// JavaScript Document

  function Modulo() {
     // Variabili associate ai campi del modulo
     var nome = document.modulo.nome.value;     
     var mail = document.modulo.mail.value;    
     var messaggio = document.modulo.messaggio.value;
     // Espressione regolare dell'email
     var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        //Effettua il controllo sul campo NOME
        if ((nome == "") || (nome == "undefined")) {
           alert("Il campo Nome è obbligatorio.");
           document.modulo.nome.focus();
           return false;
        }
        
        else if (!mail_reg_exp.test(mail) || (mail == "") || (mail == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.mail.select();
           return false;
        }
        
        //Effettua il controllo sul campo FIRMA
        else if ((messaggio == "") || (messaggio == "undefined") || (messaggio.indexOf() != (-1))) {
           alert("Attenzione non hai scritto nessun messaggio.");
           document.modulo.messaggio.focus();
           return false;
        }
        //INVIA IL MODULO
        else {
           document.modulo.action = "php/mail.php";
           document.modulo.submit();
        }
  }
 
 


