// richiamata per visualizzare una pop-up
function foto(id,type_w){
	if (type_w == "1") {
		window.open('/foto.asp?id='+id,'Foto','scrollbars=no,resizable=no,width=420,height=280,status=no,location=no,toolbar=no');
	}else{
		window.open('/foto.asp?id='+id,'Foto','scrollbars=no,resizable=no,width=420,height=540,status=no,location=no,toolbar=no');	
	}



	window.open('/foto.asp?id='+id,'Foto','scrollbars=no,resizable=no,width=420,height=330,status=no,location=no,toolbar=no');
}

// funzione per cambiare colore al tr
function cambia_colore(identificatore) {

		if (document.getElementById(identificatore).className == "none")
		{
			document.getElementById(identificatore).className = "rigatr";
		}
		else
		{ // hover
			document.getElementById(identificatore).className = "none";
		}	
}

// funzione per popolare le citta
function scelta_citta()
{ 
	document.getElementById('opt').value = "1";
	document.getElementById('form_evento').submit();
 }

function altro_segna()
{ 
	if (document.getElementById('tipo_utente').value == "Altro"){
		document.getElementById('altro_signature').style.visibility = "visible";
	}	else{
		document.getElementById('altro_signature').style.visibility = "hidden";
	}
 } 
 
function altro_tipo()
{ 
	if (document.getElementById('tipo_evento').value == "48"){
		document.getElementById('altro_type').style.visibility = "visible";
	}	else{
		document.getElementById('altro_type').style.visibility = "hidden";
	}
 }  
 
 function activa_form()
{ 
	if (document.getElementById('autorize').status == false){
		document.getElementById('subform').disabled = true;
		alert("Attenzione:\n\nL'autorizzazione al trattamento dei dati personali è\n\nOBBLIGATORIA.");		
	}else{
		document.getElementById('subform').disabled = false;
	}	
 } 


var liveSearchReq;

function cerca() 
{

	document.getElementById("id_comune").options.length=0;
	document.getElementById("id_frazione").options.length=0;

    var valorecampo = document.getElementById("id_regione").options[document.getElementById("id_regione").selectedIndex].value;

    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq = new XMLHttpRequest();
        liveSearchReq.onreadystatechange = ricevi;
        liveSearchReq.open("GET", "/popola.asp?done=province&id="+valorecampo,true);
        liveSearchReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq) {
            liveSearchReq.onreadystatechange = ricevi;
            liveSearchReq.open("GET", "/popola.asp?done=province&id="+valorecampo,true);
            liveSearchReq.send();
        }
    }
}

     
  function ricevi() {   
    var strRes;       
    var arrValori;      
	  if (liveSearchReq.readyState == 4) {	    
		  strRes=liveSearchReq.responseText;
		  arrValori=strRes.split("||");
		  document.getElementById("id_provincia").options.length=0;		    
		  for(i=0;i<arrValori.length;i++)
		  {
		    document.getElementById("id_provincia").options[document.getElementById("id_provincia").options.length]= new Option(arrValori[i].split("|")[1],arrValori[i].split("|")[0]); 
		  }
		//document.getElementById("secondChoice").style.visibility = "visible";
		 }
	}

var liveSearchReq2;	
	
function cerca2() 
{
    var valorecampo2 = document.getElementById("id_provincia").options[document.getElementById("id_provincia").selectedIndex].value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq2 = new XMLHttpRequest();
        liveSearchReq2.onreadystatechange = ricevi2;
        liveSearchReq2.open("GET", "/popola.asp?done=comuni&id="+valorecampo2,true);
        liveSearchReq2.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq2) {
            liveSearchReq2.onreadystatechange = ricevi2;
            liveSearchReq2.open("GET", "/popola.asp?done=comuni&id="+valorecampo2,true);
            liveSearchReq2.send();
        }
    }
}

     
  function ricevi2() {   
    var strRes2;       
    var arrValori2;      
	  if (liveSearchReq2.readyState == 4) {	    
		  strRes2=liveSearchReq2.responseText;
			  if (strRes2 != "") {	    
			  arrValori2=strRes2.split("||");
			  document.getElementById("id_comune").options.length=0;		    
			  for(i=0;i<arrValori2.length;i++)
			  {
			    document.getElementById("id_comune").options[document.getElementById("id_comune").options.length]= new Option(arrValori2[i].split("|")[1],arrValori2[i].split("|")[0]); 
			  }
			//document.getElementById("thirdChoice").style.visibility = "visible";
			 }
		 }
	}

