var lang='';function resizeA(){
var hC = document.body.clientHeight-177;
var hC2 = document.getElementById('all').offsetHeight+100;
var hC3 = "";
if(hC>hC2) hC3 = hC;
if(hC2>hC) hC3 = hC2;
document.getElementById('sC').style.height = hC3+"px";
//masseria
if(fixedSize=="masseria"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = hPad+"px";
//document.getElementById('ccB').style.marginTop = hPad+"px";
if(hC3<600){
document.getElementById('sC').style.height = "600px";
document.getElementById('cC').style.height = "600px";
}
}
//appartamenti
if(fixedSize=="appartamenti"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = hPad+"px";
var hC2 = document.getElementById('appa').offsetHeight+100;
var hC3 = "";
if(hC>hC2) hC3 = hC;
if(hC2>hC) hC3 = hC2;
document.getElementById('sC').style.height = hC3+"px";
}
//gallery
if(fixedSize=="gallery"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = hPad+"px";
if(hC3<460){
document.getElementById('sC').style.height = "600px";
document.getElementById('cC').style.height = "600px";
}
startSlide();
}
//dintorni
if(fixedSize=="dintorni"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = "5px";
var hC2 = document.getElementById('striTh').offsetHeight+100;
var hC3 = "";
if(hC>hC2) hC3 = hC;
if(hC2>hC) hC3 = hC2;
document.getElementById('sC').style.height = hC3+"px";
if(hC3<680){
document.getElementById('sC').style.height = "680px";
document.getElementById('cC').style.height = "680px";
}
startSlide();
}
//offerte
if(fixedSize=="offerte"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = "5px";
var hC2 = document.getElementById('striTh').offsetHeight+100;
var hC3 = "";
if(hC>hC2) hC3 = hC;
if(hC2>hC) hC3 = hC2;
document.getElementById('sC').style.height = hC3+"px";
if(hC3<680){
document.getElementById('sC').style.height = "680px";
document.getElementById('cC').style.height = "680px";
}
startSlide();
}
//fatto
if(fixedSize=="fatto"){
var hPad = Math.ceil((hC3 - 294)/2)-63;
//document.getElementById('ccA').style.marginTop = hPad+"px";
if(hC3<530){
document.getElementById('sC').style.height = "530px";
document.getElementById('cC').style.height = "530px";
}
}
}
function resizeH(){
var hC = document.body.clientHeight-177;
var hC2 = document.getElementById('all').offsetHeight+100;
var hC3 = "";
if(hC>hC2) hC3 = hC;
if(hC2>hC) hC3 = hC2;
var hPad = Math.ceil((hC3 - 294)/2)-24;
//document.getElementById('all').style.marginTop = hPad+"px";
document.getElementById('sC').style.height = hC3+"px";
document.getElementById('cC').style.height = hC3+"px";
if(hC3<600){
document.getElementById('sC').style.height = "600px";
document.getElementById('cC').style.height = "600px";
}
}
function inviaPre(){
if(document.getElementById('nomeCo').value == false){
if(lang=="it"){
alert("NOME e COGNOME: campo mancante");
}else if(lang=="en"){
alert("NAME and SURNAME: missing field");
}
document.getElementById('nomeCo').focus();
return false;
}else if(document.getElementById('nazionalita').value == false){
if(lang=="it"){
alert("NAZIONALITA': campo mancante");
}else if(lang=="en"){
alert("NATIONALITY: missing field");
}
document.getElementById('nazionalita').focus();
return false;
}else if(document.getElementById('telefono').value == false){
if(lang=="it"){
alert("TELEFONO: campo mancante");
}else if(lang=="en"){
alert("TELEPHONE: missing field");
}
document.getElementById('telefono').focus();
return false;
}else if(document.getElementById('email').value == false){
if(lang=="it"){
alert("EMAIL: campo mancante");
}else if(lang=="en"){
alert("EMAIL: missing field");
}
document.getElementById('email').focus();
return false;
}else if(!indirizzoEmailValido(document.getElementById('email').value)){
if(lang=="it"){
alert("Indirizzo Email non valido");
}else if(lang=="en"){
alert("Email Address not valide");
}
document.getElementById('email').focus();
return false;
}else if(document.getElementById('email2').value == false){
if(lang=="it"){
alert("RIPETIZIONE EMAIL: campo mancante");
}else if(lang=="en"){
alert("REPEAT EMAIL: missing field");
}
document.getElementById('email2').focus();
return false;
}else if(document.getElementById('email').value != document.getElementById('email2').value){
if(lang=="it"){
alert("Le Email non coincidono");
}else if(lang=="en"){
alert("Emails not coicide");
}
document.getElementById('email').focus();
return false;
}else if(document.getElementById('dataAr').value == false){
if(lang=="it"){
alert("DATA ARRIVO: campo mancante");
}else if(lang=="en"){
alert("ARRIVE DATE: missing field");
}
document.getElementById('dataAr').focus();
return false;
}else if(document.getElementById('dataPa').value == false){
if(lang=="it"){
alert("DATA PARTENZA: campo mancante");
}else if(lang=="en"){
alert("DEPARTURE DATE': missing field");
}
document.getElementById('dataPa').focus();
return false;
}else if(document.getElementById('numGio').value == false){
if(lang=="it"){
alert("NUMERO GIORNI: campo mancante");
}else if(lang=="en"){
alert("NUMBER OF DAYS: missing field");
}
document.getElementById('numGio').focus();
return false;
}else if(document.getElementById('appSta').value == false){
if(lang=="it"){
alert("APPARTAMENTO/STANZA: campo mancante");
}else if(lang=="en"){
alert("ACCOMMODATION/ROOM: missing field");
}
document.getElementById('appSta').focus();
return false;
}else if(document.getElementById('numPer').value == false){
if(lang=="it"){
alert("NUMERO PERSONE: campo mancante");
}else if(lang=="en"){
alert("NUMBER OF PERSONS: missing field");
}
document.getElementById('numPer').focus();
return false;
}else{
document.getElementById('inviaPre').submit();
}
}
function indirizzoEmailValido(indirizzo) {
if (window.RegExp) {
var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
var regnv = new RegExp(nonvalido);
var regv = new RegExp(valido);
if (!regnv.test(indirizzo) && regv.test(indirizzo))
return true;
return false;
}
else {
if(indirizzo.indexOf("@") >= 0)
return true;
return false;
}
}
var ultimoId = "";
var iniziaIS = 0;
var imgJ = new Array();
var descrJ = new Array();
function putImg(path,i,descr){
x = document.getElementById('image');
x.src = path;
y = document.getElementById('n');
y.innerHTML = Number(i) + Number(1);
z = document.getElementById('descr');
z.innerHTML = descr;
ultimoId = i;
}
function putImgPrev(){
iP = Number(ultimoId) - Number(1);
control = Number(iniziaIS) + Number(rr);
if(iP < iniziaIS) iP = control;
putImg(imgJ[iP],iP,descrJ[iP]);
}
function putImgNext(){
iN = Number(ultimoId) + Number(1);
control = Number(iniziaIS) + Number(rr);
if(iN > control) iN = iniziaIS;
putImg(imgJ[iN],iN,descrJ[iN]);
}
function putImgSlide(){
putImgNext();
}
function startSlide(){
if(lang=="it"){
testo = "Ferma Sequenza Foto";
}else if(lang=="en"){
testo = "Stop Slide Show";
}
putImgSlide();
id = setInterval('putImgSlide()', 5000);
x = document.getElementById('slide');
x.innerHTML = ''+testo+'';
}
function stopSlide(){
if(lang=="it"){
testo = "Avvia Sequenza Foto";
}else if(lang=="en"){
testo = "Start Slide Show";
}
iS = iniziaIS;
x = document.getElementById('slide');
x.innerHTML = ''+testo+'';
clearInterval(id);
}