function resizeBg() {
	
	var affiliateNavigation = document.getElementById("affiliateNavigation");
	var bg = document.bg;
	var h = bg.offsetHeight;
	var w = bg.offsetWidth;
	var imageRatio = w / h;
	var maxHeight;
	
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		maxHeight = window.innerHeight - bg.offsetTop;
		
	  } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		maxHeight = document.documentElement.clientHeight - bg.offsetTop;
		
	  } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		maxHeight = document.body.clientHeight;
		
	  }
	
	var maxWidth = document.body.offsetWidth;
	var windowRatio = maxWidth / maxHeight;
	
	
		if (imageRatio > windowRatio) {
			
			var newWidth = w * maxHeight / h;
		
			bg.style.height = maxHeight + "px";
			bg.style.width = newWidth + "px";
			bg.style.overflowX = "hidden";
			
			bg.style.left = (newWidth / -2) + (maxWidth / 2) + "px";
			
		} else {
		
			var newHeight = h * maxWidth / w;
			bg.style.height = Math.floor(newHeight) + "px";
			bg.style.width = maxWidth + "px";
			
			bg.style.left = 0 + "px";
		
		}
		
	bg.style.display = "block";	
}
