﻿// JScript File
// JScript File
//prende il primo (ed unico) form della pagina
function nascondiTuttiMenu(theSubName){
    var elencoMenu = new Array();
    elencoMenu.push ("ulSubMenuChiSiamo");
    elencoMenu.push ("ulSubMenuCatalogo");
    elencoMenu.push ("ulSubMenuInfoPoint");
    
    
    for(i=0; i<elencoMenu.length;i++){
        if(elencoMenu[i]!=theSubName){
            if(document.getElementById(elencoMenu[i])){
                document.getElementById(elencoMenu[i]).style.display='none';
            }
        }
       
    } 

}


    function abilitaCodice(myDdlId,myTxtId,mySpanId,myColor)
{   
    myDdl = document.getElementById(myDdlId);
    myTxt = document.getElementById(myTxtId);
    mySpan = document.getElementById(mySpanId);
    if(myTxt && mySpan && myDdl){
        //privato
        if(myDdl.selectedIndex==1){
           mySpan.style.color='#000000';
           myTxt.disabled=false; 
           
        }else{
           mySpan.style.color=myColor;
           myTxt.value = '';
           myTxt.disabled=true; 
           
        }
    }

}





function getForm(){
    return document.forms[0];
}

function getInterval(){
    return 300; //secondi prima di far apparire o scomparire il menu
}    


//function visualizzaMenu(theSub,theDis){
function containsDOM (container, containee) {
  var isParent = false;
  do {
    if ((isParent = container == containee))
      break;
    containee = containee.parentNode;
  }
  while (containee != null);
  return isParent;
}

