
function Modulo()

 {


// Variabili associate ai campi del modulo
     var nome = document.modulo.nome.value;
     var oggetto = document.modulo.oggetto.value;     
     var email = document.modulo.email.value;     
     var messaggio = document.modulo.messaggio.value;

// Espressione regolare dell'email
     var email_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;
        }
//Effettua il controllo sul campo OGGETTO
        else if ((oggetto == "") || (oggetto == "undefined")) {
           alert("Il campo Oggetto è obbligatorio.");
           document.modulo.oggetto.focus();
           return false;
        }
        
//Effettua il controllo sul campo EMAIL        
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.email.select();
           return false;
        }
        
//Effettua il controllo sul campo FIRMA
        else if ((messaggio == "") || (messaggio == "undefined") || (messaggio.indexOf("inserire il messaggio") != (-1))) {
           alert("Il campo Messaggio è obbligatorio e non si può inserire la scritta predefinita.");
           document.modulo.messaggio.focus();
           return false;
        }
//INVIA IL MODULO
        else {
           document.modulo.action = "sendmail.asp";
           document.modulo.submit();
        }
  }
 