var bgImage;
var bgWidth;

function setBG() {
	if (bgImage != "" && bgWidth > 0) {
		myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		} else {
		if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else {
			if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
				}
			}
		}

		//1024px is the overall width of the site including browser borders
		//We triple the width of the background image to make sure the site will still look centered
		if ((myWidth - (bgWidth * 3) - 1024) > 0) {
			document.getElementById("Body").style.background = "url(/portals/ab0ad4d7-310f-4e47-a2a4-18a0f0227577/skins/valice/images/" + bgImage + ") repeat-y";
		} else if ((myWidth - (24 * 3) - 1024) > 0) {
			document.getElementById("Body").style.background = "url(/portals/ab0ad4d7-310f-4e47-a2a4-18a0f0227577/skins/valice/images/side_bg_default.png) repeat-y";
		} else {
			document.getElementById("Body").style.background = "";
		}
	}
}

function initBG() {
	window.onresize = setBG;
	setBG();
}
