(function(){var K=YAHOO.util.Dom,Q=YAHOO.util.Event,L=YAHOO.widget.Tab,S=document;var T="element";var O=function(A,B){B=B||{};if(arguments.length==1&&!YAHOO.lang.isString(A)&&!A.nodeName){B=A;A=B.element||null}if(!A&&!B.element){A=P.call(this,B)}O.superclass.constructor.call(this,A,B)};YAHOO.extend(O,YAHOO.util.Element,{CLASSNAME:"yui-navset",TAB_PARENT_CLASSNAME:"yui-nav",CONTENT_PARENT_CLASSNAME:"yui-content",_tabParent:null,_contentParent:null,addTab:function(H,F){var E=this.get("tabs");if(!E){this._queue[this._queue.length]=["addTab",arguments];return false}F=(F===undefined)?E.length:F;var C=this.getTab(F);var A=this;var I=this.get(T);var B=this._tabParent;var D=this._contentParent;var V=H.get(T);var J=H.get("contentEl");if(C){B.insertBefore(V,C.get(T))}else{B.appendChild(V)}if(J&&!K.isAncestor(D,J)){D.appendChild(J)}if(!H.get("active")){H.set("contentVisible",false,true)}else{this.set("activeTab",H,true)}var G=function(U){YAHOO.util.Event.preventDefault(U);var X=false;if(this==A.get("activeTab")){X=true}A.set("activeTab",this,X)};H.addListener(H.get("activationEvent"),G);H.addListener("activationEventChange",function(U){if(U.prevValue!=U.newValue){H.removeListener(U.prevValue,G);H.addListener(U.newValue,G)}});E.splice(F,0,H)},DOMEventHandler:function(D){var I=this.get(T);var C=YAHOO.util.Event.getTarget(D);var A=this._tabParent;if(K.isAncestor(A,C)){var H;var G=null;var J;var B=this.get("tabs");for(var F=0,E=B.length;F<E;F++){H=B[F].get(T);J=B[F].get("contentEl");if(C==H||K.isAncestor(H,C)){G=B[F];break}}if(G){G.fireEvent(D.type,D)}}},getTab:function(A){return this.get("tabs")[A]},getTabIndex:function(C){var A=null;var D=this.get("tabs");for(var E=0,B=D.length;E<B;++E){if(C==D[E]){A=E;break}}return A},removeTab:function(C){var D=this.get("tabs").length;var A=this.getTabIndex(C);var B=A+1;if(C==this.get("activeTab")){if(D>1){if(A+1==D){this.set("activeIndex",A-1)}else{this.set("activeIndex",A+1)}}}this._tabParent.removeChild(C.get(T));this._contentParent.removeChild(C.get("contentEl"));this._configs.tabs.value.splice(A,1)},toString:function(){var A=this.get("id")||this.get("tagName");return"TabView "+A},contentTransition:function(A,B){A.set("contentVisible",true);B.set("contentVisible",false)},initAttributes:function(B){O.superclass.initAttributes.call(this,B);if(!B.orientation){B.orientation="top"}var C=this.get(T);if(!K.hasClass(C,this.CLASSNAME)){K.addClass(C,this.CLASSNAME)}this.setAttributeConfig("tabs",{value:[],readOnly:true});this._tabParent=this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,"ul")[0]||R.call(this);this._contentParent=this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,"div")[0]||M.call(this);this.setAttributeConfig("orientation",{value:B.orientation,method:function(E){var D=this.get("orientation");this.addClass("yui-navset-"+E);if(D!=E){this.removeClass("yui-navset-"+D)}switch(E){case"bottom":this.appendChild(this._tabParent);break}}});this.setAttributeConfig("activeIndex",{value:B.activeIndex,method:function(D){},validator:function(D){return !this.getTab(D).get("disabled")}});this.setAttributeConfig("activeTab",{value:B.activeTab,method:function(D){var E=this.get("activeTab");if(D){D.set("active",true)}if(E&&E!=D){E.set("active",false)}if(E&&D!=E){this.contentTransition(D,E)}else{if(D){D.set("contentVisible",true)}}},validator:function(D){return !D.get("disabled")}});this.on("activeTabChange",this._handleActiveTabChange);this.on("activeIndexChange",this._handleActiveIndexChange);if(this._tabParent){N.call(this)}this.DOM_EVENTS.submit=false;this.DOM_EVENTS.focus=false;this.DOM_EVENTS.blur=false;for(var A in this.DOM_EVENTS){if(YAHOO.lang.hasOwnProperty(this.DOM_EVENTS,A)){this.addListener.call(this,A,this.DOMEventHandler)}}},_handleActiveTabChange:function(C){var B=this.get("activeIndex"),A=this.getTabIndex(C.newValue);if(B!==A){if(!(this.set("activeIndex",A))){this.set("activeTab",C.prevValue)}}},_handleActiveIndexChange:function(A){if(A.newValue!==this.getTabIndex(this.get("activeTab"))){if(!(this.set("activeTab",this.getTab(A.newValue)))){this.set("activeIndex",A.prevValue)}}}});var N=function(){var C,H,D;var E=this.get(T);var F=K.getChildren(this._tabParent);var A=K.getChildren(this._contentParent);for(var G=0,B=F.length;G<B;++G){H={};if(A[G]){H.contentEl=A[G]}C=new YAHOO.widget.Tab(F[G],H);this.addTab(C);if(C.hasClass(C.ACTIVE_CLASSNAME)){this._configs.activeTab.value=C;this._configs.activeIndex.value=this.getTabIndex(C)}}};var P=function(B){var A=S.createElement("div");if(this.CLASSNAME){A.className=this.CLASSNAME}return A};var R=function(B){var A=S.createElement("ul");if(this.TAB_PARENT_CLASSNAME){A.className=this.TAB_PARENT_CLASSNAME}this.get(T).appendChild(A);return A};var M=function(B){var A=S.createElement("div");if(this.CONTENT_PARENT_CLASSNAME){A.className=this.CONTENT_PARENT_CLASSNAME}this.get(T).appendChild(A);return A};YAHOO.widget.TabView=O})();(function(){var m=YAHOO.util.Dom,U=YAHOO.util.Event,k=YAHOO.lang;var j="contentEl",X="labelEl",h="content",b="element",l="cacheData",d="dataSrc",e="dataLoaded",i="dataTimeout",f="loadMethod",c="postData",Y="disabled";var g=function(A,B){B=B||{};if(arguments.length==1&&!k.isString(A)&&!A.nodeName){B=A;A=B.element}if(!A&&!B.element){A=a.call(this,B)}this.loadHandler={success:function(C){this.set(h,C.responseText)},failure:function(C){}};g.superclass.constructor.call(this,A,B);this.DOM_EVENTS={}};YAHOO.extend(g,YAHOO.util.Element,{LABEL_TAGNAME:"em",ACTIVE_CLASSNAME:"selected",HIDDEN_CLASSNAME:"yui-hidden",ACTIVE_TITLE:"active",DISABLED_CLASSNAME:Y,LOADING_CLASSNAME:"loading",dataConnection:null,loadHandler:null,_loading:false,toString:function(){var B=this.get(b);var A=B.id||B.tagName;return"Tab "+A},initAttributes:function(C){C=C||{};g.superclass.initAttributes.call(this,C);var A=this.get(b);this.setAttributeConfig("activationEvent",{value:C.activationEvent||"click"});this.setAttributeConfig(X,{value:C.labelEl||Z.call(this),method:function(E){var D=this.get(X);if(D){if(D==E){return false}this.replaceChild(E,D)}else{if(A.firstChild){this.insertBefore(E,A.firstChild)}else{this.appendChild(E)}}}});this.setAttributeConfig("label",{value:C.label||n.call(this),method:function(D){var E=this.get(X);if(!E){this.set(X,V.call(this))}W.call(this,D)}});this.setAttributeConfig(j,{value:C.contentEl||document.createElement("div"),method:function(E){var D=this.get(j);if(D){if(D==E){return false}this.replaceChild(E,D)}}});this.setAttributeConfig(h,{value:C.content,method:function(D){this.get(j).innerHTML=D}});var B=false;this.setAttributeConfig(d,{value:C.dataSrc});this.setAttributeConfig(l,{value:C.cacheData||false,validator:k.isBoolean});this.setAttributeConfig(f,{value:C.loadMethod||"GET",validator:k.isString});this.setAttributeConfig(e,{value:false,validator:k.isBoolean,writeOnce:true});this.setAttributeConfig(i,{value:C.dataTimeout||null,validator:k.isNumber});this.setAttributeConfig(c,{value:C.postData||null});this.setAttributeConfig("active",{value:C.active||this.hasClass(this.ACTIVE_CLASSNAME),method:function(D){if(D===true){this.addClass(this.ACTIVE_CLASSNAME);this.set("title",this.ACTIVE_TITLE)}else{this.removeClass(this.ACTIVE_CLASSNAME);this.set("title","")}},validator:function(D){return k.isBoolean(D)&&!this.get(Y)}});this.setAttributeConfig(Y,{value:C.disabled||this.hasClass(this.DISABLED_CLASSNAME),method:function(D){if(D===true){m.addClass(this.get(b),this.DISABLED_CLASSNAME)}else{m.removeClass(this.get(b),this.DISABLED_CLASSNAME)}},validator:k.isBoolean});this.setAttributeConfig("href",{value:C.href||this.getElementsByTagName("a")[0].getAttribute("href",2)||"#",method:function(D){this.getElementsByTagName("a")[0].href=D},validator:k.isString});this.setAttributeConfig("contentVisible",{value:C.contentVisible,method:function(D){if(D){m.removeClass(this.get(j),this.HIDDEN_CLASSNAME);if(this.get(d)){if(!this._loading&&!(this.get(e)&&this.get(l))){this._dataConnect()}}}else{m.addClass(this.get(j),this.HIDDEN_CLASSNAME)}},validator:k.isBoolean})},_dataConnect:function(){if(!YAHOO.util.Connect){return false
}m.addClass(this.get(j).parentNode,this.LOADING_CLASSNAME);this._loading=true;this.dataConnection=YAHOO.util.Connect.asyncRequest(this.get(f),this.get(d),{success:function(A){this.loadHandler.success.call(this,A);this.set(e,true);this.dataConnection=null;m.removeClass(this.get(j).parentNode,this.LOADING_CLASSNAME);this._loading=false},failure:function(A){this.loadHandler.failure.call(this,A);this.dataConnection=null;m.removeClass(this.get(j).parentNode,this.LOADING_CLASSNAME);this._loading=false},scope:this,timeout:this.get(i)},this.get(c))}});var a=function(C){var D=document.createElement("li");var B=document.createElement("a");B.href=C.href||"#";D.appendChild(B);var E=C.label||null;var A=C.labelEl||null;if(A){if(!E){E=n.call(this,A)}}else{A=V.call(this)}B.appendChild(A);return D};var Z=function(){return this.getElementsByTagName(this.LABEL_TAGNAME)[0]};var V=function(){var A=document.createElement(this.LABEL_TAGNAME);return A};var W=function(B){var A=this.get(X);A.innerHTML=B};var n=function(){var B,A=this.get(X);if(!A){return undefined}return A.innerHTML};YAHOO.widget.Tab=g})();YAHOO.register("tabview",YAHOO.widget.TabView,{version:"2.6.0",build:"1321"});YAHOO.util.History=(function(){var M=null;var P=null;var U=false;var L=[];var N=[];function R(){var B,A;A=top.location.href;B=A.indexOf("#");return B>=0?A.substr(B+1):null}function O(){var D,C,B=[],A=[];for(D in L){if(YAHOO.lang.hasOwnProperty(L,D)){C=L[D];B.push(D+"="+C.initialState);A.push(D+"="+C.currentState)}}P.value=B.join("&")+"|"+A.join("&");if(YAHOO.env.ua.webkit){P.value+="|"+N.join(",")}}function S(I){var D,C,H,F,E,A,B,G;if(!I){for(H in L){if(YAHOO.lang.hasOwnProperty(L,H)){F=L[H];F.currentState=F.initialState;F.onStateChange(unescape(F.currentState))}}return }E=[];A=I.split("&");for(D=0,C=A.length;D<C;D++){B=A[D].split("=");if(B.length===2){H=B[0];G=B[1];E[H]=G}}for(H in L){if(YAHOO.lang.hasOwnProperty(L,H)){F=L[H];G=E[H];if(!G||F.currentState!==G){F.currentState=G||F.initialState;F.onStateChange(unescape(F.currentState))}}}}function Q(B){var A,C;A='<html><body><div id="state">'+B+"</div></body></html>";try{C=M.contentWindow.document;C.open();C.write(A);C.close();return true}catch(D){return false}}function T(){var B,A,C,D;if(!M.contentWindow||!M.contentWindow.document){setTimeout(T,10);return }B=M.contentWindow.document;A=B.getElementById("state");C=A?A.innerText:null;D=R();setInterval(function(){var E,I,H,G,F,J;B=M.contentWindow.document;A=B.getElementById("state");E=A?A.innerText:null;F=R();if(E!==C){C=E;S(C);if(!C){I=[];for(H in L){if(YAHOO.lang.hasOwnProperty(L,H)){G=L[H];I.push(H+"="+G.initialState)}}F=I.join("&")}else{F=C}top.location.hash=F;D=F;O()}else{if(F!==D){D=F;Q(F)}}},50);U=true;YAHOO.util.History.onLoadEvent.fire()}function V(){var E,C,G,A,K,I,B,H,D,J,X,F;G=P.value.split("|");if(G.length>1){B=G[0].split("&");for(E=0,C=B.length;E<C;E++){A=B[E].split("=");if(A.length===2){K=A[0];H=A[1];I=L[K];if(I){I.initialState=H}}}D=G[1].split("&");for(E=0,C=D.length;E<C;E++){A=D[E].split("=");if(A.length>=2){K=A[0];J=A[1];I=L[K];if(I){I.currentState=J}}}}if(G.length>2){N=G[2].split(",")}if(YAHOO.env.ua.ie){T()}else{X=history.length;F=R();setInterval(function(){var W,b,a;b=R();a=history.length;if(b!==F){F=b;X=a;S(F);O()}else{if(a!==X&&YAHOO.env.ua.webkit){F=b;X=a;W=N[X-1];S(W);O()}}},50);U=true;YAHOO.util.History.onLoadEvent.fire()}}return{onLoadEvent:new YAHOO.util.CustomEvent("onLoad"),onReady:function(C,B,A){if(U){setTimeout(function(){var D=window;if(A){if(A===true){D=B}else{D=A}}C.call(D,"onLoad",[],B)},0)}else{YAHOO.util.History.onLoadEvent.subscribe(C,B,A)}},register:function(E,A,C,B,F){var D,G;if(typeof E!=="string"||YAHOO.lang.trim(E)===""||typeof A!=="string"||typeof C!=="function"){throw new Error("Missing or invalid argument")}if(L[E]){return }if(U){throw new Error("All modules must be registered before calling YAHOO.util.History.initialize")}E=escape(E);A=escape(A);D=null;if(F===true){D=B}else{D=F}G=function(H){return C.call(D,H,B)};L[E]={name:E,initialState:A,currentState:A,onStateChange:G}},initialize:function(A,B){if(U){return }if(YAHOO.env.ua.opera){}if(typeof A==="string"){A=document.getElementById(A)}if(!A||A.tagName.toUpperCase()!=="TEXTAREA"&&(A.tagName.toUpperCase()!=="INPUT"||A.type!=="hidden"&&A.type!=="text")){throw new Error("Missing or invalid argument")}P=A;if(YAHOO.env.ua.ie){if(typeof B==="string"){B=document.getElementById(B)}if(!B||B.tagName.toUpperCase()!=="IFRAME"){throw new Error("Missing or invalid argument")}M=B}YAHOO.util.Event.onDOMReady(V)},navigate:function(C,B){var A;if(typeof C!=="string"||typeof B!=="string"){throw new Error("Missing or invalid argument")}A={};A[C]=B;return YAHOO.util.History.multiNavigate(A)},multiNavigate:function(F){var A,E,C,D,B;if(typeof F!=="object"){throw new Error("Missing or invalid argument")}if(!U){throw new Error("The Browser History Manager is not initialized")}for(E in F){if(!L[E]){throw new Error("The following module has not been registered: "+E)}}A=[];for(E in L){if(YAHOO.lang.hasOwnProperty(L,E)){C=L[E];if(YAHOO.lang.hasOwnProperty(F,E)){D=F[unescape(E)]}else{D=unescape(C.currentState)}E=escape(E);D=escape(D);A.push(E+"="+D)}}B=A.join("&");if(YAHOO.env.ua.ie){return Q(B)}else{top.location.hash=B;if(YAHOO.env.ua.webkit){N[history.length]=B;O()}return true}},getCurrentState:function(A){var B;if(typeof A!=="string"){throw new Error("Missing or invalid argument")}if(!U){throw new Error("The Browser History Manager is not initialized")}B=L[A];if(!B){throw new Error("No such registered module: "+A)}return unescape(B.currentState)},getBookmarkedState:function(D){var E,H,A,B,G,C,F;if(typeof D!=="string"){throw new Error("Missing or invalid argument")}A=top.location.href.indexOf("#");B=A>=0?top.location.href.substr(A+1):top.location.href;G=B.split("&");for(E=0,H=G.length;E<H;E++){C=G[E].split("=");if(C.length===2){F=C[0];if(F===D){return unescape(C[1])}}}return null},getQueryStringParameter:function(D,G){var F,H,A,B,C,E;G=G||top.location.href;A=G.indexOf("?");B=A>=0?G.substr(A+1):G;A=B.lastIndexOf("#");B=A>=0?B.substr(0,A):B;C=B.split("&");for(F=0,H=C.length;F<H;F++){E=C[F].split("=");if(E.length>=2){if(E[0]===D){return unescape(E[1])}}}return null}}})();YAHOO.register("history",YAHOO.util.History,{version:"2.6.0",build:"1321"});var MAP_COLOR_DEFAULT="CCCCCC";var MAP_COLOR_VISITED="77BB00";var MAP_COLOR_INTERESTED="FFCC00";var SCALE_MAP=false;var myMap;var mapDataHandler;var visited=[];var interested=[];var myMapData=new Array();var regionSelector=null;var publicProfileView=null;var ignoreSort=false;function loadMap(D,C,E,A,B){window.mapDataHandler=A;window.editMode=D;window.editLink=B;this.publicProfileView=E;retrieveCountryList(C);if(D){regionSelector=new MapRegionSelector(document.mapForm.regionName,null,true)}else{if(this.publicProfileView){regionSelector=new MapRegionSelector(null,null,true)}}}function mapReadyHandler(){var B=YAHOO.util.Dom.get("flashMap");if(B.style.display=="none"){return }var D=YAHOO.util.Dom.get("mapLoading");YAHOO.util.Dom.setStyle(D,"display","");var C=YAHOO.util.Dom.getXY(B);C[0]+=B.offsetWidth/2-D.offsetWidth/2;C[1]+=B.offsetHeight/2-D.offsetHeight/2;YAHOO.util.Dom.setXY(D,C);var A="/ui/map/countries.gvd";myMap.init(A,myMapData,"","updateViewHandler");myMap.enableMouseover("mouseoverHandler","dddddd");if(window.editMode||window.editLink){myMap.enableSelection("selectHandler")}}function selectHandler(D){if(window.editLink){window.location="/MyProfile?event=profile#app=myCitiesTab";return }var A=MapRegionSelector.getIdUsingCode(D);var B=visited.indexOf(A);var C=interested.indexOf(A);if(regionSelector){regionSelector.setValue(D)}if(B>=0){setMapRegion(D,"interested")}else{if(C>=0){removeMapRegion(D)}else{setMapRegion(D,"visited")}}}function regionSorter(B,A){B=MapRegionSelector.getNameUsingId(B);A=MapRegionSelector.getNameUsingId(A);if(B<A){return -1}else{if(B>A){return 1}else{return 0}}}function renderMap(){myMapData.length=0;var E="",D="";for(var A=0;A<visited.length;A++){var B=MapRegionSelector.getCodeUsingId(visited[A]);
myMapData.push(new Array(B,MAP_COLOR_VISITED))}for(var A=0;A<interested.length;A++){var B=MapRegionSelector.getCodeUsingId(interested[A]);myMapData.push(new Array(B,MAP_COLOR_INTERESTED))}if(myMap){myMap.updateColors(myMapData)}else{myMap=new VectorMap("flashMap",MAP_COLOR_DEFAULT,SCALE_MAP);myMap.enableLabels()}if(regionSelector){if(!ignoreSort||publicProfileView){visited.sort(regionSorter);interested.sort(regionSorter);ignoreSort=true}for(var A=0;A<visited.length;A++){var C=MapRegionSelector.getNameUsingId(visited[A]);if(D.indexOf(C)<0){D+=", "+C}}for(var A=0;A<interested.length;A++){var C=MapRegionSelector.getNameUsingId(interested[A]);if(E.indexOf(C)<0){E+=", "+C}}if(E){E="<b>Interests:</b> "+E.substring(2)}if(D){D="<b>Visited:</b> "+D.substring(2)}new YAHOO.util.Element("interestedNames").set("innerHTML",E);new YAHOO.util.Element("visitedNames").set("innerHTML",D)}}function updateViewHandler(){YAHOO.util.Dom.setStyle("mapLoading","display","none");var C=YAHOO.util.Dom.get("legend");if(C){var B="";B+="<div class='pair'><div class='color-block' style='background-color:#"+MAP_COLOR_VISITED+"'></div>Visited</div>";B+="<div class='pair'><div class='color-block' style='background-color:#"+MAP_COLOR_INTERESTED+"'></div>Interested";C.innerHTML="<div id='legendHolder'>"+B+"</div>";YAHOO.util.Dom.setStyle(C,"display","");var A=YAHOO.util.Dom.get("flashMap");var D=YAHOO.util.Dom.getXY(A);D[0]+=0;D[1]+=A.offsetHeight-C.offsetHeight;YAHOO.util.Dom.setXY(C,D)}}function retrieveCountryList(A){var B="event=getCountryList";if(A){B+="&user="+A}YAHOO.util.Connect.asyncRequest("GET","/services/Profiles?"+B,{success:function(C){var D=getElementText("error",C.responseXML);if(D){handleMsg(D,"errorMsgMap")}else{visitedArray=JSON.parse(getElementText("visited",C.responseXML));interestedArray=JSON.parse(getElementText("interested",C.responseXML));for(var E=0;E<visitedArray.length;E++){visited.push(parseInt(visitedArray[E].id))}for(var E=0;E<interestedArray.length;E++){interested.push(parseInt(interestedArray[E].id))}renderMap();if(mapDataHandler){mapDataHandler(visited,interested)}}},failure:function(C){handleMsg("Sorry! An unexpected error happen please try again in a bit.","errorMsgMap")}})}function saveCountryList(){var A="event=saveCountryList&visited="+JSON.stringify(visited)+"&interested="+JSON.stringify(interested);YAHOO.util.Connect.asyncRequest("POST","/services/Profiles",{success:function(B){var C=getElementText("error",B.responseXML);if(C){displayErrorMsg(C)}else{displaySuccessMsg(false)}},failure:function(B){displayErrorMsg(error)}},A);pageChanged=false}function setMapRegion(E,D){if(!E){E=regionSelector.getValue()}if(!D){D=document.mapForm.type.selectedIndex;if(D==0){D="visited"}else{if(D==1){D="interested"}}}var A=MapRegionSelector.getIdUsingCode(E);var B=visited.indexOf(A);if(B>=0){visited.splice(B,1)}var C=interested.indexOf(A);if(C>=0){interested.splice(C,1)}if(D=="visited"){visited.push(A)}else{if(D=="interested"){interested.push(A)}}pageChanged=true;renderMap()}function removeMapRegion(C){if(!C){C=regionSelector.getValue()}var A=MapRegionSelector.getIdUsingCode(C);var B=visited.indexOf(A);if(B>=0){p=visited.splice(B,1)}var B=interested.indexOf(A);if(B>=0){interested.splice(B,1)}var D=new Array();D[0]=new Array(C,MAP_COLOR_DEFAULT);myMap.updateColors(D);pageChanged=true;renderMap()}function Photo(N,A,M,F,G,C,O,D,B,K,I,E,H,J,L){this.caption=N;this.smallPath=M;this.mediumPath=F;this.largePath=G;this.thumbnail=A;this.id=C;this.tags=O;this.locationName=D;this.width=B;this.height=K;this.blog=I;this.dateAdded=E;this.dateTaken=H;this.guideId=J;this.guideName=L}function Blog(B,C,A){this.blogId=B;this.blogName=C;this.entries=A}function BlogEntry(A,B){this.entryId=A;this.entryName=B}var photoSlideshow=null;var currentSlideshowPhotoIndex=0;var memberPhotos=[];var candidPhotos=[];function openSlideshow(B){if(!B){B=currentSlideshowPhotoIndex}YAHOO.util.Event.addListener(window,"resize",resizeCallback);var A=candidPhotos.length>0?candidPhotos:memberPhotos;photoSlideshow=new PhotoSlideshow("PhotoSlideshowBody",A,60,0);photoSlideshow.startSlide(B)}function resizeCallback(){if(!photoSlideshow.isOpen()){return }var A=candidPhotos.length>0?candidPhotos:memberPhotos;photoSlideshow=new PhotoSlideshow("PhotoSlideshowBody",A,60,0);photoSlideshow.startSlide(currentSlideshowPhotoIndex)}function setCurrentSlideshowPhotoIndex(A){currentSlideshowPhotoIndex=A}var itemIndex;var itemsPerPage=20;var itemsPerRow=5;var itemCount;var blogs=[];var guideIds=[];var guideNames=[];function PhotoFilter(){itemIndex=0}PhotoFilter.prototype.registerPagers=function(A,B){YAHOO.util.Event.addListener(A,"click",this.moveLastPage,this,true);YAHOO.util.Event.addListener(B,"click",this.moveNextPage,this,true)};PhotoFilter.prototype.moveLastPage=function(){itemIndex-=itemsPerPage;if(itemIndex<0){itemIndex=0}renderPhotos(itemIndex,itemCount)};PhotoFilter.prototype.moveNextPage=function(){itemIndex+=itemsPerPage;if(itemIndex>itemCount){itemIndex=Math.floor(itemCount/itemsPerPage)*itemsPerPage}renderPhotos(itemIndex,itemCount)};PhotoFilter.prototype.retrievePhotos=function(){var A=document.hiddenForm.user.value;var B="event=getUserPhotos&userId="+A+"&addBlogs=true&addGuides=true&addComments=true";YAHOO.util.Connect.asyncRequest("GET","/services/Photos?"+B,{success:function(E){var J=getElementText("error",E.responseXML);if(J){alert("error")}else{var M=JSON.parse(E.responseText);var L=M.photos;for(var G=0;G<L.length;G++){var C=L[G];var D=new Photo(C.caption,C.squareThumb,C.smallPath,C.mediumPath,C.largePath,C.id,null,C.location,parseInt(C.width),parseInt(C.height),new Blog(C.blogId,C.blogName),C.dateAdded,C.dateTaken,C.guideId,C.guideName);D.commentHtml=C.commentHtml;memberPhotos.push(D);if(C.guideId&&C.guideId!="0"&&C.guideId!=0&&C.guideName&&guideIds.indexOf(C.guideId)<0){guideIds.push(C.guideId+"");guideNames.push(C.guideName)}}var I=M.blogs;for(var G=0;G<I.length;G++){var K=I[G];var H=[];for(var F=0;F<K.entries.length;F++){H.push(new BlogEntry(K.entries[F].entryId,K.entries[F].entryName))}blogs.push(new Blog(K.blogId,K.blogName,H))}renderPhotoFilters();itemCount=memberPhotos.length;loadedPhotos=true;candidPhotos=memberPhotos;renderPhotos(0,itemCount)}},failure:function(C){reportAjaxFailure()}})};function renderPhotoFilters(){var B="<form name='slideFilters'><div class='left'>Show photos in&nbsp;</div>";B+="<div class='left'>";B+="<select name='picGuidesFilter' onchange='filterPicsByGuide(this)'>";B+="<option selected='selected' value='-1'>All countries</option>";for(var A=0;A<guideIds.length;A++){B+="<option value='"+guideIds[A]+"'>"+guideNames[A]+"</option>"}B+="</select>";B+="</div>";B+="<div class='left'>&nbsp;or&nbsp;</div>";B+="<div class='left'><select name='picBlogsFilter' onchange='filterPicsByBlog(this)'>";B+="<option selected='selected' value='-1'>All blogs</option>";for(var A=0;A<blogs.length;A++){B+="<option value='"+blogs[A].blogId+"'>"+blogs[A].blogName+"</option>"}B+="</select></div></form>";document.getElementById("blogFilter").innerHTML=B}function filterPicsByBlog(A){var C=A.options[A.selectedIndex].value;document.forms.slideFilters.picGuidesFilter.selectedIndex=0;if(C=="-1"){candidPhotos=memberPhotos;itemCount=memberPhotos.length;renderPhotos(0,itemCount);return }candidPhotos=[];for(var B=0;B<memberPhotos.length;B++){var D=memberPhotos[B].blog;if(D.blogId==C){candidPhotos.push(memberPhotos[B])}}itemCount=candidPhotos.length;renderPhotos(0,itemCount)}function displayBlogEntries(B){document.forms.slideFilters.picGuidesFilter.selectedIndex=0;var F=B.options[B.selectedIndex].value;if(F=="-1"){$("blogEntries").style.display="none";candidPhotos=memberPhotos;itemCount=memberPhotos.length;renderPhotos(0,itemCount)}else{var D="<select name='picBlogEntriesFilter' onchange='filterPicsByBlogEntry(this)'>";D+="<option value='"+F+"'>All entries</option>";var A=[];for(var C=0;C<memberPhotos.length;C++){var E=memberPhotos[C].blogEntry;if(A.indexOf(E.entryId)>=0){continue}A.push(E.entryId);D+="<option value='"+E.entryId+"'>"+E.entryName+"</option>"
}D+="</select>";$("blogEntries").innerHTML=D;$("blogEntries").style.display="";candidPhotos=getPhotosByBlogId(F);itemCount=candidPhotos.length;renderPhotos(0,itemCount)}}function filterPicsByBlogEntry(A){var C=A.options[A.selectedIndex].value;document.forms.slideFilters.picGuidesFilter.selectedIndex=0;if(A.selectedIndex==0){candidPhotos=getPhotosByBlogId(C);itemCount=candidPhotos.length;renderPhotos(0,itemCount)}candidPhotos=[];for(var B=0;B<memberPhotos.length;B++){if(memberPhotos[B].blogEntry.entryId+""==C){candidPhotos.push(memberPhotos[B])}}itemCount=candidPhotos.length;renderPhotos(0,itemCount)}function getPhotosByBlogId(F){var B=[];for(var E=0;E<blogs.length;E++){var G=blogs[E];if(G.blogId!=F){continue}var A=G.entries;for(var D=0;D<A.length;D++){for(var C=0;C<memberPhotos.length;C++){if(A[D].entryId==memberPhotos[C].blogEntry.entryId){B.push(memberPhotos[C])}}}}return B}function filterPicsByGuide(A){var C=A.options[A.selectedIndex].value;document.forms.slideFilters.picBlogsFilter.selectedIndex=0;if(C=="-1"){candidPhotos=memberPhotos;itemCount=memberPhotos.length;renderPhotos(0,itemCount);return }candidPhotos=[];for(var B=0;B<memberPhotos.length;B++){if(memberPhotos[B].guideId+""==C){candidPhotos.push(memberPhotos[B])}}itemCount=candidPhotos.length;renderPhotos(0,itemCount)}function renderPhotos(I,H){var F="";if(candidPhotos.length<1){document.getElementById("resultsControls").style.display="none";document.getElementById("memberPhotos").innerHTML="No photos available.";return }var B=Math.ceil(candidPhotos.length*1/itemsPerPage);var C=Math.ceil((I+0.0001)/itemsPerPage);if(B>1){var G=document.getElementById("resultsControls");G.childNodes[1].innerHTML="Page "+C+" of "+B;G.style.display=""}document.getElementById("albumSize").innerHTML=H;var D=Math.min(H,I+itemsPerPage);for(var E=I;E<D;E++){var A=candidPhotos[E];var J=A.caption||A.locationName;if(E%itemsPerRow==0&&E!=I){F+="<br class='clearboth'>"}F+="<div class='thumbnail'>";F+="<a class='fake-link' onclick='openSlideshow("+E+")'>";F+="<img src='"+A.thumbnail+"' alt='"+escapeQuote(J)+"' width='60' onmouseover='showCaption(this, this.alt)' onmouseout='hideCaption()'/></a>";F+="</div>"}document.getElementById("memberPhotos").innerHTML=F}function displayLargeImage(D){var A=document.getElementById("picsTab");var C=document.getElementById("largePhoto");var B="<div style='text-align:left; margin:5px' onclick='closeImage()'><a class='fake-link'>Close</a></div>";B+="<div><img src='"+D+"' /></div>";C.innerHTML=B;C.style.display="";var E=new Array(YAHOO.util.Dom.getX(A),YAHOO.util.Dom.getY(A)+15);YAHOO.util.Dom.setXY(C,E)}function closeImage(){document.getElementById("largePhoto").style.display="none"}function showCaption(B,A){A=decode(A).replace(/(\w{12})/g,"$1<BR>")||"No Caption";var D=document.getElementById("caption");D.innerHTML=A;D.style.display="";var C=new Array(YAHOO.util.Dom.getX(B)-15,YAHOO.util.Dom.getY(B)+50);YAHOO.util.Dom.setXY(D,C)}function hideCaption(){document.getElementById("caption").style.display="none"}var elem=null;var photos=[];var previousIndex;var maxThumbnails=9;var fixedHeight=0;var maxHeight=700;var maxWidth=500;var currentEndIndex=0;var currentStartIndex=0;var vpWidth;var infoGap=30;var overlayElem;PhotoSlideshow.prototype.open;function PhotoSlideshow(B,D,C,A){this.open=false;elem=document.getElementById(B);photos=D;previousIndex=-1;photoSlideshow=this;vpWidth=getViewportWidth();overlayElem=document.getElementById("PhotoSlideshowOverlay");YAHOO.util.Dom.setStyle(overlayElem,"width",(vpWidth-A)+"px");vpWidth-=C;YAHOO.util.Dom.setStyle(elem,"width",vpWidth+"px");fixedHeight=Math.min(maxHeight,getViewportHeight()-250)}PhotoSlideshow.prototype.startSlide=function(B){this.open=true;YAHOO.util.Dom.setStyle("contentArea","opacity",0.3);B=B>photos.length?0:B;if(previousIndex>=0){YAHOO.util.Dom.setStyle("photo"+previousIndex,"border","none")}previousIndex=B;var A=photos[B];var C="";C+="<div class='clear_fix' style='width:100%'>";C+="<div class='logo'><a class='fake-link' onclick='closePhotoSlideShow(); return false;'><img src='http://ui.geckogo.com/ui/media/geckogo-gray-logo-black-bg.gif'></a></div>";C+="<div class='right'><a href='#' onclick='closePhotoSlideShow(); return false;'><img src='http://ui.geckogo.com/ui/media/close-gallery.gif'></a><span style='padding-left:6px; position:relative; bottom:6px'><a href='#' onclick='closePhotoSlideShow(); return false;' style='color:#888888; text-decoration:none'>CLOSE</a></span></div>";C+="</div>";C+="<div style='width:100%; margin:0 auto; text-align:center'>";C+="<div id='slideMainInfo' class='clear_fix' style='height:"+(fixedHeight)+"px; width:"+(maxThumbnails*70+275)+"px'>"+renderSlideImageInfo(B)+"</div>";C+="<div class='thumb-row clear_fix' id='slideShowThumbnails' style='width:"+(maxThumbnails*70+180)+"px'>"+renderSlideThumbnails(B)+"</div>";C+="<div id='slideSocialInfo' class='clear_fix'>"+renderSlideSocialInfo(B)+"</div>";C+="</div>";elem.innerHTML=C;overlayElem.style.display="";YAHOO.util.Dom.setXY(overlayElem,new Array(0,0));elem.style.display="";YAHOO.util.Dom.setXY(elem,new Array(0,0));scrollToTop();if(B==0||photos.length<maxThumbnails){document.getElementById("photoSlideLeftArrow").style.display="none";document.getElementById("photoSlideLeftArrowEmpty").style.display=""}if(B>photos.length-maxThumbnails||photos.length<maxThumbnails){document.getElementById("photoSlideRightArrow").style.display="none";document.getElementById("photoSlideRightArrowEmpty").style.display=""}};function getCommentsHtml(D,C,A){var B="<a name='info"+D+"'></a><div class='info-box' id='success"+D+"' style='display:none'>Woot! Your comment was posted successfully</div>";B+="<div id='input"+D+"' class='comment-area'>";B+="<div class='comment-header'>Leave a comment</div>";B+="<div class='comment-body'><textarea id='commentText"+D+"'></textarea></div>";B+="<div class='comment-buttons'>";B+="<button type='button' onclick=\"addComment("+D+", '"+C+"', this, commentAdded)\">Send</button>";B+="</div></div>";if(!A){A=""}B+="<div id='commentArea'>"+A+"</div>";return B}function commentAdded(A){var B=photos[previousIndex];if(B.commentHtml){B.commentHtml+=A}else{B.commentHtml=A}}PhotoSlideshow.prototype.isOpen=function(){return this.open};function showSlidePhoto(A){if(A<currentStartIndex){shiftSlideLeft(A);return }else{if(A>=currentEndIndex){shiftSlideRight(A);return }}if(previousIndex>=0){YAHOO.util.Dom.setStyle("photo"+previousIndex,"border","none")}YAHOO.util.Dom.setStyle("photo"+A,"border","2px solid #FFFFFF");previousIndex=A;document.getElementById("slideMainInfo").innerHTML=renderSlideImageInfo(A);document.getElementById("slideSocialInfo").innerHTML=renderSlideSocialInfo(A)}function renderSlideThumbnails(B){var F=Math.min(photos.length,B+maxThumbnails);currentStartIndex=photos.length>maxThumbnails?B:0;currentEndIndex=F;var D="";D+="<div class='left-arrow' id='photoSlideLeftArrow'><a href='#' onclick='shiftSlideLeft("+Math.max(0,B-maxThumbnails)+"); return false;'><img src='http://ui.geckogo.com/ui/media/slide-small-left.gif'></a></div>";D+="<div class='left-arrow' id='photoSlideLeftArrowEmpty' style='display:none'>&nbsp;</div>";D+="<div class='thumbnail-content'><div class='clear_fix' style='width:100%; text-align:center; margin:0 auto'>";for(var C=currentStartIndex;C<F;C++){var A=B==C?"thumbnail-selected":"thumbnail";var E=photos[C];D+="<div class='"+A+"' id='photo"+C+"'>";D+="<a href='#' onclick='showSlidePhoto("+C+"); return false;'><img src='"+E.thumbnail+"' width='60' height='60'></a>";D+="</div>"}D+="</div></div>";D+="<div class='right-arrow' id='photoSlideRightArrowEmpty' style='display:none'>&nbsp;</div>";D+="<div class='right-arrow' id='photoSlideRightArrow'><a href='#' onclick='shiftSlideRight("+Math.min(photos.length,B+maxThumbnails)+"); return false;'><img src='http://ui.geckogo.com/ui/media/slide-small-right.gif'></a></div>";return D}function closePhotoSlideShow(){this.open=false;photoSlideshow.open=false;overlayElem.style.display="none";elem.style.display="none";YAHOO.util.Dom.setStyle("contentArea","opacity",1)}function shiftSlideLeft(A){previousIndex=A;
var B=renderSlideThumbnails(A);document.getElementById("slideShowThumbnails").innerHTML=B;if(A==0){document.getElementById("photoSlideLeftArrow").style.display="none";document.getElementById("photoSlideLeftArrowEmpty").style.display=""}document.getElementById("photoSlideRightArrow").style.display="";document.getElementById("photoSlideRightArrowEmpty").style.display="none";showSlidePhoto(A)}function shiftSlideRight(A){previousIndex=A;var B=renderSlideThumbnails(A);document.getElementById("slideShowThumbnails").innerHTML=B;document.getElementById("photoSlideLeftArrow").style.display="";document.getElementById("photoSlideLeftArrowEmpty").style.display="none";if(A>photos.length-maxThumbnails){document.getElementById("photoSlideRightArrow").style.display="none";document.getElementById("photoSlideRightArrowEmpty").style.display=""}showSlidePhoto(A)}function toggleSlideInfoBox(A){var B=A?"":"none";document.getElementById("slideInfoBox").style.display=B;if(A){var D=YAHOO.util.Dom.getXY("slideBigPhoto");var C=document.getElementById("bigImage").offsetWidth;D[0]+=(C/2)+124;D[1]+=(fixedHeight/2)-30;YAHOO.util.Dom.setXY("slideInfoBox",D)}}function displaySlideFullInfo(B){var A=photos[B];var C="";var D=A.caption?A.caption:"&nbsp;";C+="<div class='clear_fix' style='width:100%'>";C+="<div class='full-caption'>"+D+"</div>";C+="<div class='right'><a href='#' onclick='closeSlideFullInfo(); return false;'><img src='http://ui.geckogo.com/ui/media/close-gallery.gif'></a></div>";C+="</div>";if(A.locationName){C+="<div class='location'>"+A.locationName+"</div>"}if(A.dateAdded||A.dateTaken){C+="<div class='dates'>";if(A.dateTaken){C+="<div><span class='bold'>Date taken:</span> "+A.dateTaken+"</div>"}if(A.dateAdded){C+="<div><span class='bold'>Date added:</span> "+A.dateAdded+"</div>"}C+="</div>"}var E=YAHOO.util.Dom.getXY("bigImage");E[1]-=15;document.getElementById("slideFullInfo").innerHTML=C;document.getElementById("slideFullInfo").style.display="";YAHOO.util.Dom.setXY("slideFullInfo",E)}function closeSlideFullInfo(){document.getElementById("slideFullInfo").style.display="none"}function renderSlideSocialInfo(B){var A=photos[B];var C=getCommentsHtml(A.id,"media-comment",A.commentHtml);return C}function renderSlideImageInfo(F){var E="";var B=photos[F];setCurrentSlideshowPhotoIndex(F);var C=B.width,L=B.height;var I=null;var H=null;if(C>maxWidth&&L>fixedHeight){var K=Math.ceil(L/fixedHeight);I=fixedHeight;H=Math.floor(C/K);if(H>maxWidth){K=Math.ceil((C*1)/maxWidth);H=maxWidth;I=Math.floor((L*1)/K)}}else{if(L>fixedHeight){var J=Math.ceil((L*1)/fixedHeight);I=fixedHeight;H=Math.floor((C*1)/J)}else{if(C>maxWidth){var J=Math.ceil((C*1)/maxWidth);I=Math.floor((L*1)/J);H=maxWidth}else{H=C;I=L}}}if(!I){I=fixedHeight/2}var G="margin:"+((fixedHeight-I)/2)+"px 0px "+((fixedHeight-I)/2)+"px 0px";var A="width:"+maxWidth+"px; height:"+fixedHeight+"px; text-align:center";var M=B.caption?prepareText(B.caption,150):"&nbsp;";E+="<div style='width:100%'>"+M+"</div>";E+="<div class='big-img clear_fix' id='slideBigPhoto' style='width:100%'>";E+="<div id='slideInfoBox' style='display:none; position:absolute; z-index:95'><a href='#' onclick='displaySlideFullInfo("+F+"); return false;'><img src='http://ui.geckogo.com/ui/media/MoreInfoGalleryButton.png' onmouseover='this.parentNode.parentNode.style.display=\"\";'></a></div>";var D="padding-top:"+((fixedHeight/2)-100)+"px";if(F!=0){E+="<div style='"+D+"' class='left-large-arrow' id='photoSlideLargeLeftArrow'><a herf='#' onclick='showSlidePhoto("+(F-1)+"); return false;'><img style='cursor:pointer' src='http://ui.geckogo.com/ui/media/slide-large-left.gif'></a></div>"}else{E+="<div class='left-large-arrow'>&nbsp;</div>"}E+="<div class='left' style='"+A+"' id='bigImage'><img style='"+G+"' height='"+I+"' onmouseover='toggleSlideInfoBox(true)' onmouseout='toggleSlideInfoBox(false)' src='"+B.largePath+"'></div>";if(F!=photos.length-1){E+="<div style='"+D+"' class='right-large-arrow' id='photoSlideLargeRightArrow'><a herf='#' onclick='showSlidePhoto("+(F+1)+"); return false;'><img style='cursor:pointer' src='http://ui.geckogo.com/ui/media/slide-large-right.gif'></a></div>"}else{E+="<div class='right-large-arrow'>&nbsp;</div>"}E+="</div>";E+="<div class='full-info' id='slideFullInfo' style='display:none; width:"+(maxWidth-infoGap)+"px'></div>";return E}var rte;var loggedIn=false;SCALE_MAP=false;var profileTabs=new Array("statsTab","picsTab","tripsTab","my2CTab","myTipTab","myQuestionTab","lowdownTab","booksTab");var basicTabView;var bookmarkedSection=YAHOO.util.History.getBookmarkedState("app");var querySection=YAHOO.util.History.getQueryStringParameter("section");var initialSection=bookmarkedSection||querySection||"init";var loadedPhotos=false;var filter;YAHOO.util.History.register("app",initialSection,function(A){if((A=="lowdownTab"||A=="picsTab")&&!loggedIn){establishActiveUser(function(B){if(B=="cancel"){return }else{enableTab(A)}})}else{enableTab(A)}});YAHOO.util.History.onReady(function(){initializeNavigationBar()});function init(){filter=new PhotoFilter();var A=document.getElementById("resultsControls");filter.registerPagers(A.childNodes[0],A.childNodes[2]);basicTabView=new YAHOO.widget.TabView("publicProfileTabs");loggedIn=isLoggedIn();if(!$("booksTab")){$("booksTabLI").style.display="none"}}YAHOO.util.Event.onDOMReady(init);function enableTab(C){setSelectedTabClass(C);if(C=="statsTab"){var A=document.hiddenForm.user.value;loadMap(false,A,true)}else{if(C=="my2CTab"){}else{if(C=="myTipTab"){initTips()}else{if(C=="tripsTab"){initTrips()}else{if(C=="myQuestionTab"){initQuestions()}else{if(C=="lowdownTab"){if(!rte){var B=document.getElementById("rteArea");rte=new WYSIWYG_Editor("rte",B,"","http://ui.geckogo.com/ui/editor",380,60);rte.setModeToggle(hasUserPriv());rte.setAllowAnchors(hasUserPriv());rte.display()}rte.focus()}else{if(C=="picsTab"){if(!loadedPhotos){filter.retrievePhotos()}}else{if(C=="booksTab"){}}}}}}}}}function initTips(){var A=document.hiddenForm.user.value;initContrib(40,A,false)}function initQuestions(){var A=document.hiddenForm.user.value;initContrib(60,A,false)}function initTrips(){var A=document.hiddenForm.user.value;initContrib(70,A,false)}function setSelectedTabClass(E){for(var A=0;A<profileTabs.length;A++){var C=profileTabs[A];var B=(C==E)?"selected":"";var D=$(C);if(D){D.style.display=(C==E)?"":"none";new YAHOO.util.Element(profileTabs[A]+"LI").set("className",B)}}}function initializeNavigationBar(){var D=YAHOO.util.Dom.get("publicProfileTabArea").getElementsByTagName("a");for(var C=0,A=D.length;C<A;C++){var B=D[C];YAHOO.util.Event.addListener(B,"click",function(F){var G=this.getAttribute("href");var I=YAHOO.util.History.getQueryStringParameter("section",G);try{YAHOO.util.History.navigate("app",I)}catch(H){enableTab(E);setSelectedTabClass(E)}YAHOO.util.Event.stopEvent(F)})}var E=YAHOO.util.History.getCurrentState("app");if(E=="init"){E=($("booksTab"))?"booksTab":"statsTab"}if(!E){enableTab(profileTabs[0])}else{enableTab(E)}}function showStatsCities(){showHideArea("statsTabCities",true);showHideArea("statsTabCountries",false)}function showStatsCountries(){showHideArea("statsTabCities",false);showHideArea("statsTabCountries",true)}QueryFilter.SERVICE_NAME="/services/Search";if(window.WIDGET_MODE){QueryFilter.SERVICE_NAME+=".php"}QueryFilter.MAX_FILTER_ITEMS=5;var queryFilter;function preInit(){queryFilter=new QueryFilter(true);YAHOO.util.History.onReady(function(){queryFilter.loadStart()});var B=YAHOO.util.History.getBookmarkedState("app");var A=B||"init";YAHOO.util.History.register("app",A,queryFilter.navHandler,queryFilter,true)}function QueryFilter(){this.entityType=0;this.listingType=0;this.guideType=0;this.itemIndex=0;this.setItemsPerPage(5);this.hasFilterGroups=false;this.hasTags=false;this.loadStarted=false;this.started=false;this.showCategories=false;this.showTypes=false;this.busy=false;this.anchorGuide=null}QueryFilter.prototype.init=function(E,A,D,F){this.localMode=window.WIDGET_MODE||this!=queryFilter;this.renderFilterResults=E;this.searchStarted=A;this.filterArea=D;if(F.anchorGuide){this.anchorGuide=F.guide}if(F.guide){this.guide=F.guide
}var C="";for(var B in F){if(B=="showCategories"){this.showCategories=F[B]}else{if(B=="showTypes"){this.showTypes=F[B]}else{C+="&"+B+"="+F[B]}}}this.extractState(C)};QueryFilter.prototype.setSortMode=function(A){this.sortMode=A};QueryFilter.prototype.setItemsPerPage=function(A){this.itemsPerPage=A};QueryFilter.prototype.showLoading=function(A){this.renderLoading=A};QueryFilter.prototype.navHandler=function(B){this.whenFiltersChange();if(this.searchStarted){this.searchStarted()}this.extractState(B);url=B;var C="";if(url.match(/(.*?)\?(.*)/)){url=RegExp.$1;C=RegExp.$2}if(window.WIDGET_MODE){C+="&"+getSessionParams()}if(this.skipListing){C+="&skipListing="+this.skipListing}var A=this;YAHOO.util.Connect.asyncRequest("POST",url,{success:this.renderResults,failure:function(){},scope:A},C)};QueryFilter.prototype.doQuery=function(B){if(!this.started){this.started=true}if(B){this.lastGuides=null}this.busy=true;if(this.renderLoading){this.renderLoading()}var A=this.buildState(B);if(this.localMode){this.navHandler(A)}else{YAHOO.util.History.navigate("app",A)}};QueryFilter.prototype.start=function(){this.started=true;if(this.localMode){var A="";if(!A){A=this.buildState(true)}this.navHandler(A)}else{if(this.loadStarted){this.startNow()}}};QueryFilter.prototype.loadStart=function(){this.loadStarted=true;if(this.started){this.startNow()}};QueryFilter.prototype.startNow=function(){var A=YAHOO.util.History.getCurrentState("app");if(A=="init"){A=this.buildState(true)}this.navHandler(A)};QueryFilter.prototype.searchTerm="";QueryFilter.prototype.setSearchTerm=function(A){if(A){this.searchTerm=A+" "}};QueryFilter.prototype.getSearchTerm=function(){return this.searchTerm.replace(/ $/,"")};QueryFilter.prototype.renderFilterControls=function(){if(!this.filterArea){return }this.filterArea.onclick=function(A){if(this.busy){YAHOO.util.Event.stopEvent(A)}};this.hasFilterGroups=false;if(this.showTypes){this.initTypes()}if(this.entityType!=10&&this.listingType!=1){this.initGuides();this.initTags()}this.initSearch()};QueryFilter.prototype.newFilterArea=function(C,B){var A="fa"+B;var E=document.getElementById(A);if(E){D=E.childNodes[1];D.innerHTML=""}else{E=document.createElement("DIV");E.id=A;if(this.hasFilterGroups){E.className="filter-group"}else{E.className="filter-group filter-group-first";this.hasFilterGroups=true}if(this.lastGroup&&this.lastGroup.nextSibling){this.filterArea.insertBefore(E,this.lastGroup.nextSibling)}else{this.filterArea.appendChild(E)}var D=document.createElement("DIV");E.appendChild(D);D.innerHTML=C;D.className="filter-header";D=document.createElement("DIV");E.appendChild(D);D.className="filter-body"}this.lastGroup=E;return D};QueryFilter.prototype.initTags=function(){var A=getTagLabelByType(this.entityType,this.listingType);if(A){this.tagGroupElem=this.newFilterArea(A,"tags")}if(this.listingType==10){this.activityTagGroupElem=this.newFilterArea("Activities","activities")}if(A){this.hasTags=true}};QueryFilter.prototype.setRelatedTag=function(D,C,B){var A=(B)?this.activityTags:this.mainTags;A.push(new Tag(D,C));var E=this.buildState(true);YAHOO.util.History.setCurrentState("app",E)};QueryFilter.prototype.initGuides=function(){var A=document.getElementById("tocExploreMenu");if(A){A=A.firstChild.firstChild.firstChild.innerHTML}else{A=Locale.FILTER_DESTINATIONS}this.guideGroupElem=this.newFilterArea(A,"guides")};QueryFilter.prototype.initTypes=function(){this.typeElem=this.newFilterArea(Locale.FILTER_TYPE,"types");var A="";A+="<li><a href='javascript:selectType(10);'>Destinations</a></li>";A+="<li><a href='javascript:selectType(11,10);'>Attractions</a></li>";A+="<li><a href='javascript:selectType(11,14);'>Restaurants</a></li>";A+="<li><a href='javascript:selectType(11,15);'>Nightlife</a></li>";A+="<li><a href='javascript:selectType(11,13);'>Lodging</a></li>";A+="<li><a href='javascript:selectType(40);'>Tips</a></li>";A+="<li><a href='javascript:selectType(60);'>Answers</a></li>";A+="<li><a href='javascript:selectType(70);'>Blogs</a></li>";A="<div id='typeSelector'><ul class='filter-list'>"+A+"</ul></div><div id='currentType' class='applied-filters'></div>";this.typeElem.innerHTML=A};QueryFilter.prototype.renderTypes=function(){var A=(this.entityType||this.listingType);var B="";if(A){B=this.getNameForType(this.entityType,this.listingType)+" <a title='Remove Filter' href='javascript:removeType()'><img src='http://ui.geckogo.com/ui/media/delete-orange.png'></a><br>"}document.getElementById("currentType").innerHTML=B;document.getElementById("typeSelector").style.display=A?"none":""};QueryFilter.prototype.getNameForType=function(A,B){if(A==10){return"Destinations"}else{if(A==40){return"Tips"}else{if(A==60){return"Answers"}else{if(A==70){return"Blogs"}else{if(B==10){return"Attractions"}else{if(B==12){return"Transportation"}else{if(B==13){return"Lodging"}else{if(B==14){return"Restaurants"}else{if(B==15){return"Nightlife"}else{if(B==16){return"Tour"}else{return"Other Resources"}}}}}}}}}}};function removeType(){queryFilter.entityType=null;queryFilter.listingType=null;if(this.filterArea){queryFilter.renderTypes()}queryFilter.doQuery(true)}QueryFilter.prototype.initSearch=function(){this.searchElem=this.newFilterArea(Locale.FILTER_SEARCH,"search");var A="";A+="<div id='searchTerms'></div>";A+="<div><input type='text' name='search' size='16' style='margin:0px'></div>";A+="<div><input type='radio' name='searchScope' value='all'>All <input type='radio' name='searchScope' checked value='within'>Within</div>";A+="<div style='text-align:right;padding-top:8px'><button type='button'>Search</button></div>";this.searchElem.innerHTML=A;YAHOO.util.Event.addListener(this.searchElem.childNodes[3],"click",this.doSearch,this,true);YAHOO.util.Event.addListener(this.searchElem.childNodes[1],"keypress",function(B,D){var C=YAHOO.util.Event.getCharCode(B);if(C==13){YAHOO.util.Event.stopEvent(B);this.doSearch()}},this,true)};QueryFilter.prototype.doSearch=function(){if(document.form.searchScope[0].checked){this.searchTerm="";this.guide=null;this.guideName=null;this.mainTags=[];this.activityTags=[]}var A=document.form.search.value;if(A){this.searchTerm+=A+" ";document.form.search.value="";this.doQuery(true)}return A};function removeSearchTerm(A){queryFilter.searchTerm=queryFilter.searchTerm.replace(A+" ","");queryFilter.doQuery(true)}QueryFilter.prototype.renderSearchTerms=function(){var C=this.searchTerm.split(" ");var D="";for(var A=0;A<C.length;A++){if(C[A]){D+=C[A]+" <a title='Remove Filter' href='javascript:removeSearchTerm(\""+C[A]+"\")'><img src='http://ui.geckogo.com/ui/media/delete-orange.png'></a><br>"}}if(D){D="<div class='applied-filters'>"+D+"</div>"}var B=document.getElementById("searchTerms");B.innerHTML=D;B.style.display=(D)?"":"none"};QueryFilter.prototype.buildState=function(E){if(E){this.itemIndex=0}var F="?event=query";if(this.showCategories&&E){F+="&getCategories=true"}if(this.user){F+="&user="+this.user}if(this.lat||this.lng){F+="&lat="+this.lat+"&lng="+this.lng}if(this.guide){F+="&guide="+this.guide}if(this.guideType&&!this.guide){F+="&guideType="+this.guideType}if(this.entityType){F+="&entityType="+this.entityType}if(this.listingType){F+="&listingType="+this.listingType}if(this.discussionType){F+="&discussionType="+this.discussionType}if(this.tagSection){F+="&tagSection="+this.tagSection}if(this.mainTags.length>0){var D="",A="";for(var C=0;C<this.mainTags.length;C++){D+=","+this.mainTags[C].id;A+=","+this.mainTags[C].name}F+="&tags="+D.substring(1);F+="&tagNames="+A.substring(1)}if(this.activityTags.length>0){var D="",A="";for(var C=0;C<this.activityTags.length;C++){D+=","+this.activityTags[C].id;A+=","+this.activityTags[C].name}F+="&activityTags="+D.substring(1);F+="&activityTagNames="+A.substring(1)}if(this.searchTerm){F+="&q="+encode(this.searchTerm)}if(this.sortMode){F+="&sortMode="+this.sortMode}F+="&count="+this.itemsPerPage;F+="&start="+this.itemIndex;var B=QueryFilter.SERVICE_NAME+F;return B};QueryFilter.prototype.extractState=function(A){this.mainTags=[];this.activityTags=[];var J,F;var D=A.split(/[\?&]/);
for(var E=0;E<D.length;E++){var K=D[E].split("=");var B=K[0];var H=decode(K[1]);if(B=="start"){this.itemIndex=parseInt(H)}else{if(B=="count"){this.itemsPerPage=parseInt(H)}else{if(B=="search"){this.searchTerm=H}else{if(B=="discussionType"){this.discussionType=H}else{if(B=="listingType"){this.listingType=H}else{if(B=="tagSection"){this.tagSection=H}else{if(B=="guideType"){this.guideType=H}else{if(B=="entityType"){this.entityType=H}else{if(B=="lat"){this.lat=H}else{if(B=="lng"){this.lng=H}else{if(B=="guide"){this.guide=H}else{if(B=="skipListing"){this.skipListing=H}else{if(B=="user"){this.user=H}else{if(B=="tags"){J=H}else{if(B=="activityTags"){F=H}else{if(B=="tagNames"){tmpTagNames=H}else{if(B=="activityTagNames"){tmpActivityTagNames=H}}}}}}}}}}}}}}}}}}if(J&&tmpTagNames){var I=J.split(",");var G=tmpTagNames.split(",");for(var C=0;C<I.length;C++){this.mainTags.push(new Tag(I[C],G[C]))}}if(F&&tmpActivityTagNames){var I=F.split(",");var G=tmpActivityTagNames.split(",");for(var C=0;C<I.length;C++){this.activityTags.push(new Tag(I[C],G[C]))}}};QueryFilter.prototype.renderResults=function(B){var D=JSON.parse(B.responseText);this.itemCount=D.resultCount;if(!this.isPaging){this.renderFilterControls();this.renderFilters(B)}var A=Math.floor(this.itemIndex/this.itemsPerPage)+1;var C=Math.ceil(this.itemCount/this.itemsPerPage);this.renderFilterResults(D.results,this.itemIndex,this.itemCount,A,C);this.busy=false;this.isPaging=false};QueryFilter.prototype.getIcon=function(A){var B=getIconNameForType(A.entityType,A.listingType);return"http://ui.geckogo.com/ui/media/"+B+".png"};QueryFilter.prototype.getPhoto=function(A,C){if(this.entityType==40||this.entityType==60){if(A.userPhotoUrl){return A.userPhotoUrl}else{return"http://ui.geckogo.com/ui/media/no_pic_small.gif"}}else{if(A.photo){if(C){A.photo=A.photo.replace(/-qt/,"-qm")}return A.photo}else{var B=getIconNameForType(A.entityType,A.listingType);if(C){return"http://ui.geckogo.com/ui/media/types/qm/no-"+B+".gif"}else{return"http://ui.geckogo.com/ui/media/types/q-120/no-"+B+".png"}}}};QueryFilter.prototype.renderFilters=function(A){if(!this.filterArea){return }if(this.showTypes){this.renderTypes()}this.renderSearchTerms();if(this.showCategories&&this.entityType!=10&&this.listingType!=1){var B=JSON.parse(A.responseText);this.parentGuide=B.parentGuide;this.guideName=(B.guide)?B.guide.name:"";if(B.guides){this.lastGuides=B.guides}else{this.lastGuides=null}this.renderGuides(this.lastGuides,this.guideGroupElem);if(this.hasTags){this.lastTags=B.tags;this.lastActivityTags=B.activityTags;this.renderTags(this.lastTags,this.tagGroupElem,this.mainTags,false);if(this.listingType==10){this.renderTags(this.lastActivityTags,this.activityTagGroupElem,this.activityTags,true)}}}};QueryFilter.prototype.renderGuides=function(G,D){var C=0;if(G){C=G.length<QueryFilter.MAX_FILTER_ITEMS?G.length:QueryFilter.MAX_FILTER_ITEMS}var F="";for(var E=0;E<C;E++){var A=G[E];F+="<li><a href='javascript:filterGuide("+A.id+", this)'>"+A.name+"</a> ("+A.freq+")</li>"}var B="";if(G&&G.length>=QueryFilter.MAX_FILTER_ITEMS){G.sort(function(J,I){if(J.name<I.name){return -1}else{if(J.name>I.name){return 1}else{return 0}}});for(var E=0;E<G.length;E++){var A=G[E];if(E>0&&E%6==0){B+="</div><div class='filter-popup-column'>"}B+="<div><a href='javascript:filterGuide("+A.id+", this)'>"+A.name+"</a> ("+A.freq+")</div>"}B="<div class='filter-popup' style='display:none'><div class='filter-popup-column'>"+B+"</div><div class='filter-more'><a href='#' onclick='hideMore(this);return false'>Close</a></div></div>"}if(F||this.guide!=this.anchorGuide){F="<ul class='filter-list'>"+F+"</ul>";if(B){F+="<div class='filter-more'><a href='#' onclick='showMore(this);return false'>(More)</a></div>"}var H="";if(this.guide&&this.guide!=this.anchorGuide){H="<div class='applied-filters'>"+this.guideName+" <a href='javascript:filterGuideBack("+this.guide+")' title='Remove Filter'><img src='http://ui.geckogo.com/ui/media/delete-orange.png'></a></div>"}D.innerHTML=H+B+F;D.parentNode.style.display=""}else{D.parentNode.style.display="none"}};function showMore(A){var B=A.parentNode.previousSibling.previousSibling;B.style.display=""}function hideMore(A){var B=A.parentNode.parentNode;B.style.display="none"}QueryFilter.prototype.renderTags=function(K,D,I,H){if(!K){return }var G=[];for(var E=0;E<K.length;E++){var L=K[E];for(var C=0;C<I.length;C++){if(I[C].id==L.id){break}}if(C<I.length){continue}if(L.freq==this.itemCount){continue}G.push(L)}K=G;var B=0;if(K){B=K.length<QueryFilter.MAX_FILTER_ITEMS?K.length:QueryFilter.MAX_FILTER_ITEMS}var F="";for(var E=0;E<B;E++){var L=K[E];F+="<li><a href='javascript:filterTag("+L.id+',"'+encode(L.name)+'",'+H+", this)'>"+L.name+"</a> ("+L.freq+")</li>"}var A="";if(K.length>=QueryFilter.MAX_FILTER_ITEMS){K.sort(function(N,M){if(N.name<M.name){return -1}else{if(N.name>M.name){return 1}else{return 0}}});for(var E=0;E<K.length;E++){var L=K[E];if(E>0&&E%6==0){A+="</div><div class='filter-popup-column'>"}A+="<div><a href='javascript:filterTag("+L.id+',"'+encode(L.name)+'",'+H+", this)'>"+L.name+"</a> ("+L.freq+")</div>"}A="<div class='filter-popup' style='display:none'><div class='filter-popup-column'>"+A+"</div><div class='filter-more'><a href='#' onclick='hideMore(this);return false'>Close</a></div></div>"}F="<ul class='filter-list'>"+F+"</ul>";if(A){F+="<div class='filter-more'><a href='#' onclick='showMore(this);return false'>(More)</a></div>"}var J="";for(var C=0;C<I.length;C++){J+=I[C].name+" <a title='Remove Filter' href='javascript:filterTagBack("+I[C].id+","+H+")'><img src='http://ui.geckogo.com/ui/media/delete-orange.png'></a><br>"}D.innerHTML=J+A+F};function selectType(A,B){queryFilter.selectType(A,B)}QueryFilter.prototype.selectType=function(A,B){this.entityType=A;this.listingType=B;this.mainTags=[];this.activityTags=[];this.guide=null;this.doQuery(true)};function filterTagBack(B,A){queryFilter.filterTagBack(B,A)}QueryFilter.prototype.filterTagBack=function(D,C){var B=(C)?this.activityTags:this.mainTags;for(var A=0;A<B.length;A++){if(B[A].id==D){B.splice(A,1);if(C){this.activityTags=B}else{this.mainTags=B}break}}this.doQuery(true)};function filterTag(D,C,B,A){queryFilter.filterTag(D,C,B,A)}QueryFilter.prototype.filterTag=function(F,E,D,A){E=decode(E);var C=(D)?this.activityTags:this.mainTags;for(var B=0;B<C.length;B++){if(C[B].id==F){return }}C.push(new Tag(F,E));this.doQuery(true)};function filterGuide(B,A){queryFilter.filterGuide(B,A)}QueryFilter.prototype.filterGuide=function(B,A){this.guide=B;this.doQuery(true)};function filterGuideBack(A){queryFilter.filterGuideBack(A)}QueryFilter.prototype.filterGuideBack=function(A){if(this.parentGuide){this.guide=this.parentGuide.id;this.guideName=this.parentGuide.name}else{this.guide=null;this.guideName=null}this.doQuery(true)};QueryFilter.prototype.registerPagers=function(A,B){if(A){YAHOO.util.Event.addListener(A,"click",this.movePreviousPage,this,true)}if(B){YAHOO.util.Event.addListener(B,"click",this.moveNextPage,this,true)}};QueryFilter.prototype.registerPagerJump=function(A,B){var C=this;YAHOO.util.Event.addListener(A,"click",function(D){C.moveJumpPage(D,B)},this,true)};QueryFilter.prototype.movePreviousPage=function(A){if(this.itemIndex-this.itemsPerPage>=0){this.itemIndex-=this.itemsPerPage;this.isPaging=true;this.doQuery()}YAHOO.util.Event.stopEvent(A)};QueryFilter.prototype.moveNextPage=function(A){if(this.itemIndex+this.itemsPerPage<this.itemCount){this.itemIndex+=this.itemsPerPage;this.isPaging=true;this.doQuery()}YAHOO.util.Event.stopEvent(A)};QueryFilter.prototype.moveJumpPage=function(A,B){this.itemIndex=B*this.itemsPerPage;this.isPaging=true;this.doQuery();YAHOO.util.Event.stopEvent(A)};QueryFilter.prototype.renderPager=function(M,H,L,K,E,C){var D="<b>"+(L+1)+"</b> to <b>"+(L+H.length)+"</b> of <b>"+K+"</b>";if(C>1){D+=" | Go to page ";var J=Math.max(1,E-QueryFilter.PAGER_RANGE/2);var I=Math.min(C,E+QueryFilter.PAGER_RANGE/2);for(var F=J;F<I+1;F++){if(F==E){D+=F+" "}else{D+="<a href=''>"+F+"</a> "}}}D+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";if(E>1){D+='&nbsp;<a rel="nofollow" href="#"><img src="http://ui.geckogo.com/ui/media/arrow-left.png"></a>'
}if(E<C){D+='&nbsp;<a rel="nofollow" href="#"><img src="http://ui.geckogo.com/ui/media/arrow-right.png"></a>'}M.innerHTML=D;var A=M.getElementsByTagName("A");for(var F=0;F<A.length;F++){var G=A[F];var B=G.innerHTML;if(B.indexOf("left")>=0){this.registerPagers(G,null)}else{if(B.indexOf("right")>=0){this.registerPagers(null,G)}else{this.registerPagerJump(G,parseInt(B)-1)}}}};QueryFilter.PAGER_RANGE=8;function Tag(B,A){this.id=B;this.name=A}QueryFilter.prototype.whenFiltersChange=function(){};var userUrl="";function FilterView(D,B,E,C,A){this.filter=D;this.profileUrl=E;this.addTipUrl=C;this.userId=B;this.ownerMode=A}FilterView.prototype.render=function(P,C){var J=P.entityType==40;var G=P.entityType==60;var E="<a name='item"+P.id+"'></a>";E+="<div class='result' id='result"+P.id+"'><div class='photo'><a onclick='return navLink(this.href)' href='"+P.url+"'>";if(this.ownerMode){E+="<img src='"+this.filter.getIcon(P)+"'>"}else{E+="<img src='"+this.filter.getPhoto(P)+"'>"}E+="</a></div><div class='num'>"+C+".</div><div class='main'>";E+="<div class='info'>";var B=P.name;if(P.guideName&&P.entityType==10){B+=", "+P.guideName}E+="<div class='name'>";var M="";if(J){E+="<a href='/Travel-Tip/?item="+P.id+"'>"+B+"</a>";M="<div class='controls'><div class='info-date'>"+P.dateAdded+"</div>";if(this.ownerMode){M+="<div><a href='#' onclick='editTip("+P.id+");return false'>Edit</a>&nbsp;&nbsp;<a href='#' onclick='deleteTip("+P.id+");return false'>Delete</a></div>"}M+="</div>"}else{E+="<a onclick='return navLink(this.href)' href='"+P.url+"'>"+B+"</a>"}E+="</div>";if(P.guideName&&P.entityType!=10){E+="<div class='location'>"+P.guideName+"</div>"}if(G){E+="<div class='location'>Asked by: "+P.userName+(P.dateAddedString?" ("+P.dateAddedString+" ago)":"")+"</div>"}if(!G&&P.text){E+="<div class='description'>"+prepareText(P.text,500)+"</div>"}if(J&&!this.ownerMode){var L=P.votes;if(L>0){L="+"+L}E+="<div class='tip-controls clear_fix'><div class='left'>Good tip?&nbsp;&nbsp;<span class='small' style='position:relative; top:2px'><a href='#' onclick='voteThumbsUp("+P.id+", \"tip\", this.parentNode.parentNode, 1); return false;'><img src='http://ui.geckogo.com/ui/media/thumbsup-small.png' title='Thumbs Up'></a></span><span class='small' style='padding-left:5px; position:relative; top:2px'><a href='#' onclick='voteThumbsUp("+P.id+", \"tip\", this.parentNode.parentNode, -1); return false;'><img src='http://ui.geckogo.com/ui/media/thumbsdown-small.png' title='Thumbs Down'></a></span></div>";E+="<div class='small left' style='padding-left:5px'>(<span id='fCount"+P.id+"'>"+L+"</span>)</div></div>"}E+="</div>"+M;if(J||G){var F=(J)?P.comments:P.posts;var K;var A;if(J){K=(F.length==1)?Locale.FILTER_COMMENT:Locale.FILTER_COMMENTS;A=Locale.FILTER_WRITE_COMMENT}else{if(G){K=(F.length==1)?Locale.FILTER_ANSWER:Locale.FILTER_ANSWERS;A=Locale.FILTER_WRITE_ANSWER}}var O="";if(F.length>0){var N="";if(J){N="<a href='#' class='small underline' onclick='toggleCommentBox("+P.id+"); return false;'>"}else{N="<a class='small underline' href='/Question/?item="+P.id+"'>"}O+="<div class='left control-item' style='line-height:25px'><span class='green bold' id='cNum"+P.id+"'>"+F.length+"</span> "+N+K+"</a></div>"}else{var N="";if(J){N="<a href='#' class='small underline' onclick='toggleInputBox("+P.id+"); return false;'>"}else{N="<a class='small underline' href='/Question/?item="+P.id+"'>"}O+="<div class='left control-item'><span style='padding-right:3px; position:relative; top:4px'><img src='http://ui.geckogo.com/ui/media/add-comment.png'></span>"+N+A+"</a></div>"}if(J){if(this.userId!=P.user){O+="<div class='left control-item addTip'><span style='padding-right:4px; position:relative; top:2px'><img src='http://ui.geckogo.com/ui/media/thumbsup-small.png'></span><span class='small'><a href='#' class='small underline' onclick='voteThumbsUp(\""+P.id+'", "tip", this.parentNode); return false;\'>'+Locale.FILTER_GOOD_TIP+"</a></span></div>"}var D=this.addTipUrl+"?t=ats&m=1&city="+P.city;var I=(P.guideName)?P.guideName.replace(/,.*/,""):"World";O+="<div class='left control-item addTip'><span style='padding-right:2px; position:relative; top:1px'><img src='http://ui.geckogo.com/ui/media/comment-small.png'></span><a onclick='return navLink(this.href)' class='small underline' href='"+D+"'>"+Locale.render("FILTER_ADD_TIP",[I])+"</a></div>"}var H=(J)?"tip":"discussion";if(this.userId!=P.user){O+="<div class='right control-item'><span class='small'><a href='#' onclick='flagItem(\""+P.id+'", "'+H+"\", this.parentNode); return false;'><img title='Flag for abuse' src='http://ui.geckogo.com/ui/media/flag-abuse.png'></a></span></div>"}if(!J){E+="<div class='control-parent' id='add"+P.id+"'>"+O+"</div>"}if(F.length>0){E+="<div style='margin-bottom:5px; clear:both; display:none' id='link"+P.id+"'><span style='padding-right:3px; position:relative; top:4px'><img src='http://ui.geckogo.com/ui/media/add-comment.png'></span><a href='#' class='small underline' onclick='toggleInputBox("+P.id+"); return false;'>"+A+"</a></div>"}E+="<div><a name='info"+P.id+"'></a></div><div class='info-box' id='success"+P.id+"' style='display:none; clear:both; width:355px'>"+Locale.FILTER_COMMENT_POSTED+"</div>";E+="<div id='input"+P.id+"' style='display:none; margin-top:5px'><div class='bold compliment-header'>What do you want to say?</div>";E+="<div style='margin-left:5px;'><textarea id='commentText"+P.id+"' class='compl-area'></textarea></div>";E+="<div class='add-button-row'>";E+="<div id='msg"+P.id+"' class='add-msg' style='display:none'></div>";if(J){var I=(P.guideName)?P.guideName.replace(/,.*/,""):"World";E+="<div class='add-buttons'><span><button type='button' onclick='addComment(\""+P.id+'", "'+H+'",  "'+this.userId+'", "'+P.user+'", "'+I+'", "'+P.city+"\")'>Send</button></span>"}else{E+="<div class='add-buttons'><span><button type='button' onclick='addPost(\""+P.id+'", "'+H+'",  "'+this.userId+'", "'+P.user+"\", this)'>Send</button></span>"}E+="<span style='margin-left:5px;'><button type='button' onclick='toggleInputBox("+P.id+")'>Cancel</button></span></div>";E+="</div>";E+="</div>";E+="<div id='comments"+P.id+"' style='display:none'></div>"}E+="</div></div>";return E};function renderPost(C,F,E,L,G,J,I,K,H){var A="";var B=(J)?J:"http://ui.geckogo.com/ui/media/no_pic_small.gif";var D="<a onclick='return navLink(this.href)' href='"+profileUrl+"?uid="+F+"'>";if(!G){G=Locale.ANONYMOUS}A+="<div id='comment"+C+"' class='compliment-row clear_fix' style='display:'>";A+="<div class='compliment-left'>";A+="<div class='tipPic'>"+D+"<img src='"+B+"'></a></div>";A+="</div>";A+="<div class='compliment-right'>";A+="<div class='c-info-row clear_fix'>";A+="<div class='c-info-name'>"+D+G+"</a> <span class='small'>says :</span></div>";A+="<div class='c-info-date' style='float:right'>"+L+"</div>";A+="</div>";E=E.replace(/%/,"%25");A+="<div class='compliment-item' style='clear:both'>"+decode(E)+"</div>";A+="<div class='clear_fix'>";if(F==I){A+="<div class='right'><a href='#' onclick='deletePost(\""+C+'", "'+K+"\"); return false;' class='small underline'>"+Locale.REMOVE+"</a></div>"}else{A+="<div class='left small' style='line-height:17px'>"+Locale.DISCUSSION_USEFUL+"&nbsp;&nbsp;";A+="<span class='small' style='position:relative; top:2px'><a href='#' onclick='voteThumbsUp(\""+C+"\", \"post\", this.parentNode.parentNode, \"1\"); return false;'><img src='http://ui.geckogo.com/ui/media/thumbsup-small.png' title='Thumbs Up'></a></span>";A+="<span class='small' style='padding-left:5px; position:relative; top:2px'><a href='#' onclick='voteThumbsUp(\""+C+"\", \"post\", this.parentNode.parentNode, \"-1\"); return false;'><img src='http://ui.geckogo.com/ui/media/thumbsdown-small.png' title='Thumbs Down'></a></span>";A+="</div>";if(H>0){H="+"+H}A+="<div class='small left' style='padding-left:5px; position:relative; top:2px'>(<span id='fCount"+C+"'>"+H+"</span>)</div>";A+="<div class='right'><span class='small' style='position:relative; top:2px'><a href='#' onclick='flagItem(\""+C+"\", \"post\", this.parentNode); return false;'><img title='Flag for abuse' src='http://ui.geckogo.com/ui/media/flag-abuse.png'></a></span></div>"}A+="</div>";A+="</div>";A+="</div>";return A}var profileUrl="/profile/";var addTipUrl="";var isSelf;
var ownerMode;var firstName;var controls1,controls2;var contribTypeId;function initContrib(B,C,A){window.userId=C;window.eType=B;window.ownerMode=A;isSelf=true;if(B==40){contribTypeId="Tip"}else{if(B==60){contribTypeId="Answer"}else{if(B==70){contribTypeId="Trip";isSelf=false}}}contribQueryFilter=new QueryFilter();contribQueryFilter.setItemsPerPage(10);var D={entityType:B,showTypes:false,showCategories:true,user:C,useNoPhotoIcon:false};var F=document.getElementById("filterArea"+contribTypeId);contribQueryFilter.init(renderSearchResults,searchStarted,F,D);var E="";if(window.location.search.match(/[\?&]q=(.*)/)){E=decode(RegExp.$1)}if(E){contribQueryFilter.setSearchTerm(E);contribQueryFilter.setSortMode("relevent")}else{contribQueryFilter.setSortMode("latest")}controls1=getChildElements("resultsControls1"+contribTypeId);contribQueryFilter.registerPagers(controls1[0],controls1[2]);controls2=getChildElements("resultsControls2"+contribTypeId);contribQueryFilter.registerPagers(controls2[0],controls2[2]);contribQueryFilter.start()}function searchStarted(){document.getElementById("loadingNote"+contribTypeId).style.display="";document.body.style.cursor="wait"}function renderSearchResults(G,L,K,D,C){document.getElementById("loadingNote"+contribTypeId).style.display="none";document.body.style.cursor="";if(C>1){controls1[1].innerHTML="Page "+D+" of "+C;controls2[1].innerHTML="Page "+D+" of "+C;showHideArea("resultsControls1"+contribTypeId,true);showHideArea("resultsControls2"+contribTypeId,true)}else{showHideArea("resultsControls1"+contribTypeId,false);showHideArea("resultsControls2"+contribTypeId,false)}var J=new FilterView(contribQueryFilter,userId,profileUrl,addTipUrl,ownerMode);var H="";for(var E=0;E<G.length;E++){var N=G[E];var B=L+E+1;H+=J.render(N,B)}document.getElementById("resultArea"+contribTypeId).innerHTML=H;for(var F=0;F<G.length;F++){var H="";var N=G[F];if(N.entityType==40){var I=N.comments;for(var E=0;E<I.length;E++){var A=I[E];H+=renderComment(A.id,A.user,A.text,A.dateAdded,A.first_name,A.pic,userId,N.id)}document.getElementById("comments"+N.id).innerHTML=H}else{if(N.entityType==60){var M=N.posts;for(var E=0;E<M.length;E++){var A=M[E];H+=renderPost(A.id,A.user,A.text,A.dateAdded,A.first_name,A.pic,userId,N.id,A.votes)}document.getElementById("comments"+N.id).innerHTML=H}else{break}}}}function editTip(A){window.top.location="/AddTip.html?tip="+A}function deleteTip(C){var A=confirm("Are you sure you want to delete your tip?");if(!A){return }var B="event=deleteTip&tip="+C;YAHOO.util.Connect.asyncRequest("POST","/services/Tips",{success:function(D){var D=JSON.parse(D.responseText);if(D.result=="OK"){var E=document.getElementById("result"+C);if(E){E.style.display="none"}}},failure:function(D){reportAjaxFailure()}},B)}var working=false;var fiItem;var fiType;var fiElement;var succElem,inputElem;function acceptRequest(A){if(!A){return }YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(B){var C=getElementText("error",B.responseXML);if(C){alert(C)}else{document.getElementById(A+"id").style.display="none";var D=parseInt(document.getElementById("newRequestCount").innerHTML);document.getElementById("newRequestCount").innerHTML=Math.max(0,D-1)+"";if(D==1){window.location="/MyProfile"}}},failure:function(B){reportAjaxFailure()}},"event=acceptRequest&request="+A)}function rejectRequest(A){if(!A){return }YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(B){var C=getElementText("error",B.responseXML);if(C){alert(C)}else{document.getElementById(A+"id").style.display="none";var D=parseInt(document.getElementById("newRequestCount").innerHTML);document.getElementById("newRequestCount").innerHTML=(D-1)+"";if(D==1){window.location="/MyProfile"}}},failure:function(B){reportAjaxFailure()}},"event=rejectRequest&request="+A)}function confirmRejectRequest(C,A){var B=confirm("Are you sure you want to remove "+A+" as a friend?");if(B){rejectRequest(C)}}var loggedIn=isLoggedIn();var loginId=null;var userName=null;var loginPopUp;var kwType;var kwIgnoreAlert;var kwElement;function sendKickWave(C,D,B,A){if(!C){return }loginId=C;kwType=D;kwIgnoreAlert=B;kwElement=A;if(!loggedIn){establishActiveUser(kwCallback);return }YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(E){var F=getElementText("error",E.responseXML);if(F){alert(F)}else{if(!B){alert("Your "+D+" was sent!")}if(A){var G=(D=="kick")?"You kicked!":"You waved!";document.getElementById(A).innerHTML=G}}},failure:function(E){reportAjaxFailure()}},"event=sendKickWave&userId="+C+"&type="+D)}function kwCallback(A){if(A!="cancel"){loggedIn=true;sendKickWave(loginId,kwType,kwIgnoreAlert,kwElement)}}function sendWaveBack(B,A){deleteKickWave(B,true);sendKickWave(A,"wave",true);document.getElementById("wave"+B).innerHTML="<i>Wave sent!</i>"}function deleteKickWave(B,A){if(!B){return }YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(C){var D=getElementText("error",C.responseXML);if(D){alert(D)}else{if(!A){document.getElementById("kw"+B).style.display="none"}}},failure:function(C){reportAjaxFailure()}},"event=deleteKickWave&id="+B)}function postComment(){establishActiveUser(postCommentNow)}function postCommentNow(D){if(D=="cancel"){return }var F=rte.getContent();var A=document.forms.commentForm.commentType.selectedIndex;var C=document.forms.commentForm.commentType.options[A].value;if(!C){return }var B=document.forms.hiddenForm.user.value;var E="event=postComment&text="+encode(F)+"&type="+C+"&userId="+B;YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(G){alert("Thank you, your comment is posted!");rte.setContent("");document.location.reload()},failure:function(G){reportAjaxFailure()}},E)}function deleteUserComment(C){var A=confirm("Are you sure you want to delete the comment?");if(!A||!C){return }var B="event=deleteComment&id="+C;YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(D){var E=getElementText("error",D.responseXML);if(E){alert(E)}else{document.getElementById(C+"comment").style.display="none"}},failure:function(D){reportAjaxFailure()}},B)}function voteCommentUp(A){voteComment(A,1)}function voteCommentDown(A){voteComment(A,-1)}function voteComment(B,A){if(!B){return }YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(C){var D=getElementText("error",C.responseXML);if(D){alert(D)}else{if(document.getElementById("vote"+B).style.display=="none"){document.getElementById("vote"+B).style.display=""}if(A==1){var F=parseInt(document.getElementById("yes"+B).innerHTML);var E=parseInt(document.getElementById("total"+B).innerHTML);document.getElementById("yes"+B).innerHTML=(F+1)+"";document.getElementById("total"+B).innerHTML=(E+1)+""}else{if(A==-1){var E=parseInt(document.getElementById("total"+B).innerHTML);document.getElementById("total"+B).innerHTML=(E+1)+""}}}},failure:function(C){reportAjaxFailure()}},"event=voteComment&id="+B+"&vote="+A)}function showBuddyWindow(C,A){loginId=C;userName=A;if(!loggedIn){establishActiveUser(addCallback);return }var B=document.getElementById("addBuddyWindow");document.getElementById("buddyName").innerHTML=A;popup=makePopup(B,"Add Friend");if(popup){loginPopup=popup}}function addCallback(A){if(A!="cancel"){loggedIn=true;showBuddyWindow(loginId,userName)}}function hideBuddyWindow(){closePopup(loginPopup);document.getElementById("addBuddyError").style.display="none"}function handleBuddyRequest(){document.getElementById("addBuddyError").style.display="none";var A=document.forms.hiddenForm.user.value||loginId;if(!A){alert("Buddy ID not found!");return }var C=document.forms.addBuddyForm.addBuddyMessage.value;var B="event=addBuddy&userAdded="+A+"&message="+encode(C);YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(D){var E=getElementText("error",D.responseXML);if(E){document.getElementById("addBuddyError").innerHTML=E;document.getElementById("addBuddyError").style.display=""}else{hideBuddyWindow();
document.getElementById("add"+A).innerHTML="<i>Add request submitted.</i>"}},failure:function(D){reportAjaxFailure()}},B)}function commentsRead(A){YAHOO.util.Connect.asyncRequest("POST","/services/Buddies",{success:function(B){var C=getElementText("error",B.responseXML);if(C){alert(C)}else{document.getElementById("note"+A).style.display="none"}},failure:function(B){reportAjaxFailure()}},"event=flagCommentsRead&id="+A)}function toggleInputBox(B){var A=document.getElementById("input"+B);A.style.display=(A.style.display=="none")?"":"none"}function displaySuccessBox(A){inputElem=document.getElementById("input"+A)||document.getElementById("inputBox");inputElem.style.display="none";succElem=document.getElementById("success"+A)||document.getElementById("successBox");succElem.style.display="";setTimeout("succElem.style.display='none';",4000)}function toggleCommentBox(D){var B=document.getElementById("comments"+D);var C=(B.style.display=="none")?"":"none";B.style.display=C;var A=document.getElementById("link"+D);if(A){A.style.display=C}};
