function controlla()
{



nome = document.ajaxfo.nome.value;
if (nome == '')
{
alert ('Devi inserire il nome');
document.ajaxfo.nome.style.backgroundColor = '#F5B6B3';
document.ajaxfo.nome.focus();
return false; 
}

email = document.ajaxfo.email.value;
if (email == '')
{
alert ('Devi inserire la tua e-mail');
document.ajaxfo.email.style.backgroundColor = '#F5B6B3';
document.ajaxfo.email.focus();
return false; 
}

if ( isEmail(email) == 0 ) {
alert("Inserire un indirizzo e-mail valido");
document.ajaxfo.email.focus();
return false;
}



telefono = document.ajaxfo.telefono.value;
if (telefono == '')
{
alert ('Devi inserire il tuo telefono');
document.ajaxfo.telefono.style.backgroundColor = '#F5B6B3';
document.ajaxfo.telefono.focus();
return false; 
}

dal = document.ajaxfo.dal.value;
if (dal == '')
{
alert ('Devi inserire il campo DAL');
document.ajaxfo.dal.style.backgroundColor = '#F5B6B3';
document.ajaxfo.dal.focus();
return false; 
}

al = document.ajaxfo.al.value;
if (al == '')
{
alert ('Devi inserire il campo AL');
document.ajaxfo.al.style.backgroundColor = '#F5B6B3';
document.ajaxfo.al.focus();
return false; 
}

adulti = document.ajaxfo.adulti.value;
if (adulti == '')
{
alert ('Devi inserire il numero di persone');
document.ajaxfo.adulti.style.backgroundColor = '#F5B6B3';
document.ajaxfo.adulti.focus();
return false;
}

tipologia = document.ajaxfo.tipologia.value;
if (adulti == 'tipologia')
{
alert ('Devi specificare la TIPOLOGIA');
document.ajaxfo.adulti.style.backgroundColor = '#F5B6B3';
document.ajaxfo.adulti.focus();
return false;
}
document.getElementById('ovl').style.display='block';
document.getElementById('loppa').style.display='none';


return true; 
}


function isEmail(string) {
if (string.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) != -1)
return 1;
else
return 0;
}




function visualizza_bambini(value) {
 
				document.getElementById('bambino1').style.display = "none";
				document.getElementById('bambino2').style.display = "none";
				document.getElementById('bambino3').style.display = "none";
						
						if (value == '0') {
							document.getElementById('info_nome_bambino1').value ="";
							document.getElementById('info_nome_bambino2').value = "";
							document.getElementById('info_nome_bambino3').value = "";
							document.getElementById('info_eta_bambino1').selectedIndex = 0;
							document.getElementById('info_eta_bambino2').selectedIndex = 0;
							document.getElementById('info_eta_bambino3').selectedIndex = 0;
						}
 
						 if (value == '1') {
							document.getElementById('bambino1').style.display = "block";
						 }
						 if (value == '2') {
							document.getElementById('bambino1').style.display = "block";
							document.getElementById('bambino2').style.display = "block";
						 }
						 if (value == '3') {
							document.getElementById('bambino1').style.display= "block";
							document.getElementById('bambino2').style.display= "block";
							document.getElementById('bambino3').style.display= "block";
						 }
					}

function CheckLength(txta,chrs,maxchars)
{ with (document.modulo)
{ var chars=txta.value
if (chars.length > maxchars)
{ txta.value=chars.substr(0,maxchars);
txta.blur(); }
chrs.value=maxchars-txta.value.length; } }
function validateFormit(form) {  
if ( (form.nome.value == "") ) { 
alert("Attenzione! Il campo NOME è obbligatorio!");
form.nome.focus();  
return false;}
if ( (form.messaggio.value == "") ) { 
alert("Attenzione! Devi inserire la richiesta!");
form.messaggio.focus();  
return false;}
if ( (form.telefono.value == "") ) { 
alert("Attenzione! Il campo TELEFONO è obbligatorio!");
form.telefono.focus();  
return false;}
if  ( form.email.value.indexOf( "@") == -1 )
{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
return false; }
if ( form.email.value.indexOf( ".") == -1 )
{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
return false; }
if ( (form.privacy.checked == false) ) { 
alert("Attenzione! Devi autorizzare il trattamento dei tuoi dati!");
form.privacy.focus();  
return false;}
return true;} 

