﻿function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}
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 Modulo() {
     var nome = document.modulo.nome.value;
     var cognome = document.modulo.cognome.value;
     var indirizzo = document.modulo.indirizzo.value;
     var citta = document.modulo.citta.value;
     var provincia = document.modulo.provincia.value;
     var telefono = document.modulo.telefono.value;
     var email = document.modulo.email.value;
     var info = document.modulo.info.value;

     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if ((nome == "") || (nome == "undefined")) {
           alert("Il campo Nome è obbligatorio.");
           document.modulo.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Il campo Cognome è obbligatorio.");
           document.modulo.cognome.focus();
           return false;
        }
        else if ((indirizzo == "") || (indirizzo == "undefined")) {
           alert("Il campo Indirizzo è obbligatorio.");
           document.modulo.indirizzo.focus();
           return false;
        }
        else if ((citta == "") || (citta == "undefined")) {
          alert("Il campo Citt&agrave; è obbligatorio.");
          document.modulo.citta.focus();
          return false;
        }
        else if ((provincia == "") || (provincia == "undefined")) {
          alert("Il campo Provincia è obbligatorio.");
          document.modulo.provincia.focus();
          return false;
        }
        else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("Il campo Telefono è numerico ed obbligatorio.");
           document.modulo.telefono.value = "";
           document.modulo.telefono.focus();
           return false;
        }
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.email.select();
           return false;
        }
        else if ((info == "") || (info == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("Il campo Maggiori informazioni è obbligatorio.");
           document.modulo.info.focus();
           return false;
        }
        else {
            return true;
        }
  }

  function Moduloen() {
     var nome = document.moduloen.nome.value;
     var cognome = document.moduloen.cognome.value;
     var indirizzo = document.moduloen.indirizzo.value;
     var citta = document.moduloen.citta.value;
     var provincia = document.moduloen.provincia.value;
     var telefono = document.moduloen.telefono.value;
     var email = document.moduloen.email.value;
     var info = document.moduloen.info.value;

     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if ((nome == "") || (nome == "undefined")) {
           alert("The field Name is mandatory.");
           document.moduloen.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("The field Surname is mandatory.");
           document.moduloen.cognome.focus();
           return false;
        }
        else if ((indirizzo == "") || (indirizzo == "undefined")) {
           alert("The field Address is mandatory.");
           document.moduloen.indirizzo.focus();
           return false;
        }
        else if ((citta == "") || (citta == "undefined")) {
          alert("The field City is mandatory.");
          document.moduloen.citta.focus();
          return false;
        }
        else if ((provincia == "") || (provincia == "undefined")) {
          alert("The field Province is mandatory.");
          document.moduloen.provincia.focus();
          return false;
        }
        else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("The field Telephone is numerical and mandatory.");
           document.moduloen.telefono.value = "";
           document.moduloen.telefono.focus();
           return false;
        }
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("To insert a correct address email.");
           document.moduloen.email.select();
           return false;
        }
        else if ((info == "") || (info == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("The field More Information is mandatory.");
           document.moduloen.info.focus();
           return false;
        }
        else {
            return true;
        }
  }
function Modulopl() {
     var nome = document.modulo.nome.value;
     var cognome = document.modulo.cognome.value;
     var indirizzo = document.modulo.indirizzo.value;
     var citta = document.modulo.citta.value;
     var provincia = document.modulo.provincia.value;
     var telefono = document.modulo.telefono.value;
     var email = document.modulo.email.value;
     var info = document.modulo.info.value;

     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if ((nome == "") || (nome == "undefined")) {
           alert("Nazwa pola jest wymagane.");
           document.modulo.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Pole jest obowiazkowe Nazwisko.");
           document.modulo.cognome.focus();
           return false;
        }
        else if ((indirizzo == "") || (indirizzo == "undefined")) {
           alert("W polu Adres jest wymagane.");
           document.modulo.indirizzo.focus();
           return false;
        }
        else if ((citta == "") || (citta == "undefined")) {
          alert("Pole Miasto jest wymagane.");
          document.modulo.citta.focus();
          return false;
        }
        else if ((provincia == "") || (provincia == "undefined")) {
          alert("Pole jest obowiazkowe Prowincja.");
          document.modulo.provincia.focus();
          return false;
        }
        else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("W polu Numer telefonu jest obowiazkowe i bez spacji.");
           document.modulo.telefono.value = "";
           document.modulo.telefono.focus();
           return false;
        }
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Wstaw adres e-mail.");
           document.modulo.email.select();
           return false;
        }
        else if ((info == "") || (info == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("Wiecej Pole jest wymagane.");
           document.modulo.info.focus();
           return false;
        }
        else {
            return true;
        }
  }

