// Menu Laterale
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// PopUp
function pop(a,w,h){
l=(screen.width-w)/2;
t=(screen.height-h)/2;
property="scrollbars=yes,width="+w+",height="+h+",top="+t+",left="+l;
window.open(a,"gestione",property);
}


// Aggiungi preferiti
function aggiungipref(sito,titolo) {
if( window.sidebar && window.sidebar.addPanel ) {
if (navigator.userAgent.lastIndexOf("Netscape") != -1) {
document.write( '<a class="vocemenubottom" href="javascript:window.sidebar.addPanel( "'+titolo+'", "'+sito+'", \'\' );">aggiungi ai preferiti<\/a>' );
}else{
document.write( '<a class="vocemenubottom" href="javascript:window.sidebar.addPanel( "'+titolo+'", "'+sito+'", \'\' );">aggiungi ai preferiti<\/a>' );
}
} else if( window.opera && window.print ) {
document.write( '<a class="vocemenubottom" title="'+titolo+'" rel="sidebar" href="'+sito+'">aggiungi ai preferiti<\/a>' );
} else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
document.write( '<a class="vocemenubottom" href="javascript:window.external.AddFavorite( location.href.replace( \/#.*\/, \'\' ), document.title );">aggiungi ai preferiti' + ( ( navigator.platform == 'Win32' ) ? '' : 'Aggiugi preferiti' ) + '<\/a>' );
}
}


// Controllo Directory
function controllo_dir(){
with(document.aggiungisito) {
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
if(titolo.value=="") {
alert("Errore: compilare il campo TITOLO");
titolo.focus();
return false;
}
if(descrizione.value=="") {
alert("Errore: compilare il campo DESCRIZIONE");
descrizione.focus();
return false;
}
if(url.value=="http://") {
alert("Errore: compilare il campo INDIRIZZO");
url.focus();
return false;
}
}
return true;
}


// Controllo Conatta BeB
function controllo_info(){
with(document.contattabeb) {
if(cognome.value=="") {
alert("Errore: compilare il campo COGNOME E NOME");
cognome.focus();
return false;
}
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
if(descrizione.value=="") {
alert("Errore: compilare il campo RICHIESTA");
descrizione.focus();
return false;
}
}
return true;
}


// Controllo Commenta BeB
function controllo_comm() {
with(document.commentibeb) {
if(commento.value=="") {
alert("Errore: compilare il campo commento.");
commento.focus();
return false;
}
if(security_code.value=="") {
alert("Errore: compilare il campo antispam.");
security_code.focus();
return false;
}
}



imd_mail = document.commentibeb.email.value
var mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!mail.test(imd_mail) || (imd_mail == "undefined")) {
    alert("Inserire un indirizzo email corretto! es: mariorossi@yahoo.it");
    return false;
    }
return true;



return true;
}


// Controllo Registrazione BeB
function controllo_regi(){
with(document.registratibeb) {
if(provincia.value=="") {
alert("Errore: selezionare la provincia");
provincia.focus();
return false;
}
if(comune.value=="") {
alert("Errore: selezionare la comune");
comune.focus();
return false;
}
if(indirizzo.value=="") {
alert("Indicare l'indirizzo della struttura");
comune.focus();
return false;
}
if(ragsoc.value=="") {
alert("Errore: compilare il campo RAGIONE SOCIALE");
ragsoc.focus();
return false;
}
if(cognome.value=="") {
alert("Errore: compilare il campo COGNOME");
cognome.focus();
return false;
}
if(nome.value=="") {
alert("Errore: compilare il campo NOME");
nome.focus();
return false;
}
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
if (privacy[0].checked == false ) {
alert("Errore: devi dare il consenso al trattameno dei dati personali");
return false;
}
/*
var mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!mail.test(email) || (email == "undefined")) {
alert("Inserire un indirizzo email corretto! es: nome@xxx.xx");
return false;
}
*/
}
imd_mail = document.registratibeb.email.value
var mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!mail.test(imd_mail) || (imd_mail == "undefined")) {
    alert("Inserire un indirizzo email corretto! es: mariorossi@yahoo.it");
    return false;
    }
return true;
}


// Controllo Registrazione BeB
function controllo_moddata(){
with(document.registratibeb) {
if(cognome.value=="") {
alert("Errore: compilare il campo COGNOME");
cognome.focus();
return false;
}
if(nome.value=="") {
alert("Errore: compilare il campo NOME");
nome.focus();
return false;
}
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
if(pass.value=="") {
alert("Errore: compilare il campo PASSWORD");
pass.focus();
return false;
}
}
return true;
}

// Controllo Modfica Utente
function controllo_moddatausr() {
with(document.modstru) {
if (ragsoc.value=="") {
alert("Errore: il campo RAGIONE SOCIALE non puņ essere vuoto!");
ragsoc.focus();
return false;
}
if (privacy[0].checked == false ) {
alert("ATTENZIONE:\nPer proseguire devi selezionare 'accetto'");
return false;
}
return true;
}
}