var liveSearchReq3;	
	
function cerca3() 
{
    var valorecampo3 = document.getElementById("id_comune").options[document.getElementById("id_comune").selectedIndex].value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq3 = new XMLHttpRequest();
        liveSearchReq3.onreadystatechange = ricevi3;
        liveSearchReq3.open("GET", "/popola.asp?done=frazioni&id="+valorecampo3,true);
        liveSearchReq3.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq3 = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq3) {
            liveSearchReq3.onreadystatechange = ricevi3;
            liveSearchReq3.open("GET", "/popola.asp?done=frazioni&id="+valorecampo3,true);
            liveSearchReq3.send();
        }
    }
}

     
  function ricevi3() {   
    var strRes3;       
    var arrValori3;      
	  if (liveSearchReq3.readyState == 4) {	    
		  strRes3=liveSearchReq3.responseText;
			  if (strRes3 != "") {	    
			  arrValori3=strRes3.split("||");
			  document.getElementById("id_frazione").options.length=0;		    
			  for(i=0;i<arrValori3.length;i++)
			  {
			    document.getElementById("id_frazione").options[document.getElementById("id_frazione").options.length]= new Option(arrValori3[i].split("|")[1],arrValori3[i].split("|")[0]); 
			  }
			//document.getElementById("thirdChoice").style.visibility = "visible";
			 }
		 }
	}
	
var liveSearchReq2_2;	
	
function cerca2_2() 
{
    var valorecampo6 = document.getElementById("id_provincia").options[document.getElementById("id_provincia").selectedIndex].value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq2_2 = new XMLHttpRequest();
        liveSearchReq2_2.onreadystatechange = ricevi2_2;
        liveSearchReq2_2.open("GET", "/popola.asp?done=comuni&dett=1&id="+valorecampo6,true);
        liveSearchReq2_2.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq2_2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq2_2) {
            liveSearchReq2_2.onreadystatechange = ricevi2_2;
            liveSearchReq2_2.open("GET", "/popola.asp?done=comuni&dett=1&id="+valorecampo6,true);
            liveSearchReq2_2.send();
        }
    }

}

     
  function ricevi2_2() {   
    var strRes2;       
    var arrValori2;      
	  if (liveSearchReq2_2.readyState == 4) {	    
		  strRes2=liveSearchReq2_2.responseText;
			  if (strRes2 != "") {	    
			  arrValori2=strRes2.split("||");
			  document.getElementById("id_comune").options.length=0;		    
			  for(i=0;i<arrValori2.length;i++)
			  {
			    document.getElementById("id_comune").options[document.getElementById("id_comune").options.length]= new Option(arrValori2[i].split("|")[1],arrValori2[i].split("|")[0]); 	
			  }
			 }
		 }
	}	

var liveSearchReq3_3;	
	
function cerca3_3() 
{
    var valorecampo3_3 = document.getElementById("id_comune").value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq3_3 = new XMLHttpRequest();
        liveSearchReq3_3.onreadystatechange = ricevi3_3;
        liveSearchReq3_3.open("GET", "/popola.asp?done=frazioni&id="+valorecampo3_3,true);
        liveSearchReq3_3.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq3_3 = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq3_3) {
            liveSearchReq3_3.onreadystatechange = ricevi3_3;
            liveSearchReq3_3.open("GET", "/popola.asp?done=frazioni&id="+valorecampo3_3,true);
            liveSearchReq3_3.send();
        }
    }
}

     
  function ricevi3_3() {   
    var strRes3_3;       
    var arrValori3_3;      
	  if (liveSearchReq3_3.readyState == 4) {	    
		  strRes3_3=liveSearchReq3_3.responseText;
			  if (strRes3_3 != "") {	    
			  arrValori3_3=strRes3_3.split("||");
			  document.getElementById("id_frazione").options.length=0;		    
			  for(i=0;i<arrValori3_3.length;i++)
			  {
			    document.getElementById("id_frazione").options[document.getElementById("id_frazione").options.length]= new Option(arrValori3_3[i].split("|")[1],arrValori3_3[i].split("|")[0]); 
			  }
			//document.getElementById("thirdChoice").style.visibility = "visible";
			 }
		 }
	}		
	
//-------------------------------------------------------------------------------	