function Modulofr() {
     var nome = document.modulofr.nome.value;
     var cognome = document.modulofr.cognome.value;
     var indirizzo = document.modulofr.indirizzo.value;
     var citta = document.modulofr.citta.value;
     var provincia = document.modulofr.provincia.value;
     var telefono = document.modulofr.telefono.value;
     var email = document.modulofr.email.value;
     var info = document.modulofr.info.value;

     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if ((nome == "") || (nome == "undefined")) {
           alert("Le champ Nom est obligatoire.");
           document.modulofr.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Le champ Prénom est obligatoire.");
           document.modulofr.cognome.focus();
           return false;
        }
        else if ((indirizzo == "") || (indirizzo == "undefined")) {
           alert("Le champ Adresse est obligatoire.");
           document.modulofr.indirizzo.focus();
           return false;
        }
        else if ((citta == "") || (citta == "undefined")) {
           alert("Le champ Ville est obligatoire.");
           document.modulofr.citta.focus();
           return false;
        }
        else if ((provincia == "") || (provincia == "undefined")) {
          alert("Le champ Pays est obligatoire.");
          document.modulofr.provincia.focus();
          return false;
        }
        else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("Le champ Je téléphone est numérique et obligatoire.");
           document.modulofr.telefono.value = "";
           document.modulofr.telefono.focus();
           return false;
        }
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Insérer une adresse email correcte.");
           document.modulofr.email.select();
           return false;
        }
        else if ((info == "") || (info == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("Le champ Majeures informations est obligatoire.");
           document.modulofr.info.focus();
           return false;
        }
        else {
            return true;
        }
  }

function Moduloru() {
     var nome = document.moduloru.nome.value;
     var cognome = document.moduloru.cognome.value;
     var indirizzo = document.moduloru.indirizzo.value;
     var citta = document.moduloru.citta.value;
     var provincia = document.moduloru.provincia.value;
     var telefono = document.moduloru.telefono.value;
     var email = document.moduloru.email.value;
     var info = document.moduloru.info.value;

     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        if ((nome == "") || (nome == "undefined")) {
           alert("Имя поля для заполнения.");
           document.moduloru.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Поле является обязательным Фамилия.");
           document.moduloru.cognome.focus();
           return false;
        }
        else if ((indirizzo == "") || (indirizzo == "undefined")) {
           alert("Адрес поля для заполнения.");
           document.moduloru.indirizzo.focus();
           return false;
        }
        else if ((citta == "") || (citta == "undefined")) {
           alert("Город поля для заполнения.");
           document.moduloru.citta.focus();
           return false;
        }
        else if ((provincia == "") || (provincia == "undefined")) {
          alert("Поле является обязательным Провинция.");
          document.moduloru.provincia.focus();
          return false;
        }
        else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("Телефон поле является обязательным и без пробелов.");
           document.moduloru.telefono.value = "";
           document.moduloru.telefono.focus();
           return false;
        }
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Вставить адрес электронной почты.");
           document.moduloru.email.select();
           return false;
        }
        else if ((info == "") || (info == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("Остальные поля для заполнения.");
           document.moduloru.info.focus();
           return false;
        }
        else {
            return true;
        }
  }


