// GLOBAL FUNCTION

//varibili per il rating
var timerID;
var myWidthOLD;
var myHeightOLD;

window.onload = function(){
	MM_preloadImages('/_images/logo_f2.gif','/_images/menuHome_f2.gif','/_images/menuChannel_f2.gif','/_images/menuContest_f2.gif','/_images/menuVideo_f2.gif','/_images/menuPhoto_f2.gif','/_images/menuPeople_f2.gif','/_images/menuMap_f2.gif','/_images/menuSearch_f2.gif','/_images/menuUpload_f2.gif');
	caricaFlashAvvio();
	initRateAct();
}

function setIframeSrc(src){
	myFrame=document.getElementById("flashback");
	if(myFrame){
		myFrame.src=src;
	}
}


function setGeo(cnt){
	if(document.getElementById("geo")) {
		document.getElementById("geo").value = cnt;
	}
}

function popupwindow(LarghezzaCont,AltezzaCont,Pagina,nome,scrol,stat) {
	var lsBrowser = navigator.appName;
	var navInfo = navigator.userAgent;
	if (scrol == "yes") {
		if (navInfo == "Mac" && lsBrowser.indexOf("Microsoft") >= 0) {
				aw = 0;
		} else {
		aw = 17;
		}		
	} else {
	aw = 0;
	}		
    var iMyWidth;
    var iMyHeight;
    var LarghezzaPagina;
    var AltezzaPagina;
    LarghezzaPagina = screen.availWidth;
    AltezzaPagina = screen.availHeight;
    LarghezzaCont=LarghezzaCont.toUpperCase()
    AltezzaCont=AltezzaCont.toUpperCase()
				
    if (LarghezzaCont == "FULL") {
            LarghezzaWindow = screen.availWidth;
        } else {
            LarghezzaWindow = parseInt(LarghezzaCont) + aw;
        }
    if (AltezzaCont == "FULL") {
            AltezzaWindow = screen.availHeight;
        } else {
            AltezzaWindow = AltezzaCont;
        }
    iMyWidth = (LarghezzaPagina/2) - (LarghezzaWindow/2);
    iMyHeight = (AltezzaPagina/2) - (AltezzaWindow/2);
    win = window.open(Pagina,nome,"height=" + AltezzaWindow + ",width="	+ LarghezzaWindow 
	+ ",menubar=0,resizable=yes,scrollbars=" + scrol + ",status=" + stat + ",titlebar=0,toolbar=0,left="
	+ iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
    win.focus();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImage2() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore2() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;width=100;
}


function openFileUpFormVideo(){
	for(var i=0;i<9;i++){
		document.getElementById("file"+i).value="";			
		if(i>0)
			chiudiDIV("file"+i+"cnt");		
	}
}

function openFileUpFormFoto(){
	for(var i=0;i<9;i++){
		document.getElementById("file"+i).value="";					
		if(i>0)
			apriDIV("file"+i+"cnt");		
	}
}

function aprichiudi(actdiv){
	if(document.getElementById(actdiv).style.display=="block"){
		document.getElementById(actdiv).style.display="none";		
	}else{
		document.getElementById(actdiv).style.display="block";
	}
}
function apriDIV(actdiv){
	document.getElementById(actdiv).style.display="block";
}

function chiudiDIV(actdiv){
		document.getElementById(actdiv).style.display="none";		
}


function azionaMenuProgramma(actdiv,str){
	for(var i=0;i<4;i++){
		if(i==actdiv){
			document.getElementById("blocco_"+i).style.display="block";
			document.getElementById("menuA"+i).innerHTML="<span class=\"menuProgrammiSel\">"+str+"</span>";
		}else{
				var tmp = document.getElementById("menuA"+i).firstChild.innerHTML;
			document.getElementById("menuA"+i).innerHTML="<a href=\"#\" onclick=\"azionaMenuProgramma("+i+",'"+tmp+"');return false;\">"+tmp+"</a>";
			document.getElementById("blocco_"+i).style.display="none";	
		}
	}

}

function apriDIVMenu(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="block";
	document.getElementById("menuA"+actdiv).setAttribute("class", "menuProgrammiSel");
}

function chiudiDIVMenu(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="none";		 	
	document.getElementById("menuA"+actdiv).setAttribute("class", "");
}

function apriDIVMenuSearch(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="block";
	if(actdiv==0){
		document.getElementById("videoChannelMenuItem0").innerHTML="<span class=\"postMenuSel\">VIDEOS</span>";
		document.getElementById("videoChannelMenuItem1").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('1');chiudiDIVMenuSearch('0');chiudiDIVMenuSearch('2'); return false;\" title=\"RECHERCHE AVANCEE : VOYAGEURS\">VOYAGEURS</a>";	
		document.getElementById("videoChannelMenuItem2").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('2');chiudiDIVMenuSearch('0');chiudiDIVMenuSearch('1'); return false;\" title=\"ADVANCED SEARCH: EDITORIAL SEARCH\">EDITORIAL SEARCH</a>";			
	}else if(actdiv==1){
		document.getElementById("videoChannelMenuItem0").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('0');chiudiDIVMenuSearch('1');chiudiDIVMenuSearch('2'); return false;\" title=\"RECHERCHE AVANCEE : VIDEO\">VIDEOS</a>";
		document.getElementById("videoChannelMenuItem1").innerHTML="<span class=\"postMenuSel\">VOYAGEURS</span>";	
		document.getElementById("videoChannelMenuItem2").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('2');chiudiDIVMenuSearch('0');chiudiDIVMenuSearch('1'); return false;\" title=\"ADVANCED SEARCH: EDITORIAL SEARCH\">EDITORIAL SEARCH</a>";			
		
	}else{
		document.getElementById("videoChannelMenuItem0").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('0');chiudiDIVMenuSearch('1');chiudiDIVMenuSearch('2'); return false;\" title=\"RECHERCHE AVANCEE : VIDEO\">VIDEOS</a>";
		document.getElementById("videoChannelMenuItem1").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('1');chiudiDIVMenuSearch('0');chiudiDIVMenuSearch('2'); return false;\" title=\"RECHERCHE AVANCEE : VOYAGEURS\">VOYAGEURS</a>";	
		document.getElementById("videoChannelMenuItem2").innerHTML="<span class=\"postMenuSel\">EDITORIAL SEARCH</span>";	
	}
}

function chiudiDIVMenuSearch(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="none";		 		
}

function checkContactData(){
	mf=document.contact_form;
	tmp = mf.nome.value;
	if(tmp.length < 1)
	{	alert("Insérer votre prénom");
		mf.nome.focus();
		return false;
	};
	tmp = mf.cognome.value;
	if(tmp.length < 1)
	{	alert("Insérer votre nom");
		mf.cognome.focus();
		return false;
	};
	if(window.RegExp)
	{
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)) 
		{
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
			return false;
		};
	}else
	{
		if(!(mf.email.value.indexOf("@") > 0))
		{
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
	      	return false;
		}
	}	
