﻿if (screen.availWidth >= 1024) {
	var vbLeft = document.getElementById("verticalBannerLeft"), vbRight = document.getElementById("verticalBannerRight");
	var xmlHttp = getXmlHttpObject();

	//הצג את הבאנר
	positionVerticalBanner();
	window.onresize = positionVerticalBanner;
}

//ממקמת את הבאנר האנכי תוך התחשבות בגודל החלון
function positionVerticalBanner() {
	var 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;
	}

	if (myWidth >= 950) {
		//טעינת הבאנר אם יש צורך
		if (vbLeft.innerHTML == "") {
			xmlHttp.onreadystatechange = function() {
				if (xmlHttp.readyState == 4) vbLeft.innerHTML = xmlHttp.responseText;
			};
			xmlHttp.open("GET", "/includes/verticalBanner.asp?personalArea=1&r="+Math.random(), true);
			xmlHttp.setRequestHeader("Content-Type", "text/html; charset=UTF-8");
			xmlHttp.setRequestHeader("Content-Language", "he");
			xmlHttp.send(null);
		}

		document.body.style.paddingLeft = "160px";
        vbLeft.style.top = Math.round((myHeight-600)/2)+"px";
		vbLeft.style.display = "block";

		//הוספת הבאנר הימני אם יש מקום
		if (myWidth >= 1110) {
			document.body.style.paddingLeft = "0px";
	        vbRight.style.top = Math.round((myHeight-600)/2)+"px";
			vbRight.style.display = "block";
		}
		else
			vbRight.style.display = "none";
	}
	else {
		vbLeft.style.display = "none";
		vbRight.style.display = "none";
		document.body.style.paddingLeft = "0px";
	}
}