// Controllo Recupero Password
function controllo_recupass(){
with(document.recupass) {
if(username.value=="") {
alert("Errore: compilare il campo USERNAME");
username.focus();
return false;
}
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
}
return true;
}


// Registrazione utente
function controllo_regiu(){
with(document.registratiu) {
// Cognome
if(cognome.value=="") {
alert("Errore: compilare il campo COGNOME");
cognome.focus();
return false;
}
// Nome
if(nome.value=="") {
alert("Errore: compilare il campo NOME");
nome.focus();
return false;
}
// Nazione
if (nazione.value=="106") {
// Provincia
if(provincia.value=="") {
alert("Errore: selezionare la provincia");
provincia.focus();
return false;
}
// Comune
if(comune.value=="") {
alert("Errore: selezionare la comune");
comune.focus();
return false;
}
}
// Accettazione trattamento dati
if (privacy[0].checked == false ) {
alert("Errore: devi dare il consenso al trattameno dei dati personali");
return false;
}
// Email
if(email.value=="") {
alert("Errore: compilare il campo E-MAIL");
email.focus();
return false;
}
// Password
if(pass.value=="") {
alert("Errore: compilare il campo PASSWORD");
pass.focus();
return false;
}
// Conferma password
if(pass1.value=="") {
alert("Errore: compilare il campo CONFERMA PASSWORD");
pass1.focus();
return false;
}
if(security_code.value=="") {
alert("Errore: compilare il campo antispam.");
security_code.focus();
return false;
}
}
imd_mail = document.registratiu.email.value
pass = document.registratiu.pass.value
pass1 = document.registratiu.pass1.value
var mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!mail.test(imd_mail) || (imd_mail == "undefined")) {
    alert("Inserire un indirizzo email corretto! es: mariorossi@yahoo.it");
    return false;
    }
if ( pass != pass1 ) {
    alert("Le due password non coincidono.");
    return false;
}    
return true;
}


// Controllo cookie
function controlcookie() {
document.cookie = "cook=ok";
if (document.cookie=="cook=ok"){
}else{
alert("Devi abilitare i cookie per continuare.");
}
}

/*******
    LABEL NAVIGAZIONE
    SCHEDA STRUTTURA
                *****/

// Label1: Dati struttura
function mostra1() {
    // Dati struttura
    document.getElementById('label1').style.fontWeight="bold";
    document.getElementById('label1').style.paddingLeft="16px";
    document.getElementById('label1').style.paddingRight="15px";
    document.getElementById('datistruttura').style.visibility="visible";
    // Commenti
    document.getElementById('label2').style.fontWeight="normal";
    document.getElementById('label2').style.paddingLeft="18px";
    document.getElementById('label2').style.paddingRight="18px";
    document.getElementById('commentistruttura').style.visibility="hidden";
    // Galleria
    document.getElementById('label3').style.fontWeight="normal";
    document.getElementById('label3').style.paddingLeft="18px";
    document.getElementById('label3').style.paddingRight="18px";
    document.getElementById('galleriastruttura').style.visibility="hidden";
    }

// Label2: Commenti struttura
function mostra2() {
    // Dati struttura
    document.getElementById('label1').style.fontWeight="normal";
    document.getElementById('label1').style.paddingLeft="18px";
    document.getElementById('label1').style.paddingRight="18px";
    document.getElementById('datistruttura').style.visibility="hidden";
    // Commenti
    document.getElementById('label2').style.fontWeight="bold";
    document.getElementById('label2').style.paddingLeft="15px";
    document.getElementById('label2').style.paddingRight="15px";
    document.getElementById('commentistruttura').style.visibility="visible";
    // Galleria
    document.getElementById('label3').style.fontWeight="normal";
    document.getElementById('label3').style.paddingLeft="18px";
    document.getElementById('label3').style.paddingRight="18px";
    document.getElementById('galleriastruttura').style.visibility="hidden";
    }

// Label3: Galleria fotografica
function mostra3() {
    // Dati struttura
    document.getElementById('label1').style.fontWeight="normal";
    document.getElementById('label1').style.paddingLeft="18px";
    document.getElementById('label1').style.paddingRight="18px";
    document.getElementById('datistruttura').style.visibility="hidden";
    // Commenti
    document.getElementById('label2').style.fontWeight="normal";
    document.getElementById('label2').style.paddingLeft="18px";
    document.getElementById('label2').style.paddingRight="18px";
    document.getElementById('commentistruttura').style.visibility="hidden";
    // Galleria
    document.getElementById('label3').style.fontWeight="bold";
    document.getElementById('label3').style.paddingLeft="15px";
    document.getElementById('label3').style.paddingRight="14px";
    document.getElementById('galleriastruttura').style.visibility="visible";
    }