/*
	tmp = mf.telefono.value;
	if(tmp.length < 1)
	{	alert("Insérer votre n° de téléphone.");
		mf.telefono.focus();
		return false;
	};	
*/	
	tmp = mf.yourMessage.value;
	if(tmp.length < 1)
	{	alert("Insérer le texte du message");
		mf.yourMessage.focus();
		return false;
	};
	return true;
}


function checkData(){
	mf=document.register;

	tmp = mf.nick.value;
	if(tmp.length < 1)
	{	alert("Insérer le Nickname.");
		mf.nick.focus();
		return false;
	};

	if(tmp.length > 12 || tmp.length < 4 )
	{	alert("Insérer un pseudonyme composé de 4 à 12 caractères.");
		mf.nick.focus();
		return false;
	};

// email control
	if(window.RegExp)
	{
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)) 
		{
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
			return false;
		};
	}else
	{
		if(!(mf.email.value.indexOf("@") > 0))
		{
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
	      	return false;
		}
	}

	tmp = mf.nome.value;
	if(tmp.length < 1)
	{	alert("Insérer votre prénom");
		mf.nome.focus();
		return false;
	};


	tmp = mf.cognome.value;
	if(tmp.length < 1)
	{	alert("Insérer votre nom");
		mf.cognome.focus();
		return false;
	};
	

//  return true if the input date is valid, false otherwise
	day = mf.gg.value;
	month = mf.mm.value-1; //The month needs to be a 0 (zero) for Jan, up to 11 to Dec.
	year = mf.aaaa.value;

	dteDate=new Date(year,month,day);

	if (!((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear())))
	{
		alert("Insérer une data valable.");
		mf.gg.focus();
		return false;

	};
	if(!mf.sesso[0].checked && !mf.sesso[1].checked){
		alert("Préciser votre sexe.");
		mf.sesso[0].focus();
		return false;
	};
	
	tmp = mf.citta.value;
	if(tmp.length < 1)
	{	alert("Insérer la ville.");
		mf.citta.focus();
		return false;
	};	

	tmp = mf.telefono.value;
	if(tmp.length < 1)
	{	alert("Insérer votre n° de téléphone.");
		mf.telefono.focus();
		return false;
	};	
	
	if(!mf.consenso[0].checked){
		alert("Pour vous enregistrer vous devez souscrire aux conditions de traitement de vos données personnelles.");
		mf.consenso[0].focus();
		return false;
	};
	return true;
}

