//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita(){
document.forms[0].submit.value = "Wait..";
document.forms[0].submit.disabled = true;
}



//funzione che mi permette di ridimensionare le immagini in Offerte ed Eventi se superano una determinata larghezza
function ridimensiona(){ 
for (imm in document.images){ 
img = document.images[imm] 
if (img.className=="image"){ 
if (img.width > 460){ 
img.width=460 
} 
//if (img.height> 600){ 
//img.height = 600 
//} 
} 
} 
}





function people(lng){
var colore_normale = "#c5c7c8";
var colore_avviso = "#FFFFC0";
//--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].indirizzo.style.backgroundColor = colore_normale;
document.forms[0].societa.style.backgroundColor = colore_normale;
document.forms[0].strcaptcha.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 SpamCode."
}
else if (lng=="es"){
var err_1 = "ˇAtención! Insertar el Apellido."
var err_2 = "ˇAtención! Insertar el Nombre."
var err_3 = "ˇAtención! Insertar la Ciudad."
var err_4 = "ˇAtención! Insertar el Teléfono o Cell."
var err_5 = "ˇAtención! Insertar el Email."
var err_6 = "ˇAtención! Insertar el Email corregido."
var err_7 = "ˇAtención! Insertar el Code Antispam."
}
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."
}
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].cognome.value==""){
alert(err_1);
document.forms[0].cognome.focus();
document.forms[0].cognome.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;
}
}