function ModuloF() {
     var nome = document.moduloF.nome.value;
     var cognome = document.moduloF.cognome.value;
     var giorno = document.moduloF.giorno.value;
     var mese = document.moduloF.mese.value;
     var anno = document.moduloF.anno.value;
     var residente = document.moduloF.residente.value;
     var citta = document.moduloF.citta.value;
     var provincia = document.moduloF.provincia.value;
	 var regione = document.moduloF.regione.value;
     var professione = document.moduloF.professione.value;
     var esperienza = document.moduloF.esperienza.value;
     var telefono = document.moduloF.telefono.value;
     var email = document.moduloF.email.value;
     var dove = document.moduloF.dove.value;
     var provincia2 = document.moduloF.provincia2.value;
     var regione2 = document.moduloF.regione2.value;
     var locale = document.moduloF.locale.value;


     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	 
        if ((nome == "") || (nome == "undefined")) {
           alert("Il campo Nome è obbligatorio.");
           document.moduloF.nome.focus();
           return false;
        }
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Il campo Cognome è obbligatorio.");
           document.moduloF.cognome.focus();
           return false;
        }
		else if ((isNaN(giorno)) || (giorno == "") || (giorno == "undefined")) {
           alert("Il campo Giorno è numerico ed obbligatorio.");
           document.moduloF.giorno.value = "";
           document.moduloF.giorno.focus();
           return false;
        }
		else if ((isNaN(mese)) || (mese == "") || (mese == "undefined")) {
           alert("Il campo Mese è numerico ed obbligatorio.");
           document.moduloF.mese.value = "";
           document.moduloF.mese.focus();
           return false;
        }
		else if ((isNaN(anno)) || (anno == "") || (anno == "undefined")) {
           alert("Il campo Anno è numerico ed obbligatorio.");
           document.moduloF.anno.value = "";
           document.moduloF.anno.focus();
           return false;
        }
		else if ((residente == "") || (residente == "undefined")) {
           alert("Il campo Residente è obbligatorio.");
           document.moduloF.residente.focus();
           return false;
        }
		else if ((citta == "") || (citta == "undefined")) {
           alert("Il campo Città è obbligatorio.");
           document.moduloF.citta.focus();
           return false;
        }
		else if ((provincia == "") || (provincia == "undefined")) {
           alert("Il campo Provincia è obbligatorio.");
           document.moduloF.provincia.focus();
           return false;
        }
		else if ((regione == "") || (regione == "undefined")) {
           alert("Il campo Regione è obbligatorio.");
           document.moduloF.regione.focus();
           return false;
        }
		else if ((professione == "") || (professione == "undefined")) {
           alert("Il campo Professione è obbligatorio.");
           document.moduloF.professione.focus();
           return false;
        }
		else if ((esperienza == "") || (esperienza == "undefined")) {
           alert("Il campo Esperienza nel settore è obbligatorio.");
           document.moduloF.esperienza.focus();
           return false;
        }
		else if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           alert("Il campo Telefono è numerico ed obbligatorio.");
           document.moduloF.telefono.value = "";
           document.moduloF.telefono.focus();
           return false;
        }
		else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.moduloF.email.select();
           return false;
        }
		else if ((dove == "") || (dove == "undefined")) {
           alert("Il campo Dove vorresti aprire è obbligatorio.");
           document.moduloF.dove.focus();
           return false;
        }
		else if ((provincia2 == "") || (provincia2 == "undefined")) {
           alert("Il campo Provincia di dove vuoi aprire è obbligatorio.");
           document.moduloF.provincia2.focus();
           return false;
        }
		else if ((regione2 == "") || (regione2 == "undefined")) {
           alert("Il campo Regione di dove vuoi aprire è obbligatorio.");
           document.moduloF.regione2.focus();
           return false;
        }
		else if ((locale == "") || (locale == "undefined")) {
          alert("Il campo Possiedi un locale è obbligatorio.");
          document.moduloF.locale.focus();
          return false;
        }
        else {
            return true;
        }
  }

