function change_d(ss) 
{   
  ss.form.address_to.value=ss.options[ss.selectedIndex].value;
};



function checkform(Form) 
{
   var descrErrore = "Errore:";
   var errore = false;

   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Non hai riempito il campo \"Nome\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }

    if (trim(Form.messaggio.value).length==0) 
   {
      descrErrore += "\n- Devi inserire un commento";
      if (!errore) Form.messaggio.focus();
      errore = true;
   }
   
   if (errore) 
   {  window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

};


//controlla il form nel campo contatti
function checkform_c(Form) 
{
   var descrErrore = "Errore:";
   var errore = false;

   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Fill \"First Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
      // Controllo sul campo cognome
   if (trim(Form.cognome.value).length==0) 
   {
      descrErrore += "\n- Fill \"Last Name\"";
      if (!errore) Form.cognome.focus();
      errore = true;
   }
   
   // Controllo sul campo e-mail
   if (trim(Form.email.value).length==0) 
   {
      descrErrore += "\n- Fill your \"E-Mail\"";
      if (!errore) Form.email.focus();
      errore = true;
   }
   else 
   {
      // controllo forma dell'email
      if (Form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) 
      {
         descrErrore += "\n- Your \"E-Mail\" must be name@domain.ext";
         if (!errore) 
	 {
            Form.email.select();
            Form.email.focus();
         }
      errore = true;
      }
   }
   
   

    if (trim(Form.messaggio.value).length==0) 
   {
      descrErrore += "\n- Fill a message";
      if (!errore) Form.messaggio.focus();
      errore = true;
   }
   
   if (errore) 
   {
      window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

}








//controlla il form nel campo mailing list
function checkform_m(Form) 
{
   var descrErrore = "Error:";
   var errore = false;

   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Fill \"First Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
      // Controllo sul campo cognome
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Fill \"Last Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
   
   // Controllo sul campo mailing list
   if (trim(Form.mailing_address1.value).length==0) 
   {
      descrErrore += "\n- Fill a \"Mailing Address\"";
      if (!errore) Form.mailing_address1.focus();
      errore = true;
   }
   
   
   // Controllo sul campo city
   if (trim(Form.city.value).length==0) 
   {
      descrErrore += "\n- Fill \"City\"";
      if (!errore) Form.city.focus();
      errore = true;
   }
   
   
   // Controllo sul campo State/Region
   if (trim(Form.state_region.value).length==0) 
   {
      descrErrore += "\n- Fill \"State/Region\"";
      if (!errore) Form.state_region.focus();
      errore = true;
   }
  
   
   // Controllo sul campo postal-code
   if (trim(Form.postal_code.value).length==0) 
   {
      descrErrore += "\n- Fill \"Postal Code\"";
      if (!errore) Form.postal_code.focus();
      errore = true;
   }
   
   
    // Controllo sul country
   if (trim(Form.country.value).length==0) 
   {
      descrErrore += "\n- Fill \"Country\"";
      if (!errore) Form.country.focus();
      errore = true;
   }
   
   
   
   
   // Controllo sul campo e-mail
   if (trim(Form.email.value).length==0) 
   {
      descrErrore += "\n- Fill \"E-Mail\"";
      if (!errore) Form.email.focus();
      errore = true;
   }
   else 
   {
      // controllo forma dell'email
      if (Form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) 
      {
         descrErrore += "\n- Fill \"E-Mail\" like name@domain.ext";
         if (!errore) 
	 {
            Form.email.select();
            Form.email.focus();
         }
      errore = true;
      }
   }
   
   if (errore) 
   {
      window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

}




