function CheckForm( theform ){
if( theform.v1.value == '' ){
alert( "Campo di ricerca non valorizzato");
return false;}}

function CheckForm2( theform )
{
var bMissingFields = false;
var strFields = "";
var str = theform.e_mail_mittente.value;

if( theform.nome.value == '' ){
bMissingFields = true;
strFields += "nome\n";
}
if( theform.cognome.value == '' ){
bMissingFields = true;
strFields += "cognome\n";
}
if( theform.via.value == '' ){
bMissingFields = true;
strFields += "via e numero civico\n";
} 
if( theform.comune.value == '' ){
bMissingFields = true;
strFields += "comune\n";
}
if( theform.cap.value == '' ){
bMissingFields = true;
strFields += "CAP\n";
}
if( theform.telefono.value == '' ){
bMissingFields = true;
strFields += "telefono\n";
} 
if( str == '' ){
bMissingFields = true;
strFields += "indirizzo e-mail\n";
}
if( bMissingFields ) {
alert( "Campi mancanti:\n" + strFields );
return false;
}


var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
   alert("Indirizzo E-mail non valido, verificare.")
   return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at) 
==lstr){
   alert("Indirizzo E-mail non valido, verificare.")
   return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot) 
==lstr){
    alert("Indirizzo E-mail non valido, verificare.")
    return false
}
if (str.indexOf(at,(lat+1))!=-1){
    alert("Indirizzo E-mail non valido, verificare.")
    return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    alert("Indirizzo E-mail non valido, verificare.")
    return false
}
if (str.indexOf(dot,(lat+2))==-1){
    alert("Indirizzo E-mail non valido, verificare.")
    return false
}
if (str.indexOf(" ")!=-1){
    alert("Indirizzo E-mail non valido, verificare.")
    return false
}

return true;
}
