(function($) {
	$.fn.floater = function() {
	
		return this.each(function() {
	
			var $obj 				= $(this);
			var $container			= $obj.parent();
			var opts 				= null;
			var maxTop				= 0;
			var maxBot				= $container.height();
			var start				= $container.offset().top;
			var padTop				= 30;
			
			$obj.css({ position: 'absolute', top: 0 });
			$container.css({ position: 'relative' });
			
			$(window).scroll(function(evt) {
			
				var scroll = $(window).scrollTop() - start + padTop;
				var bottomPos = scroll + $obj.height();
					
			    if (scroll >= 0 && bottomPos < maxBot)
			        $obj.css({ top: scroll, bottom: 'auto' });
			    else if (scroll < 0)
			        $obj.css({ top: 0, bottom: 'auto' });
			    else if (bottomPos >= maxBot)
			        $obj.css({ top: 'auto', bottom: 0 });
			   
			
			});
			
		});
		
	};
	
})(jQuery);