//baynote
var BaynoteEnabled=true;var BaynoteJSVersion="$Revision: 1.20 $";if(typeof(baynote_globals)=="undefined"){var baynote_globals=new Object()}function BNLog(){this.timeBase=new Date().getTime();this.lines=new Array();this.lastLine="";this.repCount=0}BNLog.prototype.log=function(b){if(b==this.lastLine){++this.repCount;return}if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""))}this.lastLine=b;this.repCount=0;var a=new Date().getTime()-this.timeBase;this.lines.push(a+": "+b)};BNLog.prototype.toString=function(){if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""));this.lastLine="";this.repCount=0}return this.lines.join("\n")};if(typeof(bnLog)=="undefined"){var bnLog=new BNLog()}function BNCriticalSectionQueue(){this.waitList=new Object();this.lastId=0}BNCriticalSectionQueue.prototype.issueId=function(){return ++this.lastId};BNCriticalSectionQueue.prototype.enqueue=function(b,a){this.waitList[b]=a};BNCriticalSectionQueue.prototype.getWaiter=function(a){return(a==null)?null:this.waitList[a]};BNCriticalSectionQueue.prototype.firstWaiter=function(){return this.getWaiter(this.nextWaiterKeyAfter(null))};BNCriticalSectionQueue.prototype.nextWaiterAfter=function(a){return this.getWaiter(this.nextWaiterKeyAfter(a))};BNCriticalSectionQueue.prototype.nextWaiterKeyAfter=function(b){for(var a in this.waitList){if(typeof(this.waitList[a])!="object"){continue}if(b==null){return a}if(b==a){b=null}}return null};BNCriticalSectionQueue.prototype.nextPredecessor=function(b,c){for(var a=c;a!=null;a=this.nextWaiterAfter(a.id)){if(a.enter||(a.number!=0&&(a.number<b.number||(a.number==b.number&&a.id<b.id)))){return a}}return null};function BNCriticalSection(a){this.csQueue=a;this.debug=1}BNCriticalSection.prototype.enter=function(a){this.enterFunc=a;this.id=this.csQueue.issueId();this.csQueue.enqueue(this.id,this);this.enter=true;this.number=(new Date()).getTime();this.enter=false;this.attempt(this.csQueue.firstWaiter())};BNCriticalSection.prototype.leave=function(){if(this.debug){bnLog.log("LEAVE "+this.id)}this.number=0};BNCriticalSection.prototype.attempt=function(c){var a=this.csQueue.nextPredecessor(this,c);if(a!=null){if(this.debug){bnLog.log("WAIT "+this.id)}var b=this;return setTimeout(function(){b.attempt(a)},50)}if(this.debug){bnLog.log("ENTER "+this.id)}this.enterFunc()};function BNResourceManager(){this.csQueue=new BNCriticalSectionQueue();this.critSec=null;this.debug=1;this.resources=new Object();this.waiting=new Object()}BNResourceManager.prototype.getResource=function(a){return this.resources[a]};BNResourceManager.prototype.loadResource=function(c,d,b){if(typeof(this.resources[c])!="undefined"){return}this.resources[c]=null;var a=new BNCriticalSection(this.csQueue);a.enter(function(){bnResourceManager.inject(c,d,b,a)})};BNResourceManager.prototype.inject=function(f,h,d,a){this.critSec=a;if(this.debug){bnLog.log("INJECT "+this.critSec.id+" ("+f+")")}if(!d||d=="script"){var g=document.createElement("script");g.language="javascript";g.src=h;var c=document.getElementsByTagName("head");c[0].appendChild(g)}else{if(d=="img"){var b=document.createElement("IMG");var e=function(){bnResourceManager.registerAndAddResource(f,b)};if(b.addEventListener){b.addEventListener("load",e,false)}else{if(b.attachEvent){b.attachEvent("onload",e)}else{b.onload=e}}b.src=h}else{alert("Unexpected resource type to loadResource: "+d)}}};BNResourceManager.prototype.waitForResource=function(rId,callbackCode,rAddress,rType){with(this){if(getResource(rId)){this.runCallback(callbackCode)}else{if(typeof(waiting[rId])=="undefined"){waiting[rId]=new Array()}var waitingList=waiting[rId];waitingList[waitingList.length]=callbackCode;if(rAddress){this.loadResource(rId,rAddress,rType)}}}};BNResourceManager.prototype.wakeUpWaiting=function(rId){with(this){var waitingList=waiting[rId];if(!waitingList){return}for(var i=0;i<waitingList.length;i++){if(waitingList[i]){var codeToEval=waitingList[i];waitingList[i]=null;if(this.debug&&codeToEval){bnLog.log("CALLBACK "+rId+": "+codeToEval)}this.runCallback(codeToEval)}}}};BNResourceManager.prototype.registerAndAddResource=function(b,a){if(this.debug){bnLog.log("REGISTER "+this.critSec.id+" ("+b+")")}this.resources[b]=a;this.wakeUpWaiting(b);this.critSec.leave();setTimeout("bnResourceManager.wakeUpWaiting('"+b+"')",5000)};BNResourceManager.prototype.registerResource=function(a){this.registerAndAddResource(a,true)};BNResourceManager.prototype.runCallback=function(callback){if(typeof(callback)=="string"){eval(callback)}else{if(typeof(callback)=="function"){callback()}else{alert("Invalid callback, type="+typeof(callback))}}};if(typeof(bnResourceManager)=="undefined"){var bnResourceManager=new BNResourceManager()}function BNSystem(){this.testServer=null}BNSystem.prototype.getCookieValue=function(e,c){if(!c){c=baynote_globals.cookieSubDomain}if(c){e+=("-"+c)}var d=document.cookie;var a=d.indexOf(" "+e+"=");if(a==-1){a=d.indexOf(e+"=")}if(a==-1){d=null}else{a=d.indexOf("=",a)+1;var b=d.indexOf(";",a);if(b==-1){b=d.length}d=unescape(d.substring(a,b))}return d};BNSystem.prototype.setCookie=function(h,g,d,e,a,f){g=escape(g);if(e=="NEVER"){var b=new Date();b.setFullYear(b.getFullYear()+500);e=b.toGMTString()}else{if(e=="SESSION"){e=""}}if(d!=""){d=";Path="+d}if(e!=""){e=";expires="+e}if(!a){a=(baynote_globals.cookieDomain)?baynote_globals.cookieDomain:""}if(a!=""){a=";domain="+a}if(!f){f=baynote_globals.cookieSubDomain}if(f){h+=("-"+f)}var c=h+"="+g+e+d+a;if(c.length>4096){return false}document.cookie=c;return true};BNSystem.prototype.removeCookie=function(b,a){this.setCookie(b,"","/","Mon, 1 Jan 1990 00:00:00",a)};BNSystem.prototype.getURLParam=function(c,b){if(!b){var b=window.location.href}var d=new RegExp("[\\?&]"+c+"=([^&#]*)");var a=d.exec(b);if(!a){return null}else{return a[1]}};BNSystem.prototype.getTestServer=function(){if(this.testServer!=null){return this.testServer}var a=this.getURLParam("bn_test");if(a){this.setCookie("bn_test",a,"/","SESSION")}else{if(a==""){this.removeCookie("bn_test")}else{a=this.getCookieValue("bn_test");if(!a){a=""}}}this.testServer=a;return a};if(typeof(bnSystem)=="undefined"){var bnSystem=new BNSystem()}if(typeof(BNTag)=="undefined"){function BNTag(a){if(a){this.id=a.id+1;this.server=a.server;this.customerId=a.customerId;this.code=a.code}else{this.id=0}this.attrs=new Object();this.css=new Object()}}BNTag.prototype.getCommonResourceId=function(){return"Common"};BNTag.prototype.getCommonResourceAddress=function(a){return(this.server+"/baynote/tags2/common.js")};BNTag.prototype.getFailsafeResourceId=function(){return"Failsafe"};BNTag.prototype.getFailsafeResourceAddress=function(){return(this.server+"/baynote/customerstatus2?customerId="+this.customerId+"&code="+this.code+"&x="+this.id+(new Date().getTime()))};BNTag.prototype.show=function(b){if(this.id==0){document.write("<span id='bn_placeholder_global'></span>")}this.placeHolderId="bn_placeholder"+this.id;var c;if(this.placeHolderElement){c=this.placeHolderElement}else{c=this.popup?"span":"div"}if(b){var d=document.createElement(c);d.id=this.placeholderId;document.getElementById(b).appendChild(d)}else{document.write("<"+c+" id='"+this.placeHolderId+"'></"+c+">")}window.bn_tags[this.id]=this;var e=bnSystem.getTestServer();if(e){var a=new RegExp("^https?://[^/]*.baynote.(com|net)(:\d+)?(/.*)?");if(a.test(e)){this.server=e}else{alert('Ignoring invalid test server "'+e+'"')}}this.showWhenReady(this);baynote_tag=new BNTag(this)};BNTag.prototype.showWhenReady=function(a){var c=this.getFailsafeResourceId();if(!bnResourceManager.getResource(c)){bnResourceManager.waitForResource(c,function(){a.showWhenReady(a)},this.getFailsafeResourceAddress(),"img");return}var b=this.getCommonResourceId();if(!bnResourceManager.getResource(b)){bnResourceManager.waitForResource(b,function(){a.showWhenReady(a)},this.getCommonResourceAddress(),"script");return}bnTagManager.show(a.id)};BNTag.prototype.noshow=function(){window.bn_tags[this.id]=this;baynote_tag=new BNTag(this)};BNTag.prototype.getParam=function(b,a){var c=this[b];if(typeof(c)=="undefined"||c==null){return a}else{return c}};if(typeof(baynote_tag)=="undefined"){window.bn_tags=new Array();var baynote_tag=new BNTag(null)};
//baynote-searchBox
function baynote_validateSearchBox(){if(typeof(BaynoteEnabled)!="undefined"&&BaynoteEnabled){if(window.location.href.indexOf("https://")==-1){var a=baynote_tag.getFailsafeResourceId();baynote_tag.server="http://expedia-www.baynote.net/";baynote_tag.customerId="expedia";baynote_tag.code="www";if((bnResourceManager!="undefined")&&(bnResourceManager!=null)&&(typeof(a)!="undefined")&&(a!=null)){bnResourceManager.waitForResource(a,"baynote_showSearchBox()",baynote_tag.getFailsafeResourceAddress(),"img")}}}}function baynote_showSearchBox(){if(document.getElementById("baynote_searchBox")){document.getElementById("baynote_searchBox").style.display="block"}}function baynote_handleSubmit(){var c=(document.getElementById("baynote_isDefault").value=="1")?"":document.getElementById("baynote_q").value;var b=document.getElementById("baynote_st").value;var e=document.getElementById("baynote_cn").value;var d=document.getElementById("baynote_cc").value;var a="http://search.expedia.com/socialsearch/query?st="+b+"&cn="+e+"&cc="+d+"&q="+c;if(window.parent){window.parent.document.location=a}else{window.location=a}}function baynote_handleFocus(){var b=document.getElementById("baynote_q");var a=document.getElementById("baynote_isDefault");if(a.value=="1"){a.value="0";b.value=""}}function baynote_handleBlur(){var b=document.getElementById("baynote_q");var a=document.getElementById("baynote_isDefault");if(b.value.length==0){b.value="Search Expedia";a.value="1"}};
