//screen size info var screenW = 640, screenH = 480; if (parseInt(navigator.appVersion)>3) { screenW = screen.width; screenH = screen.height; } else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled() ) { var jToolkit = java.awt.Toolkit.getDefaultToolkit(); var jScreenSize = jToolkit.getScreenSize(); screenW = jScreenSize.width; screenH = jScreenSize.height; } //DATEPICKER DATE INITIALISER AND HANDLER function isBrowserSupp() { // Get the version of the browser version = parseFloat( navigator.appVersion ); if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) { return false; } else { return true; } return true; } function isLeapYear( yrStr ) { var leapYear = false; var year = parseInt( yrStr, 10 ); // every fourth year is a leap year if ( year % 4 == 0 ) { leapYear = true; // unless it's a multiple of 100 if( year % 100 == 0 ) { leapYear = false; // unless it's a multiple of 400 if( year % 400 == 0 ) { leapYear=true; } } } return leapYear; } function getDaysInMonth( mthIdx, YrStr ) { // all the rest have 31 var maxDays = 31 // expect Feb. (of course) if( mthIdx == 1 ) { if( isLeapYear( YrStr ) ) { maxDays=29; } else { maxDays=28; } } // thirty days hath... if( mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10 ) { maxDays=30; } return maxDays; } //the function which does some magic to the date fields // return non-zero if it is the last day of the month function adjustDate( mthIdx, Dt ) { var value = 0; var today = new Date() theYear = parseInt( today.getYear(), 10 ) if( mthIdx < today.getMonth() ) { theYear = ( parseInt( today.getYear(), 10 ) + 1 ) } if( theYear < 100 ) { theYear = "19" + theYear } else { if( ( theYear - 100 ) < 10 ) { theYear = "0" + ( theYear - 100 ) } else { theYear = ( theYear - 100 ) + "" } theYear = "20" + theYear } var numDays = getDaysInMonth( mthIdx, theYear ); if( mthIdx == 1 ) { if( Dt.options.selectedIndex + 1 < numDays ) { return 0; } else { Dt.options.selectedIndex=numDays - 1; //check for leap year if( numDays == 29 ) { return 99; } else { return 1; } } } if( Dt.options.selectedIndex + 1 < numDays ) { value = 0; } else { if ( Dt.options.selectedIndex + 1 > numDays ) { Dt.options.selectedIndex--; value = 3; } else { //index is 31 or 30 value = 2; } } return value; } //changes departure month when arrival month is changed function amadChange( inM, inD, outM, outD ) { if ( !isBrowserSupp() ) { return; } var res = adjustDate( inM.options.selectedIndex, inD ); if( res != 0 ) { outD.options.selectedIndex = 0; if ( outM.options.selectedIndex == 11 ) { outM.options.selectedIndex = 0 } else { outM.options.selectedIndex=inM.options.selectedIndex + 1; outD.options.selectedIndex = 1; } } else { outM.options.selectedIndex = inM.options.selectedIndex; if (outD.options.selectedIndex <= inD.options.selectedIndex) { outD.options.selectedIndex = inD.options.selectedIndex + 2; } } return; } function dmddChange( outM, outD ) { if ( !isBrowserSupp() ) { return; } adjustDate( outM.options.selectedIndex, outD ); return; } function loadDates(arrivalMonthSelect, arrivalDaySelect, departureMonthSelect, departureDaySelect,arrivalDate,departureDate) { if(!(arrivalDate && departureDate)){ var calendar = new Date(); var calendar2 = new Date(); //Here is the variable to change for to advance the arrival Date var advanceArrival = 14; //Here is the variable to change for to advance the departure Date var advanceDeparture = 16; }else{ var calendar = new Date(arrivalDate); var calendar2 = new Date(departureDate); var advanceArrival=0;advanceDeparture=0; } var cal var cal2 var date; var month; var year; var date2; var month2; var year2; //Set the arrival Days calendar.setDate(calendar.getDate()+ advanceArrival); date = calendar.getDate(); month = calendar.getMonth(); //Set the Departure Days calendar2.setDate(calendar2.getDate()+advanceDeparture); date2 = calendar2.getDate(); month2 = calendar2.getMonth(); arrivalMonthSelect.value=month; arrivalDaySelect.value=date; departureMonthSelect.value=month2; departureDaySelect.value=date2; } function OpenWindow(file, name, width, height) { OpenWindow(file, name, width, height, true); } function OpenWindow(file, name, width, height, showLeftTopScrollbar) { var attr = ""; attr += "top=0,left=0,scrollbars=auto,fullscreen=yes,screenX=0,screenY=0,menubar=1,toolbar=1,"; attr += "width=" + width + ",height=" + height; window.open(file, name, attr); } /* //////////////////////////// //////////////AJAX CODE //////////////////////////// */ // remote scripting library // (c) copyright 2005 modernmethod, inc var sajax_debug_mode = false; var sajax_request_type = "GET"; var sajax_target_id = ""; var sajax_failure_redirect = ""; function sajax_debug(text) { if (sajax_debug_mode) alert(text); } function sajax_init_object() { sajax_debug("sajax_init_object() called..") var A; var msxmlhttp = new Array( 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'); for (var i = 0; i < msxmlhttp.length; i++) { try { A = new ActiveXObject(msxmlhttp[i]); } catch (e) { A = null; } } if(!A && typeof XMLHttpRequest != "undefined") A = new XMLHttpRequest(); if (!A) sajax_debug("Could not create connection object."); return A; } var sajax_requests = new Array(); function sajax_cancel() { for (var i = 0; i < sajax_requests.length; i++) sajax_requests[i].abort(); } function sajax_do_call(func_name, args) { var i, x, n; var uri; var post_data; var target_id; sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id); target_id = sajax_target_id; if (typeof(sajax_request_type) == "undefined" || sajax_request_type == "") sajax_request_type = "GET"; uri = "/img/hotelsResources/AJAX.php"; if (sajax_request_type == "GET") { if (uri.indexOf("?") == -1) uri += "?rs=" + escape(func_name); else uri += "&rs=" + escape(func_name); uri += "&rst=" + escape(sajax_target_id); uri += "&rsrnd=" + new Date().getTime(); for (i = 0; i < args.length-1; i++) uri += "&rsargs[]=" + escape(args[i]); post_data = null; } else if (sajax_request_type == "POST") { post_data = "rs=" + escape(func_name); post_data += "&rst=" + escape(sajax_target_id); post_data += "&rsrnd=" + new Date().getTime(); for (i = 0; i < args.length-1; i++) post_data = post_data + "&rsargs[]=" + escape(args[i]); } else { alert("Illegal request type: " + sajax_request_type); } x = sajax_init_object(); if (x == null) { if (sajax_failure_redirect != "") { location.href = sajax_failure_redirect; return false; } else { sajax_debug("NULL sajax object for user agent:\n" + navigator.userAgent); return false; } } else { x.open(sajax_request_type, uri, true); // window.open(uri); sajax_requests[sajax_requests.length] = x; if (sajax_request_type == "POST") { x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } x.onreadystatechange = function() { if (x.readyState != 4) return; sajax_debug("received " + x.responseText); var status; var data; var txt = x.responseText.replace(/^\s*|\s*$/g,""); status = txt.charAt(0); data = txt.substring(2); if (status == "") { // let's just assume this is a pre-response bailout and let it slide for now } else if (status == "-") alert("Error: " + data); else { if (target_id != "") document.getElementById(target_id).innerHTML = eval(data); else { try { var callback; var extra_data = false; if (typeof args[args.length-1] == "object") { callback = args[args.length-1].callback; extra_data = args[args.length-1].extra_data; } else { callback = args[args.length-1]; } callback(eval(data), extra_data); } catch (e) { sajax_debug("Caught error " + e + ": Could not eval " + data ); } } } } } sajax_debug(func_name + " uri = " + uri + "/post = " + post_data); x.send(post_data); sajax_debug(func_name + " waiting.."); delete x; return true; } // wrapper for thisCityChoices function x_thisCityChoices() { sajax_do_call("thisCityChoices", x_thisCityChoices.arguments); } // wrapper for thisCityLandmarks function x_thisCityLandmarks() { sajax_do_call("thisCityLandmarks", x_thisCityLandmarks.arguments); } // wrapper for trackAds function x_trackAds() { sajax_do_call("trackAds", x_trackAds.arguments); } // wrapper for checkBookingsUrl function x_checkBookingsUrl() { sajax_do_call("checkBookingsUrl", x_checkBookingsUrl.arguments); } function x_trackClickbyTown() { sajax_do_call("trackClickbyTown", x_trackClickbyTown.arguments); } /* //////////////////////// /////////DB TOWN LOOKUP FOR DATEPICKER //////////////////////// */ //doCityMagic('manchester'); function doCityMagic(thiscity,locale){landmarkDropDown.innerHTML='';if(thiscity.value.length>2) x_thisCityChoices(thiscity.value,locale,printCityResults);else printCityResults('');} function printCityResults(d){cityDropDown.innerHTML=d;} function printLandmarkResults(d){landmarkDropDown.innerHTML=d;} function doLandmarkMagic(citySelect,locale){ //alert(citySelect.value); destId.value=citySelect.value; x_thisCityLandmarks(citySelect.value,locale,printLandmarkResults); } function showDiv (el, div, alignX, alignY) { // (i) popups etc if (document.getElementById){ var i = document.getElementById(el); var c = document.getElementById(div); if (c.style.display != "block"){ //var l=0; var t=0; //aTag = i; //do { // aTag = aTag.offsetParent; // l += aTag.offsetLeft; // t += aTag.offsetTop; //} while (aTag.offsetParent && aTag.tagName != 'BODY'); //var left = i.offsetLeft + l; //var top = i.offsetTop + t + i.offsetHeight + 2; var box = getDimensions(i); var left = box.x, top = box.y; //if (alignX == 'left' && c.style.width){ // left = left - parseInt(c.style.width); //} //if (alignY == 'top' && c.style.height){ // top = top - parseInt(c.style.height) -25; //} c.style.visibility = 'hidden'; // Needed to measure c.style.display = "block"; // Needed to measure if(alignX == 'left') left -= c.offsetWidth; else left += i.offsetWidth; if(alignY == 'top') top -= c.offsetHeight; else top += i.offsetHeight; if(top<10) top = 10; // XXX: Don't know why IE5 needs this here and not for calendar if(gClientIsIE5) { left += document.body.scrollLeft; top += document.body.scrollTop; } c.style.left = left+'px'; c.style.top = top+'px'; c.style.visibility = 'visible'; } else { //c.style.display="none"; } } } function hideDiv (div) { if (document.getElementById) { var c = document.getElementById(div); c.style.display="none"; } } function getDimensions( elm ) { var box = { x:0, y:0, w:0, h:0 }; if(document.getBoxObjectFor) { var boxRef = document.getBoxObjectFor(elm); box.x = boxRef.x; box.y = boxRef.y; box.w = boxRef.width; box.h = boxRef.height; } else if(elm.getBoundingClientRect) { // var rxIE50 = /MSIE 5\.0/g; //alert(rxIE50 + '.test("' + navigator.appVersion + '" = ' + rxIE50.test(navigator.appVersion)); var boxRef = elm.getBoundingClientRect(); box.x = boxRef.left; box.y = boxRef.top; box.w = (boxRef.right - boxRef.left); box.h = (boxRef.bottom - boxRef.top); //var s='';for(p in boxRef) s+=p+' '; alert(s); // Damn IE... if(document.compatMode && document.compatMode != 'BackCompat') { // IE6/compliance mode box.x += document.documentElement.scrollLeft - 2; box.y += document.documentElement.scrollTop - 2; } else if(!gClientIsIE5) { // IE5.5 box.x += document.body.scrollLeft - 2; box.y += document.body.scrollTop - 2; } } else { // No known box information available, walking // manually through offsetParents to calculate x/y coordinates box.w = elm.offsetWidth; box.h = elm.offsetHeight; while(elm) { box.x += elm.offsetLeft; box.y += elm.offsetTop; if(elm.offsetParent) // Required for Safari 1.3 :( elm = elm.offsetParent; else break; } } var cc; if(cc = document.getElementById('bodyconstraint')) box.x -= cc.offsetLeft; return box; } var gClientIsGecko = (window.controllers) ? true : false; var gClientIsOpera = (window.opera) ? true : false; var gClientIsIE = (document.all && !gClientIsOpera) ? true : false; var gClientIsIE5 = (gClientIsIE && /MSIE 5\.0/.test(navigator.appVersion)) ? true : false; var gClientIsIE55 = (gClientIsIE && /MSIE 5\.5/.test(navigator.appVersion)) ? true : false; var gClientIsIE6 = (gClientIsIE && /MSIE 6\.0/.test(navigator.appVersion)) ? true : false; var gClientIsIE7 = (gClientIsIE && /MSIE 7\.0/.test(navigator.appVersion)) ? true : false; var gClientIsIElte6 = (gClientIsIE && (gClientIsIE5 || gClientIsIE55 || gClientIsIE6) && !gClientIsIE7); var gClientIsMac = (/Mac/.test(navigator.appVersion)) ? true : false; // A DIV with id "cal1Container" should already exist on the page //var cal1 = new YAHOO.widget.Calendar("cal1Container"); //cal1.render(); function popup( obj, L, T ){ with( obj.style ) { width = 800; display = ""; position = "relative"; right = 0; top = 0; } } function unpop( obj ) { obj.style.display = "none"; } /* //////////////////////// //////////////DATEPICKER //////////////////////// */ //ADULT/CHILD/ROOM PROCESSING FUNCTIONS function setChildAge(room, child, age) { if (childAgesPerRoom[room] == null) { childAgesPerRoom[room] = new Array(); } childAgesPerRoom[room][child] = age; } function setNumAdults(room, numAdults) { adultsPerRoom[room] = numAdults; } function setNumChildren(room, numChildren) { childrenPerRoom[room] = numChildren; refresh(); } function setNumRooms(x) { numRooms = x; for (i = 0; i < x; i++) { if (adultsPerRoom[i] == null) { adultsPerRoom[i] = 2; } if (childrenPerRoom[i] == null) { childrenPerRoom[i] = 0; } } refresh(); } function renderRoomSelect() { var x = ''; x += ''; return x; } function refresh() { maxChildren = 0; for (var i = 0; i < numRooms; i++) { if (childrenPerRoom[i] > maxChildren) { maxChildren = childrenPerRoom[i]; } } var x = ''; if (adultHelp.length > 0) { x = adultHelp + "

