// JavaScript Document

function ApriPagina(url)
{
window.open(url,"_self");
}

function InviaForm()
{
errore=false;
document.getElementById("errore_form").style.display="none";
nome_cognome=document.getElementById("nome_form").value;
mail=document.getElementById("mail_form").value;
testo_messaggio=document.getElementById("text_form").value;
document.getElementById("privacy_form").value;
if(nome_cognome=="")
{
errore=true;
document.getElementById("errore_form").style.display="block";
}
var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;	
if(((mail=="")||(!espressione.test(document.getElementById("mail_form").value)))&&(!errore))
{
errore=true;
document.getElementById("errore_form").style.display="block";
}
if((testo_messaggio=="")&&(!errore))
{
errore=true;
document.getElementById("errore_form").style.display="block";
}
if((!document.getElementById("privacy_form").checked)&&(!errore))
{
errore=true;
document.getElementById("errore_form").style.display="block";
}
if(!errore)
{
url="contatti.php?AZIONE=invia";
document.getElementById("form_inv").action=url;
document.getElementById("form_inv").submit();
}
}

function ApriDettaglio(id,pag,lang)
{
url="clienti.php?idcliente="+id+"&pagina="+pag+"&LANG="+lang;
window.open(url,"_self");
}

function ApriSezione(sezione,gruppo)
{
url=sezione+".php?gruppo="+gruppo;
window.open(url,"_self");
}

function Paginazione(pag,lang)
{
url="clienti.php?pagina="+pag+"&LANG="+lang;
window.open(url,"_self");
}

function GoHome()
{
url="../index.php";
window.open(url,'_self');
}

function Login()
{
document.getElementById("login_form").submit();
}

function ApriPaginaPannelloControllo()
{
url="control_panel.php";
window.open(url,'_self');
}

function Aggiorna(url)
{
document.getElementById("agg_form").action=url;
document.getElementById("agg_form").submit();
}

function Reload(url)
{
window.open(url,'_self');
}

function Elimina(url,url2)
{
if (confirm("Sei sicuro di voler eliminare l'elemento selezionato")) window.open(url,'_self');
else window.open(url2,'_self');
}

function ApriLink(url)
{
window.open(url,'_blank');
}

function MailTo(url)
{
mail="mailto:"+url;
window.open(mail,"_blank");
}

function GoHome2()
{
url="index.php";
window.open(url,'_self');
}

function CalcolaH()
{
H=screen.height;
SetCooKie("H",H);
}

function Char(Object, MaxLen)
{
return (Object.value.length <= MaxLen);
}
