function Form_Validator(theForm)
{
//Controllo campo Nome
if (theForm.Nome.value == "" ||
      theForm.Nome.value.length < 3 ||
      theForm.Nome.value.length >20)
  {
    alert("Compilare il campo \"Nome\".");
    theForm.Nome.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ &#32 \t\r\n\f";
  var checkStr = theForm.Nome.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("Compilare correttamente il campo \"Nome\".");
    theForm.Nome.focus();
    return (false);
  } 
//Controllo campo Cognome 
 if (theForm.Cognome.value == "" ||
      theForm.Cognome.value.length < 3 ||
      theForm.Cognome.value.length >20)
  {
    alert("Compilare il campo \"Cognome\".");
    theForm.Cognome.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f ";
  var checkStr = theForm.Cognome.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("Compilare correttamente il campo \"Cognome\".");
    theForm.Cognome.focus();
    return (false);
  }
//Controllo campo Citta
if (theForm.Citta.value == "" ||
      theForm.Citta.value.length < 3 ||
      theForm.Citta.value.length >20)
  {
    alert("Compilare il campo \"Città\".");
    theForm.Citta.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.Citta.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("Compilare correttamente il campo \"Città\".");
    theForm.Citta.focus();
    return (false);
  } 
 
//Controllo campo Indirizzo
 if (theForm.Indirizzo.value == "" ||
      theForm.Indirizzo.value.length < 3 ||
      theForm.Indirizzo.value.length >40)
  {
    alert("Compilare il campo \"Indirizzo\".");
    theForm.Indirizzo.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- &#32 \t\r\n\f";
  var checkStr = theForm.Indirizzo.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("Compilare correttamente il campo \"Indirizzo\".");
    theForm.Indirizzo.focus();
    return (false);
  } 

//Controllo campo CAP
 if (theForm.Cap.value == "")
  {
    alert("Compilare il 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("Compilare correttamente il campo \"Cap\".");
    theForm.Cap.focus();
    return (false);
  }
  
  if (theForm.Cap.value.length != 5 ) 
    {
    alert("Compilare correttamente il campo \"Cap\".");
    theForm.Cap.focus();
    return (false);
  }

  
//Controllo campo Telefono
if (theForm.Telefono.value == "" ||
      theForm.Telefono.value.length < 5||
      theForm.Telefono.value.length > 15)
  {
    alert("Compilare il campo \"Telefono\".");
    theForm.Telefono.focus();
    return (false);
  }
 
  var checkOK = "0123456789-";
  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("Compilare correttamente il campo \"Telefono\".");
    theForm.Telefono.focus();
    return (false);
  }
   
    
}


