function ISdata(stringa) { var data=stringa; if (data.length>0) { var ok = true; var first = false; var second = false; var g = 0; var m = 0; var giorno; var mese; var anno; for(i=0;i < data.length;i++) { if ((data.charAt(i) != '-' && data.charAt(i) != '/') && (data.charAt(i) < '0') || (data.charAt(i) > '9')) ok = false; } if (!ok){ return false; } for(i=0;i < data.length;i++) { if ((data.charAt(i) == '-' || data.charAt(i) == '/') && !first) {; first = true; g = i; } else if ((data.charAt(i) == '-' || data.charAt(i) == '/') && first) { second = true; m = i; } } if (!first || !second) ok = false; if (!ok){ return false; } giorno = data.substring(0,g); mese = data.substring(g+1,m); anno = data.substring(m+1,data.length); if (anno < 1000) ok = false; if (mese < 1 || mese > 12) ok = false; if (giorno < 1 || giorno > 31) ok = false; if (giorno > 30 && mese == 4) ok = false; if (giorno > 30 && mese == 6) ok = false; if (giorno > 30 && mese == 9) ok = false; if (giorno > 30 && mese == 11) ok = false; if (giorno > 29 && mese == 2) ok = false; if (giorno == 29 && mese == 2) { if (anno % 4 == 0) { if (anno % 100 == 0) { if (anno % 400 != 0) ok = false; } } else ok = false; } if (!ok){ return false; } } return true; } function dataArrivo() { var date = document.getElementById("date"); if (date.value.toLowerCase()=="arrival date" || date.value.toLowerCase() == "data di arrivo"){ date.value=""; } } function frmcheck(lingua) { var date = document.getElementById("date").value; if (date==""){ if (lingua=="it"){ alert("Attenzione: inserire una data di arrivo."); }else{ alert("Warning: you must specify the arrival date."); } return false; } if (date.toLowerCase()=="arrival date" || date.toLowerCase() == "data di arrivo"){ var today = new Date(); if (today.getMonth()+1 > 9){ mese = today.getMonth()+1; }else{ mese = "0"+(today.getMonth()+1); } if (today.getDate() > 9){ giorno = today.getDate(); }else{ giorno = "0"+today.getDate(); } date = giorno+"-"+mese+"-"+today.getFullYear(); } if (!ISdata(date)){ if (lingua=="it"){ alert("Attenzione: inserire una data di arrivo valida nel formato dd-mm-yyyy."); }else{ alert("Warning: you must specify the arrival date with dd-mm-yyyy format."); } return false; } if (date!=""){ document.getElementById("gg").value = parseInt(date.substring(0,2),10); document.getElementById("mm").value = parseInt(date.substring(3,5),10); document.getElementById("aa").value = parseInt(date.substring(6,10),10); }else{ if (lingua=="it"){ alert("Attenzione: inserire una data di arrivo."); }else{ alert("Warning: you must specify the arrival date."); } return false; } frm = document.getElementById("thefrm"); if (!(frm)) return false; if(frm.alb_sel && frm.alb_sel.options && frm.tappa_1_id_albergo) frm.tappa_1_id_albergo.value = frm.alb_sel.value; if (parseInt(frm.aa.value,10) < parseInt(2012)) { if (lingua=="it"){ alert ("Attenzione: la data inserita e' nel passato. Riverificare, prego."); }else{ alert("Warning: the date inserted is in the past. Please verify."); } return false; } if (parseInt(frm.aa.value,10) == parseInt(2012,10)) { if (parseInt(frm.mm.value,10) < parseInt(2,10)) { if (lingua=="it"){ alert ("Attenzione: la data inserita e' nel passato. Riverificare, prego."); }else{ alert("Warning: the date inserted is in the past. Please verify."); } return false; } if (parseInt(frm.mm.value,10) == parseInt(2,10)) { if (parseInt(frm.gg.value,10) < parseInt(22,10)) { if (lingua=="it"){ alert ("Attenzione: la data inserita e' nel passato. Riverificare, prego."); }else{ alert("Warning: the date inserted is in the past. Please verify."); } return false; } } } tot_adulti_pren = 0; // if (parseInt(frm.notti_1.value)==0 ){ frm.notti_1.value = 1; }else{ if (!(parseInt(frm.notti_1.value) > 0)) { if (lingua=="it"){ alert("E' necessario specificare il numero di notti per iniziare la ricerca."); }else{ alert("Warning: You must specify the number of nights."); } return false; } } //if (!(parseInt(frm.tot_camere.value)>0)) //{ // if (lingua=="it"){ // alert("E' necessario specificare numero di camere per iniziare la ricerca."); // }else{ // alert("Warning: You must specify the number of rooms."); // } // return false; //} if (parseInt(frm.tot_adulti.value)==0 ){ frm.tot_adulti.value = 2; }else{ if (!(parseInt(frm.tot_adulti.value) > 0)) { if (lingua=="it"){ alert("E' necessario almeno un adulto per continuare la prenotazione."); }else{ alert("Warning: You must specify the number of adults."); } return false; } } tot_adulti_pren = parseInt(frm.tot_adulti.value); // // 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) //{ // if (lingua=="it"){ // alert("E' necessario avere almeno una persona per camera."); // }else{ // alert("It is necessary to have at least one person per room."); // } // return false; //} // SE C'E' LA FUNZIONE LA TESTO E SE RITORNA FALSE RITORNO FALSE ANCHE QUI // if (window.obbligaLocalita) if (!(obbligaLocalita())) return false; // NUMERO CASUALE PER IL GET var ran_unrounded=Math.random()*1000000000; var ran_number=Math.floor(ran_unrounded); frm.nrand.value = ran_number; var lingua_descr = "eng"; if (lingua=="it"){ lingua_descr = "ita"; } window.open("https://www.blastnessbooking.com/prenota_new.htm?id_albergo=4777&tappa_1_id_albergo=4777&n_tappe=1&id_canale=0&headvar=ok&lingua_int="+lingua_descr+"&gg="+frm.gg.value+"&mm="+frm.mm.value+"&aa="+frm.aa.value+"¬ti_1="+frm.notti_1.value+"&tot_adulti="+frm.tot_adulti.value+"&tot_bambini="+frm.tot_bambini.value+"&tot_camere="+frm.tot_camere.value+"&codice_cli=&sconto="); }