function Valida()
{
var campi=new Array('txNome','txIndirizzo','txCap','txCitta','txTel','txRichiesta');
var check;

if(checkPrivacy()){

if(isValidEmail()){
for(var i=0;i<campi.length;i++){
check = document.getElementById(campi[i]);


  //name field
    if (check.value == "" || check.value == null || check.value.charAt(0) == ' ')
    {
    alert( campi[i].slice(2)+" non valido");

    return false;
    }

   }
   return true;
   }
}
return false;

}

function checkPrivacy(){
if(document.getElementById('cbPrivacy').checked==false){
alert("E' necessario acconsentire al trattamento dei dati personali per effettuare la richiesta");
return false;
}
else{return true;}
}


//function to check valid email address
function isValidEmail(){
  validRegExp = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/;
  strEmail = document.getElementById('txMail').value;
   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('Indirizzo E-Mail non valido');
      return false;
    } 
    return true; 
}

