<!--
function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
   {if (alertbox) {alert(alertbox);} return false;}
   else {return true;}
}
}

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
   {if (alertbox!="") {alert(alertbox);} return false;}
   else {return true;}
}
}

function formvalidation(thisform)
{
with (thisform)
{
    if (emptyvalidation(name,"Attenzione: inserisci il nome!")==false) {name.focus(); return false;};
    if (emptyvalidation(email,"Attenzione: inserisci l'e-mail!")==false) {email.focus(); return false;};
    if (emailvalidation(email,"Attenzione: l'indirizzo e-mail che hai inserito non è valido!")==false) {email.focus(); return false;};
    if (emptyvalidation(tel,"Attenzione: inserisci il telefono!")==false) {tel.focus(); return false;};
    if (emptyvalidation(messaggio,"Attenzione: scrivi il messaggio!")==false) {messaggio.focus(); return false;};
    if (!document.getElementById("consenso").checked) {alert("Attenzione: devi dare il consenso al trattamento dei dati personali!"); return false;};
    return true;
}
}

//-->

