<!--



function FrontPage_Form1_Validator(theForm)
{

var codice = theForm.codice.value;
if (codice != document.getElementById("captcha").innerHTML)
 {
  alert("Il codice di sicurezza è errato!");
  theForm.codice.value = "";
  theForm.codice.focus();
  return (false);
 }

     // inizio controllo campo Nome

  if (theForm.Nome.value == "")
  {
    alert("Compilare campo \"Nome\"");
    theForm.Nome.focus();
    return (false);
  }

  if (theForm.Nome.value.length < 3)
  {
    alert("Inserire almeno 3 caratteri nel campo \"Nome\"");
    theForm.Nome.focus();
    return (false);
  }

  if (theForm.Nome.value.length > 100)
  {
    alert("Inserire un valore minore di 100 caratteri nel campo \"Nome\"");
    theForm.Nome.focus();
    return (false);
  }
  
  // fine controllo campo Nome
  
  
  
  
       // inizio controllo campo Cognome

  if (theForm.Cognome.value == "")
  {
    alert("Compilare campo \"Cognome\"");
    theForm.Cognome.focus();
    return (false);
  }

  if (theForm.Cognome.value.length < 3)
  {
    alert("Inserire almeno 3 caratteri nel campo \"Cognome\"");
    theForm.Cognome.focus();
    return (false);
  }

  if (theForm.Cognome.value.length > 100)
  {
    alert("Inserire un valore minore di 100 caratteri nel campo \"Cognome\"");
    theForm.Cognome.focus();
    return (false);
  }
  
  // fine controllo campo Cognome
  
  
  
  
         // inizio controllo campo Indirizzo

//  if (theForm.Indirizzo.value == "")
//  {
//    alert("Compilare campo \"Indirizzo\"");
//    theForm.Indirizzo.focus();
//    return (false);
//  }

//  if (theForm.Indirizzo.value.length < 3)
//  {
//    alert("Inserire almeno 3 caratteri nel campo \"Indirizzo\"");
//    theForm.Indirizzo.focus();
//    return (false);
//  }

//  if (theForm.Indirizzo.value.length > 100)
//  {
//    alert("Inserire un valore minore di 100 caratteri nel campo \"Indirizzo\"");
//    theForm.Indirizzo.focus();
//    return (false);
//  }
  
  // fine controllo campo Indirizzo
  
  
  
   // inizio controllo campo Citta

//  if (theForm.Citta.value == "")
//  {
//    alert("Compilare campo \"Citta\"");
//    theForm.Citta.focus();
//    return (false);
//  }

//  if (theForm.Citta.value.length < 3)
//  {
//    alert("Inserire almeno 3 caratteri nel campo \"Citta\"");
//    theForm.Citta.focus();
//    return (false);
//  }

//  if (theForm.Citta.value.length > 100)
//  {
//    alert("Inserire un valore minore di 100 caratteri nel campo \"Citta\"");
//    theForm.Citta.focus();
//    return (false);
//  }
  
  // fine controllo campo Citta
  
  
  
  
  // inizio controllo campo Cap 

//  if (theForm.Cap.value == "")
//  {
//    alert("Compilare campo \"Cap\"");
//    theForm.Cap.focus();
//    return (false);
//  }



// if (theForm.Cap.value.length > 5)
//  {
//    alert("Inserire meno di 5 nel campo \"Cap\"");
//    theForm.Cap.focus();
//    return (false);
//  }

//  var checkOK = "0123456789";
//  var checkStr = theForm.Cap.value;
//  var allValid = true;
//  for (i = 0;  i < checkStr.length;  i++)
//  {
//    ch = checkStr.charAt(i);
//    for (j = 0;  j < checkOK.length;  j++)
//      if (ch == checkOK.charAt(j))
//        break;
//    if (j == checkOK.length)
//    {
//      allValid = false;
//      break;
//    }
//  }
//  if (!allValid)
//  {
//    alert("Puoi inserire solo numeri nel campo \"Cap\"");
//    theForm.Cap.focus();
//    return (false);
//  }
  
  // fine controllo campo Cap 
  
  
  
  
  
     // inizio controllo campo Provincia

//  if (theForm.Provincia.value == "")
//  {
//    alert("Compilare campo \"Provincia\"");
//    theForm.Provincia.focus();
//    return (false);
//  }

//  if (theForm.Provincia.value.length < 3)
//  {
//    alert("Inserire almeno 3 caratteri nel campo \"Provincia\"");
//    theForm.Provincia.focus();
//    return (false);
//  }

//  if (theForm.Provincia.value.length > 100)
//  {
//    alert("Inserire un valore minore di 100 caratteri nel campo \"Provincia\"");
//    theForm.Provincia.focus();
//    return (false);
//  }
  
  // fine controllo campo Provincia
  


  
  // inizio controllo campo Provincia

  if (theForm.Provincia.value == "")
  {
    alert("Compilare campo \"Provincia\"");
    theForm.Provincia.focus();
    return (false);
  }


  if (theForm.Provincia.value.length > 100)
  {
    alert("Inserire un valore minore di 100 caratteri nel campo \"Provincia\"");
    theForm.Provincia.focus();
    return (false);
  }
  
  // fine controllo campo Provincia
  
  
  
  
  
  
  
  // inizio controllo campo Telefono 

  if (theForm.Telefono.value == "")
  {
    alert("Compilare campo \"Telefono\"");
    theForm.Telefono.focus();
    return (false);
  }

  if (theForm.Telefono.value.length < 6)
  {
    alert("Inserire più di 6 numeri nel campo \"Telefono\"");
    theForm.Telefono.focus();
    return (false);
  }

  if (theForm.Telefono.value.length > 20)
  {
    alert("Inserire meno di 20 nel campo \"Telefono\"");
    theForm.Telefono.focus();
    return (false);
  }

  var checkOK = "0123456789-/ \t\r\n\f";
  var checkStr = theForm.Telefono.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Puoi inserire solo numeri, Non è consentito inserire caratteri diversi da \"/\" nel campo \"Telefono\"");
    theForm.Telefono.focus();
    return (false);
  }
  
  // fine controllo campo Telefono 

  
  
  
  
    // inizio controllo campo Fax 

