;(function($) {
	$.fn.floatingBox = function() 
	{
		if($(this).length == 0)
			return false;
		var box = $(this);
		var offset = $(box).offset();
		var offsetMain = $('.main').offset();
		var topPadding = 30;
		$(window).scroll(function() {
			if ($(window).scrollTop() > offset.top) {
				newMarginTop = $(window).scrollTop() - offset.top + topPadding;
				if($('.main').height() < newMarginTop + $(box).height() + 240)
					newMarginTop = $('.main').height() - $(box).height() - 240 - topPadding;
				//else
					$(box).stop().animate({
						marginTop: newMarginTop
					});
			} else {
				$(box).stop().animate({
					marginTop: 0
				});
			};
		});
	$(window).scroll();
	};
	
	$.fn.stopFloatingBox = function() 
	{
		$(window).unbind('scroll');
	};
})(jQuery);
