//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita(obj,lng){
if (lng=="de"){
obj.submit.value = "Wait please..";
}
else{
obj.submit.value = "Attendere..";
}
obj.submit.disabled = true;
}


function eventi(numero){
if (numero=="0"){
document.getElementById("tbl1").style.display = "none";
document.getElementById("tbl2").style.display = "none";
document.getElementById("tbl3").style.display = "none";
document.getElementById("tbl4").style.display = "none";
document.getElementById("tbl5").style.display = "none";
document.getElementById("tbl6").style.display = "none";
}
else if (numero=="1"){
document.getElementById("tbl1").style.display = '';
document.getElementById("tbl2").style.display = '';
document.getElementById("tbl3").style.display = '';
document.getElementById("tbl4").style.display = '';
document.getElementById("tbl5").style.display = '';
document.getElementById("tbl6").style.display = '';
}
else {
document.getElementById("tbl1").style.display = "none";
document.getElementById("tbl2").style.display = "none";
document.getElementById("tbl3").style.display = "none";
document.getElementById("tbl4").style.display = "none";
document.getElementById("tbl5").style.display = "none";
document.getElementById("tbl6").style.display = "none";
}
}


function contatto(lng){
var colore_normale = "#ffffff";
var colore_avviso = "#cfd2e1";
//--Applico il colore base alle text--
document.forms[0].nome.style.backgroundColor = colore_normale;
document.forms[0].cognome.style.backgroundColor = colore_normale;
document.forms[0].citta.style.backgroundColor = colore_normale;
document.forms[0].telefono.style.backgroundColor = colore_normale;
document.forms[0].email.style.backgroundColor = colore_normale;
document.forms[0].strCAPTCHA.style.backgroundColor = colore_normale;
document.forms[0].messaggio.style.backgroundColor = colore_normale;
document.forms[0].azienda.style.backgroundColor = colore_normale;
document.forms[0].attivita.style.backgroundColor = colore_normale;
document.forms[0].n_persone.style.backgroundColor = colore_normale;


if (lng=="en"){
var err_1 = "Please insert the Surname."
var err_2 = "Please insert the Name."
var err_3 = "Please insert the Town."
var err_4 = "Please insert the Phone Number or Mobile Phone."
var err_5 = "Please insert the Email."
var err_6 = "Attention ! Email wrong."
var err_7 = "Please insert the Antispam Code."
var err_8 = "Please insert the Message."
var err_9 = "Please insert the Firm."
var err_10 = "Please insert the Type of Firm."
var err_11 = "Please insert the number of worker."
}
else {
var err_1 = "Attenzione ! Inserire il Cognome."
var err_2 = "Attenzione ! Inserire il Nome."
var err_3 = "Attenzione ! Inserire la Cittą."
var err_4 = "Attenzione ! Inserire il Telefono o Cell."
var err_5 = "Attenzione ! Inserire l\'Email."
var err_6 = "Attenzione ! Inserire l\'E-mail corretta."
var err_7 = "Attenzione ! Inserire il Codice AntiSpam."
var err_8 = "Attenzione ! Inserire la descrizione del problema o un messaggio."
var err_9 = "Attenzione ! Inserire la Ragione Sociale."
var err_10 = "Attenzione ! Inserire il Tipo di Attivitą."
var err_11 = "Attenzione ! Inserire il numero di dipendenti."
}

if (document.forms[0].cognome.value==""){
alert(err_1);
document.forms[0].cognome.focus();
document.forms[0].cognome.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].nome.value==""){
alert(err_2);
document.forms[0].nome.focus();
document.forms[0].nome.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].citta.value==""){
alert(err_3);
document.forms[0].citta.focus();
document.forms[0].citta.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].telefono.value==""){
alert(err_4);
document.forms[0].telefono.focus();
document.forms[0].telefono.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].email.value==""){
alert(err_5);
document.forms[0].email.focus();
document.forms[0].email.style.backgroundColor = colore_avviso;
return false;
}
var x = document.forms[0].email.value;
var filter  = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
if (!(filter.test(x))){
alert (err_6);
document.forms[0].email.focus();
document.forms[0].email.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].strCAPTCHA.value==""){
alert(err_7);
document.forms[0].strCAPTCHA.focus();
document.forms[0].strCAPTCHA.style.backgroundColor = colore_avviso;
return false;
}

