// JavaScript Document

function Login()
{
document.getElementById("login_form").submit();
}

function ApriPagina(url)
{
window.open(url,"_self");
}

function IsNumber()
{
for($id=0; $id>0; $id++);
}

function Aggiorna(url)
{
document.getElementById("agg_form").action=url;
document.getElementById("agg_form").submit();
}

function GoHome()
{
url="index.php";
window.open(url,'_self');
}

function SetLang(language)
{
document.cookie = "LANG="+language;
location.replace(document.URL);		
}

function Paginazione(from,pag)
{
url=from+"?PAGINA="+pag;
window.open(url,"_self");
}  

function Paginazionebis(from,pag)
{
url=from+"&PAGINA="+pag;
window.open(url,"_self");
}    


function ApriLink(url)
{
window.open(url,'_blank');
}

function ApriDiv(div)
{
document.getElementById(div).style.display="block"; 
}

function ChiudiDiv(div)
{
document.getElementById(div).style.display="none"; 
}

function Aggiorna2(url)
{
document.getElementById("agg_form2").action=url;
document.getElementById("agg_form2").submit();
}

function Elimina(url)
{
if (confirm("Sei sicuro di voler eliminare l'elemento selezionato?")) window.open(url,'_self');
}

function EliminaG(url)
{
if (confirm("Sei sicuro di voler eliminare l'elemento selezionato? Questa gallery verrā rimossa da tutte le news a cui attualmente č abbinata.")) window.open(url,'_self');
}

function EliminaC(url)
{
if (confirm("Sei sicuro di voler eliminare l'elemento selezionato? Questa categoria verrā rimossa da tutte le news a cui attualmente č abbinata.")) window.open(url,'_self');
}

function Archivia(url)
{
if (confirm("Sei sicuro di voler archiviare l'elemento selezionato? Il processo non č reversibile.")) window.open(url,'_self');
}

function MostraDiv(div1,div2)
{
posizione=document.getElementById(div1).style.display;
posizione2=document.getElementById(div2).style.display;

if (posizione=="none")
{
document.getElementById(div1).style.display="block";
}

if (posizione=="block")
{
document.getElementById(div1).style.display="none";
}

if (posizione2=="none")
{
document.getElementById(div2).style.display="block";
}

if (posizione2=="block")
{
document.getElementById(div2).style.display="none";
}

}   

function InviaForm(url)
{
errore=false;

mone=document.getElementById("nomeform2").value;
cogmone=document.getElementById("cognomeform2").value;
mail=document.getElementById("mailform2").value;
document.getElementById("checkform").value;  
    
if(mone=="")
{
errore=true;
document.getElementById("diverr").style.display="block";  
} 

if(cogmone=="")
{
errore=true;
document.getElementById("diverr").style.display="block";     
}

      
var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;	
if(((mail=="")||(!espressione.test(document.getElementById("mailform2").value)))&&(!errore))
{
errore=true;
document.getElementById("diverr").style.display="block";  
}

    
if((!document.getElementById("checkform").checked)&&(!errore))
{
errore=true;
document.getElementById("diverr").style.display="block";     
}  

    
if(!errore)
{
document.getElementById("newsletter_form").action=url;
document.getElementById("newsletter_form").submit();
/*alert(richiesta inviata con successo);*/
}   
}

