(function($) {
	$.fn.fixedfooter = function(settings) {
		var config = {
			minDistance: 500
		};
 		if (settings) $.extend(config, settings);
		
		return this.each(function(){
			var footer = $(this);
			
			// the main update function
			var update = function() {
				footer.css('margin-bottom', Math.min(0, -config.minDistance+$(window).height()) + 'px');
			}
			
			// fire on load and on resize
			$(window).bind('load resize', update);
		});
	}
})(jQuery);