function checkMouseEnter (element, evt) {
  if (element.contains && evt.fromElement) {
    return !element.contains(evt.fromElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}
function checkMouseLeave (element, evt) {
  if (element.contains && evt.toElement) {
    return !element.contains(evt.toElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}




function visualizzaMenu(theSubName,theVis){
     puoiNasc=true;
     var theSub = document.getElementById(theSubName);
     if(theSub){
        if(theVis=='block'){
            nascondiTuttiMenu(theSubName);
        }

         theSub.style.display= theVis;

    }
}

//funzioni del menu nuovo
function nascondiMenu(theSubName){
     var theSub = document.getElementById(theSubName);
     if(theSub){
         if(theSub.style.display=='block'){
             setTimeout('visualizzaMenu("' + theSubName + '","none")', getInterval()); 
         }
      }
}

//funzioni del menu nuovo
function mostraMenu(theSubName){
    if(theSubName==''){
        setTimeout("nascondiTuttiMenu('')", getInterval()); 
    }else{
        var theSub = document.getElementById(theSubName);
        if(theSub){
           if(theSub.style.display!='block'){
                 setTimeout('visualizzaMenu("' + theSubName + '","block")', getInterval()); 
           }
        }
   }       

}



//restituisce un controllo del form in base all'id definita nel codice html della pagina
function getControl(theForm,theCtrName){
    var theCtr;
    var theCtrN = "$" + theCtrName;
    for(i=0;i<theForm.elements.length;i++){
        theCtr = theForm.elements[i];
        if(theCtr.name.indexOf(theCtrN)>=0)
        {
            return theCtr;
        }
    }
    return false;
}

function rolloverImg(theImgName){
    var theSuff = "_on";
    var theImg = document.getElementById(theImgName);
    var theSrc = theImg.src;
    var theAr = theSrc.split(".");
    var theNewSrc = theAr[theAr.length-2];
    var theExt = theAr[theAr.length-1];
    //alert(theNewSrc + theSuff + "." + theExt);
    alert(theNewSrc + theSuff + "." + theExt);
}

function isEmail(str) {
  var supported = 0;
  if(window.RegExp) {
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if (tempReg.test(tempStr)) supported = 1;
  }
  if(!supported)
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
			
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}



//SEZIONE CATALOGO
var icoOpen="images/ico_folder_open.gif"
var icoClose="images/ico_folder_close.gif"

/*
function visualizzaLinea(lineaId)
{
    var theImg = document.getElementById("imgFolder" + String(lineaId));
    if(theImg){
        if(theImg.src.indexOf("close")>0)
        {
            theImg.src = icoOpen;
            apriCategorie(lineaId,"block");
            if(elencoLinee){
                var theDiv
                for(i=0;i<elencoLinee.length;i++){
                    if(String(elencoLinee[i])!= String(lineaId)){
                        theDiv = document.getElementById(elencoLinee[i]);
                        if(theDiv){
                            theDiv.style.display="none";
                        }
                        
                    }
                }
            }
        }else{
            theImg.src = icoClose;
            apriCategorie(lineaId,"none");
            
        }
        
    }

}

*/

function visualizzaLinea(lineaId)
{
    var theImg = document.getElementById("imgFolder" + String(lineaId));
    if(theImg){
       apriCategorie(lineaId, theImg.src.indexOf("close")>0);
    }
}


function apriCategorie(lineaId,visibile)
{
    var theDiv = document.getElementById("divCategorie" + String(lineaId));
    if(theDiv)
    {
        if(visibile){
            theDiv.style.display="block";
            document.getElementById("imgFolder" + String(lineaId)).src = icoOpen;
            chiudiCategorie(lineaId);
            
        }else{
            theDiv.style.display="none";
            document.getElementById("imgFolder" + String(lineaId)).src = icoClose;
        
        }
       //theDiv.style.display=displayStyle;
    
    }
}

function chiudiCategorie(lineaId){
    if(elencoLinee){
        var theDiv
        for(i=0;i<elencoLinee.length;i++){
            
           if(String(elencoLinee[i])!= String(lineaId)){
              theDiv = document.getElementById("divCategorie" + elencoLinee[i]);
              if(theDiv){
                 theDiv.style.display="none";
                 document.getElementById("imgFolder" + String(elencoLinee[i])).src = icoClose;
                 
              }
        
            }
        }
                        
    }
}


function mostraImg(theImgUrl,theLbl){
    var myWin = window.open('popup.aspx?imgUrl=' + theImgUrl + '&imgLbl=' + theLbl,'myWin','width=600, height=400')
    //myWin.document.write (theImgUrl);
     
    //alert(theImgUrl);
}

function apriNews(theLng,theId){
    var myWin = window.open('popupNews.aspx?lingua=' + theLng + '&newsId=' + theId,'myWin','width=400, height=250, scrollbars=true')
    //myWin.document.write (theImgUrl);
     //alert(theLng + " --- " + theId);
    //alert(theImgUrl);
}



function mostraVideo(theImgUrl,theLbl){
    var myWin = window.open('video/player.aspx?myVideo=' + theImgUrl + '&myLbl=' + theLbl,'myWin','width=320, height=280')
    //myWin.document.write (theImgUrl);
     
    //alert(theImgUrl);
}

function mostraAudio(theImgUrl,theLbl){
    var myAudioWin = window.open('popAudio.aspx?myAudio=' + theImgUrl + '&myLbl=' + theLbl,'myAudioWin','width=260, height=80');
}

function apriMappa(theLng){
    //var myWin = window.open('popSwf.aspx?theImg=' + theImgUrl,'myWin','width=460, height=380')
    //myWin.document.write (theImgUrl);
    //alert(theImgUrl);
    var imgUrl = 'images/mappa_' + theLng + '.jpg';
    var contWin = window.open('popup.aspx?imgUrl=' + imgUrl + '&imgLbl=Mappa del Colorificio Di Maria S.p.A.','contWin','width=500, height=367')

}


function apriModuloOrdine(){
    //var myWin = window.open('popSwf.aspx?theImg=' + theImgUrl,'myWin','width=460, height=380')
    //myWin.document.write (theImgUrl);
    //alert(theImgUrl);
    var contWin = window.open('popModuloOrdine.aspx','ordWin','width=700, height=500, scrollbars=1')

}


function apriPrivacy(){
    //var myWin = window.open('popSwf.aspx?theImg=' + theImgUrl,'myWin','width=460, height=380')
    //myWin.document.write (theImgUrl);
    //alert(theImgUrl);
    var contPrivWin = window.open('popPrivacy.aspx','contPrivWin','width=400, height=400, scrollbars=1')

}


function validaModuloLostPwd(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"txtEmail").value;
    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid EMAIL ADDRESS";
        }else{
            msg = msg + "\n - inserisci un INDIRIZZO EMAIL valido";
        }
    }
    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}

function validaModuloRiv(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"rivenditore_ragioneSociale").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter COMPANY NAME";
        }else{
            msg = msg + "\n - il campo RAGIONE SOCIALE è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_partitaIVA").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter VAT NUMBER";
        }else{
            msg = msg + "\n - il campo PARTITA IVA è vuoto";
        }
    }
    

    currFld = getControl(theForm,"rivenditore_contatto").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter CONTACT NAME";
        }else{
            msg = msg + "\n - il campo NOMINATIVO è vuoto";
        }
    }


    currFld = getControl(theForm,"rivenditore_codice").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter RESELLER CODE";
        }else{
            msg = msg + "\n - il campo CODICE è vuoto";
        }
    }

    currFld = getControl(theForm,"rivenditore_userId").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter USER";
        }else{
            msg = msg + "\n - il campo USER è vuoto";
        }
    }


    currFld = getControl(theForm,"rivenditore_password").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter PASSWORD";
        }else{
            msg = msg + "\n - il campo PASSWORD è vuoto";
        }
    }else if(currFld.length<6 || currFld.length>20){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid PASSWORD (min 6 max 20 characters)";
        }else{
            msg = msg + "\n - inserire una PASSWORD valida (da 6 a 20 caratteri)";
        }
    }



    newFld = getControl(theForm,"conferma_password").value;
    if(currFld != newFld){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - CONFIRM PASSWORD doesn\'t match PASSWORD";
        }else{
            msg = msg + "\n - la PASSWORD di CONFERMA non corrisponde alla PASSWORD";
        }
    }

    currFld = getControl(theForm,"rivenditore_email").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_telefono").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your PHONE NUMBER";
        }else{
            msg = msg + "\n - il campo TELEFONO è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_citta").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CITY";
        }else{
            msg = msg + "\n - il campo CITTA\' è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_cap").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CAP";
        }else{
            msg = msg + "\n - il campo CAP è vuoto";
        }
    }

    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}


