if (!Array.prototype.filter){Array.prototype.filter = function(fun){var len = this.length;if (typeof fun != "function"){throw new TypeError();}var res = new Array();var thisp = arguments[1];for (var i = 0; i < len; i++){if (i in this){var val = this[i];if (fun.call(thisp, val, i, this)){res.push(val);}}}return res;};}
var searchCodeCity;
function isLocalCity(element, index, array) {if(element.codice==searchCodeCity){return true;}else{return false;}}

var arrLocalGeneric =[{"citta":"roma","codice":"058091"},{"citta":"milano","codice":"015146"},{"citta":"torino","codice":"001272"},{"citta":"bologna","codice":"037006"},{"citta":"firenze","codice":"048017"},{"citta":"genova","codice":"010025"},{"citta":"napoli","codice":"063049"},{"citta":"palermo","codice":"082053"}];
RotatorFade=function(strId,numEl,delay,colorStart,colorEnd){this.id=strId;this.numEl=numEl;this.delay=delay;this.n=1;this.rotatorCounter=null;this.colorStart=colorStart;this.colorEnd=colorEnd;this.startRotate();}
RotatorFade.prototype={changeRot:function(){var nOld=this.n;this.n=this.n+1;if(this.n>this.numEl){this.n=1};try{document.getElementById(this.id+"_"+nOld).style.display="none";}catch(e){};try{var objFade=new Fade(this.id+"Fade",this.colorStart,this.colorEnd);objFade.colorfade(1);document.getElementById(this.id+"_"+this.n).style.display="block";}catch(e){};this.startRotate();},startRotate:function(){var objRotatorTimeout=this;var returns=function(){return objRotatorTimeout.changeRot();};this.rotatorCounter=setTimeout(returns,this.delay);}}
function MM_jumpMenu(targ,selObj,restore){if(selObj.options[selObj.selectedIndex].value!=''&&selObj.selectedIndex!='0'){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");}if(restore){selObj.selectedIndex=0;}}
function validateDate(fld){var RegExPattern=/^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;if((fld.value.match(RegExPattern))&&(fld.value!='')){return true;}else{fld.focus();return false;}}
function fieldNoEmpty(fld){if(fld.value!=""){return true;}else{fld.focus();return false;}}
function addEventOnLoad(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,true);return true;}else{if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}}
function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");}
function getCookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}return"";}
var GenioJS={utf8encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}return utftext;}}
var arrOroscopo=new Array("Ariete","Toro","Gemelli","Cancro","Leone","Vergine","Bilancia","Scorpione","Sagittario","Capricorno","Acquario","Pesci");
function loadOroscopo(){strSegno=arrOroscopo[Math.floor(Math.random()*12)];document.getElementById("segnoOroscopo").innerHTML=strSegno;document.getElementById("segnoOroscopo").href="http://oroscopo.virgilio.it/oroscopogiorno/"+strSegno.toLowerCase()+".html";}
function loadOroscopoLocal(){
var strSegno=getCookie("segno");
if (strSegno==""){strSegno=arrOroscopo[Math.floor(Math.random()*12)].toLowerCase();}
document.getElementById("ifrOroscopo").src="/tech_includes/box_oroscopo_iframe.html?"+strSegno;
}
function validateFrmDivertirsi(){if(fieldNoEmpty(document.getElementById("cercaDivertirsi")))
{document.frmDivertirsi.submit();}
else
{alert("ATTENZIONE! Inserire il nome di un film, prima di effettuare la ricerca.");}
return false;}
function validateFrmSapere(){if(fieldNoEmpty(document.getElementById("cercaSapere")))
{document.frmSapere.submit();}
else
{alert("ATTENZIONE! Inserire una parola, prima di effettuare la ricerca.");}
return false;}
function validateFrmViaggiare(){if(fieldNoEmpty(document.getElementById("CityName"))){if((validateDate(document.getElementById("InDate")))&&(validateDate(document.getElementById("OutDate"))))
{document.frmViaggiare.submit();}
else
{alert("ATTENZIONE! Inserire delle date valide, prima di effettuare la ricerca.");}}
else
{alert("ATTENZIONE! Inserire una città, prima di effettuare la ricerca.");}
return false;}
Fade=function(idDiv1,colorStart,colorEnd)
{this.idDiv1=document.getElementById(idDiv1);this.maxsteps=30;this.stepdelay=40;if(colorStart!=null){this.startcolor=colorStart;}else{this.startcolor=new Array(0,0,0)}
if(colorEnd!=null){this.endcolor=colorEnd;}else{this.endcolor=new Array(255,255,255)}
this.fadelinks=1;this.fadecounter;}
Fade.prototype={linkcolorchange:function(step)
{if(this.idDiv1!=null)
{var obj=this.idDiv1.getElementsByTagName("A");if(obj.length>0)
{for(i=0;i<obj.length;i++)
{obj[i].style.color=this.getstepcolor(step);}}}},colorfade:function(step)
{if(step<=this.maxsteps)
{if(this.idDiv1!=null)
{this.idDiv1.style.color=this.getstepcolor(step);if(this.fadelinks)
{this.linkcolorchange(step);}}
step++;var objFadeTimeout=this;var returns=function(){return objFadeTimeout.colorfade(step);};this.fadecounter=setTimeout(returns,this.stepdelay);}
else
{clearTimeout(this.fadecounter);if(this.idDiv1!=null)
{this.idDiv1.style.color="rgb("+this.endcolor[0]+", "+this.endcolor[1]+", "+this.endcolor[2]+")";}}},getstepcolor:function(step)
{var diff;var newcolor=new Array(3);for(var i=0;i<3;i++)
{diff=(this.startcolor[i]-this.endcolor[i]);if(diff>0)
{newcolor[i]=this.startcolor[i]-(Math.round((diff/this.maxsteps))*step);}
else
{newcolor[i]=this.startcolor[i]+(Math.round((Math.abs(diff)/this.maxsteps))*step);}}
return("rgb("+newcolor[0]+", "+newcolor[1]+", "+newcolor[2]+")");}}
var arrLcl;var lclDomain="";var lclLongCity="";function loadLocal(){var lclCity = getCookie("vlocal_city");lclCity=lclCity.replace("city()_idcity()_provincia()_idprovincia()_hostcity()_regione()","");if (lclCity!=""){arrLcl = lclCity.split("_");arrLcl[0]=decodeURI(arrLcl[0].replace("city(","").replace(")",""));arrLcl[1]=arrLcl[1].replace("idcity(","").replace(")","");arrLcl[2]=arrLcl[2].replace("provincia(","").replace(")","");arrLcl[3]=arrLcl[3].replace("idprovincia(","").replace(")","");if (lclCity.indexOf("hostcity")!=-1){arrLcl[4]=arrLcl[4].replace("hostcity(","").replace(")","");lclDomain="http://"+ arrLcl[4] + ".virgilio.it";arrLcl[5]=arrLcl[5].replace("regione(","").replace(")","");arrLcl[4]=arrLcl[5];}else{arrLcl[4]=arrLcl[4].replace("regione(","").replace(")","");lclDomain="http://"+ arrLcl[0].replace(/à/g,"a").replace(/è/g,"e").replace(/é/g,"e").replace(/ì/g,"i").replace(/ò/g,"o").replace(/ù/g,"u").replace(/ /g,"-").replace(/'/g,"") + ".virgilio.it";}}}
function loadLocalBox(){if(lclDomain!=""){document.getElementById("lclCitta").href=lclDomain;document.getElementById("lclCittaEntra").href=lclDomain;document.getElementById("lclCitta").innerHTML="<span>Virgilio -</span> " + arrLcl[0];document.getElementById("meteoGeneric").style.display="none";}}
function loadLocalHeader(){
if(lclDomain!=""){
	lclLongCity = arrLcl[0];
	if (arrLcl[0].length>25){
		arrLcl[0] = arrLcl[0].substring (0, arrLcl[0].lastIndexOf(' ',24)) + "...";
		}
	searchCodeCity=arrLcl[1];
	var arrCityVip = arrLocalGeneric.filter(isLocalCity);
	if (arrCityVip.length==0){
		document.getElementById("localHeader").src = "/tech_includes/ifr_local_2009.html?"+arrLcl[1];
		//document.getElementById("lclLinkVgeneric").style.display="none";
		//document.getElementById("lclContainer").className="localHD-S";
	}else{
		document.getElementById("localHeader").src = "/tech_includes/ifr_local_2009_vip.html?"+arrLcl[1];
	}
/*
if (arrLcl[0].substr(0,1)==arrLcl[0].substr(0,1).toUpperCase())
    {document.getElementById("lclLinkTitle").style.textTransform="none";}
    else{document.getElementById("lclLinkTitle").href=document.getElementById("lclLinkTitle").href+"?ckset=ok";}
*/
}else{
	document.getElementById("localHeader").src = "/tech_includes/ifr_local_2009_generic.html";
}
}
function annunciLocal(strCategory){var linkCategory="";if(strCategory!=""){linkCategory="?category="+strCategory;}document.location.href=lclDomain + "/annuncilocali" + linkCategory;return false;}
function rsRefresh(){
window.location.href='/?refresh_ce';
}
