function Modulo(){
	var nome = document.modulo.nome.value;
	var cognome = document.modulo.cognome.value;
	var citta = document.modulo.citta.value;
  var telefono = document.modulo.telefono.value;
  var messaggio = document.modulo.messaggio.value;
	var mail = document.modulo.mail.value;
  var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if((nome=="")||(nome=="undefined")){
  	alert("Il campo Nome è obbligatorio.");
    document.modulo.nome.focus();
    return false;
  }
  else if((cognome=="")||(cognome=="undefined")){
  	alert("Il campo Cognome è obbligatorio.");
    document.modulo.cognome.focus();
    return false;
  }
  else if((citta=="")||(citta=="undefined")){
  	alert("Il campo Città è obbligatorio.");
    document.modulo.citta.focus();
  	return false;
  }
  else if(!mail_reg_exp.test(mail)||(mail=="")||(mail=="undefined")){
  	alert("Inserire un indirizzo e-mail corretto.");
    document.modulo.mail.select();
    return false;
  }
  else if((telefono=="")||(telefono=="undefined")){
  	alert("Il campo telefono è obbligatorio.");
    document.modulo.telefono.focus();
    return false;
  }		
	else if((messaggio=="")||(messaggio=="undefined")){
		alert("Scrivi un messaggio!");
		document.modulo.messaggio.focus();
		return false;
	}
	else if(document.modulo.accetto.checked==false){
		alert("Bisogna accettare la legge sul trattamento dei dati");
		return false;
	}
  else{
  	document.modulo.action = "include/invio.php";
    document.modulo.submit();
  }
}

//convalida per form prenotazioni
function Modulo_prenota(){
	var nome = document.moduloprenota.nome.value;
	var cognome = document.moduloprenota.cognome.value;
	var citta = document.moduloprenota.citta.value;
  var telefono = document.moduloprenota.telefono.value;
  var messaggio = document.moduloprenota.messaggio.value;
	var mail = document.moduloprenota.mail.value;
  var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if((nome=="")||(nome=="undefined")){
  	alert("Il campo Nome è obbligatorio.");
    document.moduloprenota.nome.focus();
    return false;
  }
  else if((cognome=="")||(cognome=="undefined")){
  	alert("Il campo Cognome è obbligatorio.");
    document.moduloprenota.cognome.focus();
    return false;
  }
  else if((citta=="")||(citta=="undefined")){
  	alert("Il campo Città è obbligatorio.");
    document.moduloprenota.citta.focus();
  	return false;
  }
  else if(!mail_reg_exp.test(mail)||(mail=="")||(mail=="undefined")){
  	alert("Inserire un indirizzo e-mail corretto.");
    document.moduloprenota.mail.select();
    return false;
  }
  else if((telefono=="")||(telefono=="undefined")){
  	alert("Il campo telefono è obbligatorio.");
    document.moduloprenota.telefono.focus();
    return false;
  }		
	else if((messaggio=="")||(messaggio=="undefined")){
		alert("Scrivi un messaggio!");
		document.moduloprenota.messaggio.focus();
		return false;
	}
	else if(document.moduloprenota.accetto.checked==false){
		alert("Bisogna accettare la legge sul trattamento dei dati");
		return false;
	}
  else{
  	document.moduloprenota.action = "include/invio.php";
    document.moduloprenota.submit();
  }
}
