/** * printMap PDF function fix. * This was missing from some specific directory based pages. * I've moved this here as the common function. */ function printMapPDF(geoH, geoV) { var windowHeight = screen.height - 50; var gmaxh = geoH + 542; var gminh = geoH - 542; var gmaxv = geoV - 688; var gminv = geoV + 688; openWindow('http://pdf.londontown.com/hotelmapbeta/PHP/mapPrint.php?gmaxh='+gmaxh+'&gmaxv='+gmaxv+'&gminh='+gminh+'&gminv='+gminv+'&magdaindex=false&displayHotels=false&useIndex=false&pageType=PORTRAIT&geoh='+geoH+'&geov='+geoV+'&zoom=5&callcentreId=0&rKey=0.2496131694092839&marker[]='+geoH+','+geoV,'popup','scrollbars=yes,width=587,height=' + windowHeight); } var SubNavOptions = { checkMousePosition : function(evt, button) { evt = (evt) ? evt : window.event; var subnavTop = 0; var mousePos = this.actualPosition(evt); var oldWrapper = document.getElementById('topsubnavwrapper'); var wrapper = document.getElementById('topsubnavwrapper'); if(wrapper.offsetParent) { do { subnavTop += wrapper.offsetTop } while(wrapper = wrapper.offsetParent); } if(mousePos[1] < subnavTop) oldWrapper.style.display = 'none'; }, actualPosition : function(evt) { evt = (evt) ? evt : window.event; var pos = Array(); pos[0] = 0; pos[1] = 0; if(evt.pageX || evt.pageY) { pos[0] = evt.pageX; pos[1] = evt.pageY; } else if(evt.clientX || evt.clientY) { pos[0] = (evt.clientX + document.body.scrollLeft + document.documentElement.scrollLeft); pos[1] = (evt.clientY + document.body.scrollTop + document.documentElement.scrollTop); } return pos; }, disableFade : typeof(navigator) != "undefined" && navigator.appVersion.indexOf("Mac") >= 0 && navigator.userAgent.indexOf("Firefox/2") >= 0, showSubnav : function(evt){ evt = (evt) ? evt : window.event; var showNav = true; if(document.getElementById('large') && document.getElementById('large').style.top > 0) { showNav = false; } var wrapper = document.getElementById('topsubnavwrapper'); if(document.all) wrapper.style.height = '260px'; if(document.body.clientWidth) { var leftPos = Math.floor(document.body.clientWidth / 2) - 464; } else if(window.innerWidth) { var leftPos = Math.floor(window.innerWidth / 2) - 464; } wrapper.style.left = leftPos + "px"; if(wrapper.style.display == 'none' && showNav) wrapper.style.display = 'block'; }, hideSubnav : function(wrapper, evt) { evt = (evt) ? evt : window.event; var subNavTop = 0; var subNavLeft = 0; var subNavWidth = 594; var subNavHeight = 240; var mousePosition = this.actualPosition(evt); var originalWrapper = wrapper; if(wrapper.offsetParent) { do { subNavTop += wrapper.offsetTop; subNavLeft += wrapper.offsetLeft; } while(wrapper = wrapper.offsetParent); } else { subNavTop += wrapper.x; subNavLeft += wrapper.y; } if(mousePosition[0] < subNavLeft) originalWrapper.style.display = 'none'; if(mousePosition[0] > (subNavLeft + subNavWidth)) originalWrapper.style.display = 'none'; if(mousePosition[1] > (subNavTop + subNavHeight)) originalWrapper.style.display = 'none'; if(mousePosition[1] < subNavTop) originalWrapper.style.display = 'none'; } } var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i= 24) { hr -= 24; day++; dayIndex++; } if (hr < 0) { hr += 24; day--; dayIndex--; } if (hr < 10) hr = " " + hr; if (min < 10) min = "0" + min; if (sec < 10) sec = "0" + sec; if (day <= 0) { if (month == 0) { month = 11; year--; } else { month--; } day = monthDays[month]; } if (day > monthDays[month]) { day = 1; if (month == 11) { month = 0; year++; } else { month++; } } var startDST = new Date(); var endDST = new Date(); startDST.setMonth(2); startDST.setHours(1); startDST.setDate(31); var dayDST = startDST.getDay(); startDST.setDate(31-dayDST); endDST.setMonth(9); endDST.setHours(0); endDST.setDate(31); dayDST = endDST.getDay(); endDST.setDate(31-dayDST); var currentTime = new Date(); currentTime.setMonth(month); currentTime.setYear(year); currentTime.setDate(day); currentTime.setHours(hr); if(currentTime >= startDST && currentTime < endDST) { dst = 1; } if (dst == 1) { hr++; if (hr >= 24) { hr -= 24; day++; dayIndex++; } if (hr < 10) { hr = " " + hr; } if (day > monthDays[month]) { day = 1; if (month == 11) { month = 0; year++; } else { month++; } } } var daySuffix; switch (day) { case 1: case 21: case 31: daySuffix = "st"; break; case 2: case 22: daySuffix = "nd"; break; case 3: case 23: daySuffix = "rd"; break; default: daySuffix = "th"; break; } var greeting; if (hr < 12) { greeting = "Good Morning "; } else if (hr < 18) { greeting = "Good Afternoon "; } else { greeting = "Good Evening "; } var ampm = "am"; // 12 hour clock if (hr >= 12) { ampm = "pm"; } if (hr > 12) { hr -= 12; } var dateString = allDays[dayIndex] + " " + day + daySuffix + " " + monthArray[month]; var timeString = hr + ":" + min + " " + ampm; document.getElementById('textualwelcome').innerHTML = greeting; document.getElementById('textualdate').innerHTML = timeString; document.getElementById('textualtime').innerHTML = dateString; // Finally, check we're showing the correct banner image var headImage = document.getElementById('headerBar'); if (headImage) { if (getCallCentreStatus() == "off") { // Should be off, do we have the correct image? if (headImage.src.search(/_off/) == -1) { // Nope, so set it headImage.src = "http://images.londontown.com/LTtemplates/new_site_design/images/londontown_header_off.jpg"; //headImage.src = "https://secure.londontown.com/LTtemplates/new_site_design/images/londontown_header_xmas.jpg"; } } else { // Should be on, do we have the correct image? if (headImage.src.search(/_off/) != -1) { // Nope, so set it headImage.src = "http://LTtemplates/new_site_design/images/londontown_header.jpg"; //headImage.src = "https://secure.londontown.com/LTtemplates/new_site_design/images/londontown_header_xmas.jpg"; } } } } function getCallCentreStatus() { var status = "off"; var today = new Date(); // This is client side, so convert to english time var gmt = new Date(); gmt.setTime(gmt.getTime() - (window.timeOffset * 3600000)); var dayOfMonth = today.getDate(); var month = today.getMonth() + 1; var dayOfWeek = today.getDay(); var hour = today.getHours(); if (month == 1 && dayOfMonth == 1) { // New year status = "off"; } else if(month == 12 && (dayOfMonth == 25 || dayOfMonth == 26)) { // Christmas day and boxing day status = "off"; } else if(dayOfWeek == 0 || dayOfWeek == 6) { // A weekend, open 10am to 8pm if(hour >= 10 && hour < 20) { status = "on"; } } else { // A weekday, open 8am to 10pm if(hour >= 8 && hour < 22) { status = "on"; } } return status; } function recentlyViewedPopup(ref, content, width, e) { e = (e ? e : window.event); var y = e.clientY + document.body.scrollTop; ref.interval = null; if (!ref.notice || ref.notice == null) { var y = e.clientY + document.body.scrollTop; var outerBox = document.createElement("div"); outerBox.className = 'recentlyViewedPopup'; outerBox.style.width = width; // Make sure the div is not under the mouse pointer or the onmouseout event will keep firing outerBox.style.left = e.clientX - 122; if (parseInt(outerBox.style.left) < 0) { outerBox.style.left = 0; } outerBox.style.top = y + 2; var innerBox = document.createElement("div"); innerBox.className = 'recentlyViewedBoxInternal'; var contentDiv = document.createElement("div"); contentDiv.className = 'recentlyViewedText'; contentDiv.innerHTML = content; innerBox.appendChild(contentDiv); outerBox.appendChild(innerBox); ref.notice = outerBox; document.body.appendChild(outerBox); } } function hideRecentlyViewedPopup(ref, e) { e = (e ? e : window.event); var r = ref; ref.interval = setTimeout( function() { try { r.notice.parentNode.removeChild(r.notice); r.notice=null; } catch ( e ) {} },200); } if(document.URL == 'http://dev2/' || document.URL == 'http://dev2' || document.URL == 'http://www.londontown.com' || document.URL == 'http://www.londontown.com/') { document.write(""); } var SendRightFeedback = { sendDetails : function(){ var usermail = document.getElementById('usermail').value; var username = document.getElementById('username').value; var message = document.getElementById('message').value; var url = "/LTtemplates/new_site_design/php/FeedBack.php?usermail=" + usermail + "&username=" + username + "&message=" + escape(message); this.Ajax(url); }, __handler : null, // Handler for ajax Ajax : function( URL, POST, postAjaxFunction ) { if ( typeof postAjaxFunction == 'undefined' || postAjaxFunction == '' ) { postAjaxFunction = 'postAjax(response)'; } try { if ( SendRightFeedback.__handler ) SendRightFeedback.__handler.abort() ; SendRightFeedback.__handler = ( window.XMLHttpRequest ) ? new XMLHttpRequest() : ( window.ActiveXObject ) ? new ActiveXObject("Microsoft.XMLHTTP") : null ; if ( SendRightFeedback.__handler ) { SendRightFeedback.__handler.onreadystatechange = function() { SendRightFeedback.ParseJax( SendRightFeedback.__handler, postAjaxFunction ) ; } if ( POST != '' && POST !=null && POST != "undefined" ) { SendRightFeedback.__handler.open("POST", URL, true); SendRightFeedback.__handler.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); SendRightFeedback.__handler.setRequestHeader("Content-length", POST.length); SendRightFeedback.__handler.setRequestHeader("Connection", "close"); SendRightFeedback.__handler.send(POST); } else { SendRightFeedback.__handler.open("GET", URL, true); SendRightFeedback.__handler.send(null); } } } catch (ee ){} }, ParseJax : function( handler, postAjaxFunction ) { try { if ( handler ) { if ( handler.readyState == 4 && handler.status == 200 ) { if ( handler.responseText != '' ) { eval(handler.responseText); } } } } catch (ee ){} } } function logHotelBookingAttempt(clickedBookTmp, errMessTmp) { // Don't log call centre bookings if (document.getElementById('userMode').value == 'customerService') { return; } var street2Input = document.getElementById('address2'); var street2 = (street2Input ? street2Input.value : ""); var email = document.getElementById('email').value; var clickedBook = 'N'; if (typeof clickedBookTmp != 'undefined') { clickedBook = clickedBookTmp; } var errMess = ''; if (typeof errMessTmp != 'undefined') { errMess = errMessTmp; } if (email && email.search("@") != -1) { var referer = document.getElementById('referer').value; var sourceDomain = "londontown"; if (referer.match(/hotelmap\.com/i)) { sourceDomain = "hotelmap"; } var qstring = "cookie=" + document.getElementById('searchID').value + "&firstName=" + document.getElementById('firstName').value + "&lastName=" + document.getElementById('lastName').value + "&street1=" + document.getElementById('address1').value + "&street2=" + street2 + "&city=" + document.getElementById('city').value + "&postCode=" + document.getElementById('postCode').value + "&state=" + document.getElementById('state').value + "&country=" + document.getElementById('country').value + "&phone=" + document.getElementById('phone').value + "&email=" + email + "&skin=" + document.getElementById('templateSkin').value + "&hotelBase=" + document.getElementById('hotelBase').value + "&value=" + document.getElementById('totalCost').value + "&clickedBook=" + clickedBook + "&arrDate=" + document.getElementById('arrDate').value + "&clickTrack=" + document.getElementById('clickTrackID').value + "&errMess=" + errMess + "&sourceDomain=" + sourceDomain; ajaxCall("/LTtemplates/php/hotelScripts/logBooking.php?" + qstring); } } function ajaxCall(url, qstring, responseHandler) { try { var requester = null; if (window.XMLHttpRequest) { requester = new XMLHttpRequest(); } else if (window.ActiveXObject) { requester = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser is not supported"); } if (requester) { // When the request comes through requester.onreadystatechange = function() { try { if (requester.readyState == 4 && requester.status == 200) { var response = requester.responseXML; if (response) { try { if (responseHandler) { responseHandler(response); } } catch (closeException) { //alert("Error in ajax handler: " + closeException); } } } } catch (exception) { //alert("Error in ajax response: " + exception); } }; if (qstring) { requester.open("POST", url, true); requester.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); requester.setRequestHeader("Content-length", qstring.length); requester.setRequestHeader("Connection", "close"); requester.send(qstring); } else { requester.open("GET", url, true); requester.send(null); } } } catch (outerAjaxException) { //alert("Error, please try again: " + outerAjaxException.message); } } function isEmpty(val) { if (val.match(/^\s+$/) || val == "") { return true; } else { return false; } } function trim(str) { return str.replace(/^\s*/, "").replace(/\s*$/, ""); } function getDimensions() { var viewportwidth; var viewportheight; if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } return new Array(viewportwidth,viewportheight); } function roundVal(value, decPlaces) { var rounded = new String(Math.round(value * Math.pow(10, decPlaces)) / Math.pow(10, decPlaces)); // Make sure we display both decimal places if (rounded.search(/\./) == (rounded.length - 2)) { rounded += '0'; } return rounded; } function isValidEmail(emailAddr) { return (emailAddr.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/) == null ? false : true); }