function Validator(theForm)
{  
  
  
   if (theForm.nome.value == "")
  {
     alert("Il campo \"Nome\" e' obbligatorio!");
     theForm.nome.focus();
     return (false);
  }
  
  
  if (theForm.cognome.value == "")
  {
     alert("Il campo \"Cognome\" e' obbligatorio!");
     theForm.cognome.focus();
     return (false);
  }
  
   
  if (theForm.Conoscenza.value == "")
  {
    alert("Il campo e' obbligatorio!");
    theForm.Conoscenza.focus();
    return (false);
  }
  
  
  if (theForm.Richiesta.value == "")
  {
    alert("Il campo \"Richiesta\" e' obbligatorio!");
    theForm.Richiesta.focus();
    return (false);
  }

    
   if (theForm.Richiesta.length > 160)
  {
    alert("Il testo del messaggio e' troppo lungo!");
    var lunghezza = theForm.Richiesta.length
    var stringa = new String(theForm.Richiesta.substring(1,lunghezza));
    theForm.Richiesta.value = stringa;
    theForm.Richiesta.focus();
    return (false);
  }
  
  
  	 if (theForm.email.value == "")
  {
    alert("Il campo \"email\" e' obbligatorio!");
    theForm.email.focus();
    return (false);
  }
  
  
  //controllo e-mail

	  var flag;
      var flag1;
      var flag2;
      
      var email = new String(theForm.email.value);
	   var y = email;
	   flag = false;
	   flag1 = false;
	   flag2 = false;
	  

	   var email;
	 	email = theForm.email.value
	    
	   if (email.length<7)
  	   {	alert("L'indirizzo E-MAIL ha una lunghezza errata!");
	        theForm.email.focus();
	        return(false);
	   }  
	     
	 	for(var i=0; i<email.length; i++)
	 		{ //alert(y.charAt(i))
	 			if (((y.charAt(i) >= "0") && (y.charAt(i) <= "9")) || ((y.charAt(i) >= "a") && (y.charAt(i) <= "z")) || (y.charAt(i) == "@") || (y.charAt(i) == ".") || (y.charAt(i) == "_")) 
	 			{	flag = true
	 			}
	 	      else
	 		     {
	 				alert("L'indirizzo Email contiene caratteri non validi.");
	 				theForm.email.focus();
	 			    return(false);
	 			  }
	 			if(y.charAt(i) == "@")
	 			{	flag1 = true;	
	 			}
				
		 		if(y.charAt(i) == ".")
		 			{	flag2 = true;
	 				}
	 		}
	 		
	 		if ((!flag1 == true) || (!flag2 == true))
	 				{	alert("L'indirizzo E-MAIL non e' corretto !");
	 			       theForm.email.focus();
	 			       return(false);
	 		       } 	 		


  

  return (true);
}

