function validate_domini(str) {
           if (document.domini.orgAc.value == ""){
           alert("Inserire il campo Organizzazione.");
	   loadBar(0);
           return false;
           }
           if (document.domini.nomeAc.value == ""){
           alert("Inserire il nome dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
           }
           if (document.domini.pin.value == ""){
		if (str == 1){
           	alert("Inserire il Codice Fiscale dell'oggetto REGISTRANT.");
		}else{
           	alert("Inserire la Partita IVA dell'oggetto REGISTRANT.");
		}
	   loadBar(0);
           return false;
           }
           if (document.domini.intpref1Ac.value == ""){
           alert("Inserire il prefisso internazionale nel campo telefono dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
           }
           if (document.domini.intpref1Ac.value != "+39"){
           alert("Il campo prefisso dell'oggetto REGISTRANT deve essre in forma +39.");
	   loadBar(0);
           return false;
           }
           if (document.domini.emailAc.value == ""){
           alert("Inserire l'indirizzo email dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
           }
           if (document.domini.address1Ac.value == ""){
           alert("Inserire l'indirizzo dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
           }
           if (document.domini.city1Ac.value == ""){
           alert("Inserire la citta dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
           }
           if (document.domini.cap1Ac.value == ""){
           alert("Inserire il cap dell'oggetto REGISTRANT.");
	   loadBar(0);
           return false;
	   }
           if (document.domini.prov1Ac.value == ""){
	   loadBar(0);
           alert("Inserire la provincia dell'oggetto REGISTRANT.");
           return false;
	   }
           if (document.domini.nichandleAc.value == "AUTO-1"){
	   //loadBar(0);
           //alert("Il campo nichandle per l'Adminc non č valido. Se non si conosce il nichandle lasciare il campo vuoto, verrā assegnato automaticamente.");
           //return false;
	   document.domini.nichandleAc.value == "";
	   }
	   if (!document.domini.TechC.checked){
                   if (document.domini.nomeTc.value == ""){
                   alert("Inserire il nome TECH-C.");
	   loadBar(0);
                   return false;
                   }
                   if (document.domini.address1Tc.value == ""){
                   alert("Inserire l'indirizzo TECH-C.");
                   return false;
                   }
                   if (document.domini.city1Tc.value == ""){
                   alert("Inserire la citta TECH-C.");
                   return false;
                   }
                   if (document.domini.cap1Tc.value == ""){
                   alert("Inserire il cap TECH-C.");
                   return false;
	           }
                   if (document.domini.prov1Tc.value == ""){
                   alert("Inserire la provincia TECH-C.");
                   return false;
	           }
                   if (document.domini.intpref1Tc.value == ""){
                   alert("Inserire il prefisso internazionale nel campo telefono TECH-C.");
                   return false;
                   }
                   if (document.domini.intpref1Tc.value != "+39"){
                   alert("Il campo prefisso deve essre in forma +39.");
                   return false;
                   }
                   if (document.domini.emailTc.value == ""){
                   alert("Inserire l'indirizzo email TECH-C.");
                   return false;
                   }
                      if (document.domini.nichandleTc.value == "AUTO-1" || document.domini.nichandleTc.value == "AUTO-2"){
 	             //loadBar(0);
                      //alert("Il campo nichandle per il TechC non č valido. Se non si conosce il nichandle lasciare il campo vuoto, verrā assegnato automaticamente.");
                      //return false;
			document.domini.nichandleTc.value == "";
 	             }
	}	
	   if (!document.domini.PostMaster.checked && !document.domini.PostMaster2.checked){
                   if (document.domini.nomePm.value == ""){
                   alert("Inserire il nome POSTMASTER.");
                   return false;
                   }
                  if (document.domini.address1Pm.value == ""){
                   alert("Inserire l'indirizzo POSTMASTER.");
                   return false;
                   }
                   if (document.domini.city1Pm.value == ""){
                   alert("Inserire la citta POSTMASTER.");
                   return false;
                   }
                   if (document.domini.cap1Pm.value == ""){
                   alert("Inserire il cap POSTMASTER.");
                   return false;
	           }
                   if (document.domini.prov1Pm.value == ""){
                   alert("Inserire la provincia POSTMASTER.");
                   return false;
	           }
                   if (document.domini.intpref1Pm.value == ""){
                   alert("Inserire il prefisso internazionale nel campo telefono POSTMASTER.");
                   return false;
                   }
                   if (document.domini.intpref1Pm.value != "+39"){
                   alert("Il campo prefisso deve essre in forma +39.");
                   return false;
                   }
                   if (document.domini.emailPm.value == ""){
                   alert("Inserire l'indirizzo email POSTMASTER.");
                   return false;
                   }
                      if (document.domini.nichandlePm.value == "AUTO-1" || document.domini.nichandleTc.value == "AUTO-2" || document.domini.nichandleTc.value == "AUTO-3"){
 	             loadBar(0);
                      alert("Il campo nichandle per il Postmaster non č valido. Se non si conosce il nichandle lasciare il campo vuoto, verrā assegnato automaticamente.");
                      return false;
 	             }
	}	
	if(str == 'SaveSend'){
        document.domini.action = 'domini.it.php?Action=Conferma&SaveSend=Y';
        //   alert("OK ");
	}else if(str == 'SaveOnly'){
        document.domini.action = 'domini.it.php?Action=Conferma&SaveSend=N';
	}else{
           //alert("OK ");
	}
        document.domini.submit();
        //   alert("OK ");
        return true;
}

function validate_cliaz()  {
           if (document.clienti.Nome.value == ""){
           alert("Inserire il nome del cliente.");
           return false;
           }
           if (document.clienti.Indirizzo.value == ""){
           alert("Inserire l'indirizzo .");
           return false;
           }
           if (document.clienti.Stato.value == ""){
           alert("Inserire la nazione.");
           return false;
           }
           if (document.clienti.Citta.value == ""){
           alert("Inserire la cittā.");
           return false;
           }
           if (document.clienti.Cap.value == ""){
           alert("Inserire il cap.");
           return false;
           }
           if (document.clienti.Prov.value == ""){
           alert("Inserire la provincia.");
           return false;
           }
           if (document.clienti.Tel.value == ""){
           alert("Inserire il telefono.");
           return false;
           }
           if (document.clienti.Email.value == ""){
           alert("Inserire l'indirizzo email. Il seguente indirizzo sarā utilizzato per l'invio della documentazione e delle fatture. ");
           return false;
           }
           if (document.clienti.Piva.value == "" && document.clienti.CF.value == ""){
           alert("Inserire la Partita Iva o il Codice Fiscale se trattasi di persona fisica.");
           return false;
           }
        document.clienti.submit();
        return true;
}
function validate_rq()  {
           if(document.richieste.ID_Cliente.disabled == false){
 	           if (document.richieste.ID_Cliente.options[document.richieste.ID_Cliente.selectedIndex].text == '' ){
                   alert("Selezionare il beneficiario.");
                   return false;
                   }
           }
           if (document.richieste.Importo.value == ""){
           alert("Inserire l'importo.");
           return false;
           }else{
	   dollarAmount('richieste', 'Importo')
	   }
           if (document.richieste.Note.value == ""){
           alert("Compilare il campo note.");
           return false;
           }
           if(document.richieste.Stato.disabled == false){
                   if (document.richieste.Stato.options[document.richieste.Stato.selectedIndex].text == 'Autorizzato' && document.richieste.OCS.options[document.richieste.OCS.selectedIndex].text == ''){
                   alert("Assegnare il Centro Servizi.");
                   return false;
                   }
	   }

        document.richieste.submit();
        return true;
}
function validate_domini_eu(str) {
           if (document.domini.orgAc.value == ""){
           alert("Inserire il campo Organizzazione.");
	   loadBar(0);
           return false;
           }
           if (document.domini.nomeAc.value == ""){
           alert("Inserire il nome del Registrant.");
	   loadBar(0);
           return false;
           }
           if (document.domini.address1Ac.value == ""){
           alert("Inserire l'indirizzo del Registrant.");
	   loadBar(0);
           return false;
           }
           if (document.domini.city1Ac.value == ""){
           alert("Inserire la citta del Registrant.");
	   loadBar(0);
           return false;
           }
           if (document.domini.cap1Ac.value == ""){
           alert("Inserire il cap del Registrant.");
	   loadBar(0);
           return false;
	   }
           if (document.domini.prov1Ac.value == ""){
	   loadBar(0);
           alert("Inserire la provincia del Registrant.");
           return false;
	   }
		// TELEFONO
                  if (document.domini.intpref1Ac.value == ""){
                  alert("Inserire il prefisso internazionale nel campo telefono del Registrant.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.intpref1Ac.value.substr(0,1) != "+"){
                  alert("Il campo prefisso telefono del Registrant deve essre in forma +39.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.tel1Ac.value == ""){
                  alert("Inserire il  telefono del Registrant.");
	          loadBar(0);
                  return false;
                  }
		// FAX
                  if (document.domini.intfax1Ac.value == ""){
                  alert("Inserire il prefisso internazionale nel campo fax del Registrant.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.intfax1Ac.value.substr(0,1) != "+"){
                  alert("Il campo prefisso fax del Registrant deve essre in forma +39.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.fax1Ac.value == ""){
                  alert("Inserire il  fax del Registrant.");
	          loadBar(0);
                  return false;
                  }
		// EMAIL
                  if (document.domini.emailAc.value == ""){
                  alert("Inserire l'indirizzo email del Registrant.");
	          loadBar(0);
                  return false;
                  }
//	   if (!document.domini_eu.TechC.checked){
                   if (document.domini.orgTc.value == ""){
                   alert("Inserire il nome Org del Conatto Tecnico.");
	   	   loadBar(0);
                   return false;
                   }
                   if (document.domini.nomeTc.value == ""){
                   alert("Inserire il nome TECH-C.");
	           loadBar(0);
                   return false;
                   }
                   if (document.domini.address1Tc.value == ""){
                   alert("Inserire l'indirizzo TECH-C.");
                   return false;
                   }
                   if (document.domini.city1Tc.value == ""){
                   alert("Inserire la citta TECH-C.");
                   return false;
                   }
                   if (document.domini.cap1Tc.value == ""){
                   alert("Inserire il cap TECH-C.");
                   return false;
	           }
                   if (document.domini.prov1Tc.value == ""){
                   alert("Inserire la provincia TECH-C.");
                   return false;
	           }
		// TELEFONO
                  if (document.domini.intpref1Tc.value == ""){
                  alert("Inserire il prefisso internazionale nel campo telefono del Registrant.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.intpref1Tc.value.substr(0,1) != "+"){
                  alert("Il campo prefisso telefono del Registrant deve essre in forma +39.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.tel1Tc.value == ""){
                  alert("Inserire il  telefono del Registrant.");
	          loadBar(0);
                  return false;
                  }
		// FAX
                  if (document.domini.intfax1Tc.value == ""){
                  alert("Inserire il prefisso internazionale nel campo fax del Registrant.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.intfax1Tc.value.substr(0,1) != "+"){
                  alert("Il campo prefisso fax del Registrant deve essre in forma +39.");
	          loadBar(0);
                  return false;
                  }
                  if (document.domini.fax1Tc.value == ""){
                  alert("Inserire il  fax del Registrant.");
	          loadBar(0);
                  return false;
                  }
		//EMAIL
                   if (document.domini.emailTc.value == ""){
                   alert("Inserire l'indirizzo email TECH-C.");
                   return false;
                   }
//	}	
        document.domini.submit();
        //   alert("OK ");
        return true;
}
function validate_ev()  {
                                
                                       if (document.scheda_evento.NomeEvento.value == ""){
                                       alert("Inserire il nome dell'evento .");
                                       return false;
                                      }
                                       if (document.scheda_evento.d_start.value == "" || document.scheda_evento.m_start.value == "" || document.scheda_evento.a_start.value == ""){
                                       alert("Inserire la data d'inizio dell'evento .");
                                       return false;
                                      }
                                      if (document.scheda_evento.d_start.value < 1 || document.scheda_evento.d_start.value > 31){
                                      alert("Formato data (Giorno) non valido.");
                                      return false;
                                      }
                                      if (document.scheda_evento.m_start.value < 1 || document.scheda_evento.m_start.value > 12){
                                      alert("Formato data (Mese) non valido.");
                                      return false;
                                      }
                                      if (document.scheda_evento.a_start.value < 2005 ){
                                      alert("Formato data (Anno)  non valido.");
                                      return false;
                                      }



                                       if (document.scheda_evento.d_end.value == "" || document.scheda_evento.m_end.value == "" || document.scheda_evento.a_end.value == ""){
                                       alert("Inserire la data della fine dell'evento .");
                                       return false;
                                      }
                                      if (document.scheda_evento.d_end.value < 1 || document.scheda_evento.d_end.value > 31){
                                      alert("Formato data (Giorno) non valido.");
                                      return false;
                                      }
                                      if (document.scheda_evento.m_end.value < 1 || document.scheda_evento.m_end.value > 12){
                                      alert("Formato data (Mese) non valido.");
                                      return false;
                                      }
                                      if (document.scheda_evento.a_end.value < 2005 ){
                                      alert("Formato data (Anno)  non valido.");
                                      return false;
                                      }

var inday = new Date( document.scheda_evento.a_start.value, document.scheda_evento.m_start.value, document.scheda_evento.d_start.value);
var outday = new Date(document.scheda_evento.a_end.value, document.scheda_evento.m_end.value, document.scheda_evento.d_end.value);

				      if (outday < inday){
				       alert ("Attenzione! La data di inzio deve essere antecedente alla data di fine.");
                                       return false;
                                      }
                                       if (document.scheda_evento.Citta.value == ""){
                                       alert("Inserire la citta' dove si svolge l'evento .");
                                       return false;
                                      }
                                       if (document.scheda_evento.Budget.value == ""){
                                       alert("Inserire il preventivo di spesa.");
                                       return false;
                                      }else{
					dollarAmount('scheda_evento', 'Budget');
				      }



/*var closeday = new Date(document.scheda_evento.a_Chiusura.value, document.scheda_evento.m_Chiusura.value, document.scheda_evento.d_Chiusura.value);

				      if (closeday <= inday){
				      alert ("Attenzione! "+closedayoff+" La data di chiusura deve essere antecedente alla data di inizio di almeno 15 gg.");
                                      return false;
                                      }
*/
				if(document.scheda_evento.Stato.disabled == false){
					if (document.scheda_evento.Stato.options[document.scheda_evento.Stato.selectedIndex].text == 'Autorizzato' && document.scheda_evento.OCS.options[document.scheda_evento.OCS.selectedIndex].text == ''){
                                       	alert("Assegnare il Centro Servizi.");
                                       	return false;
					}
				}

        document.scheda_evento.submit();
        return true;
}




function validate(data_evento)  {
var dataevento = data_evento.split(' ');
var dataevin = dataevento[1].split('/');
var dataevend = dataevento[3].split('/');
var eventodatain = new Date(dataevin[2], dataevin[1]-1, dataevin[0]);
var eventodataend = new Date(dataevend[2], dataevend[1]-1, dataevend[0]);
var eventodataendlim = new Date(dataevend[2], dataevend[1]-1, dataevend[0]+4);
var eventodatainlim = new Date(dataevin[2], dataevin[1]-1, dataevin[0]-4);
	if (document.prenotazioni.ID_Parent){
		if (document.prenotazioni.Cognome.value == "" || document.prenotazioni.Nome.value == ""){
                alert("Inserire  il nome del partecipante.");
                return false;
                }
	}else{
		if (document.prenotazioni.ID_Cliente.options[document.prenotazioni.ID_Cliente.selectedIndex].text == "") {
                alert("Inserire  il nome del partecipante.");
                return false;
                }
        }
	if (!document.prenotazioni.ID_Parent){
		if (!document.prenotazioni.Lettera[0].checked && !document.prenotazioni.Lettera[1].checked){
                alert("Selezionare il campo lettera.");
                return false;
                }
		if (document.prenotazioni.Hotel.checked ){
               
                      if ( document.prenotazioni.Cittahtl.value == "") {
                      alert("Inserire il  la citta dell'albergo.");
                      return false;
                     }
                      if (document.prenotazioni.d_inrq.options[document.prenotazioni.d_inrq.selectedIndex].text == "" || document.prenotazioni.m_inrq.options[document.prenotazioni.m_inrq.selectedIndex].text == "" || document.prenotazioni.a_inrq.options[document.prenotazioni.a_inrq.selectedIndex].text == ""){
                      alert("Inserire la data di arrivo.");
                      return false;
                     }
                     if (document.prenotazioni.d_inrq.options[document.prenotazioni.d_inrq.selectedIndex].text < 1 || document.prenotazioni.d_inrq.options[document.prenotazioni.d_inrq.selectedIndex].text > 31){
                     alert("Formato data (Giorno) non valido.");
                     return false;
                     }
                     if (document.prenotazioni.m_inrq.options[document.prenotazioni.m_inrq.selectedIndex].text < 1 || document.prenotazioni.m_inrq.options[document.prenotazioni.m_inrq.selectedIndex].text > 12){
                     alert("Formato data (Mese) non valido.");
                     return false;
                     }
                     if (document.prenotazioni.a_inrq.options[document.prenotazioni.a_inrq.selectedIndex].text < 2005 ){
                     alert("Formato data (Anno)  non valido.");
                     return false;
                     }

                      if (document.prenotazioni.d_outrq.options[document.prenotazioni.d_outrq.selectedIndex].text == "" || document.prenotazioni.m_outrq.options[document.prenotazioni.m_outrq.selectedIndex].text == "" || document.prenotazioni.a_outrq.options[document.prenotazioni.a_outrq.selectedIndex].text == ""){
                      alert("Inserire la data di arrivo.");
                      return false;
                     }
                     if (document.prenotazioni.d_outrq.options[document.prenotazioni.d_outrq.selectedIndex].text < 1 || document.prenotazioni.d_outrq.options[document.prenotazioni.d_outrq.selectedIndex].text > 31){
                     alert("Formato data (Giorno) non valido.");
                     return false;
                     }
                     if (document.prenotazioni.m_outrq.options[document.prenotazioni.m_outrq.selectedIndex].text < 1 || document.prenotazioni.m_outrq.options[document.prenotazioni.m_outrq.selectedIndex].text > 12){
                     alert("Formato data (Mese) non valido.");
                     return false;
                     }
                     if (document.prenotazioni.a_outrq.options[document.prenotazioni.a_outrq.selectedIndex].text < 2005 ){
                     alert("Formato data (Anno)  non valido.");
                     return false;
                     }
var inday = new Date( document.prenotazioni.a_inrq.options[document.prenotazioni.a_inrq.selectedIndex].text, document.prenotazioni.m_inrq.options[document.prenotazioni.m_inrq.selectedIndex].text-1, document.prenotazioni.d_inrq.options[document.prenotazioni.d_inrq.selectedIndex].text);
var outday = new Date(document.prenotazioni.a_outrq.options[document.prenotazioni.a_outrq.selectedIndex].text, document.prenotazioni.m_outrq.options[document.prenotazioni.m_outrq.selectedIndex].text-1, document.prenotazioni.d_outrq.options[document.prenotazioni.d_outrq.selectedIndex].text);

		     if (outday <= inday){
                     alert ("Attenzione! La data "+inday+" di arrivo deve essere antecedente alla data di partenza.");
                     return false;
                     }

		     if (inday < eventodatainlim || inday > eventodataend){
                     alert ("Attenzione! La data di arrivo non puo' essere antecedente alla data di inizio dell'evento di piu' di 4 giorni.");
                     return false;
                     }

		     if (outday > eventodataendlim){
                     alert ("Attenzione! La data di partenza non puo' essere posterioire alla data di fine dell'evento di piu' di 4 giorni.");
                     return false;
                     }

		     if (inday < eventodatain && outday < eventodatain){
                     alert ("Attenzione! La data di arrivo e la data di partenza devono essere comprese nei giorni di svolgimento dell'evento.");
                     return false;
                     }

                     if (document.prenotazioni.Roomrq.options[document.prenotazioni.Roomrq.selectedIndex].text == '' ){
                     alert("Inserire il tipo di camera");
                     return false;
                     }

	       }
	}
	if (document.prenotazioni.Volo.checked ){
var takeoffA = new Date( document.prenotazioni.V_a_and.options[document.prenotazioni.V_a_and.selectedIndex].text, document.prenotazioni.V_m_and.options[document.prenotazioni.V_m_and.selectedIndex].text-1, document.prenotazioni.V_d_and.options[document.prenotazioni.V_d_and.selectedIndex].text);
var takeoffR = new Date( document.prenotazioni.V_a_rit.options[document.prenotazioni.V_a_rit.selectedIndex].text, document.prenotazioni.V_m_rit.options[document.prenotazioni.V_m_rit.selectedIndex].text-1, document.prenotazioni.V_d_rit.options[document.prenotazioni.V_d_rit.selectedIndex].text);
              if (document.prenotazioni.V_d_and.options[document.prenotazioni.V_d_and.selectedIndex].text == ""
	         && document.prenotazioni.V_d_rit.options[document.prenotazioni.V_d_rit.selectedIndex].text == ""){
              alert("Attenzione! Avete selezionato il campo Aereo, inserire i parametri per il volo di andata o per quello di ritorno altrimenti deselezionare l'opzione.");
              return false;
	      }
                      if (document.prenotazioni.V_d_and.options[document.prenotazioni.V_d_and.selectedIndex].text != ""
			 || document.prenotazioni.V_m_and.options[document.prenotazioni.V_m_and.selectedIndex].text != ""
			 || document.prenotazioni.V_a_and.options[document.prenotazioni.V_a_and.selectedIndex].text != ""){
                              if (document.prenotazioni.V_d_and.options[document.prenotazioni.V_d_and.selectedIndex].text == ""
		                 || document.prenotazioni.V_m_and.options[document.prenotazioni.V_m_and.selectedIndex].text == ""
		                 || document.prenotazioni.V_a_and.options[document.prenotazioni.V_a_and.selectedIndex].text == ""){
                              alert("Inserire la data per il volo d'andata.");
                              return false;
                             }
                           
                              if ( document.prenotazioni.TimeVoloHA.value == "") {
                              alert("Inserire un orario indicativo di partenza per il volo d'andata (es. 10).");
                              return false;
                             }
                           
		             if (takeoffA < eventodatainlim){
                             alert ("Attenzione! La data del volo di andata non puo' essere antecedente alla data di inizio dell'evento di piu' di 4 giorni.");
                             return false;
                             }
		             if (takeoffA > eventodataend){
                             alert ("Attenzione! La data del volo di andata non puo' essere posteriore alla data di fine dell'evento.");
                             return false;
                             }
                              if ( document.prenotazioni.AptAnd.value == "") {
                              alert("Inserire la citta' o l'aereoporto di partenza per il volo di andata.");
                              return false;
                             }
                              if ( document.prenotazioni.AptAnd2.value == "") {
                              alert("Inserire la citta' o l'aereoporto di destinazione per il volo di andata.");
                              return false;
                             }
                      }
                      if (document.prenotazioni.V_d_rit.options[document.prenotazioni.V_d_rit.selectedIndex].text != ""
			 || document.prenotazioni.V_m_rit.options[document.prenotazioni.V_m_rit.selectedIndex].text != ""
			 || document.prenotazioni.V_a_rit.options[document.prenotazioni.V_a_rit.selectedIndex].text != ""){

                             if (document.prenotazioni.V_d_rit.options[document.prenotazioni.V_d_rit.selectedIndex].text == ""
		                || document.prenotazioni.V_m_rit.options[document.prenotazioni.V_m_rit.selectedIndex].text == ""
		                || document.prenotazioni.V_a_rit.options[document.prenotazioni.V_a_rit.selectedIndex].text == ""){
                             alert("Inserire la data per il volo di ritorno");
                             return false;
                             }
                              if ( document.prenotazioni.TimeVoloHR.value == "") {
                              alert("Inserire un orario indicativo di partenza per il volo di ritorno (es. 10).");
                              return false;
                             }
		             if (takeoffR < eventodatain){
                             alert ("Attenzione! La data del volo di ritorno non puo' essere antecedente alla data di inizio dell'evento.");
                             return false;
                             }
		             if (takeoffR > eventodataendlim){
                             alert ("Attenzione! La data del volo di andata non puo' essere posteriore per piu' di 4 giorni alla data di fine dell'evento.");
                             return false;
                             }
                              if ( document.prenotazioni.AptRit.value == "") {
                              alert("Inserire la citta' o l'aereoporto di partenza per il volo di ritorno.");
                              return false;
                             }
                              if ( document.prenotazioni.AptRit2.value == "") {
                              alert("Inserire la citta' o l'aereoporto di destinazione per il volo di ritorno.");
                              return false;
                             }
/*		             if (takeoffR < takeoffA){
                             alert ("Attenzione! La data  di arrivo (AEREO) deve essere antecedente alla data di partenza.");
                             return false;
                             }
		             if (takeoffR > eventodataendlim){
                             alert ("Attenzione! La data di partenza (AEREO) non puo' essere posterioire alla data di fine dell'evento di piu' di 4 giorni.");
                             return false;
                             }
                             
		             if (takeoffA < eventodatain && takeoffR < eventodatain){
                             alert ("Attenzione! La data di arrivo e la data di partenza (AEREO) devono essere comprese nei giorni di svolgimento dell'evento.");
                             return false;
                             }
  */                   }
	}
	if (document.prenotazioni.Treno.checked ){
var trenoA = new Date( document.prenotazioni.T_a_and.options[document.prenotazioni.T_a_and.selectedIndex].text, document.prenotazioni.T_m_and.options[document.prenotazioni.T_m_and.selectedIndex].text-1, document.prenotazioni.T_d_and.options[document.prenotazioni.T_d_and.selectedIndex].text);
var trenoR = new Date( document.prenotazioni.T_a_rit.options[document.prenotazioni.T_a_rit.selectedIndex].text, document.prenotazioni.T_m_rit.options[document.prenotazioni.T_m_rit.selectedIndex].text-1, document.prenotazioni.T_d_rit.options[document.prenotazioni.T_d_rit.selectedIndex].text);
                           
              if (document.prenotazioni.T_d_and.options[document.prenotazioni.T_d_and.selectedIndex].text == ""
	         && document.prenotazioni.T_d_rit.options[document.prenotazioni.T_d_rit.selectedIndex].text == ""){
              alert("Attenzione! Avete selezionato il campo Treno, inserire i parametri per il treno di andata o per quello di ritorno altrimenti deselezionare l'opzione.");
              return false;
	      }
                      if (document.prenotazioni.T_d_and.options[document.prenotazioni.T_d_and.selectedIndex].text != ""
			 || document.prenotazioni.T_m_and.options[document.prenotazioni.T_m_and.selectedIndex].text != ""
			 || document.prenotazioni.T_a_and.options[document.prenotazioni.T_a_and.selectedIndex].text != ""){
                              if (document.prenotazioni.T_d_and.options[document.prenotazioni.T_d_and.selectedIndex].text == ""
		                 || document.prenotazioni.T_m_and.options[document.prenotazioni.T_m_and.selectedIndex].text == ""
		                 || document.prenotazioni.T_a_and.options[document.prenotazioni.T_a_and.selectedIndex].text == ""){
                              alert("Inserire la data per il treno d'andata.");
                              return false;
                             }
                           
                              if ( document.prenotazioni.TimeTrenoHA.value == "") {
                              alert("Inserire un orario indicativo di partenza per il treno d'andata (es. 10).");
                              return false;
                             }
		             if (trenoA < eventodatainlim){
                             alert ("Attenzione! La data del treno di andata non puo' essere antecedente alla data di inizio dell'evento di piu' di 4 giorni.");
                             return false;
                             }
		             if (trenoA > eventodataend){
                             alert ("Attenzione! La data del treno di andata non puo' essere posteriore alla data di fine dell'evento.");
                             return false;
                             }
                              if ( document.prenotazioni.StAnd.value == "") {
                              alert("Inserire la citta' o la stazione di partenza per il treno di andata.");
                              return false;
                             }
                              if ( document.prenotazioni.StAnd2.value == "") {
                              alert("Inserire la citta' o la stazione di destinazione per il treno di andata.");
                              return false;
                             }
                      }
                      if (document.prenotazioni.T_d_rit.options[document.prenotazioni.T_d_rit.selectedIndex].text != ""
			 || document.prenotazioni.T_m_rit.options[document.prenotazioni.T_m_rit.selectedIndex].text != ""
			 || document.prenotazioni.T_a_rit.options[document.prenotazioni.T_a_rit.selectedIndex].text != ""){

                             if (document.prenotazioni.T_d_rit.options[document.prenotazioni.T_d_rit.selectedIndex].text == ""
		                || document.prenotazioni.T_m_rit.options[document.prenotazioni.T_m_rit.selectedIndex].text == ""
		                || document.prenotazioni.T_a_rit.options[document.prenotazioni.T_a_rit.selectedIndex].text == ""){
                             alert("Inserire la data per il treno di ritorno");
                             return false;
                             }
                              if ( document.prenotazioni.TimeTrenoHR.value == "") {
                              alert("Inserire un orario indicativo di partenza per il treno di ritorno (es. 10).");
                              return false;
                             }
		             if (trenoR < trenoA){
                             alert ("Attenzione! La data  di arrivo (TRENO) deve essere antecedente alla data di partenza.");
                             return false;
                             }
		             if (trenoR > eventodataendlim){
                             alert ("Attenzione! La data di partenza (TRENO) non puo' essere posterioire alla data di fine dell'evento di piu' di 4 giorni.");
                             return false;
                             }
                             
		             if (trenoA < eventodatain && trenoR < eventodatain){
                             alert ("Attenzione! La data di arrivo e la data di partenza  (TRENO) devono essere comprese nei giorni di svolgimento dell'evento.");
                             return false;
                             }
                     }
	}
        document.prenotazioni.submit();
        return true;
}
function validate_prev(){
	if (document.prenotazioni.Hotel.checked ){
		if (document.prenotazioni.Nomehtl.value == ''){
		alert ("Inserire il nome dell'Hotel");
		return false;
		}
		if (document.prenotazioni.CostoRoom.value == '0.00'){
		alert ("Inserire il costo della camera");
		return false;
		}
	}

	if (document.prenotazioni.Volo.checked ){
	}

	if (document.prenotazioni.Treno.checked ){
	}

        document.prenotazioni.submit();
        return true;
}

function fill_mail(){
document.user_form.Email.value = document.user_form.Login.value+"@gadagroup.it";
document.user_form.Email.value = document.user_form.Email.value.toLowerCase();
}
function fill_login(){
document.user_form.Login.value = document.user_form.Nome.value.substr(0,1)+"."+document.user_form.Cognome.value;
document.user_form.Login.value = document.user_form.Login.value.toLowerCase();
}
function fill_pass1(){
document.user_form.NewPassword.value = document.user_form.Cognome.value.toLowerCase();
document.user_form.NewPassword2.value = document.user_form.Cognome.value.toLowerCase();
}

function summ_rq(){
	document.prenotazioni.Tot_Rq.value = document.prenotazioni.CostoHotel.value + document.prenotazioni.CostoVolo.value + document.prenotazioni.CostoTreno.valua;
}
function set_PM(STR){
	if (STR == 'ON'){
		if(document.domini.TechC.checked){
		document.domini.PostMaster2.disabled = true;
		}else{
		document.domini.PostMaster2.disabled = false;
		}
	}else if(STR == 'OFF1'){
	document.domini.PostMaster.checked = false;
	}else if(STR == 'OFF2'){
	document.domini.PostMaster2.checked = false;
	}

}
function check_enableIT(){
enable_TcIT();
//enable_Zc();
}
function check_enableCOM(){
enable_AdCOM();
enable_TcCOM();
//enable_Zc();
}
function DisplayDiv(namediv){
 var el=document.getElementById(namediv);
	if(el.style.visibility == 'hidden'){
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
	}else{
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
	}
}
function enable_SetDomain(){
 var el=document.getElementById('set_domain');
	if (document.hosting_shared.SetDomain.checked ){
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
	}else{
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
	}
}
function enable_AdCOM(){
 var el=document.getElementById('techc_info');

	if (document.domini.TechC.checked ){
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
		document.domini.nomeTc.disabled = true;
		document.domini.address1Tc.disabled = true;
		document.domini.city1Tc.disabled = true;
		document.domini.cap1Tc.disabled = true;
		document.domini.prov1Tc.disabled = true;
		document.domini.emailTc.disabled = true;
		document.domini.intpref1Tc.disabled = true;
		//document.domini.preftel1Tc.disabled = true;
		document.domini.tel1Tc.disabled = true;
		document.domini.intfax1Tc.disabled = true;
		//document.domini.prefax1Tc.disabled = true;
		document.domini.fax1Tc.disabled = true;
		document.domini.nichandleTc.disabled = true;
	}else{
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
		document.domini.nomeTc.disabled = false;
		document.domini.address1Tc.disabled = false;
		document.domini.city1Tc.disabled = false;
		document.domini.cap1Tc.disabled = false;
		document.domini.prov1Tc.disabled = false;
		document.domini.emailTc.disabled = false;
		document.domini.intpref1Tc.disabled = false;
		//document.domini.preftel1Tc.disabled = false;
		document.domini.tel1Tc.disabled = false;
		document.domini.intfax1Tc.disabled = false;
		//document.domini.prefax1Tc.disabled = false;
		document.domini.fax1Tc.disabled = false;
		document.domini.nichandleTc.disabled = false;
	}

}
function enable_TcCOM(){
var el=document.getElementById('postmaster_info');
	if (document.domini.PostMaster.checked || document.domini.PostMaster2.checked){
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = true;
		document.domini.address1Pm.disabled = true;
		document.domini.city1Pm.disabled = true;
		document.domini.cap1Pm.disabled = true;
		document.domini.prov1Pm.disabled = true;
		document.domini.emailPm.disabled = true;
		document.domini.intpref1Pm.disabled = true;
		//document.domini.preftel1Pm.disabled = true;
		document.domini.tel1Pm.disabled = true;
		document.domini.intfax1Pm.disabled = true;
		//document.domini.prefax1Pm.disabled = true;
		document.domini.fax1Pm.disabled = true;
		document.domini.nichandlePm.disabled = true;
	}else{
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = false;
		document.domini.address1Pm.disabled = false;
		document.domini.city1Pm.disabled = false;
		document.domini.cap1Pm.disabled = false;
		document.domini.prov1Pm.disabled = false;
		document.domini.emailPm.disabled = false;
		document.domini.intpref1Pm.disabled = false;
		//document.domini.preftel1Pm.disabled = false;
		document.domini.tel1Pm.disabled = false;
		document.domini.intfax1Pm.disabled = false;
		//document.domini.prefax1Pm.disabled = false;
		document.domini.fax1Pm.disabled = false;
		document.domini.nichandlePm.disabled = false;
	}

}
function enable_TcIT(){
var el=document.getElementById('postmaster_info');
	if (document.domini.PostMaster2.checked){
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = true;
		document.domini.surnamePm.disabled = true;
		document.domini.address1Pm.disabled = true;
		document.domini.city1Pm.disabled = true;
		document.domini.cap1Pm.disabled = true;
		document.domini.prov1Pm.disabled = true;
		document.domini.emailPm.disabled = true;
		document.domini.intpref1Pm.disabled = true;
		//document.domini.preftel1Pm.disabled = true;
		document.domini.tel1Pm.disabled = true;
		document.domini.intfax1Pm.disabled = true;
		//document.domini.prefax1Pm.disabled = true;
		document.domini.fax1Pm.disabled = true;
		document.domini.nichandlePm.disabled = true;
	}else{
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = false;
		document.domini.surnamePm.disabled = false;
		document.domini.address1Pm.disabled = false;
		document.domini.city1Pm.disabled = false;
		document.domini.cap1Pm.disabled = false;
		document.domini.prov1Pm.disabled = false;
		document.domini.emailPm.disabled = false;
		document.domini.intpref1Pm.disabled = false;
		//document.domini.preftel1Pm.disabled = false;
		document.domini.tel1Pm.disabled = false;
		document.domini.intfax1Pm.disabled = false;
		//document.domini.prefax1Pm.disabled = false;
		document.domini.fax1Pm.disabled = false;
		document.domini.nichandlePm.disabled = false;
	}

}
/*
unction enable_Zc(num){
	if (document.domini.ZoneC.checked ){
		document.domini.zonec.disabled = true;
		document.domini.ip1.disabled = true;
		document.domini.ip2.disabled = true;
		document.domini.ns1.disabled = true;
		document.domini.ns2.disabled = true;
		if(num == 3){
		document.domini.ip3.disabled = true;
		document.domini.ns3.disabled = true;
		}else if(num == 4){
		document.domini.ip4.disabled = true;
		document.domini.ns4.disabled = true;
		}
	}else{
		document.domini.zonec.disabled = false;
		document.domini.ip1.disabled = false;
		document.domini.ip2.disabled = false;
		document.domini.ns1.disabled = false;
		document.domini.ns2.disabled = false;
		if(num == 3){
		document.domini.ip3.disabled = false;
		document.domini.ns3.disabled = false;
		}else if(num == 4){
		document.domini.ip4.disabled = false;
		document.domini.ns4.disabled = false;
		}
	}

}
*/
function check_enable(){
enable_Tc();
enable_Pm();
//enable_Zc();
}
function enable_Tc(){
 var el=document.getElementById('techc_info');
 var el2=document.getElementById('techc_info_rol');

	if (document.domini.TechC.checked ){

                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
		document.domini.nomeTc.disabled = true;
		document.domini.surnameTc.disabled = true;
		document.domini.address1Tc.disabled = true;
		document.domini.city1Tc.disabled = true;
		document.domini.cap1Tc.disabled = true;
		document.domini.prov1Tc.disabled = true;
		document.domini.emailTc.disabled = true;
		document.domini.intpref1Tc.disabled = true;
		document.domini.preftel1Tc.disabled = true;
		document.domini.tel1Tc.disabled = true;
		document.domini.intfax1Tc.disabled = true;
		document.domini.prefax1Tc.disabled = true;
		document.domini.fax1Tc.disabled = true;
		document.domini.nichandleTc.disabled = true;
	}else{
		if(document.domini.TipoTc[1].checked == true){
			el2.style.visibility = 'visible';
                	el2.style.display = 'block';
                	el2.style.zIndex = 2;
		}
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
		document.domini.nomeTc.disabled = false;
		document.domini.surnameTc.disabled = false;
		document.domini.address1Tc.disabled = false;
		document.domini.city1Tc.disabled = false;
		document.domini.cap1Tc.disabled = false;
		document.domini.prov1Tc.disabled = false;
		document.domini.emailTc.disabled = false;
		document.domini.intpref1Tc.disabled = false;
		document.domini.preftel1Tc.disabled = false;
		document.domini.tel1Tc.disabled = false;
		document.domini.intfax1Tc.disabled = false;
		document.domini.prefax1Tc.disabled = false;
		document.domini.fax1Tc.disabled = false;
		document.domini.nichandleTc.disabled = false;
	}

}
function enable_Pm(){
var el=document.getElementById('postmaster_info');
	if (document.domini.PostMaster.checked || document.domini.PostMaster2.checked){
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = true;
		document.domini.surnamePm.disabled = true;
		document.domini.address1Pm.disabled = true;
		document.domini.city1Pm.disabled = true;
		document.domini.cap1Pm.disabled = true;
		document.domini.prov1Pm.disabled = true;
		document.domini.emailPm.disabled = true;
		document.domini.intpref1Pm.disabled = true;
		document.domini.preftel1Pm.disabled = true;
		document.domini.tel1Pm.disabled = true;
		document.domini.intfax1Pm.disabled = true;
		document.domini.prefax1Pm.disabled = true;
		document.domini.fax1Pm.disabled = true;
		document.domini.nichandlePm.disabled = true;
	}else{
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
		document.domini.nomePm.disabled = false;
		document.domini.surnamePm.disabled = false;
		document.domini.address1Pm.disabled = false;
		document.domini.city1Pm.disabled = false;
		document.domini.cap1Pm.disabled = false;
		document.domini.prov1Pm.disabled = false;
		document.domini.emailPm.disabled = false;
		document.domini.intpref1Pm.disabled = false;
		document.domini.preftel1Pm.disabled = false;
		document.domini.tel1Pm.disabled = false;
		document.domini.intfax1Pm.disabled = false;
		document.domini.prefax1Pm.disabled = false;
		document.domini.fax1Pm.disabled = false;
		document.domini.nichandlePm.disabled = false;
	}

}
function enable_Zc(num){
	if (document.domini.ZoneC.checked ){
		document.domini.zonec.disabled = true;
		document.domini.ip1.disabled = true;
		document.domini.ip2.disabled = true;
		document.domini.ns1.disabled = true;
		document.domini.ns2.disabled = true;
		if(num == 3){
		document.domini.ip3.disabled = true;
		document.domini.ns3.disabled = true;
		}else if(num == 4){
		document.domini.ip4.disabled = true;
		document.domini.ns4.disabled = true;
		}
	}else{
		document.domini.zonec.disabled = false;
		document.domini.ip1.disabled = false;
		document.domini.ip2.disabled = false;
		document.domini.ns1.disabled = false;
		document.domini.ns2.disabled = false;
		if(num == 3){
		document.domini.ip3.disabled = false;
		document.domini.ns3.disabled = false;
		}else if(num == 4){
		document.domini.ip4.disabled = false;
		document.domini.ns4.disabled = false;
		}
	}

}
/*function resetDNS(zonec){
	if (document.domini.ZoneC.checked ){
		document.domini.zonec.value = zonec;
		document.domini.ip1.value = '80.70.112.11';
		document.domini.ip2.value = '193.205.245.8';
		document.domini.ns1.value = 'ns.lynk.it';
		document.domini.ns2.value = 'dns2.nic.it';
	}else{
		document.domini.zonec.value = '';
		document.domini.ip1.value = '';
		document.domini.ip2.value = '';
		document.domini.ns1.value = '';
		document.domini.ns2.value = '';
	}

}
*/
function validate_pwd(){
	if (document.user_form.NewPassword.value == '' || document.user_form.NewPassword2.value == ''){
	 alert ('Cambiamento password obbligatorio.');
	 return false;
	}
	if (document.user_form.NewPassword.value == document.user_form.NewPassword2.value){
	  document.user_form.submit();
	}else{
	 alert ('I due campi password non coincidono. Riprovare.');
	}
}
function validate_pdw(){
	if (document.user_form.NewPassword.value == document.user_form.NewPassword2.value){
	  document.user_form.submit();
	}else{
	 alert ('I due campi password non coincidono. Riprovare.');
	}
}
function validate_conf_esito(){
 if (document.conf_elimina.Esito[0].checked || 
	document.conf_elimina.Esito[1].checked || 
	document.conf_elimina.Esito[2].checked || 
	document.conf_elimina.Esito[3].checked || 
	document.conf_elimina.Esito[4].checked || 
	document.conf_elimina.Esito[5].checked || 
	document.conf_elimina.Esito[6].checked || 
	document.conf_elimina.Esito[7].checked || 
	document.conf_elimina.Esito[8].checked || 
	document.conf_elimina.Esito[9].checked || 
	document.conf_elimina.Esito[10].checked || 
	document.conf_elimina.Esito[11].checked || 
	document.conf_elimina.Esito[12].checked){
   document.conf_elimina.submit();
 }else{
 alert ("Devi selezionare almeno un esito");
 }
}
function validate_conf_send_promo(){
 if (document.conf_elimina.Esito.options[document.conf_elimina.Esito.selectedIndex].text != ''){
   document.conf_elimina.submit();
 }else{
 alert ("Devi selezionare almeno una promozione");
 }
}
function validate_delete(){
 if (document.conf_elimina.Conf_Del.checked){
   document.conf_elimina.submit();
 }else{
 alert ("Devi confermare l'eliminazione");
 }
}
function notify(Dom){
        NewWin = window.open('/usr/notify.php?Action=Show&Dominio='+Dom,'NewWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=600,height=400');
}
function newin(url){
        NewWin = window.open(url,'NewWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=900,height=700');
}
function open_editor(url){
        NewWin = window.open(url,'NewWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=1,left=1,width=900,height=600');
}

function checkNum(data) {      // checks if all characters
var valid = "0123456789.";     // are valid numbers or a "."
var ok = 1; var checktemp;
for (var i=0; i<data.length; i++) {
checktemp = "" + data.substring(i, i+1);
if (valid.indexOf(checktemp) == "-1") return 0; }
return 1;
}


function dollarAmount(form, field) { // idea by David Turley
Num = "" + eval("document." + form + "." + field + ".value");
dec = Num.indexOf(".");
end = ((dec > -1) ? "" + Num.substring(dec,Num.length) : ".00");
Num = "" + parseInt(Num);

var temp1 = "";
var temp2 = "";

if (checkNum(Num) == 0) {
alert("Campo valuta non valido. Riprovare.");
}
else {

if (end.length == 2) end += "0";
if (end.length == 1) end += "00";
if (end == "") end += ".00";

var count = 0;
for (var k = Num.length-1; k >= 0; k--) {
var oneChar = Num.charAt(k);
if (count == 3) {
temp1 += "";
temp1 += oneChar;
count = 1;
continue;
}
else {
temp1 += oneChar;
count ++;
   }
}
for (var k = temp1.length-1; k >= 0; k--) {
var oneChar = temp1.charAt(k);
temp2 += oneChar;
}
temp2 =  temp2 + end;
eval("document." + form + "." + field + ".value = '" + temp2 + "';");
   }
}

function SelectStato(str){

var Status = document.cerca.Stato.options[document.cerca.Stato.selectedIndex].text
location.href="ocs_prenotazioni.php?Action=Show&Status="+Status;

}

function SelectAnno(str){
	if (str == 'FT'){
	var Anno = document.listinvoice.AnnoFattura.value;
	location.href="fatture.php?Action=Show&anno="+Anno;
	}else if (str == 'AQ'){
	var Anno = document.listinvoice.AnnoFattura.value;
	location.href="acquisti.php?Action=Show&anno="+Anno;
	}else if (str == 'CTR'){
	var Anno = document.listinvoice.AnnoFattura.value;
	location.href="contratti.php?Action=Show&anno="+Anno;
	}else{
	var Anno = document.cerca.AnnoFattura.value;
	location.href="primanota.php?Action=Show&Anno="+Anno;
	}
}


function emailCheck() {
txt=document.clienti.Email.value;
if (txt.indexOf("@")<3){
alert("I'm sorry. This email address seems wrong. Please"
+" check the prefix and '@' sign.");
return false;
}
if ((txt.indexOf(".")<7)){
//if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
//&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".net")<5)
//&&(txt.indexOf(".it")<5)&&(txt.indexOf(".edu")<5)){
alert("I'm sorry. This email address seems wrong. Please"
+" check the suffix for accuracy. (It should include a "
+".com, .edu, .net, .org, .gov or .mil)");
return false;
   }
//alert("Verification successful!  Your form would not have been submitted.");
//return true;
}

function show_iscr(){
	if(document.prenotazioni.Iscrizione.checked){
	document.prenotazioni.CostoInt.disabled = false;
	document.prenotazioni.CostoInt.value= '0.00';
	}else{
	document.prenotazioni.CostoInt.disabled = true;
	document.prenotazioni.CostoInt.value = '';

	}
}
function findnic(str){

	if(str == 'ADMC'){
 		nome = document.domini.nomeAc.value;
 		cognome = document.domini.surnameAc.value;
	}else if(str == 'TECH'){
 		nome = document.domini.nomeTc.value;
 		cognome = document.domini.surnameTc.value;
	}else{
 		nome = document.domini.nomePm.value;
 		cognome = document.domini.surnamePm.value;
	}
 if (nome != '' && cognome != '')
  HndWin = window.open('http://support.lynk.it/cgi-bin/whois.pl?'+nome+' '+cognome,'HndWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=500');
 else
   alert('inserire Nome e Cognome');
}
 function fillnick(num){
 opener.document.domini.nichandle.value = document.nicform.nic_handle.value;
 window.close();
 }

function findnicdb_eu(str){

 if(str == 'ADMC'){
 nome = document.domini_eu.nichandleAc.value;
  }else if (str == 'TECH'){
 nome = document.domini_eu.nichandleTc.value;
 }else{
 nome = document.domini_eu.nichandlePm.value;
 }
 if (nome != '')
  NHndWin = window.open('select_person_com.php?nichandle='+nome+'&STR='+str,'NHndWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=600,height=300');
 else
   alert('inserire Nichandle');
}
function findnicdb_com(str){

 if(str == 'ADMC'){
 nome = document.domini.nichandleAc.value;
  }else if (str == 'TECH'){
 nome = document.domini.nichandleTc.value;
 }else{
 nome = document.domini.nichandlePm.value;
 }
 if (nome != '')
  NHndWin = window.open('select_person_com.php?nichandle='+nome+'&STR='+str,'NHndWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=600,height=300');
 else
   alert('inserire Nichandle');
}
function findnicdb(str){

 if(str == 'ADMC'){
 nome = document.domini.nichandleAc.value;
  }else if (str == 'TECH'){
 nome = document.domini.nichandleTc.value;
 }else{
 nome = document.domini.nichandlePm.value;
 }
 if (nome != '')
  NHndWin = window.open('select_person.php?nichandle='+nome+'&STR='+str,'NHndWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width=600,height=300');
 else
   alert('inserire Nichandle');
}

 function fillnicdb(str){
	if (str == 'ADMC'){
		if(document.nicform.Tipo.value == 'Role'){
		alert("L'Adminc deve essere necessariamente associato ad un oggetto Person e non Role");
 		window.close();
           	return false;
		}
              opener.document.domini.nomeAc.value = document.nicform.nomePm.value;
              opener.document.domini.address1Ac.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Ac.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Ac.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Ac.value = document.nicform.prov1Pm.value;
              opener.document.domini.nichandleAc.value = document.nicform.nichandlePm.value;
                opener.document.domini.intpref1Ac.value = document.nicform.intpref1Pm.value;
                opener.document.domini.preftel1Ac.value = document.nicform.preftel1Pm.value;
                opener.document.domini.tel1Ac.value = document.nicform.tel1Pm.value;
                opener.document.domini.intfax1Ac.value = document.nicform.intfax1Pm.value;
                opener.document.domini.prefax1Ac.value = document.nicform.prefax1Pm.value;
                opener.document.domini.fax1Ac.value = document.nicform.fax1Pm.value;
                opener.document.domini.emailAc.value = document.nicform.emailPm.value;
	}else if (str == 'TECH'){
              opener.document.domini.nomeTc.value = document.nicform.nomePm.value;
              opener.document.domini.address1Tc.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Tc.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Tc.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Tc.value = document.nicform.prov1Pm.value;
              opener.document.domini.intpref1Tc.value = document.nicform.intpref1Pm.value;
              opener.document.domini.preftel1Tc.value = document.nicform.preftel1Pm.value;
              opener.document.domini.tel1Tc.value = document.nicform.tel1Pm.value;
              opener.document.domini.intfax1Tc.value = document.nicform.intfax1Pm.value;
              opener.document.domini.prefax1Tc.value = document.nicform.prefax1Pm.value;
              opener.document.domini.fax1Tc.value = document.nicform.fax1Pm.value;
              opener.document.domini.emailTc.value = document.nicform.emailPm.value;
              opener.document.domini.nichandleTc.value = document.nicform.nichandlePm.value;
	      var el=opener.document.getElementById('techc_info_rol');
              //var el2=opener.document.getElementById('techc_info_per');
		if(document.nicform.Tipo.value == 'Person'){
		opener.document.domini.TipoTc[0].checked = true;
		opener.document.domini.TipoTc[1].checked = false;
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
               //el2.style.visibility = 'visible';
               //el2.style.display = 'block';
               //el2.style.zIndex = 2;

		//alert('Person');
		}else{
              	opener.document.domini.AdmincRTC.value = document.nicform.Adminc.value;
              	opener.document.domini.TechcRTC.value = document.nicform.Techc.value;
		opener.document.domini.TipoTc[1].checked = true;
		opener.document.domini.TipoTc[0].checked = false;
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
               //el2.style.visibility = 'hidden';
               //el2.style.display = 'none';
               //el2.style.zIndex = 2;
		//alert('Role');
		}
	}else{
              opener.document.domini.nomePm.value = document.nicform.nomePm.value;
              opener.document.domini.address1Pm.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Pm.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Pm.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Pm.value = document.nicform.prov1Pm.value;
              opener.document.domini.intpref1Pm.value = document.nicform.intpref1Pm.value;
              opener.document.domini.preftel1Pm.value = document.nicform.preftel1Pm.value;
              opener.document.domini.tel1Pm.value = document.nicform.tel1Pm.value;
              opener.document.domini.intfax1Pm.value = document.nicform.intfax1Pm.value;
              opener.document.domini.prefax1Pm.value = document.nicform.prefax1Pm.value;
              opener.document.domini.fax1Pm.value = document.nicform.fax1Pm.value;
              opener.document.domini.emailPm.value = document.nicform.emailPm.value;
              opener.document.domini.nichandlePm.value = document.nicform.nichandlePm.value;
	}
 window.close();
 }

 function fillnicdb_com(str){
	if (str == 'ADMC'){
              opener.document.domini.orgAc.value = document.nicform.orgPm.value;
              opener.document.domini.nomeAc.value = document.nicform.nomePm.value;
              opener.document.domini.address1Ac.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Ac.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Ac.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Ac.value = document.nicform.prov1Pm.value;
              opener.document.domini.nichandleAc.value = document.nicform.nichandlePm.value;
                opener.document.domini.intpref1Ac.value = document.nicform.intpref1Pm.value;
                //opener.document.domini.preftel1Ac.value = document.nicform.preftel1Pm.value;
                opener.document.domini.tel1Ac.value = document.nicform.tel1Pm.value;
                opener.document.domini.intfax1Ac.value = document.nicform.intfax1Pm.value;
                //opener.document.domini.prefax1Ac.value = document.nicform.prefax1Pm.value;
                opener.document.domini.fax1Ac.value = document.nicform.fax1Pm.value;
                opener.document.domini.emailAc.value = document.nicform.emailPm.value;
	}else if (str == 'TECH'){
              opener.document.domini.orgTc.value = document.nicform.orgPm.value;
              opener.document.domini.nomeTc.value = document.nicform.nomePm.value;
              opener.document.domini.address1Tc.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Tc.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Tc.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Tc.value = document.nicform.prov1Pm.value;
              opener.document.domini.intpref1Tc.value = document.nicform.intpref1Pm.value;
              //opener.document.domini.preftel1Tc.value = document.nicform.preftel1Pm.value;
              opener.document.domini.tel1Tc.value = document.nicform.tel1Pm.value;
              opener.document.domini.intfax1Tc.value = document.nicform.intfax1Pm.value;
              //opener.document.domini.prefax1Tc.value = document.nicform.prefax1Pm.value;
              opener.document.domini.fax1Tc.value = document.nicform.fax1Pm.value;
              opener.document.domini.emailTc.value = document.nicform.emailPm.value;
              opener.document.domini.nichandleTc.value = document.nicform.nichandlePm.value;
	}else{
              opener.document.domini.orgPm.value = document.nicform.orgPm.value;
              opener.document.domini.nomePm.value = document.nicform.nomePm.value;
              opener.document.domini.address1Pm.value = document.nicform.address1Pm.value;
              opener.document.domini.cap1Pm.value = document.nicform.cap1Pm.value;
              opener.document.domini.city1Pm.value = document.nicform.city1Pm.value;
              opener.document.domini.prov1Pm.value = document.nicform.prov1Pm.value;
              opener.document.domini.intpref1Pm.value = document.nicform.intpref1Pm.value;
              //opener.document.domini.preftel1Pm.value = document.nicform.preftel1Pm.value;
              opener.document.domini.tel1Pm.value = document.nicform.tel1Pm.value;
              opener.document.domini.intfax1Pm.value = document.nicform.intfax1Pm.value;
              //opener.document.domini.prefax1Pm.value = document.nicform.prefax1Pm.value;
              opener.document.domini.fax1Pm.value = document.nicform.fax1Pm.value;
              opener.document.domini.emailPm.value = document.nicform.emailPm.value;
              opener.document.domini.nichandlePm.value = document.nicform.nichandlePm.value;
	}
 window.close();
 }








function show_all(){
document.cerca.Research.value = "%";
document.cerca.submit();
}



function validate_nd()  {

var nname = document.new_dom.domain.value;
var arr = new Array('.com','.net','.org','.biz','.info','.it','.eu','.in','.name','.us','.mobi');

var mai = nname;
var val = true;

var dot = mai.lastIndexOf(".");
var dname = mai.substring(0,dot);
var ext = mai.substring(dot,mai.length);

	if(document.new_dom.InsertOnly){
		if(document.new_dom.InsertOnly.checked){
		var action = "domini.php?Action=InsertOnly";
		}
		if (ext == '.it'){
		var action = "domini.it.php?Action=Check";
		}else if(ext == '.eu'){
		//var action = "domini.eu.php?Action=Check";
		var action = "domini.com.php?Action=Check";
		}else{
		var action = "domini.com.php?Action=Check";
		}
	}
//var action = "domini.php?Action=Check";
	
if(dot>2 && dot<57)
{
	for(var i=0; i<arr.length; i++)
	{
	  if(ext == arr[i])
	  {
	 	val = true;
		break;
	  }	
	  else
	  {
	 	val = false;
	  }
	}
	if(val == false)
	{
	  	 alert("Your domain extension "+ext+" is not correct");
		 return false;
	}
	else
	{
		for(var j=0; j<dname.length; j++)
		{
		  var dh = dname.charAt(j);
		  var hh = dh.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
		  {
			 if((j==0 || j==dname.length-1) && hh == 45)	
		  	 {
		 	  	 alert("Domain name should not begin are end with '-'");
			      return false;
		 	 }
		  }
		else	{
		  	 alert("Your domain name should not have special characters");
			 return false;
		  }
		}
	}
} else {
 alert("Your Domain name is too short/long");
 return false;
}
	if(document.new_dom.InsertOnly){
		if(document.new_dom.InsertOnly.checked){
		var action = "domini.php?Action=InsertOnly";
		}
	}else{	
		if (ext == '.it'){
		var action = "domini.it.php?Action=Check";
		}else if(ext == '.eu'){
		//var action = "domini.eu.php?Action=Check";
		var action = "domini.com.php?Action=Check";
		}else{
		var action = "domini.com.php?Action=Check";
		}
	}
	document.new_dom.action = action;
        document.new_dom.submit();
        return true;

}
function validate_nl()  {
	if (!document.new_nl.type[0].checked && !document.new_nl.type[1].checked && !document.new_nl.type[2].checked)
	alert('Selezionare la modalita di invio della newsletter');
	else
	document.new_nl.action = "newsletters.php?Action=New1";;
	document.new_nl.submit();
}
function validate_nd_contact()  {

var nname = document.new_dom.domain.value;
var arr = new Array('.com','.net','.org','.biz','.info','.it','.eu','.in','.name','.us','.mobi');

var mai = nname;
var val = true;

var dot = mai.lastIndexOf(".");
var dname = mai.substring(0,dot);
var ext = mai.substring(dot,mai.length);

var action = "domini.php?Action=New1";
//alert(ext);
	
if(dot>2 && dot<57)
{
	for(var i=0; i<arr.length; i++)
	{
	  if(ext == arr[i])
	  {
	 	val = true;
		break;
	  }	
	  else
	  {
	 	val = false;
	  }
	}
	if(val == false)
	{
	  	 alert("Your domain extension "+ext+" is not correct");
		 return false;
	}
	else
	{
		for(var j=0; j<dname.length; j++)
		{
		  var dh = dname.charAt(j);
		  var hh = dh.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
		  {
			 if((j==0 || j==dname.length-1) && hh == 45)	
		  	 {
		 	  	 alert("Domain name should not begin are end with '-'");
			      return false;
		 	 }
		  }
		else	{
		  	 alert("Your domain name should not have special characters");
			 return false;
		  }
		}
	}
} else {
 alert("Your Domain name is too short/long");
 return false;
}	
	if (ext == '.it'){
	var action = "domini.php?Action=New1";
		document.new_dom.privato[0].disabled = false;
		document.new_dom.privato[1].disabled = false;
           if (!document.new_dom.privato[0].checked && !document.new_dom.privato[1].checked ){
           alert("Selezionare se persona fisica.");
           return false;
           }
	}else if(ext == '.eu'){
	var action = "domini.eu.php?Action=Check";
	}else{
	var action = "domini.com.php?Action=Check";
	}
	document.new_dom.action = action;
        document.new_dom.submit();
        return true;

}
function switch_object(str){
	var el=document.getElementById('person_info');
        if (str == 'Role'){
                //document.clienti.Adminc.disabled = false;
                //document.clienti.Techc.disabled = false;
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;

	}else{
                //document.clienti.Adminc.disabled = true;
                //document.clienti.Techc.disabled = true;
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
	}
}
function switch_object_dom(str, who){
	if (who == 'adminc'){
	var el=document.getElementById('adminc_info_rol');
	var el2=document.getElementById('adminc_info_per');
	}else if (who == 'techc'){
	var el=document.getElementById('techc_info_rol');
	//var el2=document.getElementById('techc_info_per');
	}else if (who == 'postmaster'){
	var el=document.getElementById('postmaster_info_rol');
	//var el2=document.getElementById('postmaster_info_per');
	}else if (who == 'zonec'){
	var el=document.getElementById('zonec_info_rol');
	//var el2=document.getElementById('zonec_info_per');
	}
        if (str == 'Role'){
                el.style.visibility = 'visible';
                el.style.display = 'block';
                el.style.zIndex = 2;
	}else{
                el.style.visibility = 'hidden';
                el.style.display = 'none';
                el.style.zIndex = 2;
	}
}
function SwitchAction(azione,ID){
        if(azione == 'do_invoice'){
        document.invoice.action="compilazione_fattura.php?Action=Insert&ID="+ID;
        }else if(azione == 'do_nc'){
        document.invoice.action="compilazione_nc.php?Action=Insert&ID="+ID;
        }else if(azione == 'delete'){
        document.invoice.action="compilazione_fattura.php?Action=Delete&ID="+ID;
        }else if(azione == 'delete_nc'){
        document.invoice.action="compilazione_nc.php?Action=Delete&ID="+ID;
        }else if(azione == 'print'){
        document.invoice.action="compilazione_fattura.php?Action=Print&ID="+ID;
        }else if(azione == 'print_nc'){
        document.invoice.action="compilazione_nc.php?Action=Print&ID="+ID;
        }else if(azione == 'print_to_pdf'){
        document.invoice.action="compilazione_fattura.php?Action=PrintPdf&ID="+ID;
        }else if(azione == 'save'){
        document.invoice.action="compilazione_fattura.php?Action=Save&ID="+ID;
        }else if(azione == 'save_nc'){
        document.invoice.action="compilazione_nc.php?Action=Save&ID="+ID;
        }else{
        document.invoice.action="fatture.php?Action=Show";
        }

document.invoice.submit();
}
function SwitchActionBis(azione,ID){
        if(azione == 'do_invoice'){
        document.invoice.action="compilazione_contratto.php?Action=Insert&ID="+ID;
        }else if(azione == 'delete'){
        document.invoice.action="compilazione_contratto.php?Action=Delete&ID="+ID;
        }else if(azione == 'print'){
        document.invoice.action="compilazione_contratto.php?Action=Print&ID="+ID;
        }else if(azione == 'save'){
        document.invoice.action="compilazione_contratto.php?Action=Save&ID="+ID;
        }else{
        document.invoice.action="contratti.php?Action=Show";
        }

document.invoice.submit();
}
function ShowHead(){
var ID_cl = document.invoice.ID_Cliente.value;
dest.location.href="show_client.php?ID="+ID_cl;
}
function set_demo_expire(){
	if (document.wh_shared.Setup.options[document.wh_shared.Setup.selectedIndex].text == 'DEMO'){
	document.wh_shared.d_scadenza.value = '10';
	document.wh_shared.m_scadenza.value = '11';
	document.wh_shared.y_scadenza.value = '2006';
	}
}
function previewDoc(str)
{
  foto= new Image(200,250)
  if (str== "uno") {
  foto.src = "pixel.gif";
  Img_1b = document.invoice.nomeFoto.value;
  document.foto.src = Img_1b;
  }


  return true;
}

function ShowForn(){
	var ID_cl = document.invoice.ID_Forn.value;
	dest.location.href="show_fornitore.php?ID="+ID_cl;
}
function Show_image(ID, h, w){
        NewWin = window.open('show.php?img='+ID,'NewWin','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=100,width='+w+',height='+h);
}

function CheckLAR(ARG){

                if(document.lar.citta.value == ''){
                alert('Compilare il campo Citta');
                return false;
                }
                if(document.lar.data.value == ''){
                alert('Compilare il campo data');
                return false;
                }
                if(document.lar.nome_dominio.value == ''){
                alert('Compilare il campo dominio');
                return false;
                }
                if(document.lar.nome2.value == ''){
                alert('Compilare il campo cognome');
                return false;
                //document.lar.nome21.value=document.lar.nome2.value;

                }
                if(document.lar.birth_city.value == ''){
                alert('Compilare il campo citta di nascita');
                return false;
                }
                if(document.lar.birth_day.value == ''){
                alert('Compilare il campo data di nascita');
                return false;
                }
                if(document.lar.cf.value == ''){
                alert('Compilare il campo codice fiscale');
                return false;
                }
                if (ARG == 'Person'){
                        if(document.lar.city_resp.value == ''){
                        alert('Compilare il campo citta di residenza');
                        return false;
                        }
                        if(document.lar.addressp.value == ''){
                        alert('Compilare il campo indirizzo');
                        return false;
                        }
                        if(document.lar.city_capp.value == ''){
                        alert('Compilare il campo cap');
                        return false;
                        }
                        if(document.lar.city_provp.value == ''){
                        alert('Compilare il campo provincia di residenza');
                        return false;
                        }

                }else{
                        if(document.lar.company_name.value == ''){
                        alert('Compilare il nome dell\'organizzazione');
                        return false;
                        }
                        if(document.lar.PI.value == ''){
                        alert('Compilare il campo Partita Iva');
                        return false;
                        }
                        if(document.lar.city_res.value == ''){
                        alert('Compilare il campo citta');
                        return false;
                        }
                        if(document.lar.address.value == ''){
                        alert('Compilare il campo indirizzo');
                        return false;
                        }
                        if(document.lar.city_cap.value == ''){
                        alert('Compilare il campo cap');
                        return false;
                        }
                        if(document.lar.city_prov.value == ''){
                        alert('Compilare il campo provincia');
                        return false;
                        }
                }

        document.lar.submit();
        return true;
}

function CheckTRSF(ARG){

		if(document.lar.citta.value == ''){
		alert('Compilare il campo Citta');
		return false;
		}
		if(document.lar.data.value == ''){
		alert('Compilare il campo data');
		return false;
		}
		//if(document.lar.nome_dominio.value == ''){
		//alert('Compilare il campo dominio');
		//return false;
		//}
		//if(document.lar.nome.value == ''){
		//alert('Compilare il campo nome');
		//return false;
		//document.lar.nome1.value=document.lar.nome.value;
		//}
		if(document.lar.nome2.value == ''){
		alert('Compilare il campo cognome');
		return false;
		//document.lar.nome21.value=document.lar.nome2.value;
		
		}
		if(document.lar.birth_city.value == ''){
		alert('Compilare il campo citta di nascita');
		return false;
		}
		if(document.lar.birth_day.value == ''){
		alert('Compilare il campo data di nascita');
		return false;
		}
		if(document.lar.cf.value == ''){
		alert('Compilare il campo codice fiscale');
		return false;
		}
		if(document.lar.tr_nome2.value == ''){
		alert('Compilare il campo cognome');
		return false;
		//document.lar.nome21.value=document.lar.nome2.value;
		
		}
		if(document.lar.tr_birth_city.value == ''){
		alert('Compilare il campo citta di nascita');
		return false;
		}
		if(document.lar.tr_birth_day.value == ''){
		alert('Compilare il campo data di nascita');
		return false;
		}
		if(document.lar.tr_cf.value == ''){
		alert('Compilare il campo codice fiscale');
		return false;
		}
		if (ARG == 'Person'){
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta di residenza');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia di residenza');
			return false;
			}
		
			if(document.lar.tr_city_res.value == ''){
			alert('Compilare il campo citta di residenza');
			return false;
			}
			if(document.lar.tr_address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.tr_city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.tr_city_prov.value == ''){
			alert('Compilare il campo provincia di residenza');
			return false;
			}
		}else{
			if(document.lar.company_name.value == ''){
			alert('Compilare il nome dell\'organizzazione');
			return false;
			}
			if(document.lar.PI.value == ''){
			alert('Compilare il campo Partita Iva');
			return false;
			}
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia');
			return false;
			}
			if(document.lar.tr_company_name.value == ''){
			alert('Compilare il nome dell\'organizzazione');
			return false;
			}
			if(document.lar.tr_PI.value == ''){
			alert('Compilare il campo Partita Iva');
			return false;
			}
			if(document.lar.tr_city_res.value == ''){
			alert('Compilare il campo citta');
			return false;
			}
			if(document.lar.tr_address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.tr_city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.tr_city_prov.value == ''){
			alert('Compilare il campo provincia');
			return false;
			}
		}

	document.lar.submit();
	return true;
}
function CheckMNT(ARG){

		if(document.lar.citta.value == ''){
		alert('Compilare il campo Citta');
		return false;
		}
		if(document.lar.data.value == ''){
		alert('Compilare il campo data');
		return false;
		}
		if(document.lar.nome_dominio.value == ''){
		alert('Compilare il campo dominio');
		return false;
		}
		//if(document.lar.nome.value == ''){
		//alert('Compilare il campo nome');
		//return false;
		//document.lar.nome1.value=document.lar.nome.value;
		//}
		if(document.lar.nome2.value == ''){
		alert('Compilare il campo cognome');
		return false;
		//document.lar.nome21.value=document.lar.nome2.value;
		
		}
		if(document.lar.birth_city.value == ''){
		alert('Compilare il campo citta di nascita');
		return false;
		}
		if(document.lar.birth_day.value == ''){
		alert('Compilare il campo data di nascita');
		return false;
		}
		if(document.lar.cf.value == ''){
		alert('Compilare il campo codice fiscale');
		return false;
		}
		if (ARG == 'Person'){
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta di residenza');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia di residenza');
			return false;
			}
		
		}else{
			if(document.lar.company_name.value == ''){
			alert('Compilare il nome dell\'organizzazione');
			return false;
			}
			if(document.lar.PI.value == ''){
			alert('Compilare il campo Partita Iva');
			return false;
			}
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia');
			return false;
			}
		}

	document.lar.submit();
	return true;
}
function CheckLar(ARG){

		if(document.lar.citta.value == ''){
		alert('Compilare il campo Citta');
		return false;
		}
		if(document.lar.data.value == ''){
		alert('Compilare il campo data');
		return false;
		}
		if(document.lar.nome_dominio.value == ''){
		alert('Compilare il campo dominio');
		return false;
		}
		//if(document.lar.nome.value == ''){
		//alert('Compilare il campo nome');
		//return false;
		//document.lar.nome1.value=document.lar.nome.value;
		//}
		if(document.lar.nome2.value == ''){
		alert('Compilare il campo cognome');
		return false;
		//document.lar.nome21.value=document.lar.nome2.value;
		
		}
		if(document.lar.birth_city.value == ''){
		alert('Compilare il campo citta di nascita');
		return false;
		}
		if(document.lar.birth_day.value == ''){
		alert('Compilare il campo data di nascita');
		return false;
		}
		if(document.lar.cf.value == ''){
		alert('Compilare il campo codice fiscale');
		return false;
		}
		if (ARG == 'Person'){
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta di residenza');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.nazione.value == ''){
			alert('Compilare il campo nazione');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia di residenza');
			return false;
			}
		
		}else{
			if(document.lar.company_name.value == ''){
			alert('Compilare il nome dell\'organizzazione');
			return false;
			}
			if(document.lar.PI.value == ''){
			alert('Compilare il campo Partita Iva');
			return false;
			}
			if(document.lar.city_res.value == ''){
			alert('Compilare il campo citta');
			return false;
			}
			if(document.lar.address.value == ''){
			alert('Compilare il campo indirizzo');
			return false;
			}
			if(document.lar.city_cap.value == ''){
			alert('Compilare il campo cap');
			return false;
			}
			if(document.lar.city_prov.value == ''){
			alert('Compilare il campo provincia');
			return false;
			}
		}
                if(document.lar.consenso.checked == false){
                alert('Concedere il consenso al trattamento dei dati personali');
                return false;
                }

	document.lar.submit();
	return true;
}
function recalling(){
	var ID = document.contatti.richiama.value;
	location.href="contatti.php?Action=New&ID="+ID;
}
function show_calendar(str){
	if (str == 'Esiti'){
        NewWin = window.open('/usr/calendar.php?','NewWin','toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=100,width=220,height=180');	
	}else{
        NewWin = window.open('/usr/calendar2.php?','NewWin','toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=100,width=220,height=180');	
	}
}
 function fill_data_esiti(day, month, year){
 opener.document.esiti.D_Esito.value = day;
 opener.document.esiti.M_Esito.value = month;
 opener.document.esiti.A_Esito.value = year;
 window.close();
 }
 function fill_data_recall(day, month, year){
 opener.document.conf_elimina.D_Recall.value = day;
 opener.document.conf_elimina.M_Recall.value = month;
 opener.document.conf_elimina.A_Recall.value = year;
 window.close();
 }

function check_import(){
	if(document.conf_elimina.ImpExpMail[0].checked || document.conf_elimina.ImpExpMail[2].checked)
	document.conf_elimina.ImpFile.disabled = false;
	else
	document.conf_elimina.ImpFile.disabled = true;
}
var Fabtabs = Class.create();
Fabtabs.prototype = {
   initialize : function(element) {
          this.element = $(element);
                var options = Object.extend({}, arguments[1] || {});
              this.menu = $A(this.element.getElementsByTagName('a'));
           this.show(this.getInitialTab());
          this.menu.each(this.setupTab.bind(this));
 },
        setupTab : function(elm) {
                Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)
  },
        activate :  function(ev) {
                var elm = Event.findElement(ev, "a");
           Event.stop(ev);
           this.show(elm);
           this.menu.without(elm).each(this.hide.bind(this));
        },
        hide : function(elm) {
            $(elm).removeClassName('active-tab');
             $(this.tabID(elm)).removeClassName('active-tab-body');
    },
        show : function(elm) {
            $(elm).addClassName('active-tab');
                $(this.tabID(elm)).addClassName('active-tab-body');
  },
        tabID : function(elm) {
           return elm.href.match(/#(\w.+)/)[1];
      },
        getInitialTab : function() {
              if(document.location.href.match(/#(\w.+)/)) {
                     var loc = RegExp.$1;
                      var elm = this.menu.find(function(value) { return value.href.match(/#(\w.+)/)[1] == loc; });
                      return elm || this.menu.first();
          } else {
                  return this.menu.first();
         }
 }
}
function get_contracts(idCliente) {

                var options = {

                        onSuccess : function (transport){

                                //var json = transport.responseText.evalJSON(true);
                                var json = transport.responseText;

                        },
                         onFailure : function(resp) {
                                alert("Oops, there's been an error.");
                        }

                }

                new Ajax.Request('clienti_dettaglio.php?ID_Cliente='+idCliente, options);
}


