var global_location = "/modustpl/_secureXMLReq.php"; var global_url = ""; function individual_traveller_profile(a, b) { if(a) { divShowIsShown = false; divShowWaitStop(); divShowWaitMask.style.display = "none"; divShowIframe.style.display = "none"; if(b == "0") { // blacklisted IP address, blacklisted words or phrases, missing, invalid or maxlength fields var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; alert(error_message); document.getElementById(error_field).focus(); document.getElementById('rmi_submit').disabled = false; } else if(b == "1") { // success alert("Your request more information form has been submitted."); document.getElementById("rmi_submit").disabled = false; } else if(b == "2") { // email failed, requires confirmation var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; var yes = confirm(error_message); if(yes) { divShowIsShown = true; divShowWaitStart(); var url_tmp = global_url + "&email_verify=1"; lXML(global_location, url_tmp); } else { document.getElementById(error_field).focus(); document.getElementById('rmi_submit').disabled = false; } } } else { divShowIsShown = true; document.getElementById("rmi_submit").disabled = true; var return_flag = true; var focus_flag = true; var url = "pid=6&rmi_prod_id=" + encodeURIComponent(document.getElementById("rmi_prod_id").value); var error_message = "A problem with the fields listed below was encountered:\n\n"; if(document.getElementById("rmi_name").value.length > 0) { url += "&rmi_name=" + encodeURIComponent(document.getElementById("rmi_name").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("rmi_name").focus(); } error_message += "'Name' field missing content.\n"; return_flag = false; } if(document.getElementById("rmi_phone").value.length > 0) { url += "&rmi_phone=" + encodeURIComponent(document.getElementById("rmi_phone").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("rmi_phone").focus(); } error_message += "'Phone' field missing content.\n"; return_flag = false; } if(document.getElementById("rmi_email").value.length > 0) { if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(document.getElementById("rmi_email").value))) { url += "&rmi_email=" + encodeURIComponent(document.getElementById("rmi_email").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("rmi_email").focus(); } error_message += "\'Email\' field invalid.\n"; return_flag = false; } } if(ismaxlength(document.getElementById("rmi_comment").value, 1024)) { url += "&rmi_comment=" + encodeURIComponent(document.getElementById("rmi_comment").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("rmi_comment").focus(); } error_message += "'Comments' field exceeded its maximum length of 1024 characters.\n"; return_flag = false; } if(!return_flag) { alert(error_message); document.getElementById("rmi_submit").disabled = false; return false; } else { url += "&rmi_dep_date=" + encodeURIComponent(document.getElementById("rmi_dep_date").value); url += "&rmi_ret_date=" + encodeURIComponent(document.getElementById("rmi_ret_date").value); global_url = url; var url_tmp = global_url + "&emailVerify=0"; divShowWaitStart(); lXML(global_location, url_tmp); } } } function individual_traveller_profile2(a, b) { if(a) { divShowIsShown = false; divShowWaitStop(); divShowWaitMask.style.display = "none"; divShowIframe.style.display = "none"; if(b == "0") { // blacklisted IP address, blacklisted words or phrases, missing, invalid or maxlength fields var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; alert(error_message); document.getElementById(error_field).focus(); document.getElementById('rmi_submit').disabled = false; } else if(b == "1") { // success alert("Your request more information form has been submitted."); document.getElementById("rmi_submit").disabled = false; } else if(b == "2") { // email failed, requires confirmation var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; var yes = confirm(error_message); if(yes) { divShowIsShown = true; divShowWaitStart(); var url_tmp = global_url + "&email_verify=1"; lXML(global_location, url_tmp); } else { document.getElementById(error_field).focus(); document.getElementById('rmi_submit').disabled = false; } } } else { divShowIsShown = true; document.getElementById("itp_submit").disabled = true; var return_flag = true; var focus_flag = true; var url = ""; var error_message = "A problem with the fields listed below was encountered:\n\n"; url += "&itp_legalCompanyName=" + encodeURIComponent(document.getElementById("itp_legalCompanyName").value); url += "&itp_firstName=" + encodeURIComponent(document.getElementById("itp_firstName").value); url += "&itp_lastName=" + encodeURIComponent(document.getElementById("itp_lastName").value); url += "&itp_additionalNames=" + encodeURIComponent(document.getElementById("itp_additionalNames").value); url += "&itp_dateOfBirth=" + encodeURIComponent(document.getElementById("itp_dateOfBirth").value); url += "&itp_phoneHome=" + encodeURIComponent(document.getElementById("itp_phoneHome").value); url += "&itp_phoneBusiness=" + encodeURIComponent(document.getElementById("itp_phoneBusiness").value); url += "&itp_phoneCell=" + encodeURIComponent(document.getElementById("itp_phoneCell").value); url += "&itp_emailPrimary=" + encodeURIComponent(document.getElementById("itp_emailPrimary").value); url += "&itp_emailOther=" + encodeURIComponent(document.getElementById("itp_emailOther").value); url += "&itp_passportName=" + encodeURIComponent(document.getElementById("itp_passportName").value); url += "&itp_passportNumber=" + encodeURIComponent(document.getElementById("itp_passportNumber").value); url += "&itp_passportDateOfIssue=" + encodeURIComponent(document.getElementById("itp_passportDateOfIssue").value); url += "&itp_passportDateOfExpire=" + encodeURIComponent(document.getElementById("itp_passportDateOfExpire").value); url += "&itp_country=" + encodeURIComponent(document.getElementById("itp_country").value); url += "&itp_placeOfIssue=" + encodeURIComponent(document.getElementById("itp_placeOfIssue").value); url += "&itp_airline1=" + encodeURIComponent(document.getElementById("itp_airline1").value); url += "&itp_number1=" + encodeURIComponent(document.getElementById("itp_number1").value); url += "&itp_nameAsShown1=" + encodeURIComponent(document.getElementById("itp_nameAsShown1").value); url += "&itp_airline2=" + encodeURIComponent(document.getElementById("itp_airline2").value); url += "&itp_number2=" + encodeURIComponent(document.getElementById("itp_number2").value); url += "&itp_nameAsShown2=" + encodeURIComponent(document.getElementById("itp_nameAsShown2").value); url += "&itp_airline3=" + encodeURIComponent(document.getElementById("itp_airline3").value); url += "&itp_number3=" + encodeURIComponent(document.getElementById("itp_number3").value); url += "&itp_nameAsShown3=" + encodeURIComponent(document.getElementById("itp_nameAsShown3").value); var seatPref = $("input[name='seatpreference']:checked").val(); if (seatPref == "other") { seatPref += ": " + $("#otherseatpreference").val(); } url += "&itp_seatpreference=" + encodeURIComponent(seatPref); url += "&itp_bedtype=" + $("input[name='bedtype']:checked").val(); url += "&itp_numofbeds=" + $("#numofbeds").val(); url += "&itp_smoking=" + $("input[name='smokingpref']:checked").val(); url += "&itp_carsize=" + encodeURIComponent($("#carsize").val()); url += "&itp_hotelcarid=" + encodeURIComponent($("#hotelcarid").val()); url += "&itp_healthrestricitions=" + encodeURIComponent($("#healthrestrictions").val()); if(!return_flag) { alert(error_message); document.getElementById("itp_submit").disabled = false; return false; } else { global_url = url; var url_tmp = global_url + "&emailVerify=0"; divShowWaitStart(); //lXML(global_location, url_tmp); $.ajax({ type: "POST", async: false, data: url_tmp, url: "/moduslib/bis/individual_travel_profile_submit.php", success: function (dat) { alert(dat); } }); divShowWaitStop(); } } } // Given two dates (in seconds) find out if date1 is bigger, date2 is bigger or they're // the same, taking only the dates, not the time into account. In other words, different // times on the same date returns equal. returns -1 for date1 bigger, 1 for date2 is bigger // 0 for equal. function compareDatesOnly(date1, date2) { var year1 = date1.getYear(); var year2 = date2.getYear(); var month1 = date1.getMonth(); var month2 = date2.getMonth(); var day1 = date1.getDate(); var day2 = date2.getDate(); if(year1 > year2) { return -1; } if(year2 > year1) { return 1; } //years are equal if(month1 > month2) { return -1; } if(month2 > month1) { return 1; } //years and months are equal if(day1 > day2) { return -1; } if(day2 > day1) { return 1; } //days are equal return 0; } // Cant choose days after the end date if it is choosen, hilights start and end dates with one style and dates between them with another. function packagesNotBeforeToday(date) { //disable days prior to today var today = new Date(); var compareToday = compareDatesOnly(date, today); if(compareToday > 0) { return(true); } // all other days are enabled return false; } Zapatec.Calendar.setup({ weekNumbers:false, electric:false, inputField:"itp_dateOfBirth", button:"itp_dateOfBirthImg", ifFormat:"%Y-%m-%d", daFormat:"%Y-%m-%d", //numberMonths:3, //controlMonth:1, //dateStatusFunc:packagesNotBeforeToday // function to call }); Zapatec.Calendar.setup({ weekNumbers:false, electric:false, inputField:"itp_passportDateOfIssue", button:"itp_passportDateOfIssueImg", ifFormat:"%Y-%m-%d", daFormat:"%Y-%m-%d", //numberMonths:3, //controlMonth:1, //dateStatusFunc:packagesNotBeforeToday // function to call }); Zapatec.Calendar.setup({ weekNumbers:false, electric:false, inputField:"itp_passportDateOfExpire", button:"itp_passportDateOfExpireImg", ifFormat:"%Y-%m-%d", daFormat:"%Y-%m-%d", //numberMonths:3, //controlMonth:1, //dateStatusFunc:packagesNotBeforeToday // function to call });