/* * Date Format 1.2.2 * (c) 2007-2008 Steven Levithan * MIT license * Includes enhancements by Scott Trenda and Kris Kowal * * Accepts a date, a mask, or a date and a mask. * Returns a formatted version of the given date. * The date defaults to the current date/time. * The mask defaults to dateFormat.masks.default. */ var dateFormat = function() { var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function(val, len) { val = String(val); len = len || 2; while (val.length < len) val = "0" + val; return val; }; // Regexes and supporting functions are cached through closure return function(date, mask, utc) { var dF = dateFormat; // You can't provide utc if you skip other args (use the "UTC:" mask prefix) if (arguments.length == 1 && (typeof date == "string" || date instanceof String) && !/\d/.test(date)) { mask = date; date = undefined; } // Passing date through Date applies Date.parse, if necessary date = date ? new Date(date) : new Date(); if (isNaN(date)) throw new SyntaxError("invalid date"); mask = String(dF.masks[mask] || mask || dF.masks["default"]); // Allow setting the utc argument via the mask if (mask.slice(0, 4) == "UTC:") { mask = mask.slice(4); utc = true; } var _ = utc ? "getUTC" : "get", d = date[_ + "Date"](), D = date[_ + "Day"](), m = date[_ + "Month"](), y = date[_ + "FullYear"](), H = date[_ + "Hours"](), M = date[_ + "Minutes"](), s = date[_ + "Seconds"](), L = date[_ + "Milliseconds"](), o = utc ? 0 : date.getTimezoneOffset(), flags = { d: d, dd: pad(d), ddd: dF.i18n.dayNames[D], dddd: dF.i18n.dayNames[D + 7], m: m + 1, mm: pad(m + 1), mmm: dF.i18n.monthNames[m], mmmm: dF.i18n.monthNames[m + 12], yy: String(y).slice(2), yyyy: y, h: H % 12 || 12, hh: pad(H % 12 || 12), H: H, HH: pad(H), M: M, MM: pad(M), s: s, ss: pad(s), l: pad(L, 3), L: pad(L > 99 ? Math.round(L / 10) : L), t: H < 12 ? "a" : "p", tt: H < 12 ? "am" : "pm", T: H < 12 ? "A" : "P", TT: H < 12 ? "AM" : "PM", Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] }; return mask.replace(token, function($0) { return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); }); }; } (); // Some common format strings dateFormat.masks = { "default": "ddd mmm dd yyyy HH:MM:ss", shortDate: "m/d/yy", mediumDate: "mmm d, yyyy", longDate: "mmmm d, yyyy", fullDate: "dddd, mmmm d, yyyy", shortTime: "h:MM TT", mediumTime: "h:MM:ss TT", longTime: "h:MM:ss TT Z", isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" }; // Internationalization strings dateFormat.i18n = { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] }; // For convenience... Date.prototype.format = function(mask, utc) { return dateFormat(this, mask, utc); }; /* Client-side access to querystring name=value pairs Version 1.3 28 May 2008 License (Simplified BSD): http://adamv.com/dev/javascript/qslicense.txt */ function Querystring(qs) { // optionally pass a querystring to parse this.params = {}; if (qs == null) qs = location.search.substring(1, location.search.length); if (qs.length == 0) return; // Turn back to // See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 qs = qs.replace(/\+/g, ' '); var args = qs.split('&'); // parse out name/value pairs separated via & // split out each name=value pair for (var i = 0; i < args.length; i++) { var pair = args[i].split('='); var name = decodeURIComponent(pair[0]); var value = (pair.length == 2) ? decodeURIComponent(pair[1]) : name; this.params[name] = value; } } Querystring.prototype.get = function(key, default_) { var value = this.params[key]; return (value != null) ? value : default_; } Querystring.prototype.contains = function(key) { var value = this.params[key]; return (value != null); } function isMobile() { var isAMobile = false; (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) isAMobile=true})(navigator.userAgent||navigator.vendor||window.opera); return isAMobile; } function writeAccuBookSearchForm(customName) { writeTheAccuBookSearchForm(customName,false); } function writeAccuBookSearchFormWithPromoCode(customName){ writeTheAccuBookSearchForm(customName,true); } function writeTheAccuBookSearchForm(customName,showPromoCode) { customName = (typeof customName === "undefined") ? "" : customName; if (!isAccuBookSettingsOK()) { alert("Online Booking is not installed correctly. Please check your business name, site name and filename settings."); document.write('Online Booking is currently not available.'); } else { document.write('
'); document.write('
'); document.write('
Arrive
'); document.write('
'); document.write('
'); document.write('
'); document.write('
'); document.write('
Depart
'); document.write('
'); document.write('
'); document.write('
'); //optional promo code if(showPromoCode){ document.write('
'); document.write('
Promo Code
'); document.write('
'); document.write('
'); } document.write('
'); document.write('
'); document.write('
'); document.write('
'); for (var i = 1; i < 32; i = i + 1) { var optn = document.createElement("OPTION"); optn.text = i; optn.value = i; document.getElementById(customName + "DdCheckinDay").options.add(optn); var optn2 = document.createElement("OPTION"); optn2.text = i; optn2.value = i; document.getElementById(customName + "DdCheckOutDay").options.add(optn2); } var accubook_two_days_away = new Date().setDate(new Date().getDate() + 1); var accubook_four_days_away = new Date().setDate(new Date().getDate() + 2); var accubook_today = new Date().setDate(new Date().getDate()); var accubook_tomorrow = new Date().setDate(new Date().getDate() + 1); var accubook_startMonth = new Date().setDate(1); for (var i = 0; i < 13; i = i + 1) { var tempDate = new Date().setFullYear(new Date().getFullYear(), new Date().getMonth() + i, 1); var optn = document.createElement("OPTION"); optn.text = dateFormat(tempDate, "mmm yy"); ; optn.value = dateFormat(tempDate, "yyyy/mm/"); document.getElementById(customName + "DdCheckinMonth").options.add(optn); var optn2 = document.createElement("OPTION"); optn2.text = dateFormat(tempDate, "mmm yy"); ; optn2.value = dateFormat(tempDate, "yyyy/mm/"); document.getElementById(customName + "DdCheckoutMonth").options.add(optn2); } var accubook_qs = new Querystring(); var accubook_qs_from = accubook_qs.get("fromdate", accubook_today); var accubook_qs_to = accubook_qs.get("todate", accubook_tomorrow); for (var i = 0; i <= document.getElementById(customName + "DdCheckinDay").length - 1; i = i + 1) { var ddlText = document.getElementById(customName + "DdCheckinDay").options[i].text; txtText = dateFormat(accubook_qs_from, "d"); if (ddlText == txtText) { document.getElementById(customName + "DdCheckinDay").selectedIndex = i; break; } } for (var i = 0; i <= document.getElementById(customName + "DdCheckinMonth").length - 1; i = i + 1) { var ddlText = document.getElementById(customName + "DdCheckinMonth").options[i].value; txtText = dateFormat(accubook_qs_from, "yyyy/mm/"); if (ddlText == txtText) { document.getElementById(customName + "DdCheckinMonth").selectedIndex = i; break; } } for (var i = 0; i <= document.getElementById(customName + "DdCheckOutDay").length - 1; i = i + 1) { var ddlText = document.getElementById(customName + "DdCheckOutDay").options[i].value; txtText = dateFormat(accubook_qs_to, "d"); if (ddlText == txtText) { document.getElementById(customName + "DdCheckOutDay").selectedIndex = i; break; } } for (var i = 0; i <= document.getElementById(customName + "DdCheckoutMonth").length - 1; i = i + 1) { var ddlText = document.getElementById(customName + "DdCheckoutMonth").options[i].value; txtText = dateFormat(accubook_qs_to, "yyyy/mm/"); if (ddlText == txtText) { document.getElementById(customName + "DdCheckoutMonth").selectedIndex = i; break; } } } } function writeAccuBookIFrame() { if (!isAccuBookSettingsOK()) { alert("Online Booking is not installed correctly. Please check your business name, site name and filename settings."); document.write('Online Booking is currently not available.'); } else { var accubook_accubookURL; var accubook_framecode; var accubook_fromDate; var accubook_toDate; var accubook_qs = new Querystring(); if (accubook_qs.contains("view")) { if (accubook_qs.get("view") == "packages") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packages&business_name=" + accubook_Business + "&site_name=" + accubook_Site; accubook_framecode = ""; } else if (accubook_qs.contains("packageid")) { var packageid = accubook_qs.get("packageid"); accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packagedetails&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&Package_ID=" + packageid; accubook_framecode = ""; //document.write(accubook_framecode); } else if (accubook_qs.get("view") == "vouchers") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=vouchers&business_name=" + accubook_Business + "&site_name=" + accubook_Site; accubook_framecode = ""; // document.write(accubook_framecode); } } else { var accubook_two_days_away = new Date().setDate(new Date().getDate() + 2); var accubook_four_days_away = new Date().setDate(new Date().getDate() + 4); var accubook_today = new Date().setDate(new Date().getDate()); var accubook_tomorrow = new Date().setDate(new Date().getDate() + 1); var accubook_qs_from = accubook_qs.get("fromdate", accubook_today); var accubook_qs_to = accubook_qs.get("todate", accubook_tomorrow); accubook_fromDate = dateFormat(new Date(accubook_qs_from), "dd") + "/" + dateFormat(new Date(accubook_qs_from), "mmm") + "/" + dateFormat(new Date(accubook_qs_from), "yyyy"); accubook_toDate = dateFormat(new Date(accubook_qs_to), "dd") + "/" + dateFormat(new Date(accubook_qs_to), "mmm") + "/" + dateFormat(new Date(accubook_qs_to), "yyyy"); var pcode = ""; if(accubook_qs.contains("pcode")){ pcode = "&pcode=" + accubook_qs.get("pcode"); } accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=room&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&fromdate=" + accubook_fromDate + "&todate=" + accubook_toDate + pcode; accubook_framecode = ""; // document.write(accubook_framecode); } if(isMobile()){ window.location=accubook_accubookURL.replace(/&/g, "&"); // & is not accepted in browser url } else { document.write(accubook_framecode); } } } var linker; function addiFrame(url) { //used by universal analytics to track across iFrame return function (tracker) { window.linker = window.linker || new window.gaplugins.Linker(tracker); var iFrame = document.getElementById('accuBookIFrame'); if(isMobile()) { window.location = window.linker.decorate(url); } else { iFrame.src = window.linker.decorate(url); } }; } function writeGAAccuBookIFrame() { var accuBookGAURL = ""; if (!isAccuBookSettingsOK()) { alert("Online Booking is not installed correctly. Please check your business name, site name and filename settings."); document.write('Online Booking is currently not available.'); } else { var accubook_accubookURL; var accubook_framecode; var accubook_fromDate; var accubook_toDate; var accubook_qs = new Querystring(); if (accubook_qs.contains("view")) { if (accubook_qs.get("view") == "packages") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packages&business_name=" + accubook_Business + "&site_name=" + accubook_Site; //var accuBookGAURL = ""; accubook_framecode = ""; document.write(accubook_framecode); var iframe = document.getElementById('accuBookIFrame'); if (typeof _gaq == "object") { _gaq.push(function () { var pageTracker = _gat._getTrackerByName(); accuBookGAURL = pageTracker._getLinkerUrl(accubook_accubookURL); if (isMobile()) { window.location = accuBookGAURL; } else { iframe.src=accuBookGAURL; } }); } else { ga(addiFrame(accubook_accubookURL)); } } else if (accubook_qs.contains("packageid")) { var packageid = accubook_qs.get("packageid"); accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packagedetails&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&Package_ID=" + packageid; //var accuBookGAURL = ""; accubook_framecode = ""; document.write(accubook_framecode); var iframe = document.getElementById('accuBookIFrame'); if (typeof _gaq == "object") { _gaq.push(function () { var pageTracker = _gat._getTrackerByName(); accuBookGAURL = pageTracker._getLinkerUrl(accubook_accubookURL); if (isMobile()) { window.location = accuBookGAURL; } else { iframe.src = accuBookGAURL; } }); } else { ga(addiFrame(accubook_accubookURL)); } } else if (accubook_qs.get("view") == "vouchers") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=vouchers&business_name=" + accubook_Business + "&site_name=" + accubook_Site; // var accuBookGAURL = ""; accubook_framecode = ""; document.write(accubook_framecode); var iframe = document.getElementById('accuBookIFrame'); if (typeof _gaq == "object") { _gaq.push(function () { var pageTracker = _gat._getTrackerByName(); accuBookGAURL = pageTracker._getLinkerUrl(accubook_accubookURL); if (isMobile()) { window.location = accuBookGAURL; } else { iframe.src = accuBookGAURL; } }); } else { ga(addiFrame(accubook_accubookURL)); } } } else { var accubook_two_days_away = new Date().setDate(new Date().getDate() + 2); var accubook_four_days_away = new Date().setDate(new Date().getDate() + 4); var accubook_today = new Date().setDate(new Date().getDate()); var accubook_tomorrow = new Date().setDate(new Date().getDate() + 1); var accubook_qs_from = accubook_qs.get("fromdate", accubook_today); var accubook_qs_to = accubook_qs.get("todate", accubook_tomorrow); accubook_fromDate = dateFormat(new Date(accubook_qs_from), "dd") + "/" + dateFormat(new Date(accubook_qs_from), "mmm") + "/" + dateFormat(new Date(accubook_qs_from), "yyyy"); accubook_toDate = dateFormat(new Date(accubook_qs_to), "dd") + "/" + dateFormat(new Date(accubook_qs_to), "mmm") + "/" + dateFormat(new Date(accubook_qs_to), "yyyy"); var pcode = ""; if(accubook_qs.contains("pcode")){ pcode = "&pcode=" + accubook_qs.get("pcode"); } accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=room&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&fromdate=" + accubook_fromDate + "&todate=" + accubook_toDate + pcode; accubook_framecode = ""; document.write(accubook_framecode); var iframe = document.getElementById('accuBookIFrame'); if (typeof _gaq == "object") {//determines if old analytics _gaq.push(function () { var pageTracker = _gat._getTrackerByName(); accuBookGAURL = pageTracker._getLinkerUrl(accubook_accubookURL); if (isMobile()) { window.location = accuBookGAURL; } else { iframe.src = accuBookGAURL; } }); } else { ga(addiFrame(accubook_accubookURL)); } } } } function redirectToCheckout() { if (!isAccuBookSettingsOK()) { alert("Online Booking is not installed correctly. Please check your business name, site name and filename settings."); document.write('Online Booking is currently not available.'); } else { var accubook_accubookURL; var accubook_framecode; var accubook_fromDate; var accubook_toDate; var accubook_qs = new Querystring(); if (accubook_qs.contains("view")) { if (accubook_qs.get("view") == "packages") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packages&business_name=" + accubook_Business + "&site_name=" + accubook_Site; } else if (accubook_qs.contains("packageid")) { var packageid = accubook_qs.get("packageid"); accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packagedetails&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&Package_ID=" + packageid; } else if (accubook_qs.contains("Package_ID")) { var packageid = accubook_qs.get("Package_ID"); accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=packagedetails&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&Package_ID=" + packageid; } else if (accubook_qs.get("view") == "vouchers") { accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=vouchers&business_name=" + accubook_Business + "&site_name=" + accubook_Site; } document.write(""); } else { var accubook_two_days_away = new Date().setDate(new Date().getDate() + 2); var accubook_four_days_away = new Date().setDate(new Date().getDate() + 4); var accubook_today = new Date().setDate(new Date().getDate()); var accubook_tomorrow = new Date().setDate(new Date().getDate() + 1); var accubook_qs_from = accubook_qs.get("fromdate", accubook_today); var accubook_qs_to = accubook_qs.get("todate", accubook_tomorrow); accubook_fromDate = dateFormat(new Date(accubook_qs_from), "dd") + "/" + dateFormat(new Date(accubook_qs_from), "mmm") + "/" + dateFormat(new Date(accubook_qs_from), "yyyy"); accubook_toDate = dateFormat(new Date(accubook_qs_to), "dd") + "/" + dateFormat(new Date(accubook_qs_to), "mmm") + "/" + dateFormat(new Date(accubook_qs_to), "yyyy"); accubook_accubookURL = "https://reservations.accubook.net/Default.aspx?view=room&business_name=" + accubook_Business + "&site_name=" + accubook_Site + "&fromdate=" + accubook_fromDate + "&todate=" + accubook_toDate; accubook_framecode = ""; document.write(accubook_framecode); } } } function searchAccuBook(customName,showPromoCode) { customName = (typeof customName === "undefined") ? "" : customName; var accubook_searchFrom; var accubook_searchTo; accubook_searchFrom = new Date(document.getElementById(customName + 'DdCheckinMonth').value + document.getElementById(customName + 'DdCheckinDay').value); accubook_searchTo = new Date(document.getElementById(customName + 'DdCheckoutMonth').value + document.getElementById(customName + 'DdCheckOutDay').value); if (accubook_searchFrom > accubook_searchTo) { alert("The departure date should be after the arrival date."); } else { var today = new Date(); today.setHours(0); today.setMilliseconds(0); today.setMinutes(0); today.setSeconds(0); if (accubook_searchFrom < today || accubook_searchTo < today) { alert("The arrival date and departure date should not be before today's date."); } else { var accubook_splitter="?"; if(accubook_SearchPage.indexOf("?")>-1){ accubook_splitter="&"; } var pcode = ""; if(showPromoCode){ pcode = "&pcode=" + document.getElementById(customName + 'promoCode').value; } window.location.href = accubook_SearchPage + accubook_splitter + "fromdate=" + document.getElementById(customName + 'DdCheckinMonth').value + document.getElementById(customName + 'DdCheckinDay').value + "&todate=" + document.getElementById(customName + 'DdCheckoutMonth').value + document.getElementById(customName + 'DdCheckOutDay').value + pcode; } } } function isAccuBookSettingsOK() { if (typeof accubook_Business == 'undefined' || typeof accubook_Site == 'undefined' || typeof accubook_SearchPage == 'undefined') return false; else return true; }