function checkDataEdit(){

	mf=document.register;

	tmp = mf.passwd.value;
	tmp2 = mf.passwd2.value;
	if(tmp.length > 0){
		if(tmp.length > 12 || tmp.length < 4 ){
			alert("Insérer un mot de passe composé de 4 à 12 caractères.");
			return false;
		}else{		
			if(tmp!=tmp2){
				alert("Vérifier que le mot de passe fourni correspond à celui de la confirmation.");
				return false;
			}
		}
	}

// email control
	if(window.RegExp){
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)){
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
			return false;
		}
	}else{
		if(!(mf.email.value.indexOf("@") > 0)){
			alert("L\'e-mail doit avoir le format suivant : username@domaine.it \r\n\""+mf.email.value+"\" adresse non valable. Le vérifier et réessayer.");
			mf.email.focus();
	      		return false;
		}
	}

	tmp = mf.nome.value;
	if(tmp.length < 1){
		alert("Insérer votre prénom");
		mf.nome.focus();
		return false;
	}


	tmp = mf.cognome.value;
	if(tmp.length < 1){
		alert("Insérer votre nom");
		mf.cognome.focus();
		return false;
	}
	

//  return true if the input date is valid, false otherwise
	day = mf.gg.value;
	month = mf.mm.value-1; //The month needs to be a 0 (zero) for Jan, up to 11 to Dec.
	year = mf.aaaa.value;

	dteDate=new Date(year,month,day);

	if (!((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()))){
		alert("Insérer une data valable.");
		mf.gg.focus();
		return false;
	}
	
	tmp = mf.citta.value;
	if(tmp.length < 1){
		alert("Insérer la ville.");
		mf.citta.focus();
		return false;
	}	
	
	if(!mf.sesso[0].checked && !mf.sesso[1].checked){
		alert("Préciser votre sexe.");
		mf.sesso[0].focus();
		return false;
	}
	
	tmp = mf.telefono.value;
	if(tmp.length < 1){
		alert("Insérer votre n° de téléphone.");
		mf.telefono.focus();
		return false;
	}	

	document.getElementById("mapData").innerHTML=frames["inputMap"].document.getElementById("inputsComponent").innerHTML;
	return true;
}


function checkPostData(){
	var oEditor = FCKeditorAPI.GetInstance(window.FCKname);
	var tmp = oEditor.UpdateLinkedField();
	var tmptext = removeHTMLTags(HtmlDecode(oEditor.GetXHTML()));
	
	mf=document.post;
	tmp = mf.titolo.value;
	if(tmp.length < 1){
		alert("Insérer Titre.");
		mf.titolo.focus();
		return false;
	}
	var tot_contest=0;
	if(document.getElementById("tot_contest")){
		tot_contest=parseInt(document.getElementById("tot_contest").value);
		for(var i=0;i<tot_contest;i++){
			tit=document.getElementById("contest_tit_"+i).innerHTML;
			if(!document.getElementById("contest_"+i+"_si").checked && !document.getElementById("contest_"+i+"_no").checked){
				alert("Choisissez si faire participer le post a"+tit+".");
				document.getElementById("contest_"+i+"_si").focus();
				return false;
			}		
		}		
	}	
/*	tmp = mf.channelSel;
	if(tmp.selectedIndex==0){
		alert("Seleziona il Canale in cui inviare il video.");
		tmp.focus();
		return false;
	}
*/	
/*	if(STag.length < 1){
		alert("Inserisci almeno una delle Tag standard.");
		return false;
	}else{
		STagStr="";
		for(i=0;i<(STag.length);i++){
			STagStr+=STag[i]+",";
		}			
		STagStr=STagStr.substr(0, (STagStr.length-1));  
		document.getElementById('stag').value=STagStr;		
	}
*/	
	tmp = mf.testo.value;
	if(tmp.length < 1){
		alert("Insérer le texte.");
		mf.testo.focus();
		return false;
	}	
	var cont_video=0;
	var cont_foto=0;
	if(mf.tipo_file[0].checked && mf.file0.value.length>1){
		var estVideoArray = new Array("mov", "avi", "wmv", "mpg","mp4"," 3gp","flv");	
		if(!validateFileName(mf.file0.value,estVideoArray)){
			mf.file0.value="";				
			mf.file0.focus();
			return false;
		}else{
			cont_video++;
		}
		mf.file1.value="";
		mf.file2.value="";
		mf.file3.value="";
		mf.file4.value="";
	}
	if(mf.tipo_file[1].checked){
		var estPhotoArray = new  Array("gif", "jpg", "png");		
		var currentInputFile;
		for(var k=0;k<9;k++){
			currentInputFile=eval("mf.file"+k);
			if(currentInputFile.value.length>1){
				if(!validateFileName(currentInputFile.value,estPhotoArray)){
					currentInputFile.value="";				
					currentInputFile.focus();
					return false;
				}else{
					cont_foto++;
				}
			}	
		}
	}
	if(cont_foto==0 && cont_video==0){
		alert("To send post, you must upload at least one photo or video.");
		return false;
	}
	
	if(!mf.consenso_1.checked){
		alert("J\'accepte toutes les conditions légales.");
		mf.consenso_1.focus();
		return false;
	}	
	document.getElementById("mapData").innerHTML=frames["inputMap"].document.getElementById("inputsComponent").innerHTML;
	document.getElementById('toppa').style.display="block";	
	document.getElementById('toppa').style.height=document.body.clientHeight+"px";
	sendMsgDivDest=document.getElementById('sendMsg');
	sendMsgDivDest.style.display="block";
	sendMsgDivDest.innerHTML='<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td width="100%" valign="middle" height="100%" align="center"><div class="popUp"><div class="col1Full"><div class="cntPadd"><h3>Chargement en cours<\/h3><div class="cntCol">Merci de ne pas fermer cette page tant que le chargement n\'est pas terminé.<br\/><br\/>Merci!<\/div><div class="cntCol" style="text-align:center;"><br\/><img src="/_images/loading.gif"\/><br\/><br\/><\/div><\/div><\/div><\/div><\/td><\/tr><\/tbody><\/table>';
	window.scroll(0,0);	
	return true;
}

