function PopupCentrata(url,lar,alt) {
var w = lar;
var h = alt;
var l = Math.floor((screen.width-w)/2);
var t = Math.floor((screen.height-h)/2);
window.open(url,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}




function ControllaForm() {
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
var controllo=false;

if (document.form1.nome.value == "" )
{
controllo=true;
alert("Inserire il nome");
document.form1.nome.style.background = "#ffffaa";
document.form1.nome.focus();
}
else if (!email_reg_exp.test(document.form1.email.value) || (document.form1.email.value == "") || (document.form1.email.value == "undefined")) 
{
controllo=true;
alert("Inserire una email valida");
document.form1.email.style.background = "#ffffaa";
document.form1.email.focus();
}
else if (document.form1.telefono.value == "" )
{
controllo=true;
alert("Inserire il telefono");
document.form1.telefono.style.background = "#ffffaa";
document.form1.telefono.focus();
}
else if (document.form1.citta.value == "" )
{
controllo=true;
alert("Inserire la citta'");
document.form1.citta.style.background = "#ffffaa";
document.form1.citta.focus();
}
else if (document.form1.testo.value == "" )
{
controllo=true;
alert("Inserire il motivo della consulenza");
document.form1.testo.style.background = "#ffffaa";
document.form1.testo.focus();
}
else if (document.form1.check.checked == false )
{
controllo=true;
alert("Autorizzare al trattamento dei dati personali");
document.form1.check.style.background = "#ffffaa";
document.form1.check.focus();
}

if (document.form1.nome.value != "" ) { document.form1.nome.style.background = "#ffffff"; }
if (email_reg_exp.test(document.form1.email.value) && document.form1.email.value != "" && document.form1.email.value != "undefined")  {
document.form1.email.style.background = "#ffffff";
}
if (document.form1.telefono.value != "" ) { document.form1.telefono.style.background = "#ffffff"; }
if (document.form1.citta.value != "" ) { document.form1.citta.style.background = "#ffffff"; }
if (document.form1.testo.value != "" ) { document.form1.testo.style.background = "#ffffff";  }
if (document.form1.check.checked == true ) { document.form1.check.style.background = "#ffffff";  }

if (controllo){ return false }else{ return true } 
}





function ControllaForm3() {
var controllo=false; 
if (document.form3.chiave.value == "" )
{
controllo=true;
alert("Inserire un termine per effettuare la ricerca");
document.form3.chiave.focus();
document.form3.chiave.style.backgroundColor="#ffffaa";
}
if (controllo){return false}else{return true} 
}