			$(function() {   
			var theWindow = $(window),
			    $bg = $("#bg"),
			    aspectRatio = $bg.width() / $bg.height();

			function resizeBg() {
			//$("#footer").css({"position" : "absolute","bottom":"0", "opacity" : "0.7"});
			//$(".titleClass").css("opacity","0.7")
				if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
				    $bg
				    	.removeClass()
				    	.addClass('bgheight');
				} else {
				    $bg
				    	.removeClass()
				    	.addClass('bgwidth');
				}
				
			}
			theWindow.resize(function() {
				resizeBg();
			}).trigger("resize");
		});

