(function($) {

    $.scrollFollow = function(element, options) {

        var defaults = {
            foo: 'bar',
            onFoo: function() {}
        }

        var plugin = this;

        plugin.settings = {}

        var $element = $(element),
             element = element;

        plugin.init = function() {
            plugin.settings = $.extend({}, defaults, options);
            // code goes here
        }

        plugin.foo_public_method = function() {
            // code goes here
        }

        var foo_private_method = function() {
            // code goes here
        }

        plugin.init();

    }

    $.fn.scrollFollow = function(options) {

        return this.each(function() {
            if (undefined == $(this).data('scrollFollow')) {
                var plugin = new $.scrollFollow(this, options);
                $(this).data('scrollFollow', plugin);
            }
            
            var el = $(this);
			var elpos = el.offset().top;
			$(window).scroll(function () {
			    var y = $(this).scrollTop();
			    if(y<elpos) {
			    	el.stop().animate({'top':0},500);
			    } else { 
			    	el.stop().animate({'top':y-elpos+10},500);
			    }
			});
        });

    }

})(jQuery);
