function frmcheck(frm) {
 
            if (parseInt(frm.aa.value) < 2009)
            {
                        alert ("Warning: the date inserted is in the past. Please verify.");
                        frm.aa.focus();
                        return false;
            }
            if (parseInt(frm.aa.value) == 2009)
            {
                        if (parseInt(frm.mm.value) < 02)
                        {
                                   alert ("Warning: the date inserted is in the past. Please verify.");
                                   frm.mm.focus();
                                   return false;
                        }
                        if (parseInt(frm.mm.value) == 02)
                        {
                                   if (parseInt(frm.gg.value) < 25)
                                   {
                                               alert ("Warning: the date inserted is in the past. Please verify.");
                                               frm.gg.focus();
                                               return false;
                                   }
                        }
            }
 
            tot_adulti_pren = 0;
            tot_camere_pren = 0;
 
            if (parseInt(frm.tot_adulti.value) < 1)
            {
                        alert("One adult is required in order to continue");
                        frm.tot_adulti.focus();
                        return false;
            }
            if ((!(parseInt(frm.tot_adulti.value)>0))||(!(parseInt(frm.tot_camere.value)>0)))
            {
                        alert("You must specify the number of adults, of children and of rooms in order to continue");
                        frm.tot_camere.focus();
                        return false;
            }
            if (!(parseInt(frm.notti_1.value) > 0))
            {
                        alert("You must specify the number of adults, of children and of rooms in order to continue");
                        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("It is necessary to specify the children's age in order to continue");
                                   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("It is necessary to have at least one person per room");
                        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>Children age:</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() {
            // thefrm = document.getElementById("frm");
            document.frm.zon_tappa_1.options[0].selected = true;
}
function annulla_localita() {
            // thefrm = 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=eng&id_albergo=6253&id_prodotto=" + id,"Albergo", "width=512,height=320,resizable=no,menubar=no,scrollbars=yes");
            window_pmod.focus()
}

function getIframSrc(){
            var querystring = location.search;
            querystring = querystring.replace(/\?/,"&");
            var oldSrc = document.getElementById('framebooking').src;
            var newSrc = oldSrc + querystring;
            document.getElementById('framebooking').src = newSrc;
}