function bookingalto()
{
dal = document.bookingalto.dal.value;
if (dal == '')
{
alert ('Inserisci la data di inizio del soggiorno');
document.bookingalto.dal.style.backgroundColor = '#F5B6B3';
document.bookingalto.dal.focus();
return false; 
}
al = document.bookingalto.al.value;
if (al == '')
{
alert ('Inserisci la data di fine del soggiorno');
document.bookingalto.al.style.backgroundColor = '#F5B6B3';
document.bookingalto.al.focus();
return false; 
}

return true;
}


function pulisci()
{
if (document.bookingalto.dal.value=="Dal")
{document.bookingalto.dal.value = '';
}}
function puliscidue()
{
if (document.bookingalto.al.value=="Al")
{document.bookingalto.al.value = '';
}}

function registrazione() 
{
email = document.registrazione_listmail.email_listmail.value;

if(email == "")
{
alert("Inserisci l'indirizzo di posta elettronica");
document.registrazione_listmail.email_listmail.focus();
return false;
}
else
{
EmailAddr = document.registrazione_listmail.email_listmail.value;
Filtro = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-]{2,})+.)+([a-zA-Z0-9]{2,})+$/;
if (Filtro.test(EmailAddr))
{}
else
{
alert("Controlla l'indirizzo di posta elettronica inserito");
document.registrazione_listmail.email_listmail.focus();
return false;
}
}
if (! window.focus) return true;
window.open("", "registrazione", "height=200,width=400,scrollbars=no");
document.registrazione_listmail.target="registrazione";
document.registrazione_listmail.submit();
return true;
}



$(function(){
$('a.fancyzoom').fancyzoom();
});

var slideshowSpeed = 6000;
var photos = [ 
{"image" : "slide1.jpg"},
{"image" : "slide2.jpg"},
{"image" : "slide3.jpg"}
];
$(document).ready(function() {
var interval;
$("#control").toggle(function(){
stopAnimation();
}, function() {
$(this).css({ "background-image" : "url(/struttura/loading.png)" });
navigate("next");
interval = setInterval(function() {navigate("next");}, slideshowSpeed);
});
	
	
var activeContainer = 1;	
var currentImg = 0;
var animating = false;
var navigate = function(direction) {
if(animating) {
return;
}
		
if(direction == "next") {
currentImg++;
if(currentImg == photos.length + 1) {
currentImg = 1;
}
} else {
currentImg--;
if(currentImg == 0) {
currentImg = photos.length;
}
}
		
var currentContainer = activeContainer;
if(activeContainer == 1) {
activeContainer = 2;
} else {
activeContainer = 1;
}
showImage(photos[currentImg - 1], currentContainer, activeContainer);
};
	
var currentZindex = -1;
var showImage = function(photoObject, currentContainer, activeContainer) {
animating = true;
currentZindex--;

// Set the background image of the new active container
$("#headerimg" + activeContainer).css({
"background-image" : "url(/struttura/" + photoObject.image + ")",
			"display" : "block",
			"z-index" : currentZindex
		});
		

		
		
		// Fade out the current container
		// and display the header text when animation is complete
		$("#headerimg" + currentContainer).fadeOut(function() {
			setTimeout(function() {
				$("#headertxt").css({"display" : "block"});
				animating = false;
			}, 500);
		});
	};
	

	
	// We should statically set the first image
	navigate("next");
	
	// Start playing the animation
	interval = setInterval(function() {
		navigate("next");
	}, slideshowSpeed);
	
});

