var seType = "Default" // search box specific type var defCountry = "France" // default Country var defCity = "Paris" // default City var showSub = true var langCode = "EN" var affID = 4556 // affiliate ID var tid = 0 // template ID var isB2B = true // is b2b var disabled = 1 var tabBitMask = 111 var arrMonth = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') var monthArray = arrMonth var dateMask = 'd|m|y|-' var wkdArray = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat') var arrShortDay = new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa') //to include this library the following variables should be initialized: //affID, langCode, seType //must also include the following in includer: //MonthTranslation.inc, DayTranslation.inc var lastCity = -1 //index of last selected city //initialise search engine function initSearchEng() { frm = document.searchEng datesFrm = frm if (typeof(isB2B) != "undefined") { frmAction = new String(frm.action) if (isB2B) { rExp = /http:\/\/www/gi; frm.action = frmAction.replace(rExp, "http://b2b") } else { rExp = /http:\/\/b2b/gi; frm.action = frmAction.replace(rExp, "http://www") } } //initialise travel dates populateDates() if (!objCookie.inDate) { var setdatein = new Date(curYear, curMonth, curDay) var setdateout = new Date(curYear, curMonth, curDay+1) setVal(datesFrm.inDate, formatDateVal(setdatein)) setVal(datesFrm.outDate, formatDateVal(setdateout)) setWkd() } langRow = false if (typeof(langCode) == "undefined") langCode = "EN" if (typeof(frm.lc) != "undefined") frm.lc.value = langCode frm.affid.value = affID if (typeof(tid) != "undefined") frm.tid.value = tid sourceVal = "" targetCtl = "" arrLoading = new Array("", 'loading...') //"loading... " arrData = new Array() arrData["country"] = new Array() arrData["city"] = new Array() arrData["suburb"] = new Array() //set default locations if (typeof(defCountry) == "undefined") defCountry = "" if (typeof(defCity) == "undefined") defCity = "" if (typeof(defSuburb) == "undefined") defSuburb = "" objRS.langCode = langCode // populate country and city spans with translated values if ((seType == 'Country') || (seType == 'City')) { //initially fill with english values while loading if (document.all) document.all("sc_c1").innerHTML = defCountry else if (document.getElementById) document.getElementById("sc_c1").innerHTML = defCountry frm.country.value = defCountry if (langCode != 'EN') getLangRow("AffSearchEngineGetCountryLang", defCountry) if (seType == 'City') { if (document.all) document.all("sc_h1").innerHTML = defCity else if (document.getElementById) document.getElementById("sc_h1").innerHTML = defCity frm.city.value = defCity if (langCode != 'EN') getLangRow("AffSearchEngineGetCityLang", defCity) } } fillCountryCitySuburb() } //fill the spans with default country and city translated values function fillSpan(type) { if (type == 'Country') id = "sc_c1" else if (type == 'City') id = "sc_h1" if (document.all) document.all(id).innerHTML = arrData[type] else if (document.getElementById) document.getElementById(id).innerHTML = arrData[type] } //fill country, city and suburb select boxes where appropriate function fillCountryCitySuburb() { //wait untill remote script object isnt busy if (objRS.busy) { setTimeout("fillCountryCitySuburb()", 100) return } if (seType == 'Default') countryFill() else if (seType == 'Country') countryChange("") else if (seType == 'City') cityChange(frm.suburb) } //set select box text function setText(ctl, newText) { for (var i=0; i 0 && bookPeriod < 11 && ctl.name == "outDate") { bookPeriod = bookPeriod + bookPeriod } else if (bookPeriod > 10 && bookPeriod < 21 && ctl.name == "outDate") { bookPeriod = 21 } if (CheckOutPeriod > 0 && CheckOutPeriod < 21 && ctl.name == "outDate") { bookPeriod = CheckOutPeriod; } //populate select box for (var i=0; i<=bookPeriod; i++) { ctl[i] = new Option(formatDateText(optDate), formatDateVal(optDate)) optDate.setDate(optDate.getDate() + 1) } ctl[0].selected = true ctl.selectedIndex = 0 } //format date as specified in the dateMask (if provided) or put 'dd-mmm-yyyy' as default function formatDateText(date) { var dateVal dateVal = date.getDate() if (dateVal < 10) dateVal = "0" + dateVal var arrMask = dateMask.split("|") var sTmpDate = dateMask.replace(/y/, date.getFullYear()) sTmpDate = sTmpDate.replace(/m/, monthArray[date.getMonth()]) sTmpDate = sTmpDate.replace(/d/, dateVal) sTmpDate = sTmpDate.replace(/\|/g, arrMask[3]) if (arrMask[3] != "") sTmpDate = sTmpDate.substring(0, sTmpDate.length - 2) return sTmpDate } //format date as yyyy-mm-dd function formatDateVal(date) { return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() } //set select box value function setVal(ctl, newVal) { for (var i=0; i= out date function resetInDate() { if (datesFrm.inDate.selectedIndex > datesFrm.outDate.selectedIndex) datesFrm.inDate.selectedIndex = datesFrm.outDate.selectedIndex DateChangeExtras() } //extra work that needs to be done when a date is changed function DateChangeExtras() { //set weekdays and length of stay setWkd() } //cookie values object constructor function cookieVal(country, city, suburb, inDate, outDate) { this.country = country this.city = city this.suburb = suburb this.inDate = inDate this.outDate = outDate } //save selected dates and location to cookie function setSelCookie(country, city, suburb, inDate, outDate) { document.cookie = escape("|SearchEng|") + "=" + escape("|" + country + "|" + city + "|" + suburb + "|" + inDate + "|" + outDate + "|") + ";path=/" } //reload page with new in/out dates function changeDates() { //to check 25 nights of booking. var arrinDate = getVal(datesFrm.inDate).split("-") var arroutDate = getVal(datesFrm.outDate).split("-") var checkin = new Date(arrinDate[0], arrinDate[1] - 1, arrinDate[2]) var checkout = new Date(arroutDate[0], arroutDate[1] - 1, arroutDate[2]) if (Math.round((checkout - checkin) / 86400000) > 25) { if (typeof (StayTooLong_Msg) == "undefined") StayTooLong_Msg = "Your period of stay should be not longer than 25 nights.\n\nIf you wish to book for more than 25 nights, please send us an e-mail with your request." alert(StayTooLong_Msg) datesFrm.outDate.focus() return } //save new dates to the cookie setSelCookie(objCookie.country, objCookie.city, objCookie.suburb, getVal(datesFrm.inDate), getVal(datesFrm.outDate)) //get new querystring var qString = location.search.substr(1) qString = setQStringName(qString, "inDate", new Array(getVal(datesFrm.inDate))) qString = setQStringName(qString, "outDate", new Array(getVal(datesFrm.outDate))) //do some extra work if dates are changed on the search results page if (datesFrm.ShowAll) { //set page to 1 qString = setQStringName(qString, "page", new Array("1")) //set currencly selected search option for (var i = 0; 1 < datesFrm.ShowAll.length; i++) { if (datesFrm.ShowAll[i].checked) { var showAll = datesFrm.ShowAll[i].value break } } qString = setQStringName(qString, "ShowAll", new Array(showAll)) } location = location.pathname + "?" + qString } //replace or add a name/value pairs in url-encoded querystring function setQStringName(qString, name, arrVal) { var i var qStringNew = "" if (qString != "") { var curName var arrNameVal = qString.split("&") for (i in arrNameVal) { curName = arrNameVal[i].split("=")[0] curName = URLDecode(curName) if (curName.toLowerCase() != name.toLowerCase()) qStringNew += "&" + arrNameVal[i] } } for (i in arrVal) { qStringNew += "&" + escape(name) + "=" + escape(arrVal[i]) } return qStringNew.substr(1) } //extract value from querystring for the passed name function GetQSVal(qsName) { var qsPair var qsVal = "" var qString = location.search.substr(1) var arrNameVal = qString.split("&") for (var i in arrNameVal) { qsPair = arrNameVal[i].split("=") if (URLDecode(qsPair[0]) == qsName) { qsVal = URLDecode(qsPair[1]) break } } return qsVal } //unencode url-encoded string function URLDecode(urlStr) { return unescape(urlStr.replace(/\+/g, " ")) } //info button redirection function Info(htlID) { location = "/Hotel.asp?HotelID=" + htlID + "&inDate=" + GetQSVal("inDate") + "&outDate=" + GetQSVal("outDate") } //book button redirection function Book(rtID) { location = "/Selections.asp?RoomTypeID=" + rtID + "&inDate=" + GetQSVal("inDate") + "&outDate=" + GetQSVal("outDate") } //reload search results page with the new querystring name-value pair function Reload(name, val) { var qString = location.search.substr(1) qString = setQStringName(qString, "page", new Array("1")) //always resert page to 1 qString = setQStringName(qString, name, new Array(val.toString())) location = location.pathname + "?" + qString } //remote scripting object constructor function remScript(url, callBack, containerName, objName) { if (typeof(containerName) == "undefined") containerName = "rs" if (typeof(objName) == "undefined") objName = "objRS" this.containerName = containerName this.objName = objName this.url = url this.callBack = callBack this.busy = false this.createContainer = createContainer this.getData = getData } //create container for remote data function createContainer(blankSrc) { if (typeof(blankSrc) == "undefined") { if (typeof(affID) == "undefined") blankSrc = "/blank.htm" else blankSrc = "about:blank" } if (document.layers) document.write("") else document.write("") } //load container with remote data function getData(func, args) { var d = new Date() var params = "f=" + escape(func) + "&o=" + escape(this.objName) + "&u=" + d.getTime() for (var i=0; i "9" || number.charAt(i) < "0") return true } return false } //adds digit grouping to the number function formatNumber(number) { if (number.toString() == "") { if (typeof (Common_Scripts_FuncLib_OnRequest) == "undefined") Common_Scripts_FuncLib_OnRequest = "On Request" return Common_Scripts_FuncLib_OnRequest } if (number < 0) { var sign = "-" number = -number } else{ var sign = "" } number = number.toString() var tmpNumber = "" var dot = false for (var j=0; j=i; j--) { if (stringToTrim.charAt(j) != " ") break } return stringToTrim.substring(i, j + 1) } //validate email address function notEmail(field, fieldName, msg) { var email = trim(field.value) if (email == "") return false var at = false var dot = false for (var i=0; i 5)) { if (msg == null) msg = "The " + fieldName + " you entered is not a valid e-mail address." alert(msg) field.focus() field.select() return true } //check for invalid characters if (invalidChars(field, "E-mail", '%,;|" <>\\/')) return true return false } //validate ASCII Character Set function charCheck(field, message, toASCIIfield) { if (toASCIIfield == null) var txt = field.value else var txt = ToASCII(field) for (var i=0; i= 128) { alert(message) field.focus() return true } } return false } //checks whether selected option has invalid value and selects option with gotoIndex function checkInvalVal(sel, invalVal, gotoIndex) { if (GetSelVal(sel) == invalVal) sel.selectedIndex = gotoIndex } //date validation function validDate(date, ctlDay) { return date.getDate() == GetSelVal(ctlDay) } //set select box value function SetSelVal(ctl, newVal) { for (var i=0; i maxLen) { if (msg == null) msg = "Please limit " + ctlName + " to " + maxLen + " characters. You have used " + ctlLen + " characters." msg = msg.replace(/\[MaxCharactersAllowed\]/, maxLen) msg = msg.replace(/\[NumOfCharacters\]/, ctlLen) alert(msg) ctl.focus() return true } return false } //open new window function openWnd(url, name, height, width, directories, location, menubar, resizable, scrollbars, status, toolbar) { wnd = window.open(url, name, "alwaysRaised=1,height=" + height + ",width=" + width + ",directories=" + directories + ",locaton=" + location + ",menubar=" + menubar + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",status=" + status + ",toolbar=" + toolbar) wnd.focus() } //Web-1146 function openWndRTG(url, name, height, width,directories, location, menubar, resizable, scrollbars, status, toolbar) { var left = 250 var top = 250 wnd = window.open(url, name, "alwaysRaised=1,height=" + height + ",width=" + width + " ,left=" + left + ",top=" + top + " ,directories=" + directories + ",locaton=" + location + ",menubar=" + menubar + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",status=" + status + ",toolbar=" + toolbar) wnd.focus() } //unencode url-encoded string function URLDecode(urlStr) { return unescape(urlStr.replace(/\+/g, " ")) } //remove all name/value pairs with the passed name from url-encoded querystring function remQStringName(qString, name) { var i var qStringNew = "" if (qString != "") { var curName var arrNameVal = qString.split("&") for (i in arrNameVal) { curName = URLDecode(arrNameVal[i].split("=")[0]) if (curName.toLowerCase() != name.toLowerCase()) qStringNew += "&" + arrNameVal[i] } } return qStringNew.substr(1) } //replace or add name/value pairs in url-encoded querystring function setQStringName(qString, name, arrVal) { var qStringNew = remQStringName(qString, name) var start = qStringNew == "" ? 1 : 0 for (var i in arrVal) qStringNew += "&" + escape(name) + "=" + escape(arrVal[i]) return qStringNew.substr(start) } //extract (first!) value from querystring for the passed name function GetQSVal(qsName) { var qsPair var qString = location.search.substr(1) var arrNameVal = qString.split("&") for (var i in arrNameVal) { qsPair = arrNameVal[i].split("=") if (URLDecode(qsPair[0]).toLowerCase() == qsName.toLowerCase()) return URLDecode(qsPair[1]) } return "" } //convert character to ASCII function ToASCII(field){ var txt = field.value for (var i = 0; i'+ ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
Last Minute Hotel Search
Check in:'+ ''+ 'Length of stay:
night(s)'+ '
Check out:'+ '
Country:'+ ''+ 'Star rating:
'+ '
'+ '
'+ ' and below'+ ''+ '
City:'+ ''+ '
Suburb:'+ ''+ '

'+ 'Search for:'+ '
'+ ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ '
'+ '
'+ '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ ' Search by Destination '+ ''+ ' Search by Name '+ ''+ ' 
'+ '
'+ '
'; document.write(varSEHTML); //initialise remote scripting objRS = new remScript("RemScript.htm", rsCallBack) objRS.createContainer() window.onload = initSearchEng