
var OT=OT||{};OT.BookingBox=function(_tracking,_bookingOptions,_displayOptions,_mediaPartnerTracking){var _b=_bookingOptions,_d=_displayOptions,_t=_tracking,_mpt=_mediaPartnerTracking;var UNDF="undefined";var OBJ="object";this._host="http://www.onetime.com";this.box=null;this.frame=null;this.b=this.bookingOptions={sid:typeof _t!=OBJ?_t:(_t.sid||null),kwid:typeof _t!=OBJ?null:(_t.kwid||null),hotel:typeof _b.hotel!=UNDF?{id:_b.hotel.id||null,name:_b.hotel.name||null,locationId:_b.hotel.locationId||null,locationName:_b.hotel.locationName||null,checkInDate:_b.hotel.checkInDate||null,checkOutDate:_b.hotel.checkOutDate||null,guests:_b.hotel.guests||1,rooms:_b.hotel.rooms||1}:null,location:typeof _b.location!=UNDF?{id:_b.location.id||null,name:_b.location.name||null,checkInDate:_b.location.checkInDate||null,checkOutDate:_b.location.checkOutDate||null,guests:_b.location.guests||1,rooms:_b.location.rooms||1}:null,flight:typeof _b.flight!=UNDF?{fromId:_b.flight.fromId||null,toId:_b.flight.toId||null,fromName:_b.flight.fromName||null,toName:_b.flight.toName||null,departureDate:_b.flight.departureDate||null,returnDate:_b.flight.returnDate||null,oneWay:_b.flight.oneWay===true,passengers:_b.flight.passengers||1}:null};if(typeof _d==UNDF)_d={};this.d=this.displayOptions={boxClassName:_d.boxClassName||null,frameClassName:_d.frameClassName||null,cssURL:_d.cssURL||null,cache:_d.cache||false,popup:_d.popup||false,shadow:_d.shadow||false,overlay:_d.overlay||false,position:typeof _d.position!=UNDF?{x:_d.position.x||0,y:_d.position.y||0}:{x:0,y:0},dimensions:typeof _d.dimensions!=UNDF?{width:_d.dimensions.width||525,height:_d.dimensions.height||265}:{width:525,height:265},anchorElement:typeof _d.anchorElement!=UNDF?OT.dom.get(_d.anchorElement):null,center:_d.center||false,visible:typeof _d.popup!=UNDF&&_d.popup==false&&typeof _d.visible!=UNDF?_d.visible:true};if(typeof _mpt==UNDF)_mpt={};this.mpt={tags:_mpt.tags||null};if(this.d.anchorElement!=null){this.d.position.x=OT.dom.getX(this.d.anchorElement);this.d.position.y=OT.dom.getY(this.d.anchorElement);this.d.position.x=isNaN(this.d.position.x)?0:this.d.position.x;this.d.position.y=isNaN(this.d.position.y)?0:this.d.position.y;}
if(this.d.popup&&this.d.center){dim=OT.dom.getPageDimensions();this.d.position={x:Math.round((dim.viewport.width-this.d.dimensions.width)/2),y:Math.round((dim.viewport.height-this.d.dimensions.height)/2+OT.dom.getYPageScroll())};}
this.w=this.d.dimensions.width;this.h=this.d.dimensions.height;this._initialize=function(){var d=this.d,b=this.b;var opened;var fr;if(d.cache&&(opened=this._getCached())!=null){this._host=opened._host;this.w=opened.width;this.h=opened.height;this.box=opened.box;this.frame=opened.frame;if(this.box!=null){this.box.setPosition(d.position);if(this.box.visible)
this.box.c();else
this.box.o();}
return;}else{fr=this.frame=document.createElement("iframe");fr.setAttribute("scrolling","no");fr.setAttribute("frameBorder","0");fr.name=fr.id="fr"+this.getHashKey();if(d.frameClassName!=null){fr.className=d.frameClassName;}
this._setFrameStyle(this.frame);if(d.popup||(!d.popup&&d.anchorElement==null)){this.box=new OT.PopUp(fr,d.position,{shadow:d.shadow,overlay:d.overlay,iframe:false});if(d.boxClassName!=null){this.box.main.className+=" "+d.boxClassName;}
d.popup=true;}else if(d.anchorElement!=null){d.anchorElement.appendChild(fr);}
if(d.popup){if(d.overlay)this._setOverlayStyle(this.box.getOverlay());if(d.shadow)this._setShadowStyle(this.box.getShadow());this._setBoxStyle(this.box.getPopUpMain());this._setCloseStyle(this.box.getX(),this.box.getClose(),null);}
fr.src=this.constructURL();if(d.cache){this._setCached();}
if(d.visible){this.show();}else{this.hide();}}};this.constructURL=function(){var url=this._host+"/bookingbox.php?";var nil=this.nullToEscapedEmptyString;var h=this.b.hotel,l=this.b.location,f=this.b.flight;url+="sid="+nil(this.b.sid)+"&kwid="+nil(this.b.kwid);if(this.b.hotel!=null){url+="&type=hs";url+="&hid="+nil(h.id);url+="&hotel="+nil(h.name);url+="&lid="+nil(h.locationId);url+="&city="+nil(h.locationName);url+="&inDate="+nil(h.checkInDate);url+="&outDate="+nil(h.checkOutDate);url+="&travelers="+nil(h.guests);url+="&rooms="+nil(h.rooms);}else if(this.b.location!=null){url+="&type=hl";url+="&lid="+nil(l.id);url+="&city="+nil(l.name);url+="&inDate="+nil(l.checkInDate);url+="&outDate="+nil(l.checkOutDate);url+="&travelers="+nil(l.guests);url+="&rooms="+nil(l.rooms);}else if(this.b.flight!=null){url+="&type=fl";url+="&fid="+nil(f.fromId);url+="&tid="+nil(f.toId);url+="&from="+nil(f.fromName);url+="&to="+nil(f.toName);url+="&inDate="+nil(f.departureDate);url+="&outDate="+nil(f.returnDate);url+="&oneWay="+(f.oneWay?'1':'');url+="&travelers="+nil(f.passengers);}else{}
if(this.d.cssURL!=null){url+="&css="+nil(this.d.cssURL);}
if(this.mpt.tags!=null){if(typeof this.mpt.tags=="string")
url+="&ttags="+nil(this.mpt.tags);else if(typeof this.mpt.tags=="object"){var tagstr="";for(var i=0;i<this.mpt.tags.length;i++){tagstr+=this.mpt.tags[i].replace(";","")+";";}
url+="&ttags="+nil(tagstr);}}
return url;};this.nullToEscapedEmptyString=function(str){return str==null?'':escape(str);};this.center=function(){var main=null;if(this.box!=null){dim=OT.dom.getPageDimensions();main=this.box.getPopUpMain();this.box.setPosition({x:Math.round((dim.viewport.width-OT.dom.getW(main))/2),y:Math.round((dim.viewport.height-OT.dom.getH(main))/2+OT.dom.getYPageScroll())});}};this.show=function(){OT.dom.displayOn(this.frame);};this.hide=function(){OT.dom.displayOff(this.frame);};this._getCached=function(){if(null!=OT.BookingBoxCache[this.getHashKey()])
return OT.BookingBoxCache[this.getHashKey()];else
return null;};this._setCached=function(){OT.BookingBoxCache[this.getHashKey()]=this;};this.getHashKey=function(){var key='';if(this.b.hotel!=null)
key+='h'+this.b.hotel.id+this.b.hotel.name+this.b.hotel.locationId+this.b.hotel.locationName;else if(this.b.location!=null)
key+='l'+this.b.location.id+this.b.location.name;else if(this.b.flight!=null)key+='f'+this.b.flight.fromId+this.b.flight.toId+this.b.flight.fromName+this.b.flight.toName
return key;};this._setBoxStyle=function(box,coords){var s=box.style;s.border="2px solid #376cae";s.width=this.w+"px";s.height=this.h+"px";s.background="white";s.position="absolute";s.padding="0px";s.margin="0px";s.display="block";s.zIndex=9010;};this._setOverlayStyle=function(overlay){var s=overlay.style;s.opacity=0.3;s.background="black";s.filter="alpha(opacity=30)";s.zIndex=9009;};this._setShadowStyle=function(shadow){var s=shadow.style;s.width=this.w+"px";s.height=this.h+"px";s.background="black";s.position="absolute";s.padding="0px";s.margin="0px";s.display="block";s.opacity="0.3";s.filter="alpha(opacity=30)";};this._setFrameStyle=function(fr){var s=fr.style;s.width=this.w+"px";s.height=this.h+"px";s.border="0px";s.overflow="hidden";s.position=this.d.popup?"absolute":"relative";s.top="0px";s.left="0px";s.background="white";if(!this.d.visible){s.display="none";}};this._setCloseStyle=function(x,close){var r=x.style,s=close.style;r.position=s.position="absolute";r.display=s.display="block";r.border="0px";r.width="10px";r.height="10px";r.padding=r.margin="0px";r.lineHeight="15px";r.textDecoration=s.textDecoration="none";r.fontFamily=s.fontFamily="arial,sans-serif";s.fontSize="12px";r.fontSize="20px";r.color=s.color="#3556a6";r.top=0+"px";r.left=(this.w-14)+"px";s.top=(this.h-15)+"px";s.left=(this.w-33)+"px";s.zIndex=r.zIndex=9011;};this._initialize();};if("undefined"==OT.BookingBoxCache||null==OT.BookingBoxCache){OT.BookingBoxCache=[];}
var OT=OT||{};OT.uid=function(){if(!OT._uid){OT._uid=0;}
return OT._uid++;};OT.PopUp=function(contents,coords,options){var that=this;this.elements=[];this.options={shadow:false,overlay:false,iframe:false};this.coords={x:0,y:0};this.visible=false;this.overlay=null;this.shadow=null;this.x=null;this.close=null;this.main=null;this.iframe=null;this.show=function(contents){return this.create(contents);};this.create=function(){this.options=null==options?this.options:options;if(null!=coords&&coords.x!=null&&coords.y!=null){this.coords.x=coords.x;this.coords.y=coords.y;}else{this.coords=null;}
this.addMainContent(contents);return this;};this.addMainContent=function(contents){this._initialize();var el=this.elements[0].appendChild(contents);this.elements[this.elements.length]=el;for(var i=0;i<el.childNodes.length;i++){this.elements[this.elements.length]=el.childNodes[i];}};this.c=function(){OT.effect.showBleeders();for(var i=0;i<this.elements.length;i++){OT.dom.displayOff(this.elements[i]);OT.dom.hide(this.elements[i]);}
this.visible=false;};this.o=function(){OT.effect.hideBleeders();for(var i=0;i<this.elements.length;i++){OT.dom.displayOn(this.elements[i]);OT.dom.show(this.elements[i]);}
this.visible=true;};this.getOverlay=function(){return this.overlay;};this.getShadow=function(){return this.shadow;};this.getPopUpMain=function(){return this.main;};this.getX=function(){return this.x;};this.getClose=function(){return this.close;};this.setPosition=function(coords){this.main.style.top=coords.y+"px";this.main.style.left=coords.x+"px";if(this.shadow!=null){this.shadow.style.top=(coords.y+10)+"px";this.shadow.style.left=(coords.x+10)+"px";}
if(this.iframe!=null){this.iframe.style.top=coords.y+"px";this.iframe.style.left=coords.x+"px";}};this._initialize=function(){var id="popup"+OT.uid();OT.effect.hideBleeders();var main,x,close;this.main=main=this.elements[0]=OT.dom.addBodyElement("div");main.id=id;main.className="popupMain";this.x=x=OT.dom.addChildElement(main,"a");this.close=close=OT.dom.addChildElement(main,"a");x.className="popupX";x.innerHTML="&#215;";close.innerHTML="close";close.className="popupClose";close.onclick=function(){that.c();};x.onclick=function(){that.c();};x.setAttribute("href","javascript:void(0);");close.setAttribute("href","javascript:void(0);");main.style.position=x.style.position=close.style.position="absolute";if(null!=this.coords){this.setPosition(this.coords);}
if(this.options.overlay){this.overlay=this.elements[this.elements.length]=OT.effect.addScreenOverlay(main,"popupOverlay");}
if(this.options.shadow){this.shadow=this.elements[this.elements.length]=OT.effect.addShadow(main,"popupShadow");}
if(this.options.iframe){this.iframe=this.elements[this.elements.length]=OT.effect.addBackgroundIframe(main);}
x.style.display=close.style.display="block";x.style.zIndex=close.style.zIndex=OT.dom.getZIndex(main)+1;x.style.top=(0-3)+"px";x.style.left=(OT.dom.getW(main)-OT.dom.getW(x)-2)+"px";close.style.top=(OT.dom.getH(main)-OT.dom.getH(close)-1)+"px";close.style.left=(OT.dom.getW(main)-OT.dom.getW(close)-4)+"px";this.visible=true;};this.create();};OT.dom=OT.dom||{};OT.Dom=OT.dom;OT.dom.get=function(_te){if(typeof _te=="string"){if(document.all)
return document.all[_te];else if(document.getElementById)
return document.getElementById(_te);else
return document[_te];}else if(_te){return _te;}else{return null;}};OT.dom.getX=function(o){if(document.layers)return o.left;return o.offsetLeft+(o.offsetParent?OT.dom.getX(o.offsetParent):0);};OT.dom.getY=function(o){if(document.layers)return o.top;return o.offsetTop+(o.offsetParent?OT.dom.getY(o.offsetParent):0);};OT.dom.getW=function(o){if(document.layers)return o.clip.width;return o.offsetWidth;};OT.dom.getH=function(o){if(document.layers)return o.clip.height;return o.offsetHeight;};OT.dom.displayOff=function(element){element.style.display="none";};OT.dom.displayOn=function(element){element.style.display="block";};OT.dom.hide=function(element){element.style.visibility="hidden";};OT.dom.show=function(element){element.style.visibility="visible";};OT.dom.hideElementsByTag=function(name){var elements=document.getElementsByTagName(name);for(var i=0;i<elements.length;i++){if(OT.dom.getComputedStyle(elements[i],"visibility")!="hidden"){OT.dom.hide(elements[i]);elements[i].bleeder=true;}}};OT.dom.showElementsByTag=function(name){var elements=document.getElementsByTagName(name);for(var i=0;i<elements.length;i++){if(elements[i].bleeder)OT.dom.show(elements[i]);}};OT.dom.getYPageScroll=function(){var yS,de=document.documentElement,db=document.body;if(self.pageYOffset){yS=self.pageYOffset;}else if(de&&de.scrollTop){yS=de.scrollTop;}else if(db){yS=db.scrollTop;}
return yS;};OT.dom.getPageDimensions=function(){var dx,dy,wW,wH,pgH,pgW,w=window,db=document.body,de=document.documentElement;if(w.innerHeight&&w.scrollMaxY){dx=db.scrollWidth;dy=w.innerHeight+w.scrollMaxY;}else if(db.scrollHeight>db.offsetHeight){dx=db.scrollWidth;dy=db.scrollHeight;}else{dx=db.offsetWidth;dy=db.offsetHeight;}
if(self.innerHeight){wW=self.innerWidth;wH=self.innerHeight;}else if(de&&de.clientHeight){wW=de.clientWidth;wH=de.clientHeight;}else if(db){wW=de.clientWidth;wH=db.clientHeight;}
pgH=dy<wH?wH:dy;pgW=dx<wW?wW:dx;return{page:{width:pgW,height:pgH},viewport:{width:wW,height:wH}};};OT.dom.addBodyElement=function(tag){return document.body.appendChild(document.createElement(tag));};OT.dom.addChildElement=function(parent,tag){return parent.appendChild(document.createElement(tag));};OT.dom.addElementsToDom=function(mainComponents){var root=document.createElement("div");for(var i=0;i<mainComponents.length;i++){el=OT.dom.addChildElement(root,mainComponents[i][0]);el.className=mainComponents[i][1];el.innerHTML=mainComponents[i][2];}
return root;};OT.dom.getZIndex=function(element){return OT.dom.getComputedStyle(element,'zIndex');};OT.dom.getComputedStyle=function(element,style){var value;if(document.defaultView&&document.defaultView.getComputedStyle){var computed=document.defaultView.getComputedStyle(element,'');if(computed){value=computed[style];}
return element.style[style]||value;}else if(document.documentElement.currentStyle){value=element.currentStyle?element.currentStyle[style]:null;return(element.style[style]||value);}else{return element.style[style];}};OT.dom.addEvent=function(obj,type,fn){if(obj.attachEvent){obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event);}
obj.attachEvent('on'+type,obj[type+fn]);}else{obj.addEventListener(type,fn,false);}};OT.dom.removeEvent=function(obj,type,fn){if(obj.detachEvent){obj.detachEvent('on'+type,obj[type+fn]);obj[type+fn]=null;obj['e'+type+fn]=null;}else{obj.removeEventListener(type,fn,false);}};OT.dom.form=OT.dom.form||{};OT.dom.form.getRadioValue=function(radioField){var val=null;if("object"==typeof radioField){if("undefined"==typeof radioField.length){val=radioField.checked?radioField.value:null;}else{for(i=0;i<radioField.length;i++){if(radioField[i].checked){val=radioField[i].value;break;}}}}
return val;};OT.effect=OT.effect||{};OT.Effect=OT.effect;OT.effect.addShadow=function(element,className){var shadow=OT.dom.addBodyElement("div");shadow.className=null!=className?className:shadow.className;shadow.style.position="absolute";shadow.style.zIndex=OT.dom.getZIndex(element)-1;shadow.style.width=OT.dom.getW(element);shadow.style.height=OT.dom.getH(element);shadow.style.top=(OT.dom.getY(element)+10)+"px";shadow.style.left=(OT.dom.getX(element)+10)+"px";return shadow;};OT.effect.addScreenOverlay=function(element,className){var overlay=OT.dom.addBodyElement("div");overlay.className=null!=className?className:overlay.className;overlay.style.position="absolute";overlay.style.zIndex=OT.dom.getZIndex(element)-1;var dim=OT.dom.getPageDimensions();overlay.style.top=overlay.style.left="0px";overlay.style.width=(dim.viewport.width>dim.page.width?dim.viewport.width:dim.page.width)+"px";overlay.style.height=(dim.viewport.height>dim.page.height?dim.viewport.height:dim.page.height)+"px";return overlay;};OT.effect.addBackgroundIframe=function(element){var iframe=OT.dom.addBodyElement("iframe");iframe.style.position="absolute";iframe.style.zIndex=OT.dom.getZIndex(element)-1;iframe.style.background="white";iframe.style.width=(OT.dom.getW(element)-4)+"px";iframe.style.height=(OT.dom.getH(element)-4)+"px";iframe.style.top=OT.dom.getY(element)+"px";iframe.style.left=OT.dom.getX(element)+"px";iframe.setAttribute("frameBorder","0");return iframe;};OT.effect.showBleeders=function(){OT.dom.showElementsByTag("select");OT.dom.showElementsByTag("embed");OT.dom.showElementsByTag("object");OT.dom.showElementsByTag("iframe");};OT.effect.hideBleeders=function(){OT.dom.hideElementsByTag("select");OT.dom.hideElementsByTag("embed");OT.dom.hideElementsByTag("object");OT.dom.hideElementsByTag("iframe");};
