	 function WindowWidth () {
	  if (window.innerWidth) {
		return window.innerWidth;
	  } else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	  } else {
		return 0;
	  }
	}

	function WindowHeight () {
	  if (window.innerHeight) {
		return window.innerHeight;
	  } else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	  } else {
		return 0;
	  }
	}			

	var resizeImageId="BackgroundImage";
	
	function bgimagecheck()
	{	
		var window_height = WindowHeight();
		var window_width  = WindowWidth();
		var resize_image = document.getElementById(resizeImageId);
		if (resize_image!=null && window_height>0 && window_width >0)
		{
			var resizeImageWidth = resize_image.width;
			var resizeImageHeight = resize_image.height;
			
			var height_ratio  = resizeImageHeight / window_height;
			var width_ratio   = resizeImageWidth / window_width;
			if (height_ratio < width_ratio)
			{
				resize_image.style.width = "auto";					
				resize_image.style.height = window_height+"px";				
			}	
			else
			{					
				resize_image.style.width = window_width+"px";
				resize_image.style.height = "auto";									
			}			
			resize_image.style.display="block";
		}		
	}
	
	window.onresize=bgimagecheck;
	window.setInterval("bgimagecheck()", 100);