// JavaScript Document

function bgResize() {
			// The current aspect ratio of the window
		var browserHeight, browserWidth;
		window.innerHeight ? (browserHeight = window.innerHeight) : (browserHeight = document.body.offsetHeight);
		window.innerWidth ? (browserWidth = window.innerWidth) : (browserWidth = document.body.offsetWidth);	

		var winAR = browserWidth / browserHeight;
		var imgRatio = document.getElementById("bgImg").width / document.getElementById("bgImg").height;
		if (winAR >= imgRatio){
			document.getElementById("bgContainer").className = "wide";
			var imgHeight = document.getElementById("bgImg").height;
			var topM = -((imgHeight - browserHeight)/2);
			document.getElementById("bgImg").style.margin=topM + "px 0px 0px 0px";
		}
		
		else if (winAR < imgRatio){
			document.getElementById("bgContainer").className = "tall";
			var imgWidth = document.getElementById("bgImg").width;
			var leftM = -((imgWidth - browserWidth)/2);
			document.getElementById("bgImg").style.margin= "0px 0px 0px " + leftM + "px";
		}
		
	function marginCalculator(){
		
			
	}
	
};

//window.onload = bgResize;
window.onresize = bgResize;


