function setDate(form_name)
{
	
	var form = document.getElementById(form_name);
	
	var gg = form.gg;
	var mm = form.mm;
	var aa = form.aa;
	var oggi = new Date();


	if(gg && mm && aa)
	{


		gg.options[(oggi.getDate()-1)].selected = true;
		mm.options[(oggi.getMonth())].selected = true;

		for(i=0; i<10; i++)
		{
			if(aa.options[i])
			{
				if(aa.options[i].value == oggi.getFullYear()) aa.options[i].selected = true;
			}
		}

	}

	//controllo sulla data di partenza

	var ggf = document.getElementById("id_ggf");
	var mmf = document.getElementById("id_mmf");
	var aaf = document.getElementById("id_aaf");
	var oggif = new Date();

	if(ggf && mmf && aaf)
	{
		ggf.options[(oggif.getDate()-1)].selected = true;
		mmf.options[(oggif.getMonth())].selected = true;
		for(i=0; i<10; i++)
		{
			if(aaf.options[i])
			{
				if(aaf.options[i].value == oggif.getFullYear()) aaf.options[i].selected = true;
			}
		}
	}
}



function frmcheck(frm) 
{	
	if (parseInt(frm.aa.value) < 2010)
	{
		alert ("Attenzione: la data inserita � nel passato. Riverificare, prego.");
		frm.aa.focus();
		return false;
	}
	if (parseInt(frm.aa.value) == 2010)
	{
		if (parseInt(frm.mm.value) < 01)
		{
			alert ("Attenzione: la data inserita � nel passato. Riverificare, prego.");
			frm.mm.focus();
			return false;
		}
		if (parseInt(frm.mm.value) == 01)
		{
			if (parseInt(frm.gg.value) < 20)
			{
				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);
	if(!(tot_bambini_pren > 0)) tot_bambini_pren = 0;
	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_bambini(n) {
	camere = parseInt(document.frm.tot_camere.value);
	if (n>4) n=4;
	if ((n>0)&&(camere==1))
	{
		content = "<font class='testo_tecnico'><b>Et� bambini:</b></font>&nbsp;<BR>";
		for (i=1; i<=n; i++) content += "<select class='myinput' name='st1bamb"+i+"' id='st1bamb"+i+"'><option value='-1'>-?-</option><option value='0'>&lt;1</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option></select>";
		
		document.getElementById("bam_div").innerHTML=content+"&nbsp;";
		document.getElementById("bam_div").style.visibility = "visible";
		document.getElementById("bam_div").style.display = "block";
	} else {
		document.getElementById("bam_div").style.visibility = "hidden";
		document.getElementById("bam_div").style.display = "none";
	}
}
function cambia_camere(n) {
	bambini = parseInt(document.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=5764&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=3043&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	locurl = "calendario.htm?tipo=inizio&id_stile=3043&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=3043&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");
}