// JavaScript Document

var ImgGrande_src = '';

function ctrlcampi_prodotto_italiano() {
     var nome = document.prodotto.nome.value;
     var cognome = document.prodotto.cognome.value;
     var societa = document.prodotto.societa.value;
     var telefono = document.prodotto.telefono.value;
     var email = document.prodotto.email.value;
     var richiesta = document.prodotto.richiesta.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.prodotto.nome.focus();
           return false;
        }
        
        else if ((cognome == "") || (cognome == "undefined")) {
          alert("Il campo Cognome è obbligatorio.");
          document.prodotto.cognome.focus();
          return false;
        }
        else if ((societa == "") || (societa == "undefined")) {
          alert("Il campo Società è obbligatorio.");
          document.prodotto.societa.focus();
          return false;
        }
        
        else if ((telefono == "") || (telefono == "undefined")) {
          alert("Il campo Telefono è obbligatorio.");
          document.prodotto.telefono.focus();
          return false;
        }
        
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.prodotto.email.select();
           return false;
        }
        else if ((richiesta == "") || (richiesta == "undefined")) {
          alert("Il campo Richiesta è obbligatorio.");
          document.prodotto.richiesta.focus();
          return false;
        }
        
	    else if (prodotto.accetto.checked == false){
	alert('Impossibile inviare la richiesta\nnon è stata data l\'autorizzazione al trattamento dei dati personali');
	return false;
	}	
        //INVIA IL MODULO
        else {
           return true;
        }
    }
    
function ctrlcampi_prodotto_inglese() {
     var nome = document.prodotto.nome.value;
     var cognome = document.prodotto.cognome.value;
     var societa = document.prodotto.societa.value;
     var telefono = document.prodotto.telefono.value;
     var email = document.prodotto.email.value;
     var richiesta = document.prodotto.richiesta.value;     
	 
     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
     
        if ((nome == "") || (nome == "undefined")) {
           alert("Name is required.");
           document.prodotto.nome.focus();
           return false;
        }
        
        else if ((cognome == "") || (cognome == "undefined")) {
          alert("Last name is required.");
          document.prodotto.cognome.focus();
          return false;
        }
        else if ((societa == "") || (societa == "undefined")) {
          alert("Company is required.");
          document.prodotto.societa.focus();
          return false;
        }
        
        else if ((telefono == "") || (telefono == "undefined")) {
          alert("Phone is required.");
          document.prodotto.telefono.focus();
          return false;
        }
        
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("E-mail address is incorrect");
           document.prodotto.email.select();
           return false;
        }
        else if ((richiesta == "") || (richiesta == "undefined")) {
          alert("Request is required");
          document.prodotto.richiesta.focus();
          return false;
        }
        
	    else if (prodotto.accetto.checked == false){
	alert('You must agree the privacy law');
	return false;
	}	
        //INVIA IL MODULO
        else {
           return true;
        }
    }
    
function ctrlcampi_contatti_italiano() {
     var nome = document.prodotto.nome.value;
     var cognome = document.prodotto.cognome.value;
     var societa = document.prodotto.societa.value;
     var telefono = document.prodotto.telefono.value;
     var email = document.prodotto.email.value;
     var richiesta = document.prodotto.richiesta.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.prodotto.nome.focus();
           return false;
        }
        
        else if ((cognome == "") || (cognome == "undefined")) {
          alert("Il campo Cognome è obbligatorio.");
          document.prodotto.cognome.focus();
          return false;
        }
        else if ((societa == "") || (societa == "undefined")) {
          alert("Il campo Società è obbligatorio.");
          document.prodotto.societa.focus();
          return false;
        }
        
        else if ((telefono == "") || (telefono == "undefined")) {
          alert("Il campo Telefono è obbligatorio.");
          document.prodotto.telefono.focus();
          return false;
        }
        
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.prodotto.email.select();
           return false;
        }
        else if ((richiesta == "") || (richiesta == "undefined")) {
          alert("Il campo Richiesta è obbligatorio.");
          document.prodotto.richiesta.focus();
          return false;
        }
        
	    else if (prodotto.accetto.checked == false){
	alert('Impossibile inviare la richiesta\nnon è stata data l\'autorizzazione al trattamento dei dati personali');
	return false;
	}	
        //INVIA IL MODULO
        else {
           return true;
        }
    }
    
function ctrlcampi_contatti_inglese() {
     var nome = document.prodotto.nome.value;
     var cognome = document.prodotto.cognome.value;
     var societa = document.prodotto.societa.value;
     var telefono = document.prodotto.telefono.value;
     var email = document.prodotto.email.value;
     var richiesta = document.prodotto.richiesta.value;     
	 
     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
     
        if ((nome == "") || (nome == "undefined")) {
           alert("Name is required.");
           document.prodotto.nome.focus();
           return false;
        }
        
        else if ((cognome == "") || (cognome == "undefined")) {
          alert("Last name is required.");
          document.prodotto.cognome.focus();
          return false;
        }
        else if ((societa == "") || (societa == "undefined")) {
          alert("Company is required.");
          document.prodotto.societa.focus();
          return false;
        }
        else if ((telefono == "") || (telefono == "undefined")) {
          alert("Phone is required.");
          document.prodotto.telefono.focus();
          return false;
        }
        
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("E-mail address is incorrect");
           document.prodotto.email.select();
           return false;
        }
        else if ((richiesta == "") || (richiesta == "undefined")) {
          alert("Request is required");
          document.prodotto.richiesta.focus();
          return false;
        }
        
	    else if (prodotto.accetto.checked == false){
	alert('You must agree the privacy law');
	return false;
	}	
        //INVIA IL MODULO
        else {
           return true;
        }
    }
    

function finestra (title,w,h,imgsource)
   {
   Fin=open('','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,screenX=300,screenY=200,width='+w+',height='+h+'');
   Fin.document.open();
   Fin.document.write("<HTML><HEAD><title>");
   Fin.document.write(title);
   Fin.document.write("</title></HEAD><BODY style='margin-top: 0px; margin-left: 0px; background-color: #000'>");
   Fin.document.write("<a href='javascript:window.close()'>");
   Fin.document.write("<img src=\""+imgsource+"\" border=0 alt='Clicca per chiudere / Click to close'>");
   Fin.document.write("</a>");
   Fin.document.write("</BODY></HTML>");
   Fin.document.close();
   }