//  if (theForm.Fax.value == "")
//  {
//    alert("Compilare campo \"Fax\"");
//    theForm.Fax.focus();
//    return (false);
//  }

//  if (theForm.Fax.value.length < 6)
//  {
 //   alert("Inserire più di 6 numeri nel campo \"Fax\"");
 //   theForm.Fax.focus();
 //   return (false);
//  }

//  if (theForm.Fax.value.length > 20)
//  {
//    alert("Inserire meno di 20 nel campo \"Fax\"");
//    theForm.Fax.focus();
//    return (false);
//  }

//  var checkOK = "0123456789-/ \t\r\n\f";
//  var checkStr = theForm.Fax.value;
//  var allValid = true;
//  for (i = 0;  i < checkStr.length;  i++)
//  {
//    ch = checkStr.charAt(i);
//    for (j = 0;  j < checkOK.length;  j++)
//      if (ch == checkOK.charAt(j))
//        break;
//    if (j == checkOK.length)
//    {
//      allValid = false;
//      break;
//    }
//}
//  if (!allValid)
//  {
//    alert("Puoi inserire solo numeri, Non è consentito inserire caratteri diversi da \"/\" nel campo \"Fax\"");
//    theForm.Fax.focus();
 //   return (false);
//  }
  
  // fine controllo campo Fax 
  
  
  
  //controllo Email
  
 
 if (theForm.Email.value == "")
  {
    alert("Inserire un valore per il campo \"Email\".");
    theForm.Email.focus();
    return (false);
  }


  ValoreEmail = theForm.Email.value;
   PosizioneAt = theForm.Email.value.indexOf("@");
   PosizionePunto = theForm.Email.value.indexOf(".");
   
   
  	if (PosizioneAt==-1 || PosizioneAt==0 || PosizionePunto==-1 || PosizionePunto==0 || PosizioneAt==ValoreEmail.length-1)
   
   {  
    alert("Inserire un indirizzo di E-mail Corretto \"Email\".");
    theForm.Email.focus();
    return (false);
  }
 

//  if (theForm.Email.value.length < 7)
//  {
//   alert("Inserire almeno 7 caratteri nel campo \"Email\".");
//   theForm.Email.focus();
//   return (false);
//  }

  if (theForm.Email.value.length > 60)
  {
    alert("Inserire al massimo 60 caratteri nel campo \"Email\".");
    theForm.Email.focus();
  return (false);
  }
//controllo Email

  
  
  
  
  
  
  
    

  
  
  

  
  
  
       // inizio controllo campo Privacy

  if (theForm.privacy.value == "no")
  {
    alert("E' neccessario accettare le condizioni");
    theForm.privacy.focus();
    return (false);
  }
  
    // fine controllo campo Privacy
  
  
  
  
  
  return (true);
}
//-->
