/*****global variables*******/ var staticServerPath="https://www.opentable.co.uk"; var OTpInputMonth; var OTpInputDay; var OTpInputYear; var OTtoday = new Date(); OTtoday.setFullYear(2018, 6, 19); var OTjavaDate=OTtoday; var OTyear = OTtoday.getFullYear(); var OTjavaYear=OTyear; var OTmonth = OTtoday.getMonth(); var OTjavaMonth=OTtoday.getMonth(); var OTinputDateField; var OTinputDate; var OTdefaultDate; var OTvertical; var OTtInputMonth; var OTtInputDay; var OTtInputYear; var OTcalShim; var OTkCal; var OTkCalShim; var defaultDateString = 'dd/mm/yyyy'; var OTpkId = ""; var OTpkJsMOver = " "; var OTpkJsMOut = " "; var OTpkJsOnClick = " "; var OTactiveCal = ""; var OTfoo = true; //debugging var var OTjavaLimitYear = 2020; var OTRestName = ""; var OTCookiesChecked = true; var OTHoverClose = ""; document.write(""); document.write("
"); document.write('
'); document.write("

Book a Table

"); document.write("
"); document.write('
'); document.write("Party Size:"); document.write("
"); document.write('
'); document.write(" "); document.write("
"); document.write('
'); document.write("Date:"); document.write("
"); document.write('
'); document.write("
"); document.write("

dd/mm/yyyy

