
	$(document).ready( function() {
		var headerHeight = $("#header").height();
		var maxHeigh = ($("#body-wrapper").height() + headerHeight + $("#footer").height() + $("#bottom-static").height());

		if (maxHeigh > $(window).height()) {
			var bodyWrapperHeight = maxHeigh - $("#bottom-static").height();
			var bottomBackground = maxHeigh;
		
		} else{
			var bodyWrapperHeight = $(window).height() - $("#footer").height();
			var bottomBackground = ($(window).height() - $("#footer").height()) + $("#bottom-static").height();
		}

		
		$("#wrapper").css("height", bodyWrapperHeight + "px");
		$("#bottom-background").css("top", bottomBackground + "px");	

	});		

