$=MochiKit.DOM.$;
var boa={nodes:[]};
boa.shortDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
boa.shortMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
boa.length=function(_1){
if(_1.length){
return _1.length;
}
var x=0;
for(var i in _1){
x++;
}
return x;
};
boa.printR=function(_4,_5){
var _6="\n";
var _7="";
_5=_5?_5:0;
if(_4.constructor){
for(var k in _4){
for(var l=0;l<_5;l++){
_7+=" ";
}
if((_4[k]!=null)&&(_4[k].constructor==Array||_4[k].constructor==Object)){
_7+=k+"=>"+typeof (_4)+"("+_6+""+this.printR(_4[k],_5+1)+")"+_6;
}else{
_7+=k+"=>"+_4[k]+_6;
}
}
}else{
_7=_4+_6;
}
return _7;
};
boa.serialize=function(a,_b){
var i=0;
var s="";
if(typeof _b=="undefined"){
_b=true;
}
if(typeof (a)=="object"){
for(var k in a){
i++;
s+="s:"+String(k).length+":\""+String(k)+"\";"+this.serialize(a[k],_b);
}
s="a:"+i+":{"+s+"}";
}else{
var _f=String(a);
if(_b===true){
_f=boa.escapeText(_f);
}
s+="s:"+String(a).length+":\""+_f+"\";";
}
return s;
};
boa.escapeText=function(str){
str=str.replace(/\\/g,"\\\\");
str=str.replace(/"/g,"\\\"");
str=str.replace(/'/g,"\\'");
return str;
};
boa.unEscapeText=function(str){
str=str.replace(/\\'/g,"'");
str=str.replace(/\\"/g,"\"");
str=str.replace(/\\\\/g,"\\");
return str;
};
boa.unEscapeEvalObject=function(obj){
for(var key in obj){
if(typeof (obj.key)=="object"){
obj.key=boa.unEscapeEvalObject(obj.key);
}else{
if(typeof (obj.key)=="string"){
obj.key=boa.unEscapeText(obj.key);
}
}
}
return obj;
};
boa.doSimplePostXMLHttpRequest=function(url){
var _15=MochiKit.Async;
var req=_15.getXMLHttpRequest();
if(arguments.length>1){
var m=MochiKit.Base;
var qs=m.queryString.apply(null,m.extend(null,arguments,1));
}
req.open("POST",url,true);
var _19=["X-Requested-With","XMLHttpRequest","X-MochiKit-Version",MochiKit.Async.VERSION,"Accept","text/javascript, text/html, application/xml, text/xml, ","Content-type","application/x-www-form-urlencoded; charset=UTF8"];
if(req.overrideMimeType){
_19.push("Connection","close");
}
for(var i=0;i<_19.length;i+=2){
req.setRequestHeader(_19[i],_19[i+1]);
}
return _15.sendXMLHttpRequest(req,qs);
};
boa.insertAfter=function(_1b,_1c){
MochiKit.DOM.insertSiblingNodesAfter(_1b,newNode);
};
boa.registerCustomSignal=function(_1d,_1e,evt){
var MS=MochiKit.Signal;
var MD=MochiKit.DOM;
MS.connect(_1d,_1e.type,function(){
MS.signal(MD.$(_1e.target),_1e.name,evt);
});
};
boa.appendClass=function(_22,_23){
var MD=MochiKit.DOM;
if(MD.$(_22)&&(String(MD.$(_22).className).indexOf(_23)==-1)){
MD.$(_22).className+=" "+_23;
}
};
boa.removeClass=function(_25,_26){
var MD=MochiKit.DOM;
MD.$(_25).className=String(MD.$(_25).className).replace(_26,"");
};
boa.disableTextSelection=function(_28){
var MD=MochiKit.DOM;
MD.$(_28).style.MozUserSelect="none";
MD.$(_28).onselectstart=function(){
return false;
};
};
boa.getStyleValue=function(_2a,css){
if(_2a.style[css]){
return _2a.style[css];
}else{
var _2c;
if(_2c=_2a.className){
_2c="."+_2c;
for(var x=0;x<document.styleSheets.length;x++){
if(document.styleSheets[x].cssRules){
for(var z=0;z<document.styleSheets[x].cssRules.length;z++){
if(document.styleSheets[x].cssRules[z].selectorText==_2c){
return document.styleSheets[x].cssRules[z].style[css];
}
}
}else{
if(document.styleSheets[x].rules){
for(var z=0;z<document.styleSheets[x].rules.length;z++){
if(document.styleSheets[x].rules[z].selectorText==_2c){
return document.styleSheets[x].rules[z].style[css];
}
}
}
}
}
}
}
return "";
};
boa.getStyleValueByIdentifier=function(_2f,css){
var _31=false;
var x=document.styleSheets.length-1;
while(!_31&&x>=0){
rules=new Array();
sheet=document.styleSheets[x];
try{
if(sheet.cssRules){
rules=sheet.cssRules;
}else{
if(sheet.rules){
rules=sheet.rules;
}
}
}
catch(e){
}
var y=rules.length;
while(y>=0){
if(rules[y]&&rules[y].selectorText==_2f){
return rules[y].style[css];
}
y--;
}
x--;
}
};
boa.parseInt=function(i){
var x=parseInt(i);
if(isNaN(x)){
x=0;
}
return x;
};
boa.parseFloat=function(i){
var x=parseFloat(i);
if(isNaN(x)){
x=0;
}
return x;
};
boa.runAll=function(arr,arg){
for(var i in arr){
if(typeof arr[i]=="function"){
arr[i](arg);
}else{
log("non-function passed to runAll:",arr[i]);
}
}
};
boa.addDays=function(_3b,_3c){
var _3d=MochiKit.DateTime.isoDate(_3b);
_3d.setDate(_3d.getDate()+_3c);
return MochiKit.DateTime.toISODate(_3d);
};
boa.dateToStr=function(d){
if(typeof d!=Date){
d=MochiKit.DateTime.isoDate(d);
}
return boa.shortDayNames[d.getDay()]+" "+d.getDate()+" "+boa.shortMonthNames[d.getMonth()];
};
boa.min=function(a){
var min={index:-1,value:999999999999999};
for(var i in a){
if(a[i]<min.value){
min.index=i;
min.value=a[i];
}
}
return min;
};
boa.max=function(a){
var max={index:-1,value:-999999999999999};
for(var i in a){
if(a[i]>max.value){
max.index=i;
max.value=a[i];
}
}
return max;
};
boa.imageSrc=function(_45,src){
var MD=MochiKit.DOM;
var img=MD.getElement(_45);
if(img==null){
return;
}
img.src=src;
};
boa.leftPad=function(n,_4a,_4b){
if(!_4b){
_4b="0";
}
var _4c=String();
var mul=0;
for(var i=_4a-1;i>=0;i--){
mul=Math.pow(10,i);
if(n<mul){
_4c+=_4b;
}
}
_4c+=String(n);
return _4c;
};
boa.addWindowOnload=function(_4f){
if(!this.windowLoadingFuncs){
this.windowLoadingFuncs=[];
MochiKit.Signal.connect(window,"onload",partial(this.runAll,this.windowLoadingFuncs));
}
this.windowLoadingFuncs.push(_4f);
};
boa.addWindowOnUnload=function(_50){
if(!this.windowUnloadingFuncs){
this.windowUnloadingFuncs=[];
MochiKit.Signal.connect(window,"onunload",partial(this.runAll,this.windowUnloadingFuncs));
}
this.windowUnloadingFuncs.push(_50);
};
boa.setOpacity=function(_51,val){
_51.style.filter="alpha(opacity="+(val*100)+")";
_51.style.MozOpacity=val;
_51.style.opacity=val;
};
boa.setTop=function(obj,pos){
obj.style.top=pos+"px";
};
boa.setLeft=function(obj,pos){
obj.style.left=pos+"px";
};
boa.getAllInputElements=function(_57){
var _58=[];
var m=MochiKit.Base;
m.nodeWalk(_57,function(_5a){
var _5b=_5a.nodeName;
if(_5b=="INPUT"||_5b=="SELECT"){
_58.push(_5a);
return null;
}else{
if(_5b=="FORM"||_5b=="P"||_5b=="SPAN"||_5b=="DIV"){
return _5a.childNodes;
}
}
return _5a.childNodes;
});
return _58;
};
boa.toggleSelectedCheckboxes=function(_5c){
var arr=Array();
if(typeof (_5c)=="string"){
var MD=MochiKit.DOM;
arr=MD.getElementsByTagAndClassName(null,_5c);
}else{
arr=_5c;
}
if(arr.length>0){
for(var i in arr){
if(arr[i].checked){
arr[i].checked=false;
}else{
arr[i].checked=true;
}
}
}
};
boa.getSelectedOptions=function(_60){
if(typeof (_60)=="string"){
_60=MochiKit.DOM.$(_60);
}
var _61=new Array();
var _62=_60.getElementsByTagName("option");
for(var i=0;i<_62.length;i++){
if(_62[i].selected){
_61.push(_62[i]);
}
}
return _61;
};
boa.cloneSelectOptions=function(_64){
var _65=new Array();
for(i=0;i<_64.length;i++){
var _66=_64[i];
var _67=MochiKit.DOM.OPTION({"value":_66.value});
_67.innerHTML=_66.innerHTML;
_65.push(_67);
}
return _65;
};
boa.getAttribute=function(_68,_69,_6a){
var rez=MochiKit.DOM.getNodeAttribute(_68,_69);
if(rez===null){
rez=_6a;
}
return rez;
};
boa.getTagNodesFromNodeList=function(_6c){
return MochiKit.Iter.ifilter(function(_6d){
return (_6d.nodeType==1)?1:0;
},_6c);
};
boa.removeAllChildNodes=function(_6e){
while(_6e.firstChild){
_6e.removeChild(_6e.firstChild);
}
};
boa.objectToArray=function(obj){
var arr=new Array();
for(var i in obj){
arr.push(obj[i]);
}
return arr;
};
boa.windowHeight=function(){
var MS=MochiKit.Style;
var MD=MochiKit.DOM;
var _74=null;
if(MD.getElement("bottomMarker")){
_74=MS.getElementPosition("bottomMarker").y;
}else{
_74=document.height;
}
return _74;
};
boa.switchElementsDisplay=function(x,y){
$(x).style.display="none";
$(y).style.display="block";
};
boa.getDaysBetween=function(_77,_78){
var _79=24*60*60*1000;
var _7a=MochiKit.DateTime.isoDate(_77).getTime();
var _7b=MochiKit.DateTime.isoDate(_78).getTime();
var _7c=_7a-_7b;
var _7d=_7c/_79;
return Math.abs(parseInt(_7d));
};
boa.connectIfExists=function(_7e,_7f,_80,_81){
if($(_7e)){
return MochiKit.Signal.connect(_7e,_7f,_80,_81);
}
};
var welcomeBackPanel="welcomeBackPanel";
var signupPanel="signupPanel";
var signupPanelTitle="signupPanelTitle";
var signupPanelSubMenu="signupPanelSubMenu";
var remember=false;
var contractall_default=true;
var menu,titles,submenus,bypixels;
var heights=new Array();
var n=navigator.userAgent;
if(/Opera/.test(n)){
bypixels=2;
}else{
if(/Firefox/.test(n)){
bypixels=3;
}else{
if(/MSIE/.test(n)){
bypixels=2;
}
}
}
function slash_expandall(){
if(typeof menu!="undefined"){
submenus[0].style.display="";
submenus[0].style.height=heights[i]+"px";
}
}
function slash_contractall(){
if(typeof menu!="undefined"){
submenus[0].style.display="none";
submenus[0].style.height=0;
}
}
function profilemenu_init(){
if($(signupPanel)){
var MD=MochiKit.DOM;
var MS=MochiKit.Signal;
menu=Array();
titles=Array();
submenus=Array();
menu[0]=MD.getElement(signupPanel);
titles[0]=MD.getElement(signupPanelTitle);
submenus[0]=MD.getElement(signupPanelSubMenu);
if(submenus[0]==null){
return;
}
var _84=MD.getElement("welcomeBackPanel");
if(menu==null||titles==null){
return;
}
titles[0].onclick=gomenu;
heights[0]=submenus[0].offsetHeight;
submenus[0].style.height=submenus[0].offsetHeight+"px";
submenus[0].style.top="30px";
submenus[0].style.left="17px";
slash_contractall();
MS.connect(signupPanel,"onmouseover",profileMenuMouseOver);
MS.connect(signupPanel,"onmouseout",profileMenuMouseOut);
}
}
function profileMenuMouseOver(){
boa.appendClass(welcomeBackPanel,"mouseOver");
}
function profileMenuMouseOut(){
boa.removeClass(welcomeBackPanel,"mouseOver");
}
function gomenu(e){
if(!e){
var e=window.event;
}
var ce=(e.target)?e.target:e.srcElement;
if(!ce.nodeName||ce.nodeName!="DIV"){
return;
}
var sm=0;
if(parseInt(submenus[sm].style.height)>parseInt(heights[sm])-2){
hidemenu(sm);
}else{
if(parseInt(submenus[sm].style.height)<2){
showmenu(sm);
}
}
}
function hidemenu(sm){
var nr=submenus[sm].getElementsByTagName("a").length*bypixels;
submenus[sm].style.height=(parseInt(submenus[sm].style.height)-nr)+"px";
var to=setTimeout("hidemenu("+sm+")",30);
if(parseInt(submenus[sm].style.height)<=nr){
clearTimeout(to);
submenus[sm].style.display="none";
submenus[sm].style.height="0px";
}
}
function showmenu(sm){
var nr=submenus[sm].getElementsByTagName("a").length*bypixels;
submenus[sm].style.display="";
submenus[sm].style.height=(parseInt(submenus[sm].style.height)+nr)+"px";
var to=setTimeout("showmenu("+sm+")",30);
if(parseInt(submenus[sm].style.height)>(parseInt(heights[sm])-nr)){
clearTimeout(to);
submenus[sm].style.height=heights[sm]+"px";
}
}
function getElementsByClassName(_8e,_8f,_90){
if(_90==null){
return;
}
var _91=(_8f=="*"&&document.all)?document.all:_90.getElementsByTagName(_8f);
var _92=new Array();
_8e=_8e.replace(/\-/g,"\\-");
var _93=new RegExp("(^|\\s)"+_8e+"(\\s|$)");
var _94;
for(var i=0;i<_91.length;i++){
_94=_91[i];
if(_93.test(_94.className)){
_92.push(_94);
}
}
return (_92);
}
boa.addWindowOnload(profilemenu_init);
function ToggleCats(_96){
var $=MochiKit.DOM.$;
$("doSee").style.display="none";
$("barsRest").style.display="none";
$("placesToStay").style.display="none";
$("cityReview").style.display="none";
$(_96).style.display="block";
$("doSeeCat").className="inactiveCatHeading";
$("barsRestCat").className="inactiveCatHeading";
$("placesToStayCat").className="inactiveCatHeading";
$("cityReviewCat").className="inactiveCatHeading";
var _98=_96+"Cat";
$(_98).className="activeCatHeading";
}
function ToggleVisible(_99,_9a){
var $=MochiKit.DOM.$;
var el=$(_99);
if(!el){
return;
}
var _9d=MochiKit.Style.getStyle(el,"display");
if((_9a==null&&_9d=="none")||_9a==true){
MochiKit.Style.setStyle(el,{"display":"block"});
}else{
if(_9a==null||_9a==false){
MochiKit.Style.setStyle(el,{"display":"none"});
}
}
}
function sniffBrowsers(){
ns4=document.layers;
op5=(navigator.userAgent.indexOf("Opera 5")!=-1)||(navigator.userAgent.indexOf("Opera/5")!=-1);
op6=(navigator.userAgent.indexOf("Opera 6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1);
agt=navigator.userAgent.toLowerCase();
mac=(agt.indexOf("mac")!=-1);
ie=(agt.indexOf("msie")!=-1);
mac_ie=mac&&ie;
}
function getElementHeight(_9e){
xPos=_9e.offsetHeight;
return parseInt(xPos);
}
function getElementTop(_9f){
yPos+=_9f.offsetTop;
return parseInt(yPos);
}
boa.addWindowOnload(sniffBrowsers);
var displayErrorPane=false;
function showErrorPane(){
ToggleVisible("errorPane",true);
}
if(window.location.protocol=="https:"){
document.write("<scr"+"ipt type=\"text/javascript\" src=\"https://ssl.google-analytics.com/urchin.js\" language=\"Javascript\"></script>");
}else{
document.write("<scr"+"ipt type=\"text/javascript\" src=\"http://www.google-analytics.com/urchin.js\" language=\"Javascript\"></script>");
}
function doUrchinTracker(){
_uacct="UA-1762034-2";
_udn="boo.com";
if(typeof (urchinTracker)!="undefined"){
urchinTracker();
}else{
MochiKit.Async.callLater(doUrchinTracker,3);
}
}
boa.addWindowOnload(doUrchinTracker);
boa.commLayer=function(_a0){
this.targetURL=_a0;
this.callbacks=[];
this.errbacks=[];
this.parameters={};
MochiKit.Base.bindMethods(this);
};
boa.commLayerExt=function(_a1){
if(typeof _a1=="undefined"){
_a1=Math.random();
}
this.threadId=_a1;
this.targetURL="/dynamic/ActionHandler.php";
this.callbacks=[];
this.errbacks=[];
this.parameters={};
this.commToken="";
if($("__commToken")){
this.commToken=$("__commToken").value;
}
MochiKit.Base.bindMethods(this);
};
boa.commLayerExt.prototype=MochiKit.Base.clone(boa.commLayer.prototype);
boa.commLayerExt.prototype.setController=function(_a2){
this.parameters["controller"]=_a2;
};
boa.commLayerExt.prototype.setAction=function(_a3){
this.parameters["action"]=_a3;
};
boa.commLayerExt.prototype.setParameters=function(_a4){
this.parameters["parameters"]=_a4;
};
boa.commLayerExt.prototype._xCallback=function(req){
this._result=new boa.comm.result(req.responseText);
this._result.threadId=this.threadId;
if(this._result){
if(this._result.error){
this._setError(this._result.error);
}else{
boa.runAll(this.callbacks,this._result);
}
}else{
var _a6={type:"CRIT",desc:"result interpretation error"};
this._setError(_a6);
}
};
boa.commLayer.prototype.setCallbacks=function(_a7,_a8){
this.callbacks=[];
this.callbacks.push(_a7);
this.errbacks.push(_a8);
};
boa.commLayer.prototype._xCallback=function(req){
this._result=new boa.comm.result(req.responseText);
if(this._result){
if(this._result.error){
this._setError(this._result.error);
}else{
boa.runAll(this.callbacks,this._result);
}
}else{
var _aa={type:"CRIT",desc:"result interpretation error"};
this._setError(_aa);
}
};
boa.commLayer.prototype._xErrback=function(err){
var _ac={type:"CRIT",desc:"Communication level error",data:err};
this._setError(_ac);
};
boa.commLayer.prototype._setError=function(_ad){
boa.runAll(this.errbacks,_ad);
};
boa.commLayer.prototype.addParameter=function(_ae,_af){
this.parameters[_ae]=_af;
};
boa.commLayer.prototype.cancel=function(){
if(this.request){
this.request.cancel();
}
};
boa.commLayer.prototype.sendRequest=function(){
this.cancel();
this.request=boa.doSimplePostXMLHttpRequest(this.targetURL,{"__commLink":boa.serialize(this.parameters),"__commToken":this.commToken});
this.request.addCallbacks(this._xCallback,this._xErrback);
};
boa.comm={};
boa.comm.result=function(_b0){
var _b1=eval("("+_b0+")");
_b1=boa.unEscapeEvalObject(_b1);
this.items=_b1.items;
this.length=_b1.itemCount;
this.error=_b1.error;
};
boa.comm.result.prototype.getValue=function(_b2){
return this.items[_b2];
};
function BooAnalyticsClickController(){
this.constructor=function(){
this.signal=MochiKit.Signal;
this.elSearchers=new Array("tag-cloud","take-tour","resultsTable");
this.elSearchersSearch=new Array("searchBooInput");
this.elLookers=new Array("sp3GoArrowButton");
this.elClickers=new Array("ppcLink","ppcLink2","propertyURL","mapPPCLink_1","mapPPCLink_2","mapPPCLink_3","mapPPCLink_4","recPPCLink_1","recPPCLink_2","recPPCLink_3","recPPCLink_4");
this.elBookers=new Array();
this.signalSearchers=new Array(this.elSearchers.length);
this.signalSearchersSearch=new Array(this.elSearchersSearch.length);
this.signalLookers=new Array(this.elLookers.length);
this.signalBookers=new Array(this.elBookers.length);
this.signalClickers=new Array(this.elClickers.length);
if($("tag-cloud")){
this.incrementVisitors(null);
}
for(i=0;i<this.elSearchers.length;i++){
if($(this.elSearchers[i])){
this.signalSearchers[i]=this.signal.connect(this.elSearchers[i],"onclick",this,this.incrementSearchers);
}
}
for(i=0;i<this.elSearchersSearch.length;i++){
if($(this.elSearchersSearch[i])){
this.signalSearchersSearch[i]=this.signal.connect(this.elSearchersSearch[i],"onkeydown",this,this.incrementSearchersSearch);
}
}
for(i=0;i<this.elLookers.length;i++){
if($(this.elLookers[i])!=null){
this.signalLookers[i]=this.signal.connect(this.elLookers[i],"onclick",this,this.incrementLookers);
}
}
for(i=0;i<this.elBookers.length;i++){
if($(this.elBookers[i])){
this.signalBookers[i]=this.signal.connect(this.elBookers[i],"onclick",this,this.incrementBookers);
}
}
for(i=0;i<this.elClickers.length;i++){
if($(this.elClickers[i])){
this.signalClickers[i]=this.signal.connect(this.elClickers[i],"onclick",this,this.incrementClickers);
}
}
};
this.disconnect=function(tab){
for(i=0;tab&&i<tab.length;i++){
if(tab[i]){
this.signal.disconnect(tab[i]);
}
}
};
this.incrementValue=function(_b4){
comm=new boa.commLayerExt();
comm.setController("BooAnalyticsClickController");
comm.setParameters([_b4]);
comm.setAction("incrementValue");
comm.sendRequest();
};
this.incrementVisitors=function(_b5){
this.incrementValue("Visitors");
};
this.incrementSearchers=function(_b6){
this.incrementValue("Searchers");
this.disconnect(this.signalSearchers);
};
this.incrementSearchersSearch=function(_b7){
if(_b7.key().string=="KEY_ENTER"){
this.incrementSearchers(_b7);
this.disconnect(this.signalSearchersSearch);
}
};
this.incrementLookers=function(_b8){
this.incrementValue("Lookers");
this.disconnect(this.signalLookers);
};
this.incrementBookers=function(_b9){
this.incrementValue("Bookers");
this.disconnect(this.signalBookers);
};
this.incrementClickers=function(_ba){
this.incrementValue("Clickers");
this.disconnect(this.signalClickers);
};
}
function initBooAnalyticsClickController(){
var _bb=new BooAnalyticsClickController().constructor();
}
boa.addWindowOnload(initBooAnalyticsClickController);
function shimmyShim(_bc){
if(navigator.userAgent.indexOf("MSIE")!=-1){
var _bd=document.createElement("<iframe scrolling='no' frameborder='0' id='shim"+_bc.id+"' "+"style='position:absolute; top:0px;"+"left:0px; display:block; "+"width: 100%; z-index:-1;' src='javascript:false'><iframe>");
_bd.style.height=_bc.offsetHeight;
_bd.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
var _be=_bc.appendChild(_bd);
}
}
var log=MochiKit.Logging.logDebug;
boosearch=function(id,_c0){
MD=MochiKit.DOM;
MB=MochiKit.Base;
MS=MochiKit.Signal;
MB.bindMethods(this);
this.options=[];
this.parameters=[];
this.matchesShown=0;
this.selectedMatch=0;
this.searchConstraint="";
this.hiddenResults=new Array();
this.results=new Array();
this.extendedData=new Array();
this.searchComm=new boa.commLayerExt();
if(typeof _c0!="undefined"){
this.options=_c0;
}
this.initialiseRemainingOptions();
this.searchType=this.options.defaultSearchType;
this.citiesOnly=this.options.citiesOnly;
this.withContent=this.options.withContent;
this.domNode=MD.$(id);
this.resultsContainer=this.options.resultsContainer;
this.form=MD.$(this.options.formId);
this.hiddenResultNode=MD.$(this.options.hiddenResultNodeId);
if(!this.options.resultsWidth){
this.options.resultsWidth=MochiKit.Style.elementDimensions(this.domNode).w;
}
this.searchStringList=[];
this.searchString="";
this.oldSearchString=this.searchString;
MD.setNodeAttribute(this.domNode,"autocomplete","off");
this.keyUp=MS.connect(this.domNode,"onkeyup",this.checkKeyPressed);
this.keyDown=MS.connect(this.domNode,"onkeydown",this.checkKeyPressed);
this.enabled=true;
if(this.options.focusListener){
MS.connect(this.domNode,"onclick",this.options.focusListener);
}
MS.connect(this.domNode,"onblur",this.lostFocus);
};
boosearch.prototype.togglePower=function(_c1){
if(typeof _c1!="undefined"&&_c1==true){
if(this.enabled){
return;
}
}else{
if(!this.enabled){
return;
}
}
if(this.enabled){
MS.disconnect(this.keyUp);
MS.disconnect(this.keyDown);
this.enabled=false;
}else{
this.keyUp=MS.connect(this.domNode,"onkeyup",this.checkKeyPressed);
this.keyDown=MS.connect(this.domNode,"onkeydown",this.checkKeyPressed);
this.enabled=true;
}
};
boosearch.prototype.initialiseRemainingOptions=function(){
if(typeof this.options.minCharsForSearch=="undefined"){
this.options.minCharsForSearch=3;
}
if(typeof this.options.searchTrigger=="undefined"){
this.options.searchTrigger="onkeyup";
}
if(typeof this.options.listExtension=="undefined"){
this.options.listExtension={allow:false};
}
if(typeof this.options.maxResultsShown=="undefined"){
this.options.maxResultsShown=100;
}
if(typeof this.options.defaultSearchType=="undefined"){
this.options.defaultSearchType="searchLocations";
}
if(typeof this.options.showListLimitNotice=="undefined"){
this.options.showListLimitNotice=true;
}
if(typeof this.options.extendedTabs=="undefined"){
this.options.extendedTabs={load:false};
}
if(typeof this.options.listener=="undefined"){
this.options.listener={load:false};
}
if(typeof this.options.searchLanguage=="undefined"){
this.options.searchLanguage="en";
}
};
boosearch.prototype.checkKeyPressed=function(evt){
var key=evt.key().code;
this.searchStringList=this.domNode.value.split(",");
this.searchString=this.searchStringList[0];
if(this.matchesShown==0&&this.options.searchTrigger=="external"&&key!=13){
return;
}
if(this.matchesShown==0&&this.options.searchTrigger=="external"&&key==13&&evt.type()=="keydown"){
this.getResults();
evt.stop();
return false;
}
if(key==9||key==13){
if(evt.type()=="keydown"&&this.matchesShown){
var _c4=this.selectedMatch;
this.lastSelectedMatch=this.selectedMatch;
this.completeSelected();
log("tab or enter - choice not 0");
if(this.options.listener&&this.options.listener.load==true){
this.options.listener.call();
}
}
evt.stop();
return false;
}
if(this.hiddenResultNode){
this.hiddenResultNode.value="";
}
if(this.matchesShown&&key){
if((key==40||key==39)){
if(evt.type()=="keydown"){
this.changeSelectedMatch(1);
}
}else{
if((key==38||key==37)){
if(evt.type()=="keydown"){
this.changeSelectedMatch(-1);
}
}else{
if(this.searchString.length>=this.options.minCharsForSearch&&evt.type()=="keyup"){
this.startGetResults();
}else{
if(this.searchString.length<this.options.minCharsForSearch&&key==8){
this.hideMatches();
}
}
}
}
return true;
}else{
if(this.searchString.length>=this.options.minCharsForSearch&&evt.type()=="keyup"){
this.startGetResults();
}else{
this.hideMatches();
}
}
return true;
};
boosearch.prototype.changeSelectedMatch=function(num){
if(MD.$(this.domNode.id+"result"+this.selectedMatch)){
MD.removeElementClass(this.domNode.id+"result"+this.selectedMatch,this.options.selectedResultClass);
}
if(this.matchesShown-1<this.selectedMatch+num){
this.selectedMatch=this.matchesShown-1;
}else{
if(this.selectedMatch+num<0){
this.selectedMatch=0;
}else{
this.selectedMatch+=num;
}
}
MD.addElementClass(this.domNode.id+"result"+this.selectedMatch,this.options.selectedResultClass);
};
boosearch.prototype.startGetResults=function(){
if(this.timed){
this.timed.cancel();
}
this.timed=MochiKit.Async.callLater(0.3,this.getResults);
};
boosearch.prototype.getResults=function(){
if(this.options.searchTrigger!="onkeyup"){
this.searchStringList=this.domNode.value.split(",");
this.searchString=this.searchStringList[0];
}
var _c6=[];
if(this.options.extendedTabs&&this.options.extendedTabs.load==true){
if(this.options.extendedTabs.tabList.properties){
_c6.push("properties");
}
if(this.options.extendedTabs.tabList.locations){
_c6.push("locations");
}
if(this.options.extendedTabs.tabList.users){
_c6.push("users");
}
if(this.options.extendedTabs.tabList.barsRest){
_c6.push("barsRest");
}
if(this.options.extendedTabs.tabList.todo){
_c6.push("todo");
}
}
if(_c6.length==0){
_c6.push("locations");
}
this.parameters[0]=_c6;
this.parameters[1]=this.searchString;
this.parameters[2]=this.options.searchLanguage;
this.parameters[3]=this.searchConstraint;
this.parameters[4]=typeof this.poiConstraintCat!="undefined"?this.poiConstraintCat:"";
this.parameters[5]=this.options.citiesOnly;
this.parameters[6]=this.options.withContent;
if(this.searchString!=this.oldSearchString&&this.searchString.length>=this.options.minCharsForSearch){
this.sendSearchRequest();
}
this.oldSearchString=this.searchString;
};
boosearch.prototype.showMatches=function(_c7){
if(_c7.length==0){
if(this.options.emptyResultsFallback){
this.options.emptyResultsFallback();
}
}
var _c8=_c7.getValue("results");
this.results=boa.objectToArray(_c8);
if(this.results.length==0){
if(this.options.emptyResultsFallback){
this.options.emptyResultsFallback();
}
}
var _c9=_c7.getValue("categoryCounts");
if(this.results.length>0||_c9.locations>0||_c9.users>0||_c9.properties>0||_c9.barsRest>0||_c9.todo>0){
if(this.options.resultsListener){
this.options.resultsListener();
}
if(!(this.results.length==1&&this.results[0]==this.searchString)){
var _ca=new Array();
this.matchesShown=Math.min(this.results.length,this.options.maxResultsShown);
if(this.options.extendedTabs){
var _cb="";
switch(this.searchType){
case "searchLocations":
_cb="locations";
break;
case "searchProperties":
_cb="properties";
break;
case "searchUsers":
_cb="users";
break;
case "searchPOI":
if(this.poiConstraintCat==2){
_cb="barsRest";
}else{
_cb="todo";
}
break;
}
if(_cb!=""&&_c9[_cb]==0){
this.manageTabFallback(_c9);
}
}
for(i=0;i<this.matchesShown;i++){
if(typeof this.results[i].extendedData!="undefined"){
this.extendedData[i]=this.results[i].extendedData;
}else{
this.extendedData[i]="";
}
this.hiddenResults[i]=this.results[i].idEntities;
this.results[i]=this.results[i].displayText;
if(i==this.selectedMatch){
var _cc=A({"class":"searchLink "+this.options.selectedResultClass,"id":this.domNode.id+"result"+i},this.results[i]);
MS.connect(_cc,"onclick",this.onResultClick);
var _cd=DIV({"class":"resultDiv"},_cc);
_ca[i]=_cd;
}else{
var _cc=A({"class":"searchLink","id":this.domNode.id+"result"+i},this.results[i]);
MS.connect(_cc,"onclick",this.onResultClick);
var _cd=DIV({"class":"resultDiv"},_cc);
_ca[i]=_cd;
}
}
if(this.options.listExtension.allow==true&&MochiKit.DOM.$(this.options.listExtension.node)){
var _ce=[];
for(var x=0;x<this.options.listExtension.listData.length;x++){
var _cc=A({"class":"searchLink"},this.options.listExtension.listData[x].html);
var _cd=DIV({"class":"resultDiv"},_cc);
_ce[x]=_cd;
MS.connect(_ce[x],"onclick",this.hideMatches);
if(typeof this.options.listExtension.listData[x].listener!="undefined"){
MS.connect(_ce[x],"onclick",this.options.listExtension.listData[x].listener);
}
}
MochiKit.DOM.replaceChildNodes(this.options.listExtension.node,_ce);
}
if(this.options.showListLimitNotice&&this.results.length>this.matchesShown){
var _cc=A({"class":"searchLink"},"More results found, please narrow your search.");
var _cd=DIV({"class":"resultDiv","id":this.domNode.id+"_moreResults","style":"font-style:italic; color:black; cursor: pointer;"},_cc);
_ca[++i]=_cd;
}
MD.replaceChildNodes(this.resultsContainer,_ca);
if(this.options.extendedTabs&&this.options.extendedTabs.load==true){
var _d0=[];
this.loadTabExtension(_d0,_c9,"locations");
this.loadTabExtension(_d0,_c9,"users");
this.loadTabExtension(_d0,_c9,"properties");
this.loadTabExtension(_d0,_c9,"barsRest",2);
this.loadTabExtension(_d0,_c9,"todo",5);
MD.replaceChildNodes(MD.$(this.options.extendedTabs.container),_d0);
}
MochiKit.Style.setStyle(this.options.mainResultsContainer,{"display":"block"});
shimmyShim(MD.$(this.resultsContainer));
}else{
this.results=new Array();
}
}else{
if(this.matchesShown){
this.hideMatches();
}
}
};
boosearch.prototype.manageTabFallback=function(_d1){
switch(this.searchType){
case "searchLocations":
if(_d1.locations==0){
var _d2="searchLocations";
this.findTabFallback(_d2,_d1);
}
break;
case "searchProperties":
if(_d1.properties==0){
var _d2="searchProperties";
this.findTabFallback(_d2,_d1);
}
break;
case "searchUsers":
if(_d1.users==0){
var _d2="searchUsers";
this.findTabFallback(_d2,_d1);
}
break;
case "searchPOI":
if(_d1.barsRest==0||_d1.todo==0){
var _d2="searchPOI";
this.findTabFallback(_d2,_d1);
}
break;
default:
break;
}
};
boosearch.prototype.findTabFallback=function(_d3,_d4){
if(_d3!="searchUsers"&&this.options.extendedTabs.tabList["users"]&&_d4.users>0){
if(this.options.extendedTabs.tabList["users"].autoSelectListener){
this.options.extendedTabs.tabList["users"].autoSelectListener();
}
this.changeSearchType("searchUsers");
}else{
if(_d3!="searchProperties"&&this.options.extendedTabs.tabList["properties"]&&_d4.properties>0){
if(this.options.extendedTabs.tabList["properties"].autoSelectListener){
this.options.extendedTabs.tabList["properties"].autoSelectListener();
}
this.changeSearchType("searchProperties");
}else{
if(_d3!="searchLocations"&&this.options.extendedTabs.tabList["locations"]&&_d4.locations>0){
if(this.options.extendedTabs.tabList["locations"].autoSelectListener){
this.options.extendedTabs.tabList["locations"].autoSelectListener();
}
this.changeSearchType("searchLocations");
}else{
if(_d3!="searchPOI"&&this.options.extendedTabs.tabList["barsRest"]&&_d4.barsRest>0){
if(this.options.extendedTabs.tabList["barsRest"].autoSelectListener){
this.options.extendedTabs.tabList["barsRest"].autoSelectListener();
}
this.changeSearchType("searchPOI",2);
}else{
if(_d3!="searchPOI"&&this.options.extendedTabs.tabList["todo"]&&_d4.todo>0){
if(this.options.extendedTabs.tabList["todo"].autoSelectListener){
this.options.extendedTabs.tabList["todo"].autoSelectListener();
}
this.changeSearchType("searchPOI",5);
}
}
}
}
}
};
boosearch.prototype.loadTabExtension=function(_d5,_d6,_d7,_d8){
if(this.options.extendedTabs.tabList[_d7]&&_d6[_d7]>0){
var _d9=MD.IMG({"src":this.options.extendedTabs.tabList[_d7].icon,"alt":this.options.extendedTabs.tabList[_d7].alt,"title":this.options.extendedTabs.tabList[_d7].title});
var _da=MD.SPAN({"class":"resultsTabTxt"},_d6[_d7]);
if(typeof this.selectedTab=="undefined"){
this.selectedTab=_d7;
}
var _db="resultsTabBox";
if(this.selectedTab==_d7){
_db="resultsTabBoxOn";
}
var _dc=MD.DIV({"class":_db,"id":_d7+"Tab"},_d9,_da);
_d8=_d8!="undefined"?_d8:-1;
MS.connect(_dc,"onclick",MochiKit.Base.partial(this.tabClicked,_d7,_d8));
_d5.push(_dc);
}
};
boosearch.prototype.tabClicked=function(_dd,_de){
this.selectedTab=_dd;
if(typeof _de!=-1){
this.changeSearchType(this.options.extendedTabs.tabList[_dd].controllerAction,_de);
}else{
this.changeSearchType(this.options.extendedTabs.tabList[_dd].controllerAction);
}
if(this.options.extendedTabs.tabList[_dd].listener){
this.options.extendedTabs.tabList[_dd].listener();
}
};
boosearch.prototype.changeSearchType=function(_df,poi){
if(typeof poi!="undefined"&&typeof poi!="object"){
var _e1=this.poiConstraintCat;
this.poiConstraintCat=poi;
this.parameters[4]=poi;
}else{
this.poiConstraintCat="";
}
if(this.searchType!=_df||(typeof this.poiConstraintCat!=""&&_e1!=poi)){
this.searchType=_df;
var _e2=new String(this.domNode.value);
if(_e2.length>=this.options.minCharsForSearch){
this.sendSearchRequest();
}
}
};
boosearch.prototype.updateSearchConstraint=function(_e3){
this.searchConstraint=_e3;
};
boosearch.prototype.getChoiceId=function(){
return this.hiddenResultNode.value;
};
boosearch.prototype.sendSearchRequest=function(){
if(this.options.searchStartedListener){
this.options.searchStartedListener();
}
this.searchComm.setController("BooSearchController");
this.searchComm.setAction(this.searchType);
this.searchComm.setParameters(this.parameters);
this.searchComm.setCallbacks(this.showMatches,this.hideMatches);
this.searchComm.sendRequest();
};
boosearch.prototype.completeSelected=function(){
if(this.results[this.selectedMatch]){
this.domNode.value=this.results[this.selectedMatch];
}
if(this.hiddenResults[this.selectedMatch]){
this.hiddenResultNode.value=this.hiddenResults[this.selectedMatch];
}
this.selectedMatch=0;
this.hideMatches();
this.postCompleteSelected();
};
boosearch.prototype.postCompleteSelected=function(){
log("selected");
};
boosearch.prototype.hideMatches=function(){
MochiKit.Style.setStyle(this.options.mainResultsContainer,{"display":"none"});
MD.replaceChildNodes(MD.$(this.options.resultsContainer));
if(this.options.extendedTabs&&this.options.extendedTabs.load==true){
MD.replaceChildNodes(MD.$(this.options.extendedTabs.container));
}
if(this.matchesShown){
MS.disconnect(this.resultsMouseOver);
MS.disconnect(this.resultsMouseOut);
this.matchesShown=0;
this.searchString="";
this.oldSearchString="";
}
};
boosearch.prototype.onResultClick=function(evt){
this.selectedMatch=parseInt(evt.target().id.replace(this.domNode.id+"result",""));
this.lastSelectedMatch=this.selectedMatch;
if(evt.target().tagName=="A"&&evt.target().id!=this.domNode.id+"_moreResults"){
this.completeSelected();
if(this.options.listener&&this.options.listener.load==true){
this.options.listener.call();
}
}
};
boosearch.prototype.lostFocus=function(){
};
boosearch.prototype.getSelectedMatchExtendedData=function(){
if(typeof this.extendedData[this.lastSelectedMatch]!="undefined"){
return this.extendedData[this.lastSelectedMatch];
}
return false;
};
boosearchwidget=function(){
this.searchOptions={mainResultsContainer:"mainResultsContainer",resultsContainer:"resultsTable",selectedResultClass:"selectedResult",hiddenResultNodeId:"idEntities",defaultSearchType:"searchLocations",citiesOnly:"",withContent:"",searchStartedListener:function(){
MochiKit.Style.setStyle("searchButtonDone",{"display":"none"});
MochiKit.Style.setStyle("searchButtonLoading",{"display":"block"});
},emptyResultsFallback:function(){
MochiKit.Style.setStyle("searchHelp",{"display":"block"});
MochiKit.Style.setStyle("searchButtonDone",{"display":"block"});
MochiKit.Style.setStyle("searchButtonLoading",{"display":"none"});
},focusListener:function(){
MochiKit.DOM.$("searchBooInput").value="";
MochiKit.Style.setStyle("searchHelp",{"display":"none"});
},resultsListener:function(){
MochiKit.Style.setStyle("searchHelp",{"display":"none"});
MochiKit.Style.setStyle("searchButtonDone",{"display":"block"});
MochiKit.Style.setStyle("searchButtonLoading",{"display":"none"});
},extendedTabs:{container:"tabs",load:true,tabList:{properties:{allow:true,icon:"/images/boo/Top-Left/images/seachtab_icon_accomm.gif",alt:"Places to stay",title:"Places to stay",listener:function(){
MochiKit.DOM.$("idCategories").value="properties";
},autoSelectListener:function(){
log("updatin categories to properties");
MochiKit.DOM.$("idCategories").value="properties";
},controllerAction:"searchProperties"},todo:{allow:true,icon:"/images/boo/Top-Left/images/seachtab_icon_siteseeing.gif",alt:"Things to do",title:"Things to do",listener:function(){
MochiKit.DOM.$("idCategories").value="todo";
},autoSelectListener:function(){
log("updatin categories to todo");
MochiKit.DOM.$("idCategories").value="todo";
},controllerAction:"searchPOI"},barsRest:{allow:true,icon:"/images/boo/Top-Left/images/seachtab_icon_restandbars.gif",alt:"Bars and restaurants",title:"Bars and restaurants",listener:function(){
MochiKit.DOM.$("idCategories").value="barsRest";
},autoSelectListener:function(){
log("updatin categories to barsRest");
MochiKit.DOM.$("idCategories").value="barsRest";
},controllerAction:"searchPOI"},users:{allow:true,icon:"/images/boo/Top-Left/images/seachtab_icon_users.gif",alt:"Boo Members",title:"Boo Members",listener:function(){
MochiKit.DOM.$("idCategories").value="users";
},autoSelectListener:function(){
log("updatin categories to users");
MochiKit.DOM.$("idCategories").value="users";
},controllerAction:"searchUsers"},locations:{allow:true,icon:"/images/boo/Top-Left/images/seachtab_icon_destination.gif",alt:"Destinations",title:"Destinations",listener:function(){
MochiKit.DOM.$("idCategories").value="locations";
},autoSelectListener:function(){
log("updatin categories to locations");
MochiKit.DOM.$("idCategories").value="locations";
},controllerAction:"searchLocations"}}},listener:{load:true,call:function(){
var _e5=window.dropdown.getSelectedMatchExtendedData();
if(_e5!=false){
MochiKit.DOM.$("entityType").value=_e5;
}
MochiKit.DOM.$("searchForm").submit();
}}};
window.dropdown=new boosearch("searchBooInput",this.searchOptions);
};
boa.addWindowOnload(function(){
if(!MochiKit.DOM.$("mainResultsContainer")){
return;
}
if($("closeMessageBubbleSearch")){
MochiKit.Signal.connect("closeMessageBubbleSearch","onclick",function(){
MochiKit.Style.setStyle("searchHelp",{"display":"none"});
});
MochiKit.DOM.$("idCategories").value="locations";
window.boosearchwidget=new boosearchwidget();
}
MochiKit.Signal.connect(document,"onmousedown",function(evt){
if(!window.mainClicked&&!window.searchClicked){
window.dropdown.hideMatches();
window.mainClicked=false;
window.searchClicked=false;
}else{
window.mainClicked=false;
window.searchClicked=false;
}
});
MochiKit.Signal.connect("mainResultsContainer","onmousedown",function(){
window.mainClicked=true;
});
if(MochiKit.DOM.$("searchButtonDone")){
MochiKit.Signal.connect("searchButtonDone","onmousedown",function(){
window.searchClicked=true;
});
}
});
boa.simpleCalendar=function(_e7,_e8){
if(_e8){
this.invalidClass=_e8.invalidClass;
this.month=_e8.month;
this.titleClass=_e8.titleClass;
this.dayNamesClass=_e8.dayNamesClass;
this.selectClass=_e8.selectClass;
}else{
this.invalidClass="";
}
this.initialise(_e7);
};
boa.simpleCalendar.prototype.initialise=function(_e9){
this.domNode=$(_e9);
MochiKit.Base.bindMethods(this);
this.defaultSettings();
this.appendChildren();
this.buildDays();
this.buildCalendarTable();
this.addMainEvents();
};
boa.simpleCalendar.sharedRowCache={};
boa.simpleCalendar.prototype.defaultSettings=function(){
this.startOfWeek=1;
this.numWeeks=6;
this.dayNames=new Array("Su","Mo","Tu","We","Th","Fr","Sa");
this.monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
this.idPrefix=this.domNode.id+"*";
this.initDates();
this.lastSelected=null;
this.rowCache={};
};
boa.simpleCalendar.dateCache={};
boa.simpleCalendar.prototype.initDates=function(){
this.dateToday=new Date();
this.dateToday.setHours(0);
this.dateToday.setMinutes(0);
this.dateToday.setSeconds(0);
this.dateToday.setMilliseconds(0);
this.setDefaultDate();
};
boa.simpleCalendar.prototype.setDefaultDate=function(){
this.defaultDate=new Date();
this.defaultDate.setDate(1);
if(this.month){
this.defaultDate.setMonth(this.month-1);
}else{
this.month=this.defaultDate.getMonth()+1;
}
this.defaultDate.setHours(0);
this.defaultDate.setMinutes(0);
this.defaultDate.setSeconds(0);
};
boa.simpleCalendar.prototype.appendChildren=function(){
var MD=MochiKit.DOM;
this.monthYearNameTitle=MD.TH({"colspan":7});
this.monthYearNameNode=MD.THEAD({"class":this.titleClass},MD.TR({},this.monthYearNameTitle));
this.dayNamesNode=MD.TBODY();
this.calendarNode=MD.TBODY();
MD.replaceChildNodes(this.domNode,this.monthYearNameNode,this.dayNamesNode,this.calendarNode);
};
boa.simpleCalendar.prototype.addMainEvents=function(){
boa.disableTextSelection(this.domNode);
this.onClick=MochiKit.Signal.connect(this.domNode,"onclick",this,this.calClick);
};
boa.simpleCalendar.prototype.selectDate=function(d){
this.deselect();
var _ec=$(this.idPrefix+d);
if(_ec){
_ec.className=this.selectClass;
this.lastSelected=_ec;
this.domNode.value=d;
}
};
boa.simpleCalendar.prototype.calClick=function(evt){
if(evt.target().nodeName=="A"){
var _ee=evt.target().parentNode;
this.deselect();
_ee.className=this.selectClass;
this.lastSelected=_ee;
this.domNode.value=this.getDateFromID(_ee.id);
MochiKit.Signal.signal(this.domNode,"onchange");
}
};
boa.simpleCalendar.prototype.deselect=function(){
if(this.lastSelected!=null){
this.lastSelected.className="";
this.domNode.value="";
}
};
boa.simpleCalendar.prototype.getDateFromID=function(id){
return String(id).substr(this.idPrefix.length);
};
boa.simpleCalendar.prototype.buildCalendarTable=function(){
var MD=MochiKit.DOM;
var MB=MochiKit.Base;
var MDT=MochiKit.DateTime;
this.setMonthTitle();
var _f3=new Date(this.defaultDate);
if(_f3.getDay()==0){
_f3.setDate(_f3.getDate()-7);
}
_f3.setDate(_f3.getDate()-(_f3.getDay()-this.startOfWeek));
this.firstDate=new Date(_f3);
var x=0;
var _f5=new Array();
var _f6=new Array();
var _f7;
if(!this.rowCache[this.month]){
for(var j=0;j<this.numWeeks;j++){
var _f9=new Array();
for(var i=0;i<7;i++){
var _fb=MDT.toISODate(_f3);
var id=this.idPrefix+_fb;
if((this.invalidClass)&&((_f3.getMonth()!=this.defaultDate.getMonth())||(_f3<this.dateToday))){
var _fd={"class":this.invalidClass};
_f9[i]=MD.TD(_fd,_f3.getDate());
}else{
var _fd={"id":id};
_f9[i]=MD.TD(_fd,MD.A({"href":"javascript:void(null);"},_f3.getDate()));
_f6.push(_fb);
}
_f3.setDate(_f3.getDate()+1);
}
_f5[j]=MD.TR(null,_f9);
}
boa.simpleCalendar.dateCache[this.month]=_f6;
this.rowCache[this.month]=_f5;
}
MD.replaceChildNodes(this.calendarNode,this.rowCache[this.month]);
};
boa.simpleCalendar.prototype.setMonthTitle=function(){
this.monthYearNameTitle.innerHTML=this.monthNames[this.defaultDate.getMonth()]+" "+this.defaultDate.getFullYear();
};
boa.simpleCalendar.prototype.buildDays=function(){
var md=MochiKit.DOM;
var mb=MochiKit.Base;
var _100=[];
for(var i=this.startOfWeek;i<this.startOfWeek+7;i++){
_100.push(this.dayNames[i%7]);
}
var _102={};
if(this.dayNamesClass){
_102["class"]=this.dayNamesClass;
}
md.replaceChildNodes(this.dayNamesNode,md.TR(_102,mb.map(mb.partial(md.TH,{"class":this.dayNamesClass,"scope":"col"}),_100)));
};
boa.simpleCalendar.prototype.nextMonth=function(){
this.month++;
this.monthChanged();
};
boa.simpleCalendar.prototype.prevMonth=function(){
this.month--;
this.monthChanged();
};
boa.simpleCalendar.prototype.monthChanged=function(){
var _103=this.idPrefix+this.domNode.value;
$(_103)&&($(_103).className="");
this.setDefaultDate();
this.buildCalendarTable();
$(_103)&&($(_103).className=this.selectClass);
};
dualCalendar=function(name){
this.name=name;
this.targetNode=$(name);
this.displayInput=$(this.name+"_l");
this.selectClass="";
this.rangeClass="";
this.highlightClass="";
this.highlightDay="";
this.startRange="";
this.endRange="";
this.invalidClass="no-month";
};
dualCalendar.prototype.load=function(){
this.createCalendars();
this.attachEvents();
};
dualCalendar.prototype.createCalendars=function(){
now=new Date();
if(now.getMonth()==11){
this.month=12;
}else{
this.month=((now.getMonth()+1)%12);
}
var _105={"invalidClass":this.invalidClass,"dayNamesClass":"week-days","titleClass":"month-year","selectClass":this.selectClass};
var _106=MochiKit.Base.clone(_105);
var _107=MochiKit.Base.clone(_105);
_107.month=this.month+1;
this.cal1=new boa.simpleCalendar(this.name+"_m1",_106);
this.cal2=new boa.simpleCalendar(this.name+"_m2",_107);
this.range=[];
};
dualCalendar.prototype.attachEvents=function(){
conn=MochiKit.Signal.connect;
conn(this.cal1.domNode,"onchange",this,MochiKit.Base.partial(this.calChange,1));
conn(this.cal2.domNode,"onchange",this,MochiKit.Base.partial(this.calChange,2));
conn(this.displayInput,"onclick",this,this.showHideCalendar);
conn(this.name+"_x","onclick",this,this.close);
conn(this.name+"_c","onclick",this,this.clear);
conn(this.name+"_p","onclick",this,this.prevMonth);
conn(this.name+"_n","onclick",this,this.nextMonth);
};
dualCalendar.prototype.showHideCalendar=function(){
if($(this.name+"_d").style.display=="block"){
this.close();
}else{
this.open();
}
};
dualCalendar.prototype.open=function(){
$(this.name+"_d").style.display="block";
MochiKit.Signal.signal(this,"opened");
if($("IEhackIframe")){
ToggleVisible($("IEhackIframe"),true);
}else{
if($(this.name+"_IEhackIframe")){
ToggleVisible($(this.name+"_IEhackIframe"),true);
}
}
this.applyHighlight();
};
dualCalendar.prototype.close=function(){
$(this.name+"_d").style.display="none";
MochiKit.Signal.signal(this,"closed");
if($("IEhackIframe")){
ToggleVisible($("IEhackIframe"),false);
}else{
if($(this.name+"_IEhackIframe")){
ToggleVisible($(this.name+"_IEhackIframe"),false);
}
}
};
dualCalendar.prototype.calChange=function(cal){
if(cal==1){
this.cal2.deselect();
this.targetNode.value=this.cal1.domNode.value;
}else{
this.cal1.deselect();
this.targetNode.value=this.cal2.domNode.value;
}
this.updateDisplay();
};
dualCalendar.prototype.updateDisplay=function(){
var _109=this.targetNode.value?boa.dateToStr(this.targetNode.value):"";
this.displayInput.value=_109;
MochiKit.Signal.signal(this.targetNode,"onchange");
if(this.startRange>this.endRange){
this.displayInput.value="";
this.clearRange();
if($("wrongDatesSelected")){
$("wrongDatesSelected").style.display="block";
}
return;
}
if($("wrongDatesSelected")){
$("wrongDatesSelected").style.display="none";
}
this.close();
};
dualCalendar.prototype.clear=function(){
this.clearX();
MochiKit.Signal.signal(this,"clear");
};
dualCalendar.prototype.clearX=function(){
this.cal1.deselect();
this.cal2.deselect();
this.targetNode.value="";
this.updateDisplay();
};
dualCalendar.prototype.nextMonth=function(){
this.monthMove(1);
};
dualCalendar.prototype.prevMonth=function(){
this.monthMove(-1);
};
dualCalendar.prototype.monthMove=function(_10a){
if((_10a<0)&&(this.cal1.month==this.month)){
return;
}
this.clearRange();
this.clearHighlight();
if(_10a<0){
this.cal1.prevMonth();
this.cal2.prevMonth();
}else{
this.cal1.nextMonth();
this.cal2.nextMonth();
}
this.cal1.selectDate(this.targetNode.value);
this.cal2.selectDate(this.targetNode.value);
this.applyRangeFill();
this.applyHighlight();
};
dualCalendar.prototype.fillDates=function(_10b,_10c){
this.startDate=_10b;
this.endDate=_10c;
};
dualCalendar.prototype.fillRange=function(_10d,_10e){
this.startRange=_10d;
this.endRange=_10e;
this.applyRangeFill();
};
dualCalendar.prototype.applyRangeFill=function(){
this.clearRange();
var tmp=[this.cal1,this.cal2];
for(var x in tmp){
cal=tmp[x];
for(var i in boa.simpleCalendar.dateCache[cal.month]){
var _112=boa.simpleCalendar.dateCache[cal.month][i];
if(_112>=this.endRange){
break;
}else{
if(_112>this.startRange){
this.range.push(_112);
boa.appendClass(cal.idPrefix+_112,this.rangeClass);
}
}
}
}
};
dualCalendar.prototype.clearRange=function(){
for(var i in this.range){
if($(this.cal1.idPrefix+this.range[i])){
boa.removeClass(this.cal1.idPrefix+this.range[i],this.rangeClass);
}
if($(this.cal2.idPrefix+this.range[i])){
boa.removeClass(this.cal2.idPrefix+this.range[i],this.rangeClass);
}
}
this.range=[];
};
dualCalendar.prototype.highlightDate=function(day){
this.clearHighlight();
this.highlightDay=day;
this.applyHighlight();
};
dualCalendar.prototype.clearHighlight=function(){
if($(this.cal1.idPrefix+this.highlightDay)){
boa.removeClass(this.cal1.idPrefix+this.highlightDay,this.highlightClass);
}
if($(this.cal2.idPrefix+this.highlightDay)){
boa.removeClass(this.cal2.idPrefix+this.highlightDay,this.highlightClass);
}
};
dualCalendar.prototype.applyHighlight=function(day){
if($(this.cal1.idPrefix+this.highlightDay)){
boa.appendClass(this.cal1.idPrefix+this.highlightDay,this.highlightClass);
}
if($(this.cal2.idPrefix+this.highlightDay)){
boa.appendClass(this.cal2.idPrefix+this.highlightDay,this.highlightClass);
}
};
dualCalendar.prototype.selectDate=function(day){
this.cal1.selectDate(day);
this.cal2.selectDate(day);
this.targetNode.value=day;
this.updateDisplay();
this.applyHighlight();
this.applyRangeFill();
};
dateRangeDual=function(_117,_118){
this.createCalendars(_117,_118);
this.attachEvents();
this.checkin="";
this.checkout="";
this.endDate="";
};
dateRangeDual.prototype.createCalendars=function(_119,_11a){
this.dateSelect1=new dualCalendar(_119);
this.dateSelect2=new dualCalendar(_11a);
this.dateSelect1.selectClass="selected-start";
this.dateSelect2.selectClass="selected-end";
this.dateSelect1.highlightClass="selected-end";
this.dateSelect2.highlightClass="selected-start";
this.dateSelect1.rangeClass="from-to";
this.dateSelect2.rangeClass="from-to";
this.dateSelect1.load();
this.dateSelect2.load();
};
dateRangeDual.prototype.attachEvents=function(){
conn=MochiKit.Signal.connect;
conn(this.dateSelect1,"opened",this,MochiKit.Base.partial(this.calOpen,1));
conn(this.dateSelect2,"opened",this,MochiKit.Base.partial(this.calOpen,2));
conn(this.dateSelect1.targetNode,"onchange",this,this.checkinUpdate);
conn(this.dateSelect2.targetNode,"onchange",this,this.checkoutUpdate);
conn(this.dateSelect1,"clear",this,MochiKit.Base.partial(this.clear,this.dateSelect2));
conn(this.dateSelect2,"clear",this,MochiKit.Base.partial(this.clear,this.dateSelect1));
};
dateRangeDual.prototype.checkinUpdate=function(){
this.checkin=this.dateSelect1.targetNode.value;
this.dateSelect2.highlightDate(this.checkin);
this.dateUpdate();
};
dateRangeDual.prototype.checkoutUpdate=function(){
this.checkout=this.dateSelect2.targetNode.value;
this.dateSelect1.highlightDate(this.checkout);
this.dateUpdate();
};
dateRangeDual.prototype.dateUpdate=function(){
if(this.checkin&&this.checkout){
this.dateSelect1.fillRange(this.checkin,this.checkout);
this.dateSelect2.fillRange(this.checkin,this.checkout);
if($("cal_cinDate_set")){
$("cal_cinDate_set").value=this.checkin;
}
if($("cal_coutDate_set")){
$("cal_coutDate_set").value=this.checkout;
}
}else{
this.dateSelect1.clearRange();
this.dateSelect2.clearRange();
if($("cal_cinDate_set")){
$("cal_cinDate_set").value="";
}
if($("cal_coutDate_set")){
$("cal_coutDate_set").value="";
}
}
if(this.checkout&&this.checkin){
this.endDate=boa.addDays(this.checkout,-1);
this.value=this.checkin+" "+this.endDate;
}else{
this.value="";
}
MochiKit.Signal.signal(this,"onchange");
};
dateRangeDual.prototype.calOpen=function(cal){
if(cal==1){
this.dateSelect2.close();
this.dateSelect1.cal1.month=this.dateSelect2.cal1.month;
this.dateSelect1.cal2.month=this.dateSelect2.cal2.month;
this.dateSelect1.cal1.monthChanged();
this.dateSelect1.cal2.monthChanged();
}else{
this.dateSelect1.close();
this.dateSelect2.cal1.month=this.dateSelect1.cal1.month;
this.dateSelect2.cal2.month=this.dateSelect1.cal2.month;
this.dateSelect2.cal1.monthChanged();
this.dateSelect2.cal2.monthChanged();
}
};
dateRangeDual.prototype.setValueFromNode=function(node){
node=$(node);
this.value=node.value;
if(this.value){
var bits=this.value.split(" ");
this.checkin=bits[0];
this.checkout=boa.addDays(bits[1],1);
this.dateSelect1.selectDate(this.checkin);
this.dateSelect2.selectDate(this.checkout);
this.dateSelect1.highlightDate(this.checkout);
this.dateSelect2.highlightDate(this.checkin);
}
};
dateRangeDual.prototype.clear=function(_11e){
_11e.clearX();
};
dateRangeDual.prototype.validRange=function(){
if(this.checkin&&this.checkout&&(this.checkin<this.checkout)){
return true;
}
return false;
};
initFooter=function(){
if($("ShareThisLink")){
MochiKit.Signal.connect("ShareThisLink","onclick",window,showHideShareThisContainer);
}
};
showHideShareThisContainer=function(){
if($("sharethisContainer")){
ToggleVisible("sharethisContainer");
}
};
boa.addWindowOnload(initFooter);

