﻿
  function popWin( url, name, width, height, scroller )
{
var outStr = 'height=' + height + ',width=' + width;
if (scroller != 'true') {
outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no, resizable=no';
}
else {
outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no, resizable=no';
}
window.open(url, name, outStr);
}

function popWin2( url, name, width, height, scroller )
{
var outStr = 'height=' + height + ',width=' + width;
if (scroller != 'true') {
outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, resizable=no';
}
else {
outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no, resizable=no';
}
window.open(url, name, outStr);
}


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 (locale in js_locales) {
        valore = js_locales[locale];
        if (valore == 'it' || valore == from) {
        } else {
            nomeout = field+'_'+valore;
            campoout = document.getElementById(nomeout);
            campoout.value = campoin.value;
        }

    }
}

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>Cral Tangenziale di Napoli - 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 openPrint(url,w,h,pleft,ptop) {
    newWindow = window.open(url,"newWindow","width="+w+",height="+h+",left="+pleft+",top="+ptop);
}

function Modulo() {
         var nome = document.modulo.nome.value;
         var cognome = document.modulo.cognome.value;
         var indirizzo = document.modulo.indirizzo.value;
         var telefono = document.modulo.telefono.value;
         var email = document.modulo.email.value;
         var info = document.modulo.info.value;
         var offerte = document.modulo.offerte.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 ((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 Info è obbligatorio.");
           document.modulo.info.focus();
           return false;
        }
        else if ((offerte == "") || (offerte == "undefined") || (info.indexOf("Inserisci qui il tuo slogan!") != (-1))) {
           alert("Il campo Offerte per i soci è obbligatorio.");
           document.modulo.offerte.focus();
           return false;
        }
        else {
            return true;
        }
  }
