

  var ricerca_pro;

  
   
function AJAXProvince() 
{
    var valorecampo = document.formdati.provincia.options[document.formdati.provincia.selectedIndex].value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        ricerca_pro = new XMLHttpRequest();
        ricerca_pro.onreadystatechange = getProvince;
        ricerca_pro.open("GET", "../common/service.cfm?p="+valorecampo,true);
        ricerca_pro.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        ricerca_pro = new ActiveXObject("Microsoft.XMLHTTP");
        if (ricerca_pro) {
            ricerca_pro.onreadystatechange = getProvince;
            ricerca_pro.open("GET", "../common/service.cfm?p="+valorecampo,true);
            ricerca_pro.send();
        }
    }
}

     

	 
  function getProvince() {   
    var strRes;       
    var arrValori; 
	var arrCitta;     
	  if (ricerca_pro.readyState == 4) {	    
		  strRes=ricerca_pro.responseText;
		  arrValori=strRes.split("|");
		  document.formdati.localita.options.length=0;		    
		  for(i=0;i<arrValori.length;i++)
		  {
			 arrCitta= arrValori[i].split("$")
			
			document.formdati.localita.options[document.formdati.localita.options.length]= new Option(arrCitta[0]) ; 
		   	document.formdati.localita.options[document.formdati.localita.options.length -1].value= arrCitta[1];
			
		  }
		 
		 }
	}
	
	 function showCAP() {   
     		document.formdati.CAP.value=document.formdati.localita.value;
			document.formdati.citta.value=document.formdati.localita.options[document.formdati.localita.selectedIndex].text;
			
		  }

		  
