// צריך להיות זהה לצד שרת בקובץ הפונקציות
var count=0; //מספר החלפות
var sZones = "";
var HebsZones = "";
var sIDs = "";
var aIDs = []
function Final()
{
	aIDs = sIDs.split(",");
	iCountry = sCountry=="IL"?1:2;
	url="http://click.inn.co.il/infojs2.php?c="+iCountry+"&zones_list=" + sZones
	var scriptElem = document.createElement('script');
	scriptElem.setAttribute('src',url);
	document.getElementsByTagName('head')[0].appendChild(scriptElem);

	
	if (HebsZones=="77"){
		url="http://click.inn.co.il/infojs.php?&zones_list=" + HebsZones + "&"+new Date().getTime();
		var scriptElem2 = document.createElement('script');
		scriptElem2.setAttribute('src',url);
		document.getElementsByTagName('head')[0].appendChild(scriptElem2);
	}
	
	if (count<5){window.setTimeout(Final,70000); count++;}
}

function InsertBad(i,bid,cid,zone,type,url,file,ver,height,width) {
	newurl = "http://click.inn.co.il/phpA"+"dsNew-en-new/a"+"d";
	newurle = ".php?bannerid="+bid+"&zoneid="+zone+"&clientid="+cid+"&dest="+url;
	fileurl ='http://click.inn.co.il/info_en/'+file;
	clickurl= newurl+"click"+newurle;
	logurl= newurl+"log"+newurle;
	if (zone==77) {
              	i=3;newurl = "http://click.inn.co.il/phpA"+"dsNew/a"+"d";
								fileurl ='http://click.inn.co.il/info_he/'+file;
	             }
	code="";
	switch (type) {
		case "jpeg":case "png":case "gif":
		code="<a href="+clickurl+"><img width="+width+" height="+height+" src="+fileurl+"></a>";
		break;
		case "swf":
		fileurl += "?alink1="+escape(clickurl)+"&atar1=_blank"
		code = "<OBJECT codeBase=http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 height="+height+" width="+width+" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME=Movie VALUE='"+fileurl+"'><PARAM NAME=Src VALUE='"+fileurl+"'><PARAM NAME=WMode VALUE=Transparent><PARAM NAME=Menu VALUE=-1><PARAM NAME=AllowScriptAccess VALUE=never><PARAM NAME=AllowFullScreen VALUE=false><embed src='"+fileurl+"' quality=high wmode='transparent' width='"+width+"' height='"+height+"' type='application/x-shockwave-flash' pluginspace='http://www.adobe.com/go/getflashplayer' allowScriptAccess='never'></embed></OBJECT>";	break;
		case "html":
		code=file;
	}
	code+="<img src="+logurl+"&"+new Date().getTime()+" style=display:none>";
	try {
	document.getElementById(aIDs[i]).innerHTML = code; } catch(e) {/*alert(i +" "+ sIDs)*/}
}
function CheckHiRes() {
	div = document.getElementById("divHiRes");
	if (div) {
		if(document.body.clientWidth<970) {div.style.visibility = "hidden";reload=true;}
		else {
			if(document.body.clientHeight<800) div.style.marginTop = Math.floor(document.body.clientHeight/2)-300+"px";
			if (!adLoaded) {
				adLoaded=true;
				if (reload){try{sZones='67';sIDs='divHiRes';Final();reload=false;}catch(e){}} //טוען מחדש
				else {sZones+=',67';sIDs+=',divHiRes';}
			}
			div.style.visibility="visible";
			
		}
	}
}
function CheckHiRes_2() {
div = document.getElementById("divHiRes_2");
	if (div) {
              HebsZones='77';sIDs+=',divHiRes_2';
              }
}