var STag= new Array();

function addStag(id,tname){
	if(STag.length==0){
		STag[0]=tname;
		document.getElementById(id).style.color="#EFC700";
	}else{
		allowAdd=true;
		remPos=0;
		STagStr="";
		for(i=0;i<(STag.length);i++){
			if(STag[i]==tname){
				allowAdd=false;
				remPos=i;
				break;
			}
		}
		if(allowAdd){
			STag[STag.length]=tname;
			document.getElementById(id).style.color="#EFC700";
		}else{
			STag.splice(remPos,1);
			document.getElementById(id).style.color="black";
		}
	}
}

function checkMsg(){
	if(document.posta.commento.value.length <= 1){
		alert("Insérer le texte de votre commentaire.");
		return false;
	}else{
		return true;
	}
}

function checkOut(Obj){
	if(Obj.options[Obj.selectedIndex].value!="17"){
		document.getElementById("divtestata").style.display="none";
		document.getElementById("testata").value="";
	}else{
		document.getElementById("divtestata").style.display="block";		
	}
}

function moveTopScroll(){
	window.scrollTo(0,0);
}

var maxchar=7000
function checkLimit(obj){
	if(obj.value.length>maxchar){
		alert("Le texte ne doit pas dépasser 7.000 caractères");
		obj.value=obj.value.substring(0,maxchar);
	}
}
function checkTextLimit(obj){
	if(obj.value.length>999){
		alert("Le texte ne doit pas dépasser 1.000 caractères");
		obj.value=obj.value.substring(0,999);
	}
}
function validateFileName(str,est) {
   var charValid = false;
   if(str.indexOf("/")!=-1 && (str.lastIndexOf("/")+1)<str.length ){
	   str=str.substr((str.lastIndexOf("/")+1));
   }
   if(str.indexOf("\\")!=-1 && (str.lastIndexOf("\\")+1)<str.length ){
	   str=str.substr((str.lastIndexOf("\\")+1));
   }
   msg_str_err="";
   if (str.length>0) {
       //valido i caratteri          
	   for (var i = 0; i<str.length; i++) {
           codice = str.charCodeAt(i);
           if (codice == 95 || codice == 45 || codice == 46 || (codice>=48 && codice<=57) || (codice>=65 && codice<=90) || (codice>=97 && codice<=122)) {
               charValid = true;
           } else {
               charValid = false;
               msg_str_err+=" - le caractère :" +str.charAt(i)+" non valide; il est possible d\'utiliser uniquement des caractères alphanumériques et des symboles '.' '-' '_'\n";
               break;
           }
       }
       //valido le estensioni
       var myest = str.substr((str.length-3));
       var estValid = false;
       for (var j = 0; j<est.length; j++) {
           if (est[j] == myest.toLowerCase()) {
               estValid = true;
               break;
           }
       }
       if (!estValid) {
           charValid = false;
           msg_str_err+=" - le format "+myest+" n\'est pas autorisé.";
       }
	   if(!charValid){
		   alert("Impossible de charger le fichier :"+str+".\n"+msg_str_err);
	   }
       return charValid;
   } else {
       return charValid;
   }
}

