

function frmcheck(frm) {



	if (parseInt(frm.aa.value) < 2008)
	{
		alert ("Attenzione: la data inserita è nel passato. Riverificare, prego.");
		frm.aa.focus();
		return false;
	}
	if (parseInt(frm.aa.value) == 2008)
	{
		if (parseInt(frm.mm.value) < 04)
		{
			alert ("Attenzione: la data inserita è nel passato. Riverificare, prego.");
			frm.mm.focus();
			return false;
		}
		if (parseInt(frm.mm.value) == 04)
		{
			if (parseInt(frm.gg.value) < 22)
			{
				alert ("Attenzione: la data inserita è nel passato. Riverificare, prego.");
				frm.gg.focus();
				return false;
			}
		}
	}

	tot_adulti_pren = 0;
	tot_camere_pren = 0;

	if (parseInt(frm.tot_adulti.value) < 1)
	{
		alert("E' necessario almeno un adulto per continuare la prenotazione");
		frm.tot_adulti.focus();
		return false;
	}

		if (!(parseInt(frm.notti_1.value) > 0))
	{
		alert("E' necessario specificare numero di notti, di adulti e di camere per iniziare la ricerca");
		frm.notti_1.focus();
		return false;
 	}


	if ((parseInt(frm.tot_bambini.value)>0)&&(parseInt(frm.tot_camere.value)==1))
	{
		tutto_ok = 1;
		for (i=1; i<=parseInt(frm.tot_bambini.value); i++)
		{
			myvar = "st1bamb" + i;
			eta = parseInt(document.getElementById(myvar).value);
			if (eta < 0) tutto_ok = 0;
		}
		if (tutto_ok==0)
		{
			alert("E' necessario specificare l'età dei bambini per continuare la ricerca");
			frm.st1bamb1.focus();
			return false;
		}
	}
	tot_adulti_pren = parseInt(frm.tot_adulti.value);
	tot_camere_pren = parseInt(frm.tot_camere.value);
	tot_bambini_pren = parseInt(frm.tot_bambini.value);
	tot_occupanti_pren = tot_adulti_pren + tot_bambini_pren;
	str = "occ = " + tot_occupanti_pren + " cam = " + tot_camere_pren;
	//alert(str);
	if (tot_occupanti_pren < tot_camere_pren)
	{
		alert("E' necessario avere almeno una persona per camera");
		frm.tot_adulti.focus();
		return false;
	}
}


function cambia_camere(n) {
	var frm = document.getElementById('frm');
	var bambini = frm.tot_bambini.value;
	cambia_bambini(bambini);
}
function annulla_zona() {
	// frm = document.getElementById("frm");
	document.frm.zon_tappa_1.options[0].selected = true;
}
function annulla_localita() {
	// frm = document.getElementById("frm");
	document.frm.loc_tappa_1.options[0].selected = true;
}
function vedi_prodotto(id)
{
	window_pmod=window.open("vedi_prodotto.htm?lingua_int=ita&id_albergo=278&id_prodotto=" + id,"Albergo", "width=512,height=320,resizable=no,menubar=no,scrollbars=yes");
	window_pmod.focus()
}
function pop_calendar(theVars)
{
	theGVar = theVars + "gg";
	gg = document.getElementById(theGVar).value;
	theMVar = theVars + "mm";
	mm = document.getElementById(theMVar).value;
	theAVar = theVars + "aa";
	aa = document.getElementById(theAVar).value;

	//locurl = "calendario.htm?id_stile=170&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	locurl = "calendario.htm?tipo=inizio&id_stile=170&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	window.open(locurl,"Calendario", "width=220,height=190,resizable=no,menubar=no,scrollbars=yes");

}

function pop_calendarf(theVars)
{
	theGVar = theVars + "ggf";
	gg = document.getElementById(theGVar).value;
	theMVar = theVars + "mmf";
	mm = document.getElementById(theMVar).value;
	theAVar = theVars + "aaf";
	aa = document.getElementById(theAVar).value;

	locurl = "calendario.htm?tipo_cal=fine&id_stile=170&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	window.open(locurl,"Calendario", "width=220,height=190,resizable=no,menubar=no,scrollbars=yes");
}
