var MONTHS_SHORT = ["Január", "Február", "Március", "Április", "Május", "Június","Július", "Augusztus", "Szeptember", "Október", "November", "December"]; var MONTHS_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31]; var ARR_WEEKDAYS = ["Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat"]; function DayOfTheWeek(year, month, day) { var c = new Date(year, month-1, day); var dayOfWeek = c.getDay(); return ARR_WEEKDAYS[dayOfWeek]; } function getDays(startdate, enddate) { var startyear = startdate.charAt(0) + startdate.charAt(1) + startdate.charAt(2) + startdate.charAt(3); var startmonth = startdate.charAt(5) + startdate.charAt(6); var startday = startdate.charAt(8) + '' + startdate.charAt(9); var endyear = enddate.charAt(0) + enddate.charAt(1) + enddate.charAt(2) + enddate.charAt(3); var endmonth = enddate.charAt(5) + enddate.charAt(6); var endday = enddate.charAt(8) + '' + enddate.charAt(9); var start = new Date(startyear, startmonth-1, startday); var end = new Date(endyear, endmonth-1, endday); var one_day=1000*60*60*24 var days = Math.ceil((end.getTime()-start.getTime())/(one_day)); return days; } function setArrival(date, fullmonth) { today = '2024-05-03'; if (date < today) { date = today; } year = date.charAt(0) + date.charAt(1) + date.charAt(2) + date.charAt(3); month = date.charAt(5) + date.charAt(6); day = date.charAt(8) + '' + date.charAt(9); if (day > MONTHS_DAYS[month-1]) day = MONTHS_DAYS[month-1]; //nagy dátum beállítása myarr_date = document.getElementById("arr_date"); myarr_date.value = day + '-' + month + '-' + year; //a hét napja beállítása myarr_dayname = document.getElementById("arr_dayname"); myarr_dayname.value = DayOfTheWeek(year, month, day); myarr_day = document.getElementById("arr_day"); for (i=0;i<31;i++) { myarr_day.options[i]=null; } for (i=0;i 12) { aktmonth = 1*i-12; aktyear = 1*globalyear+1; } if (i > 24) { aktmonth = 1*i-24; aktyear = 1*globalyear+2; } if ((aktmonth == month) && (aktyear == year)) selectedmonth = j; myarr_month.options[j]=null; myarr_month.options[j]=new Option(MONTHS_SHORT[1*aktmonth-1] + ' '+ aktyear,aktyear + ''+ aktmonth); j++; } myarr_month.options[selectedmonth].selected=true; } function setDeparture(date, fullmonth) { today = '2024-05-04'; if (date < today) { date = today; } //alert(date); year = date.charAt(0) + date.charAt(1) + date.charAt(2) + date.charAt(3); month = date.charAt(5) + date.charAt(6); day = date.charAt(8) + '' + date.charAt(9); if (day > MONTHS_DAYS[month-1]) day = MONTHS_DAYS[month-1]; //nagy dátum beállítása mydep_date = document.getElementById("dep_date"); mydep_date.value = day + '-' + month + '-' + year; //a hét napja beállítása mydep_dayname = document.getElementById("dep_dayname"); mydep_dayname.value = DayOfTheWeek(year, month, day); mydep_day = document.getElementById("dep_day"); for (i=0;i<31;i++) { mydep_day.options[i]=null; } for (i=0;i<1*fullmonth;i++) { mydep_day.options[i]=new Option(1*i+1,1*i+1); } mydep_day.options[day-1].selected=true; mydep_month = document.getElementById("dep_month"); j = 0; globalmonth = 05; globalyear = 2024; for (i=globalmonth;i<1*globalmonth+12;i++) { aktmonth = i; aktyear = globalyear; if (i > 12) { aktmonth = 1*i-12; aktyear = 1*globalyear+1; } if (i > 24) { aktmonth = 1*i-24; aktyear = 1*globalyear+2; } //alert(aktyear); if ((aktmonth == month) && (aktyear == year)) selectedmonth = j; mydep_month.options[j]=null; mydep_month.options[j]=new Option(MONTHS_SHORT[aktmonth-1] + ' '+ aktyear,aktyear + ''+ aktmonth); j++; } mydep_month.options[selectedmonth].selected=true; } function changeArrDate() { myarr_day = document.getElementById("arr_day"); myarr_month = document.getElementById("arr_month"); myarr_month_text = myarr_month.options[myarr_month.selectedIndex].value; day = myarr_day.options[myarr_day.selectedIndex].value; year = myarr_month_text.charAt(0) + myarr_month_text.charAt(1) + myarr_month_text.charAt(2) + myarr_month_text.charAt(3); month = myarr_month_text.charAt(4) + myarr_month_text.charAt(5); //biztosan frissiteni kell az érkezést arrdate = year; if (month < 10) { arrdate = arrdate + '-0' + month; } else { arrdate = arrdate + '-' + month; } if (day < 10) { arrdate = arrdate + '-0' + day; } else { arrdate = arrdate + '-' + day; } //alert(arrdate); globaldate = '2025-04-30'; globaldate2 = '2025-04-29'; globalday2 = '29'; if (globaldate == arrdate) { arrdate = globaldate2; arrday = globalday2; } setArrival(arrdate, MONTHS_DAYS[month-1]); day = myarr_day.options[myarr_day.selectedIndex].value; year = myarr_month_text.charAt(0) + myarr_month_text.charAt(1) + myarr_month_text.charAt(2) + myarr_month_text.charAt(3); month = myarr_month_text.charAt(4) + myarr_month_text.charAt(5); //csak akkor módosítjuk a távozás dátumát, ha az megelőzi az érkezést mydep_day = document.getElementById("dep_day"); mydep_month = document.getElementById("dep_month"); mydep_month_text = mydep_month.options[mydep_month.selectedIndex].value; depnowday = mydep_day.options[mydep_day.selectedIndex].value; depnowyear = mydep_month_text.charAt(0) + mydep_month_text.charAt(1) + mydep_month_text.charAt(2) + mydep_month_text.charAt(3); depnowmonth = mydep_month_text.charAt(4) + mydep_month_text.charAt(5); if (1*year < 1*depnowyear) return; if ((1*year == 1*depnowyear) && (1*month < 1*depnowmonth)) return; if ( (1*year == 1*depnowyear) && (1*month==1*depnowmonth) && (1*day < 1*depnowday)) return; //alert(year + '-' + month + '-' + day); depday = 1*day + 1; depmonth = month; depyear = year; if ( (month<12) && (MONTHS_DAYS[month-1] == day)) { //nem december és hónap vége van depday = 1; depmonth = 1*month+1; depyear = 1*year; } if ((month == 12) && (MONTHS_DAYS[month-1] == day)) { //december és hónap vége van depday = 1; depmonth = 1; depyear = 1*year + 1; } depdate = depyear; if (depmonth < 10) { depdate = depdate + '-0' + depmonth; } else { depdate = depdate + '-' + depmonth; } if (depday < 10) { depdate = depdate + '-0' + depday; } else { depdate = depdate + '-' + depday; } //alert(depdate); setDeparture(depdate, MONTHS_DAYS[depmonth-1]); } function changeDepDate() { myarr_day = document.getElementById("arr_day"); myarr_month = document.getElementById("arr_month"); myarr_month_text = myarr_month.options[myarr_month.selectedIndex].value; arrday = myarr_day.options[myarr_day.selectedIndex].value; arryear = myarr_month_text.charAt(0) + myarr_month_text.charAt(1) + myarr_month_text.charAt(2) + myarr_month_text.charAt(3); arrmonth = myarr_month_text.charAt(4) + myarr_month_text.charAt(5); mydep_day = document.getElementById("dep_day"); mydep_month = document.getElementById("dep_month"); mydep_month_text = mydep_month.options[mydep_month.selectedIndex].value; depday = mydep_day.options[mydep_day.selectedIndex].value; depyear = mydep_month_text.charAt(0) + mydep_month_text.charAt(1) + mydep_month_text.charAt(2) + mydep_month_text.charAt(3); depmonth = mydep_month_text.charAt(4) + mydep_month_text.charAt(5); //biztosan frissiteni kell az távozást depdate = depyear; if (depmonth < 10) { depdate = depdate + '-0' + 1*depmonth; } else { depdate = depdate + '-' + 1*depmonth; } if (depday < 10) { depdate = depdate + '-0' + 1*depday; } else { depdate = depdate + '-' + 1*depday; } //alert(depdate); globaldate = '2024-05-01'; globaldate2 = '2024-05-02'; if (globaldate == depdate) { depdate = globaldate2; depday = 2; } arrdate = arryear; if (arrmonth < 10) { arrdate = arrdate + '-0' + 1*arrmonth; } else { arrdate = arrdate + '-' + 1*arrmonth; } if (arrday < 10) { arrdate = arrdate + '-0' + 1*arrday; } else { arrdate = arrdate + '-' + 1*arrday; } setDeparture(depdate, MONTHS_DAYS[1*depmonth-1]); return; if (arrdate < depdate) return; //minden ok //változtatni kell az érkezést is sajna arrday = 1*depday - 1; arrmonth = depmonth; arryear = depyear; if ( (depmonth>0) && (depday == 1)) { //nem január és hónap eleje arrday = 31; //a beállíátsnál úgyis a hónap végére módosítja a függvény arrmonth = 1*depmonth-1; arryear = 1*depyear; } if ((month == 0) && (depday == 1)) { //január és hónap eleje van arrday = 31; arrmonth = 12; arryear = 1*depyear - 1; } arrdate = arryear; if (arrmonth < 10) { arrdate = arrdate + '-0' + 1*arrmonth; } else { arrdate = arrdate + '-' + 1*arrmonth; } if (arrday < 10) { arrdate = arrdate + '-0' + 1*arrday; } else { arrdate = arrdate + '-' + 1*arrday; } //alert(arrdate); setArrival(arrdate, MONTHS_DAYS[arrmonth-1]); } function checkDateValidity() { myarr_day = document.getElementById("arr_day"); myarr_month = document.getElementById("arr_month"); myarr_month_text = myarr_month.options[myarr_month.selectedIndex].value; arrday = myarr_day.options[myarr_day.selectedIndex].value; arryear = myarr_month_text.charAt(0) + myarr_month_text.charAt(1) + myarr_month_text.charAt(2) + myarr_month_text.charAt(3); arrmonth = myarr_month_text.charAt(4) + myarr_month_text.charAt(5); mydep_day = document.getElementById("dep_day"); mydep_month = document.getElementById("dep_month"); mydep_month_text = mydep_month.options[mydep_month.selectedIndex].value; depday = mydep_day.options[mydep_day.selectedIndex].value; depyear = mydep_month_text.charAt(0) + mydep_month_text.charAt(1) + mydep_month_text.charAt(2) + mydep_month_text.charAt(3); depmonth = mydep_month_text.charAt(4) + mydep_month_text.charAt(5); //biztosan frissiteni kell az távozást depdate = depyear; if (depmonth < 10) { depdate = depdate + '-0' + 1*depmonth; } else { depdate = depdate + '-' + 1*depmonth; } if (depday < 10) { depdate = depdate + '-0' + 1*depday; } else { depdate = depdate + '-' + 1*depday; } //alert(depdate); globaldate = '2024-05-01'; globaldate2 = '2024-05-02'; if (globaldate == depdate) { depdate = globaldate2; depday = 2; } arrdate = arryear; if (arrmonth < 10) { arrdate = arrdate + '-0' + 1*arrmonth; } else { arrdate = arrdate + '-' + 1*arrmonth; } if (arrday < 10) { arrdate = arrdate + '-0' + 1*arrday; } else { arrdate = arrdate + '-' + 1*arrday; } if (arrdate < depdate) { if (arrdate == '2024-05-03') { if (confirm('Biztosan a mai napon szeretne érkezni?')) { return 1; } else return 2; } else return 1; //minden ok } return 0; } var startDate; var endDate; var ONEDAY = 3600 * 24; function resetDates() { startDate = endDate = null; } function filterDates1(cal) { var date = cal.date; startDate = date.getTime() if (endDate == null) { Zapatec.Calendar.setup({ inputField : "arrivalDate", button : "button8b", // What will trigger the popup of the calendar ifFormat : "%b %d, %Y", date : startDate, showsTime : false, //no time dateStatusFunc : disallowDateBefore, //the function to call onUpdate : filterDates2 }); } } function filterDates2(cal) { var date = cal.date; endDate = date.getTime() } function disallowDateBefore(date) { date = date.getTime(); if ((startDate != null) && (date < (startDate + ONEDAY))) { //start date can't be prior to end date return true; } var now = new Date().getTime(); if (date < (now - ONEDAY)) { //start date can't be prior to today return true; } return false; } function disallowDateAfter(date) { date = date.getTime(); if ((endDate != null) && (date > (endDate - ONEDAY))) { return true; } var now = new Date().getTime(); if (date < (now - ONEDAY)) { return true; } return false; } Zapatec.Calendar.setup({ firstDay : 1, inputField : "arr_date", // id of the input field button : "arr_button", // What will trigger the popup of the calendar ifFormat : "%d-%m-%Y", // format of the input field: Mar 18, 2005 showsTime : false, //no time dateStatusFunc : disallowDateAfter, //the function to call onUpdate : updateArr }); Zapatec.Calendar.setup({ firstDay : 1, inputField : "dep_date", button : "dep_button", // What will trigger the popup of the calendar ifFormat : "%d-%m-%Y", // format of the input field: Mar 18, 2005 showsTime : false, //no time dateStatusFunc : disallowDateBefore, //the function to call onUpdate : updateDep }); function updateArr(cal) { var date = cal.date; year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); if (month < 10) month = '0' + month; if (day < 10) day = '0'+day; fulldate = year + '-' + month + '-' + day; setArrival(fulldate, MONTHS_DAYS[date.getMonth()]); changeArrDate(); startDate = date.getTime(); } function updateDep(cal) { var date = cal.date; year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); if (month < 10) month = '0' + month; if (day < 10) day = '0'+day; fulldate = year + '-' + month + '-' + day; //alert(fulldate); setDeparture(fulldate, MONTHS_DAYS[date.getMonth()]); changeDepDate(); } function ChangeRoomNumber() { } function sendinquiry() { vname2 = document.guest_data.last_name.value; if (vname2.length == 0) { alert('A vezetéknév hiányzik!'); document.guest_data.last_name.focus(); return; } vname = document.guest_data.first_name.value; if (vname.length == 0) { alert('A keresztnév hiányzik!'); document.guest_data.first_name.focus(); return; } vemil = document.guest_data.email.value; if (vemil.length == 0) { alert('Az e-mail cím hiányzik!'); document.guest_data.email.focus(); return; } if (vemil.length < 4) { alert('Az e-mail cím túl rövid!'); document.guest_data.email.focus(); return; } vsrch = '[a-zA-Z0-9_.-]+@[a-zA-Z0-9.-]+'; if ((vemil.search(vsrch) == -1) || (vemil.search(' ') != -1)) { alert('Az e-mail cím nem érvényes!'); document.guest_data.email.focus(); return; } vphone = document.guest_data.telefon_fax.value; if (vphone .length == 0) { alert('A telefonszám hiányzik!'); document.guest_data.telefon_fax.focus(); return; } if (vphone.length < 4) { alert('A telefonszám túl rövid!'); document.guest_data.telefon_fax.focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 0) && (document.getElementById("child1_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child1_age").focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 1) && (document.getElementById("child2_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child2_age").focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 2) && (document.getElementById("child3_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child3_age").focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 3) && (document.getElementById("child4_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child4_age").focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 4) && (document.getElementById("child5_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child5_age").focus(); return; } if ((document.getElementById("guest_persons_child").selectedIndex > 5) && (document.getElementById("child6_age").selectedIndex == 0)) { alert('Adja meg a gyermek életkorát!'); document.getElementById("child6_age").focus(); return; } var datecheck = checkDateValidity(); if (datecheck == 0) { alert('Az utazási dátumnak későbbre kell esnie, mint az érkezési dátumnak. Kérjük ellenőrizze a dátumot és próbálja újra!'); return false; } var my_arrdate = document.getElementById("arr_date").value; var myright_arrdate = my_arrdate.charAt(6) + my_arrdate.charAt(7) + my_arrdate.charAt(8) + my_arrdate.charAt(9) + '-' + my_arrdate.charAt(3) + my_arrdate.charAt(4) + '-' + my_arrdate.charAt(0) + my_arrdate.charAt(1); var my_depdate = document.getElementById("dep_date").value; var myright_depdate = my_depdate.charAt(6) + my_depdate.charAt(7) + my_depdate.charAt(8) + my_depdate.charAt(9) + '-' + my_depdate.charAt(3) + my_depdate.charAt(4) + '-' + my_depdate.charAt(0) + my_depdate.charAt(1); var packID = document.getElementById("package").options[document.getElementById("package").selectedIndex].value; var arrdate = myright_arrdate; var depdate = myright_depdate; var nights = getDays(arrdate, depdate);