<!--

<!-- Valida campi testo -->
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 validateForm(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 validateForm2(form) {  
if ( (form.Nome.value == "") ) { 
alert("Attenzione! Il campo NOME è obbligatorio!");
form.Nome.style.backgroundColor = '#F5B6B3';
return false;}
if ( (form.Nome.value == "Nome *") ) { 
alert("Attenzione! Il campo NOME è obbligatorio!");
form.Nome.style.backgroundColor = '#F5B6B3';
return false;}


if  ( form.Email.value.indexOf( "@") == -1 )
{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
form.Email.style.backgroundColor = '#F5B6B3';
return false; }
if ( form.Email.value.indexOf( ".") == -1 )
{ alert( "Inserisci un indirizzo valido per la e-mail" ); 
form.Email.style.backgroundColor = '#F5B6B3';
return false; }
if ( (form.privacy.checked == false) ) { 
alert("Attenzione! Devi autorizzare il trattamento dei tuoi dati!");
form.privacy.focus();  
return false;}
return true;} 

  
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;
}


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";
						 }
					}
  
  
//-->

