/***************************************************************************************
*  CARICA COMUNI
****************************************************************************************/

   function caricaComuni(){  

        try
        { 

 
    	  var url = "/system/modules/it.italcogimreti/elements/app_configurazione_impianti/comuniAjax.jsp";                    
	  var xmlhttp = FactoryXMLHttpRequest();
          var combo = document.getElementById("regione");
          var _regione = combo.options[combo.selectedIndex].value;
       
          //var comune_ = document.getElementById("nome_comune").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("id_comune").disabled=true;
                                          }catch(E){alert(E);}
                        }
                   }

                   xmlhttp.send("my_reg="+_regione);         
        } 
       
      }catch(E){}

   }

/***************************************************************************************
*  CERCA: SELEZIONA COMUNE E PROVINCIA 
****************************************************************************************/

 function cerca(){ 
     
        var f = document.theform;

        var combo = document.getElementById("id_comune");
        var text = combo.options[combo.selectedIndex].text;
        var id = combo.options[combo.selectedIndex].value;
        if(id=='') return;   


        document.getElementById("nome_comune").value= text;

        f.submit();
        
   }


 function cercaCombo(){
     
        var f = document.theform;
        f.submit();
        
   }


/***************************************************************************************
*  OPEN TARIFFARIO
****************************************************************************************/

       function open_tariffario(param1,param2,param3,param4,param5,param6,type){

                        var f = document.theform;
                        //document.getElementById("cur_page").value=param1;
                        document.getElementById("id_comune").value=param2;

                        document.getElementById("data_inizio_validita").value=param4;
                        document.getElementById("strumento").value=param6;
                        document.getElementById("passo").value=2;

                        f.submit();
       }

/***************************************************************************************
*  OPEN CLASSE
****************************************************************************************/


       function open_classe(){

                        var f = document.theform;
                        document.getElementById("passo").value=3;

                        f.submit();


       }






