
function prenota()
{
if (document.getElementById('pax').selectedIndex == 0)
	{
	alert('Devi indicare il numero dei passeggeri');
	document.getElementById('pax').focus();
	return false
	}

var dataok = document.getElementsByName('data_new');
var conta = 0 ;
var conta_week = 0 ;
var temp = '' ;

for(var i=0; i<dataok.length; i++)
{
	if (dataok[i].checked == true && temp == "" )
	{
	conta = conta + 1 ;
	temp = i ;
	document.getElementById('data1ok').value = dataok[i].value ;
	}
		
	if (dataok[i].checked == true && temp != "" && temp != i )
	{
	
		if (i != (temp + 1))
			{
			alert('Le settimane devono essere continue');
			return false;
			}
			else
			{
			temp = temp + 1;
			conta = conta + 1 ;
			}
	}
}

if (conta == 0 )
{
alert('Devi selezionare una data per potere passare alla prenotazione !') 
return false;
}

if (conta > 3 )
{
alert('E\' possibile selezionare fino a 3 settimane !') 
return false;
}

document.getElementById('weeks1').value = conta ;
document.getElementById('form1').submit();

}

function call_richiesta(id)
{
$('mex0').innerHTML = 'Wait just a second...<br><img src="/bb/images/loading.gif">';
new Ajax.Updater('mex0', '/bb/ajax/richiesta.asp?id_barca='+id ,
 {evalScripts:true,asynchronous:true});
 	   
 	   $('mex0').style.display = 'block';
 	   //new Effect.Appear('mex1');
       var lung = document.body.clientWidth / 2 ;
       var alt = document.body.clientHeight / 2 ;
       $('mex0').style.left = lung - 250  ;
       $('mex0').style.top = alt - 200  ;
}

function send_email()
{
var conta = 0 ;
var form = document.getElementById('form3');

if (form.email.value == "")
{
form.email.style.background= '#ffff00' ;
conta = conta + 1;
}
else
{
form.email.style.background= '' ;
}

if (!form.email.value.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/)) 
{
 conta = conta + 1 ;
 form.email.style.background= '#ffff00' ;
}
else
{
form.email.style.background= '' ;
}

if (form.messaggio.value == "")
{
form.messaggio.style.background= '#ffff00' ;
conta = conta + 1;
}
else
{
form.messaggio.style.background = '' ;
}

if (form.securitycode.value == "")
{
form.securitycode.style.background= '#ffff00' ;
conta = conta + 1;
}
else
{
form.securitycode.style.background= '' ;
}

if ( conta > 0 )
{
alert('Alcuni campi non completi o errati');
return false ;
}

$('form3').submit()
 
}

function seleziona_data(id,prezzo)
{

var totale = document.getElementById('totale').value ;
if (document.getElementById("k"+id).className != 'free' )
	{
	document.getElementById("k"+id).className = 'free' ;
	}
	else
	{
	document.getElementById("k"+id).className = '' ;
	}
var check = document.getElementById("s"+id).checked ;

//if (check == true )
//{
//document.getElementById('totale').value = parseInt(prezzo) + parseInt(totale) ;
//document.getElementById('calcolo').innerHTML = "Totale €. " +  document.getElementById('totale').value ;
//}
//else
//{
//if (totale > 0 )
//{
//document.getElementById('totale').value = parseInt(totale) - parseInt(prezzo) ;
//document.getElementById('calcolo').innerHTML = "Totale €. " +  document.getElementById('totale').value ;
//}
//}
}


function popup_unica(strlink)
{
var w = window.open(strlink,'Dettagli','left=20,top=20,width=700,height=630,toolbar=0,resizable=0,scrollbars=1,menubar=0,status=0,directories=0');
w.focus();
}


