jQuery.noConflict(); trattamenti = ""; hotelTrattamenti = ""; var selectedWeek; var values = new Array(); var inputs = new Array(); function einaus(ele,ele2){ var index = ele.substring(7,8); var welligs = document.getElementById(ele); var testo = document.getElementById(ele2); if (welligs.style.display=='none'){ welligs.style.display = "block"; testo.innerHTML="- Remove rooms"; }else{ testo.innerHTML="+ Add other rooms"; for(i=index; i<=3; i++){ document.getElementById('opzione'+i).style.display="none"; document.getElementById('camerapiu'+i).innerHTML ="+ Add other rooms"; document.getElementById('camere'+i).selectedIndex=""; document.getElementById('adulti'+i).selectedIndex=""; document.getElementById('bambinoa'+i).selectedIndex=""; document.getElementById('bambinob'+i).selectedIndex=""; document.getElementById('bambinoc'+i).selectedIndex=""; } } } function einaus2IR(ele,ele2, ele3){ //document.getElementById("camerea").selectedIndex=""; var welligs = document.getElementById(ele); var testo = document.getElementById(ele2); var altPeriod = document.getElementById('alt_period'); var visualizza = document.getElementById(ele3); if (welligs.style.display=='none'){ welligs.style.display = "block"; visualizza.style.display = "none"; //testo.innerHTML="- Remove alternative period"; altPeriod.checked = true; }else{ welligs.style.display = "none"; visualizza.style.display = "inline-block"; //testo.innerHTML="+ Add alternative period"; altPeriod.checked = false; } } function CheckForm(f) { formObj = f; var mail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; var total = false; if (formObj.nome_cognome.value == "" || formObj.nome_cognome.value == "Required field") { alert("Please insert name and surname"); formObj.nome_cognome.focus(); return false; }else if (formObj.telefono.value ==""|| formObj.telefono.value == "Required field" ) { alert("Please insert phone number"); formObj.telefono.focus(); return false; }else if (formObj.email.value == "" || formObj.email.value == "Required field" || !mail.test(formObj.email.value) ) { alert("Please, insert a valid email address__"); formObj.email.focus(); return false; } else if (!formObj.privacy.checked) { alert("Please, accepts the agreements on privacy"); formObj.privacy.focus(); return false; } } function frmcheckVb(frm) { if(frm.aa){ if (frm.id_albergo.value == "") { alert ("Please choose an hotel /residence"); frm.id_albergo.focus(); return false; } if ((frm.aa.value=="")||(frm.mm.value=="")||(frm.gg.value=="")) { alert ("Attention: wrong date. Verify, please"); frm.gg.focus(); return false; } if (frm.aa.value < 2024) { alert ("Attention: wrong date. Verify, please"); frm.aa.focus(); return false; } if (frm.aa.value == 2024) { if (frm.mm.value < 11) { alert ("Attention: wrong date. Verify, please"); frm.mm.focus(); return false; } if (frm.mm.value == 11) { if (frm.gg.value < 10) { alert ("Attention: wrong date. Verify, please"); frm.gg.focus(); return false; } } } }else if(frm.datefrom.value == ''){ alert ("Attention: wrong date. Verify, please"); frm.datefrom.focus(); return false; } if(frm.dateto.value == ''){ alert ("Attention: wrong date. Verify, please"); frm.dateto.focus(); return false; } tot_adulti_pren = 0; tot_camere_pren = 0; if (parseInt(frm.tot_adulti.value) < 1) { alert("__MSGADULTO__"); frm.tot_adulti.focus(); return false; } if ((!(parseInt(frm.notti_1.value) > 0))||(!(parseInt(frm.tot_adulti.value)>0))||(!(parseInt(frm.tot_camere.value)>0))) { alert("You have to insert nights, adults and rooms numbers to start the query"); 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("You have to insert children age 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 = frm.tot_bambini.value == '' ? 0 :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 frmcheckBg(frm) { if(frm.aa){ if ((frm.aa.value=="")||(frm.mm.value=="")||(frm.gg.value=="")) { alert ("Attention: wrong date. Verify, please"); frm.gg.focus(); return false; } if (frm.aa.value < 2024) { alert ("Attention: wrong date. Verify, please"); frm.aa.focus(); return false; } if (frm.aa.value == 2024) { if (frm.mm.value < 11) { alert ("Attention: wrong date. Verify, please"); frm.mm.focus(); return false; } if (frm.mm.value == 11) { if (frm.gg.value < 10) { alert ("Attention: wrong date. Verify, please"); frm.gg.focus(); return false; } } } }else if(frm.datefrom.value == ''){ alert ("Attention: wrong date. Verify, please"); frm.datefrom.focus(); return false; } if(frm.dateto.value == ''){ alert ("Attention: wrong date. Verify, please"); frm.dateto.focus(); return false; } tot_adulti_pren = 0; tot_camere_pren = 0; if (parseInt(frm.num_adulti.value) < 1) { alert("__MSGADULTO__"); frm.num_adulti.focus(); return false; } if ((parseInt(frm.num_bambini.value)>0)&&(parseInt(frm.num_rooms.value)==1)) { tutto_ok = 1; for (i=1; i<=parseInt(frm.num_bambini.value); i++) { myvar = "st1bamb" + i; eta = parseInt(document.getElementById(myvar).value); if (eta < 0) tutto_ok = 0; } if (tutto_ok==0) { alert("You have to insert children age to continue"); frm.st1bamb1.focus(); return false; } } tot_adulti_pren = parseInt(frm.num_adulti.value); tot_camere_pren = parseInt(frm.num_rooms.value); tot_bambini_pren = frm.num_bambini.value == '' ? 0 :parseInt(frm.num_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.num_adulti.focus(); return false; } } function CheckMultiple292(frm, name) { for (var i=0; i < frm.length; i++) { fldObj = frm.elements[i]; fldId = fldObj.id; if (fldId) { var fieldnamecheck=fldObj.id.indexOf(name); if (fieldnamecheck != -1) { if (fldObj.checked) { return true; } } } } return false; } function CheckForm292(f) { var email_re = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i; if (!email_re.test(f.email.value)) { alert("__NEWSINDIRIZZOEMAIL__"); f.email.focus(); return false; } if (f.format.selectedIndex == -1) { alert("__NEWSFORMATO__"); f.format.focus(); return false; } var fldcheck = CheckMultiple292(f, "CustomFields[1099_292]"); if (!fldcheck) { alert("__NEWSPRIVACY__"); return false; } return true; } function CheckReceptionOnline(f) { formObj = f; var mail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (formObj.name.value == "" || formObj.name.value == "Required field") { alert("Please, insert your name"); formObj.name.focus(); return false; } else if (formObj.phone.value == "" || formObj.phone.value == "Required field") { alert("Please insert phone number"); formObj.phone.focus(); return false; } else if (formObj.email.value == "" || !mail.test(formObj.email.value)) { alert("Please, insert a valid email address__"); formObj.email.focus(); return false; } else if (!formObj.privacy.checked) { alert("Please, accepts the agreements on privacy"); formObj.privacy.focus(); return false; } formObj.invia.disabled=1; setTimeout("formObj.invia.disabled=0;",3000); } function scegli(){ if(!document.getElementById('cosa')) return; obj=document.getElementById('cosa').scelta; if(obj[0].checked){ document.getElementById('dlcatalogo').style.display="block"; document.getElementById('rccatalogo').style.display="none"; }else{ document.getElementById('rccatalogo').style.display="block"; document.getElementById('dlcatalogo').style.display="none"; } } function CheckCatalogue(f) { formObj = f; var mail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (formObj.nome.value == "" || formObj.nome.value == "Required field") { alert("Please, insert your name"); formObj.nome.focus(); return false; } else if (formObj.cognome.value == "" || formObj.cognome.value == "Required field") { alert("Please, insert your surname"); formObj.cognome.focus(); return false; } else if (formObj.email.value == "" || !mail.test(formObj.email.value)) { alert("Please, insert a valid email address__"); formObj.email.focus(); return false; } else if (formObj.via.value == "" ) { alert("Please, insert your adress"); formObj.via.focus(); return false; } else if (formObj.cap.value == "" ) { alert("Please, insert zip code"); formObj.cap.focus(); return false; } else if (formObj.citta.value == "" ) { alert("Please, insert your country"); formObj.citta.focus(); return false; } else if (!formObj.privacy.checked) { alert("Please, accepts the agreements on privacy"); formObj.privacy.focus(); return false; } formObj.invia.disabled=1; } function CheckDlCatalogue(f) { formObj = f; var mail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (formObj.email.value == "" || !mail.test(formObj.email.value)) { alert("Please, insert a valid email address__"); formObj.email.focus(); return false; } else if (!formObj.privacy.checked) { alert("Please, accepts the agreements on privacy"); formObj.privacy.focus(); return false; } formObj.invia.disabled=1; } function addWaterMark(el){ try { values.push(el.value); el.addEvent('focus',function(){ if (el.value === values[inputs.indexOf(el)]){el.value = ''}; }); el.addEvent('blur',function(){ if(this.value === ''){el.value = values[inputs.indexOf(el)]}; }); } catch(e) {} }; jQuery(document).ready(function() { //jQuery('#periodopiu').button({icons: {primary: "ui-icon-plusthick"}, text: false}); scegli(); var curAdults = 4; var curRooms = 0; if (curAdults) { jQuery('select#form_adulti').val(curAdults); } if (curRooms) { jQuery('select#form_camere').val(curRooms); } jQuery('input.cerca').click(function (e) { e.preventDefault(); jQuery('form#box-quotation').submit(); return false; }); jQuery('input.watermark').each(function(){ addWaterMark(jQuery(this)); }); if(jQuery('input#datefrom').length && jQuery('input#dateto').length) { jQuery('input#datefrom').datepicker({ dateFormat: 'dd/mm/yy' , minDate: 0, defaultDate: 0, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); var date2 = jQuery(this).datepicker('getDate', '+1d'); var date3 = jQuery(this).datepicker('getDate', '+1d'); date2.setDate(date2.getDate()+1); jQuery('input#dateto').datepicker( "option", "minDate", date2); date3.setDate(date3.getDate()); jQuery('input#dateto').datepicker('setDate',date3); } }); jQuery('input#dateto').datepicker({ dateFormat: 'dd/mm/yy' , minDate: +1, defaultDate: +7, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); } }); jQuery('input#datefrom').datepicker('setDate','default'); var date2 = jQuery('input#datefrom').datepicker('getDate', '+1d'); date2.setDate(date2.getDate()); jQuery('input#dateto').datepicker('setDate',date2); } if(jQuery('input#form_datefromIR').length && jQuery('input#form_datetoIR').length) { jQuery('input#form_datefromIR').datepicker({ dateFormat: 'dd/mm/yy' , minDate: 0, defaultDate: 0, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var option = "minDate"; var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); var date2 = jQuery(this).datepicker('getDate', '+1d'); date2.setDate(date2.getDate()+1); jQuery('input#form_datetoIR').datepicker( "option", option, date2); } }); jQuery('input#form_datetoIR').datepicker({ dateFormat: 'dd/mm/yy' , minDate: +7, defaultDate: +7, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var option = "maxDate"; var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); var date2 = jQuery(this).datepicker('getDate', '-1d'); date2.setDate(date2.getDate()-1); jQuery('input#form_datefromIR').datepicker( "option", option, date2); } }); jQuery('input#form_datefromIR').datepicker('setDate','0'); jQuery('input#form_datetoIR').datepicker('setDate',+2); //jQuery('input#form_datefromIR').datepicker('setDate','default'); //jQuery('input#form_datetoIR').datepicker('setDate','default'); } if(jQuery('input#form_datefromAltIR').length && jQuery('input#form_datetoAltIR').length) { jQuery('input#form_datefromAltIR').datepicker({ dateFormat: 'dd/mm/yy' , minDate: 0, defaultDate: 0, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var option = "minDate"; var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); var date2 = jQuery(this).datepicker('getDate', '+1d'); date2.setDate(date2.getDate()+1); jQuery('input#datetoAltIR').datepicker( "option", option, date2); } }); jQuery('input#form_datetoAltIR').datepicker({ dateFormat: 'dd/mm/yy' , minDate: +2, defaultDate: +2, showOn: 'both', buttonImage: "/pw/images/calendar.png", //set the class 'week-highlight' for the whole week beforeShowDay: function(date){ var day = date.getDay(); return [true,( day == 0)?"sunday":( day == 6)?"saturday":'']; }, onSelect: function( selectedDate ) { var option = "maxDate"; var instance = jQuery(this).data("datepicker"); jQuery.datepicker.parseDate(instance.settings.dateFormat ,selectedDate, instance.settings ); var date2 = jQuery(this).datepicker('getDate', '-1d'); date2.setDate(date2.getDate()-1); jQuery('input#form_datefromAltIR').datepicker( "option", option, date2); } }); jQuery('input#form_datefromAltIR').datepicker('setDate','default'); jQuery('input#form_datetoAltIR').datepicker('setDate','default'); } trattamenti = jQuery('select[name=trattamento]').html(); hotelTrattamenti = { '1':'Hotel'} ; });