function fillCommentArea(divSrc,divDest,nome){
	document.getElementById(divDest).value="[cite]"+nome+" ecrire  "+removeHTMLTags(HtmlDecode(document.getElementById(divSrc).innerHTML))+"[/cite]\n";
	document.getElementById(divDest).focus();
}
function removeHTMLTags(strInputCode){
	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
		return (p1 == "lt")? "<" : ">";
	});
	return strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
}
function HtmlDecode (s) {
	var out = "";
	if (s==null) return;
	var l = s.length;
	for (var i=0; i<l; i++) {
		var ch = s.charAt(i);
		if (ch == '&') {
			var semicolonIndex = s.indexOf(';', i+1);
			if (semicolonIndex > 0) {
				var entity = s.substring(i + 1, semicolonIndex);
				if (entity.length > 1 && entity.charAt(0) == '#') {
					  if (entity.charAt(1) == 'x' || entity.charAt(1) == 'X')
							ch = String.fromCharCode(eval('0'+entity.substring(1)));
					  else
							ch = String.fromCharCode(eval(entity.substring(1)));
				} else {
					  switch (entity) {
							case 'quot': ch = String.fromCharCode(0x0022); break;
							case 'amp': ch = String.fromCharCode(0x0026); break;
							case 'lt': ch = String.fromCharCode(0x003c); break;
							case 'gt': ch = String.fromCharCode(0x003e); break;
							case 'nbsp': ch = String.fromCharCode(0x00a0); break;
							case 'iexcl': ch = String.fromCharCode(0x00a1); break;
							case 'cent': ch = String.fromCharCode(0x00a2); break;
							case 'pound': ch = String.fromCharCode(0x00a3); break;
							case 'curren': ch = String.fromCharCode(0x00a4); break;
							case 'yen': ch = String.fromCharCode(0x00a5); break;
							case 'brvbar': ch = String.fromCharCode(0x00a6); break;
							case 'sect': ch = String.fromCharCode(0x00a7); break;
							case 'uml': ch = String.fromCharCode(0x00a8); break;
							case 'copy': ch = String.fromCharCode(0x00a9); break;
							case 'ordf': ch = String.fromCharCode(0x00aa); break;
							case 'laquo': ch = String.fromCharCode(0x00ab); break;
							case 'not': ch = String.fromCharCode(0x00ac); break;
							case 'shy': ch = String.fromCharCode(0x00ad); break;
							case 'reg': ch = String.fromCharCode(0x00ae); break;
							case 'macr': ch = String.fromCharCode(0x00af); break;
							case 'deg': ch = String.fromCharCode(0x00b0); break;
							case 'plusmn': ch = String.fromCharCode(0x00b1); break;
							case 'sup2': ch = String.fromCharCode(0x00b2); break;
							case 'sup3': ch = String.fromCharCode(0x00b3); break;
							case 'acute': ch = String.fromCharCode(0x00b4); break;
							case 'micro': ch = String.fromCharCode(0x00b5); break;
							case 'para': ch = String.fromCharCode(0x00b6); break;
							case 'middot': ch = String.fromCharCode(0x00b7); break;
							case 'cedil': ch = String.fromCharCode(0x00b8); break;
							case 'sup1': ch = String.fromCharCode(0x00b9); break;
							case 'ordm': ch = String.fromCharCode(0x00ba); break;
							case 'raquo': ch = String.fromCharCode(0x00bb); break;
							case 'frac14': ch = String.fromCharCode(0x00bc); break;
							case 'frac12': ch = String.fromCharCode(0x00bd); break;
							case 'frac34': ch = String.fromCharCode(0x00be); break;
							case 'iquest': ch = String.fromCharCode(0x00bf); break;
							case 'Agrave': ch = String.fromCharCode(0x00c0); break;
							case 'Aacute': ch = String.fromCharCode(0x00c1); break;
							case 'Acirc': ch = String.fromCharCode(0x00c2); break;
							case 'Atilde': ch = String.fromCharCode(0x00c3); break;
							case 'Auml': ch = String.fromCharCode(0x00c4); break;
							case 'Aring': ch = String.fromCharCode(0x00c5); break;
							case 'AElig': ch = String.fromCharCode(0x00c6); break;
							case 'Ccedil': ch = String.fromCharCode(0x00c7); break;
							case 'Egrave': ch = String.fromCharCode(0x00c8); break;
							case 'Eacute': ch = String.fromCharCode(0x00c9); break;
							case 'Ecirc': ch = String.fromCharCode(0x00ca); break;
							case 'Euml': ch = String.fromCharCode(0x00cb); break;
							case 'Igrave': ch = String.fromCharCode(0x00cc); break;
							case 'Iacute': ch = String.fromCharCode(0x00cd); break;
							case 'Icirc': ch = String.fromCharCode(0x00ce ); break;
							case 'Iuml': ch = String.fromCharCode(0x00cf); break;
							case 'ETH': ch = String.fromCharCode(0x00d0); break;
							case 'Ntilde': ch = String.fromCharCode(0x00d1); break;
							case 'Ograve': ch = String.fromCharCode(0x00d2); break;
							case 'Oacute': ch = String.fromCharCode(0x00d3); break;
							case 'Ocirc': ch = String.fromCharCode(0x00d4); break;
							case 'Otilde': ch = String.fromCharCode(0x00d5); break;
							case 'Ouml': ch = String.fromCharCode(0x00d6); break;
							case 'times': ch = String.fromCharCode(0x00d7); break;
							case 'Oslash': ch = String.fromCharCode(0x00d8); break;
							case 'Ugrave': ch = String.fromCharCode(0x00d9); break;
							case 'Uacute': ch = String.fromCharCode(0x00da); break;
							case 'Ucirc': ch = String.fromCharCode(0x00db); break;
							case 'Uuml': ch = String.fromCharCode(0x00dc); break;
							case 'Yacute': ch = String.fromCharCode(0x00dd); break;
							case 'THORN': ch = String.fromCharCode(0x00de); break;
							case 'szlig': ch = String.fromCharCode(0x00df); break;
							case 'agrave': ch = String.fromCharCode(0x00e0); break;
							case 'aacute': ch = String.fromCharCode(0x00e1); break;
							case 'acirc': ch = String.fromCharCode(0x00e2); break;
							case 'atilde': ch = String.fromCharCode(0x00e3); break;
							case 'auml': ch = String.fromCharCode(0x00e4); break;
							case 'aring': ch = String.fromCharCode(0x00e5); break;
							case 'aelig': ch = String.fromCharCode(0x00e6); break;
							case 'ccedil': ch = String.fromCharCode(0x00e7); break;
							case 'egrave': ch = String.fromCharCode(0x00e8); break;
							case 'eacute': ch = String.fromCharCode(0x00e9); break;
							case 'ecirc': ch = String.fromCharCode(0x00ea); break;
							case 'euml': ch = String.fromCharCode(0x00eb); break;
							case 'igrave': ch = String.fromCharCode(0x00ec); break;
							case 'iacute': ch = String.fromCharCode(0x00ed); break;
							case 'icirc': ch = String.fromCharCode(0x00ee); break;
							case 'iuml': ch = String.fromCharCode(0x00ef); break;
							case 'eth': ch = String.fromCharCode(0x00f0); break;
							case 'ntilde': ch = String.fromCharCode(0x00f1); break;
							case 'ograve': ch = String.fromCharCode(0x00f2); break;
							case 'oacute': ch = String.fromCharCode(0x00f3); break;
							case 'ocirc': ch = String.fromCharCode(0x00f4); break;
							case 'otilde': ch = String.fromCharCode(0x00f5); break;
							case 'ouml': ch = String.fromCharCode(0x00f6); break;
							case 'divide': ch = String.fromCharCode(0x00f7); break;
							case 'oslash': ch = String.fromCharCode(0x00f8); break;
							case 'ugrave': ch = String.fromCharCode(0x00f9); break;
							case 'uacute': ch = String.fromCharCode(0x00fa); break;
							case 'ucirc': ch = String.fromCharCode(0x00fb); break;
							case 'uuml': ch = String.fromCharCode(0x00fc); break;
							case 'yacute': ch = String.fromCharCode(0x00fd); break;
							case 'thorn': ch = String.fromCharCode(0x00fe); break;
							case 'yuml': ch = String.fromCharCode(0x00ff); break;
							case 'OElig': ch = String.fromCharCode(0x0152); break;
							case 'oelig': ch = String.fromCharCode(0x0153); break;
							case 'Scaron': ch = String.fromCharCode(0x0160); break;
							case 'scaron': ch = String.fromCharCode(0x0161); break;
							case 'Yuml': ch = String.fromCharCode(0x0178); break;
							case 'fnof': ch = String.fromCharCode(0x0192); break;
							case 'circ': ch = String.fromCharCode(0x02c6); break;
							case 'tilde': ch = String.fromCharCode(0x02dc); break;
							case 'Alpha': ch = String.fromCharCode(0x0391); break;
							case 'Beta': ch = String.fromCharCode(0x0392); break;
							case 'Gamma': ch = String.fromCharCode(0x0393); break;
							case 'Delta': ch = String.fromCharCode(0x0394); break;
							case 'Epsilon': ch = String.fromCharCode(0x0395); break;
							case 'Zeta': ch = String.fromCharCode(0x0396); break;
							case 'Eta': ch = String.fromCharCode(0x0397); break;
							case 'Theta': ch = String.fromCharCode(0x0398); break;
							case 'Iota': ch = String.fromCharCode(0x0399); break;
							case 'Kappa': ch = String.fromCharCode(0x039a); break;
							case 'Lambda': ch = String.fromCharCode(0x039b); break;
							case 'Mu': ch = String.fromCharCode(0x039c); break;
							case 'Nu': ch = String.fromCharCode(0x039d); break;
							case 'Xi': ch = String.fromCharCode(0x039e); break;
							case 'Omicron': ch = String.fromCharCode(0x039f); break;
							case 'Pi': ch = String.fromCharCode(0x03a0); break;
							case ' Rho ': ch = String.fromCharCode(0x03a1); break;
							case 'Sigma': ch = String.fromCharCode(0x03a3); break;
							case 'Tau': ch = String.fromCharCode(0x03a4); break;
							case 'Upsilon': ch = String.fromCharCode(0x03a5); break;
							case 'Phi': ch = String.fromCharCode(0x03a6); break;
							case 'Chi': ch = String.fromCharCode(0x03a7); break;
							case 'Psi': ch = String.fromCharCode(0x03a8); break;
							case 'Omega': ch = String.fromCharCode(0x03a9); break;
							case 'alpha': ch = String.fromCharCode(0x03b1); break;
							case 'beta': ch = String.fromCharCode(0x03b2); break;
							case 'gamma': ch = String.fromCharCode(0x03b3); break;
							case 'delta': ch = String.fromCharCode(0x03b4); break;
							case 'epsilon': ch = String.fromCharCode(0x03b5); break;
							case 'zeta': ch = String.fromCharCode(0x03b6); break;
							case 'eta': ch = String.fromCharCode(0x03b7); break;
							case 'theta': ch = String.fromCharCode(0x03b8); break;
							case 'iota': ch = String.fromCharCode(0x03b9); break;
							case 'kappa': ch = String.fromCharCode(0x03ba); break;
							case 'lambda': ch = String.fromCharCode(0x03bb); break;
							case 'mu': ch = String.fromCharCode(0x03bc); break;
							case 'nu': ch = String.fromCharCode(0x03bd); break;
							case 'xi': ch = String.fromCharCode(0x03be); break;
							case 'omicron': ch = String.fromCharCode(0x03bf); break;
							case 'pi': ch = String.fromCharCode(0x03c0); break;
							case 'rho': ch = String.fromCharCode(0x03c1); break;
							case 'sigmaf': ch = String.fromCharCode(0x03c2); break;
							case 'sigma': ch = String.fromCharCode(0x03c3); break;
							case 'tau': ch = String.fromCharCode(0x03c4); break;
							case 'upsilon': ch = String.fromCharCode(0x03c5); break;
							case 'phi': ch = String.fromCharCode(0x03c6); break;
							case 'chi': ch = String.fromCharCode(0x03c7); break;
							case 'psi': ch = String.fromCharCode(0x03c8); break;
							case 'omega': ch = String.fromCharCode(0x03c9); break;
							case 'thetasym': ch = String.fromCharCode(0x03d1); break;
							case 'upsih': ch = String.fromCharCode(0x03d2); break;
							case 'piv': ch = String.fromCharCode(0x03d6); break;
							case 'ensp': ch = String.fromCharCode(0x2002); break;
							case 'emsp': ch = String.fromCharCode(0x2003); break;
							case 'thinsp': ch = String.fromCharCode(0x2009); break;
							case 'zwnj': ch = String.fromCharCode(0x200c); break;
							case 'zwj': ch = String.fromCharCode(0x200d); break;
							case 'lrm': ch = String.fromCharCode(0x200e); break;
							case 'rlm': ch = String.fromCharCode(0x200f); break;
							case 'ndash': ch = String.fromCharCode(0x2013); break;
							case 'mdash': ch = String.fromCharCode(0x2014); break;
							case 'lsquo': ch = String.fromCharCode(0x2018); break;
							case 'rsquo': ch = String.fromCharCode(0x2019); break;
							case 'sbquo': ch = String.fromCharCode(0x201a); break;
							case 'ldquo': ch = String.fromCharCode(0x201c); break;
							case 'rdquo': ch = String.fromCharCode(0x201d); break;
							case 'bdquo': ch = String.fromCharCode(0x201e); break;
							case 'dagger': ch = String.fromCharCode(0x2020); break;
							case 'Dagger': ch = String.fromCharCode(0x2021); break;
							case 'bull': ch = String.fromCharCode(0x2022); break;
							case 'hellip': ch = String.fromCharCode(0x2026); break;
							case 'permil': ch = String.fromCharCode(0x2030); break;
							case 'prime': ch = String.fromCharCode(0x2032); break;
							case 'Prime': ch = String.fromCharCode(0x2033); break;
							case 'lsaquo': ch = String.fromCharCode(0x2039); break;
							case 'rsaquo': ch = String.fromCharCode(0x203a); break;
							case 'oline': ch = String.fromCharCode(0x203e); break;
							case 'frasl': ch = String.fromCharCode(0x2044); break;
							case 'euro': ch = String.fromCharCode(0x20ac); break;
							case 'image': ch = String.fromCharCode(0x2111); break;
							case 'weierp': ch = String.fromCharCode(0x2118); break;
							case 'real': ch = String.fromCharCode(0x211c); break;
							case 'trade': ch = String.fromCharCode(0x2122); break;
							case 'alefsym': ch = String.fromCharCode(0x2135); break;
							case 'larr': ch = String.fromCharCode(0x2190); break;
							case 'uarr': ch = String.fromCharCode(0x2191); break;
							case 'rarr': ch = String.fromCharCode(0x2192); break;
							case 'darr': ch = String.fromCharCode(0x2193); break;
							case 'harr': ch = String.fromCharCode(0x2194); break;
							case 'crarr': ch = String.fromCharCode(0x21b5); break;
							case 'lArr': ch = String.fromCharCode(0x21d0); break;
							case 'uArr': ch = String.fromCharCode(0x21d1); break;
							case 'rArr': ch = String.fromCharCode(0x21d2); break;
							case 'dArr': ch = String.fromCharCode(0x21d3); break;
							case 'hArr': ch = String.fromCharCode(0x21d4); break;
							case 'forall': ch = String.fromCharCode(0x2200); break;
							case 'part': ch = String.fromCharCode(0x2202); break;
							case 'exist': ch = String.fromCharCode(0x2203); break;
							case 'empty': ch = String.fromCharCode(0x2205); break;
							case 'nabla': ch = String.fromCharCode(0x2207); break;
							case 'isin': ch = String.fromCharCode(0x2208); break;
							case 'notin': ch = String.fromCharCode(0x2209); break;
							case 'ni': ch = String.fromCharCode(0x220b); break;
							case 'prod': ch = String.fromCharCode(0x220f); break;
							case 'sum': ch = String.fromCharCode(0x2211); break;
							case 'minus': ch = String.fromCharCode(0x2212); break;
							case 'lowast': ch = String.fromCharCode(0x2217); break;
							case 'radic': ch = String.fromCharCode(0x221a); break;
							case 'prop': ch = String.fromCharCode(0x221d); break;
							case 'infin': ch = String.fromCharCode(0x221e); break;
							case 'ang': ch = String.fromCharCode(0x2220); break;
							case 'and': ch = String.fromCharCode(0x2227); break;
							case 'or': ch = String.fromCharCode(0x2228); break;
							case 'cap': ch = String.fromCharCode(0x2229); break;
							case 'cup': ch = String.fromCharCode(0x222a); break;
							case 'int': ch = String.fromCharCode(0x222b); break;
							case 'there4': ch = String.fromCharCode(0x2234); break;
							case 'sim': ch = String.fromCharCode(0x223c); break;
							case 'cong': ch = String.fromCharCode(0x2245); break;
							case 'asymp': ch = String.fromCharCode(0x2248); break;
							case 'ne': ch = String.fromCharCode(0x2260); break;
							case 'equiv': ch = String.fromCharCode(0x2261); break;
							case 'le': ch = String.fromCharCode(0x2264); break;
							case 'ge': ch = String.fromCharCode(0x2265); break;
							case 'sub': ch = String.fromCharCode(0x2282); break;
							case 'sup': ch = String.fromCharCode(0x2283); break;
							case 'nsub': ch = String.fromCharCode(0x2284); break;
							case 'sube': ch = String.fromCharCode(0x2286); break;
							case 'supe': ch = String.fromCharCode(0x2287); break;
							case 'oplus': ch = String.fromCharCode(0x2295); break;
							case 'otimes': ch = String.fromCharCode(0x2297); break;
							case 'perp': ch = String.fromCharCode(0x22a5); break;
							case 'sdot': ch = String.fromCharCode(0x22c5); break;
							case 'lceil': ch = String.fromCharCode(0x2308); break;
							case 'rceil': ch = String.fromCharCode(0x2309); break;
							case 'lfloor': ch = String.fromCharCode(0x230a); break;
							case 'rfloor': ch = String.fromCharCode(0x230b); break;
							case 'lang': ch = String.fromCharCode(0x2329); break;
							case 'rang': ch = String.fromCharCode(0x232a); break;
							case 'loz': ch = String.fromCharCode(0x25ca); break;
							case 'spades': ch = String.fromCharCode(0x2660); break;
							case 'clubs': ch = String.fromCharCode(0x2663); break;
							case 'hearts': ch = String.fromCharCode(0x2665); break;
							case 'diams': ch = String.fromCharCode(0x2666); break;
							default: ch = ''; break;
					  }
				}
				i = semicolonIndex;
			}
		}
		out += ch;
	}
	return out;
}