if (document.forms[0].tipo_richiesta.options.selectedIndex=="1"){
if (document.forms[0].azienda.value==""){
alert(err_9);
document.forms[0].azienda.focus();
document.forms[0].azienda.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].attivita.value==""){
alert(err_10);
document.forms[0].attivita.focus();
document.forms[0].attivita.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].n_persone.options.selectedIndex=="0"){
alert(err_11);
document.forms[0].n_persone.focus();
document.forms[0].n_persone.style.backgroundColor = colore_avviso;
return false;
}
}

if (document.forms[0].messaggio.value==""){
alert(err_8);
document.forms[0].messaggio.focus();
document.forms[0].messaggio.style.backgroundColor = colore_avviso;
return false;
}
}





function preventivo(lng){
var colore_normale = "#ffffff";
var colore_avviso = "#cfd2e1";
//--Applico il colore base alle text--
document.forms[0].nome.style.backgroundColor = colore_normale;
document.forms[0].cognome.style.backgroundColor = colore_normale;
document.forms[0].telefono.style.backgroundColor = colore_normale;
document.forms[0].email.style.backgroundColor = colore_normale;
document.forms[0].strCAPTCHA.style.backgroundColor = colore_normale;
document.forms[0].blob.style.backgroundColor = colore_normale;
document.forms[0].messaggio.style.backgroundColor = colore_normale;

if (lng=="de"){
var err_1 = "Achtung! Einlegen der Vorname."
var err_2 = "Achtung! Einlegen der Name."
var err_4 = "Achtung! Legen Sie die Telefon."
var err_5 = "Achtung! Legen Sie die E-Mail."
var err_6 = "Achtung! E-Mail falsch."
var err_7 = "Achtung! Legen Sie die SpamCode."
var err_8 = "Achtung! Falls Sie keinen Text einfügen, bitten wir Sie, das Dokument als E-Mail-Anhang zu senden."
}
else {
var err_1 = "Attenzione ! Inserire il Cognome."
var err_2 = "Attenzione ! Inserire il Nome."
var err_4 = "Attenzione ! Inserire il Telefono o Cell."
var err_5 = "Attenzione ! Inserire l\'Email."
var err_6 = "Attenzione ! Inserire l\'E-mail corretta."
var err_7 = "Attenzione ! Inserire il Codice AntiSpam."
var err_8 = "Attenzione ! Inserire il testo da tradurre oppure caricare un file."
}

if (document.forms[0].cognome.value==""){
alert(err_1);
document.forms[0].cognome.focus();
document.forms[0].cognome.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].nome.value==""){
alert(err_2);
document.forms[0].nome.focus();
document.forms[0].nome.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].telefono.value==""){
alert(err_4);
document.forms[0].telefono.focus();
document.forms[0].telefono.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].email.value==""){
alert(err_5);
document.forms[0].email.focus();
document.forms[0].email.style.backgroundColor = colore_avviso;
return false;
}
var x = document.forms[0].email.value;
var filter  = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
if (!(filter.test(x))){
alert (err_6);
document.forms[0].email.focus();
document.forms[0].email.style.backgroundColor = colore_avviso;
return false;
}

if (document.forms[0].messaggio.value=="" && document.forms[0].blob.value=="" ){
alert(err_8);
document.forms[0].messaggio.focus();
document.forms[0].blob.focus();
document.forms[0].messaggio.style.backgroundColor = colore_avviso;
document.forms[0].blob.style.backgroundColor = colore_avviso;
return false;
}
if (document.forms[0].strCAPTCHA.value==""){
alert(err_7);
document.forms[0].strCAPTCHA.focus();
document.forms[0].strCAPTCHA.style.backgroundColor = colore_avviso;
return false;
}
}
