$(document).ready(function() {

	function fitBackground() {
		var x,y;
		
		if (self.innerHeight) {
			x = self.innerWidth;
			y = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			// IE 6 Strict Mode
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		} else if (document.body) {
			 // other Explorers
			 x = document.body.clientWidth;
			 y = document.body.clientHeight;
		}
		
		var iwidth=1155;
		var iheight=740;
		var modX = x/iwidth;
		var modY = y/iheight;
		
		if (modX>modY) {
			iwidth=(iwidth*modX);
			iheight=(iheight*modX);
		} else {
			iwidth=(iwidth*modY);
			iheight=(iheight*modY);
		}
		
		$("#background").attr("width",iwidth);
		$("#background").attr("height",iheight);
	}

	// Fit the background proportionally
	fitBackground();

	$(window).resize(function() {
	   	// Change the image proportions when rescaling the browser window
		fitBackground();
	});
});

