$(function(){
	$('#footer').easyStickyFooter();
});

(function($){
  $.fn.easyStickyFooter = function(options) {  
  
	//set up default options 
	var defaults = { 
		
	}; 

	var opts = $.extend({}, defaults, options); 	

    return this.each(function() {  
		
		$this = $(this);

		origFooterHeight = $this.height();
		
		calcNewFooterHeight();
				
		$(window).resize(function(){
			$this.css('height', origFooterHeight+"px");
			calcNewFooterHeight();
		})
			
    });

	function calcNewFooterHeight(){
	
		windowHeight = $(window).height();
		bodyHeight = $('body').height();
		
		if (bodyHeight < windowHeight) {
			var footerHeight = origFooterHeight + (windowHeight - bodyHeight);
			$this.css('height', footerHeight+"px");
		} else {
			$this.css('height', origFooterHeight+"px");
		}
	}	

  };

})(jQuery);

