// Secure this javascript from being called and executed on behalf of outside websites. var d = new Array("www.traveltst.ca", "secure.traveltst.ca"); var domaincheck = document.location.href; //retrieve the current URL of user browser var accepted_ok = false; //set acess to false by default if(domaincheck.indexOf("http") != -1 || domaincheck.indexOf("https") != -1) { // If this is an http or https request. for(r = 0; r < d.length; r++) { if(domaincheck.indexOf(d[r]) != -1) { //if a match is found accepted_ok = true; //set access to true, and break out of loop break; } } } else { accepted_ok = true; } if(!accepted_ok) { alert("You're not allowed to directly link to this .js file on our server!"); history.back(-1); } var global_location = "/modustpl/_secureXMLReq.php"; var global_url = ""; function group_travel_info(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('gt_submit').disabled = false; } else if(b == "1") { // success alert("Your request more information form has been submitted."); document.getElementById("gt_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('gt_submit').disabled = false; } } } else { divShowIsShown = true; document.getElementById("gt_submit").disabled = true; var return_flag = true; var focus_flag = true; var url = "pid=10"; var error_message = "A problem with the fields listed below was encountered:\n\n"; if(document.getElementById("gt_name").value.length > 0) { url += ">_name=" + encodeURIComponent(document.getElementById("gt_name").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_name").focus(); } error_message += "'Name' field missing content.\n"; return_flag = false; } var numPeopleVal = document.getElementById("gt_anticipate").value; if(numPeopleVal.length > 0) { if(!isNaN(numPeopleVal)) { url += ">_anticipate=" + encodeURIComponent(document.getElementById("gt_anticipate").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_anticipate").focus(); } error_message += "'Anticipating Number of People' field must be a number.\n"; return_flag = false; } } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_anticipate").focus(); } error_message += "'Anticipating Number of People' field missing content.\n"; return_flag = false; } if(document.getElementById("gt_email").value.length > 0) { if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(document.getElementById("gt_email").value))) { url += ">_email=" + encodeURIComponent(document.getElementById("gt_email").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_email").focus(); } error_message += "\'Email\' field invalid.\n"; return_flag = false; } } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_email").focus(); } error_message += "\'Email\' field required.\n"; return_flag = false; } if(ismaxlength(document.getElementById("gt_comment").value, 1024)) { url += ">_comment=" + encodeURIComponent(document.getElementById("gt_comment").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("gt_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("gt_submit").disabled = false; return false; } else { url += ">_dep_date=" + encodeURIComponent(document.getElementById("gt_dep_date").value); url += ">_leavingfrom=" + encodeURIComponent(document.getElementById("gt_leavingfrom").value); url += ">_goingto=" + encodeURIComponent(document.getElementById("gt_goingto").value); url += ">_phone_day=" + encodeURIComponent($("#gt_phone_day").val()); url += ">_phone_night=" + encodeURIComponent($("#gt_phone_night").val()); url += ">_spec_ocais=" + encodeURIComponent($("#gt_spec_ocais").val()) if($(":radio[name='gt_traveltype']:checked").length > 0) { url += ">_traveltype=" + $(":radio[name='gt_traveltype']:checked").val(); } else { url += ">_traveltype="; } global_url = url; var url_tmp = global_url + "&email_verify=0"; divShowWaitStart(); //lXML(global_location, url_tmp); $.ajax({ type: "POST", async: false, data: url_tmp, url: "/modustpl/_group_vacation_XML.php", success: function (dat) { alert(dat); } }); divShowWaitStop(); window.location = window.location; } } } var startDate; var endDate; var callbacks = 0; function resetDates() { startDate = endDate = null; } /* Given two dates (in seconds) find out if date1 is bigger, date2 is bigger or theyre 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; } function filterDates1(cal) { startDate = cal.date; /* If they havent chosen an end date before well set it to the same date as the start date This way if the user scrolls in the start date 5 months forward, they dont need to do it again for the end date. if (endDate == null) { Zapatec.Calendar.setup({ firstDay : 0, weekNumbers : false, electric : false, showOthers : false, showsTime : false, timeFormat : "24", step : 2, range : [1900.01, 2999.12], electric : false, singleClick : true, ifFormat : "%Y-%m-%d", vertical : false, align : "Br", inputField : "gt_ret_date", button : "gt_ret_dateimg", // What will trigger the popup of the calendar dateStatusFunc : dateInRange2, //the function to call onUpdate : filterDates2, numberMonths : 3, controlMonth : 1 }); } */ } function filterDates2(cal) { endDate = cal.date; } /* 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 dateInRange1(date) { if(endDate != null) { // Disable dates after end date var compareEnd = compareDatesOnly(date, endDate); if(compareEnd < 0) { return (true); } // Hilight end date with "edges" style if(compareEnd == 0) { {return "edges";} } // Hilight inner dates with "between" style if(startDate != null){ var compareStart = compareDatesOnly(date, startDate); if(compareStart < 0) { return "between"; } } } //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; //alert(ret + " " + today + ":" + date + ":" + compareToday + ":" + days1 + ":" + days2); return(ret); } /* Cant choose days before the start date if it is choosen, hilights start and end dates with one style and dates between them with another. */ function dateInRange2(date) { if (startDate != null) { // Disable dates before start date var compareDays = compareDatesOnly(startDate, date); if(compareDays < 0) { return (true); } // Hilight end date with "edges" style if(compareDays == 0) { {return "edges";} } // Hilight inner dates with "between" style if((endDate != null) && (date > startDate) && (date < endDate)) { return "between"; } } var now = new Date(); if(compareDatesOnly(now, date) < 0) { return (true); } // all other days are enabled return false; // return true; }