function openPicture(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
    newWindow = window.open('',"newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
    newWindow.document.open();
    newWindow.document.write('<html><HEAD><title>Dapro Viaggi S.a.s. - Zoom</title></HEAD><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
    newWindow.document.write('<img src="'+imageName+'" width="'+imageWidth+'" height="'+imageHeight+'" alt="'+alt+'">');
    newWindow.document.write('</body></html>');
    newWindow.document.close();
    newWindow.focus();
}

function imgassoc(val, lang) {
    StrWin = window.open('',"StrWin","width=580,height=400,left=0,top=0");
    StrWin.document.location.href='/images.php?lang='+lang+'&action=assoc&value='+val;
    StrWin.focus();
}

function asseref(go) {
    if (go) {
        opener.location.reload(false);
    }
}

function conferma(messaggio, url) {
    if (confirm(messaggio)) {
        document.location.href = url;
    }
    return false;
}

function localecopy(field, from) {
    nome = field+'_'+from;
    campoin = document.getElementById(nome);
    for (var i = 0;i<js_locales.length;i++) {
        valore = js_locales[i];
        if (valore == 'it' || valore == from) {
        } else {
            nomeout = field+'_'+valore;
            campoout = document.getElementById(nomeout);
            campoout.value = campoin.value;
        }

    }
}

function showadv() {
    var sg = 0;
    /*
    for(i=1;i<2;i++) {
        el = document.getElementById("hid"+i);

        if( el.style.display == "none" ) {
            el.style.display = "block";
            sg=1;
        } else {
            el.style.display = "none";
            sg=0;
        }
    }
    */

    el = document.getElementById("div_hid");
    if( el.style.display == "none" ) {
        el.style.display = "block";
        el.style.visibility = "visible";
        sg=1;
    } else {
        el.style.display = "none";
        el.style.visibility = "hidden";
        sg=0;
    }


    el = document.getElementById("advdiv");
    jorel = document.getElementById("advsearch");
    if (sg == 0) {
        el.innerHTML = '&raquo;';
        jorel.value = 'f';
    } else {
        el.innerHTML = '&laquo;';
        jorel.value = 't';
    }
}

function spopen(w) {
    el = document.getElementById('figli'+w);
    if (el.style.visibility == 'hidden') {
        el.style.visibility = 'visible';
    } else {
        el.style.visibility = 'hidden';
        div = document.getElementById('layerName');
        div.style.visibility = 'hidden';
    }
}

function loopen(w) {
    toshow = js_pacchetti[w];

    if (toshow == null || typeof toshow == 'undefined') {
        frames["ifaddsez"].location.href = '/daproviaggi.php?action=showlist&value='+w;
    }

    rebuildPacchetti(w);
    div = document.getElementById('layerName');
    div.style.left = 300;
    div.style.top = 150;
    div.style.visibility = 'visible';
}

function update_pacchetti(add, pacchetti, sezione) {
    if (add == 1) {
        parent.js_pacchetti[sezione] = pacchetti;
        parent.rebuildPacchetti(sezione);
    }
}

function rebuildPacchetti(w) {
    toshow = js_pacchetti[w];

    if (toshow == null || typeof toshow == 'undefined') return;

    div = document.getElementById('layerName');

    var stringa = '<br><br><ul>';

    for (pacchetto in toshow) {
        riga = toshow[pacchetto];
        stringa += '<li><a href="/daproviaggi.php?action=show&value='+riga["codice"]+'">'+riga["nome"]+'</a></li>';
    }
    stringa += '</ul>';

    div.innerHTML = stringa;

}


function getAbsolutePos(el) {
    var r = { x: el.offsetLeft, y: el.offsetTop };
    if (el.offsetParent) {
        var tmp = getAbsolutePos(el.offsetParent);
        r.x += tmp.x;
        r.y += tmp.y;
    }
    return r;
}

function clear_field(campo) {
    campo = document.getElementById(campo);
    if (campo == null || typeof campo == 'undefined') return;
    campo.value = '';
}

function despammail(address)
{
        document.location = "mailto:" + address.replace(/\[at\]/, "@");
}







if ( document.all )
{
    function blink_show()
    {
        blink_tags  = document.all.tags('blink');
        blink_count = blink_tags.length;
        for ( i = 0; i < blink_count; i++ )
        {
            blink_tags[i].style.visibility = 'visible';
        }

        window.setTimeout( 'blink_hide()', 700 );
    }

    function blink_hide()
    {
        blink_tags  = document.all.tags('blink');
        blink_count = blink_tags.length;
        for ( i = 0; i < blink_count; i++ )
        {
            blink_tags[i].style.visibility = 'hidden';
        }

        window.setTimeout( 'blink_show()', 250 );
    }

    window.onload = blink_show;
}






function send_a_friend() {
    top.document.location.href = 'mailto:?subject=Un pacchetto viaggi interessante&body=Ciao, ho visto questa pagina che puo\' interessarti: '+URLEncode(window.location.href);
    return false;
}


function URLEncode(stringa) {
    // The Javascript escape and unescape functions do not correspond
    // with what browsers actually do...
    var SAFECHARS = "0123456789" +                  // Numeric
                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  // Alphabetic
                    "abcdefghijklmnopqrstuvwxyz" +
                    "-_.!~*'()";                    // RFC2396 Mark characters
    var HEX = "0123456789ABCDEF";

    var plaintext = stringa;
    var encoded = "";
    for (var i = 0; i < plaintext.length; i++ ) {
        var ch = plaintext.charAt(i);
        if (ch == " ") {
            encoded += "+";             // x-www-urlencoded, rather than %20
        } else if (SAFECHARS.indexOf(ch) != -1) {
            encoded += ch;
        } else {
            var charCode = ch.charCodeAt(0);
            if (charCode > 255) {
                alert( "Unicode Character '"
                        + ch
                        + "' cannot be encoded using standard URL encoding.\n" +
                          "(URL encoding only supports 8-bit characters.)\n" +
                          "A space (+) will be substituted." );
                encoded += "+";
            } else {
                encoded += "%";
                encoded += HEX.charAt((charCode >> 4) & 0xF);
                encoded += HEX.charAt(charCode & 0xF);
            }
        }
    } // for

    return encoded;
};

function showrsta(val) {
    bz = 'rsta'+val;
    bz = document.getElementById(bz);

    cm = bz.style.display;
    if (cm == 'block') {
        bz.style.display = 'none';
    } else {
        bz.style.display = 'block';
    }
}