// funzione per far comparire il pop-up della privacy
function apriFinestra(page){
var winOpenSquadra;
winOpened = window.open(page,"Squadra","directories=no,status=no,statusbar=no,resizable=no,menubar=no,scrollbars=yes,toolbar=no,width=770,height=530,left=10,top=10");
}

function WM_toggle(id){
if (document.all){
if(document.all[id].style.display == 'none'){
document.all[id].style.display = '';
} else {
document.all[id].style.display = 'none';
}
return false;
} else if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
return false;
}
}

function people(lng){
var colore_normale = "#FFFFFF";
var colore_avviso = "#FFFFC0";
//--Applico il colore base alle text--
document.theform.nome.style.backgroundColor = colore_normale;
document.theform.cognome.style.backgroundColor = colore_normale;
document.theform.telefono.style.backgroundColor = colore_normale;
document.theform.email.style.backgroundColor = colore_normale;
document.theform.messaggio.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 Arrival Date."
var err_8 = "Please insert the Departure Date."
var err_9 = "Please insert the Arrival Time."
var err_10 = "Attention ! The number of people is greater to the number of selected beds."
var err_11 = "Attention ! The number of people is lower to the number of selected beds."
var err_12 = "Attention ! Choose a typology of lodging."
var err_13 = "Please insert the N. of People."
var err_14 = "Attention ! Our property can entertain maximum 50 people."
var err_15 = "Attention ! Insert your message."
}
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 Día de Llegada."
var err_8 = "¡Atención! Insertar el Día de Salida."
var err_9 = "¡Atención! Insertar el horario de Llegada."
var err_10 = "¡Atención! El número max de personas integradas es superior a los sitios cama seleccionada."
var err_11 = "¡Atención! El número max de personas integradas es inferior a los sitios cama seleccionada."
var err_12 = "¡Atención! Eliges una tipología de habitación."
var err_13 = "¡Atención! Insertar el número de las personas."
var err_14 = "¡Atención! Nuestra estructura puede hospedar un máximo de 50 personas."
var err_15 = "¡Atención! Insertar un Messaje."
}
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 Giorno di Arrivo."
var err_8 = "Attenzione ! Inserire il Giorno di Partenza."
var err_9 = "Attenzione ! Inserire l\'Orario di Arrivo."
var err_10 = "Attenzione ! Il numero max di persone inserite è superiore ai posti letto selezionati."
var err_11 = "Attenzione ! Il numero max di persone inserite è inferiore ai posti letto selezionati."
var err_12 = "Attenzione ! Scegli una tipologia di stanza."
var err_13 = "Attenzione ! Inserire il numero delle persone."
var err_14 = "Attenzione ! La nostra struttura può ospitare un massimo di 50 persone."
var err_15 = "Attenzione ! Devi compilare il campo Messaggio."
}

if (document.theform.cognome.value==""){
alert(err_1);
document.theform.cognome.focus();
document.theform.cognome.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.nome.value==""){
alert(err_2);
document.theform.nome.focus();
document.theform.nome.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.telefono.value==""){
alert(err_4);
document.theform.telefono.focus();
document.theform.telefono.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.email.value==""){
alert(err_5);
document.theform.email.focus();
document.theform.email.style.backgroundColor = colore_avviso;
return false;
}
var x = document.theform.email.value;
var filter  = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
if (!(filter.test(x))){
alert (err_6);
document.theform.email.focus();
document.theform.email.style.backgroundColor = colore_avviso;
return false;
}
var messaggio = document.theform.messaggio.value;
if (messaggio==0){
alert(err_15);
document.theform.messaggio.focus();
document.theform.messaggio.style.backgroundColor = colore_avviso;
return false;
}
}


//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 > 550){ 
img.width=550 
} 
//if (img.height> 600){ 
//img.height = 600 
//} 
} 
} 
}




// funzione per far comparire il pop-up della privacy
function popup(page,w,h){
var winOpenVideo;
winOpened = window.open(page,"Video","directories=no,status=no,statusbar=no,resizable=no,menubar=no,scrollbars=yes,toolbar=no,width="+ w +",height="+ h +"");
}




//funzione che mi permette di centrare la popup
function resizeWin(Larghezza, Altezza){
var sizeH= Altezza;
var sizeW= Larghezza;
var posH=0;
var posW=0;

if (sizeH<=screen.height)
sizeH=30+sizeH;
if (sizeW<=screen.width)
sizeW=30+sizeW
self.resizeTo(sizeW,sizeH);
if (((screen.height-sizeH)/2)>0)
posW=((screen.height-sizeH)/2);
if (((screen.width-sizeW)/2)>0)
posH=((screen.width-sizeW)/2);
self.moveTo(posW,posH);
}