"); document.write("
"); document.write(" "); document.write("
"); document.write('
'); document.write("Time:"); document.write("
"); document.write('
'); document.write(" "); document.write("
"); document.write("
"); document.write("
"); document.write(""); document.write("
"); document.write("
"); document.write('
'); document.write('
'); document.write(""); document.write(""); document.write('
'); document.write("
"); document.close(); // Utilities functions function stopBubble(e) { if(e.stopPropagation) { e.stopPropagation(); } else { e.cancelBubble = true; } } function wrtPkDayDtls(pkLabel){ var tlabel = pkLabel.toString(); document.getElementById('pkDayDtls').innerHTML = tlabel; clickLayer('pkDayDtls', 2, -15); } function killAllCalendars() { OTkCal = OTactiveCal; OTkCalShim = OTactiveCal+"Shim"; setVisible(false,OTactiveCal, OTactiveCal+"Shim"); } function parseToDoubleDigit(number) { return (number < 10) ? '0' + number : number; } function parseToSingleDigit(number) { var str = '' + number; return str = str.replace(/^0+/g, ''); } function getAllDaysInMonth(month) { var days; var year = (month >= OTjavaMonth) ? OTjavaYear : OTjavaYear + 1; if (month==0 || month==2 || month==4 || month==6 || month==7 || month==9 || month==11) { days=31; } else if (month==3 || month==5 || month==8 || month==10) { days=30; } else if (month==1) { if (isThisLeapYear(year)) { days=29; } else { days=28; } } return (days); } function isThisLeapYear (Year) { if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) { return (true); } else { return (false); } } function parseDate(dateString){ /****utitility and subfunctions*******/ function trim(sString){ var re1 = /\s{2,10}/g; //precompile reg ex's for performance sString = sString.replace(re1, ' '); while(sString.substring(0,1) == ' '){ sString = sString.substring(1, sString.length); } while(sString.substring(sString.length-1, sString.length) == ' '){ sString = sString.substring(0,sString.length-1); } return sString; } /******/ function delimit(sString){ var thisString; var re1 = /,\s/g; var re2 = /([|]|[.]|[,]|[;]|[\s]|[\/])/g; //BUG: ugly, but mozilla has problems with some character class formations thisString = sString.replace(re1, ','); thisString = thisString.replace(re2, '|'); thisString = thisString.toLowerCase(); return thisString; } /*****/ function convertMonthAbbreviation(inputString) { var alphaMonth; var numericMonth; var numericString; var re1 = /^[a-zA-Z]*/; var re2 = /^[a-zA-Z]{3}/; var alphaMonthArray = new Array("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" ); if(inputString.length < 3) return; if(inputString.match(re1)){ alphaMonth = inputString.match(re2); for(i=0;i 12) { parseDate(OTdefaultDate); } OTtInputMonth = parseToSingleDigit(OTpInputMonth); OTtInputDay = parseToSingleDigit(OTpInputDay); OTtInputYear = ((OTpInputYear.length <= 2) ? '20' + OTpInputYear : OTpInputYear); OTmonth = OTtInputMonth - 1; OTtoday.setMonth(OTmonth); OTyear = OTtInputYear; OTtoday.setFullYear(OTyear); } function returnDate(inDay,cal) { var thisDay = inDay; var thisMonth = OTmonth + 1; var thisYear = OTyear; var thisYearString = '' + thisYear; if ((defaultDateString == "mm/dd/yyyy") || (defaultDateString == "mm/dd/yy")) { OTinputDateField.value = parseToDoubleDigit(thisMonth) + '/' + parseToDoubleDigit(thisDay) + '/' + (thisYear); } else if ((defaultDateString == "yyyy/mm/dd") || (defaultDateString == "yy/mm/dd")) { OTinputDateField.value = (thisYear) + '/' + parseToDoubleDigit(thisMonth) + '/' + parseToDoubleDigit(thisDay); } else if ((defaultDateString == "dd/mm/yyyy") || (defaultDateString == "dd/mm/yy")) { OTinputDateField.value = parseToDoubleDigit(thisDay) + '/' + parseToDoubleDigit(thisMonth) + '/' + (thisYear); } else if ((defaultDateString == "dd.mm.yyyy") || (defaultDateString == "dd.mm.yy")) { OTinputDateField.value = parseToDoubleDigit(thisDay) + '.' + parseToDoubleDigit(thisMonth) + '.' + (thisYear); } closeCalendar(cal, OTcalShim); } function writeCalendar(cal) { //alert(OTvertical); OTactiveCal = cal; OTcalShim = cal + "Shim"; blankColumn = " " tableOutput = "" var days = getAllDaysInMonth(OTmonth); var firstOfMonth = new Date (OTyear, OTmonth, 1); var startingPos = firstOfMonth.getDay() startingPos -= parseInt(1) if (startingPos < 0) { startingPos = 7+startingPos; } days += startingPos; // //alert(startingPos + ":" + days); var columnCount = 0; for (i = 0; i < startingPos; i++) { tableOutput += blankColumn; columnCount++; } var currentDay = 0; for (i = startingPos; i < days; i++) { currentDay = i-startingPos+1; var pStyle = " "; var pStyleCode = " "; var sltdDt = " "; var sltdDtA= " "; var pkMonth = parseToDoubleDigit(OTmonth + 1); //modify date segments for peak date id's var pkCurrentDay; pkCurrentDay = parseToDoubleDigit(currentDay); OTyear = "" + OTyear; //javascript internal bug; force type to year pkYear = OTyear.substring(2,4); var pkId = " "; pkId = "pk" + pkMonth + pkCurrentDay + pkYear; OTpkJsMOver = " "; OTpkJsMOut = " "; OTpkJsOnClick = " "; OTpkId = pkId; if(OTvertical == "flights"){ // Render peak days for AIR only // Private function to pop peak day bubble function checkPkDays(pkId){ var label = " "; var showLabel for (var i in peakDays){ label = peakDays[i]; if(pkId == i){ OTpkJsMOver = " onmouseover='wrtPkDayDtls(\"" + label + "\");' "; OTpkJsMOut = " onmouseout='javascript:hideLayer(\"pkDayDtls\");' "; OTpkJsOnClick = " onclick='javascript:hideLayer(\"pkDayDtls\");' " pStyleCode = " pkD " } } } checkPkDays(pkId); } if(OTmonth + 1 == OTtInputMonth && (currentDay == OTtInputDay)) { sltdDt = "style=\"border:1px solid #9CADBD; background-color:#FFEF9C;\"" sltdDtA="style=\"background-color:#FFEF9C;\"" } var verticalDate = OTjavaDate; var nonClickableDayString = ""; var clickableDayString = "" //alert (nonClickableDayString); //alert(clickableDayString); //For Past Purchase vertical we have to show the previous/past date, the below check is done for that. if(OTvertical != 'pastpurchase') { //alert("javamonth = " + OTjavaMonth + " OTjavaYear :" + OTjavaYear + " current day : " + currentDay + " vertical date: " + verticalDate); if (OTmonth <= OTjavaMonth && OTyear == OTjavaYear) { if (OTmonth == OTjavaMonth && currentDay >= verticalDate.getDate()) { tableOutput += clickableDayString; } else { tableOutput += nonClickableDayString; } } else if (OTyear >= OTjavaLimitYear) { if ((OTmonth > javaLimitMonth) || (OTmonth == javaLimitMonth && currentDay >= javaLimitDate) || (OTyear > OTjavaLimitYear)){ tableOutput += nonClickableDayString; } else { tableOutput += clickableDayString; } } else if (OTyear < OTjavaYear) { tableOutput += nonClickableDayString; } else { tableOutput += clickableDayString; } } else { tableOutput += clickableDayString; } columnCount++; if (columnCount % 7 == 0) { tableOutput += ""; } } for (i=days; i<42; i++) { tableOutput += blankColumn; columnCount++; if (columnCount % 7 == 0) { tableOutput += ""; if (i<41) { tableOutput += ""; } } } var leftarrow; var rightarrow; if(OTvertical == 'pastpurchase') { //Show left arrow of the calendar as the customer can go and check any past dates for past purchase vertical leftarrow="" } else { if(OTmonth==OTjavaMonth && OTyear==OTjavaYear) leftarrow="" else leftarrow="" } //Show right arrow of the calendar as the customer can go and check any future dates for past purchase vertical if(OTvertical == 'pastpurchase') { rightarrow="" } else { if((OTmonth==OTjavaMonth-1) && (OTyear==OTjavaYear+1)) rightarrow="" else rightarrow="" } tableOutput += "
" + "M" + "" + "T" + "" + "W" + "" + "T" + "" + "F" + "" + "S" + "" + "S" + "
" + currentDay + "" + currentDay + "
"; //alert(tableOutput) monthOutput = "
" + leftarrow + "" + returnMonth(OTmonth,OTyear) + "" + rightarrow + "
"; disclaimer = "
"; tableOutput = (monthOutput + tableOutput) + disclaimer; document.getElementById(cal).innerHTML=tableOutput; setVisible(true,cal,OTcalShim); } // any click outside of the calendar will hide all calendars function exteriorCloseCal(e) { var myObj = new Object; if( !e ) { if( window.event ) { e = window.event; } else { return; } } if (document.all) { myObj = e.srcElement; } else { myObj = e.target; } // we close all calendars on every click on the document, UNLESS that click is: // 1) on a calendar, noted by a match to class name partOfCal or 2) is on a named input field (which call the calendar) // all objects in calendar must be part of class partOfCal if (myObj.className.indexOf("partOfCal") == -1 && myObj.name != 'startDate' && myObj.name != 'endDate' && myObj.name != 'travelStartDate') { killAllCalendars(); } } document.onclick=exteriorCloseCal; function CheckIfCookieSet() { //Then we check the if the cookie set in that domain can be retrieved //in that domain var cookieIframeGetUrl = staticServerPath + "/ism/CookieCheck.aspx?act=get&url=" + escape(window.location.href); jQuery("body").append(""); } function beginCookieCheck() { //Add iframe to check for 3rd party cookies enable. //We first set the cookie in the 3rd party domain var cookieIframeSetUrl = staticServerPath + "/ism/CookieCheck.aspx?act=set&url=" + escape(window.location.href); jQuery("body").append(""); } function HoverSearch() { if (!OTCookiesChecked) { var sAction = document.ism.action; if (sAction.indexOf('?') > 1) sAction = sAction + "&rnd=1"; else sAction = sAction + "?rnd=1"; document.ism.action = sAction; return false; } var sSearchParams = ""; if (document.ism.startDate != null) sSearchParams = addQSParameter(sSearchParams, "StartDate", document.ism.startDate.value); if (document.ism.ResTime != null) sSearchParams = addQSParameter(sSearchParams, "ResTime", document.ism.ResTime.value); if (document.ism.txtDateFormat != null) sSearchParams = addQSParameter(sSearchParams, "txtDateFormat", document.ism.txtDateFormat.value); if (document.ism.RestaurantID != null) sSearchParams = addQSParameter(sSearchParams, "RestaurantID", document.ism.RestaurantID.value); if (document.ism.SearchType != null) sSearchParams = addQSParameter(sSearchParams, "SearchType", document.ism.SearchType.value); if (document.ism.GeoID != null) sSearchParams = addQSParameter(sSearchParams, "GeoID", document.ism.GeoID.value); if (document.ism.Region != null) sSearchParams = addQSParameter(sSearchParams, "Region", document.ism.Region.value); if (document.ism.ref != null) sSearchParams = addQSParameter(sSearchParams, "ref", document.ism.ref.value); if (document.ism.PartySize != null) sSearchParams = addQSParameter(sSearchParams, "PartySize", document.ism.PartySize.value); if (document.ism.PromoID != null) sSearchParams = addQSParameter(sSearchParams, "PromoID", document.ism.PromoID.value); if (document.ism.LunchRestaurantID != null) sSearchParams = addQSParameter(sSearchParams, "LunchRestaurantID", document.ism.LunchRestaurantID.value); if (document.ism.DinnerRestaurantID != null) sSearchParams = addQSParameter(sSearchParams, "DinnerRestaurantID", document.ism.DinnerRestaurantID.value); sSearchParams = addQSParameter(sSearchParams, "hover", "true"); sSearchParams = addQSParameter(sSearchParams, "wt", "true"); sSearchParams = addQSParameter(sSearchParams, "KeepThis", "true"); sSearchParams = addQSParameter(sSearchParams, "TB_iframe", "true"); sSearchParams = addQSParameter(sSearchParams, "width", "870"); sSearchParams = addQSParameter(sSearchParams, "height", "700"); tb_show("", "", staticServerPath + "/ism/interim.aspx" + sSearchParams); return true; } function addQSParameter(sQS, sParam, sValue) { if (sQS == null || sQS == "") return "?" + sParam + "=" + sValue; else return sQS + "&" + sParam + "=" + sValue; } window.OTDataLayer = [{"page_name":null,"metro_id":"0","domain":"70","language":"en-gb","ref_id":"-1","restref_id":null,"billing_type_visual":"network","visitor_status":"Logged Out","user_type":"anonymous"}];(function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l !== 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'OTDataLayer', 'GTM-MJTRF6F');