var bgImg = document.getElementById('bgimg');
bgImg.setAttribute("onload", "resize();");
document["body"].setAttribute("onresize", "resize();");
setTimeout("resize()", 2000);
function resize() {
	bgImg["style"]["visibility"] = "visible";
	var h = w = 0;	
	if (window["innerHeight"]) { // Firefox
		h = window["innerHeight"];
		w = window["innerWidth"];
	} else if (document["body"]["scrollHeight"] > document["body"]["offsetHeight"]) { // all but Explorer Mac
		h = document["body"]["scrollHeight"];
		w = document["body"]["scrollWidth"];
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		h = document["body"]["offsetHeight"];
		w = document["body"]["offsetWidth"];
	}
	var ratioW = w / bgImg["width"];	
	var ratioH = h / bgImg["height"];
	if(ratioW > ratioH) {
		bgImg["height"] = w * bgImg["height"]/bgImg["width"];
		bgImg["width"] = w;
	} else {
		bgImg["height"] = h;
		bgImg["width"] = h*bgImg["width"]/bgImg["height"];
	}
}