var $reload=function(C,A){new Dialog({title:MooTools.lang.get("Generic","reloadTitle"),message:MooTools.lang.get("Generic","reloadMessage"),buttons:[]});
var B=location.href.split(/[\?#]/g)[0];
location.href=B+"?_lhc="+Math.floor(Math.random()*1000000)+(C?"&"+C:"")
};
var $args=function(A){if(!A){return{}
}var B=A.split(/[\[=,\]]/g);
var C={};
if(B.length>1){A=B.shift();
while(B.length>1){C[B.shift().trim()]=B.shift().trim()
}}return C
};
var $screenSize=function(){var A;
var B;
if($defined(window.innerWidth)){A=window.innerWidth;
B=window.innerHeight
}else{if(($defined(document.documentElement))&&($defined(document.documentElement.clientWidth))&&(document.documentElement.clientWidth!=0)){A=document.documentElement.clientWidth;
B=document.documentElement.clientHeight
}else{A=document.getElementsByTagName("body")[0].clientWidth;
B=document.getElementsByTagName("body")[0].clientHeight
}}return{width:A,height:B}
};
var $isIE6=function(){return($chk(Browser.Engine.trident)&&Browser.Engine.version<4.001)
};
var $isIE7=function(){return($chk(Browser.Engine.trident)&&Browser.Engine.version>4.999&&Browser.Engine.version<5.999)
};
var $isValidEmail=function(A){return A.match(new RegExp(".*@[^.].+[.]([a-z]|[A-Z]){2,}$"))!=null
};
var $toggleAreas=function(B,A,C){B=$(B);
A=$(A);
if(B.style.display=="none"){B.style.display=$pick(C,"block");
A.style.display="none"
}else{B.style.display="none";
A.style.display=$pick(C,"block")
}};
var $properlyCapitalize=function(E){if(!E){return""
}if(E.length==1){return E.toUpperCase()
}var A=E.capitalize();
var B=A.charAt(0);
for(var C=1;
C<A.length;
C++){var D=A.charAt(C);
if(A.charAt(C-1)!=" "){D=D.toLowerCase()
}B+=D
}return B
};
var $deleteRecursivelyByHand=function(A,B){if(A.getChildren().length==0){A.dispose()
}else{$each(A.getChildren(),function(C){$deleteRecursivelyByHand(C,++B)
})
}};
Array.implement({shuffle:function(){for(var C,B,A=this.length;
C;
B=parseInt(Math.random()*C),A=this[--C],this[C]=this[B],this[B]=A){}return this
}});
var TripSay2009=new Class({baseUrl:"/",wall:null,page:function(A,B){if(B.baseUrl!=null){ts.baseUrl=B.baseUrl
}window.addEvent("domready",function(){if(A=="destination"){Controller.implement(TitleTags.prototype);
Controller.implement(InplaceEditEvents.prototype);
Controller.implement(DestinationRating.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TipSet.prototype);
Controller.implement(FeedFilter.prototype);
Controller.implement(Guru.prototype);
Controller.implement(HotelBooking.prototype);
Controller.implement(DestinationTipBox.prototype);
Controller.implement(DestinationFilmStrip.prototype);
Controller.implement(DestinationEdit.prototype);
new Controller($merge(B,{destination:B.destinationId,mapImage:B.mapImage,actions:".action, .editAction",user:B.user,wall:{kind:"destination",id:B.destinationId,overtext:null}}))
}if(A=="guru"){Controller.implement(InplaceEditEvents.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TabControl.prototype);
Controller.implement(Guru.prototype);
var C=new Controller({actions:".action, .editAction",user:B.user,wall:{kind:"guru",id:B.guru,overtext:null}});
if(B.destination){C.fireEvent("filterWall",[{"class":"place"+B.destination}])
}}if(A=="front"){new FrontPageAccordion();
Controller.implement(StaticMap.prototype);
new Controller(B)
}if(A=="places"){Controller.implement(PlacesMap.prototype);
Controller.implement(HotelBooking.prototype);
new Controller(B)
}if(A=="addplace"){Controller.implement(AddPlace.prototype);
new Controller(B)
}if(A=="miniTaste"){Controller.implement(MiniTaste.prototype);
new Controller(B)
}if(A=="miniTasteResults"){Controller.implement(MiniTasteResults.prototype);
Controller.implement(MiniTasteCarousel.prototype);
new Controller(B)
}if(A=="miniTasteTeaser"){Controller.implement(MiniTasteTeaser.prototype);
new Controller(B)
}if(A=="discussion"){Controller.implement(StaticMap.prototype);
Controller.implement(Wall.prototype);
new Controller({places:B.places,mapCenterLat:B.mapCenterLat,mapCenterLng:B.mapCenterLng,mapCenterZoom:B.mapCenterZoom,actions:".action, .editAction",user:B.user,wall:{kind:"editorialContent",id:B.content}})
}if(A=="travelStory"){Controller.implement(InplaceEditEvents.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TravelStoryMap.prototype);
new Controller({actions:".action, .editAction",user:B.user,story:B.story,selected:B.selected,places:B.places,wall:{tips:"#groupComments .tipItem",kind:"travelStory",id:B.story}})
}if(A=="travelStoryList"){new TravelStoryActions({})
}if(A=="profile"){new ProfileMap();
Controller.implement(InplaceEditEvents.prototype);
Controller.implement(GroupCreateActions.prototype);
Controller.implement(ProfileActions.prototype);
Controller.implement(ProfileMap.prototype);
Controller.implement(Events.TravelStory.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TipSet.prototype);
$extend(B,{actions:".action, .editAction"});
$extend(B,{wall:{kind:"user",id:B.profile}});
new Controller(B)
}if(A=="profileWall"){new ProfileMap();
Controller.implement(InplaceEditEvents.prototype);
Controller.implement(GroupCreateActions.prototype);
Controller.implement(ProfileActions.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TipSet.prototype);
$extend(B,{actions:".action, .editAction"});
$extend(B,{wall:{kind:"user",id:B.profile}});
new Controller(B)
}if(A=="tipSet"){Controller.implement(InplaceEditEvents.prototype);
Controller.implement(Wall.prototype);
Controller.implement(TipSet.prototype);
$extend(B,{actions:".action, .editAction"});
$extend(B,{wall:{kind:"tipset",id:B.tipSet}});
new Controller(B)
}if(A=="feed"){Controller.implement(FeedTabs.prototype);
Controller.implement(ImageActions.prototype);
new Controller(B)
}if(A=="settings"){Controller.implement(UserSettings.prototype);
Controller.implement(Sliders.prototype);
new Controller(B)
}if(A=="multiTipPage"){Controller.implement(MultiTip.prototype);
Controller.implement(Wall.prototype);
new Controller(B)
}if(A=="group"){Controller.implement(Drawer.prototype);
Controller.implement(TitleTags.prototype);
Controller.implement(InplaceEditEvents.prototype);
Controller.implement(GroupActions.prototype);
Controller.implement(GroupMap.prototype);
Controller.implement(Wall.prototype);
var C=new Controller($merge(B,{user:B.user,actions:".action, .editAction",places:B.places,map:"map",wall:{kind:"group",id:B.group}}));
C.addEvents({openDrawer:function(D){this.onSelectMarker(this.getMarker(D.id))
}.bind(C),selectMarker:function(D){this.onOpenDrawer({id:D.destinationId})
}.bind(C)})
}if(A=="browseGroups"){Controller.implement(GroupCreateActions.prototype);
var C=new Controller({});
C.addEvents({actions:".action, .editAction",openDrawer:function(D){this.onSelectMarker(this.getMarker(D.id))
}.bind(C),selectMarker:function(D){this.onOpenDrawer({id:D.destinationId})
}.bind(C)})
}if(A=="hotelHunt"){Controller.implement(HotelHunt.prototype);
var C=new Controller(B);
C.addEvents({actions:".action, .editAction"})
}})
}});
var ts=new TripSay2009();
var Actions=new Class({params:/\[((\w+):\s*(.+),?)\]/g,addDefaultEvents:function(){for(var A in this){if($type(this[A])!="function"||!(/^on[A-Z]/).test(A)||A=="onAction"){continue
}this.addEvent(A,this[A])
}},bindActions:function(B,A){$$(B).each(function(C){this.initAction(C,A)
},this)
},initAction:function(D,C){if(D.hasClass("bound")){return 
}D.addClass("bound");
var E=D.get("class").split(/\s/);
$each(E,function(F){if(F.match(/action/gi)){D.removeClass(F)
}});
if(!D.get("href")){D.set("href","javascript:void(0);")
}var A=D.get("rel");
if(!A){return 
}params=$args(A);
var B=A.split(/[\[=,\]]/g);
if(B.length>1){A=B.shift()
}$(D).addEvent("click",this.onAction.pass([A,$merge(params,C||{}),D],this))
},onAction:function(C,A,B){if($(B)&&$(B).hasClass("disabled")){if(!$(B).hasClass("forceEvents")){if($(B).get("title")){alert($(B).get("title"))
}return false
}}if(!this.fireEvent){return false
}this.fireEvent(C,[A,B]);
return false
},disableButtons:function(A){A.removeEvents();
A.addClass("disabled")
},enableButtons:function(A){this.bindActions(A);
A.removeClass("disabled")
}});
var AddPlace=new Class({Implements:[Options,Events,Actions],map:null,MAP_COOKIE:"tsMapFilters",MAP_SIZE_ADJUST:115,options:{changedMapManually:false},initialize:function(B){this.setOptions(B);
this.bindActions($$(".action"));
this.addDefaultEvents();
var A=window.location.href;
if(A.indexOf("#")!=-1){var C=$properlyCapitalize(unescape(A.substr(A.indexOf("#")+1)));
if(C.indexOf(",")!=-1){C=C.substr(0,C.indexOf(","));
C=C.trim()
}$("addName").value=C
}this.initializeAddPlaceMap()
},initializeAddPlaceMap:function(){google.load("maps","2",{callback:function(){this.onAddPlaceMapReady()
}.bind(this)})
},onAddPlaceMapReady:function(){this.map=new google.maps.Map2($("map"));
var C=40;
var A=0;
var B=3;
if(this.options.zoom!=0){C=new Number(this.options.lat);
A=new Number(this.options.lng);
B=new Number(this.options.zoom);
B+=0
}this.map.setCenter(new google.maps.LatLng(C,A),B,B>10?G_NORMAL_MAP:G_PHYSICAL_MAP);
this.map.addControl(getTsMapControl(true));
this.map.addControl(new google.maps.ScaleControl());
this.map.enableScrollWheelZoom();
google.maps.Event.addListener(this.map,"zoomend",this.onMapZoomOrMove.bind(this));
google.maps.Event.addListener(this.map,"moveend",this.onMapZoomOrMove.bind(this));
window.addEvent("resize",this.resizeMap.bind(this));
this.resizeMap()
},resizeMap:function(C){var D=this.MAP_SIZE_ADJUST;
this.map.getContainer().setStyle("height",($screenSize()["height"]-D)+"px");
var A=$screenSize()["width"];
var B="0";
if(A<929){B=(A-929)+"px"
}else{B=((Math.floor($screenSize()["width"])-929)/2)+"px"
}$("navigationSearchDiv").setStyles({right:B,display:"block"});
return C
},onMapZoomOrMove:function(A){if(!this.options.changedMapManually){this.map.setMapType(this.map.getZoom()>10?G_NORMAL_MAP:G_PHYSICAL_MAP)
}if(this.map.getZoom()<14){$("addPlaceMapNote").show();
$$("a[rel=onAddSelectCategory]")[0].addClass("disabled")
}else{$("addPlaceMapNote").hide();
$$("a[rel=onAddSelectCategory]")[0].removeClass("disabled")
}},onShowStep:function(A){this.showStep(A.step)
},showStep:function(A){$$(".addPlaceMode").hide();
$(A).show();
$("addPlaceTitle").set("html",MooTools.lang.get("AddPlace","defaultTitle"));
if(A=="addComplete"){$("addPlaceTitle").set("html",MooTools.lang.get("AddPlace","thanksTitle"))
}$("cloak").show();
$$("div#tripsayWide div.box").getParent().setStyle("width","100%");
$$("div#tripsayWide div.box").getParent().setStyle("margin-left","auto");
$$("div#tripsayWide div.box").getParent().setStyle("top","0pt");
$$("div#tripsayWide div.box").setStyle("margin-top","50px");
if(this.options.crossHair){this.map.removeControl(this.options.crossHair)
}if(A=="addMapPosition"){$("addPlaceTitle").set("html",MooTools.lang.get("AddPlace","mapTitle").substitute({destinationName:$("addName").value}));
$("cloak").hide();
$$("div#tripsayWide div.box").getParent().setStyle("width","275px");
$$("div#tripsayWide div.box").getParent().setStyle("margin-left",($screenSize()["width"]/2-150)+"px");
$$("#tripsayWide div.box").getParent().setStyle("top",($screenSize()["height"]-275)+"px");
$$("div#tripsayWide div.box").setStyle("margin-top","0px");
this.options.crossHair=new tsCrossHair(this.map);
this.map.addControl(this.options.crossHair);
$each($$(".mapCrossHair"),function(B){B.addEvent("click",function(C){new Dialog({title:MooTools.lang.get("AddPlace","crosshairClickTitle"),message:MooTools.lang.get("AddPlace","crosshairClickMessage")})
}.bind(this))
}.bind(this))
}},onCheckDuplicates:function(B){if($("addName").value==""){alert(MooTools.lang.get("AddPlace","noNameAlert"));
return 
}var A=$properlyCapitalize($("addName").value);
if(A.indexOf(",")!=-1){A=A.substr(0,A.indexOf(","))
}$("addName").value=A.trim();
this.showStep("addLoading");
new Request.JSON({method:"post",url:this.options.searchUrl,headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(D){if((D.length==1)&&(D[0]["id"]==0)){this.onAddPlaceAddress()
}else{this.showStep("addPlaceDupes");
$$("#addPlaceDupes p b").set("html",A);
var C="";
$each(D,function(E){if(E.link){C+='<a href="'+ts.baseUrl+"map/"+E.link+'">'+E.name+"</a><br/>"
}});
if(C==""){this.onAddPlaceAddress()
}$("dupeList").set("html",C)
}}.bind(this)}).send(JSON.encode({query:$("addName").value}))
},onAddPlaceStart:function(A){this.showStep("addPlaceStart")
},onAddPlaceAddress:function(A){this.showStep("addPlaceAddress")
},onAddSearchAddress:function(A){if($("addAddress").value==""){alert(MooTools.lang.get("AddPlace","addressAlert"));
return 
}this.showStep("addLoading");
new Request.JSON({method:"post",url:this.options.addressSearchUrl,headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(C){if((C==null)||(C.addresses.length==0)){this.map.setCenter(new google.maps.LatLng(40,0),2,G_PHYSICAL_MAP);
this.showStep("addMapPosition");
return 
}if(C.addresses.length==1){this.map.setCenter(new google.maps.LatLng(C.addresses[0]["lat"],C.addresses[0]["lng"]),14,G_NORMAL_MAP);
this.showStep("addMapPosition");
return 
}this.showStep("addChooseAddress");
var B="";
$each(C.addresses,function(D){B+='<a href="#" class="action" rel="chooseAddress[lat='+D.lat+",lng="+D.lng+']">';
B+=D.name;
B+="</a>";
B+="<br/>"
}.bind(this));
$("chooseAddressList").set("html",B);
this.bindActions($$("#chooseAddressList a"))
}.bind(this)}).send(JSON.encode({address:$("addAddress").value.trim()}))
},onChooseAddress:function(A){this.map.setCenter(new google.maps.LatLng(A.lat,A.lng),14,G_NORMAL_MAP);
this.showStep("addMapPosition")
},onAddMapPosition:function(A){this.showStep("addMapPosition")
},onAddSelectCategory:function(A){if(this.map.getZoom()<14){return 
}this.showStep("addSelectCategory");
this.options.selectedCategory=null
},onAddPlace_switch:function(A){this.options.selectedCategory=A.type;
$$("div#addSelectCategory ul.filters li").removeClass("selected");
$$("div#addSelectCategory ul.filters li."+A.type).addClass("selected")
},onAddComplete:function(A){this.showStep("addComplete");
new Request.JSON({method:"post",url:this.options.saveUrl,headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(B){$("thankYouText").set("html",MooTools.lang.get("AddPlace","thanks").substitute({destinationName:B.name}));
$("thankYouLink").show();
$("thankYouLink").href=this.options.destinationUrlPrefix+B.id
}.bind(this)}).send(JSON.encode({name:$("addName").value,type:this.options.selectedCategory,lat:this.map.getCenter().lat(),lng:this.map.getCenter().lng()}))
},onMapMode:function(A){var B=this.map.getCurrentMapType();
if(B==G_NORMAL_MAP){this.map.setMapType(G_SATELLITE_MAP)
}else{if(B==G_SATELLITE_MAP){this.map.setMapType(G_PHYSICAL_MAP)
}else{this.map.setMapType(G_NORMAL_MAP)
}}this.options.changedMapManually=true
}});
var Controller=new Class({Implements:[Events,Options,Actions],options:{actions:".action"},initialize:function(A){this.setOptions(A);
this.bindActions($$(this.options.actions));
this.addDefaultEvents();
for(var B in this){if($type(this[B])!="function"||!(/^initialize[A-Z]/).test(B)){continue
}this[B]()
}}});
var DestinationEdit=new Class({onEditPlace:function(A){if(this.editDialog==null){this.editDialog=new EditPlaceDialog({lat:this.options.latitude,lng:this.options.longitude,destinationName:A.destinationName,selectedCategory:A.selectedCategory,width:"972px",title:MooTools.lang.get("EditPlace","defaultTitle")+' "'+A.destinationName+'"',message:MooTools.lang.get("EditPlace","defaultMessage")+"<br/><br/>",buttons:["save","cancel"],editUrl:this.options.editUrl,onSave:function(){location.href=this.options.editUrl+"?lat="+this.map.getCenter().lat()+"&lng="+this.map.getCenter().lng()+"&type="+this.selectedCategory+"&name="+this.getDestinationName()
},onCancel:function(){this.reset()
}})
}else{this.editDialog.show()
}},onSuggestJoin:function(){new Dialog({title:MooTools.lang.get("EditPlace","suggestJoinTitle"),message:MooTools.lang.get("EditPlace","suggestJoinMessage"),buttons:["join","cancel"],onJoin:function(){location.href=this.options.joinUrl
}.bind(this)})
}});
var DestinationFilmStrip=new Class({previousOffset:0,initializeFilmStrip:function(){this.largeBackgroundDiv=$("photo");
this.filmStripDiv=$("browseImages");
this.invisiblePhoto=new Image();
this.invisiblePhoto.onload=this.setBackgroundImage.bind(this);
this.invisiblePhoto.alt="";
$("smallAndInvisible").appendChild(this.invisiblePhoto);
this.loadFilmStripImages(this.options.destinationId,this.options.primaryImage)
},loadFilmStripImages:function(A,B){if(!$defined(A)||A==""||A==-1){return 
}new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"destination/"+A+"/images",onSuccess:function(C){C=C.filter(function(D){return D.largeWidth>689
});
if(this.options.mapImage){C.splice(0,0,this.options.mapImage)
}this.filmStripImages=C;
if(B==null){this.invisiblePhoto.src=C[C.length>1?1:0].largeUrl
}$each(C,function(D){if(B==D.largeUrl){this.invisiblePhoto.src=D.largeUrl;
this.handleTitles(D)
}}.bind(this));
this.populateFilmStrip(0)
}.bind(this)}).send(JSON.encode({type:"SQUARE"}))
},populateFilmStrip:function(E){var G=$pick(E,0);
this.filmStripDiv.empty();
if(this.filmStripImages.length==0){return 
}new Element("a",{href:"javascript:void(0);","class":"prev",events:{click:function(){this.populateFilmStrip(G-1);
return false
}.bind(this)}}).inject(this.filmStripDiv);
if(this.filmStripImages.length>5&&G>this.filmStripImages.length-5){G=this.filmStripImages.length-5
}if(G<0){G=0
}var A=false;
var D=0;
for(var C=0;
C<this.filmStripImages.length;
C++){if(C==G){A=true
}if(A){++D;
if(D==6){A=false
}}var B=this.filmStripImages[C];
var F=B.title+(B.ownerId==""?(" by "+B.owner):"");
new Element("img",{src:B.url,alt:F,title:F,owner:B.owner,events:{click:this.setDestinationBackground.pass([B],this)},styles:{display:(A?"block":"none")}}).inject(this.filmStripDiv)
}new Element("a",{href:"javascript:void(0);","class":"next",events:{click:function(){this.populateFilmStrip(G+1);
return false
}.bind(this)}}).inject(this.filmStripDiv);
if(G==0){$$("a.prev").addClass("faint")
}if((this.filmStripImages.length>5&&G==this.filmStripImages.length-5)||(this.filmStripImages.length<6)){$$("a.next").addClass("faint");
$$("a.next").removeEvents("click")
}this.previousOffset=G
},setDestinationBackground:function(E){if($("bgImageLoading")!=null){$("bgImageLoading").dispose()
}var D=0;
var B=$$("#browseImages img");
for(var C=0;
C<B.length;
C++){if(B[C].getStyle("display")!="none"){if(B[C].src.indexOf(E.url)>=0){break
}else{D++
}}}if(D>=0&&D<5){var A=new Element("div",{id:"bgImageLoading"});
A.innerHTML=MooTools.lang.get("DestinationFilmStrip","loading");
A.setStyle("margin-left",(107+83*Number(D))+"px");
A.setStyle("top",$("browseImages").getStyle("padding-top"));
A.inject($("browseImages"),"after")
}this.invisiblePhoto.removeAttribute("height");
this.invisiblePhoto.removeAttribute("width");
this.invisiblePhoto.src=E.largeUrl;
this.handleTitles(E);
return false
},handleTitles:function(A){if(A.title){if(A.ownerId==null||A.ownerId==""){A.ownerUrl=this.options.baseUrl+"traveler/"+A.owner
}$("mosaicCaptionShadow").innerHTML=A.title+" by "+A.owner+(A.ownerId?" Image from Flickr.":"");
$("mosaicCaptionText").innerHTML=A.title+" by <a href='"+A.ownerUrl+"'>"+A.owner+(A.ownerId?'</a> Image from <a href="http://www.flickr.com" target="_blank">Flickr</a>.':"")
}else{if(this.owner){$("mosaicCaptionShadow").innerHTML="Image by "+A.owner;
$("mosaicCaptionText").innerHTML="Image by "+A.owner
}else{$("mosaicCaptionShadow").innerHTML="";
$("mosaicCaptionText").innerHTML=""
}}},setBackgroundImage:function(B){if(this.invisiblePhoto.height==375&&this.invisiblePhoto.width==500){var C=null;
var D=-1;
$each(this.filmStripImages,function(F,E){if(F.largeUrl==this.invisiblePhoto.src){D=E;
C=F
}}.bind(this));
this.filmStripImages.splice(D,1);
if($("bgImageLoading")!=null){$("bgImageLoading").dispose()
}this.filmStripDiv.empty();
this.populateFilmStrip(this.previousOffset);
var A=$$("#browseImages img");
A[(A.length-1)<D?0:D].fireEvent("click");
new Request({method:"post",url:ts.baseUrl+"destination/"+this.options.destinationId+"/images/remove"}).post({removeUrl:C.largeUrl});
return 
}this.filmStripDiv.setStyle("padding-top",(this.invisiblePhoto.height-90)+"px");
this.largeBackgroundDiv.setStyle("background-image","url("+this.invisiblePhoto.src+")");
if($("bgImageLoading")!=null){$("bgImageLoading").dispose()
}$("currentPlaceTatti").hide();
this.largeBackgroundDiv.setStyles({"background-repeat":"repeat-x",height:""});
this.largeBackgroundDiv.setStyles({"background-position":"0 0"});
if(this.invisiblePhoto.src.contains("http://maps.google.com")){$("currentPlaceTatti").show();
this.largeBackgroundDiv.setStyles({"background-repeat":"no-repeat"})
}if(this.invisiblePhoto.src.contains("http://www.booking.com")){this.largeBackgroundDiv.setStyles({"background-repeat":"no-repeat"});
this.largeBackgroundDiv.setStyles({"background-position":"60px 0"})
}}});
function dimOthers(B,A){$$(B).each(function(C){C.setStyle("opacity",C.id==A?"1":".25")
})
}var DestinationRating=new Class({rating:-1,editDialog:null,initializeRating:function(){this.rated=this.options.rated;
this.loved=this.options.loved;
this.hated=this.options.hated;
this.wished=this.options.wished;
this.bested=this.options.bested;
if(this.rated){var A=this.options.destinationId;
$("rateLove_"+A).setStyle("opacity",this.loved?"1":".25");
$("rateBtdt_"+A).setStyle("opacity",!(this.loved||this.hated||this.wished||this.bested)?"1":".25");
$("rateSucks_"+A).setStyle("opacity",this.hated?"1":".25");
$("rateWish_"+A).setStyle("opacity",this.wished?"1":".25");
$("rateBest_"+A).setStyle("opacity",this.bested?"1":".25");
$("rateDrop_"+A).innerHTML=this.wished?"Drop wish":"Drop rating";
$("rateDrop_"+A).show()
}if($("rateReasonInput_"+this.options.destinationId)){$("rateReasonInput_"+this.options.destinationId).addEvent("keyup",function(){this.enableOrDisableRateSave(this.options.destinationId)
}.bind(this))
}},enableOrDisableRateSave:function(A){if($("rateReasonInput_"+A).value.length<10){$("rateSubmitButton_"+A).addClass("disabled")
}else{$("rateSubmitButton_"+A).removeClass("disabled")
}},onRate:function(B,D){var C=B.destinationId;
this.rateText=$("rateReasonText_"+C);
if(D){$$("#rate_"+C+" a.dimmable").each(function(F){F.setStyle("opacity",F==D?"1":".25")
})
}var E=B.value||this.rating;
if((E<-1)||(E>6)){return 
}this.rating=E;
$$(".joinAdvertisement").show();
if(E==1){this["rateText"].innerHTML="hate"
}if(E>3){this["rateText"].innerHTML="love"
}$("rateDrop_"+C).innerHTML=E==-1?"Drop wish":"Drop rating";
$("rateReasonDone_"+C).hide();
$("rateReasonless_"+C).hide();
var A={reason:$("rateReasonInput_"+C).value};
if(E<1){A.wish=true
}else{if(E>5){A.best=true
}else{A.value=this.rating
}}new Request.JSON({url:ts.baseUrl+"destination/"+B.destinationId+"/quickRate",onComplete:function(){this.rateComplete(B.close||false,B.destinationId);
$("rateDrop_"+B.destinationId).show();
if($$("div#info").length>0){var F=new Request.HTML({url:ts.baseUrl+"destination/"+B.destinationId+"/loveHate",onComplete:function(G){if($("loveHateAjaxUpdated")){$("loveHateAjaxUpdated").empty();
$("loveHateAjaxUpdated").adopt(G)
}}.bind(this)});
F.post({})
}}.bind(this)}).post(A)
},onNoReason:function(A){$("rateReason_"+A.destinationId).hide();
$("rateClick_"+A.destinationId).value="reason";
this.rateComplete(false,A.destinationId)
},onReason:function(A){$("rateReason_"+A.destinationId).hide();
$("rateClick_"+A.destinationId).value="reason";
this.onRate({close:true,destinationId:A.destinationId})
},rateComplete:function(A,B){if($("rateClick_"+B).value=="face"){if(this.rating==3||this.rating==-1){$("rateReason_"+B).hide();
$("rateReasonless_"+B).show()
}else{$("rateValue_"+B).value=this.rating;
if(!A){$("rateReason_"+B).show();
this.enableOrDisableRateSave(B)
}}}else{$("rateReason_"+B).hide();
$("rateReasonDone_"+B).show();
$("rateClick_"+B).value="face"
}if(this.rated){this.adjustLoveHateCounts((this.loved||this.bested)?-1:0,this.hated?-1:0)
}this.rated=true;
this.loved=this.rating==5;
this.hated=this.rating==1;
this.adjustLoveHateCounts((this.loved||this.bested)?1:0,this.hated?1:0)
},onDropRating:function(A){$$("#rate_"+A.destinationId+" a.dimmable").each(function(B){B.setStyle("opacity","1")
});
$$(".rateReason").hide();
$("rateDrop_"+A.destinationId).hide();
new Request.JSON({url:ts.baseUrl+"destination/"+A.destinationId+"/dropRating",onComplete:function(){$("rateDropped_"+A.destinationId).show();
var B=function(){$("rateDropped_"+A.destinationId).hide()
}.bind(this);
B.delay(5000)
}.bind(this)}).post()
},adjustLoveHateCounts:function(A,B){this.adjust("loverAmount",A);
this.adjust("haterAmount",B)
},adjust:function(A,B){if($(A)){$(A).innerHTML=new Number($(A).innerHTML)+B
}},onHideRating:function(A){$("ratingsButtons_"+A.destinationId).hide();
$("ratingsLink_"+A.destinationId).show()
}});
var DestinationTipBox=new Class({Implements:[Options],Binds:["prepareTabs"],options:{tipBoxDiv:"tip",tipText:"usertip",destination:null,defaultMode:"write"},initializeDestinationtipBox:function(A){this.setOptions(A);
if(!this.options.registered){$("usertip").addEvent("focus",this.advertiseRegistration.bind(this))
}$(this.options.tipText).addEvents({focus:this.enable.pass(false,this),blur:this.enable.pass(true,this),change:this.enable.pass(true,this)});
this.overText=new OverText(this.options.tipText,{textOverride:'<span id="overlay-content"></span>'});
$$("#"+this.options.tipBoxDiv+" .tabs a").each(this.prepareTabs);
this.showTab(this.options.defaultMode);
$$("#newAddImage").addEvent("uploadComplete",this.onNewTipUploadComplete);
$$("#newAddImage").addEvent("imageSelected",this.onNewTipImageSelected);
$$("#newAddImage").addEvent("imageDiscarded",this.onShowAddTipImage);
$$("#newAddImage").addEvent("destroy",this.onNewTipDestroy);
if($isIE7()){this.showLowerOKButton()
}},prepareTabs:function(A){A.addEvent("click",this.onClick.pass([A],this))
},onClick:function(A){this.showTab(A.get("class"));
if($("isQuestion")){$("isQuestion").value=A.get("class")=="ask"
}},showTab:function(A){$(this.options.tipBoxDiv).set("class","box "+A+"Mode");
if($("overlay-content")){$("overlay-content").set("text",MooTools.lang.get("DestinationTipBox",A).substitute(this.options))
}return false
},enable:function(A){var B=$(this.options.tipText);
if(B==null){return 
}if(A&&B.get("value")==""){B.addClass("disabled")
}else{B.removeClass("disabled")
}},advertiseRegistration:function(){var A=$("messageForm");
if(A==null){return 
}A=A.getParent();
if(A==null){return 
}A.empty();
A.innerHTML=MooTools.lang.get("DestinationTipBox","advertisementPrefix")+"and to ask tips from fellow travellers.<br/><br/><a href='"+this.options.joinUrl+"'>"+MooTools.lang.get("DestinationTipBox","advertisementLink")+"</a>"+MooTools.lang.get("DestinationTipBox","advertisementSuffix")
},onShowAddTipImage:function(){this.showLowerOKButton();
$$("#showAddTipImage").hide();
$("newTipExternalImageUrl").value="";
$("newTipUsePreviewImage").value=0;
$$("#newAddImage").empty();
$$("#newAddImage").set("html","&nbsp;<br/>");
$$("#newAddImage").show();
$$("#showAddTipSources").fireEvent("click")
},onShowAddTipLink:function(){this.showLowerOKButton();
$$("#showAddTipLink").hide();
$$("#newTipUrl").show();
(function(){if($$("#newTipUrl input").length>0){var A=$$("#newTipUrl input")[0];
A.focus();
A.removeEvents();
A.addEvent("keypress",this.hideAddTipIfInputEmpty)
}}.bind(this)).delay(500)
},hideAddTipIfInputEmpty:function(A){(function(){var B=$$("#newTipUrl input")[0];
if(B.value.length==0){$("newTipUrl").hide();
$("showAddTipLink").setStyles({visibility:"visible",opacity:"1.0",display:"block"})
}}.bind(this)).delay(1000)
},showLowerOKButton:function(){$("newTipOKButton_upper").hide();
$("newTipOKButton_lower").show()
},onNewTipImageSelected:function(B){$("newTipExternalImageUrl").value=B.url;
$("newTipUsePreviewImage").value=0;
var A=$$("img."+B.tinyClass)[0];
$("newAddImage").empty();
var E=new Element("div",{"class":"clear",styles:{"padding-top":"10px","margin-left":"30px",width:"200px",height:"110px"}});
A.setStyle("float","right");
A.inject(E);
var C="";
if(!A.alt||A.alt==""){C="This image"
}else{C='"<b>'+A.alt+'</b>"'
}var D=new Element("span",{styles:{"float":"left","margin-right":"5px",width:"105px"},html:C+" will be added to your tip.<br/>"});
new Element("a",{events:{click:function(){$("showAddTipImage").fireEvent("click")
}},html:"Change it?"}).inject(D);
D.inject(E);
E.inject($("newAddImage"))
},onNewTipUploadComplete:function(A){$("newTipExternalImageUrl").value="";
$("newTipUsePreviewImage").value="true";
$("newAddImage").setStyle("text-align","center");
$("newAddImage").empty();
new Element("img",{src:A,styles:{"margin-top":"10px"}}).inject($("newAddImage"));
new Element("br").inject($("newAddImage"));
$("newAddImage").appendText("The above image you uploaded will");
new Element("br").inject($("newAddImage"));
$("newAddImage").appendText("be added to your tip. ");
new Element("a",{events:{click:function(){$("newAddImage").setStyle("text-align","left");
$("newAddImage").setStyle("margin-bottom","0px");
$("showAddTipImage").fireEvent("click")
}},html:"Change it?"}).inject($("newAddImage"));
$("newAddImage").setStyle("margin-bottom","10px")
},onNewTipDestroy:function(){$("newAddImage").empty();
$("newAddImage").hide();
$("showAddTipImage").show()
}});
var Dialog=new Class({Extends:StickyWin.Modal,Implements:[Actions],defaultDlg:{title:"Are you sure?",message:"Dialog Content",buttons:["ok"]},initialize:function(A){this.html=this.createContent($merge(this.defaultDlg,A||{}));
this.parent($merge({content:this.html,validate:true},A||{}));
if($("destinationAutoComplete")){setTimeout(function(){var C=$("destinationAutoComplete").getParent().getElements(".autocompleter-choices")[0];
var B=$("destinationAutoComplete").getParent().getParent().getParent().getParent().getParent();
C.inject(B.getElements("div.bottom")[0],"after");
C=B.getElements(".autocompleter-choices")[0];
C.setStyle("margin-top","-105px");
C.setStyle("margin-left","15px")
},2000)
}},createContent:function(A){var D=("<h2>"+A.title+'</h2><div class="cnt"><div class="inner">'+(!A.elements?A.message:"")+'<span class="buttons"></span><div class="clear"></div></div></div><div class="bottom">');
var B=new Element("div",{"class":"box"});
B.set("html",D);
if(A.elements){B.getElement("div.inner").adopt(A.elements);
B.getElements(".action").each(function(E){this.linkButton(E,A.args)
}.bind(this))
}else{if(A.buttons.length>0){var C=new Element("p");
C.addClass("lightboxButtons");
$splat(A.buttons).each(function(E){this.createButton(E,C,A)
},this);
C.replaces(B.getElement("span.buttons"))
}}return B
},createButton:function(B,C,A){var D=new Element("a",{rel:B,href:"javascript:void(0);","class":"button right closeSticky"});
D.set("html","<span>"+B.toString().capitalize()+"</span>");
this.linkButton(D,A.args);
C.adopt(D)
},linkButton:function(B,A){B.addEvent("click",this.onButton.pass([B.get("rel").replace(/ /g,""),A||{}],this))
},onButton:function(C,B){var A=B||{};
this.html.getElements("input, textarea").each(function(D){if(D.get("name")){A[D.get("name")]=D.get("value")
}});
this.onAction(C,A)
}});
Dialog.dialogs=[];
Dialog.confirm=function(B,A){if(Dialog.dialogs.confirm){Dialog.dialogs.confirm.destroy()
}var C=new Dialog($merge({buttons:["cancel","confirm"],args:B||null,title:"Edit"},A));
Dialog.dialogs.confirm=C;
return C
};
Dialog.textEditor=function(B,A){if(Dialog.dialogs.textEditor){Dialog.dialogs.textEditor.destroy()
}var C="<p>{message}</p><textarea name='{field}'>{value}</textarea>".substitute(A);
var D=new Dialog($merge({buttons:["cancel","update"],args:B||null},A,{message:C}));
Dialog.dialogs.textEditor=D;
return D
};
Dialog.inputEditor=function(B,A){if(Dialog.dialogs.inputEditor){Dialog.dialogs.inputEditor.destroy()
}var C='<p>{message}</p><p><input name="{field}" type="text" value="{value}" class="full"/></p>'.substitute(A);
var D=new Dialog($merge({buttons:["cancel","accept"],args:B||null},A,{message:C}));
return D
};
var $fieldOptions=function(A){return $merge({type:"text","class":"full",value:"",idField:(A.id?"id='"+A.id+"' ":"")},A)
};
var $field=function(A){return'<p>{title}</p><p><input {idField} name="{name}" type="{type}" value="{value}" class="{class}"/></p>'.substitute($fieldOptions(A))
};
var $textarea=function(A){return'<p>{title}</p><p><textarea {idField} name="{name}" class="{class}">{value}</textarea></p>'.substitute($fieldOptions(A))
};
var FieldsDialog=new Class({Extends:Dialog,Binds:["destroy"],initialize:function(B,A){var C=B.help||"";
$each(A,function(E){var D=E.type=="textarea"?$textarea:$field;
C+=E.content?E.content:D(E)
});
this.parent($merge({buttons:["cancel","confirm"]},B,{message:C}));
$each(A,function(D){if(D.initialize&&typeof (D.initialize)=="function"){var E=D.initialize;
delete D.initialize;
E.attempt([D],this)
}});
this.addEvents({cancel:this.destroy})
}});
var DestinationSelector=new Class({createDestinationField:function(B){var A=new Autocompleter.Ajax.Destination(B.field||"destinationAutoComplete",ts.baseUrl+(B.url||"map/search/!matchPlace"),{postVar:"query",minLength:3,useSelection:false,selectMode:"pick",observerOptions:{delay:125}});
if(B.overtext){this.destinationOverText=new OverText(B.field,{textOverride:'<span class="destinationInput" id="overlay-content">'+B.overtext+"</span>"})
}return A
}});
var DateSelector=new Class({createDateField:function(A){this.datePicker=new DatePicker(A.id);
$("options").addEvent("click",datePicker.show.bind(datePicker))
}});
Autocompleter.Ajax.Destination=new Class({Extends:Autocompleter.Ajax.Json,Binds:["pick"],destination:null,initialize:function(){this.parent.apply(this,arguments);
this.addEvent("select",this.pick);
this.addEvent("selection",this.pick)
},pick:function(C,A){var B=$(this.element.id+"Id");
var D=A.retrieve("destination");
B.value=D.id;
B.store("destination",D)
},update:function(B){var A=$(this.element.id+"Id");
A.value="";
A.store("destination",null);
this.choices.empty();
this.cached=B;
if(!B||!B.length){this.hideChoices()
}else{if(this.options.maxChoices<B.length&&!this.options.overflow){B.length=this.options.maxChoices
}B.each(this.options.injectChoice||function(C){var E=$defined(C.typeString)?'<label class="'+E+'"></label>':"";
var D=new Element("li").set("html",E+this.markQueryValue(C.name));
D.inputValue=C.name;
D.store("destination",C);
C.toString=function(){return this.name
};
this.addChoiceEvents(D).inject(this.choices)
},this);
this.showChoices()
}}});
var Drawer=new Class({scroll:null,initDrawerScroller:function(){this.scroll=new Fx.Scroll($(this.options.drawerContainer||"drawerContainer"),{duration:250})
},onOpenDrawer:function(B){if(this.scroll==null){this.initDrawerScroller()
}$each($$(".placeList li.selected"),function(C){if(C.id!="drawer"+B.id){C.removeClass("selected")
}});
var A=$("drawer"+B.id);
if(!A){return 
}A.toggleClass("selected");
if(!A.hasClass("selected")){return 
}this.scroll.toElement(A)
},onCloseDrawer:function(A){if(!$("drawer"+A.id)){return 
}$("drawer"+A.id).removeClass("selected")
}});
var EditPlaceDialog=new Class({Extends:Dialog,Implements:[Actions],map:null,selectedCategory:null,filters:["airport","transport","accomodation","eat","party","waterbody","beach","diving","culture","city","shopping","mountain","fun","wine"],filterMessages:["Airport","Other Transport","Hotels","Restaurant","Bar","Bodies of water","Beach","Diving","Sight","Cities and villages","Shopping","Mountain","Fun","Wineyards"],initialize:function(A){this.html=this.createContent($merge(this.defaultDlg,A||{}));
this.parent($merge({content:this.html,validate:true},A||{}));
this.map=new GMap2($("editMap"));
this.map.setCenter(new GLatLng(A.lat,A.lng),14,G_NORMAL_MAP);
this.map.addControl(getTsMapControl());
this.map.enableScrollWheelZoom();
this.crosshair=new tsCrossHair(this.map);
this.map.addControl(this.crosshair);
this.selectedCategory=A.selectedCategory;
this.createFilters().injectInside($("editPlaceCategory"))
},createContent:function(A){var D=("<h2>"+A.title+'</h2><div class="cnt"><div class="inner">'+(!A.elements?A.message:"")+'<div id="editMap"></div><div id="editName" style="margin: 6px 0 26px 0;"><input style="font-size: 20px; margin: 0 0 0 20px;" type="text" class="field" id="destinationName" value="'+A.destinationName+'" name="destinationName"/></div><div id="editPlaceCategory"></div><span class="buttons"></span><div class="clear"></div></div></div><div class="bottom">');
var B=new Element("div",{"class":"box wide"});
B.set("html",D);
if(A.elements){B.getElement("div.inner").adopt(A.elements);
B.getElements(".action").each(function(E){this.linkButton(E,A.args)
}.bind(this))
}else{if(A.buttons.length>0){var C=new Element("p");
C.addClass("lightboxButtons");
$splat(A.buttons).each(function(E){this.createButton(E,C,A)
},this);
C.replaces(B.getElement("span.buttons"))
}}return B
},createFilters:function(){var B=new Element("ul",{"class":"filters"});
var A=0;
$each(this.filters,function(D){var C=new Element("li",{"class":"f "+D});
if(this.selectedCategory==D){C.addClass("selected")
}var E=new Element("a",{id:D});
E.set("html","<label></label> "+this.filterMessages[A]);
E.injectInside(C);
E.addEvent("click",function(){this.selectFilter(D)
}.bind(this));
C.injectInside(B);
A++
}.bind(this));
return B
},destroy:function(){this.html.destroy();
this.html.dispose()
},selectFilter:function(A){this.selectedCategory=A;
$$("div#editPlaceCategory ul.filters li").removeClass("selected");
$$("div#editPlaceCategory ul.filters li."+A).addClass("selected")
},reset:function(){this.selectedCategory=this.options.selectedCategory;
this.selectFilter(this.selectedCategory);
$("destinationName").set("value",this.options.destinationName);
this.map.setCenter(new GLatLng(this.options.lat,this.options.lng),14,G_NORMAL_MAP)
},getDestinationName:function(){return $("destinationName").get("value")
}});
var FeedFilter=new Class({initializeWallFilter:function(){this.countFilter(true)
},onToggleDD:function(A){$(A.id).toggle()
},countFilter:function(C,B){var A=$$(".tipItem.tip"+(C?"":".place"+B)).length;
var D=$$(".tipItem.question"+(C?"":".place"+B)).length;
$("totalCount").set("html",(A+D));
$("tipCount").set("html",(A));
$("questionCount").set("html",(D));
if(A>0&&D>0){$("selectFilter").show()
}},onCountFilter:function(){this.countFilter(arguments)
},onFilterFeed:function(B,A){$$("#filters a").removeClass("selected");
A.addClass("selected");
$("tipsview").set("class",B.type);
$("filterMenu").hide()
}});
var FeedTabs=new Class({initializeFeedTabs:function(){var A=$("miniFeed").innerHTML;
$each(this.options.followedUsers,function(B){if(!A.contains("traveler/"+B.loginname+'"')){$$("ul#userMenu li.showOnly"+B.id).dispose()
}}.bind(this));
if($$("ul#userMenu li").length<=10){$("userMenu").setStyle("height","auto")
}},onToggleDD:function(A){$(A.id).toggle()
},onShowAll:function(){$$("#miniFeed li").show();
$("userMenu").hide();
$("userFilter").innerHTML="Show everything"
},onHideOthers:function(B){var A=B.name;
$$("#miniFeed li").each(function(C){if(!C.hasClass("header")){if(C.innerHTML.contains("traveler/"+B.login+'"')){C.show()
}else{C.hide()
}}});
$("userMenu").hide();
$("userFilter").innerHTML="Show "+B.name
}});
var TripSayForm=new Class({Implements:[Options,Events],Binds:["onSubmit","bindSubmit"],options:{element:"submitForm",submit:".submit",validate:true,isAjax:true,submitOptions:{},validatorOptions:{evaluateFieldsOnBlur:false,evaluateFieldsOnChange:false,scrollToErrorsOnSubmit:false}},initialize:function(A){this.setOptions(A);
if(!$(this.options.element)){return 
}if(this.options.isAjax){$(this.options.element).set("send",this.options.submitOptions)
}$$("#"+this.options.element+" "+this.options.submit).each(this.bindSubmit);
if(this.options.validate){this.validator=new FormValidator(this.options.element,this.options.validatorOptions)
}},bindSubmit:function(A){$(A).addEvent("click",this.onSubmit);
$(A).removeClass("disabled")
},onSubmit:function(A){if(this.validator.validate(A)){if(this.options.isAjax){$(this.options.element).send()
}else{$(this.options.element).submit();
return true
}}return false
}});
FrontPageAccordion=new Class({accordion:null,initialize:function(){this.accordion=new Accordion($$(".accordionToggler"),$$(".accordionElement"),{display:0,alwaysHide:true});
window.addEvent("broughtToFront",this.onBroughtToFront.bind(this))
},onBroughtToFront:function(A){if(this.accordion!=null){this.accordion.display(A)
}}});
var IconCache=new Class({Implements:[Options],options:{path:"gfx/icons/map/"},initialize:function(A){this.setOptions(A);
this.cache=new Hash({})
},getIcon:function(A){if(this.cache.has(A)){return this.cache.get(A)
}return this.cacheIcon(A)
},cacheIcon:function(B){var A=new google.maps.Icon(this.options.baseIcon,ts.baseUrl+this.options.path+B+".png");
if(B.indexOf("dimmed_")>-1){A.shadow=null
}this.cache.set(B,A);
return A
}});
var CreateGroupDialog=new Class({Extends:FieldsDialog,Binds:["destroy"],initialize:function(B){B.title=MooTools.lang.get("GroupActions","createTitle");
B.help=MooTools.lang.get("GroupActions","createHelp")+"<p class='dupeGroupName'>"+MooTools.lang.get("GroupActions","createError")+"</p>";
var A={title:{title:MooTools.lang.get("GroupActions","createFieldsTitle"),name:"group.name"},description:{title:MooTools.lang.get("GroupActions","createFieldsDescription"),name:"group.description",type:"textarea"}};
this.parent(B,A);
$$('input[name="group.name"]').addEvent("change",function(){new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"groups/checkGroupNameUniqueness",onSuccess:function(C){if(C){this.enableButtons($$('a.button[rel="confirm"]'));
$$("p.dupeGroupName").hide()
}else{this.disableButtons($$('a.button[rel="confirm"]'));
$$("p.dupeGroupName").show();
$$("p.dupeGroupName b")[0].innerHTML=$$('input[name="group.name"]')[0].value;
if($$("p.dupeGroupName b")[0].innerHTML==""){$$("p.dupeGroupName").hide()
}}}.bind(this)}).send(JSON.encode({groupName:$$('input[name="group.name"]')[0].value}))
}.bind(this))
}});
var GroupCreateActions=new Class({onCreateGroup:function(){this.createGroupDialog=new CreateGroupDialog({onConfirm:this.createGroup.bind(this)})
},createGroup:function(A){if((!$defined(A["group.name"]))||(!$defined(A["group.description"]))){return 
}if((A["group.name"].trim()=="")||(A["group.description"].trim()=="")){new Dialog({title:MooTools.lang.get("GroupActions","errorTitle"),message:MooTools.lang.get("GroupActions","errorMessage")+"<br/><br/>",buttons:["ok"]});
return 
}else{location.href=ts.baseUrl+"groups/create?"+new Hash(A).toQueryString()
}}});
var GroupJoinActions=new Class({onJoinGroup:function(A){location.href=ts.baseUrl+"groups/join/"+A.name
},onLeaveGroup:function(A){location.href=ts.baseUrl+"groups/leave/"+A.name
}});
var GroupActions=new Class({Implements:[DestinationSelector,GroupJoinActions,GroupCreateActions],initializeGroup:function(){this.imager=new ImageUploader({actions:".groupImageAction",type:"group"});
if($("addPlaceAutocompleteField")){this.createDestinationField({field:"addPlaceAutocompleteField",overtext:MooTools.lang.get("GroupActions","addPlaceOvertext")})
}if(!this.options.groupMember){$$("span.actions a.tip_reply").removeEvents();
$$("span.actions a.tip_reply").addEvent("click",function(){new Dialog({title:"You're not a member of "+this.options.group,message:"You must be a member of this group if you wish to reply to any of the messages or post new messages.<br/>&nbsp;",buttons:["cancel","join"],onJoin:function(){this.onJoinGroup({name:this.options.group})
}.bind(this)})
}.bind(this))
}},onAddPlace:function(B){var C=$("addPlaceAutocompleteFieldId").value;
if(C<1){return 
}var A=$("addPlaceAutocompleteFieldId").retrieve("destination");
if(A&&typeof (this.addPlaceMarker)=="function"){this.addPlaceMarker({title:A.name,lat:A.lat,lng:A.lng,type:A.typeString,id:A.id});
this.zoomRelevant()
}new Request.HTML({method:"post",url:ts.baseUrl+"groups/addPlace/"+B.group,update:"drawerContainer",onSuccess:function(){this.bindActions($("drawerContainer").getElements(".action"));
this.fireEvent("openDrawer",A)
}.bind(this)}).post({destination:C})
}});
var GroupMap=new Class({places:new Hash(),initializeMap:function(){google.load("maps","2",{callback:function(){this.onMapReady()
}.bind(this)})
},onMapReady:function(){this.map=new google.maps.Map2($(this.options.map));
this.map.addMapType(G_PHYSICAL_MAP);
this.map.setCenter(new google.maps.LatLng(17.3,14),1,G_PHYSICAL_MAP);
this.markerBounds=new google.maps.LatLngBounds();
this.map.addControl(getTsMapControl());
this.map.addControl(new google.maps.ScaleControl());
var A=new google.maps.Icon(G_DEFAULT_ICON);
A.iconSize=new google.maps.Size(46,55);
A.shadow=ts.baseUrl+"gfx/icons/map/shadow.png";
A.shadowSize=new google.maps.Size(46,60);
A.iconAnchor=new google.maps.Point(22,53);
A.bubbleAnchor=new google.maps.Point(0,7);
A.transparent=ts.baseUrl+"/gfx/icons/transp.png";
A.imageMap=[0,7,0,55,46,55,46,7];
this.icons=new IconCache({baseIcon:A});
$each(this.options.places,function(B){this.addPlaceMarker(B)
}.bind(this));
this.zoomRelevant()
},getMarker:function(A){return this.places.get(A).marker||null
},addPlaceMarker:function(E,D){var C=E.type;
if(C=="isle"){C="waterbody"
}if(C.substr(0,8)=="landmark"){C="sight"
}if(C=="locality"){C="city"
}var B=this.icons.getIcon(C);
var A=new google.maps.Marker(new google.maps.LatLng(E.lat,E.lng),{icon:B});
A.destinationId=E.id;
A.selected=D;
A.title=E.title;
A.text=C;
this.map.addOverlay(A);
google.maps.Event.addListener(A,"click",this.fireEvent.pass(["selectMarker",A],this));
google.maps.Event.addListener(A,"mouseover",this.hoverMarker.pass([A],this));
google.maps.Event.addListener(A,"mouseout",this.closeHover.pass([A],this));
this.markerBounds.extend(A.getLatLng());
E.marker=A;
this.places.set(E.id,E);
return A
},panMap:function(D,A,B){try{this.map.setCenter(new google.maps.LatLng(D,A),$pick(B,9))
}catch(C){}},onSelectMarker:function(A){if(this.selectedMarker!=null){if(this.selectedMarker==A){this.unselectMarker();
return 
}else{this.unselectMarker()
}}this.selectMarker(A)
},selectMarker:function(A){A.selected=true;
A.bubbleType="selected";
this.selectedMarker=this.hoverMarker(A,true)
},closeHover:function(A){if(A==this.selectedMarker){return 
}if(A.hover){this.map.removeOverlay(A.hover)
}A.hover=null
},hoverMarker:function(A,B){if(A.hover){if(B){this.map.removeOverlay(A.hover)
}else{return null
}}if(this.selectedMarker!=null&&A!=this.selectedMarker){A.distance=Math.round(A.getLatLng().distanceFrom(this.selectedMarker.getLatLng())/1000)
}else{A.distance=null
}A.hover=new dInfo(A);
this.map.addOverlay(A.hover);
return A
},unselectMarker:function(){if(!this.selectedMarker||!this.selectedMarker.hover){return 
}this.map.removeOverlay(this.selectedMarker.hover);
this.selectedMarker.selected=false;
this.selectedMarker.bubbleType=null;
this.selectedMarker.hover=null;
this.selectedMarker=null
},zoomRelevant:function(){this.panMap(this.markerBounds.getCenter().lat(),this.markerBounds.getCenter().lng(),this.map.getBoundsZoomLevel(this.markerBounds))
}});
var Grouper=new Class({getGroupers:function(B,D,E){var C=B.getZoom();
if(!E){E=16
}if(!this.groupers){this.groupers=new Array()
}if(!this.groupers["level"+C]){this.groupers["level"+C]=new Array();
while(D.length>0){var A={groupedMarkers:new Array()};
$each(D,function(G){var K=A.groupedMarkers.length==0;
var F=B.fromLatLngToContainerPixel(G.getLatLng());
if(!K){var H=A.x-F.x;
var I=A.y-F.y;
var J=Math.sqrt(H*H+I*I);
K=J<E
}if(K){if(A.groupedMarkers.length==0){A.x=F.x;
A.y=F.y
}A.groupedMarkers.push(G)
}}.bind(this));
this.groupers["level"+C].push(A);
$each(A.groupedMarkers,function(F){D.erase(F)
})
}}return this.groupers["level"+C]
}});
var Guru=new Class({Implements:[Options,Events,Actions],options:{},initializeGuru:function(C){this.setOptions(C);
this.addEvent("tab",this.onShowAll.bind(this));
$each($$(".stopBeingGuru"),function(D){D.addEvent("mouseenter",function(F){var E=F.target;
var H=E.rel;
var G=E.innerHTML;
$$("span.bailoutGuru").dispose();
$$("span.questionAmounts").setStyle("display","inline");
new Element("span",{"class":"bailoutGuru",html:' (<a href="#">Stop helping here</a>)',events:{click:function(){this.onStopBeingGuru(H,G);
return false
}.bind(this)}}).inject(E,"after");
E.nextSibling.nextSibling.nextSibling.hide();
(function(){$$("span.bailoutGuru").dispose();
$$("span.questionAmounts").setStyle("display","inline")
}).delay(6000)
}.bind(this))
}.bind(this));
if(location.href.indexOf("#entry")!=-1){var B=location.href.split("#entry")[1];
var A=$$("span#voteButtons_"+B+" + a.tip_reply");
if(A.length>0){A[0].fireEvent("click");
(function(){$("reply.message").getParent().setStyle("height",Number($("reply.message").getParent().getStyle("height").replace("px",""))+20+"px");
var D=new Element("span",{text:MooTools.lang.get("Guru","answerHelp"),"class":"replyHelp"});
D.inject($("reply.message"),"before");
$("reply.message").focus()
}).delay(1000)
}}if($("bailoutGuru")){$("bailoutGuru").addEvent("click",this.onGuruOptOut);
$("bailoutGuru").checked=true
}if($("acceptGuru")){$("acceptGuru").addEvent("click",this.onGuruOptIn);
$("acceptGuru").checked=false
}},onGuruOptIn:function(){new Request.JSON({method:"post",url:ts.baseUrl+"questions/changeGuruStatus",onSuccess:function(){$reload()
}}).post({bailIn:"true"});
return false
},onGuruOptOut:function(){new Dialog({title:MooTools.lang.get("Guru","stopAllGuruTitle"),message:MooTools.lang.get("Guru","stopAllGuruMessage"),buttons:["ok","cancel"],onOk:function(){new Request.JSON({method:"post",url:ts.baseUrl+"questions/changeGuruStatus",onSuccess:function(){$reload()
}}).post({bailOut:"true"})
}});
return false
},onStopBeingGuru:function(B,A){new Dialog({title:"No longer interested?",message:"Stop helping in "+A+"?<br/><br/>",buttons:["ok","cancel"],onOk:function(){new Request.JSON({method:"post",url:ts.baseUrl+"questions/changeGuruStatus",onSuccess:function(){new Dialog({title:"Please wait",message:"Reloading page ...",buttons:[]});
location.reload(true)
}}).post({destination:B,newStatus:"false"})
}});
return false
},onBecomeGuru:function(C){if(C.destinationId){this.onBecomeGuruRecursive([C.destinationId]);
return false
}var A=1;
var B=new Array();
while($("guruSuggestionCheckbox"+A)){if($("guruSuggestionCheckbox"+A).checked){B.push($("guruSuggestionCheckbox"+A).value)
}A++
}if(B.length==0){new Dialog({title:"No destinations selected!",message:"Please select one or more destinations",buttons:["ok"]})
}else{this.onBecomeGuruRecursive(B)
}},onBecomeGuruRecursive:function(A,B){new Request.JSON({method:"post",url:ts.baseUrl+"questions/changeGuruStatus",onSuccess:function(){if(this["destinations"].length==1){new Dialog({title:"Thanks for helping out!",message:"Questions regarding your selected destination(s) will be periodically mailed to you.",buttons:["ok"],onOk:function(){new Dialog({title:"Please wait",message:"Reloading page ...",buttons:[]});
location.reload(true)
}})
}else{this["destinations"].erase(this["destinations"][0]);
this["recursion"](this["destinations"],this["recursion"])
}}.bind({destinations:A,recursion:B?B:this.onBecomeGuruRecursive})}).post({destination:A[0],newStatus:"true"})
},onChangeGuruness:function(A){$$("div.isGuru, div.notGuru").hide();
$$("div.loadingGuru").show();
new Request.JSON({method:"post",url:ts.baseUrl+"questions/changeGuruStatus",onSuccess:function(B){$$("div.loadingGuru").hide();
if(""+A.become=="true"){$$(".notGuru").hide();
$$(".isGuru").show()
}else{$$(".notGuru").show();
$$(".isGuru").hide()
}}.bind(this)}).post({destination:A.destinationId,newStatus:A.become})
},onFilterWall:function(A){$$(".tipItem").hide();
$$(".tipItem."+A["class"]).show()
},onShowAll:function(A){$$(".tipItem").show()
}});
var HotelBooking=new Class({onBookHotel:function(A){A.hotelUrl=A.hotelUrl.replace("_-_","=");
var B=new Request.JSON({url:ts.baseUrl+"destination/"+A.destinationId+"/bookHotel?type="+A.type,onSuccess:function(){location.href=A.hotelUrl
}.bind(this)});
B.send()
}});
var ImageActions=new Class({initializeImages:function(){this.bindActions($$("a.largeImageLink"))
},onClickLargeImage:function(B){var A=new StickyWin.Modal({content:"<div>"+MooTools.lang.get("Images","loading")+"</div>",id:"largeImageLoadingModalWindow"});
$("largeImageSizeDeterminer").src=B.url;
$("largeImageSizeDeterminer").addEvent("load",function(){this.hide();
var C=new StickyWin.Modal({content:'<img src="'+$("largeImageSizeDeterminer").src+'" alt=""/>',id:"largeImageModalWindow"});
$$("#largeImageModalWindow img")[0].addEvent("click",C.hide.bind(C))
}.bind(A))
}});
var ImageUploader=new Class({Implements:[Options,Events,Actions],options:{type:null,usePreview:"newTipUsePreviewImage",imageUrl:"newTipExternalImageUrl"},initialize:function(A){this.setOptions(A);
this.selectQuery=new Request.HTML({url:(ts.baseUrl+"photos/import"),onSuccess:this.updateImage.bind(this)});
this.uploadQuery=new Request.HTML({url:(ts.baseUrl+"photos/usePreview"),onSuccess:this.updateImage.bind(this)});
if(this.options.actions){this.bindActions($$(this.options.actions+", .imageAction"));
this.addDefaultEvents()
}},onAddImage:function(A){this.imageEditor=new ImageUploadDialog($merge({title:MooTools.lang.get("Images","uploadDialogTitle"),onSelect:this.selectImage.bind(this),onUseImage:this.usePreviewImage.bind(this)},A),A.containerId)
},onRemoveImage:function(A){Dialog.confirm(A,{onConfirm:this.doRemoveImage.bind(this),message:MooTools.lang.get("Images","removeQuestion")})
},doRemoveImage:function(A){new Request.HTML({url:ts.baseUrl+"photos/remove",onSuccess:this.fireEvent.pass(["imageRemoved",A],this)}).post(this.createPost(A,this.options.type));
$reload("#entry"+A.item)
},createPost:function(A,C){var B={};
B[C]=A.item;
return B
},selectImage:function(A){if(this.imageEditor.options.item){this.selectQuery.post($merge(this.createPost(this.imageEditor.options,this.options.type),A||{}))
}else{$(this.options.usePreview).value="false";
$(this.options.imageUrl).value=A.url
}this.imageEditor.destroy()
},usePreviewImage:function(B){if(this.imageEditor.options.item){var A=$merge(this.createPost(this.imageEditor.options,this.options.type),B||{});
this.uploadQuery.post(A)
}else{$(this.options.usePreview).value="true";
$(this.options.imageUrl).value=""
}this.imageEditor.destroy()
},updateImage:function(A){if(typeof (A)=="object"&&this.imageEditor){A=this.imageEditor.options.item
}$reload("#entry"+(A||this.imageEditor.options.entry))
}});
var ImageUploadDialog=new Class({Extends:Dialog,Implements:[Chain,Actions],Binds:["destroy","changePage","queryImages","updateImageList","uploadImage","toggleLink"],uploadOptions:{title:MooTools.lang.get("Images","uploadDialogTitle"),id:"imageUploadDialog_win",dialog:"imageUploadDialog",mainPage:"selectServicePage",pages:["myComputer","myFlickr","myPicasa","images"]},postVars:{page:1},initialize:function(B,A){var D=$merge(this.uploadOptions,B);
if(A){this["containerId"]=A
}var C=$(D.dialog).clone();
C.getElement("div.page").show();
if(!A){this.bindActions(C.getElements(".uploadAction"));
this.parent($merge({elements:C.getChildren()},D||{}))
}else{$(A).adopt(C.getChildren());
$(A).show();
this.bindActions($$("div#"+A+" .uploadAction"))
}this.addEvents({cancel:this.destroy,"continue":this.toggleLink,nextImages:this.page.pass(1,this),prevImages:this.page.pass(-1,this),go:this.changePage,upload:this.uploadImage});
this.query=new Request.HTML({url:(ts.baseUrl+"photos/"),onSuccess:this.updateImageList})
},changePage:function(A){$$(this.getContainerRoot()+" .page").each(function(B){B.hide()
});
$$(this.getContainerRoot()+" .page."+A.page).each(function(B){B.show()
});
if(A.s){this.postVars.service=A.s
}},page:function(A){this.postVars.page+=A;
this.loadImages()
},queryImages:function(){this.postVars.uid=$$(this.getContainerRoot()+" input")[0].value;
this.loadImages()
},loadImages:function(A){this.query.post(this.postVars)
},updateImageList:function(B){var A=$$(this.getContainerRoot()+" .imageList")[0];
A.empty();
A.adopt(B);
this.bindActions($$(this.getContainerRoot()+" .imageList .action"));
if(this["containerId"]){this.addEvents({select:this.select})
}},select:function(A){$(this["containerId"]).fireEvent("imageSelected",A)
},uploadImage:function(){var D=null;
if($$(this.getContainerRoot()+" iframe")[0]["contentDocument"]!=null){D=$$(this.getContainerRoot()+" iframe")[0].contentDocument
}else{D=$$(this.getContainerRoot()+" iframe")[0].contentWindow.document
}D.getElementById("uploadMaxSizeAndLoadingInfo").innerHTML="Please wait a moment while your image is being received ...";
D.getElementById("browseThigy").style.display="none";
var B=D.getElementById("hiddenSubmit");
B=$(B);
if(B){B.click()
}$$(this.getContainerRoot()+" a[rel=useImage]").hide();
$$(this.getContainerRoot()+" a[rel=upload]").dispose();
$$(this.getContainerRoot()+" a[rel=cancel]").dispose();
var C="";
var A=function(){var E=null;
if($$(this.getContainerRoot()+" iframe")[0]["contentDocument"]!=null){E=$$(this.getContainerRoot()+" iframe")[0].contentDocument
}else{E=$$(this.getContainerRoot()+" iframe")[0].contentWindow.document
}if(C==""&&E.getElementById("prevImage")!=null){C=E.getElementById("prevImage").src;
$clear(this.periodicalId);
if(this["containerId"]){$(this["containerId"]).fireEvent("uploadComplete",C)
}else{$$(this.getContainerRoot()+" a[rel=useImage]").fireEvent("click")
}}}.bind(this);
this.periodicalId=A.periodical(500,this)
},toggleLink:function(A){if(!$$(this.getContainerRoot()+" input[name=confirmAccount]")[0].checked){return alert(MooTools.lang.get("Images","licenseError"))
}this.changePage(A);
this.queryImages()
},destroy:function(){if(this["containerId"]){$(this["containerId"]).fireEvent("destroy")
}else{this.hide()
}},getContainerRoot:function(){return(this["containerId"])?"#"+this["containerId"]:".StickyWinInstance"
}});
var InlineEditor=new Class({Implements:[Options,Events,Actions,ToElement],Binds:["doClose"],options:{content:null,"class":"editor",action:null,editor:"<textarea id='text{id}' name='{name}'>{message}</textarea>"},initialize:function(A){this.setOptions(A);
this.element=new Element("form",{"class":this.options["class"],id:"editor"+this.options.id,action:this.options.action,method:"post"});
var B={message:$(this.options.content)?$(this.options.content).toEditorString():"",name:"message"};
this.element.set("html",this.options.editor.substitute($merge(B,this.options)));
this.bindActions(this.element.getElements(".action"),{});
this.element.getElements(".closeEditor").each(function(C){C.addEvent("click",this.doClose)
}.bind(this))
},doClose:function(){this.element.dispose()
}});
var __editorButtons__='<input class="action button" type="button" value="{editorButtonsSave}" rel="save"/> {editorButtonsOr} <input class="action button" type="button" value="{editorButtonsCancel}" rel="destroy"/>';
var InplaceEditor=new Class({Implements:[Options,Events,Actions],options:{args:null,"class":"inplaceEditor",name:"message",editor:'<input name="{name}" value="{text}" type="text"/> '+__editorButtons__},element:null,original:null,initialize:function(B,A){this.setOptions(A);
this.setOptions(MooTools.lang.get("InlineEditor"));
this.original=B;
this.element=new Element("div",{"class":this.options["class"]});
this.element.set("html",this.options.editor.substitute(this.options));
if(!A.hide||A.hide!="false"){this.original.hide()
}this.element.inject(this.original,"after");
this.addDefaultEvents();
this.bindActions(this.element.getElements(".action"))
},onSave:function(B){var A=$merge(this.options.args||{},B||{});
this.element.getElements("input[name="+this.options.name+"], textarea[name="+this.options.name+"]").each(function(C){if(C.get("type")!="button"){A[C.get("name")]=C.get("value")
}});
this.original.set("html",A[this.options.name].formatEditorString(this.options));
this.fireEvent("success",A);
this.destroy()
},onDestroy:function(){this.destroy()
},destroy:function(){this.fireEvent("close",[]);
this.element.destroy();
this.original.show()
}});
InplaceEditor.TextArea=new Class({Extends:InplaceEditor,initialize:function(B,A){var C={editor:'<textarea name="{name}">{text}</textarea>'+__editorButtons__};
this.parent(B,$merge(A,C))
}});
InplaceEditor.Date=new Class({Extends:InplaceEditor,initialize:function(B,A){var C={format:"%m/%d/%Y",editor:'<input id="datePicker{entry}" name="{name}" value="{text}" type="hidden"/>'};
this.parent(B,$merge({type:"text"},A,C));
this.datePicker=new DatePicker("datePicker"+this.options.entry,{stickyWinOptions:{relativeTo:$(A.element)},onPick:this.onSave.bind(this),onHide:this.onDestroy.bind(this)});
this.datePicker.show()
}});
var InplaceEditEvents=new Class({onEdit:function(A,B){var D={onClose:B.show.bind(B),onSuccess:function(E){this.success(A.url||this.options.editUrl,E,B)
}.bind(this)};
if(B.get("name")){D.name=B.get("name")
}if(A.element){B.hide()
}var C=$(A.element||B);
C.edit($merge(D,A))
},success:function(B,A,C){new Request.HTML({url:B,onSuccess:this.inplaceEditSuccess.pass([A,C],this)}).post(A)
},inplaceEditSuccess:function(B,C){var A=C.get("name")||B.name;
if(A){this.fireEvent(A.replace(/\./g,"-").camelCase()+"EditSuccess",arguments)
}}});
Element.implement({toEditorString:function(){return this.get("html").replace(/\<br\>/g,"\n").stripTags().trim()
},edit:function(B){if(this.hasClass("date")){var C=this.toEditorString();
var A=C!=""?new Date().parse(C):new Date();
new InplaceEditor.Date(this,$merge({text:A.format("%m/%d/%Y")},B||{}))
}else{if(this.hasClass("textarea")){new InplaceEditor.TextArea(this,$merge({text:this.toEditorString(),args:$args(this.get("rel"))},B||{}))
}else{new InplaceEditor(this,$merge({text:this.toEditorString()},B||{}))
}}}});
String.implement({formatEditorString:function(A){if(A&&(A.bold=="false"||!A.bold)){return this.replace(/\n/g,"<br />")
}var B=this.split(/([?!.])/,2);
str="<b>"+B[0]+(B.length>1?B[1]:"")+"</b>"+this.substr(B[0].length+1);
return str.replace(/\n/g,"<br />")
}});
var LazyLoad=new Class({Implements:[Options,Events],options:{range:200,image:"blank.gif",resetDimensions:true,elements:"img",container:window,fireScroll:true,mode:"vertical"},initialize:function(B){this.setOptions(B);
this.container=document.id(this.options.container);
this.elements=$$(this.options.elements);
var A=(this.options.mode=="vertical"?"y":"x");
this.containerDimension=this.container.getSize()[A];
this.start=0;
this.elements=this.elements.filter(function(D){if(D.getPosition(this.container)[A]>this.containerDimension+this.options.range){D.store("oSRC",D.get("src")).set("src",this.options.image);
if(this.options.resetDimensions){D.store("oWidth",D.get("width")).store("oHeight",D.get("height")).set({width:"",height:""})
}return true
}},this);
var C=function(){var D=this.container.getScroll()[A];
if(D>this.start){this.elements=this.elements.filter(function(E){if((this.container.getScroll()[A]+this.options.range+this.containerDimension)>=E.getPosition(this.container)[A]){if(E.retrieve("oSRC")){E.set("src",E.retrieve("oSRC"))
}if(this.options.resetDimensions){E.set({width:E.retrieve("oWidth"),height:E.retrieve("oHeight")})
}this.fireEvent("load",[E]);
return false
}return true
},this);
this.start=D
}this.fireEvent("scroll");
if(!this.elements.length){this.container.removeEvent("scroll",C);
this.fireEvent("complete")
}}.bind(this);
this.container.addEvent("scroll",C);
if(this.options.fireScroll){this.container.fireEvent("scroll")
}}});
var MiniTaste=new Class({MIN_NUMBER_OF_REQUIRED_RATINGS:5,Implements:[Options,Events,Actions],MAP_COOKIE:"tsMapFilters",MAP_SIZE_ADJUST:115,TASTE_ICON_PATH:"gfx/icons/taste/",MAP_UPDATE_DELAY:666,previousUpdateLocation:[],rated:[],rateMode:-1,rateTypes:["best","love","hate","wish","empty"],originalDraggablePositions:[],draggables:[],nowDragging:false,mapMarkers:[],zoomed:false,nonCompleteIsOk:false,forceDestination:-1,previousZoomLevel:-1,options:{markerXoffset:0,markerYoffset:0},shortcuts:[{name:"Whole world",lat:25.79989118208833,lng:-113.203125,zoom:2,countries:[]},{name:"Africa",lat:-8.754794702435605,lng:2.98828125,zoom:3,countries:[]},{name:"Asia",lat:28.767659105691227,lng:74.8828125,zoom:3,countries:[]},{name:"Australia",lat:-27.916766641249062,lng:122.255859375,zoom:4,countries:[]},{name:"Europe",lat:53.33087298301704,lng:-2.4609375,zoom:3,countries:[]},{name:"North America",lat:29.53522956294847,lng:-118.125,zoom:3,countries:[]},{name:"South America",lat:-22.10599879975055,lng:-83.3203125,zoom:3,countries:[]}],rateMotivators:{"default":"Please continue rating places to discover more likeminded travelers!",rated_1:[{maxAverage:1,message:"So you liked it, eh? How about telling us what you DON'T like?"},{maxAverage:0,message:"Hmm...okay. How about rating something really good or bad?"},{maxAverage:-1,message:"Come on, be a bit more positive. Tell us what you like!"}],rated_2:[{maxAverage:1,message:"Come on, tell something you DON'T like? Don't be shy!"},{maxAverage:0,message:"OK, now we have both. So, how about rating more?"},{maxAverage:-1,message:"Why so negative? There must be something you like?"}],rated_3:[{maxAverage:1,message:"Please continue rating to improve your results."}]},exampleRound:function(){$("tasteH1").fade("out");
var A=new Request({url:this.options.exampleUrl,onSuccess:function(D,C){$("example").set("html",D);
var B=new Array();
$each($$("#example img"),function(E){B.push(E.src)
});
new Asset.images(B,{onComplete:function(){$$(".helicopter img").show();
var E=new Fx.Morph($("example"),{duration:"long",onComplete:function(){var F=new Fx.Morph($("example"),{onComplete:function(){$$(".helicopter img").hide();
$("tasteH1").fade("in")
},duration:"long"});
F.start({opacity:[1,0]})
}.delay(30000)});
E.start({opacity:[0,1]})
}})
}});
A.send({method:"get",data:"ignored="+$("exampleProfileId").value})
},initialize:function(B){if($isIE6()){var A=new Element("div",{html:'You are using Internet Explorer 6, a browser which is almost eight years old.<br/>Please consider <a href="http://www.microsoft.com/windows/internet-explorer">updating your browser</a> or installing one of these fine alternatives:<br/><br/><a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br/><a href="http://www.apple.com/safari/">Apple Safari</a><br/><a href="http://www.google.com/chrome">Google Chrome</a><br/><a href="http://www.opera.com/">Opera Browser</a><br/><br/>By updating your browser you enhance your web surfing<br/>experience and make using your computer much safer.<br/><br/><a class="button right" style="text-decoration:none" href="'+ts.baseUrl+'map/"><span>Proceed anyway</span></a>',"class":"ie6"});
A.inject($$("body")[0]);
$("messages").dispose();
$("helperGuru").dispose();
return 
}this.setOptions(B);
if(this.options.isAnonymous){Cookie.write("tasteTest",""+new Date(),{path:"/"})
}if(!this.options.facebook){$$(".helicopter img").hide();
this.exampleRound.periodical(50000,this)
}this.bindActions($$(".action"));
this.addDefaultEvents();
this.initializeMap();
this.enableDrag();
$each($$("#rateModes a label.draggable"),function(C,D){this.originalDraggablePositions.push(C.getStyle("top"))
}.bind(this));
this.disableDrag();
$each(this.shortcuts,function(F,E){var D=new Element("a",{html:F.name,events:{click:function(){this.clickShortcut(F,E)
}.bind(this)}});
D.inject($("shortcuts"));
var C=new Element("span",{id:"subplaces"+E,"class":"subplaceContainer",styles:{display:"none"}});
C.inject($("shortcuts"));
if(F.countries.length>0){$("subplaces"+E).appendText(": ");
$each(F.countries,function(I,H){var G=new Element("a",{html:I.name,events:{click:function(){this.clickShortcut(I)
}.bind(this)}});
G.inject($("subplaces"+E));
if(H<F.countries.length-1){$("subplaces"+E).appendText(", ")
}}.bind(this))
}if(E<this.shortcuts.length-1){$("shortcuts").appendText(" | ")
}}.bind(this));
if(Cookie.read("minitasteZoom")){this.zoomed=true
}else{this.zoomed=false
}this.updateAmounts();
this.preloadRatedIcons()
},preloadRatedIcons:function(){if(document.images){var C=[];
for(var B=0;
B<this.rateTypes.length;
B++){var A=new Image();
A.src=this.getIconURLForRating(B);
C.push(A)
}}},clickShortcut:function(A,B){if(B){$$(".subplaceContainer").hide();
$("subplaces"+B).setStyle("display","inline")
}this.onMapPreset(A)
},initializeMap:function(){google.load("maps","2",{callback:function(){this.onMapReady()
}.bind(this)})
},onMapReady:function(){this.map=new google.maps.Map2($("map"));
this.emptyIcon=new google.maps.Icon();
this.emptyIcon.image=ts.baseUrl+this.TASTE_ICON_PATH+"empty.png";
this.emptyIcon.iconSize=new google.maps.Size(34,37);
this.emptyIcon.iconAnchor=new google.maps.Point(16,28);
this.emptyIcon.bubbleAnchor=this.LOW_BUBBLE;
var G=this.shortcuts[0].lat;
var B=this.shortcuts[0].lng;
var E=this.shortcuts[0].zoom;
var D=location.href.split(/[#,]/);
if(D.length>3){D[3]=D[3].split(/&/)[0]
}if(D.length!=4){var A=new RegExp("rnd=([0-9]*),([0-9.-]*),([0-9.-]*),([0-9]*)").exec(location.href);
if(A!=null){D=new Array();
for(var C=0;
C<4;
++C){D[C]=A[C+1]
}}}if(D.length==4){var G=new Number(D[1]);
var B=new Number(D[2]);
var E=8;
this.forceDestination=new Number(D[3])
}this.map.setCenter(new google.maps.LatLng(G,B),E,G_SATELLITE_MAP);
var F=G_ANCHOR_TOP_RIGHT;
if(this.options.controlPosition=="top_left"){F=G_ANCHOR_TOP_LEFT
}this.map.addControl(getTsMapControl(true),new google.maps.ControlPosition(F,new google.maps.Size(12,12)));
this.map.enableScrollWheelZoom();
google.maps.Event.addListener(this.map,"zoomend",this.onMapMoveOrZoom.bind(this));
google.maps.Event.addListener(this.map,"moveend",this.onMapMoveOrZoom.bind(this));
google.maps.Event.addListener(this.map,"movestart",this.clearSubtitles.bind(this));
if(this.options.ratedAnything){this.preRate(this.options.best,0);
this.preRate(this.options.loved,1);
this.preRate(this.options.hated,2);
this.preRate(this.options.wished,3);
this.updateSpeechBubble()
}this.refreshStuffOnMap(true,true);
this.LOW_BUBBLE=new google.maps.Point(3,28);
this.HIGH_BUBBLE=new google.maps.Point(3,18)
},preRate:function(B,A){$each(B,function(C){this.rated.push({rating:A,destinationId:C.id,country:C.country,title:C.title});
if(this.options.isAnonymous){this.addShortcut({title:C.title,getLatLng:function(){return new google.maps.LatLng(C.lat,C.lng)
}})
}}.bind(this));
this.updateAmounts()
},hideShadows:function(){$$("div#map img[src="+ts.baseUrl+"gfx/blank.gif]").hide()
},onMapPreset:function(B){var A=new google.maps.LatLng(B.lat,B.lng);
var C=new Number(B.zoom)+0;
this.clearSubtitles();
this.map.setCenter(A,C);
return false
},onMapMoveOrZoom:function(A){this.disableDrag();
if(this.previousZoomLevel!=this.map.getZoom()){this.clearSubtitles();
this.clearMarkers()
}$clear(this["mapZoomMoveTimer"]);
this["mapZoomMoveTimer"]=function(){if(this.map.getZoom()<2){this.map.setZoom(2)
}if(this.shortcuts[0]["zoom"]!=this.map.getZoom()){this.zoomed=true
}this.refreshStuffOnMap(false,this.previousZoomLevel!=this.map.getZoom())
}.bind(this).delay(this["MAP_UPDATE_DELAY"])
},onShowStep:function(A){this.showStep(A.step)
},refreshStuffOnMap:function(A,B){$clear(this["makeAjaxRequestTimer"]);
this["makeAjaxRequestTimer"]=function(){this.previousZoomLevel=this.map.getZoom();
if(this["request"]!=null){this["request"].cancel()
}if(B){this.clearMarkers()
}this["request"]=new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"index/search",onSuccess:function(G){this["request"]=null;
this.previousUpdateLocation.lat=this.map.getCenter().lat();
this.previousUpdateLocation.lng=this.map.getCenter().lng();
this.previousUpdateLocation.zoom=this.map.getZoom();
if(!G.ready){this.map.setZoom(this.map.getZoom()-1);
return 
}this.options.places=G.markers;
this.drawMarkers(B);
this.enableDrag()
}.bind(this)});
var C=this.map.getBounds().getSouthWest();
var E=this.map.fromLatLngToDivPixel(C);
E.x+=this.options.markerXoffset;
E.y-=this.options.markerYoffset;
var D=this.map.fromDivPixelToLatLng(E);
var F={nelat:this.map.getBounds().getNorthEast().lat(),nelng:this.map.getBounds().getNorthEast().lng(),swlat:D.lat(),swlng:D.lng(),level:this.map.getZoom()};
if(this.forceDestination>0){F.forceDestination=this.forceDestination
}this.request.send(JSON.encode(F))
}.bind(this).delay(A?0:this["MAP_UPDATE_DELAY"])
},enableDrag:function(){var A={onDrop:function(C,F,E){this.disableDrag();
if(F==null){this.enableDrag();
return 
}var H=F.getStyle("top");
var B=F.getStyle("left");
var G=null;
$each($$("img[src="+ts.baseUrl+"gfx/blank.gif]"),function(J,I){if((G==null)&&(J.getStyle("top")==H)&&(J.getStyle("left")==B)){G=new Number(J.getStyle("height").replace("px",""))
}}.bind(this));
if(G==null){this.enableDrag();
return 
}var D=false;
$each(this.mapMarkers,function(J){if(J.destinationId==G){D=true;
this.clickMarker(J);
if(this.options.isAnonymous){var I=new Request({url:this.options.rateUrl});
I.send("destination="+G+"&count="+this.rated.length+"&rating="+this.rateMode)
}}}.bind(this));
if(!D){this.enableDrag();
return 
}C.fireEvent("cancel")
}.bind(this),droppables:new Array(),checkDroppables:false};
$each($$("div#map < div < div < div < img"),function(B){if(B.id.contains("mtgt_unnamed")){A.droppables.push(B);
B.setStyle("cursor","-moz-grab")
}}.bind(this));
$each($$("#rateModes a label.draggable"),function(C,B){A.onStart=function(){this.rateMode=B;
this.nowDragging=true
}.bind(this);
C.setStyle("opacity",1);
this.draggables.push(C.makeDraggable(A))
}.bind(this));
$each($$("a.button"),function(C,B){C.removeClass("tempDisabled")
})
},disableDrag:function(){$each($$("#rateModes a label.draggable"),function(B,A){B.setStyle("opacity",0.3)
});
$each($$("a.button"),function(B,A){B.addClass("tempDisabled")
});
$each(this.draggables,function(A){A.detach()
}.bind(this));
this.draggables.empty();
this.resetDrag()
},resetDrag:function(){$each($$("#rateModes a label.draggable"),function(B,A){B.setStyle("top","");
B.setStyle("left","");
B.setStyle("visibility","visible")
}.bind(this))
},clearMarkers:function(){this.map.clearOverlays();
this.clearSubtitles()
},clearSubtitles:function(){$$(".tasteMarkerName").dispose()
},drawMarkers:function(A){if(A){this.mapMarkers.empty();
this.clearMarkers();
$each(this.options.places,function(B){this.drawMarker(B,true)
}.bind(this))
}else{$each(this.options.places,function(B){var D=false;
for(var C=0;
C<this.mapMarkers.length;
++C){if(!D&&this.mapMarkers[C].destinationId==B.id){D=true;
break
}}if(!D){this.drawMarker(B,false)
}}.bind(this));
$each(this.mapMarkers,function(B){this.makeSubtitle(B,B.destinationId==this.forceDestination)
}.bind(this))
}this.hideShadows()
},getTasteIcon:function(C){var B=new google.maps.Icon(this.emptyIcon);
var A=this.getRating(C);
if(A>-1){B.image=this.getIconURLForRating(A)
}B.shadow=ts.baseUrl+"gfx/blank.gif";
B.shadowSize=new google.maps.Size(0,C);
return B
},drawMarker:function(C,E){var B={icon:this.getTasteIcon(C.id)};
if(C.id==this.forceDestination){B.zIndexProcess=function(){return 350
}
}var F=new google.maps.LatLng(C.lat,C.lng);
var A=new google.maps.Marker(F,B);
A.destinationId=C.id;
A.title=C.name;
A.country=C.country;
A.text="";
var D=this.getRating(C.id);
if(!D){D=4
}A.rating=D;
this.map.addOverlay(A);
this.mapMarkers.push(A);
if(E){this.makeSubtitle(A,C.id==this.forceDestination)
}google.maps.Event.addListener(A,"click",function(){this.clickMarker(A)
}.bind(this))
},makeSubtitle:function(E,H){var I="#fff";
var C="#3f4853";
if(H){I="#3f4853";
C="#fff"
}var B=E.getLatLng();
var G=this.map.fromLatLngToContainerPixel(B).x;
var F=new Number($$("#map")[0].getStyle("width").substr(0,3))+1;
if(G<F){var A=new Element("div",{html:E.title,"class":"tasteMarkerName",styles:{top:this.map.fromLatLngToContainerPixel(B).y+"px",left:G+"px","z-index":"180",color:I}});
A.inject($("map"));
var D=A.clone();
D.setStyle("color",C);
D.setStyle("z-index","179");
D.setStyle("left",(G-1)+"px");
D.inject($("map"));
D=D.clone();
D.setStyle("left",(G+1)+"px");
D.inject($("map"));
D=D.clone();
D.setStyle("top",(this.map.fromLatLngToContainerPixel(B).y-1)+"px");
D.setStyle("left",(G)+"px");
D.inject($("map"));
D=D.clone();
D.setStyle("top",(this.map.fromLatLngToContainerPixel(B).y+1)+"px");
D.setStyle("left",(G)+"px");
D.inject($("map"))
}},updateAmounts:function(){var A=5-this.rated.length;
if(A>0){$("resultButton").className="buttons noProceed";
$$("#resultButton span")[0].set("html",'<span class="bigNumber">'+A+'</span> places to be rated<br/><font color="#AAAAAA">before results can be calculated</font>');
$$("a[rel=tasteResults]").addClass("disabled")
}else{$("resultButton").className="buttons proceed";
$$("#resultButton span")[0].set("html","Keep on rating or proceed to recommendations for you");
$$("a[rel=tasteResults]").removeClass("disabled");
var B=$("fbProceed");
if(B){B.show()
}}},getRating:function(B){for(var A=0;
A<this.rated.length;
A++){if(this.rated[A].destinationId==B){return this.rated[A].rating
}}return -1
},clickMarker:function(B){if(!this.nowDragging){var A=false;
$each(this.mapMarkers,function(H,G){if(H.destinationId==B.destinationId){H.setImage(this.getIconURLForRating(4));
H.rating=-1;
var F=Array();
$each(this.rated,function(I){if(I.destinationId!=B.destinationId){F.push(I)
}else{A=true
}}.bind(this));
if(A){this.rated=F;
this.updateAmounts();
this.updateSpeechBubble();
new Request.JSON({url:this.options.dropRatingUrl+B.destinationId+"/dropRating",onComplete:function(){new Dialog({title:"Rating dropped",message:"Your rating for "+this.title+" has been removed.<br/><br/>",buttons:["Okay"]})
}.bind(B)}).post()
}}}.bind(this));
if(!A){new Dialog({title:"Drag & drop",message:"Drag the icons from the top right <br/>corner to here to rate this place!"})
}return 
}if(this.rateMode==0){var C=new Array();
for(var D=0;
D<this.rated.length;
D++){if(this.rated[D].rating>0){C.push(this.rated[D])
}else{$$("a[rel="+this.rated[D].title.replace(" ","_")+"]").dispose();
$$("span[rel="+this.rated[D].title.replace(" ","_")+"]").dispose()
}}this.rated=C
}var E=this.getRating(B.destinationId);
if(E>-1){for(var D=0;
D<this.rated.length;
D++){if(this.rated[D].destinationId==B.destinationId){this.rated[D].rating=this.rateMode;
this.postClick(this.rated[D].destinationId);
return 
}}}else{this.rated.push({rating:this.rateMode,destinationId:B.destinationId,country:B.country,title:B.title});
this.addShortcut(B)
}this.postClick(B.destinationId)
},postClick:function(A){this.nowDragging=false;
this.updateAmounts();
this.updateSpeechBubble();
if(this.rateMode==0){var B=this.getIconURLForRating(0);
$each(this.mapMarkers,function(D,C){if(D.rating==0){D.setImage(this.getIconURLForRating(4));
D.rating=4;
D.reason=""
}}.bind(this))
}$each(this.mapMarkers,function(D,C){if(D.destinationId==A){D.setImage(this.getIconURLForRating(this.rateMode));
D.rating=this.rateMode;
D.reason=""
}}.bind(this));
this.enableDrag();
this.askForReason(this.rateMode,A)
},addShortcut:function(B){$("nowRated").show();
if($("nowRatedList").getChildren().length>0){var C=new Element("span",{html:", ",rel:B.title.replace(" ","_")});
C.inject($("nowRatedList"))
}var A=new Element("a",{href:"#",html:B.title,"class":"nowRated",rel:B.title.replace(" ","_"),events:{click:function(){this.map.setCenter(B.getLatLng(),6,G_SATELLITE_MAP);
return false
}.bind(this)}});
A.inject($("nowRatedList"))
},updateSpeechBubble:function(M){var O="You've rated "+this.rated.length+" place"+(this.rated.length==1?"":"s")+" in ";
var K=new Array();
$each(this.rated,function(Q){if(!K.contains(Q.country)){K.push(Q.country)
}}.bind(this));
O+=K.length+" "+(K.length==1?"country":"countries");
O+=".";
var F="";
if(this.rated.length>4){F="You can still continue rating to improve results."
}else{F="Rate at least "+(this.MIN_NUMBER_OF_REQUIRED_RATINGS-this.rated.length)+" more place"+(this.rated.length==(this.MIN_NUMBER_OF_REQUIRED_RATINGS-1)?".":"s.")
}var P="";
var E=this.getRatingsLists();
var L=E.best.split(",").length-1;
var D=E.love.split(",").length-1;
var N=E.hate.split(",").length-1;
var C=E.wish.split(",").length-1;
var J=L+D+N+C;
var H=((D+L-N)/(J));
if(!this.rateMotivators["rated_"+J]){P=this.rateMotivators["default"]
}else{var G=this.rateMotivators["rated_"+J];
var A=null;
for(var I=0;
I<G.length;
++I){var B=new Number(G[I]["maxAverage"]);
B+=0.0001;
if(B>H){A=G[I]["message"]
}else{break
}}P=A
}if(!M||M==0){M=Math.round(Math.random()*100)%3+1
}if((M==2)&&(F=="")){++M
}if((this.rated.length>this.MIN_NUMBER_OF_REQUIRED_RATINGS-1)&&(M==2)){++M
}$("messageText").empty();
switch(M){case 2:$("messageText").innerHTML=F;
this.addSpeechBubbleLink(3);
break;
case 3:$("messageText").innerHTML=P;
this.addSpeechBubbleLink(1);
break;
default:$("messageText").innerHTML=O;
this.addSpeechBubbleLink(2);
break
}},addSpeechBubbleLink:function(B){$("messageText").appendText(" ");
var A=new Element("a",{html:"more","class":"more",events:{click:function(){this.updateSpeechBubble(B)
}.bind(this)}});
A.inject($("messageText"))
},onTasteResults:function(B){Cookie.write("minitasteZoom","true",{duration:14});
if(!this.zoomed){this.zoomed=true;
new Dialog({title:"Did you know?",message:"<b>Zoom and pan</b> the map to find more places!<br/><br/>",buttons:["proceed","back to map"],onProceed:function(){(function(){$$("a[rel=tasteResults]")[0].fireEvent("click")
}).delay(1000)
}.bind(this)});
return 
}if(!this.nonCompleteIsOk){var A=true;
$each($$("div#rateModes span.x"),function(C){if(C.getStyle("display")!="none"){A=false
}}.bind(this));
if(!A){new Dialog({title:"Ready already?",message:"How about rating a few more places? <b>The more you rate, the better tips you will get.</b><br/>",buttons:["show tips","rate more"],onShowtips:function(){this.nonCompleteIsOk=true;
this.onTasteResults()
}.bind(this)});
return 
}}new Dialog({title:"Calculating recommendations",message:"Please wait a moment ...",buttons:[]});
if(this.request){this.request.cancel()
}new Request.HTML({url:this.options.saveUrl,method:"post",onSuccess:function(){if(this.options.facebook){top.location.href=this.options.resultUrl
}else{location.href=this.options.resultUrl
}}.bind(this)}).post(this.getRatingsLists())
},getRatingsLists:function(){var A={best:"",love:"",hate:"",wish:"",reason:""};
for(var B=0;
B<this.rated.length;
B++){switch(this.rated[B].rating){case 0:A.best+=this.rated[B].destinationId+",";
break;
case 1:A.love+=this.rated[B].destinationId+",";
break;
case 2:A.hate+=this.rated[B].destinationId+",";
break;
default:A.wish+=this.rated[B].destinationId+",";
break
}if(this.rated[B].reason&&this.rated[B].reason.trim().length>0){A.reason+=this.rated[B].destinationId+"@"+this.rated[B].reason+","
}}return A
},getIconURLForRating:function(A){return ts.baseUrl+this.TASTE_ICON_PATH+this.rateTypes[A]+".png"
},onCloseStartIntro:function(){$("startIntro").hide();
$("fbFrame").removeClass("faint")
},onCloseBubble:function(){$("allBubbles").hide()
},onShowBubble:function(){$("allBubbles").show()
},onCancelReason:function(){$("reasons").hide();
$("reasonText").value=""
},onEnterReason:function(A){var C=$("reasonText").value;
if(C.length<5||C.indexOf("Ex.")==0){return 
}for(var B=0;
B<this.rated.length;
B++){if(this.rated[B].destinationId==$("reasonId").value){this.rated[B].reason=C
}}$("reasons").hide();
$("reasonText").value="";
this.updateSpeechBubble(3)
},askForReason:function(A,B){if(A==3){return 
}$("reasonIntro").empty();
$("reasonIntro").appendText("You");
$("reasonId").value=B;
switch(A){case 0:$("reasonIntro").appendText(" love ");
$("reasons").className="best";
break;
case 1:$("reasonIntro").appendText(" like ");
$("reasons").className="";
break;
case 2:$("reasonIntro").appendText(" hate ");
$("reasons").className="hate";
break
}$each(this.options.places,function(C){if(C.id==B){$("reasonIntro").appendText(C.name+"! Care to tell a reason?")
}});
$("reasons").show()
}});
var MiniTasteCarousel=new Class({Implements:[Options,Events,Actions],carouselContainer:"likemindedCarousel",previousButton:"previous",nextButton:"next",viewWidth:840,fullWidth:0,viewBlocks:0,curPos:0,nextTween:null,previousTween:null,initializeMiniTasteCarousel:function(A){if($(this.carouselContainer)==null){return 
}this.viewWidth=$(this.carouselContainer).getChildren()[0].getStyle("width").toInt();
this.viewBlocks=$(this.carouselContainer).getChildren().indexOf($(this.carouselContainer).getChildren().getLast())+1;
$(this.carouselContainer).setStyle("width",this.viewBlocks*this.viewWidth);
this.fullWidth=$(this.carouselContainer).getStyle("width").toInt();
this.updateButtons();
this.nextTween=new Fx.Tween($(this.carouselContainer),{transition:Fx.Transitions.Sine.easeInOut,link:"chain",onComplete:function(){this.updateButtons()
}.bind(this)});
this.previousTween=new Fx.Tween($(this.carouselContainer),{transition:Fx.Transitions.Sine.easeInOut,link:"chain",onComplete:function(){this.updateButtons()
}.bind(this)})
},onNext:function(){if(this.curPos<this.viewBlocks-1){this.curPos++;
this.nextTween.start("right",this.curPos*this.viewWidth)
}},onPrevious:function(){if(this.curPos>0){this.curPos--;
this.previousTween.start("right",this.curPos*this.viewWidth)
}},isFirst:function(){if(this.curPos==0){return true
}else{return false
}},isLast:function(){if(this.curPos==(this.viewBlocks-1)){return true
}else{return false
}},updateButtons:function(){var B=$(this.nextButton);
var A=$(this.previousButton);
if(A){if(this.isFirst()){A.addClass("disabled")
}else{A.removeClass("disabled")
}if(this.isLast()){B.addClass("disabled")
}else{B.removeClass("disabled")
}}}});
var MiniTasteResults=new Class({firstShownRecommender:[],Binds:["onCancel"],tabs:["recommended","friends","likeminded","invite","tripsay"],initializeMiniTasteResults:function(){$$("div.joinAdvertisement").dispose();
if($("usernameField")){$("usernameField").addEvent("keyup",function(){this.validateUsername(this.options.verifyUsernameUrl,$("usernameField"),$("usernameError"),false,false)
}.bind(this))
}if($("emailField")){$("emailField").addEvent("keyup",function(){this.validateEmail(this.options.verifyEmailUrl,$("emailField"),$("emailError"),false,false)
}.bind(this))
}this.emailOK=false;
this.usernameOK=false;
window.addEvent("load",function(){$each($$("div.image img"),function(C,A){var B=C.offsetWidth;
if(C.offsetWidth<100){C.alt="";
B=239
}C.getParent().setStyle("width",B+"px");
C.getNext().setStyle("width",(B-50)+"px")
});
$each($$(".similarPercent a"),function(A){A.addEvent("mouseover",function(){var B=A.get("rel");
var C=$args(B);
$$("#container"+C.container+" .tab.selected").each(function(D){D.removeClass("selected")
});
$$("#container"+C.container+" #bubble"+C.container+"_"+C.user).each(function(D){D.addClass("selected")
})
})
});
$each($$(".tasteFlickrInfo"),function(A){if(!A.getNext("img").get("longdesc")){return 
}A.set("html",'(CC) [Photo: <a href="'+A.getNext("img").get("longdesc").split("@@@@@")[2]+'" target="_blank">'+A.getNext("img").get("longdesc").split("@@@@@")[1]+"</a>]");
A.setStyle("width",(A.getNext("img").offsetWidth-1)+"px");
A.setStyle("top",(A.getNext("img").offsetHeight-13)+"px")
})
}.bind(this));
if(this.inFacebook()){this.adjustForFacebook()
}if(this.options.recommendations>0&&this.options.self&&!this.options.registered&&!this.inFacebook()){this.showRegisterLightbox()
}},showRegisterLightbox:function(){new Dialog({title:"Stay tuned for Taste updates!",message:'<h3 class="tasteUpdates"><img src="'+ts.baseUrl+'gfx/taste/who_are_you.png" alt=""/>Compare your travel taste with your friends!</h3><p style="clear:both">Username: <span class="light">(something your friends recognize)</span><span class="tasteResultPageError" id="lightbox_login_error"></span><br/><input style="width:260px" type="text" id="lightbox_loginname"/><br/>Email: <span class="light">(for validation and updates)</span><span class="tasteResultPageError" id="lightbox_email_error"></span><br/><input style="width:260px" type="text" id="lightbox_email"/><br/></p><p class=\'light\'>(We won\'t give your email to any third party)</p>',buttons:["skip","save and show results"],onSaveandshowresults:function(){this.validateUsername(this.options.verifyUsernameUrl,$("lightbox_loginname"),$("lightbox_login_error"),true,true);
this.validateEmail(this.options.verifyEmailUrl,$("lightbox_email"),$("lightbox_email_error"),true,true);
if(!this.emailOK||!this.usernameOK){$("lightbox_loginname").dispose();
$("lightbox_email").dispose();
$("lightbox_login_error").dispose();
$("lightbox_email_error").dispose();
(function(){this.showRegisterLightbox()
}.bind(this)).delay(1000);
return 
}new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:this.options.tinyUrl,onComplete:function(A){$("createTinyurlButton").destroy();
(function(){this.showRegisterLightboxThanks($("lightbox_email").value)
}.bind(this)).delay(1000)
}.bind(this)}).send(JSON.encode({username:$("lightbox_loginname").value,email:$("lightbox_email").value}))
}.bind(this)});
if($("lightbox_loginname")){$("lightbox_loginname").addEvent("keyup",function(){this.validateUsername(this.options.verifyUsernameUrl,$("lightbox_loginname"),$("lightbox_login_error"),false,true)
}.bind(this))
}if($("lightbox_email")){$("lightbox_email").addEvent("keyup",function(){this.validateEmail(this.options.verifyEmailUrl,$("lightbox_email"),$("lightbox_email_error"),false,true)
}.bind(this))
}},showRegisterLightboxThanks:function(A){this.removeJoinNowNavi(A);
new Dialog({title:"Thank you for joining TripSay!",message:"A confirmation email has been sent to <b>"+A+"</b>.<br/><br/>Confirm your registration by clicking the confirmation link in the email.<br/><br/>",buttons:["Roger that"]})
},removeJoinNowNavi:function(A){if($$("a.joinbutton").length==0){return 
}$$("a.joinbutton")[0].href="#";
$$("a.joinbutton")[0].set("html","USERNAME<br/>AND<br/>PASSWORD<br/>EMAILED");
$$("a.joinbutton")[0].setStyles({"margin-top":"-13px","font-size":"10px"});
$$("a.joinbutton")[0].removeEvents();
$$("a.joinbutton")[0].addEvent("click",function(){new Dialog({title:"Thank you for joining TripSay!",message:"A confirmation email has been sent to <b>"+A+"</b>.<br/><br/>Con-firm your registration by clicking the confirmation link in the email.<br/><br/>",buttons:["Show tips"]})
}.bind(this))
},onSelectTinyurl:function(A){$(A.url).select()
},onConfirm:function(){this.validateUsername(this.options.verifyUsernameUrl,$("usernameField"),$("usernameError"),true,false);
this.validateEmail(this.options.verifyEmailUrl,$("emailField"),$("emailError"),true,false);
if(!this.emailOK||!this.usernameOK){return 
}var A={};
$$("#tinyurlForm input").each(function(B){A[B.name]=B.value
});
new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:this.options.tinyUrl,onComplete:function(C){var B=new Fx.Tween($("tinyurlForm"));
B.start("height",154);
this.removeJoinNowNavi(A.email);
$("tinyurlForm").set("html",'<p class="results">Thank you for joining TripSay!<br/><span class="registered">A confirmation email has been sent to <b>'+A.email+'</b>. Confirm your registration by clicking the confirmation link in the email.</span></p><p><a rel="close" class="button right"><span>Close</span></a></p>');
$$("a[rel=close]")[0].addEvent("click",function(D){this.onCancel();
$("createTinyurlButton").destroy()
}.bind(this))
}.bind(this)}).send(JSON.encode(A))
},onCancel:function(){var A=new Fx.Tween($("tinyurlForm"),{onComplete:function(){$("tinyurlForm").hide()
}});
A.start("height",0)
},onCreateTinyurl:function(){$("tinyurlForm").show();
var A=new Fx.Tween($("tinyurlForm"));
A.start("height",0,$("tinyurlForm").getChildren()[0].getComputedSize().totalHeight)
},validateUsername:function(C,B,A,D,E){if(this.verifyUserNameRequest){this.verifyUserNameRequest.cancel()
}this.verifyUserNameRequest=new Request.JSON({async:!D,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:C,onComplete:function(F){this.usernameOK=F;
A.innerHTML=!F?"Username already taken":"";
if(E&&!F){this.lightboxError(A,A.getParent().getParent())
}if(B.value.trim().length==0){this.usernameOK=false;
A.innerHTML="Username is empty!"
}}.bind(this)});
this.verifyUserNameRequest.send(JSON.encode({username:B.value}))
},validateEmail:function(C,B,A,E,F){var D=new RegExp(".*@[^.].+[.]([a-z]|[A-Z]){2,}$");
if(!B.value.match(D)){this.emailOK=false;
A.innerHTML="Please complete your address";
return 
}if(this.verifyEmailRequest){this.verifyEmailRequest.cancel()
}this.verifyEmailRequest=new Request.JSON({async:!E,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:C,onComplete:function(G){this.emailOK=G;
A.innerHTML=!G?"Email already used or is invalid":"";
if(F&&!G){this.lightboxError(A,A.getParent().getParent())
}if(B.value.trim().length==0){this.emailOK=false;
A.innerHTML="Email is empty!"
}}.bind(this)});
this.verifyEmailRequest.send(JSON.encode({email:B.value}))
},onViewStats:function(){var A=new Fx.Scroll(window).toElement("profileRatings");
A.start()
},lightboxError:function(C,B){C.empty();
C.appendText("This one is invalid or already taken:");
new Element("br").inject(C);
C.appendText("Please modify, ");
var D=new Element("a",{html:"login",styles:{color:"red","text-decoration":"underline"},events:{click:function(){this.loginInLightbox(B,false)
}.bind(this)}});
D.inject(C);
C.appendText(" or ");
var A=new Element("a",{html:"recover password",styles:{color:"red","text-decoration":"underline"},events:{click:function(){this.recoverPasswordInLightbox(B)
}.bind(this)}});
A.inject(C);
C.appendText(".")
},loginInLightbox:function(A,E,H,B){$$(".box h2")[0].innerHTML="Log in to TripSay";
var D=$$("a[rel=skip]")[0];
if(!H&&$("lightbox_loginname")){H=$("lightbox_loginname").value
}if(!B&&$("lightbox_email")){B=$("lightbox_email").value
}A.empty();
if(E){A.appendText("Your username and password has been emailed to you.");
new Element("br").inject(A);
new Element("br").inject(A)
}var F=this.options.loginUrl;
while(F.substr(F.length-1,1)=="/"){F=F.substr(0,F.length-1)
}var C=new Element("form",{id:"lightboxLoginForm",method:"post",action:F});
C.inject(A);
new Element("input",{type:"hidden",name:"_acegi_security_remember_me",value:"true"}).inject(C);
new Element("input",{type:"hidden",name:"referrerUrl",value:location.href}).inject(C);
if(B){new Element("input",{type:"hidden",id:"lightbox_email",value:B}).inject(C)
}C.appendText("Username:");
new Element("br").inject(C);
new Element("input",{id:"lightbox_loginname",type:"text",name:"j_username",value:H,styles:{width:"260px"}}).inject(C);
new Element("br").inject(C);
new Element("br").inject(C);
C.appendText("Password:");
new Element("br").inject(C);
new Element("input",{type:"password",name:"j_password",styles:{width:"260px"}}).inject(C);
new Element("br").inject(C);
new Element("br").inject(C);
new Element("a",{html:"Forgot your password or username?",events:{click:function(){this.recoverPasswordInLightbox(A)
}.bind(this)}}).inject(C);
new Element("br").inject(C);
new Element("br").inject(C);
var G=new Element("p",{"class":"lightboxButtons"});
G.inject(C);
D.set("html","<span>Cancel</span>");
D.inject(G);
new Element("a",{"class":"button right",html:"<span>Log in</span>",events:{click:function(){$("lightboxLoginForm").submit();
return false
}.bind(this)}}).inject(G)
},recoverPasswordInLightbox:function(A){$$(".box h2")[0].innerHTML="Recover your password";
var C=$$("a[rel=skip]")[0];
var B="";
if($("lightbox_email")){B=$("lightbox_email").value
}var E=$("lightbox_loginname").value;
A.empty();
A.appendText("Enter your email address and we will mail you your username and your new password:");
new Element("input",{type:"text",id:"lightboxRecoverEmail",value:B,styles:{width:"260px"}}).inject(A);
var D=new Element("p",{"class":"lightboxButtons"});
D.inject(A);
C.set("html","<span>Cancel</span>");
C.inject(D);
new Element("a",{"class":"button right",html:"<span>Continue</span>",events:{click:function(){new Request({url:this.options.recoverUrl,method:"post",onSuccess:function(){this.loginInLightbox(A,true,E,B)
}.bind(this),data:{str:$("lightboxRecoverEmail").value}}).send();
return false
}.bind(this)}}).inject(D)
},onCycleRecommenders:function(B){var D=$$("div.cyclable_"+B.block);
var A=3;
var E=D.length;
var C=this.firstShownRecommender[B.block];
if(C==null){C=0
}C+=new Number(B.amount);
if(C<=0){C=0;
$("cyclePrev_"+B.block).addClass("disabled")
}else{$("cyclePrev_"+B.block).removeClass("disabled")
}if(C>=E-A){C=E-A;
$("cycleNext_"+B.block).addClass("disabled")
}else{$("cycleNext_"+B.block).removeClass("disabled")
}D.each(function(G,F){if(F>=C&&F<C+A){G.removeClass("hide")
}else{G.addClass("hide")
}});
this.firstShownRecommender[B.block]=C
},inFacebook:function(){return location.href.indexOf("/facebook/")!=-1
},onSelectTab:function(A){$("tabContents").className=this.tabs[A.tab]+"Selected";
if(A.tab==4&&$("tripsayTab").getChildren().getLast()==null){$("tripsayTab").load(this.options.tripsayTabUrl)
}},adjustForFacebook:function(){$each($$("a"),function(A){if(A.href.indexOf("/destination/")!=-1){A.set("target","_blank")
}});
$each($$("a"),function(B){var A=B.href;
if(A.indexOf("/#")>-1){A=ts.baseUrl+"facebook/minitaste#"+A.split("#")[1];
B.href=A
}});
$each($$("a"),function(B){var A=B.href;
if(A.indexOf("/mt")>-1){A=ts.baseUrl+"facebook/minitaste/results/"+A.split("/mt")[1];
B.href=A
}});
$each($$("a.beenHereRateThis"),function(A){A.addEvent("click",function(){var B=""+(new Date().getTime());
B+=",";
B+=this.substr(this.indexOf("#")+1);
parent.location.href="http://apps.facebook.com/traveltaste/?rnd="+B;
return false
}.bind(A.href));
A.href="#"
})
},onTwitthis:function(){window.open("http://www.twitthis.com/twit?url="+this.options.twiturl+"&title="+this.options.twittitle,"twitthis","height=600, width=600")
}});
if(self.GOverlay){function ExtInfoWindow(B,A,D,C){this.html_=D;
this.marker_=B;
this.infoWindowId_=A;
this.options_=C==null?{}:C;
this.ajaxUrl_=this.options_.ajaxUrl==null?null:this.options_.ajaxUrl;
this.callback_=this.options_.ajaxCallback==null?null:this.options_.ajaxCallback;
this.borderSize_=this.options_.beakOffset==null?0:this.options_.beakOffset;
this.paddingX_=this.options_.paddingX==null?0+this.borderSize_:this.options_.paddingX+this.borderSize_;
this.paddingY_=this.options_.paddingY==null?0+this.borderSize_:this.options_.paddingY+this.borderSize_;
this.map_=null;
this.container_=document.createElement("div");
this.container_.style.position="relative";
this.container_.style.display="none";
this.contentDiv_=document.createElement("div");
this.contentDiv_.id=this.infoWindowId_+"_contents";
this.contentDiv_.innerHTML=this.html_;
this.contentDiv_.style.display="block";
this.contentDiv_.style.visibility="hidden";
this.wrapperDiv_=document.createElement("div")
}ExtInfoWindow.prototype=new GOverlay();
ExtInfoWindow.prototype.initialize=function(a){this.map_=a;
this.defaultStyles={containerWidth:this.map_.getSize().width/2,borderSize:1};
this.wrapperParts={tl:{t:0,l:0,w:0,h:0,domElement:null},t:{t:0,l:0,w:0,h:0,domElement:null},tr:{t:0,l:0,w:0,h:0,domElement:null},l:{t:0,l:0,w:0,h:0,domElement:null},r:{t:0,l:0,w:0,h:0,domElement:null},bl:{t:0,l:0,w:0,h:0,domElement:null},b:{t:0,l:0,w:0,h:0,domElement:null},br:{t:0,l:0,w:0,h:0,domElement:null},beak:{t:0,l:0,w:0,h:0,domElement:null},close:{t:0,l:0,w:0,h:0,domElement:null}};
for(var i in this.wrapperParts){var b=document.createElement("div");
b.id=this.infoWindowId_+"_"+i;
b.style.visibility="hidden";
document.body.appendChild(b);
b=document.getElementById(this.infoWindowId_+"_"+i);
var c=eval("this.wrapperParts."+i);
c.w=parseInt(this.getStyle_(b,"width"));
c.h=parseInt(this.getStyle_(b,"height"));
document.body.removeChild(b)
}for(var i in this.wrapperParts){if(i=="close"){this.wrapperDiv_.appendChild(this.contentDiv_)
}var d=null;
if(this.wrapperParts[i].domElement==null){d=document.createElement("div");
this.wrapperDiv_.appendChild(d)
}else{d=this.wrapperParts[i].domElement
}d.id=this.infoWindowId_+"_"+i;
d.style.position="absolute";
d.style.width=this.wrapperParts[i].w+"px";
d.style.height=this.wrapperParts[i].h+"px";
d.style.top=this.wrapperParts[i].t+"px";
d.style.left=this.wrapperParts[i].l+"px";
this.wrapperParts[i].domElement=d
}this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);
this.container_.id=this.infoWindowId_;
var e=this.getStyle_(document.getElementById(this.infoWindowId_),"width");
this.container_.style.width=(e==null?this.defaultStyles.containerWidth:e);
this.map_.getContainer().appendChild(this.contentDiv_);
this.contentWidth=this.getDimensions_(this.container_).width;
this.contentDiv_.style.width=this.contentWidth+"px";
this.contentDiv_.style.position="absolute";
this.container_.appendChild(this.wrapperDiv_);
GEvent.bindDom(this.container_,"mousedown",this,this.onClick_);
GEvent.bindDom(this.container_,"dblclick",this,this.onClick_);
GEvent.bindDom(this.container_,"DOMMouseScroll",this,this.onClick_);
GEvent.trigger(this.map_,"extinfowindowopen");
if(this.ajaxUrl_!=null){this.ajaxRequest_(this.ajaxUrl_)
}};
ExtInfoWindow.prototype.onClick_=function(A){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;
window.event.returnValue=false
}else{A.stopPropagation()
}};
ExtInfoWindow.prototype.remove=function(){if(this.map_.getExtInfoWindow()!=null){GEvent.trigger(this.map_,"extinfowindowbeforeclose");
GEvent.clearInstanceListeners(this.container_);
if(this.container_.outerHTML){this.container_.outerHTML=""
}if(this.container_.parentNode){this.container_.parentNode.removeChild(this.container_)
}this.container_=null;
GEvent.trigger(this.map_,"extinfowindowclose");
this.map_.setExtInfoWindow_(null)
}};
ExtInfoWindow.prototype.copy=function(){return new ExtInfoWindow(this.marker_,this.infoWindowId_,this.html_,this.options_)
};
ExtInfoWindow.prototype.redraw=function(B){if(!B||this.container_==null){return 
}var A=this.contentDiv_.offsetHeight;
this.contentDiv_.style.height=A+"px";
this.contentDiv_.style.left=this.wrapperParts.l.w+"px";
this.contentDiv_.style.top=this.wrapperParts.tl.h+"px";
this.contentDiv_.style.visibility="visible";
this.wrapperParts.tl.t=0;
this.wrapperParts.tl.l=0;
this.wrapperParts.t.l=this.wrapperParts.tl.w;
this.wrapperParts.t.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.tl.w-this.wrapperParts.tr.w;
this.wrapperParts.t.h=this.wrapperParts.tl.h;
this.wrapperParts.tr.l=this.wrapperParts.t.w+this.wrapperParts.tl.w;
this.wrapperParts.l.t=this.wrapperParts.tl.h;
this.wrapperParts.l.h=A;
this.wrapperParts.r.l=this.contentWidth+this.wrapperParts.l.w;
this.wrapperParts.r.t=this.wrapperParts.tr.h;
this.wrapperParts.r.h=A;
this.wrapperParts.bl.t=A+this.wrapperParts.tl.h;
this.wrapperParts.b.l=this.wrapperParts.bl.w;
this.wrapperParts.b.t=A+this.wrapperParts.tl.h;
this.wrapperParts.b.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.bl.w-this.wrapperParts.br.w;
this.wrapperParts.b.h=this.wrapperParts.bl.h;
this.wrapperParts.br.l=this.wrapperParts.b.w+this.wrapperParts.bl.w;
this.wrapperParts.br.t=A+this.wrapperParts.tr.h;
this.wrapperParts.close.l=this.wrapperParts.tr.l+this.wrapperParts.tr.w-this.wrapperParts.close.w-this.borderSize_;
this.wrapperParts.close.t=this.borderSize_;
this.wrapperParts.beak.l=this.borderSize_+(this.contentWidth/2)-(this.wrapperParts.beak.w/2);
this.wrapperParts.beak.t=this.wrapperParts.bl.t+this.wrapperParts.bl.h-this.borderSize_;
for(var C in this.wrapperParts){if(C=="close"){this.wrapperDiv_.insertBefore(this.contentDiv_,this.wrapperParts[C].domElement)
}var H=null;
if(this.wrapperParts[C].domElement==null){H=document.createElement("div");
this.wrapperDiv_.appendChild(H)
}else{H=this.wrapperParts[C].domElement
}H.id=this.infoWindowId_+"_"+C;
H.style.position="absolute";
H.style.width=this.wrapperParts[C].w+"px";
H.style.height=this.wrapperParts[C].h+"px";
H.style.top=this.wrapperParts[C].t+"px";
H.style.left=this.wrapperParts[C].l+"px";
this.wrapperParts[C].domElement=H
}var G=this.marker_;
var F=this.map_;
GEvent.addDomListener(this.wrapperParts.close.domElement,"click",function(){F.closeExtInfoWindow()
});
var E=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
this.container_.style.position="absolute";
var D=this.marker_.getIcon();
this.container_.style.left=(E.x-(this.contentWidth/2)-D.iconAnchor.x+D.infoWindowAnchor.x)+"px";
this.container_.style.top=(E.y-this.wrapperParts.bl.h-A-this.wrapperParts.tl.h-this.wrapperParts.beak.h-D.iconAnchor.y+D.infoWindowAnchor.y+this.borderSize_)+"px";
this.container_.style.display="block";
if(this.map_.getExtInfoWindow()!=null){this.repositionMap_()
}};
ExtInfoWindow.prototype.resize=function(){var B=this.contentDiv_.cloneNode(true);
B.id=this.infoWindowId_+"_tempContents";
B.style.visibility="hidden";
B.style.height="auto";
document.body.appendChild(B);
B=document.getElementById(this.infoWindowId_+"_tempContents");
var A=B.offsetHeight;
document.body.removeChild(B);
this.contentDiv_.style.height=A+"px";
var G=this.contentDiv_.offsetWidth;
var F=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
var E=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;
var D=this.wrapperParts.t.domElement.offsetTop;
this.wrapperParts.l.domElement.style.height=A+"px";
this.wrapperParts.r.domElement.style.height=A+"px";
var C=this.wrapperParts.b.domElement.offsetTop-A;
this.wrapperParts.l.domElement.style.top=C+"px";
this.wrapperParts.r.domElement.style.top=C+"px";
this.contentDiv_.style.top=C+"px";
windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height);
C-=windowTHeight;
this.wrapperParts.close.domElement.style.top=C+this.borderSize_+"px";
this.wrapperParts.tl.domElement.style.top=C+"px";
this.wrapperParts.t.domElement.style.top=C+"px";
this.wrapperParts.tr.domElement.style.top=C+"px";
this.repositionMap_()
};
ExtInfoWindow.prototype.repositionMap_=function(){var R=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());
var Q=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());
var P=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
var O=0;
var N=0;
var M=this.paddingX_;
var L=this.paddingY_;
var K=this.marker_.getIcon().infoWindowAnchor;
var J=this.marker_.getIcon().iconAnchor;
var I=this.wrapperParts.t.domElement;
var H=this.wrapperParts.l.domElement;
var G=this.wrapperParts.b.domElement;
var F=this.wrapperParts.r.domElement;
var E=this.wrapperParts.beak.domElement;
var D=P.y-(-K.y+J.y+this.getDimensions_(E).height+this.getDimensions_(G).height+this.getDimensions_(H).height+this.getDimensions_(I).height+this.paddingY_);
if(D<R.y){N=R.y-D
}else{var C=P.y+this.paddingY_;
if(C>=Q.y){N=-(C-Q.y)
}}var B=Math.round(P.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(F).width+this.paddingX_+K.x-J.x);
if(B>R.x){O=-(B-R.x)
}else{var A=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(H).width+this.borderSize_+this.paddingX_)-P.x-K.x+J.x);
if(A<Q.x){O=Q.x-A
}}if(O!=0||N!=0&&this.map_.getExtInfoWindow()!=null){this.map_.panBy(new GSize(O,N))
}};
ExtInfoWindow.prototype.ajaxRequest_=function(C){var B=this.map_;
var A=this.callback_;
GDownloadUrl(C,function(E,D){var F=document.getElementById(B.getExtInfoWindow().infoWindowId_+"_contents");
if(E==null||D==-1){F.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+C+'"</span>'
}else{F.innerHTML=E
}if(A!=null){A()
}B.getExtInfoWindow().resize();
GEvent.trigger(B,"extinfowindowupdate")
})
};
ExtInfoWindow.prototype.getDimensions_=function(B){var A=this.getStyle_(B,"display");
if(A!="none"&&A!=null){return{width:B.offsetWidth,height:B.offsetHeight}
}var H=B.style;
var G=H.visibility;
var F=H.position;
var E=H.display;
H.visibility="hidden";
H.position="absolute";
H.display="block";
var D=B.clientWidth;
var C=B.clientHeight;
H.display=E;
H.position=F;
H.visibility=G;
return{width:D,height:C}
};
ExtInfoWindow.prototype.getStyle_=function(B,A){var E=false;
A=this.camelize_(A);
var D=B.style[A];
if(!D){if(document.defaultView&&document.defaultView.getComputedStyle){var C=document.defaultView.getComputedStyle(B,null);
D=C?C[A]:null
}else{if(B.currentStyle){D=B.currentStyle[A]
}}}if((D=="auto")&&(A=="width"||A=="height")&&(this.getStyle_(B,"display")!="none")){if(A=="width"){D=B.offsetWidth
}else{D=B.offsetHeight
}}return(D=="auto")?null:D
};
ExtInfoWindow.prototype.camelize_=function(C){var B=C.split("-"),A=B.length;
if(A==1){return B[0]
}var E=C.charAt(0)=="-"?B[0].charAt(0).toUpperCase()+B[0].substring(1):B[0];
for(var D=1;
D<A;
D++){E+=B[D].charAt(0).toUpperCase()+B[D].substring(1)
}return E
};
GMap.prototype.ExtInfoWindowInstance_=null;
GMap.prototype.ClickListener_=null;
GMap.prototype.InfoWindowListener_=null;
GMarker.prototype.openExtInfoWindow=function(A,F,E,D){if(A==null){throw"Error in GMarker.openExtInfoWindow: map cannot be null";
return false
}if(F==null||F==""){throw"Error in GMarker.openExtInfoWindow: must specify a cssId";
return false
}A.closeInfoWindow();
if(A.getExtInfoWindow()!=null){A.closeExtInfoWindow()
}if(A.getExtInfoWindow()==null){A.setExtInfoWindow_(new ExtInfoWindow(this,F,E,D));
if(A.ClickListener_==null){A.ClickListener_=GEvent.addListener(A,"click",function(G){if(!G&&A.getExtInfoWindow()!=null){A.closeExtInfoWindow()
}})
}if(A.InfoWindowListener_==null){A.InfoWindowListener_=GEvent.addListener(A,"infowindowopen",function(G){if(A.getExtInfoWindow()!=null){A.closeExtInfoWindow()
}})
}var B=A.getExtInfoWindow();
try{A.addOverlay(B)
}catch(C){}}};
GMarker.prototype.closeExtInfoWindow=function(A){if(A.getExtInfWindow()!=null){A.closeExtInfoWindow()
}};
GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_
};
GMap2.prototype.setExtInfoWindow_=function(A){this.ExtInfoWindowInstance_=A
};
GMap2.prototype.closeExtInfoWindow=function(){if(this.getExtInfoWindow()!=null){this.ExtInfoWindowInstance_.remove()
}};
var MiniTasteTeaser=new Class({Implements:[Options,Events,Actions],ICON_PATH:"images/icons/map/",options:{facebook:false},runningIndex:-1,marker:null,period:null,infoWin:null,teaseIcon:new GIcon(),initialize:function(A){this.setOptions(A);
this.bindActions($$(".action"));
this.addDefaultEvents();
this.initializeMap()
},initializeMap:function(){this.teaseIcon.shadow=ts.baseUrl+this.ICON_PATH+"shadow.png";
this.teaseIcon.image=ts.baseUrl+this.ICON_PATH+"sight.png";
this.teaseIcon.iconSize=new GSize(46,55);
this.teaseIcon.shadowSize=new GSize(46,60);
this.teaseIcon.iconAnchor=new GPoint(22,53);
this.teaseIcon.infoWindowAnchor=new GPoint(17,7);
this.map=new GMap2($("map"));
var D=0;
var A=0;
var B=4;
var C=this.options.dests;
if(C!=null&&C.length>0){D=C[0].lat;
A=C[0].lng
}this.map.setCenter(new GLatLng(D,A),B,G_PHYSICAL_MAP);
this.period=this.nextDestination.periodical(15000,this);
this.nextDestination()
},nextDestination:function(){var A=this.options.dests;
if(++this.runningIndex>=A.length){this.runningIndex=0
}var B=A[this.runningIndex];
if(B){if(this.marker){this.map.removeOverlay(this.marker)
}this.marker=new GMarker(new GLatLng(B.lat,B.lng),{icon:this.teaseIcon});
this.map.addOverlay(this.marker);
var C="#";
this.setNextPlaceLabel();
this.marker.openExtInfoWindow(this.map,"tripsayInfo","<h1>"+B.name+"<span>, "+B.country+'</span></h1><p><img class="dest" src="'+B.img+'" alt=""/>'+B.d+'</p><div class="btm"><span>tipped by <a href="'+C+'">'+B.author+"</a></span></div>",{beakOffset:6,paddingX:3,paddingY:3})
}},setNextPlaceLabel:function(){if(this.options.dests&&this.options.dests.length>1){var A=(this.runningIndex<this.options.dests.length-1)?(this.runningIndex+1):0;
$("mapNext").innerHTML="Next: "+this.options.dests[A].name+", "+this.options.dests[A].country;
if(A==0){$("mapNext").innerHTML+=" (starting over)"
}}else{$("mapNext").innerHTML=""
}},onMapNext:function(){$clear(this.period);
this.nextDestination();
this.period=this.nextDestination.periodical(15000,this)
}})
}var MultiTip=new Class({alreadyShown:new Array(),initializeMultiTip:function(){window.addEvent("load",function(){$each($$(".multitipitem"),function(A){var B=new Number(A.id.substr(11));
if(this.alreadyShown.indexOf(B)==-1){this.alreadyShown.push(B)
}}.bind(this));
this.multiTipPageContentChanged(true)
}.bind(this))
},multiTipPageContentChanged:function(A){$each($$("div.image img"),function(D,B){var C=D.offsetWidth;
if(D.offsetWidth<100){D.alt="";
C=239
}D.getParent().setStyle("width",C+"px");
D.getNext().setStyle("width",(C-50)+"px")
});
if(!A){this.bindActions($$(this.options.actions))
}},onSubmitMultiTip:function(B){var D=$("multiTipTextarea_"+B.id).value;
if(D.trim().length>10){var A={externalImageUrl:$("newTipExternalImageUrl_"+B.id).value,message:D.trim(),question:false,related:"",url:$("newTipUrl_"+B.id).value,usePreviewImage:$("newTipUsePreviewImage_"+B.id).value,"wall.destination":B.id};
new Request.JSON({url:this.options.wallWriteUrl,link:"chain",async:"false",onComplete:function(){}.bind(this)}).post(A)
}var C=new Fx.Morph($("multiThankYou_"+B.id),{duration:"long",onComplete:function(){var E='<div style="text-align:center;height:150px;"><h3 style="margin:12px 0">Thank you for your tip!</h3>Your tip has been saved.<br/>Displaying another destination...</div>';
$("multiThankYou_"+B.id).set("html",E);
var F=new Fx.Morph($("multiThankYou_"+B.id),{duration:"long",onComplete:function(){this.onCloseTipBox({id:B.id})
}.bind(this)}).start({opacity:[0,1]})
}.bind(this)});
C.start({opacity:[1,0]})
},onMultiRate:function(B){$("rateMarkers_"+B.id).removeClass("lWish");
$("rateMarkers_"+B.id).removeClass("lHated");
$("rateMarkers_"+B.id).removeClass("lVisited");
$("rateMarkers_"+B.id).removeClass("lLoved");
$("rateMarkers_"+B.id).addClass(B.className);
if($("rated_true_"+B.id).getStyle("display")=="none"){$("rated_false_"+B.id).dispose();
$("rated_true_"+B.id).setStyle("display","inline")
}else{$("new_"+B.id).setStyle("display","inline")
}var A={};
if(B.value<1){A.wish=true
}else{if(B.value>5){A.best=true
}else{A.value=B.value
}}new Request.JSON({url:this.options.destinationUrl+B.id+"/quickRate"}).post(A)
},getIgnoredString:function(){var A="";
for(var B=0;
B<this.alreadyShown.length;
++B){A+=this.alreadyShown[B];
if(B+1<this.alreadyShown.length){A+=","
}}return A
},onCloseTipBox:function(A){var B=new Fx.Morph($("multiTipFor"+A.id),{duration:"long",onComplete:function(){new Request.HTML({onSuccess:function(D,C,E){var F=$("multiTipFor"+A.id);
F.set("html",E);
var H=F.getChildren("div")[0];
H.inject(F,"before");
F.dispose();
var G=new Fx.Morph($(H.id),{duration:"long"});
G.start({opacity:[0.1,1]});
this.alreadyShown.push(new Number(H.id.substr(11)));
this.multiTipPageContentChanged.bind(this).delay(1000)
}.bind(this)}).get(this.options.nextDestUrl+"?destinationsOnly=true&limit=1&ignore="+this.getIgnoredString()+(this.options.origo!=null?"&origoDestination="+this.options.origo:""))
}.bind(this)});
B.start({opacity:[1,0]})
},onMultiTipAddImage:function(A){var B=new ImageUploader({usePreview:"newTipUsePreviewImage_"+A.id,imageUrl:"newTipExternalImageUrl_"+A.id});
B.onAddImage()
},onMultiTipLink:function(A,B){this.wallOptions.linkFieldId="newTipUrl_"+A.id;
if(this.onLink){this.onLink()
}}});
var PlacesMap=new Class({Implements:[Options,Events,Actions],MAP_SIZE_ADJUST:69,MAP_TIPS_HEIGHT:169,MAP_TIPS_RESTORE_HEIGHT:35,MAP_COOKIE:"tsMapFilters",ALWAYS_RECOMMENDATIONS_MAX_LEVEL:13,filters:[],cookie:null,options:{places:[],tipsDisplayed:true,recommendationsOnly:false,filterButtons:$$("ul.filters li.f a"),forcedDestination:-1,forcedDestinationWasRated:false},map:null,markers:[],recommendationMarkers:[],ownRatingMarkers:[],ownRatingMarkersGrouper:new Grouper(),previousUpdateLocation:{lat:-1,lng:-1,zoom:-1},TATTI_UPDATE_MINIMUM_INTERVAL_IN_MILLISECONDS:1666,makeAjaxRequestTimer:{},onScrollRight:function(A){var B=$$("ul.filters li.f");
var C=B.getLast().dispose();
C.inject(B[0],"before")
},onScrollLeft:function(B){var A=$$("ul.filters li.f");
var C=A[0].dispose();
C.inject(A.getLast(),"after")
},onSelectNone:function(A){this.filters.empty();
this.updateFilterButtons();
this.refreshStuffOnMap()
},onCloseHowTo:function(){$("mapHowTo").dispose();
$("map").removeClass("faint")
},selectAll:function(){this.filters=[];
$each(this.options.filterButtons,function(A){this.filters.include(A.id)
}.bind(this));
this.updateFilterButtons()
},onSelectAll:function(A){this.selectAll();
this.refreshStuffOnMap()
},onSelectInverse:function(A){$each(this.options.filterButtons,function(B){if(this.filters.contains(B.id)){this.filters.erase(B.id)
}else{this.filters.include(B.id)
}B.toggleClass("inactive")
}.bind(this));
this.refreshStuffOnMap()
},onToggleFilter:function(A){$("mapFilters").toggleClass("visible")
},onAddPlaceHere:function(A){new Dialog({title:MooTools.lang.get("PlacesMap","addPlaceHereTitle"),message:MooTools.lang.get("PlacesMap","addPlaceHereMessage")+"<br/><br/>",buttons:["add","cancel"],onAdd:function(){location.href=this.options.addUrl+"?lat="+this.map.getCenter().lat()+"&lng="+this.map.getCenter().lng()+"&zoom="+this.map.getZoom()
}.bind(this)})
},onSwitch:function(A,B){B.toggleClass("inactive");
this.changeFilter(A.type);
this.refreshStuffOnMap()
},initialize:function(A){A.ratings.combine(A.wished);
A.wished=null;
this.setOptions(A);
if(this.options.isAnonymous&&$("addPlaceHere")){$("addPlaceHere").addClass("disabled")
}var B=this.toggleTips.bind(this);
$$("#reviews, #reviewsRestore").each(function(C){C.addEvent("click",B)
});
this.cookie=new Hash.Cookie(this.MAP_COOKIE);
this.filters=this.getFiltersFromCookie();
if(!this.filters){this.selectAll()
}this.updateFilterButtons();
this.bindActions($$(".action"));
this.bindActions(this.options.filterButtons);
this.addDefaultEvents();
this.initializePlacesMap()
},resizeMap:function(C){var D=this.MAP_SIZE_ADJUST;
if(this.options.tipsDisplayed){D+=this.MAP_TIPS_HEIGHT
}else{D+=this.MAP_TIPS_RESTORE_HEIGHT
}$("map").setStyle("height",($screenSize()["height"]-D)+"px");
$("reviews").setStyle("display",this.options.tipsDisplayed?"block":"none");
$("reviewsRestore").setStyle("display",!this.options.tipsDisplayed?"block":"none");
$("footerWide").setStyle("display",this.options.tipsDisplayed?"block":"none");
var A=$screenSize()["width"];
var B="0";
if(A<929){B=(A-929)+"px"
}else{B=((Math.floor($screenSize()["width"])-929)/2)+"px"
}$("navigationSearchDiv").setStyles({right:B,display:"block"});
if(this.map){this.onMapMove()
}return C
},initializePlacesMap:function(){google.load("maps","2",{callback:function(){this.onPlacesMapReady()
}.bind(this)})
},onPlacesMapReady:function(){this.farIcon=new google.maps.Icon();
this.farIcon.shadow=ts.baseUrl+"gfx/map/icons/shadow.png";
this.farIcon.transparent=ts.baseUrl+"gfx/transp.png";
this.nearIcon=new google.maps.Icon(this.farIcon);
this.farIcon.iconSize=new google.maps.Size(23,27);
this.farIcon.shadowSize=new google.maps.Size(23,30);
this.farIcon.iconAnchor=new google.maps.Point(11,26);
this.farIcon.bubbleAnchor=new google.maps.Point(0,4);
this.farIcon.imageMap=[0,5,0,27,23,27,23,5];
this.farIconCache=new IconCache({baseIcon:this.farIcon});
this.nearIcon.iconSize=new google.maps.Size(46,55);
this.nearIcon.shadowSize=new google.maps.Size(46,60);
this.nearIcon.iconAnchor=new google.maps.Point(22,52);
this.nearIcon.bubbleAnchor=new google.maps.Point(0,8);
this.nearIcon.imageMap=[0,9,0,55,46,55,46,9];
this.nearIconCache=new IconCache({baseIcon:this.nearIcon});
this.ratedIcon=new google.maps.Icon();
this.ratedIcon.shadow=ts.baseUrl+"gfx/map/icons/places_shadow.png";
this.ratedIcon.transparent=ts.baseUrl+"gfx/transp.png";
this.ratedIcon.iconSize=new google.maps.Size(27,27);
this.ratedIcon.shadowSize=new google.maps.Size(28,29);
this.ratedIcon.iconAnchor=new google.maps.Point(13,23);
this.ratedIcon.bubbleAnchor=new google.maps.Point(0,7);
this.ratedIcon.imageMap=[2,2,2,25,25,25,25,2];
this.ratedIconCache=new IconCache({baseIcon:this.ratedIcon,path:"gfx/map/icons/"});
this.resizeMap();
this.map=new google.maps.Map2($("map"));
var D=0;
var B=14;
var C=2;
var A=this.cookie.get("mapPosition");
if((A!=null)&&(A.contains("|"))){D=new Number(A.split("|")[0]);
B=new Number(A.split("|")[1]);
C=new Number(A.split("|")[2])
}C+=0;
if(this.options.initialViewLat!=null){D=this.options.initialViewLat;
B=this.options.initialViewLng;
C=15
}this.map.setCenter(new google.maps.LatLng(D,B),C,C>10?G_NORMAL_MAP:G_PHYSICAL_MAP);
this.map.addControl(getTsMapControl(true));
this.map.addControl(new google.maps.ScaleControl());
this.map.enableScrollWheelZoom();
google.maps.Event.addListener(this.map,"moveend",this.onMapMove.bind(this));
google.maps.Event.addListener(this.map,"zoomend",this.onMapZoom.bind(this));
window.addEvent("resize",this.resizeMap.bind(this));
this.handleAddPlaceButton();
this.onMapMove()
},onMapZoom:function(A){this.map.setMapType(this.map.getZoom()>10?G_NORMAL_MAP:G_PHYSICAL_MAP);
this.handleAddPlaceButton()
},handleAddPlaceButton:function(){if($("addPlaceHere")){if(this.map.getZoom()>8&&!this.options.isAnonymous){$("addPlaceHere").removeClass("disabled");
$("addPlaceHere").setAttribute("title","")
}else{$("addPlaceHere").addClass("disabled");
$("addPlaceHere").setAttribute("title",(this.options.isAnonymous?"Log in":"Zoom closer")+" to add a place")
}}},onToggleRecommendations:function(){$("recFilter").toggleClass("recFilterOn");
$("recFilter").innerHTML=($("recFilter").hasClass("recFilterOn")?"Recommendation filter <b>ON</b>":"Recommendation filter OFF");
this.options.recommendationsOnly=$("recFilter").hasClass("recFilterOn");
this.setRecFilterTextAndClass();
this.refreshStuffOnMap(true)
},onMapMove:function(A){if((this.previousUpdateLocation.lat==this.map.getCenter().lat())&&(this.previousUpdateLocation.lng==this.map.getCenter().lng())&&(this.previousUpdateLocation.zoom==this.map.getZoom())){return 
}this.cookie.set("mapPosition",this.map.getCenter().lat()+"|"+this.map.getCenter().lng()+"|"+this.map.getZoom());
this.cookie.set("filters",this.filters.join());
this.refreshStuffOnMap();
return false
},setRecFilterTextAndClass:function(){if(this.map.getZoom()<=this.ALWAYS_RECOMMENDATIONS_MAX_LEVEL){$("recFilter").addClass("disabled");
$("recFilter").innerHTML="Recommendations only";
$("recFilter").setAttribute("title","Showing only recommendations on higher map levels (your browser can't display all the zillion places anyway)")
}else{$("recFilter").removeClass("disabled");
$("recFilter").innerHTML=($("recFilter").hasClass("recFilterOn")?"Recommendations only <b>ON</b>":"Recommendations only OFF");
$("recFilter").setAttribute("title","")
}},refreshStuffOnMap:function(B){var A=B?0:this["TATTI_UPDATE_MINIMUM_INTERVAL_IN_MILLISECONDS"];
$clear(this["makeAjaxRequestTimer"]);
this["makeAjaxRequestTimer"]=function(){$("mapLoader").show();
this.markers.empty();
if(this["request"]!=null){this["request"].cancel()
}this["request"]=new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"map/search",onSuccess:function(D){this["request"]=null;
this.previousUpdateLocation.lat=this.map.getCenter().lat();
this.previousUpdateLocation.lng=this.map.getCenter().lng();
this.previousUpdateLocation.zoom=this.map.getZoom();
this.options.places=D.destinations;
this.drawMarkers();
this.updateTipBoxes(D.tips,D.images);
this.drawOwnMarkers(D.ratings);
$("mapLoader").hide()
}.bind(this)});
this.setRecFilterTextAndClass();
var C={nelat:this.map.getBounds().getNorthEast().lat(),nelng:this.map.getBounds().getNorthEast().lng(),swlat:this.map.getBounds().getSouthWest().lat(),swlng:this.map.getBounds().getSouthWest().lng(),level:this.map.getZoom(),amount:20,categories:this.computeFilters(),tipAmount:this.getNumberOfTipsOnMapPage(),everything:this.map.getZoom()>this.ALWAYS_RECOMMENDATIONS_MAX_LEVEL&&!this.options.recommendationsOnly,ownRatings:true};
if(this.options.forcedDestination!=-1){C.forcedDestination=this.options.forcedDestination
}this.request.send(JSON.encode(C))
}.bind(this).delay(A)
},computeFilters:function(){return this.filters.join();
if(this.map.getZoom()>10){return this.filters.join()
}var B=["accomodation","eat","party","airport","transport"];
var A=new Array();
$each(this.filters,function(C){if(!B.contains(C)){A.push(C)
}}.bind(this));
return A.join()
},drawMarkers:function(){$each(this.recommendationMarkers,function(A){this.map.removeOverlay(A)
}.bind(this));
this.recommendationMarkers=[];
$each(this.options.places,function(A){this.drawMarker(A,true)
}.bind(this))
},drawOwnMarkers:function(A){$each(this.ownRatingMarkers,function(B){this.map.removeOverlay(B)
}.bind(this));
this.ownRatingMarkers.empty();
$each(this.options.ratings,function(C){for(var B=0;
B<A.length;
++B){if(A[B].id==C.id){this.drawMarker(C,false);
break
}}}.bind(this))
},recommendationsOnTopProcess:function importanceOrder(B,A){var D=B.getLatLng().lat();
var C=(D>0)?90-D:-D+90;
return C*1000000+(B.recommendation?200000000:0)
},drawMarker:function(B,D){var E=((this.map.getZoom()>6)?this.nearIconCache:this.farIconCache).getIcon((B.recommendation?"":"dimmed_")+B.typeString);
$each(this.options.ratings,function(G){if(G.id==B.id){D=false;
B.loved=G.loved;
B.hated=G.hated;
B.visited=G.visited;
B.wished=G.wished;
if(this.options.forcedDestination==G.id){this.options.forcedDestinationWasRated=true
}}}.bind(this));
var C="";
if(!D){if(B.loved){E=this.ratedIconCache.getIcon("places_loved");
C="lLoved"
}if(B.visited){E=this.ratedIconCache.getIcon("places_visited");
C="lVisited"
}if(B.hated){E=this.ratedIconCache.getIcon("places_hated");
C="lHated"
}if(B.wished){E=this.ratedIconCache.getIcon("wish");
C="lWish"
}}var A=new google.maps.Marker(new google.maps.LatLng(B.lat,B.lng),{icon:E,zIndexProcess:this.recommendationsOnTopProcess});
A.destinationId=B.id;
A.recommendation=B.recommendation;
A.title="<img class='tipBubbleIcon' title=\""+MooTools.lang.get("DestinationTypes",B.typeString.replace("_"," "))+'" src="'+this.options.iconUrl+(B.typeString.substr(0,8)=="landmark"?"sight":B.typeString)+'.png"/>';
A.title+='<a href="'+this.options.destinationUrl+B.link+'">'+B.name+"</a>";
A.text="";
if(B.id==this.options.forcedDestination){A.text+=MooTools.lang.get("PlacesMap","isLocatedHere")
}else{if(D){if(B.recommendation){recommender=B.by;
if(recommender==null){A.text+=MooTools.lang.get("PlacesMap","recommendedByTripSay")
}else{var F="";
if(B.reason!=""){F=" "+MooTools.lang.get("PlacesMap","because")+" &quot;"+B.reason+"&quot;"
}A.text+=MooTools.lang.get("PlacesMap","recommendedByUser")+' <a href="'+this.options.profileUrl+recommender.name+'">'+recommender.name+"</a>"+F
}}else{A.text+=MooTools.lang.get("PlacesMap","notRecommended")
}}else{if(B.loved){A.text+=MooTools.lang.get("PlacesMap","loved")
}if(B.hated){A.text+=MooTools.lang.get("PlacesMap","hated")
}if(B.visited){A.text+=MooTools.lang.get("PlacesMap","visited")
}if(B.wished){A.text+=MooTools.lang.get("PlacesMap","wished")
}}}if(B.hotel){A.text+='<br/><span class="price">'+MooTools.lang.get("dInfo","from")+" "+B.currency+" <b>"+B.price+"</b></span>";
A.hotel=true;
A.stars=B.stars;
A.hotelLink=B.hotelUrl
}A.text+='<div id="rateMarkers_'+B.id+'" class="rateMarkers '+C+'">';
A.text+='<a title="Wish to go there" class="linkWish" id="_'+B.id+'_-1"></a>';
A.text+='<a title="Dislike it" class="linkHate" id="_'+B.id+'_1"></a>';
A.text+='<a title="Been there" class="linkBeenThere" id="_'+B.id+'_3"></a>';
A.text+='<a title="Love it" class="linkLove" id="_'+B.id+'_5"></a>';
A.text+="Rate:</div>";
this.map.addOverlay(A);
google.maps.Event.addListener(A,"click",function(){this.clickMarker(A)
}.bind(this));
google.maps.Event.addListener(A,"mouseover",function(){this.moveOverMarker(A)
}.bind(this));
google.maps.Event.addListener(A,"mouseout",function(){this.moveOutMarker(A)
}.bind(this));
this.markers.push(A);
if(D){this.recommendationMarkers.push(A)
}else{this.ownRatingMarkers.push(A)
}if(B.id==this.options.forcedDestination){if(!this.options.forcedDestinationBubbleDisplayed){this.moveOverMarker(A);
this.options.forcedDestinationBubbleDisplayed=true
}}return A
},rateMarker:function(D,C){var B={};
var A="lWish";
if(C<0){B.wish=true
}else{if(C>5){B.best=true
}else{B.value=C;
if(C==5){A="lLoved"
}if(C==3){A="lVisited"
}if(C==1){A="lHated"
}}}$("rateMarkers_"+D).className="rateMarkers "+A;
new Request.JSON({url:ts.baseUrl+"destination/"+D+"/quickRate",onComplete:function(){var E=false;
$each(this.options.ratings,function(F){if(F.id==D){F.loved=(C==5);
F.visited=(C==3);
F.hated=(C==1);
F.wished=(C==-1);
E=true
}}.bind(this));
if(!E){$each(this.options.places,function(F){if(F.id==D){this.options.ratings.push({name:F.name,link:F.link,lat:F.lat,lng:F.lng,typeString:F.typeString,id:F.id,loved:(C==5),visited:(C==3),hated:(C==1),wished:(C==-1)})
}}.bind(this))
}this.refreshStuffOnMap(true)
}.bind(this)}).post(B)
},clickMarker:function(A){location.href=ts.baseUrl+"destination/"+A.destinationId
},getMarkerByDestinationId:function(B){var A=this.markers.filter(function(C){return C.destinationId==B
});
if(A.length>0){return A[0]
}else{return null
}},moveOverMarker:function(A){if(A==null){return 
}$each(this["markers"],function(B){if(B.hover){try{this.map.removeOverlay(B.hover)
}catch(C){}B.hover=null
}}.bind(this));
if(!A.hover){A.hover=new dInfo(A);
this.map.addOverlay(A.hover)
}$each($$(".rateMarkers a"),function(B){if(B.id.substr(0,1)=="_"){B.removeEvents();
B.addEvent("click",function(){this.rateMarker(B.id.split("_")[1],B.id.split("_")[2])
}.bind(this))
}}.bind(this))
},moveOutMarker:function(A){if(A==null){return 
}try{this.map.removeOverlay(A.hover)
}catch(B){}},toggleTips:function(){this.options.tipsDisplayed=!this.options.tipsDisplayed;
this.resizeMap()
},changeFilter:function(A){if(this.options.filterButtons.length!=this.filters.length){if(this.filters.contains(A)){this.filters.erase(A)
}else{this.filters.include(A)
}}else{this.filters.empty();
this.filters.include(A)
}if(this.filters==null||this.filters.length==0){this.selectAll()
}this.updateFilterButtons()
},updateFilterButtons:function(){$each(this.options.filterButtons,function(A){if(this.filters.contains(A.id)){A.removeClass("inactive")
}else{A.addClass("inactive")
}}.bind(this))
},getFiltersFromCookie:function(){var A=this.cookie.get("filters");
if(A&&A.length>0){return A.split(",")
}this.cookie.erase();
return null
},updateTipBoxes:function(B,A){if((B.length==0)&&(A.length==0)){return 
}$("tipPicks").empty();
var C=this.getNumberOfTipsOnMapPage();
if(B.length>0){$$("div.tips")[0].setStyle("width",B.length<C?(B.length*302+30)+"px":(C*302+30)+"px");
$each(B,function(E,D){if(D<C){var F=new Element("div",{html:(E.destinationImageThumbUrl?'<p><img src="'+ts.baseUrl+E.destinationImageThumbUrl+'" alt=""/>':"")+'<span><a href="'+ts.baseUrl+"traveler/"+E.authorLoginname+'">'+E.authorLoginname+"</a> "+MooTools.lang.get("PlacesMap","userSaidAboutDestination")+' <a href="'+ts.baseUrl+"destination/"+E.destinationId+'">'+E.destinationName+"</a>:</span>"+E.message+"</p>",events:{mouseover:function(){this.moveOverMarker(this.getMarkerByDestinationId(E.destinationId))
}.bind(this),mouseout:function(){this.moveOutMarker(this.getMarkerByDestinationId(E.destinationId))
}.bind(this)}});
F.injectInside($("tipPicks"))
}}.bind(this))
}else{}},getNumberOfTipsOnMapPage:function(){return Math.floor(($screenSize()["width"]-50)/302)
}});
var ScheduleTripDialog=new Class({Extends:FieldsDialog,Implements:[Actions,DestinationSelector,DateSelector],Binds:["destroy","createDateField","createDestinationField"],initialize:function(B){B.title=MooTools.lang.get("ProfileActions","scheduleTitle");
B.help="<p>"+MooTools.lang.get("ProfileActions","scheduleHelp")+"</p>";
var A={destination:{content:"<p>"+MooTools.lang.get("ProfileActions","where")+"</p><p><input style='display:block' id='destinationAutoComplete' class='full zfix' value='{place}'/><input id='destinationAutoCompleteId' name='destination' value='{destId}' type='hidden'/></p>".substitute(B),initialize:this.createDestinationField},date:{id:"departureDate",title:MooTools.lang.get("ProfileActions","when"),name:"departure",value:B.departure||"",initialize:this.createDateField}};
if(B.tripId){A.tripId={name:"tripId",type:"hidden",value:B.tripId||null}
}this.parent(B,A)
}});
var ProfileActions=new Class({modifyScheduledModalWindow:null,onScheduleTrip:function(A){if(this.scheduleDialog){this.scheduleDialog.destroy()
}this.scheduleDialog=new ScheduleTripDialog($merge(A,{onConfirm:this.scheduleConfirm.bind(this)}))
},onDeleteSchedule:function(A){this.scheduleConfirm(A)
},updateSchedule:function(A){$reload()
},scheduleConfirm:function(A){if(this.scheduleDialog&&(($$("#"+this.scheduleDialog.id+" input")[1].value=="")||($$("#"+this.scheduleDialog.id+" input")[2].value==""))){new Dialog({title:MooTools.lang.get("ProfileActions","scheduleErrorTitle"),message:MooTools.lang.get("ProfileActions","scheduleErrorMessage")+"<br/><br/>",buttons:["ok"]})
}else{new Request({method:"post",url:ts.baseUrl+"traveler/scheduleTrip/"+(A.tripId||""),onComplete:this.updateSchedule.bind(this)}).post(A)
}},onFollow:function(A){$("isFollowing").setStyle("display","");
$("notFollowing").hide();
new Request({method:"post",url:ts.baseUrl+"traveler/follow/"+(A.profileId||""),onComplete:function(){$$("#profileFollow .notFollowing").hide();
$$("#profileFollow .following").show()
}}).post({cancel:false})
},onStopFollowing:function(A){$("isFollowing").hide();
$("notFollowing").setStyle("display","");
new Request({method:"post",url:ts.baseUrl+"traveler/follow/"+(A.profileId||""),onComplete:function(){$$("#profileFollow .notFollowing").show();
$$("#profileFollow .following").hide();
$$("#profileFollow .beingFollowedBy").hide()
}}).post({cancel:true})
}});
ProfileMap=new Class({map:null,groupers:{},home:null,homeMarker:null,homeIcon:null,bestIcon:null,grouper:new Grouper(),ratingMarkers:new Array(),initializeMap:function(){google.load("maps","2",{callback:function(){this.onMapReady()
}.bind(this)})
},onMapReady:function(){if($("miniFeed")){new Request.JSON({method:"post",url:ts.baseUrl+"traveler/feedbody",onSuccess:function(D,E){$("miniFeed").set("html",E)
},onCancel:function(){$("miniFeed").dispose()
}}).post({digestinterval:"7",digestuser:this.options.loginname,mailreceiver:"",newestOnly:"true"})
}this.map=new google.maps.Map2($("map"));
this.map.addMapType(G_PHYSICAL_MAP);
this.map.setCenter(new google.maps.LatLng(17.3,14),2,G_PHYSICAL_MAP);
this.homeIcon=new google.maps.Icon();
this.homeIcon.image=ts.baseUrl+"images/icons/visited/home.png";
this.homeIcon.iconSize=new google.maps.Size(34,30);
this.homeIcon.iconAnchor=new google.maps.Point(16,32);
this.homeIcon.bubbleAnchor=new google.maps.Point(2,1);
var B=new google.maps.Icon();
B.iconSize=new google.maps.Size(26,26);
B.iconAnchor=new google.maps.Point(15,16);
B.bubbleAnchor=new google.maps.Point(2,19);
B.imageMap=[9,9,9,21,21,21,21,9];
B.transparent=ts.baseUrl+"images/icons/transp.png";
this.lovedIcon=new google.maps.Icon(B);
this.lovedIcon.image=ts.baseUrl+"gfx/map/icons/loved.png";
this.lovedIcon.shadowSize=new google.maps.Size(31,32);
this.lovedIcon.shadow=ts.baseUrl+"gfx/map/icons/loved_shadow.png";
this.hatedIcon=new google.maps.Icon(B);
this.hatedIcon.image=ts.baseUrl+"gfx/map/icons/hated.png";
this.hatedIcon.shadowSize=new google.maps.Size(31,32);
this.hatedIcon.shadow=ts.baseUrl+"gfx/map/icons/hated_shadow.png";
this.visitedIcon=new google.maps.Icon(B);
this.visitedIcon.image=ts.baseUrl+"gfx/map/icons/visited.png";
this.bestIcon=new google.maps.Icon(B);
this.bestIcon.image=ts.baseUrl+"gfx/map/icons/best.png";
this.bestIcon.shadowSize=new google.maps.Size(31,32);
this.bestIcon.shadow=ts.baseUrl+"gfx/map/icons/loved_shadow.png";
this.wishIcon=new google.maps.Icon(B);
this.wishIcon.image=ts.baseUrl+"gfx/map/icons/wish.png";
this.scheduledIcon=new google.maps.Icon(B);
this.scheduledIcon.image=ts.baseUrl+"gfx/map/icons/scheduled.png";
this.map.addControl(getTsMapControl());
this.map.enableScrollWheelZoom();
this.options.ratings.combine(this.options.wished);
this.options.ratings.combine(this.options.scheduled);
if(this.options.best){this.options.ratings.push(this.options.best)
}if(this.options.home){this.options.ratings.push(this.options.home)
}var A=0;
var C=0;
$each(this.options.ratings,function(D){if(D.loved){++A
}if(D.hated){++C
}});
this.zoomRelevant();
this.map.panBy(new google.maps.Size(0,100));
(function(){$each(this.options.ratings,function(E){if(this.isAlwaysShown(E)){var D=this.addProfilePlaceMarker(E);
this.map.addOverlay(D);
if(!E.wished){this.hoverMarker(D)
}}}.bind(this));
google.maps.Event.addListener(this.map,"zoomend",this.onProfileMapMoveOrZoom.bind(this));
google.maps.Event.addListener(this.map,"moveend",this.onProfileMapMoveOrZoom.bind(this));
this.onProfileMapMoveOrZoom()
}.bind(this)).delay(2500)
},getIcon:function(A){if(A.home){return this.homeIcon
}if(A.best){return this.bestIcon
}if(A.loved){return this.lovedIcon
}if(A.hated){return this.hatedIcon
}if(A.wished){return this.wishIcon
}if(A.scheduled){return this.scheduledIcon
}return this.visitedIcon
},addProfilePlaceMarker:function(B){var C=this.getIcon(B);
var A=new google.maps.Marker(new google.maps.LatLng(B.lat,B.lng),{icon:C});
A.destinationId=B.id;
A.type="";
A.unclosable=this.isAlwaysShown(B);
if(B.wished){A.unclosable=false
}var D='<a id="belongsTo'+B.id+'" href="'+ts.baseUrl+"destination/"+B.link+'">'+B.name+"</a>";
if(B.best){A.text=MooTools.lang.get("ProfileMap","loved")+" "+D+" "+MooTools.lang.get("ProfileMap","best");
A.bubbleType="bested"
}else{if(B.loved){A.text=MooTools.lang.get("ProfileMap","loved")+" "+D;
A.bubbleType="loved"
}else{if(B.hated){A.text=MooTools.lang.get("ProfileMap","hated")+" "+D;
A.bubbleType="hated"
}else{if(B.scheduled){A.text=MooTools.lang.get("ProfileMap","scheduled")+" "+D;
A.bubbleType="scheduled"
}else{if(B.wished){A.text=MooTools.lang.get("ProfileMap","wished")+" "+D;
A.bubbleType="wished"
}else{if(B.home){A.text='Home in <a href="'+ts.baseUrl+"destination/"+this.options.home.link+'">'+this.options.home.name+"</a>";
A.bubbleType="home"
}else{A.text=MooTools.lang.get("ProfileMap","visited")+" "+D;
A.bubbleType="visited"
}}}}}}google.maps.Event.addListener(A,"click",function(){window.location.href=ts.baseUrl+"destination/"+B.id
});
google.maps.Event.addListener(A,"mouseover",this.hoverMarker.pass([A],this));
google.maps.Event.addListener(A,"mouseout",this.closeHover.pass([A],this));
return A
},panMap:function(D,A,B){try{this.map.setCenter(new google.maps.LatLng(D,A),$pick(B,9))
}catch(C){}},zoomRelevant:function(){var A=new google.maps.LatLngBounds();
if(this.options.home){A.extend(new google.maps.LatLng(this.options.home.lat,this.options.home.lng))
}$each(this.options.ratings,function(B){A.extend(new google.maps.LatLng(B.lat,B.lng))
},this);
this.panMap(A.getCenter().lat(),A.getCenter().lng(),this.map.getBoundsZoomLevel(A)+1)
},hoverMarker:function(A){if(!A){return 
}if(A.hover){this.map.removeOverlay(A.hover)
}A.hover=new dInfo(A);
this.map.addOverlay(A.hover);
return A
},closeHover:function(A){if(A.unclosable){return 
}if(!A){return 
}if(A==this.selectedMarker){return 
}try{this.map.removeOverlay(A.hover)
}catch(B){}A.hover=null
},isAlwaysShown:function(A){return(A.home||A.best||A.wished||A.scheduled)
},onProfileMapMoveOrZoom:function(){if(this.map.getZoom()<2){this.map.setZoom(2)
}$each(this.ratingMarkers,function(A){if(A.hover){this.map.removeOverlay(A.hover)
}this.map.removeOverlay(A)
}.bind(this));
if(this["makeAjaxRequestTimer"]){$clear(this["makeAjaxRequestTimer"])
}this["makeAjaxRequestTimer"]=function(){if(this["request"]!=null){this["request"].cancel()
}this["request"]=new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"map/search",onSuccess:function(B){$each(this.options.ratings,function(D){var F=false;
for(var E=0;
E<B.ratings.length;
++E){if(B.ratings[E].id==D.id){var C=this.addProfilePlaceMarker(D);
var G=C.text;
if(B.ratings[E].q>1){G+="<!-- z --><br/>Zoom in for "+(B.ratings[E].q-1)+" more"
}C.text=G;
this.map.addOverlay(C);
this.ratingMarkers.push(C);
break
}}}.bind(this))
}.bind(this)});
var A={nelat:this.map.getBounds().getNorthEast().lat(),nelng:this.map.getBounds().getNorthEast().lng(),swlat:this.map.getBounds().getSouthWest().lat(),swlng:this.map.getBounds().getSouthWest().lng(),level:this.map.getZoom(),ownRatingsOnly:true,ownRatingsFor:this.options.userId};
this["request"].send(JSON.encode(A))
}.bind(this).delay(2500)
}});
var AutoAjax=new Class({Implements:[Events,Options],options:{element:"loadTest"},initialize:function(A){this.setOptions(A)
},startPoll:function(){this.updater=this.poll.periodical(1000,this)
},cancelPoll:function(){$clear(this.updater)
},poll:function(){var C=$(this.options.element);
var A=C.getCoordinates();
var D=window.getScroll();
var B=window.getSize();
if((A.top+A.height-B.y)<D.y){this.fireEvent("loadMore")
}}});
var Sliders=new Class({options:{rail:"rail",knob:"knob",values:{pricerange:50,experience:50,language:50,accessible:50,family:50},isEditable:true,paramPrefix:"param_"},sliders:{},fromFrontendToBackend:function(A){return(A-50)/50
},initializeSliders:function(){$each(this.options.values,function(A,B){if(!this.options.isEditable){if($("knob_"+B)){$("knob_"+B).setStyles({position:"relative",left:(A+1.5)+"px"})
}return 
}if($("rail_"+B)&&$("knob_"+B)){this.sliders[B]=$slider("rail_"+B,"knob_"+B,{value:A,onComplete:function(C){this.onComplete(C,B)
}.bind(this)})
}}.bind(this))
},onComplete:function(B,A){if(this.options.values[A]==B){return 
}this.options.values[A]=B;
if(this.options.saveSliderUrl){new Request({method:"post",url:this.options.saveSliderUrl}).post({param:this.options.paramPrefix+A,value:this.fromFrontendToBackend(B)})
}}});
var $slider=function(D,A,B){var C=new Slider(D,A,$merge({start:0,end:100},B));
C.fireEvent("tick",C.toPosition(B.value))
};
var StaticMap=new Class({Implements:[Events,Options,Actions],topZindex:100,initializeStaticMap:function(D){this.setOptions(D);
var B=1;
var F=this.options.mapCenterLat;
var C=this.options.mapCenterLng;
var E=Math.max(this.options.mapCenterZoom,1);
var A=this.latLngToPixel(F,C,E);
$each(this.options.places,function(G){var O=G.title;
if(O.length>14){O=O.substring(0,12)+"..."
}var L=new Element("a",{href:ts.baseUrl+"destination/"+G.link,text:O});
var H=new Element("div",{"class":"staticMarker place",id:"staticMarker_"+(B-1)});
var M=new Element("span",{html:(B++)+"."});
M.injectInside(H);
L.injectInside(H);
var N=$("map");
var I=this.latLngToPixel(G.lat,G.lng,E);
var J=N.offsetHeight/2+(I.y-A.y);
var K=N.offsetWidth/2+(I.x-A.x);
H.setStyle("top",J+"px");
H.setStyle("left",K+"px");
H.injectInside($(this.options.map||"map"))
}.bind(this))
},onBringToFront:function(A){$("staticMarker_"+A.index).style.zIndex=this.topZindex++;
window.fireEvent("broughtToFront",A.index)
},latLngToPixel:function(G,B,F){var H=Math.pow(2,F+7);
var A=H*2;
var D=A/360;
var E=A/(2*Math.PI);
var C=Math.min(Math.max(Math.sin(G*(Math.PI/180)),-0.9999),0.9999);
return{x:Math.round(H+B*D),y:Math.round(H-0.5*Math.log((1+C)/(1-C))*E)}
}});
var TabControl=new Class({onTab:function(A){$$(".tabs .tab").each(this.deselectTab);
$$(".tabs .tab."+A.page).each(this.selectTab);
$$(".tabContent .tab").each(this.deselectDiv);
$$(".tabContent .tab."+A.page).each(this.selectDiv)
},selectDiv:function(A){A.show()
},deselectDiv:function(A){A.hide()
},selectTab:function(A){A.addClass("selected")
},deselectTab:function(A){A.removeClass("selected")
}});
var TipSet=new Class({Implements:[Events,Options],map:null,markers:[],options:{tipsetPage:false},initializeTipSet:function(A){this.setOptions(A);
if(!this.options.tipsetPage){return 
}$each($$(".tipsetBottom"),function(B){B.innerHTML="";
B.addClass("bottom");
B.removeClass("tipsetBottom")
});
$$("#messageForm").hide();
$$("#messageForm + div.clear").dispose();
window.addEvent("wallDelete",this.onTipSetItemDeleted.bind(this))
},initializeTipSetMapMap:function(){if(!this.options.tipsetPage){return 
}google.load("maps","2",{callback:function(){this.onTipSetMapReady()
}.bind(this)})
},onTipSetMapReady:function(){this.map=new google.maps.Map2($("map"));
this.map.addMapType(G_PHYSICAL_MAP);
this.map.setCenter(new google.maps.LatLng(17.3,14),1,G_PHYSICAL_MAP);
this.map.addControl(getTsMapControl());
this.icon=new google.maps.Icon(G_DEFAULT_ICON,ts.baseUrl+"gfx/map/icons/place.png");
this.icon.shadow=null;
this.icon.iconSize=new google.maps.Size(14,14);
this.icon.iconAnchor=new google.maps.Point(6,7);
this.icon.bubbleAnchor=new google.maps.Point(1,8);
this.refreshPath()
},refreshPath:function(){this.markers=new Array();
this.map.clearOverlays();
this.markerBounds=new google.maps.LatLngBounds();
var A=new Array();
var C;
$each(this.options.places,function(G,F){var H=new google.maps.LatLng(G.lat,G.lng);
var E=new google.maps.Marker(H,{icon:this.icon});
google.maps.Event.addListener(E,"click",this.onSelectStop.pass(G,this));
E.i=F+1;
E.text=G.title;
E.bubbleType="indexed";
G.marker=E;
if(C){C.next=G;
G.previous=C
}C=G;
this.map.addOverlay(E);
google.maps.Event.addListener(E,"mouseover",function(){this.moveOverMarker(E)
}.bind(this));
google.maps.Event.addListener(E,"mouseout",function(){this.moveOutMarker(E)
}.bind(this));
this.markers.push(E);
this.markerBounds.extend(H);
A.push(H)
}.bind(this));
var B=new google.maps.Polyline(A,"#00aeef",7,0.9,{clickable:false,geodesic:false});
this.map.addOverlay(B);
var D=this.map.getBoundsZoomLevel(this.markerBounds);
if(D>1){--D
}this.map.setCenter(new google.maps.LatLng(this.markerBounds.getCenter().lat(),this.markerBounds.getCenter().lng()),D)
},moveOverMarker:function(A){if(A==null){return 
}$each(this["markers"],function(B){if(B.hover){try{this.map.removeOverlay(B.hover)
}catch(C){}B.hover=null
}}.bind(this));
if(!A.hover){A.hover=new dInfo(A);
this.map.addOverlay(A.hover)
}},moveOutMarker:function(A){if(A==null){return 
}setTimeout(function(){if(A.hover){try{this.map.removeOverlay(A.hover)
}catch(B){}A.hover=null
}}.bind(this),4000)
},onSelectStop:function(A){$$("#messageboardContents div.tipItem").hide();
$$("div#entry"+A.reviewEntryId).show();
$$("#showAllTipSetEntries").show()
},onShowAllTipSetEntries:function(){$$("#messageboardContents div.tipItem").show();
$$("#showAllTipSetEntries").hide()
},openTipSetLightbox:function(A){if($("tipSetLightbox")){$("tipSetLightbox").dispose()
}new Dialog({title:A,message:'<span id="tipSetLightbox">Loading, please wait ...</span>',buttons:["cancel"]})
},onTipSetAdd:function(A){this.openTipSetLightbox("Add tip to a tip set");
var B=new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"tipset/list",onSuccess:function(C){var E;
if(C.result.length>0){E=this.tipSetGetClearLightBoxContent("Select an existing tip set:");
E.br();
C=C.result;
$each(C,function(F){new Element("a",{href:"#",html:F.name,events:{click:function(){this.tipSetGetClearLightBoxContent("Adding, please wait ...");
var G=new Request({url:ts.baseUrl+"tipset/add/"+F.id+"/"+A.entry,onSuccess:function(H){this.tipSetHideLightBoxAndUpdateWallLinks(A.entry)
}.bind(this)});
G.send();
return false
}.bind(this)}}).inject(E);
E.br()
}.bind(this));
E.br();
E.appendText("... or create a new one by giving its name:")
}else{E=this.tipSetGetClearLightBoxContent("Create a tip set by giving its name:")
}E.br();
new Element("input",{style:"float:left",type:"text",name:"newtipsetname",size:20}).inject(E);
var D=new Element("a",{"class":"button"});
new Element("span",{html:"Create",events:{click:function(){var H=$$("input[name=newtipsetname]");
var F=H[H.length-1].value;
this.tipSetGetClearLightBoxContent('Creating "'+F+'" and adding your tip to it, please wait ...');
var G=new Request.HTML({url:ts.baseUrl+"tipset/add/-1/"+A.entry,onSuccess:function(){this.tipSetHideLightBoxAndUpdateWallLinks(A.entry)
}.bind(this)});
G.post({name:F});
return false
}.bind(this)}}).inject(D);
D.inject(E);
E.br();
E.br();
E.br()
}.bind(this)});
B.send(JSON.encode({}))
},onTipSetRemove:function(A){if($("tipSetLightbox")){$("tipSetLightbox").dispose()
}new Dialog({title:"Remove this tip from tip set",message:'<span id="tipSetLightbox">Remove this tip from its tip set?<br/><br/>The tip itself will not be deleted.<br/><br/>If you remove the last tip from a set, the set will be automatically deleted.<br/><br/></span>',buttons:["cancel","remove"],onRemove:function(){this.tipSetGetClearLightBoxContent("Removing, please wait ...");
this.tipSetUpdateWallRemove(A.entry);
var B=new Request.JSON({url:ts.baseUrl+"tipset/remove/"+A.entry,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(C){if(this.options.tipsetPage){$("entry"+A.entry).dispose()
}if(C>-1){this.tipSetHideLightBoxAndUpdateWallLinks(C)
}else{this.onTipSetItemDeleted(C)
}}.bind(this)});
B.send(JSON.encode({}))
}.bind(this)})
},onTipSetOrder:function(C,A,F,D){var G=(!A||!F||!D);
var B;
if(G){if($("tipSetLightbox")){$("tipSetLightbox").dispose()
}new Dialog({title:"Modify tip set",message:'<span id="tipSetLightbox">Loading, please wait ...</span>',buttons:["done"],onDone:function(){this.tipSetHideLightBoxAndUpdateWallLinks(C.entry)
}.bind(this)});
B=ts.baseUrl+"tipset/order/"+C.entry
}else{B=ts.baseUrl+"tipset/order/"+D+"/"+A+"/"+F
}var E=new Request.JSON({url:B,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(H){if(!G){this.tipSetUpdateWallNeighborLinks(C.entry)
}var J=this.tipSetGetClearLightBoxContent();
new Element("input",{type:"text",size:"25",value:H[0]["tipSetName"],name:"tipSetId"+H[0]["tipSetId"]+"_"+H[0].reviewEntryId,"class":"tipSetRenameInput",styles:{"font-size":"16px"},events:{keyup:function(){var K=function(){var N=$$(".tipSetRenameInput");
N=N[N.length-1];
var M=N.value;
var P=N.name.substr(8).split("_")[0];
var L=N.name.substr(8).split("_")[1];
var O=new Request.HTML({url:ts.baseUrl+"tipset/rename",onSuccess:function(){$$("#tipSetPageTitle").set("html",M);
this.tipSetUpdateWallNeighborLinks(L)
}.bind(this)});
O.post({tipSet:P,name:M})
};
if(this.delayedRenameTimer){$clear(this.delayedRenameTimer)
}this.delayedRenameTimer=K.delay(1000,this)
}.bind(this)}}).inject(J);
J.br();
J.br();
if(H.length==1){J.appendText("As this tip set contains only one item, there's very little sense in reordering it :)");
J.br();
J.br();
$$("a[rel=done] span").set("html","Yes, that makes sense");
return 
}var I=0;
$each(H,function(L){var M=new Element("div",{id:"tipSetOrder_"+L.id,styles:{clear:"both"}});
new Element("div",{html:++I+".",styles:{color:"#71D000","font-size":"21px","float":"left",padding:"3px 6px 0 0",height:"35px"}}).inject(M);
new Element("b",{html:L.destinationName}).inject(M);
M.appendText(": "+L.taster);
M.inject(J);
new Element("br").inject(M);
var K=new Element("small",{style:{"padding-left":"20px"}});
K.appendText("Move the above tip [");
if(I>1){new Element("a",{html:"up",events:{click:function(){this.tipSetMove(L.id,true,L.tipSetId,C.entry)
}.bind(this)}}).inject(K)
}if(I<H.length){if(I>1){K.appendText("/")
}new Element("a",{html:"down",events:{click:function(){this.tipSetMove(L.id,false,L.tipSetId,C.entry)
}.bind(this)}}).inject(K)
}K.appendText("]");
K.inject(M)
}.bind(this));
J.br()
}.bind(this)});
E.send(JSON.encode({}))
},tipSetMove:function(G,C,F,A){var E=$("tipSetOrder_"+G);
var B=C?E.getPrevious():E.getNext();
E.dispose();
E.inject(B,C?"before":"after");
var D=new Number(B.id.substr(12));
this.onTipSetOrder({entry:A},G,D,F)
},tipSetGetClearLightBoxContent:function(A){var B=$("tipSetLightbox");
B.empty();
B.br=function(){new Element("br").inject(this)
}.bind(B);
if(A){B.appendText(A)
}return B
},tipSetHideLightBoxAndUpdateWallLinks:function(A){this.tipSetGetClearLightBoxContent();
$$("div.StickyWinInstance a[rel=cancel]").fireEvent("click");
this.tipSetUpdateWallNeighborLinks(A)
},tipSetUpdateWallRemove:function(B){$("tipSetIndividual"+B).setStyle("display","inline");
$("tipSetContaining"+B).setStyle("display","none");
var A=$$("#entry"+B+" .tipsetBottom")[0];
if(A){A.empty();
A.removeClass("tipsetBottom");
A.addClass("bottom")
}},tipSetUpdateWallNeighborLinks:function(B){if(this.options.tipsetPage){var A=new Request.JSON({url:ts.baseUrl+"tipset/order/"+B,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(C){$each(C,function(D){var E=$("entry"+D.reviewEntryId);
E.dispose();
E.inject($("messageboardContents"))
});
this.options.places=new Array();
$each(C,function(D){this.options.places.push({title:D.destinationName,lat:D.lat,lng:D.lng,reviewEntryId:D.reviewEntryId})
}.bind(this));
this.refreshPath()
}.bind(this)});
A.send(JSON.encode({}));
return 
}var A=new Request.JSON({url:ts.baseUrl+"tipset/links/"+B,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(C){$each(C.items,function(E){if($("tipSetIndividual"+E.reviewEntryId)){$("tipSetIndividual"+E.reviewEntryId).setStyle("display","none");
$("tipSetContaining"+E.reviewEntryId).setStyle("display","inline");
var D=$$("#entry"+E.reviewEntryId+" .tipsetBottom")[0];
if(!D){D=$$("#entry"+E.reviewEntryId+" .bottom")[0]
}D.empty();
if(E.previous){new Element("a",{title:"Previous tip/destination in "+E.tipSetName,href:ts.baseUrl+"destination/"+E.previousDestId+"#"+E.previousEntryId,html:E.previousDestName}).inject(D);
D.set("html",D.get("html")+" &lt;&lt; ")
}D.appendText('This tip is part of "');
new Element("a",{href:ts.baseUrl+"tipset/"+E.tipSetId,html:E.tipSetName}).inject(D);
D.appendText('"');
if(E.next){D.set("html",D.get("html")+" &gt;&gt; ");
new Element("a",{title:"Next tip/destination in "+E.tipSetName,href:ts.baseUrl+"destination/"+E.nextDestId+"#"+E.nextEntryId,html:E.nextDestName}).inject(D)
}D.removeClass("bottom");
D.addClass("tipsetBottom")
}}.bind(this))
}.bind(this)});
A.send(JSON.encode({}))
},onTipSetItemDeleted:function(B){this.options.places=this.options.places.filter(function(C){return C.reviewEntryId!=B
}.bind(this));
this.refreshPath();
if($$("#messageboardContents div.tipItem").length>0){return 
}if(this.options.allTipSets.length<2){location.href=ts.baseUrl+"traveler/";
return 
}for(var A=0;
A<this.options.allTipSets.length;
++A){if(this.options.allTipSets[A]!=this.options.tipSet){location.href=ts.baseUrl+"tipset/"+this.options.allTipSets[A];
return 
}}location.href=ts.baseUrl+"traveler/"
},onTipSetTweet:function(){window.open("http://www.twitthis.com/twit?url="+this.options.twitUrl+"&title="+this.options.twitTitle,"twitthis","height=600, width=600")
},onTipSetCreate:function(A){this.openTipSetLightbox(A.id?"Add tips to this tip set":"Create a new tip set");
var B=new Request.JSON({method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"tipset/available",onSuccess:function(C){if(C.result.length==0){var E=this.tipSetGetClearLightBoxContent("You have no tips to add to your tip set!");
E.br();
E.br();
$$("#tipSetLightbox + p span")[0].innerHTML="Okay";
return 
}var D=new Element("a",{"class":"button right"});
new Element("span",{html:A.id?"Add selected":"Create",events:{click:function(){if(A.id){var I=$$("#tipSetLightbox input[name=newtipsetname]")[0];
if(I.value.trim().length<5){I.focus();
return 
}var G=$$("a.check.checked");
this.tipSetGetClearLightBoxContent("Adding, please wait ...");
$$("p.lightboxButtons").hide();
var H=new Request.HTML({async:false,url:ts.baseUrl+"tipset/rename"});
H.post({tipSet:A.id,name:I.value});
G.each(function(J){var L=J.id.split("_")[1];
var K=new Request({async:false,url:ts.baseUrl+"tipset/add/"+A.id+"/"+L});
K.send()
}.bind(this));
$$(".lightboxButtons a[rel=cancel]").fireEvent("click");
$reload()
}else{this.tipSetCreateDone()
}return false
}.bind(this)}}).inject(D);
D.inject($$("#tipSetLightbox + p")[0]);
var E=this.tipSetGetClearLightBoxContent();
E.appendText("Name: ");
new Element("input",{title:"Give a name to your tip set",type:"text",name:"newtipsetname",size:20,value:(A.id?this.options.currentTipSetName:this.options.defaultNewTipSetName)}).inject(E);
E.br();
E.br();
var F=new Element("div",{id:"newTipSetTipListing",style:"height:150px;overflow:auto;font-size:11px"});
C=C.result;
$each(C,function(G){var I=new Element("div");
new Element("a",{id:"newTipSetTipListing_"+G.id,href:"#","class":"check",style:"margin:1px 3px 3px 1px",title:"Check to select your tip from "+G.destination+" to be included in your new tip set",events:{click:function(){if(this.hasClass("checked")){this.removeClass("checked")
}else{this.addClass("checked")
}this.getParent().setStyles({"background-color":(this.hasClass("checked")?"#00AEEF":"#FFF"),color:(this.hasClass("checked")?"#FFF":"#3F4853")});
return false
}}}).inject(I);
new Element("b",{html:G.destination}).inject(I);
I.appendText(" in ");
new Element("b",{html:G.country}).inject(I);
var H=G.message.trim();
if(H.length>10){H=H.substr(0,90).trim()+"..."
}I.appendText(' "'+H+'"');
I.inject(F);
new Element("div",{style:"clear:both"}).inject(F)
}.bind(this));
F.inject(E)
}.bind(this)});
B.send(JSON.encode({}))
},tipSetCreateDone:function(){var C=$$("#tipSetLightbox input[name=newtipsetname]")[0];
if(C.value.trim().length<5){C.focus();
return 
}var D=new Array();
$$("a.check.checked").each(function(E){D.push(E.id.split("_")[1])
});
if(D.length==0){alert("Select tips to be included in your tip set");
return 
}var B=this.tipSetGetClearLightBoxContent("Saving your tip set...");
$$("p.lightboxButtons").dispose();
var A=new Request.HTML({async:false,url:ts.baseUrl+"tipset/add/-1/"+D[0],onSuccess:function(){var E=new Request.JSON({async:false,method:"post",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,url:ts.baseUrl+"tipset/list",onSuccess:function(F){var G=location.href;
location.href=G.substr(0,G.lastIndexOf("/"))+"/"+F.newestId
}});
E.send(JSON.encode({}))
}.bind(this)});
A.post({name:C.value.trim(),additional:D.erase(D[0]).join()})
}});
TitleTags=new Class({medianRelevance:0,onShowAllTags:function(){$("tags").addClass("allTags")
},onShowGoodTags:function(){$("tags").removeClass("allTags")
},onVoteTag:function(A){new Request({url:ts.baseUrl+"tags/vote",onComplete:function(B){$$("#tag_"+A.tag+" .thumbs").each(function(C){C.innerHTML=" you gave "+A.value
})
}}).post(A)
},onAddTag:function(A){this.addTagModalWindow=new Dialog({title:MooTools.lang.get("TitleTags","addTitle"),message:MooTools.lang.get("TitleTags","addMessage")+' <input type="text" id="addTagTextfield"/>',buttons:["add","cancel"],onAdd:this.doAdd.pass(A,this)});
new Autocompleter.Ajax.Json($("addTagTextfield"),ts.baseUrl+"tags/interests!match",{postVar:"query",minLength:3,useSelection:false,observerOptions:{delay:500},injectChoice:function(B,C){var D=new Element("li").set("html",this.markQueryValue(B.name)+($defined(B.typeString)?" ("+B.typeString.replace("_","&nbsp;")+")":""));
D.inputValue=B;
B.toString=function(){return this.name
};
B.substr=function(F,E){return this.name.substr(F,E)
};
if(!B.name.contains("not found")){this.addChoiceEvents(D)
}else{D.setStyle("color","red");
this.addChoiceEvents(D)
}D.injectInside(this.choices)
}})
},doAdd:function(A){A.tagName=$("addTagTextfield").value;
new Request({method:"post",url:ts.baseUrl+"tags/add",onComplete:function(){location.reload()
}}).post(A)
},onShowTag:function(B){if($("modalOverlay")){$("modalOverlay").fireEvent("click")
}var C=new Dialog({title:B.name,message:MooTools.lang.get("TitleTags","detailsLoading"),buttons:["cancel"]});
var A=$merge({},B);
delete (A.name);
new Request({url:ts.baseUrl+"tags/view",onComplete:function(E){if(C.visible&&$("modalOverlay")){C.destroy();
var D=new Dialog({title:MooTools.lang.get("TitleTags","detailsTitle"),message:E,buttons:["close"]})
}}.bind(this)}).post(A)
}});
var TravelStoryDialog=new Class({Extends:FieldsDialog,Implements:[DestinationSelector],Binds:["destroy","createDestinationField"],initialize:function(B){B.title=MooTools.lang.get("TravelStoryList","createTitle");
B.help="<p>"+MooTools.lang.get("TravelStoryList","createHelp")+"</p><p style='display:none' id='error'><b>"+MooTools.lang.get("TravelStoryList","createHelpError")+"</b></p>";
var A={destination:{content:"<p>"+MooTools.lang.get("TravelStoryList","createDestinationField")+"</p><p><input id='destinationAutoComplete' class='full' value='{place}'/><input id='destinationAutoCompleteId' name='destination' value='{destId}' type='hidden'/></p>".substitute(B),initialize:this.createDestinationField},title:{title:MooTools.lang.get("TravelStoryList","createNameField"),name:"name",value:B.name||"",initialize:this.createDateField}};
this.parent(B,A)
}});
Events.TravelStory=new Class({onDeleteStory:function(A){new Dialog({title:MooTools.lang.get("TravelStoryList","deleteTitle"),message:MooTools.lang.get("TravelStoryList","deleteMessage")+"<br/><br/>",buttons:["ok","cancel"],onOk:function(){new Request({method:"post",url:ts.baseUrl+"travelstory/story/delete",onSuccess:function(){$("listStory"+this["travelStory"]).dispose()
}.bind(this)}).post(this)
}.bind(A)})
},onCreateStory:function(){this.addPlaceDialog=new TravelStoryDialog({onConfirm:this.createStory.bind(this)})
},createStory:function(A){if(($$("#"+this.addPlaceDialog.id+" input")[1].value=="")||($$("#"+this.addPlaceDialog.id+" input")[2].value=="")){new Dialog({title:MooTools.lang.get("TravelStoryList","createErrorTitle"),message:MooTools.lang.get("TravelStoryList","createErrorMessage")+"<br/><br/>",buttons:["ok"]})
}else{location.href=ts.baseUrl+"travelstory/create?"+new Hash(A).toQueryString()
}}});
var TravelStoryActions=new Class({Implements:[Events,Options,Actions,Events.TravelStory],Binds:["createStory"],map:null,markerBounds:null,selectedMarkerIndex:1,bubble:null,options:{actions:"#storyPage .action"},initialize:function(A){this.setOptions(A);
this.bindActions($$(this.options.actions));
this.addDefaultEvents()
}});
var TravelStoryMap=new Class({Implements:[DestinationSelector],map:null,markerBounds:null,bubble:null,places:new Hash(),initializeTravelStoryMap:function(){if($("addPlaceAutocompleteField")){this.createDestinationField({field:"addPlaceAutocompleteField",overtext:MooTools.lang.get("TravelStoryMap","addPlaceOvertext")})
}this.map=new GMap2($("map"));
this.map.addMapType(G_PHYSICAL_MAP);
this.map.setCenter(new GLatLng(17.3,14),1,G_PHYSICAL_MAP);
this.map.addControl(new tsMapControl());
this.icon=new GIcon(G_DEFAULT_ICON,ts.baseUrl+"gfx/map/icons/place.png");
this.icon.shadow=null;
this.icon.iconSize=new GSize(14,14);
this.icon.iconAnchor=new GPoint(6,7);
this.icon.bubbleAnchor=new GPoint(1,8);
this.refreshPath();
$each(this.options.places,function(B){if(B.id==this.options.selected){this.onSelectStop(B)
}},this);
if(!this.selected){this.onSelectStop(this.options.places[0])
}if($$("#storyPage #messageboardContents a.replier").length==0){var A=$$("p.replyLine a");
if(A.length==1){}}},save:function(B){var A=B.entry;
delete B.entry;
new Request.HTML({url:ts.baseUrl+"wall/edit/"+A}).post(B)
},onSaveDescription:function(A){var B=$("message"+A.entry).value;
new Request.HTML({url:ts.baseUrl+"wall/edit/"+A.entry}).post({"entry.message":B});
$("textContents"+A.entry).set("html",B.formatEditorString());
$("editor"+A.entry).hide();
$("editButton"+A.entry).show("inline")
},onAddPlace:function(A){var B=$("addPlaceAutocompleteFieldId").value;
if(B>0){location.href=ts.baseUrl+"travelstory/story/"+this.options.story+"/add/"+B+"?"+new Hash(A).toQueryString()
}},onRemoveStop:function(A){new Dialog({title:"Remove this stop?",message:"Are you sure you want to remove this stop from your travel story?",buttons:["delete","cancel"],onDelete:function(){location.href=ts.baseUrl+"travelstory/story/remove/"+this.options.story+"/"+A.id
}.bind(this)})
},onEntryDateEditSuccess:function(A){location.href=ts.baseUrl+"travelstory/story/"+this.options.story+"/"+A.entry
},onSelectStop:function(A){this.selected=this.places.get(A.id);
this.moveBubble();
this.openCommentBoxIfNoReplies()
},refreshPath:function(){this.map.clearOverlays();
this.markerBounds=new GLatLngBounds();
var A=new Array();
var C;
$each(this.options.places,function(G,F){var H=new GLatLng(G.lat,G.lng);
var E=new GMarker(H,{icon:this.icon});
GEvent.addListener(E,"click",this.onSelectStop.pass(G,this));
E.i=F+1;
E.text=G.title;
E.bubbleType="indexed";
G.marker=E;
if(C){C.next=G;
G.previous=C
}C=G;
this.map.addOverlay(E);
this.markerBounds.extend(H);
A.push(H);
this.places.set(G.id,G)
}.bind(this));
var B=new GPolyline(A,"#00aeef",8,0.5,{clickable:false,geodesic:false});
this.map.addOverlay(B);
var D=this.map.getBoundsZoomLevel(this.markerBounds);
if(D>1){--D
}this.map.setCenter(new google.maps.LatLng(this.markerBounds.getCenter().lat(),this.markerBounds.getCenter().lng()),D);
this.showBubble()
},showBubble:function(){if(this.bubble){this.map.removeOverlay(this.bubble)
}if(this.selected){this.bubble=new dInfo(this.selected.marker);
this.map.addOverlay(this.bubble)
}},moveBubble:function(){var B=this.selected;
if(!B){return 
}this.showBubble();
$each($$("#stopList li"),function(C){C.removeClass("selected")
});
var A=$("letsgo_"+B.id);
if(A){A.addClass("selected")
}$each(this.options.places,function(C){var D=$("travelStoryContent_"+C.id);
(C.id==B.id)?D.show():D.hide()
})
},onPrev:function(){if(!this.selected.previous){return 
}this.onSelectStop(this.selected.previous)
},onNext:function(){if(!this.selected.next){return 
}this.onSelectStop(this.selected.next)
},openCommentBoxIfNoReplies:function(){var A=false;
$each($$(".reply"),function(B){if(B.getParent().getParent().getParent().getParent().getParent().getStyle("display")!="none"){A=true
}}.bind(this));
if(!A){$each($$(".tip_reply"),function(B){if(B.getParent().getParent().getParent().getStyle("display")!="none"){B.fireEvent("click")
}})
}}});
var UserSettings=new Class({initializeUserSettings:function(){this.imager=new ImageUploader({actions:".userImageAction",type:"user"});
$("saveSettingsButton").addEvent("click",this.validateAndSubmitSettings.bind(this));
$("screenname").addEvent("change",this.handleLoginname);
$("addInterestButton").addEvent("click",this.saveInterest.bind(this));
$each(this.options.interests,this.drawInterest.bind(this));
new Autocompleter.Ajax.Json($("interests"),this.options.interestAutocompleteUrl,{postVar:"query",minLength:3,useSelection:false,markQuery:false,observerOptions:{delay:500},injectChoice:function(A,B){var C=new Element("li").set("html",A.name);
C.setStyles({background:"none",padding:"1px"});
C.inputValue=A;
A.toString=function(){return A.name
};
A.substr=function(E,D){return A.name.substr(E,D)
};
if(!A.name.contains("not found")){this.addChoiceEvents(C)
}else{C.setStyle("color","red");
this.addChoiceEvents(C)
}C.injectInside(this.choices)
},onSelect:function(B,A,C){$each(A.getParent().getChildren(),function(D){if(this==D){D.setStyle("background-color","#00AEEF")
}else{D.setStyle("background-color","")
}}.bind(A))
}});
new Autocompleter.Ajax.Json($("cityName"),ts.baseUrl+"map/search/!matchCities",{postVar:"query",minLength:3,useSelection:false,markQuery:false,observerOptions:{delay:500},onSelection:function(B,A,C){$("cityId").value=C.id
}.bind(this),injectChoice:function(A,B){var C=new Element("li").set("html",A.name);
C.setStyles({background:"none",padding:"1px"});
C.inputValue=A;
A.toString=function(){return A.name
};
A.substr=function(E,D){return A.name.substr(E,D)
};
if(!A.name.contains("not found")){this.addChoiceEvents(C)
}else{C.setStyle("color","red");
this.addChoiceEvents(C)
}C.injectInside(this.choices)
},onSelect:function(B,A,C){$each(A.getParent().getChildren(),function(D){if(this==D){D.setStyle("background-color","#00AEEF")
}else{D.setStyle("background-color","")
}}.bind(A))
}})
},drawInterest:function(B){$("interests").value="";
var A=new Element("a",{id:"interest_"+B.id,"class":"button_interest",html:"<span>"+B.name+"</span>",events:{click:function(){this.removeInterest(B)
}.bind(this)}});
A.injectInside($("interestList"));
this.fixInterestDivHeight()
},saveInterest:function(C,B){var A;
if(!C.name){A=$("interests").value;
this.drawInterest({id:new Date().getTime(),name:A})
}else{A=C.name
}if(!B){B=1
}if(A!=""){new Request({method:"post",url:this.options.interestSaveUrl}).post({interest:A,value:B})
}},removeInterest:function(A){$("interest_"+A.id).dispose();
this.fixInterestDivHeight();
this.saveInterest(A,-1)
},fixInterestDivHeight:function(){$$("#mySettings .sliders_").setStyle("height",(260+$("interestList").offsetHeight)+"px")
},handleLoginname:function(){this.value=this.value.toLowerCase();
var A="";
for(var B=0;
B<this.value.length;
B++){if("0123456789abcdefghijklmnopqrstuvwxyz-.!*".indexOf(this.value.charAt(B))!=-1){A+=this.value.charAt(B)
}}this.value=A;
new Request.JSON({method:"post",url:ts.baseUrl+"settings/checkLoginnameUniqueness",headers:{"Content-Type":"application/json","X-Request":"JSON"},urlEncoded:false,onSuccess:function(C){$("dupe").setStyle("display",C?"none":"inline");
loginNameOK=C
}}).send(JSON.encode({loginname:$("screenname").value}))
},onSelectField:function(B,A){if(A.hasClass("errorMessage")){A.removeClass("errorMessage");
A.value=""
}},validateAndSubmitSettings:function(){if($("dupe").getStyle("display")!="none"){alert(MooTools.lang.get("UserSettings","dupeError"));
return false
}if($("screenname").value.length<3){alert(MooTools.lang.get("UserSettings","loginnameTooShortError"));
return false
}$("screenname").value=$("screenname").value.toLowerCase();
if(($("password").value.length>0)||($("pass2").value.length>0)){if($("oldPassword").value.length==0){alert(MooTools.lang.get("UserSettings","oldPasswordError"));
return false
}if($("password").value!=$("pass2").value){alert(MooTools.lang.get("UserSettings","passwordMismatchError"));
return false
}}if(($("firstName").length<1)||($("lastName").length<1)){alert(MooTools.lang.get("UserSettings","bothNamesRequiredError"));
return false
}var A=$("email").value;
if((A.length<6)||(A.indexOf(".")==-1)||(A.indexOf("@")==-1)){alert(MooTools.lang.get("UserSettings","emailRequired"));
return false
}if($("cityId").value==""){alert(MooTools.lang.get("UserSettings","homeRequired"));
return false
}$("mydataForm").submit()
}});
var VoteActions=new Class({followedOnThisPageLoad:new Array(),onVoteEntry:function(B,C){var D=C.getParent();
var A=new Element("span",{html:MooTools.lang.get("Wall","voted"),styles:{"float":"right","padding-right":"5px"},id:"votedReady"});
A.injectInside(D);
(function(){$("votedReady").dispose()
}).delay(2000);
$each(C.getParent().getElements("a"),function(E){var F="1.0";
if(E==C){F="0.5"
}(function(){this.show();
this.setStyle("opacity",F)
}).delay(2000,E);
E.hide()
});
new Request.HTML({method:"post",url:ts.baseUrl+"wall/vote"}).post(B);
if(B.follow&&!this.followedOnThisPageLoad.contains(B.follow)){new Dialog({title:"Since you liked the tip ...",message:"... would you like to follow its author?<br/>&nbsp;",buttons:["no thanks","okay"],onOkay:function(){this.followedOnThisPageLoad.push(B.follow);
new Request({method:"post",url:ts.baseUrl+"traveler/follow/user/"+(B.follow||"")}).post({cancel:false})
}.bind(this)})
}}});
var Wall=new Class({Implements:[ImageActions,VoteActions,Actions],wallOptions:{element:"messageForm",wallElement:"messageBoard",tips:"#messageBoard .tipItem",overtext:MooTools.lang.get("Wall","overtext")},initializeWall:function(){this.wallOptions=$merge(this.wallOptions,this.options.wall,{validatorOptions:{onElementFail:this.onInvalidInput.bind(this)},submitOptions:{onComplete:this.updateFromWrite.bind(this)}});
this.form=new TripSayForm(this.wallOptions);
this.imager=new ImageUploader({actions:".commentImageAction",type:"commentEntry",onImageRemoved:function(A){$$("message"+A.item+" img").each(Element.destroy)
}});
if($(this.wallOptions.element)){$(this.wallOptions.element).grab(new Element("input",{type:"hidden",name:"wall."+this.options.wall.kind,value:this.options.wall.id}),"top");
if(this.wallOptions.overtext){$(this.wallOptions.element).getElements("textarea").each(function(A){new OverText(A,{textOverride:'<span class="destinationInput" id="overlay-content">'+this.wallOptions.overtext+"</span>"})
}.bind(this))
}}},loadMore:function(){var B={from:++this.page};
B["wall."+this.options.wall.kind]=this.options.wall.id;
this.autoPoll.cancelPoll();
var A=new Element("div",{html:"loading more"});
$("messageboardContents").adopt(A,"end");
A.set("load",{method:"post",data:B,onComplete:function(){this.onLoadMoreComplete(A)
}.bind(this)});
A.load(ts.baseUrl+"wall/view")
},onLoadMoreComplete:function(A){this.update(A);
this.autoPoll.startPoll()
},onInvalidInput:function(A,C){var B=$(A).get("value");
if(B==""){alert(MooTools.lang.get("Wall","noMessageError"))
}else{if(B.length<10){alert(MooTools.lang.get("Wall","tooShortMessageError"))
}}},updateFromWrite:function(C){var E=new Element("div");
E.set("html",C);
E.inject(($("newInserts")?$("newInserts"):$("messageboardContents")),"bottom");
$$("#messageboardContents .empty").hide();
this.update(E);
if($(this.wallOptions.element)){if(typeof ($(this.wallOptions.element).reset)=="function"){$(this.wallOptions.element).reset()
}$(this.wallOptions.element).getElements("form").each(function(F){F.reset()
})
}var B=C.indexOf('class="tipItem question')!=-1;
var D=MooTools.lang.get("Wall","thanksTip");
if(B){D=MooTools.lang.get("Wall","thanksQuestion")
}if($$("#tip").length>0){$$("#tip.box div.cnt div.inner")[0].hide();
var A=new Element("div",{"class":"inner plain",style:"text:align:center",text:D});
A.injectInside($$("#tip.box div.cnt")[0]);
(function(){this.dispose();
$$("#tip.box div.cnt div.inner")[0].show()
}).delay(10000,A)
}if($$("#filters").length>0){$$("#filters a#default")[0].fireEvent("click")
}this.bindActions($$("a.largeImageLink"));
if(this.countFilter){this.countFilter(true)
}if($("orderFilter")){$("orderFilter").show()
}$$("#showAddTipImage").show();
$$("#showAddTipSources").hide();
if($("newAddImage")){$("newAddImage").empty();
$("newAddImage").setStyle("margin","0")
}$$("#showAddTipLink").show();
$$("#newTipUrl").hide();
$$("#newTipOKButton_upper").show();
$$("#newTipOKButton_lower").hide()
},update:function(A){this.imager.bindActions($(A).getElements(".commentImageAction"));
this.bindActions($(A).getElements(".action, .editAction"))
},onReply:function(A){this.replyEntry={parent:A.entry};
this.replyEntry["wall."+this.options.wall.kind]=this.options.wall.id;
var B=A.entry;
if(this.editor){this.editor.destroy()
}$$("#messageboard .replyLine").each(function(C){C.set("style","")
});
$$(".actions .replyLine").setStyle("display","inline");
$$("#entry"+A.entry+" .replyLine").each(Element.hide);
this.replyImager=new ImageUploader({type:"commentEntry",usePreview:"newTipUsePreviewImage_reply",imageUrl:"newTipExternalImageUrl_reply",onImageRemoved:function(C){$$("message"+A.entry+" img").each(Element.destroy)
}});
this.editor=$(new InlineEditor({id:B,userAvatar:this.options.user.avatar,userName:this.options.user.name,action:"wall/write",editor:'<img src="{userAvatar}" class="toolTip" title="{userName}" alt="{userName}"/><div class="commentBubble"><div class="comment"><textarea class="input_txt" id="reply.message" name="message" rows="2">{message}</textarea><a class="action small addImage" rel="addImage"><span>'+MooTools.lang.get("Wall","addImage")+'</span></a><a class="action small addUrl" rel="addLink"><span>'+MooTools.lang.get("Wall","addLink")+'</span></a><a class="action button say_button" rel="comment"><span>'+MooTools.lang.get("Wall","say")+'</span></a></div><div class="bottom"/></div><input type="hidden" name="usePreviewImage" id="newTipUsePreviewImage_reply" value="false"/><input type="hidden" name="externalImageUrl" id="newTipExternalImageUrl_reply" value=""/><input type="hidden" name="url" id="replyUrl"/>',onAddImage:this.replyImager.onAddImage.bind(this.replyImager),onAddLink:this.onLink.bind(this),onComment:this.doReply.bind(this)}));
this.editor.inject($("commentEditor"+B),"bottom");
$("commentEditor"+B).focus()
},doReply:function(A){var B=$merge(this.replyEntry,{message:$("reply.message").value,url:$("replyUrl").value,usePreviewImage:$("newTipUsePreviewImage_reply").value,externalImageUrl:$("newTipExternalImageUrl_reply").value});
new Request.HTML({url:ts.baseUrl+"wall/write",update:"entry"+this.replyEntry.parent,onSuccess:this.update.pass(["entry"+this.replyEntry.parent],this)}).post(B);
if(this.editor){this.editor.destroy()
}return false
},onEditEntry:function(A){Dialog.textEditor(A,{onUpdate:this.doEdit.bind(this),title:"Text edit",field:"message",message:"Edit your text here:",value:$("textContents"+A.entry).toEditorString()})
},doEdit:function(A){new Request.HTML({url:ts.baseUrl+"wall/edit"}).post(A);
$("textContents"+A.entry).set("html",A.message.formatEditorString())
},onLink:function(){Dialog.inputEditor({},{onAccept:this.doLink.bind(this),field:"url_link",title:MooTools.lang.get("Wall","addLinkDialogTitle"),message:MooTools.lang.get("Wall","addLinkDialogMessage"),value:"http://"})
},onLinkRemove:function(){($("replyUrl")||$("newTipUrl")).value="";
$("addLink").removeClass("added")
},doLink:function(B){var A=$$("input[name=url_link]")[$$("input[name=url_link]").length-1].value;
if(A=="http://"){A=""
}if($("replyUrl")||$("newTipUrl")){($("replyUrl")||$("newTipUrl")).value=A
}else{$(this.wallOptions.linkFieldId).value=A
}if($("addLink")){$("addLink").addClass("added")
}},onDelete:function(A){Dialog.confirm(A,{onConfirm:this.doDelete.bind(this),message:MooTools.lang.get("Wall","removeConfirmationDialogMessage")})
},doDelete:function(B){var C=B.entry;
B["wall."+this.options.wall.kind]=this.options.wall.id;
new Request.HTML({url:ts.baseUrl+"wall/delete"}).post(B);
var A=new Fx.Tween("entry"+C,{transition:Fx.Transition.EaseInOut,onComplete:function(){$("entry"+C).destroy();
window.fireEvent("wallDelete",C);
if(this.countFilter){this.countFilter(true)
}}.bind(this)});
A.start("opacity",0)
},onShowFollowUps:function(A){$("toggle"+A.entry).hide();
$("hiddenFollowUps"+A.entry).show()
},onOrderWallPosts:function(H,E){$("orderMenu").hide();
$("orderFilter").set("text","Sorting ...");
$$("#orderMenu li a").each(function(J){if(J==E){J.addClass("selected")
}else{J.removeClass("selected")
}});
var G=$$("#messageboardContents div.tipItem");
var D=E.innerHTML;
var A;
var C=function(M,L){var K=M.getElement("input[name=_sortBelongsToPrimaryDest]").value;
var J=L.getElement("input[name=_sortBelongsToPrimaryDest]").value;
if(K!=J){return(K=="1"?-1:1)
}else{return 0
}};
var B=function(K,J,L){if(K==null&&J==null){return 0
}if(K==null&&J!=null){return 1
}if(K!=null&&J==null){return -1
}if(!L){return null
}return(K.value&&J.value)?(J.value-K.value):(J-K)
};
if(H.order=="time"){A=function(L,K){var J=C(L,K);
if(J!=0){return J
}return B(L.getElement("input[name=_sortTime]"),K.getElement("input[name=_sortTime]"),true)
}.bind(this)
}if(H.order=="thumbs"){A=function(L,K){var J=C(L,K);
if(J!=0){return J
}return B(L.getElement("input[name=_sortThumbs]"),K.getElement("input[name=_sortThumbs]"),true)
}.bind(this)
}if(H.order=="taste"){A=function(L,K){var J=C(L,K);
if(J!=0){return J
}J=B(L.getElement("span.matchvalue"),K.getElement("span.matchvalue"));
if(J!=null){return J
}var M="[^0-9]*([0-9]+)[^0-9]*";
return B(L.get("text").match(new RegExp(M))[1],K.get("text").match(new RegExp(M))[1],true)
}.bind(this)
}G.sort(A);
var I=false;
var F=false;
$$("#messageboardContents div.tipItem").dispose();
$each(G,function(K){var J=K.getElement("input[name=_sortBelongsToPrimaryDest]");
if(J!=null){if(J.value=="1"&&!I){var L=$$("h2.primaryDestTitle");
if(L[0]){$$("h2.primaryDestTitle").dispose();
L[0].inject($("messageboardContents"));
I=true
}}if(J.value=="0"&&!F){var L=$$("h2.nearbyDestTitle");
if(L[0]){$$("h2.nearbyDestTitle").dispose();
L[0].inject($("messageboardContents"));
F=true
}}}K.inject($("messageboardContents"))
}.bind(this));
$("orderFilter").set("text",D)
},onShowHiddenEntries:function(A){$$("a.hiddenTipItem").dispose();
$each($$("div.hiddenTipItem"),function(D){var C=D.getParent();
var B=D.getChildren();
$each(B,function(){B.inject(C,"bottom")
});
D.dispose()
})
}});
function tsMapControl(A){this.showSlider=A||false;
this.slide=null;
this.knob=null;
this.map=null;
this.minZoom=0;
this.maxZoom=17;
this.railHeight=116
}function tsCrossHair(A){this.map=A;
this.width=76;
this.height=77
}function dInfo(A){this.marker=A;
this.className="dynamic"+((" "+A.bubbleType)||"");
this.d=null
}var mapControlReady=false;
function getTsMapControl(A){if(!mapControlReady){initTsMapControl();
mapControlReady=true
}return new tsMapControl(A)
}var initTsMapControl=function(){tsCrossHair.prototype=new google.maps.Control();
tsCrossHair.prototype.initialize=function(map){var img=new Image();
img.src=ts.baseUrl+"gfx/map/icons/add_crosshair.png";
img.className="mapCrossHair";
map.getContainer().appendChild(img);
return img
};
tsCrossHair.prototype.printable=function(){return true
};
tsCrossHair.prototype.selectable=function(){return false
};
tsCrossHair.prototype.getDefaultPosition=function(){return new google.maps.ControlPosition(G_ANCHOR_TOP_LEFT,new google.maps.Size(this["map"].getSize()["width"]/2-38,this["map"].getSize()["height"]/2-38))
};
tsMapControl.prototype=new google.maps.Control();
tsMapControl.prototype.onDrag=function(){var y=this.knob.style.top;
var pos=eval(y.substring(0,y.length-2));
var level=Math.round((this.maxZoom-this.minZoom)*(1-pos/this.railHeight))+this.minZoom;
this.map.setZoom(level);
this.setSlider()
};
tsMapControl.prototype.setSlider=function(){var y=Math.round(this.railHeight*(1-(this.map.getZoom()-this.minZoom)/(this.maxZoom-this.minZoom)));
this.knob.style.top=y+"px"
};
tsMapControl.prototype.initialize=function(map){this.map=map;
var img=new Image();
img.src=ts.baseUrl+"gfx/map/"+(this.showSlider?"large":"small")+"_control.png";
var d=document.createElement("div");
d.className="mapControl"+(this.showSlider?" largeControl":"");
var dUp=document.createElement("div");
dUp.className="dUp";
d.appendChild(dUp);
google.maps.Event.addDomListener(dUp,"click",function(){this.panBy(new GSize(0,150))
}.bind(map));
var dDown=document.createElement("div");
dDown.className="dDown";
d.appendChild(dDown);
google.maps.Event.addDomListener(dDown,"click",function(){map.panBy(new GSize(0,-150))
});
var dLeft=document.createElement("div");
dLeft.className="dLeft";
d.appendChild(dLeft);
google.maps.Event.addDomListener(dLeft,"click",function(){map.panBy(new GSize(150,0))
});
var dRight=document.createElement("div");
dRight.className="dRight";
d.appendChild(dRight);
google.maps.Event.addDomListener(dRight,"click",function(){map.panBy(new GSize(-150,0))
});
var dIn=document.createElement("div");
dIn.className="dIn";
d.appendChild(dIn);
google.maps.Event.addDomListener(dIn,"click",function(){map.zoomIn()
});
var dOut=document.createElement("div");
dOut.className="dOut";
d.appendChild(dOut);
google.maps.Event.addDomListener(dOut,"click",function(){map.zoomOut()
});
d.appendChild(img);
map.getContainer().appendChild(d);
if(this.showSlider){var rail=document.createElement("div");
this.knob=document.createElement("div");
rail.className="ds";
this.knob.className="knob";
this.slide=new google.maps.DraggableObject(this.knob,{container:rail});
rail.appendChild(this.knob);
d.appendChild(rail);
this.setSlider(map.getZoom());
google.maps.Event.addListener(this.slide,"dragend",this.onDrag.bind(this));
google.maps.Event.addListener(this.map,"zoomend",this.setSlider.bind(this))
}return d
};
tsMapControl.prototype.printable=function(){return true
};
tsMapControl.prototype.selectable=function(){return false
};
tsMapControl.prototype.getDefaultPosition=function(){return new google.maps.ControlPosition(G_ANCHOR_TOP_LEFT,new GSize(10,10))
};
dInfo.prototype=new google.maps.Overlay();
dInfo.prototype.initialize=function(map){this.map=map;
var p=map.fromLatLngToDivPixel(this.marker.getLatLng());
var s=map.getSize();
var i=this.marker.getIcon();
var h=i.iconSize.height;
var w=0;
if(i.bubbleAnchor){h=h-i.bubbleAnchor.y;
w=i.bubbleAnchor.x
}this.d=document.createElement("div");
this.d.className=this.className;
if(this.marker.selected){var l=document.createElement("label");
l.innerHTML="selected";
this.d.appendChild(l)
}var d2=document.createElement("div");
var d3=document.createElement("div");
d2.innerHTML=this.marker.i?('<span class="i">'+this.marker.i+".</span>"):"";
d2.innerHTML+=this.marker.title?("<b>"+this.marker.title+"</b> "):"";
d2.innerHTML+=this.marker.text||"";
d2.innerHTML+=this.marker.distance?" "+this.marker.distance+"km":"";
d3.className="bottom";
if(this.marker.hotel){var book=new Element("a",{events:{click:function(){var hb=new HotelBooking();
hb.onBookHotel({type:"map",destinationId:this.marker.destinationId,hotelUrl:this.marker.hotelLink})
}.bind(this)}});
book.innerHTML=MooTools.lang.get("dInfo","book");
book.title=MooTools.lang.get("dInfo","bookTitle");
var stars=document.createElement("span");
stars.style.width=(15*this.marker.stars)+"px";
d3.appendChild(book);
d3.appendChild(stars);
d3.className="hotelBottom"
}this.d.appendChild(d2);
this.d.appendChild(d3);
map.getPane(G_MAP_FLOAT_PANE).appendChild(this.d);
var off=this.d.offsetHeight;
this.d.style.left=(p.x-75+w)+"px";
this.d.style.top=(p.y-off-h)+"px";
google.maps.Event.addListener(map,"zoomend",function(){var p=this.map.fromLatLngToDivPixel(this.marker.getLatLng());
var i=this.marker.getIcon();
var h=i.iconSize.height;
var w=0;
if(i.bubbleAnchor){h=h-i.bubbleAnchor.y;
w=i.bubbleAnchor.x
}this.d.style.left=(p.x-75+w)+"px";
this.d.style.top=(p.y-off-h)+"px"
}.bind(this))
};
dInfo.prototype.remove=function(){this.d.parentNode.removeChild(this.d)
};
dInfo.prototype.redraw=function(force){}
};
MooTools.lang.set("en-US","Generic",{reloadTitle:"Please wait",reloadMessage:"Reloading page..."});
MooTools.lang.set("en-US","DestinationTypes",{airport:"Airport",bar:"Bar",beach:"Beach",city:"City",eat:"Eat",hotel:"Hotel",landmark:"Landmark",locality:"Locality",mountain:"Mountain",party:"Party",restaurant:"Restaurant",shopping:"Shopping",sight:"Sight",village:"Village",waterbody:"Waterbody"});
MooTools.lang.set("en-US","DialogButtons",{ok:"OK",cancel:"Cancel"});
MooTools.lang.set("en-US","DestinationFilmStrip",{loading:"Loading..."});
MooTools.lang.set("en-US","DestinationTipBox",{write:"Click here to share your tip about {destinationName}.",ask:"Click here to ask a question about {destinationName} from other TripSay users.",advertisementPrefix:"Register to TripSay to get recommendations, to share your travel expertise and to ask tips from fellow travellers.",advertisementLink:"Join now",advertisementSuffix:", it's quick and easy!"});
MooTools.lang.set("en-US","Dialogs",{defaultTitle:"Are you sure?",defaultMessage:"Dialog Content"});
MooTools.lang.set("en-US","GroupActions",{createTitle:"Create a new Travel Group!",createHelp:"<p><b>What's your passion regarding travel?</b> Create a group with others sharing that passion! TripSay groups are made up of people who share common interests or activities.<br/><br/>Build your traveler network using groups. You can share tips and places with your network and as the result you'll get their recommendations for your next trip!</p>",createError:"There already exists a group with the name <b></b>. Please enter a different name for your group.",createFieldsTitle:"And what should we call the group?",createFieldsDescription:"Give a short description about the group:",errorTitle:"Sorry, but...",errorMessage:"In order to create a group you must give a group a name and a description.",addPlaceOvertext:"Add a place to this group"});
MooTools.lang.set("en-US","Guru",{answerHelp:'Write your reply below and click "Say!"',stopAllGuruTitle:"No longer interested?",stopAllGuruMessage:"Do you wish to stop helping in ALL your destinations and stop receiving any questions via email?"});
MooTools.lang.set("en-US","Images",{loading:"Loading image, please wait...",removeQuestion:"Are you sure you to want to remove the image completely?",uploadDialogTitle:"Upload your image!",licenseError:"Sorry, but you must agree to the license"});
MooTools.lang.set("en-US","InlineEditor",{editorButtonsSave:"Save",editorButtonsOr:"or",editorButtonsCancel:"Cancel"});
MooTools.lang.set("en-US","PlacesMap",{recommendedByTripSay:" recommended to you by TripSay community",recommendedByUser:" recommended to you by",because:"because",loved:"which you <b>loved</b>",hated:"which you <b>hated</b>",visited:"which you have visited",wished:"which you wish to visit",userSaidAboutDestination:"said about",addPlaceHereTitle:"Add a new place?",addPlaceHereMessage:"Don't we have the place you're looking for? Do you want to add a new place to our service for you and others to use?",isLocatedHere:" is located here",notRecommended:" is not specifically recommended to you"});
MooTools.lang.set("en-US","ProfileActions",{scheduleTitle:"Schedule a Trip",scheduleHelp:"Let others know where and when are you going by scheduling a trip!",where:"Where are you going to?",when:"When are you going to be there?",scheduleErrorTitle:"Sorry, but...",scheduleErrorMessage:"In order to schedule a trip you need to give both the destination and a date for your trip.",userSaidAboutDestination:"said about"});
MooTools.lang.set("en-US","ProfileMap",{loved:"loved",best:"the most",hated:"hated",visited:"visited",scheduled:"scheduled a trip to<br/>",wished:"wishes to go to<br/>"});
MooTools.lang.set("en-US","TitleTags",{addTitle:"Add a new tag",addMessage:"Tag name:",detailsTitle:"Tag details",detailsLoading:"Loading tag details..."});
MooTools.lang.set("en-US","TravelStoryList",{createTitle:"Create a new Travel Story!",createHelp:"This is your chance to boast with your travel experiences and share your stories about wonderful places around the world!",createHelpError:"Please will both fields",createDestinationField:"Tell us where you were!",createNameField:"And what should we call the trip?",createErrorTitle:"Sorry, but...",createErrorMessage:"In order to create a travel story you need to give both the starting destination and a name for your trip.",deleteTitle:"Really delete this travel story?",deleteMessage:"Are you sure you want to delete this travel story? <br/><br/>ALL texts, images and waypoints related to this story will be removed!"});
MooTools.lang.set("en-US","TravelStoryMap",{addPlaceOvertext:"Add a place to this story"});
MooTools.lang.set("en-US","UserSettings",{dupeError:"Please enter a login name that's not in use!",loginnameTooShortError:"Please enter a longer username",oldPasswordError:"If you wish to change your password,\nplease enter your old password for security.",passwordMismatchError:"Please check the passwords - they do not match.",bothNamesRequiredError:"First and last names are required.",emailRequired:"Please enter your email.",homeRequired:"Please enter your home location."});
MooTools.lang.set("en-US","Wall",{addImage:"Add image",addLink:"Add link",voted:"Voted",say:"Say!",overtext:"Have your say!",thanksTip:"Thank you for your tip!",thanksQuestion:"'Thanks! Your question was saved and will be sent to potential helpers. You'll get mail when someone answers. Answers will also be displayed on this page, too.",addLinkDialogTitle:"Add a link to your message",addLinkDialogMessage:"Enter the address of the web site which you want to link to your message:",removeConfirmationDialogMessage:"Are you sure you to want to remove this item completely?",noMessageError:"Please write your own text before clicking OK.",tooShortMessageError:"Please make your message a bit longer."});
MooTools.lang.set("en-US","AddPlace",{defaultTitle:"Add a new place to TripSay",noNameAlert:"Please enter the name of the place",addressAlert:"Please either enter the address or\nclick \"Don' know\" if you don't know the address.",mapTitle:"Show us where <b>{destinationName}</b> is",thanksTitle:"Destination added!",thanks:"Thank you very much! We are thrilled to have <b>{destinationName}</b> in our service! Now that {destinationName} has been added, you can",crosshairClickTitle:"Drag the map",crosshairClickMessage:"Drag the map, not the crossair."});
MooTools.lang.set("en-US","EditPlace",{defaultTitle:"Edit place",defaultMessage:"Pan and zoom the map to adjust the location",suggestJoinTitle:"Join TripSay",suggestJoinMessage:"Register to TripSay to get recommendations, to share your travel expertise and to ask tips from fellow travellers."});
MooTools.lang.set("en-US","dInfo",{from:"From",book:"&nbsp;Book",bookTitle:"Check availability and book"});
MooTools.lang.setLanguage("en-US");