function validaModuloRivMod(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"rivenditore_ragioneSociale").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter COMPANY NAME";
        }else{
            msg = msg + "\n - il campo RAGIONE SOCIALE è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_partitaIVA").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter VAT NUMBER";
        }else{
            msg = msg + "\n - il campo PARTITA IVA è vuoto";
        }
    }
    

    currFld = getControl(theForm,"rivenditore_contatto").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter CONTACT NAME";
        }else{
            msg = msg + "\n - il campo NOMINATIVO è vuoto";
        }
    }


    currFld = getControl(theForm,"rivenditore_password").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter PASSWORD";
        }else{
            msg = msg + "\n - il campo PASSWORD è vuoto";
        }
    }else if(currFld.length<6 || currFld.length>20){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid PASSWORD (min 6 max 20 characters)";
        }else{
            msg = msg + "\n - inserire una PASSWORD valida (da 6 a 20 caratteri)";
        }
    }



    newFld = getControl(theForm,"conferma_password").value;
    if(currFld != newFld){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - CONFIRM PASSWORD doesn\'t match PASSWORD";
        }else{
            msg = msg + "\n - la PASSWORD di CONFERMA non corrisponde alla PASSWORD";
        }
    }

    currFld = getControl(theForm,"rivenditore_email").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_telefono").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your PHONE NUMBER";
        }else{
            msg = msg + "\n - il campo TELEFONO è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_citta").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CITY";
        }else{
            msg = msg + "\n - il campo CITTA\' è vuoto";
        }
    }
    
    currFld = getControl(theForm,"rivenditore_cap").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CAP";
        }else{
            msg = msg + "\n - il campo CAP è vuoto";
        }
    }

    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}

function verificaFormIscrizione(nc)
{
    var prefix = nc + "_";
    var errore = false;
    var msg = "Sono presenti degli errori nel modulo: ";
    var fld;
    var val;
     
    fld = document.getElementById(prefix + "txtragionesoc");
    if(fld){
        val=fld.value;
        if(val == ""){
            errore = true;
            msg = msg + "\n - non hai inserito la RAGIONE SOCIALE";
        }
    }
    
    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         
}

function verificaFormIscrizioneNew(theForm)
{
    var errore = false;
    var msg = "Sono presenti degli errori nel modulo: ";
    
    currFld = getControl(theForm,"txt_nome").value;
    if(currFld == ""){
        errore = true;
        msg = msg + "\n - il campo NOME è vuoto";
        
    }else if(currFld.length>50){
        errore = true;
        msg = msg + "\n - il campo NOME può contenere max 50 caratteri ";
    }
             
    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         
}