\n"; } if (numRooms > 8) { x += textRooms; x += renderRoomSelect(); } else { x += '\n'; x += ''+textRooms+pad+''; if (numRooms > 1) { x += ' '; } x += ''+textAdults+pad+''+textChildren+pad+'\n'; for (var i = 0; i < numRooms; i++) { x += ''; if (i == 0) { x += renderRoomSelect(); } else { x += ' '; } x += ''; if (numRooms > 1) { x += ''+getValue(textRoomX, i+1)+pad + ''; } x += ''; x += buildSelect('room-' + i + '-adult-total', 'setNumAdults(' + i + ', this.options[this.selectedIndex].value)', 1, 4, adultsPerRoom[i]); x += ''; x += buildSelect('room-' + i + '-child-total', 'setNumChildren(' + i + ', this.options[this.selectedIndex].value)', 0, 6, childrenPerRoom[i]); x += '\n'; } x += '
\n'; var didHeader = false; for (var i = 0; i < numRooms; i++) { if (childrenPerRoom[i] > 0) { if (!didHeader) { x += '\n'; x += ''; x += '
'; x += childHelp; x += '
'; x += '
\n '; for (var j = 0; j < maxChildren; j++) { x += ''+getValue(textChildX, j+1)+pad+'\n'; } didHeader = true; } x += '\n'+getValue(textRoomX, i+1)+pad+''; for (var j = 0; j < childrenPerRoom[i]; j++) { x += ''; var def = -1; if (childAgesPerRoom[i] != null) { if (childAgesPerRoom[i][j] != null) { def = childAgesPerRoom[i][j]; } } x += '\n'; } } if (didHeader) { x += '
\n'; } } document.getElementById("hot-search-params").innerHTML = x; } function buildSelect(name, onchange, min, max, selected) { var x = '