/***************************************************************************************
*  CARICA COMUNI
****************************************************************************************/

   function caricaComuni(){  

        try
        { 

 
    	  var url = "/system/modules/it.italcogimreti/elements/app_tariffe/comuniAjax.jsp";                    
	  var xmlhttp = FactoryXMLHttpRequest();
          var combo = document.getElementById("regione");
          var _regione = combo.options[combo.selectedIndex].value;
       
          var comune_ = document.getElementById("elenco_comuni").value; 


           //NON METTIAMO APPOSTO NIENTE
           if(xmlhttp)
           {
            	
       	 
            	     	        	
                   xmlhttp.open("POST", url);
                   
                   xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

                   xmlhttp.onreadystatechange = function()
                   {
                        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                        {                                                
		                         document.getElementById('comune_').innerHTML = xmlhttp.responseText;

                                   try{
                                           if(_regione =='')
                                                     document.getElementById("comune").disabled=true;
                                   }catch(E){}


                        }
                   }

                   xmlhttp.send("my_reg="+_regione+"&comune="+comune_);         
        } 
       
      }catch(E){}

   }

/***************************************************************************************
*  CERCA
****************************************************************************************/

 function cerca(){ 
     
        var f = document.theform;
        var combo2 = document.getElementById("comune");
        var _comune = combo2.options[combo2.selectedIndex].text;
        
        if(combo2.value == '') return; 

        f.elenco_comuni.value = _comune;                   
 
        
        f.submit();
        
   }


 function cercaCombo(){
     
        var f = document.theform;
        f.submit();
        
   }


