//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita(lng){
if (lng=="en"){
var scritta = "Wait";
}
else {
var scritta = "Attedi";
}
document.forms[0].submit.value = scritta;
document.forms[0].submit.disabled = true;
}


function people(lng){
var colore_normale = "#FFFFFF";
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].telefono.style.backgroundColor = colore_normale;
document.forms[0].email.style.backgroundColor = colore_normale;
document.forms[0].messaggio.style.backgroundColor = colore_normale;

if (lng=="en"){
var err_1 = "Please, insert the Surname."
var err_2 = "Please, insert the Name."
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 your request."
}
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 la richiesta."
}
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==""){
alert(err_7);
document.forms[0].messaggio.focus();
document.forms[0].messaggio.style.backgroundColor = colore_avviso;
return false;
}
}
