function checkMail(){
	var nomeCognomeCampo=document.formMail.elements['nome_cognome'];
	if(nomeCognomeCampo.value==""){
		alert("Nome/cognome non inseriti");
		nomeCognomeCampo.style.backgroundColor="red";
		nomeCognomeCampo.focus();
		return false;
	}
	else
		nomeCognomeCampo.style.backgroundColor="white";
		
	var emailCampo=document.formMail.elements['email'];
	if(emailCampo.value==""){
		alert("Email non inserita");
		emailCampo.style.backgroundColor="red";
		emailCampo.focus();
		return false;
	}
	else
		emailCampo.style.backgroundColor="white";
	
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if(!email_reg_exp.test(emailCampo.value)){
		alert("Email non valida");
		emailCampo.style.backgroundColor="red";
		emailCampo.focus();
		return false;
	}
	else
		emailCampo.style.backgroundColor="white";
	
	var captchaCampo=document.formMail.elements['captcha'];
	if(captchaCampo.value==""){
		alert("Devi inserire il codice di sicurezza");
		captchaCampo.style.backgroundColor="red";
		captchaCampo.focus();
		return false;
	}
	else
		captchaCampo.style.backgroundColor="white";
	
	var privacyCampo=document.formMail.elements['privacy'];
	if(privacyCampo.checked==false){
		alert("Devi prendere visione dell'informativa privacy");
		privacyCampo.focus();
		return false;
	}
	
	return true;
}

function checkForm(){
	var nomeCampo=document.getElementById("nome");
	if(nomeCampo.value==""){
		alert("Il nome non e' stato inserito");
		nomeCampo.style.backgroundColor="red";
		nomeCampo.focus();
		return false;
	}
	else
		nomeCampo.style.backgroundColor="white";
	
	var messaggioCampo=document.getElementById("textarea");
	if(messaggioCampo.value==""){
		alert("Il messaggio non e' stato inserito");
		messaggioCampo.style.backgroundColor="red";
		messaggioCampo.focus();
		return false;
	}
	else
		messaggioCampo.style.backgroundColor="white";
	
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	var emailCampo=document.getElementById("email");
	if(emailCampo.value!="" && !email_reg_exp.test(emailCampo.value)){
		alert("Email non valida");
		emailCampo.style.backgroundColor="red";
		emailCampo.focus();
		return false;
	}
	else
		emailCampo.style.backgroundColor="white";
	
	
	var captchaCampo=document.getElementById("captcha");
	if(captchaCampo.value==""){
		alert("Devi inserire il codice di sicurezza");
		captchaCampo.style.backgroundColor="red";
		captchaCampo.focus();
		return false;
	}
	else
		captchaCampo.style.backgroundColor="white";
}
