
arImmCat=new Array();
arImmCat.push(new Array(1,"Nuova costruzione","New construction"));
arImmCat.push(new Array(3,"Monolocale","One-room"));
arImmCat.push(new Array(4,"Appartamento","Flat"));
arImmCat.push(new Array(5,"Attico","Top-flat"));
arImmCat.push(new Array(6,"Mansarda",""));
arImmCat.push(new Array(7,"Immobile di prestigio",""));
arImmCat.push(new Array(8,"Casa Bi/Trifamiliare",""));
arImmCat.push(new Array(9,"Casa indipendente",""));
arImmCat.push(new Array(10,"Porzione di casa",""));
arImmCat.push(new Array(11,"Baita/Chalet/Trullo",""));
arImmCat.push(new Array(12,"Villa",""));
arImmCat.push(new Array(13,"Villetta a schiera",""));
arImmCat.push(new Array(14,"Rustico/Casale",""));
arImmCat.push(new Array(15,"Terratetto/Terracielo",""));
arImmCat.push(new Array(16,"Stabile/Palazzo","Building"));
arImmCat.push(new Array(17,"Bungalow",""));
arImmCat.push(new Array(18,"Cantina/Solaio",""));
arImmCat.push(new Array(19,"Garage/Box auto",""));
arImmCat.push(new Array(20,"Loft","Loft"));
arImmCat.push(new Array(21,"Negozio","Shop"));
arImmCat.push(new Array(22,"Ufficio","Office"));
arImmCat.push(new Array(23,"Magazzino",""));
arImmCat.push(new Array(24,"Capannone",""));
arImmCat.push(new Array(25,"Laboratorio",""));
arImmCat.push(new Array(26,"Attivit&agrave;/Licenza comm",""));
arImmCat.push(new Array(27,"Show room","Show room"));
arImmCat.push(new Array(28,"Cessazioni di aziende",""));
arImmCat.push(new Array(29,"Locale commerciale",""));
arImmCat.push(new Array(30,"Terreno",""));
arImmCat.push(new Array(31,"Terreno industriale",""));
arImmCat.push(new Array(32,"Terreno agricolo",""));
arImmCat.push(new Array(33,"Terreno edificabile",""));

//banner