function validaModuloPrivMod(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"privato_nome").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your FIRST NAME";
        }else{
            msg = msg + "\n - il campo NOME è vuoto";
        }
    }
    


    currFld = getControl(theForm,"privato_password").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter PASSWORD";
        }else{
            msg = msg + "\n - il campo PASSWORD è vuoto";
        }
    }else if(currFld.length<6 || currFld.length>20){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid PASSWORD (min 6 max 20 characters)";
        }else{
            msg = msg + "\n - inserire una PASSWORD valida (da 6 a 20 caratteri)";
        }
    }


    newFld = getControl(theForm,"priv_conferma_password").value;
    if(currFld != newFld){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - CONFIRM PASSWORD doesn\'t match PASSWORD";
        }else{
            msg = msg + "\n - la PASSWORD di CONFERMA non corrisponde alla PASSWORD";
        }
    }

    currFld = getControl(theForm,"privato_email").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}



function validaModuloPriv(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"privato_nome").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your FIRST NAME";
        }else{
            msg = msg + "\n - il campo NOME è vuoto";
        }
    }
    

    currFld = getControl(theForm,"privato_userId").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter USER";
        }else{
            msg = msg + "\n - il campo USER è vuoto";
        }
    }else if(currFld.length<6 || currFld.length>20){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid USER (min 6 max 20 characters)";
        }else{
            msg = msg + "\n - inserire una USER valida (da 6 a 20 caratteri)";
        }
    }


    currFld = getControl(theForm,"privato_password").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter PASSWORD";
        }else{
            msg = msg + "\n - il campo PASSWORD è vuoto";
        }
    }else if(currFld.length<6 || currFld.length>20){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid PASSWORD (min 6 max 20 characters)";
        }else{
            msg = msg + "\n - inserire una PASSWORD valida (da 6 a 20 caratteri)";
        }
    }


    newFld = getControl(theForm,"conferma_password").value;
    if(currFld != newFld){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - CONFIRM PASSWORD doesn\'t match PASSWORD";
        }else{
            msg = msg + "\n - la PASSWORD di CONFERMA non corrisponde alla PASSWORD";
        }
    }

    currFld = getControl(theForm,"privato_email").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}



function validaModuloCercaRiv(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"txtNominativo").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your NAME";
        }else{
            msg = msg + "\n - il campo NOMINATIVO è vuoto";
        }
    }
    
    currFld = getControl(theForm,"txtEmail").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"txtCitta").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CITY";
        }else{
            msg = msg + "\n - il campo CITTA è vuoto";
        }
    }
    

    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}



function validaModuloJob(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"txtNominativo").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your NAME";
        }else{
            msg = msg + "\n - il campo NOMINATIVO è vuoto";
        }
    }
    
    
    
    currFld = getControl(theForm,"ddlFigura").selectedIndex;

    if(currFld<=0){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please choose a job profile";
        }else{
            msg = msg + "\n - occorre selezionare una figura professionale tra quelli disponibili";
        }
    }
    
    currFld = getControl(theForm,"txtEmail").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"txtCitta").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CITY";
        }else{
            msg = msg + "\n - il campo CITTA è vuoto";
        }
    }
    

    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}


function validaModuloContatti(theLng)
{
    var theForm = getForm();
    var errore = false;
    var msg = "";
    if(theLng=='en'){
        msg = "Sorry we can\'t process your request. Errors were found in your data: ";
    }else{
        msg = "Sono presenti degli errori nel modulo: ";
    }
    var currFld = getControl(theForm,"txtNominativo").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your NAME";
        }else{
            msg = msg + "\n - il campo NOMINATIVO è vuoto";
        }
    }
    
    
    
    currFld = getControl(theForm,"ddlDestinazione").selectedIndex;

    if(currFld<=0){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please choose a valid recipient";
        }else{
            msg = msg + "\n - occorre selezionare il destinatario tra quelli disponibili";
        }
    }
    
    currFld = getControl(theForm,"txtEmail").value;

    if(!isEmail(currFld)){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter a valid email address";
        }else{
            msg = msg + "\n - il campo EMAIL contiene un indirizzo non corretto";
        }
    }
    
    currFld = getControl(theForm,"txtCitta").value;
    if(currFld == ""){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - please enter your CITY";
        }else{
            msg = msg + "\n - il campo CITTA è vuoto";
        }
    }
    

    currFld = getControl(theForm,"cbPrivacy");
    
    if(!currFld.checked){
        errore = true;
        if(theLng=='en'){
             msg = msg + "\n - Please accept PRIVACY POLICY to let us process your request";
        }else{
            msg = msg + "\n - Occorre accettare la normativa sulla PRIVACY prima di inviare il modulo";
        }
    }


    if(errore){
        alert(msg);
        return false;
    }else{
        return true;
    }         


}