function checkDataFormPartir(){
	mf=document.partire_form;

	if(!mf.sesso[0].checked && !mf.sesso[1].checked && !mf.sesso[2].checked){
		alert("Préciser votre sexe.");
		mf.sesso[0].focus();
		return false;
	};
	
	tmp = mf.nome.value;
	if(tmp.length < 1)
	{
		alert("Insérer votre prénom");
		mf.nome.focus();
		return false;
	};


	tmp = mf.cognome.value;
	if(tmp.length < 1)
	{	alert("Insérer votre nom");
		mf.cognome.focus();
		return false;
	};

	tmp = mf.telefono.value;
	if(tmp.length < 1)
	{	alert("Insérer votre n° de téléphone.");
		mf.telefono.focus();
		return false;
	};	
// email control
	if(window.RegExp)
	{
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)) 
		{
			alert("L\'Email indiqué : username@domain.it, l\'adresse fournie n\'est pas valable.");
			mf.email.focus();
			return false;
		};
	}else
	{
		if(!(mf.email.value.indexOf("@") > 0))
		{
			alert("L\'Email indiqué : username@domain.it, l\'adresse fournie n\'est pas valable.");
			mf.email.focus();
	      	return false;
		}
	}
tmp = mf.indirizzo.value;
	if(tmp.length < 1)
	{	
	alert("Insérer votre adresse");
		mf.indirizzo.focus();
		return false;
	};	

/*	tmp = mf.indirizzo2.value;
	if(tmp.length < 1)
	{	
	alert("Inserisci il tuo secondo indirizzo.");
		mf.indirizzo2.focus();
		return false;
	};	
*/
//  return true if the input date is valid, false otherwise
	
tmp = mf.cap.value;
	if(tmp.length < 1)
	{	
	alert("Insérer votre code postal");
		mf.cap.focus();
		return false;
	};	
	
	
	tmp = mf.citta.value;
	if(tmp.length < 1)
	{	
	alert("Insérer la ville.");
		mf.citta.focus();
		return false;
	};	
	

	
	return true;
}