function crBnn(ppBnnR,iNumLstMod,id){
	var thi=this;
	this.obj=_gel("bnn_"+id+"_"+iNumLstMod);
	if(!this.obj) return;
	this.ppBnnR=ppBnnR.slice(1,-1).replace("|",",");
	this.iNumLstMod=iNumLstMod;
	this.id=id;
	this.chgBnn=function(ppBnnR,iNumLstMod,id){
		thi.ajaxCall(thi.xmlHttp,thi.url,function(){
			if(thi.xmlHttp.readyState==4){
				//alert(thi.xmlHttp.responseText);
				if(thi.xmlHttp.responseText=="NO") return;
				var ar=ppArr(thi.xmlHttp.responseText,"\1");
				var obj=_gel(thi.obj.id);
				obj.id="bann_"+ar[0]+"_"+thi.iNumLstMod;
				obj.src=ar[2];
				obj.alt=obj.title=ar[3];//+lang
				return;
			}
		});
		var t=setTimeout(thi.chgBnn,60000);
	}
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if (thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return;
	this.url="cms/php/ajBnn.php?_a=1&pp="+this.ppBnnR+"&id="+this.id+"&_nc="+Math.random();
	this.ajaxCall=function(obj,url,func){
		obj.onreadystatechange=func;
		obj.open("GET",url,true);
		obj.send(null);
	}
	var t=setTimeout(thi.chgBnn,60000);
}

function bnnClck(obj){
	if(!obj) return;
	var thi=this;
	var ar=obj.id.split("_");
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if (thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return;
	this.url="cms/php/ajBnn.php?_a=2&id="+ar[1]+"&_nc="+Math.random();
	this.ajaxCall=function(obj,url,func){
		obj.onreadystatechange=func;
		obj.open("GET",url,true);
		obj.send(null);
	}
	this.ajaxCall(thi.xmlHttp,thi.url,function(){
		if(thi.xmlHttp.readyState==4){
			//alert(thi.xmlHttp.responseText);
			if(thi.xmlHttp.responseText=="NO") return;
		}
	});
}
//fine banner

function gestLst(obj){
	var id=obj.id.split("_");
	id=id[1];
	var objDiv=document.getElementById("div_"+id);
	if(objDiv.style.height=="auto"){
		objDiv.style.height="0px";
		obj.className="lstC";
	}else{
		objDiv.style.height="auto";
		obj.className="lstO";
	}
}
function ajNxtSrc(szNm,idUsr,idDoc,idSez,szSrc,iCCW,iPag,szArgs,lstNumRec,_sf,_so){
	var objModRic=_gel("divSez_"+idDoc+"_"+idSez);
	if(!objModRic) return;
	objModRic.innerHTML="<img src=\"docs/img/loader.gif\" />"
	new ajSrc(szNm,idUsr,idDoc,idSez,szSrc,iCCW,iPag,szArgs,lstNumRec,_sf,_so);
}
/*
function objLst(obj){
	obj.style.backgroundImage=(obj.style.backgroundImage=="none" || obj.style.backgroundImage=="")?'url(docs/img/sfw10.png)':'none';
}
*/
var ftSel=0;
var arFoto=new Array();
function sFoto(szNome,szDescr){ this.szNome=szNome; this.szDescr=szDescr; }

function ajSrc(szNm,idUsr,idDoc,idSez,szSrc,iCCW,iPag,szArgs,lstNumRec,_sf,_so){
	var thi=this;
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if (thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return;
	this.ajaxCall=function(obj,args,func){
		var url="cms/php/ajSrc.php?_x=src&_args="+args+"&_l="+cmsLang+"&_nc="+Math.random();
		obj.onreadystatechange=func;
		obj.open("GET",url,true);
		obj.send(null);
	}
	this.ajaxCall(this.xmlHttp,idUsr+"\1"+idDoc+"\1"+idSez+"\1"+szSrc+"\1"+iPag+"\1"+szArgs+"\1"+iCCW+"\1"+lstNumRec+"\1"+_sf+"\1"+_so,function(){
		//alert(lstNumRec);
		if(thi.xmlHttp.readyState==4){
			//alert(thi.xmlHttp.responseText);
			var objModRic=_gel("ricerca");
			var objModSez=_gel("divSez_"+idDoc+"_"+idSez);
			var objVwAll=_gel("vwAll");
			if(thi.xmlHttp.responseText=="NO" || thi.xmlHttp.responseText=="NORES" || !thi.xmlHttp.responseText){
				objDivAlrt=_cel("div");
				objDivAlrt.className="divMsgAlrt";
				//var szMsg=gestMSG("noRes");
				if(!objVwAll){
					objDivAlrt.innerHTML=szNm+": "+gestMSG("noRes");
					objModRic.parentNode.insertBefore(objDivAlrt,objModRic);
				}else{
					//objDivAlrt.innerHTML=szMsg;
					objVwAll.className="divMsgAlrt";
					objVwAll.innerHTML=gestMSG("noCmt");
					objModSez.innerHTML="";
					//objModSez.appendChild(objDivAlrt);
				}
				return false;
			}
			var ar3=thi.xmlHttp.responseText.split("\3");
			
			var ar=ajaxAr(ar3[1]);
			var sz="";
			var kk=1;
			var szArFoto="";
			var szJs="";
			for(var i=0;i<ar.length;i++){
				//var idS=(ar[i][3]>0)?ar[i][3]:ar[i][1];
				var idS=ar[i][1];
				var szUrl="index.php?__fidSez="+idS+"&cnt="+ar[i][0]+"&_w="+idUsr
				//0     1     2  3  4   5   6   7   8
				//intID idSez td ft tit sub txt ftd dt
				
				ar[i][8]=(ar[i][8])?dtPrnt(ar[i][8].substr(0,10))+" "+ar[i][8].substr(11,8)+" - ":"";
				switch(idDoc){
					case 1://articoli
					case 2://foto
					case 5://home
					case 10://news
					case 12://video
					case 13://eventi
					case 14://prodotti
					case 15://immobili
						if(idDoc==2&&ar[i][2]==2){
							var szFtB=ar[i][3].replace("_T","_N");
							sz+="<div class=\"modLstImg\"><div class=\"fLstCnt\"><img src=\""+ar[i][3]+"\" alt=\""+ar[i][7]+"\" title=\""+ar[i][7]+"\" onclick=\"viewImg('"+szFtB+"')\" /></div><div class=\"phLstD\"><a href=\""+szUrl+"\">>></a></div></div>";
							arFoto.push(new sFoto(szFtB,ar[i][7]));
							kk++;
							if(iCCW/(kk*140)<1){
								kk=1;
								sz+="<div class=\"clear\"></div>";
							}
							break;
						}
						if(idDoc==10) szUrl+="&__fnws=1";
						/*
						if(idDoc==13){
							//var arT=ar[i][5].split("|");
							ar[i][9]=dtPrnt(ar[i][9]);
						}
						*/
						sz+="<div class=\"modLst\">";
						if(ar[i][4]) sz+="<div class=\"lstTit\"><a href=\""+szUrl+"\">"+ar[i][8]+ar[i][4]+"</a></div>";//tit
						sz+="<div class=\"vs4\"></div>";
						if(ar[i][5]) sz+="<div class=\"lstSub\">"+ar[i][5]+"</div>";//subtit
						if(ar[i][3]){
							if(idDoc==12){
								var arV=ppArr(ar[i][3]);
								sz+="<div class=\"phLst\"><img src=\"http://i.ytimg.com/vi/"+arV[0]+"/default.jpg\" alt=\""+ar[i][4]+"\" title=\""+ar[i][4]+"\" style=\"width:80px;height:60px;\" /></div>";
							}else sz+="<div class=\"phLst\"><img src=\""+ar[i][3]+"\" alt=\""+ar[i][8]+"\" title=\""+ar[i][7]+"\" /></div>"
						}
						sz+="<div class=\"float\" style=\"width:"+(iCCW-140)+"px;\">"+ar[i][6]+"</div>";
						sz+="<div class=\"clear\"></div></div><div class=\"clear\"></div>";
						break;
					case 3://links
						sz+="<div class=\"modLst\"><div class=\"lstTit\"><a href=\""+ar[i][4]+"\" target=\"blank\">"+ar[i][4].replace("http://","")+"</a></div><div class=\"lstSub\">"+ar[i][5]+"</div></div>";
						break;
					case 100://commenti
						sz+="<div class=\"modLstCmt\">";
						if(ar[i][4]){
							//var arT=ar[i][5].split("|");
							//ar[i][5]=dtPrnt(arT[0].substr(0,10))+" "+arT[0].substr(11,8)+" - "+arT[1];
							sz+="<div class=\"lstTit\"><a href=\""+szUrl+"\">"+ar[i][8]+ar[i][4]+"</a></div>";//Nome e data
						}
						if(ar[i][5]) sz+="<div class=\"lstSub\">"+ar[i][5]+"</div>";//commento
						sz+="<div class=\"clear\"></div></div><div class=\"clear\"></div>";
						break;
				}				
				var szPagin=(ar3[2])?ar3[2]:"";
				var szFltr=(ar3[3])?ar3[3]:"";
			}
			sz+="<div class=\"clear\"></div>";
			if(szPagin>"") sz=szFltr+sz;
			sz+=szPagin+"<div class=\"vs20\"></div>";
			//var objModSez=_gel("divSez_"+idDoc+"_"+idSez);
			if(!objModSez){
				var szMod="<div class=\"riepHome\">"+szNm+"</div><div id=\"lstTotRec_"+idDoc+"_"+idSez+"\">"+ar3[0]+"</div><div class=\"clear\"></div><div id=\"divSez_"+idDoc+"_"+idSez+"\">"+sz+"</div>";
				objDiv=document.createElement("div");
				objDiv.innerHTML=szMod;
				objModRic.appendChild(objDiv);
			}else{
				_gel("lstTotRec_"+idDoc+"_"+idSez).innerHTML=ar3[0];
				objModSez.innerHTML=sz;
			}
			if(objVwAll) objVwAll.innerHTML="";
		}
	});
}
function cmpOK(idCmp){
	var obj=_gel("cnttNm_"+idCmp);
	if(!obj) return true;
	obj.style.color="";
	obj.style.fontWeight="normal";
	return true;
}
function cmpErr(idCmp){
	var obj=_gel("cnttNm_"+idCmp);
	if(!obj) return false;
	obj.style.color="#f00";
	obj.style.fontWeight="bold";
	return false;
}
function chkFrm(nmFrm){
	var obj=document.forms["fs_"+nmFrm];
	var b=true;
	for(var i=0;i<obj.length;i++){
		var objC=obj.elements[i];
		if(objC.id.indexOf("cnttIn_")==-1) continue;
		var ar=objC.id.split("_");
		var objO=_gel("cnttIn_o_"+ar[1]);
		var objT=_gel("cnttIn_t_"+ar[1]);
		if(objO&&objT){
			switch(parseInt(objT.value)){
				default:
					if(objO.value==1&&objC.value=="") b=b&&cmpErr(ar[1]);
					else b=b&&cmpOK(ar[1]);
					break;
				case 6://email
					if(objC.value>""){
						if(!isEmail(objC.value)) b=b&&cmpErr(ar[1]);
						else b=b&&cmpOK(ar[1]);
					}else{
						if(objO.value==1) b=b&&cmpErr(ar[1]);
						else b=b&&cmpOK(ar[1]);
					}
					break;
				case 4:
					var ar=objC.id.split("_");
					var objR=obj.elements[ar[0]+"_"+ar[1]];
					var j=false;
					for(i=0;i<objR.length;i++) if(objR[i].checked){ j=true; break;}
					if(!j) b=b&&cmpErr(ar[1]);
					else b=b&&cmpOK(ar[1]);
					break;
				case 5:
					if(objO.value==1&&!objC.checked) b=b&&cmpErr(ar[1]);
					else b=b&&cmpOK(ar[1]);
					break;
			}
		}
		i+=3;
	}
	return b;
}
function subCmt(idSez,idCnt){
	if(!chkFrm("cmt")) return false;
	new ajCmt(idSez,idCnt);
	_gel("divCmt").innerHTML="<img src=\"docs/img/loader.gif\" />"
}
function ajCmt(idSez,idCnt){
	if(!idSez || !idCnt) return;
	//if(idCat===false) idCat=0;
	var thi=this;
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if(thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return; 
	this.url="cms/php/ajSrc.php?_x=scmt"
	this.param="is="+idSez+"&id="+idCnt+
			"&n="+encodeURI(_gel("cnttIn_strNome").value)+
			"&m="+encodeURI(_gel("cnttIn_strEmail").value)+
			"&c="+encodeURI(_gel("cnttIn_strCommento").value);
	this.ajaxCall=function(obj,url,param,func){
		obj.onreadystatechange=func;
		obj.open("POST",url,true);
		obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		obj.setRequestHeader("Content-length",param.length);
		obj.setRequestHeader("Connection","close");
		obj.send(param);
	}
	this.ajaxCall(this.xmlHttp,this.url,this.param,function(){
		if(thi.xmlHttp.readyState==4){
			if(thi.xmlHttp.responseText=="NO") sz="Errore!";
			else sz=thi.xmlHttp.responseText;
			_gel("divCmt").innerHTML=sz;
			var t=setTimeout(thi.rmCmt,3500);
		}
	});
	this.rmCmt=function(){
		new objFade(_gel("divCmt"),300,-1);
	}
}
function lstCmt(szNm,idUsr,idDoc,idSez,szSrc,iCCW,iPag,szArgs,lstNumRec,_sf,_so){
	var objModCmt=_gel("divSez_"+idDoc+"_"+idSez);
	if(!objModCmt) return;
	objModCmt.innerHTML="<img src=\"docs/img/loader.gif\" />"
	new ajSrc(szNm,idUsr,idDoc,idSez,szSrc,iCCW,iPag,szArgs,lstNumRec,_sf,_so);
}
function subMlst(bMode,szCol){
	if(!chkFrm("mlst")) return false;
	var objN=_gel("cnttIn_strNome");
	var objC=_gel("cnttIn_strCognome");
	var szN=(objN)?objN.value:"";
	var szC=(objC)?objC.value:"";
	new ajMlst(_gel("cnttIn_strEmail").value,szN,szC,szCol,bMode);
	_gel("divMlst").innerHTML="<img src=\"docs/img/loader.gif\" />"
}
function ajMlst(szMail,szNm,szCogn,szCol,bMode){
	if(!szMail || !bMode) return;
	var thi=this;
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if (thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return;
	switch(bMode){
		case 1://invio email
			this._args="_a=1&_m="+szMail+"&_col="+szCol;
			break;
		case 2://invio dati nome e cognome, privacy
			this._args="_a=2&_m="+szMail+"&_n="+szNm+"&_c="+szCogn+"&_col="+szCol;
			break;
		case 3://unsubscribe
			this._args="_a=3&_m="+szMail+"&_col="+szCol;
			break;
	}
	this.url="cms/php/mailer.php?"+this._args+"&_l="+cmsLang+"&_nc="+Math.random();
	this.ajaxCall=function(obj,url,func){
		obj.onreadystatechange=func;
		obj.open("GET",url,true);
		obj.send(null);
	}
	this.ajaxCall(this.xmlHttp,this.url,function(){
		if(thi.xmlHttp.readyState==4){
			//alert(thi.xmlHttp.responseText);
			var sz=""
			if(thi.xmlHttp.responseText=="NO") sz="Errore!";
			else sz=thi.xmlHttp.responseText;
			_gel("divMlst").innerHTML=sz;
		}
	});
}
function subSond(bMode,idUsr,icW){
	var obj=document.forms['fs_snd'].elements['cnttIn_snd'];
	var ok=-1;
	for(i=0;i<obj.length;i++) if(obj[i].checked){ ok=i; break;}
	if(bMode<3) if(ok<0) return false;
	new ajSond(ok,bMode,idUsr,icW);
	_gel("divSond").innerHTML="<img src=\"docs/img/loader.gif\" />"
}
function ajSond(iVal,bMode,idUsr,icW){
	var thi=this;
	this.isAjax=function(){//GetXmlHttpObject
		try{ thi.xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{ thi.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){ thi.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		if (thi.xmlHttp==null) return false;//no ajax
		return thi.xmlHttp;
	}
	this.xmlHttp=this.isAjax();
	if(this.xmlHttp==null) return;
	switch(bMode){
		case 1://voto
			this._args="_a=1&_w="+idUsr+"&_v="+iVal;
			break;
		case 2://invio dati nome e cognome, privacy
			this._args="_a=2&_w="+idUsr+"&_m="+szMail+"&_n="+szNm+"&_c="+szCogn;
			break;
		case 3://unsubscribe
			this._args="_a=3&_w="+idUsr+"&_m="+szMail;
			break;
	}
	this.url="cms/php/ajSrc.php?_x=snd&="+this._args+"&_l="+cmsLang+"&_iCCW="+icW+"&_nc="+Math.random();
	this.ajaxCall=function(obj,url,func){
		obj.onreadystatechange=func;
		obj.open("GET",url,true);
		obj.send(null);
	}
	this.ajaxCall(this.xmlHttp,this.url,function(){
		if(thi.xmlHttp.readyState==4){
			var sz=""
			if(thi.xmlHttp.responseText=="NO") sz="Errore!";
			else sz=thi.xmlHttp.responseText;
			_gel("divSond").innerHTML=sz;
		}
	});
}
function viewImg(szImg){
	opOsc(function(){clOsc();if(_gel("imgLoad")) document.body.removeChild(_gel("imgLoad"));if(_gel("imgEnl")) document.body.removeChild(_gel("imgEnl"));});
	var objLoad=document.createElement("img");
	objLoad.id="imgLoad";
	objLoad.className="imgLoad";
	objLoad.src="docs/img/loader.gif";
	document.body.appendChild(objLoad);
	cntrObj(objLoad,32,32);
	var iKey=arGetKey(arFoto,"szNome",szImg);
	ftSel=iKey;
	preloadImages.onComplete=function(){
		imgLoaded(preloadImages.currImgLdd.src,preloadImages.currImgLdd.width,preloadImages.currImgLdd.height);
		_gel("ftDescr").innerHTML=_gel("imgBig").title=_gel("imgBig").alt=arFoto[iKey].szDescr;
		document.body.removeChild(_gel("imgLoad"));
	}
	preloadImages.queue_images(new Array(szImg));
}
function imgLoaded(szImg,iW,iH){
	var objDiv=document.createElement("div");
	objDiv.id="imgEnl";
	objDiv.className="imgEnl";
	addEvent(objDiv,'click',function(){clOsc();if(_gel("imgLoad")) document.body.removeChild(_gel("imgLoad"));if(_gel("imgEnl")) document.body.removeChild(_gel("imgEnl"));},false);
	objDiv.innerHTML=sz="<img id=\"ftLeft\" style=\"z-index:1002;opacity:100;width:16px;\" src=\"docs/img/ftLeft.png\" onmouseover=\"imgRollOver(this)\" onmouseout=\"imgRollOver(this)\" onclick=\"ftChg(event,-1,arFoto)\"><img src=\""+szImg+"\" id=\"imgBig\" alt=\"\" width=\""+iW+"\" height=\""+iH+"\" /><img id=\"ftRight\" style=\"z-index:1003;opacity:100;width:16px;\" src=\"docs/img/ftRight.png\" onmouseover=\"imgRollOver(this)\" onmouseout=\"imgRollOver(this)\" onclick=\"ftChg(event,1,arFoto)\"><div id=\"ftDescr\" style=\"z-index:1004;width:"+iW+"px;margin-left:36px;\"></div>";
	document.body.appendChild(objDiv);
	cntrObj(objDiv,iW+92,iH+20);
	new objFade(_gel("imgBig"),300,100);
}
/*



function ftChgSel(idx,ar){
	ftSel=idx;
	imgChgHd();
	var obj=_gel("imgBig");
	preloadImages.onComplete=function(){ imgChgShw(obj,ar);}
	preloadImages.queue_images(new Array(ar[ftSel].szNome));
}
function ftScroll(iDir){
	var objScroll=_gel("imgScroll");//.offsetWidth;
	var objTab=objScroll.firstChild;//.offsetWidth;
	objTab.id="objTab";
	var dX=objTab.offsetLeft;
	var dW=objTab.offsetWidth-objScroll.offsetWidth;
	switch(iDir){
		case 1:
			if(dX>=0) return;
			var dMove=(-dX>=objScroll.offsetWidth) ? objScroll.offsetWidth : -dX;
			break;
		case -1:
			var dMove=(dW+dX>objScroll.offsetWidth) ? objScroll.offsetWidth : dW+dX;
			if(dX<-dW) return;
			break;
	}
	var xF=objTab.offsetLeft+(iDir*dMove);
	gestMove(objTab,xF,null);
}






function imgChgShw(obj,ar){
	stAlph(obj,0);
	if(_gel("imgEnl")){
		stAlph(_gel("imgEnl"),100);
		_gel("ftDescr").style.width=preloadImages.currImgLdd.width+"px";
	}
	_gel("imgLoad").parentNode.removeChild(_gel("imgLoad"));
	obj.src=preloadImages.currImgLdd.src;
	obj.style.width=preloadImages.currImgLdd.width+"px";
	obj.style.height=preloadImages.currImgLdd.height+"px";
	_gel("ftDescr").innerHTML=obj.title=obj.alt=ar[ftSel].szDescr;
	new objFade(obj,150,100);
}
function imgChgHd(){
	var iW=iH=0;
	var objEnl=_gel("imgEnl");
	if(objEnl) stAlph(objEnl,0);
	else{
		var objBig=_gel("imgBig");
		iW=parseInt(objBig.offsetLeft+objBig.offsetWidth/2);
		iH=parseInt(objBig.offsetTop+objBig.offsetHeight/2);
		stAlph(objBig);
	}
	var objLoad=document.createElement("img");
	objLoad.id="imgLoad";
	objLoad.className="imgLoad";
	objLoad.src="docs/img/loader.gif";
	document.body.appendChild(objLoad);
	if(objEnl) cntrObj(objLoad,32,32);
	else{
		objLoad.style.left=iW+"px";
		objLoad.style.top=iH+"px";
	}
}
*/



function ftChg(e,iDir,ar){
	noPropag(e);
	var thi=this;
	var ft="";
	switch(iDir){
		case 1:
			if(ftSel<ar.length-1) ftSel++; else ftSel=0;
			break;
		case -1:
			if(ftSel>0) ftSel--; else ftSel=ar.length-1;
			break;
	}
	var obj=_gel("imgBig");
	this.imgChgShw=function(obj,ar){
		var objImg=_gel("imgLoad");
		if(!objImg) return;
		stAlph(obj,0);
		if(_gel("imgEnl")){
			stAlph(_gel("imgEnl"),100);
			_gel("ftDescr").style.width=preloadImages.currImgLdd.width+"px";
		}
		objImg.parentNode.removeChild(objImg);
		obj.src=preloadImages.currImgLdd.src;
		obj.style.width=preloadImages.currImgLdd.width+"px";
		obj.style.height=preloadImages.currImgLdd.height+"px";
		_gel("ftDescr").innerHTML=obj.title=obj.alt=ar[ftSel].szDescr;
		new objFade(obj,150,100);
	}
	this.imgChgHd=function(){
		var iW=iH=0;
		var objEnl=_gel("imgEnl");
		if(objEnl) stAlph(objEnl,0);
		else{
			var objBig=_gel("imgBig");
			iW=parseInt(objBig.offsetLeft+objBig.offsetWidth/2);
			iH=parseInt(objBig.offsetTop+objBig.offsetHeight/2);
			stAlph(objBig);
		}
		var objLoad=document.createElement("img");
		objLoad.id="imgLoad";
		objLoad.className="imgLoad";
		objLoad.src="docs/img/loader.gif";
		document.body.appendChild(objLoad);
		if(objEnl) cntrObj(objLoad,32,32);
		else{
			objLoad.style.left=iW+"px";
			objLoad.style.top=iH+"px";
		}
	}
	this.imgChgHd();
	preloadImages.onComplete=function(){
		thi.cntrObj(obj.parentNode,preloadImages.currImgLdd.width+92,preloadImages.currImgLdd.height+20);
		imgChgShw(obj,ar);
	}
	preloadImages.queue_images(new Array(ar[ftSel].szNome));
}
arMove=new Array();
function gestMove(obj,xF,yF){
	if(!ppSearch(ppString(arMove),obj.id)){
		arMove.push(obj.id);
		new objMove(obj,xF,yF);
	}
}
function objMove(obj,xF,yF){
	this.obj=obj;
	this.xI=parseInt(obj.offsetLeft);
	this.yI=parseInt(obj.offsetTop);
	this.xF=xF;
	this.yF=yF;
	this.xDir=this.xF-this.xI;
	this.yDir=this.yF-this.yI;
	var thi=this;
	this.funcMove=function(){
		if(thi.xDir==0 && thi.yDir==0) return;
		if(thi.yF!=null){   
			var jmp=(thi.yF-thi.yI)/4;
			thi.yI+=jmp;
			thi.obj.style.top=thi.yI+"px";
		}
		if(thi.xF!=null) {
			var jmp=(thi.xF-thi.xI)/4;
			thi.xI+=jmp;
			thi.obj.style.left=thi.xI+"px";
		}
		if((thi.xDir>0&&thi.xI>=thi.xF-1)||(thi.xDir<0&&thi.xI<=thi.xF+1)){
			thi.obj.style.width=thi.xF+"px";
			thi.xF=null;
		}
		if((thi.yDir>0&&thi.yI>=thi.yF-1)||(thi.yDir<0&&thi.yI<=thi.yF+1)){
			thi.obj.style.top=thi.yF+"px";
			thi.yF=null;
		}
		if(thi.xF!=null || thi.yF!=null) setTimeout(thi.funcMove,41); else arRemElem(arMove,thi.obj.id);
	};
	this.funcMove(preloadImages.currImgLdd.src);
}
preloadImages={
	iNumImg:0,
	iNumLdd:0,
	onComplete:"",
	onLoaded:function(){},
	currImgLdd:"",
	arImg:[],
	arImgInc:[],
	queue_images:function(arImg){
  		this.iNumLdd=0;
  		this.arImg=[];
  		this.iNumImg=arImg.length;
  		this.arImgInc=arImg;
  		this.process_queue();
	},
	process_queue:function(){
		this.load_image(this.arImgInc.shift());
 	},
	load_image:function(image){
		var this_ref=this;
		var preload_image=new Image;
  		preload_image.onload=function(){
   			this_ref.currImgLdd=preload_image;
   			this_ref.arImg.push(preload_image);
			this_ref.iNumLdd+=1;
			(this_ref.onLoaded)();
   			if(this_ref.iNumImg==this_ref.iNumLdd) (this_ref.onComplete)(); 
			else this_ref.process_queue();
		}
		preload_image.src=image;
	}
}
preloadImages.onLoaded=function(){}
function checkMl(){
	var bM=false;
	var bC=false;
	bM=checkMail(_gel("strEmail"));
	var obj=_gel("fPrivacy");
	bC=(!obj.checked) ? inputErr(obj) : inputOk(obj);
	return bM&&bC;
}

function intRidim(hF){
	gestResize(_gel("Hd"),null,hF,intRdmCls);
}
function intRdmCls(){
	setCookie("intRdm",szUrl,24000);
	bFlC=1;
	crHd();
}
function crHd(bRvw){
	var b=false;
	if(HdFlash>""){
		if(bFlC==1){
			b=false;
			var obj=_cel("div");
			obj.id="HdRvw";
			_gel("HdCell").parentNode.insertBefore(obj,_gel("HdCell"));
			obj.innerHTML="<a href=\"javascript:crHd(1)\">play Intro</a>";
		}else b=true;
	}else b=false;
	
	if(bRvw) b=true;
	var objF=_gel("HdFlash");
	if(!objF) objF=_cel("div");
	objF.id="HdFlash";
	var objHd=_gel("Hd");
	objHd.appendChild(objF);
	if(b){
		var ar=ppArr(HdFlash);
		objHd.style.height=ar[1]+"px";
		_gel("HdFlash").innerHTML='<object width="'+ar[0]+'" height="'+ar[1]+'"><param name="movie" value="'+szPth+ar[2]+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+szPth+ar[2]+'?a='+ar[4]+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+ar[0]+'" height="'+ar[1]+'"></embed></object>';
	}else{
		objHd.removeChild(objF);
		_gel("HdTxt").innerHTML=HdTxt;
		if(HdImg>"") _gel("HdImg").innerHTML="<img id=\"HdImg\" src=\""+HdImg+"\" alt=\"\" />";
	}
}
