(function($){$.fn.layout=function(opts){var prefix="ui-layout-",defaults={paneClass:prefix+"pane",resizerClass:prefix+"resizer",togglerClass:prefix+"toggler",togglerInnerClass:prefix+"",buttonClass:prefix+"button",contentSelector:"."+prefix+"content",contentIgnoreSelector:"."+prefix+"ignore"};var options={name:"",scrollToBookmarkOnLoad:true,defaults:{applyDefaultStyles:false,closable:true,resizable:true,slidable:true,contentSelector:defaults.contentSelector,contentIgnoreSelector:defaults.contentIgnoreSelector,paneClass:defaults.paneClass,resizerClass:defaults.resizerClass,togglerClass:defaults.togglerClass,buttonClass:defaults.buttonClass,resizerDragOpacity:1,maskIframesOnResize:true,minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerTip_open:"Close",togglerTip_closed:"Open",resizerTip:"Resize",sliderTip:"Slide Open",sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseout",hideTogglerOnSlide:false,togglerContent_open:"",togglerContent_closed:"",showOverflowOnHover:false,enableCursorHotkey:true,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{},initClosed:false,initHidden:false},north:{paneSelector:"."+prefix+"north",size:"auto",resizerCursor:"n-resize"},south:{paneSelector:"."+prefix+"south",size:"auto",resizerCursor:"s-resize"},east:{paneSelector:"."+prefix+"east",size:200,resizerCursor:"e-resize"},west:{paneSelector:"."+prefix+"west",size:200,resizerCursor:"w-resize"},center:{paneSelector:"."+prefix+"center"}};
var effects={slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},scale:{all:{duration:"fast"}}};var config={allPanes:"north,south,east,west,center",borderPanes:"north,south,east,west",zIndex:{resizer_normal:1,pane_normal:2,mask:4,sliding:100,resizing:10000,animation:10000},resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden",zIndex:1},cssDef:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDef:{background:"#AAA"}},content:{cssReq:{overflow:"auto"},cssDef:{}},defaults:{cssReq:{position:"absolute",margin:0,zIndex:2},cssDef:{padding:"10px",background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{edge:"top",sizeType:"height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{edge:"bottom",sizeType:"height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{edge:"right",sizeType:"width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{edge:"left",sizeType:"width",dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}},center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}};
var state={id:Math.floor(Math.random()*10000),container:{},north:{},south:{},east:{},west:{},center:{}};var altEdge={top:"bottom",bottom:"top",left:"right",right:"left"},altSide={north:"south",south:"north",east:"west",west:"east"};var isStr=function(o){if(typeof o=="string"){return true}else{if(typeof o=="object"){try{var match=o.constructor.toString().match(/string/i);return(match!==null)}catch(e){}}}return false};var str=function(o){if(typeof o=="string"||isStr(o)){return $.trim(o)}else{return o}};var min=function(x,y){return Math.min(x,y)};var max=function(x,y){return Math.max(x,y)};var transformData=function(d){var json={defaults:{fxSettings:{}},north:{fxSettings:{}},south:{fxSettings:{}},east:{fxSettings:{}},west:{fxSettings:{}},center:{fxSettings:{}}};d=d||{};if(d.effects||d.defaults||d.north||d.south||d.west||d.east||d.center){json=$.extend(json,d)}else{$.each(d,function(key,val){a=key.split("__");json[a[1]?a[0]:"defaults"][a[1]?a[1]:a[0]]=val})}return json};var setFlowCallback=function(action,pane,param){var cb=action+","+pane+","+(param?1:0),cP,cbPane;
$.each(c.borderPanes.split(","),function(i,p){if(c[p].isMoving){bindCallback(p);return false}});function bindCallback(p,test){cP=c[p];if(!cP.doCallback){cP.doCallback=true;cP.callback=cb}else{cpPane=cP.callback.split(",")[1];if(cpPane!=p&&cpPane!=pane){bindCallback(cpPane,true)}}}};var execFlowCallback=function(pane){var cP=c[pane];c.isLayoutBusy=false;delete cP.isMoving;if(!cP.doCallback||!cP.callback){return}cP.doCallback=false;var cb=cP.callback.split(","),param=(cb[2]>0?true:false);if(cb[0]=="open"){open(cb[1],param)}else{if(cb[0]=="close"){close(cb[1],param)}}if(!cP.doCallback){cP.callback=null}};var execUserCallback=function(pane,v_fn){if(!v_fn){return}var fn;try{if(typeof v_fn=="function"){fn=v_fn}else{if(typeof v_fn!="string"){return}else{if(v_fn.indexOf(",")>0){var args=v_fn.split(","),fn=eval(args[0]);if(typeof fn=="function"&&args.length>1){return fn(args[1])}}else{fn=eval(v_fn)}}}if(typeof fn=="function"){return fn(pane,$Ps[pane],$.extend({},state[pane]),$.extend({},options[pane]),options.name)
}}catch(ex){}};var cssNum=function($E,prop){var val=0,hidden=false,visibility="";if(!$.browser.msie){if($.curCSS($E[0],"display",true)=="none"){hidden=true;visibility=$.curCSS($E[0],"visibility",true);$E.css({display:"block",visibility:"hidden"})}}val=parseInt($.curCSS($E[0],prop,true),10)||0;if(hidden){$E.css({display:"none"});if(visibility&&visibility!="hidden"){$E.css({visibility:visibility})}}return val};var cssW=function(e,outerWidth){var $E;if(isStr(e)){e=str(e);$E=$Ps[e]}else{$E=$(e)}if(outerWidth<=0){return 0}else{if(!(outerWidth>0)){outerWidth=isStr(e)?getPaneSize(e):$E.outerWidth()}}if(!$.boxModel){return outerWidth}else{return outerWidth-cssNum($E,"paddingLeft")-cssNum($E,"paddingRight")-($.curCSS($E[0],"borderLeftStyle",true)=="none"?0:cssNum($E,"borderLeftWidth"))-($.curCSS($E[0],"borderRightStyle",true)=="none"?0:cssNum($E,"borderRightWidth"))}};var cssH=function(e,outerHeight){var $E;if(isStr(e)){e=str(e);$E=$Ps[e]}else{$E=$(e)}if(outerHeight<=0){return 0}else{if(!(outerHeight>0)){outerHeight=(isStr(e))?getPaneSize(e):$E.outerHeight()
}}if(!$.boxModel){return outerHeight}else{return outerHeight-cssNum($E,"paddingTop")-cssNum($E,"paddingBottom")-($.curCSS($E[0],"borderTopStyle",true)=="none"?0:cssNum($E,"borderTopWidth"))-($.curCSS($E[0],"borderBottomStyle",true)=="none"?0:cssNum($E,"borderBottomWidth"))}};var cssSize=function(pane,outerSize){if(c[pane].dir=="horz"){return cssH(pane,outerSize)}else{return cssW(pane,outerSize)}};var getPaneSize=function(pane,inclSpace){var $P=$Ps[pane],o=options[pane],s=state[pane],oSp=(inclSpace?o.spacing_open:0),cSp=(inclSpace?o.spacing_closed:0);if(!$P||s.isHidden){return 0}else{if(s.isClosed||(s.isSliding&&inclSpace)){return cSp}else{if(c[pane].dir=="horz"){return $P.outerHeight()+oSp}else{return $P.outerWidth()+oSp}}}};var setPaneMinMaxSizes=function(pane){var d=cDims,edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$altPane=$Ps[altSide[pane]],paneSpacing=o.spacing_open,altPaneSpacing=options[altSide[pane]].spacing_open,altPaneSize=(!$altPane?0:(dir=="horz"?$altPane.outerHeight():$altPane.outerWidth())),containerSize=(dir=="horz"?d.innerHeight:d.innerWidth),limitSize=containerSize-paneSpacing-altPaneSize-altPaneSpacing,minSize=s.minSize||0,maxSize=Math.min(s.maxSize||9999,limitSize),minPos,maxPos;
switch(pane){case"north":minPos=d.offsetTop+minSize;maxPos=d.offsetTop+maxSize;break;case"west":minPos=d.offsetLeft+minSize;maxPos=d.offsetLeft+maxSize;break;case"south":minPos=d.offsetTop+d.innerHeight-maxSize;maxPos=d.offsetTop+d.innerHeight-minSize;break;case"east":minPos=d.offsetLeft+d.innerWidth-maxSize;maxPos=d.offsetLeft+d.innerWidth-minSize;break}$.extend(s,{minSize:minSize,maxSize:maxSize,minPosition:minPos,maxPosition:maxPos})};var getPaneDims=function(){var d={top:getPaneSize("north",true),bottom:getPaneSize("south",true),left:getPaneSize("west",true),right:getPaneSize("east",true),width:0,height:0};with(d){width=cDims.innerWidth-left-right;height=cDims.innerHeight-bottom-top;top+=cDims.top;bottom+=cDims.bottom;left+=cDims.left;right+=cDims.right}return d};var getElemDims=function($E){var d={},e,b,p;$.each("Left,Right,Top,Bottom".split(","),function(){e=str(this);b=d["border"+e]=cssNum($E,"border"+e+"Width");p=d["padding"+e]=cssNum($E,"padding"+e);d["offset"+e]=b+p;if($E==$Container){d[e.toLowerCase()]=($.boxModel?p:0)
}});d.innerWidth=d.outerWidth=$E.outerWidth();d.innerHeight=d.outerHeight=$E.outerHeight();if($.boxModel){d.innerWidth-=(d.offsetLeft+d.offsetRight);d.innerHeight-=(d.offsetTop+d.offsetBottom)}return d};var setTimer=function(pane,action,fn,ms){var Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name]){return}else{Timers[name]=setTimeout(fn,ms)}};var clearTimer=function(pane,action){var Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name]){clearTimeout(Timers[name]);delete Timers[name];return true}else{return false}};var create=function(){initOptions();initContainer();initPanes();initHandles();initResizable();sizeContent("all");if(options.scrollToBookmarkOnLoad){with(self.location){if(hash){replace(hash)}}}initHotkeys();$(window).resize(function(){var timerID="timerLayout_"+state.id;if(window[timerID]){clearTimeout(window[timerID])
}window[timerID]=null;if(true||$.browser.msie){window[timerID]=setTimeout(resizeAll,100)}else{resizeAll()}})};var initContainer=function(){try{if($Container[0].tagName=="BODY"){$("html").css({height:"100%",overflow:"hidden"});$("body").css({position:"relative",height:"100%",overflow:"hidden",margin:0,padding:0,border:"none"})}else{var CSS={overflow:"hidden"},p=$Container.css("position"),h=$Container.css("height");if(!$Container.hasClass("ui-layout-pane")){if(!p||"fixed,absolute,relative".indexOf(p)<0){CSS.position="relative"}if(!h||h=="auto"){CSS.height="100%"}}$Container.css(CSS)}}catch(ex){}cDims=state.container=getElemDims($Container)};var initHotkeys=function(){$.each(c.borderPanes.split(","),function(i,pane){var o=options[pane];if(o.enableCursorHotkey||o.customHotkey){$(document).keydown(keyDown);return false}})};var initOptions=function(){opts=transformData(opts);if(opts.effects){$.extend(effects,opts.effects);delete opts.effects}$.each("name,scrollToBookmarkOnLoad".split(","),function(idx,key){if(opts[key]!==undefined){options[key]=opts[key]
}else{if(opts.defaults[key]!==undefined){options[key]=opts.defaults[key];delete opts.defaults[key]}}});$.each("paneSelector,resizerCursor,customHotkey".split(","),function(idx,key){delete opts.defaults[key]});$.extend(options.defaults,opts.defaults);c.center=$.extend(true,{},c.defaults,c.center);$.extend(options.center,opts.center);var o_Center=$.extend(true,{},options.defaults,opts.defaults,options.center);$.each("paneClass,contentSelector,contentIgnoreSelector,applyDefaultStyles,showOverflowOnHover".split(","),function(idx,key){options.center[key]=o_Center[key]});var defs=options.defaults;$.each(c.borderPanes.split(","),function(i,pane){c[pane]=$.extend(true,{},c.defaults,c[pane]);o=options[pane]=$.extend(true,{},options.defaults,options[pane],opts.defaults,opts[pane]);if(!o.paneClass){o.paneClass=defaults.paneClass}if(!o.resizerClass){o.resizerClass=defaults.resizerClass}if(!o.togglerClass){o.togglerClass=defaults.togglerClass}$.each(["_open","_close",""],function(i,n){var sName="fxName"+n,sSpeed="fxSpeed"+n,sSettings="fxSettings"+n;
o[sName]=opts[pane][sName]||opts[pane].fxName||opts.defaults[sName]||opts.defaults.fxName||o[sName]||o.fxName||defs[sName]||defs.fxName||"none";var fxName=o[sName];if(fxName=="none"||!$.effects||!$.effects[fxName]||(!effects[fxName]&&!o[sSettings]&&!o.fxSettings)){fxName=o[sName]="none"}var fx=effects[fxName]||{},fx_all=fx.all||{},fx_pane=fx[pane]||{};o[sSettings]=$.extend({},fx_all,fx_pane,defs.fxSettings||{},defs[sSettings]||{},o.fxSettings,o[sSettings],opts.defaults.fxSettings,opts.defaults[sSettings]||{},opts[pane].fxSettings,opts[pane][sSettings]||{});o[sSpeed]=opts[pane][sSpeed]||opts[pane].fxSpeed||opts.defaults[sSpeed]||opts.defaults.fxSpeed||o[sSpeed]||o[sSettings].duration||o.fxSpeed||o.fxSettings.duration||defs.fxSpeed||defs.fxSettings.duration||fx_pane.duration||fx_all.duration||"normal"})})};var initPanes=function(){$.each(c.allPanes.split(","),function(){var pane=str(this),o=options[pane],s=state[pane],fx=s.fx,dir=c[pane].dir,size=o.size=="auto"||isNaN(o.size)?0:o.size,minSize=o.minSize||1,maxSize=o.maxSize||9999,spacing=o.spacing_open||0,sel=o.paneSelector,isIE6=($.browser.msie&&$.browser.version<7),CSS={},$P,$C;
$Cs[pane]=false;if(sel.substr(0,1)==="#"){$P=$Ps[pane]=$Container.find(sel+":first")}else{$P=$Ps[pane]=$Container.children(sel+":first");if(!$P.length){$P=$Ps[pane]=$Container.children("form:first").children(sel+":first")}}if(!$P.length){$Ps[pane]=false;return true}$P.attr("pane",pane).addClass(o.paneClass+" "+o.paneClass+"-"+pane);if(pane!="center"){s.isClosed=false;s.isSliding=false;s.isResizing=false;s.isHidden=false;s.noRoom=false;c[pane].pins=[]}CSS=$.extend({visibility:"visible",display:"block"},c.defaults.cssReq,c[pane].cssReq);if(o.applyDefaultStyles){$.extend(CSS,c.defaults.cssDef,c[pane].cssDef)}$P.css(CSS);CSS={};switch(pane){case"north":CSS.top=cDims.top;CSS.left=cDims.left;CSS.right=cDims.right;break;case"south":CSS.bottom=cDims.bottom;CSS.left=cDims.left;CSS.right=cDims.right;break;case"west":CSS.left=cDims.left;break;case"east":CSS.right=cDims.right;break;case"center":}if(dir=="horz"){if(size===0||size=="auto"){$P.css({height:"auto"});size=$P.outerHeight()}size=max(size,minSize);
size=min(size,maxSize);size=min(size,cDims.innerHeight-spacing);CSS.height=max(1,cssH(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.height+1);$P.css(CSS)}else{if(dir=="vert"){if(size===0||size=="auto"){$P.css("width","auto").css("float","left");size=$P.outerWidth();$P.css("float","none")}size=max(size,minSize);size=min(size,maxSize);size=min(size,cDims.innerWidth-spacing);CSS.width=max(1,cssW(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.width+1);$P.css(CSS);sizeMidPanes(pane,null,true)}else{if(pane=="center"){$P.css(CSS);sizeMidPanes("center",null,true)}}}if(o.initClosed&&o.closable){$P.hide().addClass("closed");s.isClosed=true}else{if(o.initHidden||o.initClosed){hide(pane,true);s.isHidden=true}else{$P.addClass("open")}}if(o.showOverflowOnHover){$P.hover(allowOverflow,resetOverflow)}if(o.contentSelector){$C=$Cs[pane]=$P.children(o.contentSelector+":first");if(!$C.length){$Cs[pane]=false;return true}$C.css(c.content.cssReq);if(o.applyDefaultStyles){$C.css(c.content.cssDef)
}$P.css({overflow:"hidden"})}})};var initHandles=function(){$.each(c.borderPanes.split(","),function(){var pane=str(this),o=options[pane],s=state[pane],rClass=o.resizerClass,tClass=o.togglerClass,$P=$Ps[pane];$Rs[pane]=false;$Ts[pane]=false;if(!$P||(!o.closable&&!o.resizable)){return}var edge=c[pane].edge,isOpen=$P.is(":visible"),spacing=(isOpen?o.spacing_open:o.spacing_closed),_pane="-"+pane,_state=(isOpen?"-open":"-closed"),$R,$T;$R=$Rs[pane]=$("<span></span>");if(isOpen&&o.resizable){}else{if(!isOpen&&o.slidable){$R.attr("title",o.sliderTip).css("cursor",o.sliderCursor)}}$R.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-resizer":"")).attr("resizer",pane).css(c.resizers.cssReq).css(edge,cDims[edge]+getPaneSize(pane)).addClass(rClass+" "+rClass+_pane+" "+rClass+_state+" "+rClass+_pane+_state).appendTo($Container);if(o.applyDefaultStyles){$R.css(c.resizers.cssDef)}if(o.closable){$T=$Ts[pane]=$("<div></div>");$T.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-toggler":"")).css(c.togglers.cssReq).attr("title",(isOpen?o.togglerTip_open:o.togglerTip_closed)).click(function(evt){toggle(pane);
evt.stopPropagation()}).mouseover(function(evt){evt.stopPropagation()}).addClass(tClass+" "+tClass+_pane+" "+tClass+_state+" "+tClass+_pane+_state).appendTo($R);if(o.togglerContent_open){$("<span>"+o.togglerContent_open+"</span>").addClass("content content-open").css("display",s.isClosed?"none":"block").appendTo($T)}if(o.togglerContent_closed){$("<span>"+o.togglerContent_closed+"</span>").addClass("content content-closed").css("display",s.isClosed?"block":"none").appendTo($T)}if(o.applyDefaultStyles){$T.css(c.togglers.cssDef)}if(!isOpen){bindStartSlidingEvent(pane,true)}}});sizeHandles("all",true)};var initResizable=function(){var draggingAvailable=(typeof $.fn.draggable=="function"),minPosition,maxPosition,edge;$.each(c.borderPanes.split(","),function(){var pane=str(this),o=options[pane],s=state[pane];if(!draggingAvailable||!$Ps[pane]||!o.resizable){o.resizable=false;return true}var rClass=o.resizerClass,dragClass=rClass+"-drag",dragPaneClass=rClass+"-"+pane+"-drag",draggingClass=rClass+"-dragging",draggingPaneClass=rClass+"-"+pane+"-dragging",draggingClassSet=false,$P=$Ps[pane],$R=$Rs[pane];
if(!s.isClosed){$R.attr("title",o.resizerTip).css("cursor",o.resizerCursor)}$R.draggable({containment:$Container[0],axis:(c[pane].dir=="horz"?"y":"x"),delay:200,distance:1,helper:"clone",opacity:o.resizerDragOpacity,zIndex:c.zIndex.resizing,start:function(e,ui){if(false===execUserCallback(pane,o.onresize_start)){return false}s.isResizing=true;clearTimer(pane,"closeSlider");$R.addClass(dragClass+" "+dragPaneClass);draggingClassSet=false;var resizerWidth=(pane=="east"||pane=="south"?o.spacing_open:0);setPaneMinMaxSizes(pane);s.minPosition-=resizerWidth;s.maxPosition-=resizerWidth;edge=(c[pane].dir=="horz"?"top":"left");$(o.maskIframesOnResize===true?"iframe":o.maskIframesOnResize).each(function(){$('<div class="ui-layout-mask"/>').css({background:"#fff",opacity:"0.001",zIndex:9,position:"absolute",width:this.offsetWidth+"px",height:this.offsetHeight+"px"}).css($(this).offset()).appendTo(this.parentNode)})},drag:function(e,ui){if(!draggingClassSet){$(".ui-draggable-dragging").addClass(draggingClass+" "+draggingPaneClass).children().css("visibility","hidden");
draggingClassSet=true;if(s.isSliding){$Ps[pane].css("zIndex",c.zIndex.sliding)}}if(ui.position[edge]<s.minPosition){ui.position[edge]=s.minPosition}else{if(ui.position[edge]>s.maxPosition){ui.position[edge]=s.maxPosition}}},stop:function(e,ui){var dragPos=ui.position,resizerPos,newSize;$R.removeClass(dragClass+" "+dragPaneClass);switch(pane){case"north":resizerPos=dragPos.top;break;case"west":resizerPos=dragPos.left;break;case"south":resizerPos=cDims.outerHeight-dragPos.top-$R.outerHeight();break;case"east":resizerPos=cDims.outerWidth-dragPos.left-$R.outerWidth();break}newSize=resizerPos-cDims[c[pane].edge];sizePane(pane,newSize);$("div.ui-layout-mask").remove();s.isResizing=false}})})};var hide=function(pane,onInit){var o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||s.isHidden){return}if(false===execUserCallback(pane,o.onhide_start)){return}s.isSliding=false;if($R){$R.hide()}if(onInit||s.isClosed){s.isClosed=true;s.isHidden=true;$P.hide();sizeMidPanes(c[pane].dir=="horz"?"all":"center");
execUserCallback(pane,o.onhide_end||o.onhide)}else{s.isHiding=true;close(pane,false)}};var show=function(pane,openPane){var o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||!s.isHidden){return}if(false===execUserCallback(pane,o.onshow_start)){return}s.isSliding=false;s.isShowing=true;if($R&&o.spacing_open>0){$R.show()}if(openPane===false){close(pane,true)}else{open(pane)}};var toggle=function(pane){var s=state[pane];if(s.isHidden){show(pane)}else{if(s.isClosed){open(pane)}else{close(pane)}}};var close=function(pane,force,noAnimation){var $P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&!s.isClosed&&(o.fxName_close!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_sliding="-sliding",_closed="-closed",isShowing=s.isShowing,isHiding=s.isHiding;delete s.isShowing;delete s.isHiding;if(!$P||(!o.resizable&&!o.closable)){return}else{if(!force&&s.isClosed&&!isShowing){return}}if(c.isLayoutBusy){setFlowCallback("close",pane,force);
return}if(!isShowing&&false===execUserCallback(pane,o.onclose_start)){return}c[pane].isMoving=true;c.isLayoutBusy=true;s.isClosed=true;if(isHiding){s.isHidden=true}else{if(isShowing){s.isHidden=false}}syncPinBtns(pane,false);if(!s.isSliding){sizeMidPanes(c[pane].dir=="horz"?"all":"center")}if($R){$R.css(edge,cDims[edge]).removeClass(rClass+_open+" "+rClass+_pane+_open).removeClass(rClass+_sliding+" "+rClass+_pane+_sliding).addClass(rClass+_closed+" "+rClass+_pane+_closed);if(o.resizable){$R.draggable("disable").css("cursor","default").attr("title","")}if($T){$T.removeClass(tClass+_open+" "+tClass+_pane+_open).addClass(tClass+_closed+" "+tClass+_pane+_closed).attr("title",o.togglerTip_closed)}sizeHandles()}if(doFX){lockPaneForFX(pane,true);$P.hide(o.fxName_close,o.fxSettings_close,o.fxSpeed_close,function(){lockPaneForFX(pane,false);if(!s.isClosed){return}close_2()})}else{$P.hide();close_2()}function close_2(){bindStartSlidingEvent(pane,true);if(!isShowing){execUserCallback(pane,o.onclose_end||o.onclose)
}if(isShowing){execUserCallback(pane,o.onshow_end||o.onshow)}if(isHiding){execUserCallback(pane,o.onhide_end||o.onhide)}execFlowCallback(pane)}};var open=function(pane,slide,noAnimation){var $P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&s.isClosed&&(o.fxName_open!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_closed="-closed",_sliding="-sliding",isShowing=s.isShowing;delete s.isShowing;if(!$P||(!o.resizable&&!o.closable)){return}else{if(!s.isClosed&&!s.isSliding){return}}if(s.isHidden&&!isShowing){show(pane,true);return}if(c.isLayoutBusy){setFlowCallback("open",pane,slide);return}if(false===execUserCallback(pane,o.onopen_start)){return}c[pane].isMoving=true;c.isLayoutBusy=true;if(s.isSliding&&!slide){bindStopSlidingEvents(pane,false)}s.isClosed=false;if(isShowing){s.isHidden=false}setPaneMinMaxSizes(pane);if(s.size>s.maxSize){$P.css(c[pane].sizeType,max(1,cssSize(pane,s.maxSize)))}bindStartSlidingEvent(pane,false);
if(doFX){lockPaneForFX(pane,true);$P.show(o.fxName_open,o.fxSettings_open,o.fxSpeed_open,function(){lockPaneForFX(pane,false);if(s.isClosed){return}open_2()})}else{$P.show();open_2()}function open_2(){if(!s.isSliding){sizeMidPanes(c[pane].dir=="vert"?"center":"all")}if($R){$R.css(edge,cDims[edge]+getPaneSize(pane)).removeClass(rClass+_closed+" "+rClass+_pane+_closed).addClass(rClass+_open+" "+rClass+_pane+_open).addClass(!s.isSliding?"":rClass+_sliding+" "+rClass+_pane+_sliding);if(o.resizable){$R.draggable("enable").css("cursor",o.resizerCursor).attr("title",o.resizerTip)}else{$R.css("cursor","default")}if($T){$T.removeClass(tClass+_closed+" "+tClass+_pane+_closed).addClass(tClass+_open+" "+tClass+_pane+_open).attr("title",o.togglerTip_open)}sizeHandles("all")}sizeContent(pane);syncPinBtns(pane,!s.isSliding);execUserCallback(pane,o.onopen_end||o.onopen);if(isShowing){execUserCallback(pane,o.onshow_end||o.onshow)}execFlowCallback(pane)}};var lockPaneForFX=function(pane,doLock){var $P=$Ps[pane];
if(doLock){$P.css({zIndex:c.zIndex.animation});if(pane=="south"){$P.css({top:cDims.top+cDims.innerHeight-$P.outerHeight()})}else{if(pane=="east"){$P.css({left:cDims.left+cDims.innerWidth-$P.outerWidth()})}}}else{if(!state[pane].isSliding){$P.css({zIndex:c.zIndex.pane_normal})}if(pane=="south"){$P.css({top:"auto"})}else{if(pane=="east"){$P.css({left:"auto"})}}}};var bindStartSlidingEvent=function(pane,enable){var o=options[pane],$R=$Rs[pane],trigger=o.slideTrigger_open;if(!$R||!o.slidable){return}if(trigger!="click"&&trigger!="dblclick"&&trigger!="mouseover"){trigger="click"}$R[enable?"bind":"unbind"](trigger,slideOpen).css("cursor",(enable?o.sliderCursor:"default")).attr("title",(enable?o.sliderTip:""))};var bindStopSlidingEvents=function(pane,enable){var o=options[pane],s=state[pane],trigger=o.slideTrigger_close,action=(enable?"bind":"unbind"),$P=$Ps[pane],$R=$Rs[pane];s.isSliding=enable;clearTimer(pane,"closeSlider");$P.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.pane_normal)});$R.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.resizer_normal)});
if(trigger!="click"&&trigger!="mouseout"){trigger="mouseout"}if(enable){$P.bind(trigger,slideClosed);$R.bind(trigger,slideClosed);if(trigger="mouseout"){$P.bind("mouseover",cancelMouseOut);$R.bind("mouseover",cancelMouseOut)}}else{$P.unbind(trigger);$R.unbind(trigger);if(trigger="mouseout"){$P.unbind("mouseover");$R.unbind("mouseover");clearTimer(pane,"closeSlider")}}function cancelMouseOut(evt){clearTimer(pane,"closeSlider");evt.stopPropagation()}};var slideOpen=function(){var pane=$(this).attr("resizer");if(state[pane].isClosed){bindStopSlidingEvents(pane,true);open(pane,true)}};var slideClosed=function(){var $E=$(this),pane=$E.attr("pane")||$E.attr("resizer"),o=options[pane],s=state[pane];if(s.isClosed||s.isResizing){return}else{if(o.slideTrigger_close=="click"){close_NOW()}else{setTimer(pane,"closeSlider",close_NOW,300)}}function close_NOW(){bindStopSlidingEvents(pane,false);if(!s.isClosed){close(pane)}}};var sizePane=function(pane,size){var edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];
setPaneMinMaxSizes(pane);s.minSize=max(s.minSize,o.minSize);if(o.maxSize>0){s.maxSize=min(s.maxSize,o.maxSize)}size=max(size,s.minSize);size=min(size,s.maxSize);s.size=size;$R.css(edge,size+cDims[edge]);$P.css(c[pane].sizeType,max(1,cssSize(pane,size)));if(!s.isSliding){sizeMidPanes(dir=="horz"?"all":"center")}sizeHandles();sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize)};var sizeMidPanes=function(panes,overrideDims,onInit){if(!panes||panes=="all"){panes="east,west,center"}var d=getPaneDims();if(overrideDims){$.extend(d,overrideDims)}$.each(panes.split(","),function(){if(!$Ps[this]){return}var pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],hasRoom=true,CSS={};if(pane=="center"){d=getPaneDims();CSS=$.extend({},d);CSS.width=max(1,cssW(pane,CSS.width));CSS.height=max(1,cssH(pane,CSS.height));hasRoom=(CSS.width>1&&CSS.height>1);if($.browser.msie&&(!$.boxModel||$.browser.version<7)){if($Ps.north){$Ps.north.css({width:cssW($Ps.north,cDims.innerWidth)})
}if($Ps.south){$Ps.south.css({width:cssW($Ps.south,cDims.innerWidth)})}}}else{CSS.top=d.top;CSS.bottom=d.bottom;CSS.height=max(1,cssH(pane,d.height));hasRoom=(CSS.height>1)}if(hasRoom){$P.css(CSS);if(s.noRoom){s.noRoom=false;if(s.isHidden){return}else{show(pane,!s.isClosed)}}if(!onInit){sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize)}}else{if(!s.noRoom){s.noRoom=true;if(s.isHidden){return}if(onInit){$P.hide();if($R){$R.hide()}}else{hide(pane)}}}})};var sizeContent=function(panes){if(!panes||panes=="all"){panes=c.allPanes}$.each(panes.split(","),function(){if(!$Cs[this]){return}var pane=str(this),ignore=options[pane].contentIgnoreSelector,$P=$Ps[pane],$C=$Cs[pane],e_C=$C[0],height=cssH($P);$P.children().each(function(){if(this==e_C){return}var $E=$(this);if(!ignore||!$E.is(ignore)){height-=$E.outerHeight()}});if(height>0){height=cssH($C,height)}if(height<1){$C.hide()}else{$C.css({height:height}).show()}})};var sizeHandles=function(panes,onInit){if(!panes||panes=="all"){panes=c.borderPanes
}$.each(panes.split(","),function(){var pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane];if(!$P||!$R||(!o.resizable&&!o.closable)){return}var dir=c[pane].dir,_state=(s.isClosed?"_closed":"_open"),spacing=o["spacing"+_state],togAlign=o["togglerAlign"+_state],togLen=o["togglerLength"+_state],paneLen,offset,CSS={};if(spacing==0){$R.hide();return}else{if(!s.noRoom&&!s.isHidden){$R.show()}}if(dir=="horz"){paneLen=$P.outerWidth();$R.css({width:max(1,cssW($R,paneLen)),height:max(1,cssH($R,spacing)),left:cssNum($P,"left")})}else{paneLen=$P.outerHeight();$R.css({height:max(1,cssH($R,paneLen)),width:max(1,cssW($R,spacing)),top:cDims.top+getPaneSize("north",true)})}if($T){if(togLen==0||(s.isSliding&&o.hideTogglerOnSlide)){$T.hide();return}else{$T.show()}if(!(togLen>0)||togLen=="100%"||togLen>paneLen){togLen=paneLen;offset=0}else{if(typeof togAlign=="string"){switch(togAlign){case"top":case"left":offset=0;break;case"bottom":case"right":offset=paneLen-togLen;break;
case"middle":case"center":default:offset=Math.floor((paneLen-togLen)/2)}}else{var x=parseInt(togAlign);if(togAlign>=0){offset=x}else{offset=paneLen-togLen+x}}}var $TC_o=(o.togglerContent_open?$T.children(".content-open"):false),$TC_c=(o.togglerContent_closed?$T.children(".content-closed"):false),$TC=(s.isClosed?$TC_c:$TC_o);if($TC_o){$TC_o.css("display",s.isClosed?"none":"block")}if($TC_c){$TC_c.css("display",s.isClosed?"block":"none")}if(dir=="horz"){var width=cssW($T,togLen);$T.css({width:max(0,width),height:max(1,cssH($T,spacing)),left:offset});if($TC){$TC.css("marginLeft",Math.floor((width-$TC.outerWidth())/2))}}else{var height=cssH($T,togLen);$T.css({height:max(0,height),width:max(1,cssW($T,spacing)),top:offset});if($TC){$TC.css("marginTop",Math.floor((height-$TC.outerHeight())/2))}}}if(onInit&&o.initHidden){$R.hide();if($T){$T.hide()}}})};var resizeAll=function(){var oldW=cDims.innerWidth,oldH=cDims.innerHeight;cDims=state.container=getElemDims($Container);var checkH=(cDims.innerHeight<oldH),checkW=(cDims.innerWidth<oldW),s,dir;
if(checkH||checkW){$.each(["south","north","east","west"],function(i,pane){s=state[pane];dir=c[pane].dir;if(!s.isClosed&&((checkH&&dir=="horz")||(checkW&&dir=="vert"))){setPaneMinMaxSizes(pane);if(s.size>s.maxSize){sizePane(pane,s.maxSize)}}})}sizeMidPanes("all");sizeHandles("all")};function keyDown(evt){if(!evt){return true}var code=evt.keyCode;if(code<33){return true}var PANE={38:"north",40:"south",37:"west",39:"east"},isCursorKey=(code>=37&&code<=40),ALT=evt.altKey,SHIFT=evt.shiftKey,CTRL=evt.ctrlKey,pane=false,s,o,k,m,el;if(!CTRL&&!SHIFT){return true}else{if(isCursorKey&&options[PANE[code]].enableCursorHotkey){pane=PANE[code]}else{$.each(c.borderPanes.split(","),function(i,p){o=options[p];k=o.customHotkey;m=o.customHotkeyModifier;if((SHIFT&&m=="SHIFT")||(CTRL&&m=="CTRL")||(CTRL&&SHIFT)){if(k&&code==(isNaN(k)||k<=9?k.toUpperCase().charCodeAt(0):k)){pane=p;return false}}})}}if(!pane){return true}o=options[pane];s=state[pane];if(!o.enableCursorHotkey||s.isHidden||!$Ps[pane]){return true
}el=evt.target||evt.srcElement;if(el&&SHIFT&&isCursorKey&&(el.tagName=="TEXTAREA"||(el.tagName=="INPUT"&&(code==37||code==39)))){return true}toggle(pane);evt.stopPropagation();evt.returnValue=false;return false}function allowOverflow(elem){if(this&&this.tagName){elem=this}var $P;if(typeof elem=="string"){$P=$Ps[elem]}else{if($(elem).attr("pane")){$P=$(elem)}else{$P=$(elem).parents("div[pane]:first")}}if(!$P.length){return}var pane=$P.attr("pane"),s=state[pane];if(s.cssSaved){resetOverflow(pane)}if(s.isSliding||s.isResizing||s.isClosed){s.cssSaved=false;return}var newCSS={zIndex:(c.zIndex.pane_normal+1)},curCSS={},of=$P.css("overflow"),ofX=$P.css("overflowX"),ofY=$P.css("overflowY");if(of!="visible"){curCSS.overflow=of;newCSS.overflow="visible"}if(ofX&&ofX!="visible"&&ofX!="auto"){curCSS.overflowX=ofX;newCSS.overflowX="visible"}if(ofY&&ofY!="visible"&&ofY!="auto"){curCSS.overflowY=ofX;newCSS.overflowY="visible"}s.cssSaved=curCSS;$P.css(newCSS);$.each(c.allPanes.split(","),function(i,p){if(p!=pane){resetOverflow(p)
}})}function resetOverflow(elem){if(this&&this.tagName){elem=this}var $P;if(typeof elem=="string"){$P=$Ps[elem]}else{if($(elem).hasClass("ui-layout-pane")){$P=$(elem)}else{$P=$(elem).parents("div[pane]:first")}}if(!$P.length){return}var pane=$P.attr("pane"),s=state[pane],CSS=s.cssSaved||{};if(!s.isSliding&&!s.isResizing){$P.css("zIndex",c.zIndex.pane_normal)}$P.css(CSS);s.cssSaved=false}function getBtn(selector,pane,action){var $E=$(selector),err="Error Adding Button \n\nInvalid ";if(!$E.length){alert(err+"selector: "+selector)}else{if(c.borderPanes.indexOf(pane)==-1){alert(err+"pane: "+pane)}else{var btn=options[pane].buttonClass+"-"+action;$E.addClass(btn+" "+btn+"-"+pane);return $E}}return false}function addToggleBtn(selector,pane){var $E=getBtn(selector,pane,"toggle");if($E){$E.attr("title",state[pane].isClosed?"Open":"Close").click(function(evt){toggle(pane);evt.stopPropagation()})}}function addOpenBtn(selector,pane){var $E=getBtn(selector,pane,"open");if($E){$E.attr("title","Open").click(function(evt){open(pane);
evt.stopPropagation()})}}function addCloseBtn(selector,pane){var $E=getBtn(selector,pane,"close");if($E){$E.attr("title","Close").click(function(evt){close(pane);evt.stopPropagation()})}}function addPinBtn(selector,pane){var $E=getBtn(selector,pane,"pin");if($E){var s=state[pane];$E.click(function(evt){setPinState($(this),pane,(s.isSliding||s.isClosed));if(s.isSliding||s.isClosed){open(pane)}else{close(pane)}evt.stopPropagation()});setPinState($E,pane,(!s.isClosed&&!s.isSliding));c[pane].pins.push(selector)}}function syncPinBtns(pane,doPin){$.each(c[pane].pins,function(i,selector){setPinState($(selector),pane,doPin)})}function setPinState($Pin,pane,doPin){var updown=$Pin.attr("pin");if(updown&&doPin==(updown=="down")){return}var root=options[pane].buttonClass,class1=root+"-pin",class2=class1+"-"+pane,UP1=class1+"-up",UP2=class2+"-up",DN1=class1+"-down",DN2=class2+"-down";$Pin.attr("pin",doPin?"down":"up").attr("title",doPin?"Un-Pin":"Pin").removeClass(doPin?UP1:DN1).removeClass(doPin?UP2:DN2).addClass(doPin?DN1:UP1).addClass(doPin?DN2:UP2)
}var $Container=$(this).css({overflow:"hidden"}),$Ps={},$Cs={},$Rs={},$Ts={},c=config,cDims=state.container;create();return{options:options,state:state,panes:$Ps,toggle:toggle,open:open,close:close,hide:hide,show:show,resizeContent:sizeContent,sizePane:sizePane,resizeAll:resizeAll,addToggleBtn:addToggleBtn,addOpenBtn:addOpenBtn,addCloseBtn:addCloseBtn,addPinBtn:addPinBtn,allowOverflow:allowOverflow,resetOverflow:resetOverflow,cssWidth:cssW,cssHeight:cssH}}})(jQuery);(function(){var c;c=jQuery.fn.flash=function(h,g,e,j){var i=e||c.replace;g=c.copy(c.pluginOptions,g);if(!c.hasFlash(g.version)){if(g.expressInstall&&c.hasFlash(6,0,65)){var f={flashvars:{MMredirectURL:location,MMplayerType:"PlugIn",MMdoctitle:jQuery("title").text()}}}else{if(g.update){i=j||c.update}else{return this}}}h=c.copy(c.htmlOptions,f,h);return this.each(function(){i.call(this,c.copy(h))})};c.copy=function(){var g={},f={};for(var h=0;h<arguments.length;h++){var e=arguments[h];if(e==undefined){continue}jQuery.extend(g,e);
if(e.flashvars==undefined){continue}jQuery.extend(f,e.flashvars)}g.flashvars=f;return g};c.hasFlash=function(){if(/hasFlash\=true/.test(location)){return true}if(/hasFlash\=false/.test(location)){return false}var f=c.hasFlash.playerVersion().match(/\d+/g);var g=String([arguments[0],arguments[1],arguments[2]]).match(/\d+/g)||String(c.pluginOptions.version).match(/\d+/g);for(var e=0;e<3;e++){f[e]=parseInt(f[e]||0);g[e]=parseInt(g[e]||0);if(f[e]<g[e]){return false}if(f[e]>g[e]){return true}}return true};c.hasFlash.playerVersion=function(){try{try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{f.AllowScriptAccess="always"}catch(g){return"6,0,0"}}catch(g){}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(g){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]
}}catch(g){}}return"0,0,0"};c.htmlOptions={height:240,flashvars:{},pluginspage:"http://www.adobe.com/go/getflashplayer",src:"#",type:"application/x-shockwave-flash",width:320};c.pluginOptions={expressInstall:false,update:true,version:"6.0.65"};c.replace=function(f){var e=this.innerHTML;jQuery(this).empty().append($("<div />").addClass("alt").html(e));jQuery(this).addClass("flash-replaced").prepend(c.transform(f))};c.update=function(f){var e=String(location).split("?");e.splice(1,0,"?hasFlash=true&");e=e.join("");var g='<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+e+'">Click here.</a></p>';this.innerHTML='<span class="alt">'+this.innerHTML+"</span>";jQuery(this).addClass("flash-update").prepend(g)};function b(){var f="";for(var e in this){if(typeof this[e]!="function"){f+=e+'="'+this[e]+'" '}}return f}function d(){var f="";for(var e in this){if(typeof this[e]!="function"){f+=e+"="+encodeURIComponent(this[e])+"&"
}}return f.replace(/&$/,"")}c.transform=function(e){e.toString=b;if(e.flashvars){e.flashvars.toString=d}return"<embed "+String(e)+"/>"};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}})();(function(c){function b(){this._curHash="";this._callback=function(d){}}c.extend(b.prototype,{init:function(e){this._callback=e;this._curHash=location.hash;if(c.browser.msie){if(this._curHash==""){this._curHash="#"}c("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var d=c("#jQuery_history")[0].contentWindow.document;d.open();d.close();d.location.hash=this._curHash}else{if(c.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false}}this._callback(this._curHash.replace(/^#/,""));setInterval(this._check,100)},add:function(d){this._historyBackStack.push(d);this._historyForwardStack.length=0;
this._isFirst=true},_check:function(){if(c.browser.msie){var d=c("#jQuery_history")[0];var g=d.contentDocument||d.contentWindow.document;var j=g.location.hash;if(j!=c.history._curHash){location.hash=j;c.history._curHash=j;c.history._callback(j.replace(/^#/,""))}}else{if(c.browser.safari){if(!c.history._dontCheck){var e=history.length-c.history._historyBackStack.length;if(e){c.history._isFirst=false;if(e<0){for(var f=0;f<Math.abs(e);f++){c.history._historyForwardStack.unshift(c.history._historyBackStack.pop())}}else{for(var f=0;f<e;f++){c.history._historyBackStack.push(c.history._historyForwardStack.shift())}}var h=c.history._historyBackStack[c.history._historyBackStack.length-1];if(h!=undefined){c.history._curHash=location.hash;c.history._callback(h)}}else{if(c.history._historyBackStack[c.history._historyBackStack.length-1]==undefined&&!c.history._isFirst){if(document.URL.indexOf("#")>=0){c.history._callback(document.URL.split("#")[1])}else{c.history._callback("")}c.history._isFirst=true
}}}}else{var j=location.hash;if(j!=c.history._curHash){c.history._curHash=j;c.history._callback(j.replace(/^#/,""))}}}},load:function(g){var h;if(c.browser.safari){h=g}else{h="#"+g;location.hash=h}this._curHash=h;if(c.browser.msie){var d=c("#jQuery_history")[0];var f=d.contentWindow.document;f.open();f.close();f.location.hash=h;this._callback(g)}else{if(c.browser.safari){this._dontCheck=true;this.add(g);var e=function(){c.history._dontCheck=false};window.setTimeout(e,200);this._callback(g);location.hash=h}else{this._callback(g)}}}});c(document).ready(function(){c.history=new b()})})(jQuery);(function(b){b.extend({noticeAdd:function(d){var g={inEffect:{opacity:"show"},inEffectDuration:600,stayTime:3000,text:"",stay:false,type:"notice"};var d,h,f,e,c;d=b.extend({},g,d);h=(!b(".notice-wrap").length)?b("<div></div>").addClass("notice-wrap").appendTo("body"):b(".notice-wrap");f=b("<div></div>").addClass("notice-item-wrapper");e=b("<div></div>").hide().addClass("notice-item "+d.type).appendTo(h).html("<p>"+d.text+"</p>").animate(d.inEffect,d.inEffectDuration).wrap(f);
c=b("<div></div>").addClass("notice-item-close").prependTo(e).html("x").click(function(){b.noticeRemove(e)});if(navigator.userAgent.match(/MSIE 6/i)){h.css({top:document.documentElement.scrollTop})}if(!d.stay){setTimeout(function(){b.noticeRemove(e)},d.stayTime)}},noticeRemove:function(c){c.animate({opacity:"0"},600,function(){c.parent().animate({height:"0px"},300,function(){c.parent().remove()})})}})})(jQuery);(function(c){EMPTY_FUNCTION=function(){};var b=/msie 7/.test(navigator.userAgent.toLowerCase());c.traccordiontab=function(d,f){var e=this;this.options=c.extend({},c.traccordiontab.defaults,f);this.accordion=d;this.container=c("<div />").addClass(this.accordion.options.tabContainerClass);this.container.empty().append(this.header=c("<div />").addClass("tra-tabheader").addClass(this.accordion.options.tabHeaderClass).append(this.options.headerContent).bind("click.tra",function(){e.options.onHeaderClick.apply(e);e.select()})).append(this.collapsible=c("<div />").addClass(this.accordion.options.tabCollapsibleClass).css({border:"none",padding:"0",margin:"0"}).append(this.content=c("<div />").addClass(this.accordion.options.tabContentClass).css({overflowY:"auto"})).append(this.footer=c("<div />").addClass("tra-tabfooter").addClass(this.accordion.options.tabFooterClass).append(this.options.footerContent)));
d._onTabAttach(this,this.options.tabIndex,this.options.autoOpen)};c.traccordiontab.defaults={headerContent:"",footerContent:"",tabIndex:-1,autoOpen:false,constructElement:false,getItemId:false,onOpen:function(){},onHeaderClick:function(){},emptyHelpContent:""};c.traccordiontab.prototype={_appear:function(d,e){e=e||EMPTY_FUNCTION;if(d){this.container.slideDown(d,e)}else{this.container.show();e()}},_disappear:function(d,e){e=e||EMPTY_FUNCTION;if(d){this.container.slideUp(d,e)}else{this.container.hide();e()}},_close:function(d,e){e=e||EMPTY_FUNCTION;if(d&&!b){this.collapsible.slideUp(d,e)}else{this.collapsible.hide();e()}this.header.removeClass("tra-selected")},_open:function(e,f){f=f||EMPTY_FUNCTION;var d=this;if(e&&!b){this.collapsible.slideDown(e,function(){d.options.onOpen.apply(d);f()})}else{this.collapsible.show();this.options.onOpen.apply(this);f()}this.header.addClass("tra-selected")},_resizeTo:function(e){var d=this.content.outerHeight()-this.content.height();this.content.height(e-this.accordion.options.tabFooterHeight-d)
},_cleanup:function(){this.container.empty();delete this.container;delete this.accordion;delete this.header;delete this.collapsible;delete this.content;delete this.footer},headerContent:function(d){if(typeof(d)=="undefined"){return this.header}this.header.empty();this.header.append(d)},footerContent:function(d){if(typeof(d)=="undefined"){return this.footer}this.footer.empty();this.footer.append(d)},mainContent:function(d){if(typeof(d)=="undefined"){return this.content}this.content.empty();this.content.append(d)},isSelected:function(){return this.accordion.isTabSelected(this)},select:function(d){this.accordion.selectTab(this,d)},isVisible:function(){return this.accordion.isTabVisible(this)}};c.tritemsaccordiontab=function(d,e){this.items=[];this.idToItem={};this.idToContainer={};c.traccordiontab.apply(this,arguments);if(!this.options.constructElement||!this.options.getItemId){alert("$.tritemsaccordiontab needs constructElement and getItemId options")}this.content.append(this.subHeader=c("<div />").addClass("tra-subheader"));
this.content.append(this.listContainer=c("<div />"));this.content.append(this.waitingContainer=c("<div />").text("please wait..."));this.content.append(this.helpContainer=c("<div />").append(this.options.emptyHelpContent));this.container.addClass("tra-noitems");this.subHeader.hide();this.waitingContainer.hide()};c.tritemsaccordiontab.prototype=c.extend({},c.traccordiontab.prototype,{_cleanup:function(){delete this.items;delete this.idToItem;delete this.idToContainer;c.traccordiontab.prototype._cleanup.apply(this,arguments)},_reindex:function(){for(var d=0;d<this.items.length;d++){this.items[d]._index=d}},_getContainer:function(d){var e=d.constructor==Number?d:this.options.getItemId(d);return this.idToContainer[e]},_setContainer:function(e,d){var f=e.constructor==Number?e:this.options.getItemId(e);if(d){this.idToContainer[f]=d}else{delete this.idToContainer[f]}return d},_addItem:function(g,f,d){f=f||this.items.length;d=!!d;if(f<0||f>this.items.length){f=this.items.length}var e=this._setContainer(g,c(this.options.constructElement(g)).addClass("tra-item"));
if(f==this.items.length){this.listContainer.append(e)}else{this._getContainer(this.items[f]).before(e)}if(this.items.length==0){this.container.removeClass("tra-noitems");this.container.addClass("tra-hasitems");this.helpContainer.hide()}this.items.splice(f,0,g);this.idToItem[this.options.getItemId(g)]=g;this._reindex();g.__used=true;return g},_removeItem:function(g,d){d=!!d;var f=g.constructor==Number?g:this.idToItem[this.options.getItemId(g)]._index;if(f<0||f>=this.items.length){f=this.items.length-1}if(f<0){return}var g=this.items[f];var e=this._getContainer(g);this.items.splice(f,1);delete this.idToItem[this.options.getItemId(g)];this._setContainer(g);this._reindex();if(this.items.length==0){this.container.removeClass("tra-hasitems");this.container.addClass("tra-noitems");this.helpContainer.show()}if(!d){e.hide(this.accordion.options.animationSpeed,function(){e.remove()})}else{e.empty();e.remove()}if(this.selected==g){this.selected=false}},_updateItem:function(f,d){d=!!d;var i=this.idToItem[this.options.getItemId(f)];
var h=this._getContainer(i);var g=c(this.options.constructElement(f)).addClass("tra-item");var e=i._index;this.items[e]=f;this.idToItem[this.options.getItemId(f)]=f;this._reindex();h.before(g);this._setContainer(f,g);h.empty().remove();f.__used=true},showWait:function(){this.waitingContainer.show();this.listContainer.hide()},hideWait:function(){this.waitingContainer.hide();this.listContainer.show()},addItem:function(g,f,e,d){this.addItems([g],f,e,d)},addItems:function(f,g,e,d){e=!!e;for(var h=f.length-1;h>=0;h--){this._addItem(f[h],g,d)}if(e&&f.length>0){this.scrollTo(f[0])}},removeItem:function(e,d){this.removeItems([e],d)},removeItems:function(e,d){for(var f=0;f<e.length;f++){this._removeItem(e[f],d)}},removeAllItems:function(d){for(var e=this.items.length-1;e>=0;e--){this._removeItem(e,d)}},updateItem:function(e,d){this._updateItem(e,d)},containsItem:function(d){if(d.constructor==Number){return !!this.idToItem[d]}return this.idToItem[this.options.getItemId(d)]},startUpdate:function(){c.each(this.items,function(){this.__used=false
})},endUpdateAndRemoveUnused:function(d){var e=c.grep(this.items,function(f){return !f.__used});this.removeItems(e,d)},scrollTo:function(f){try{var d=this._getContainer(f).position().top;this.content.stop();this.content.animate({scrollTop:this.content.scrollTop()+d-36},"fast")}catch(g){this._getContainer(f).log("failed position")}},subHeaderContent:function(d){if(typeof(d)=="undefined"){return this.subHeader}this.subHeader.empty();this.subHeader.append(d);if(d){this.subHeader.show()}else{this.subHeader.hide()}},selectItem:function(e){if(this.selected&&this._getContainer(this.selected)){this._getContainer(this.selected).removeClass("selected");this.selected=null}if(e){var d=this._getContainer(e);this.scrollTo(e);this._getContainer(e).addClass("selected");this.selected=e}},unselectItems:function(){this.selectItem(null)},count:function(){return this.items.length}});c.trdatasourceaccordiontab=function(d,f){this.datasource=null;c.tritemsaccordiontab.apply(this,arguments);if(!this.options.dataSource){alert("$.trdatasourceaccordiontab needs dataSource option")
}var e=this;this.options.dataSource.addObserver(this.statusChangedFunction=function(g){e._onDataSourceStatusChanged(g)})};c.trdatasourceaccordiontab.prototype=c.extend({},c.tritemsaccordiontab.prototype,{_cleanup:function(){this.options.dataSource.removeObserver(this.statusChangedFunction);this.statusChangedFunction=null;c.tritemsaccordiontab.prototype._cleanup.apply(this,arguments)},_onDataSourceStatusChanged:function(d){var e=this;switch(d){case"loaded":this.startUpdate();c.each(e.options.dataSource.getData(),function(f){if(e.containsItem(this)){e.updateItem(this,false,true)}else{e.addItem(this,f,false,true)}});this.selectItem(this.selected);this.endUpdateAndRemoveUnused();this.hideWait();break;case"idle":if(this.isSelected()){this.options.dataSource.ensureData()}break;default:this.showWait();break}},_open:function(){c.tritemsaccordiontab.prototype._open.apply(this,arguments);this.options.dataSource.ensureData()},getDataSource:function(){return this.options.dataSource}});c.traccordion=function(i,f){var e=this;
this.options=c.extend({},c.traccordion.defaults,f);this.container=c(i).addClass(this.options.containerClass);var h=this.container.find(".tra-header-content");var d=this.container.find(".tra-footer-content");var g=this.container.find(".tra-emptyhelp-content");this.tabs=[];this.firstVisibleTab=0;this.firstInvisibleTab=this.options.pageTabCount;this.openedTab=null;this.container.append(this.header=c("<div />").addClass(this.options.headerClass).append(h)).append(this.content=c("<div />").addClass(this.options.contentClass).css({margin:"0",overflowY:"hidden"}).append(this.emptyHelp=c("<div />").addClass(this.options.emptyHelpClass).css({height:"100%",overflowY:"auto"}).append(g))).append(this.footer=c("<div />").addClass(this.options.footerClass).append(d));this.pager=d.find(".tra-pager");if(this.pager.length==0){this.pager=null}this.resize()};c.traccordion.prototype={headerContent:function(d){if(typeof(d)=="undefined"){return this.header}this.header.empty();this.header.append(d)},footerContent:function(d){if(typeof(d)=="undefined"){return this.header
}this.footer.empty();this.footer.append(d)},resize:function(g){g=g||this.container.height();var f=this.content.outerHeight()-this.content.height();var e=g-this.options.headerHeight-this.options.footerHeight-f;this.content.height(e);this.header.height(this.options.headerHeight);this.footer.height(this.options.footerHeight);var d=e-(this.options.pageTabCount)*this.options.tabHeaderHeight;c.each(this.tabs,function(){this._resizeTo(d)})},_tab:function(d){if(d==null){return null}if(d.constructor==Number){return this.tabs[d]}return d},_updatePager:function(){if(!this.pager){return}var e=this;this.pager.empty();if(this.tabs.length==0){return}var j=this.getPage();var g=this.getPageCount();var d=j>4;var f=j<g-5;function k(i){return c("<a />").addClass("tra-pager-page").attr("href","#").text(""+(i+1)).click(function(){e.setPage(i)})}if(d){this.pager.append(k(0)).append("/").append(k(1)).append("...").append(k(j-1)).append("/")}else{for(var h=0;h<j;h++){this.pager.append(k(h));this.pager.append("/")
}}this.pager.append(c("<span />").text(" "+(j+1)+" ").addClass("tra-pager-activepage"));if(f){this.pager.append("/").append(k(j+1)).append("...").append(k(g-2)).append("/").append(k(g-1))}else{for(var h=j+1;h<g;h++){this.pager.append("/");this.pager.append(k(h))}}},isTabVisible:function(d){d=this._tab(d);return this.firstVisibleTab<=d.index&&d.index<this.firstInvisibleTab},isTabSelected:function(d){return this.openedTab==d},getSelectedTab:function(){return this.openedTab},getPage:function(){return Math.floor(this.firstVisibleTab/this.options.pageTabCount)},getPageCount:function(){return Math.floor((this.tabs.length-1)/this.options.pageTabCount)+1},_openTab:function(e,f){f=f||EMPTY_FUNCTION;e=this._tab(e);var d=this;if(d.openedTab){d.openedTab._close(d.openedTab.isVisible()?"fast":undefined)}d.openedTab=e;if(e){d.openedTab._open("fast",f)}this.options.onTabSelected(e)},selectTab:function(e,f){f=f||EMPTY_FUNCTION;e=this._tab(e);if(this.openedTab&&this.openedTab==e){this.options.onTabSelected(e);
this.openedTab._open(null,f);return}var d=this;if(!e){if(d.openedTab){d.openedTab._close(d.openedTab.isVisible()?"fast":undefined)}this.openedTab=null}else{if(this.isTabVisible(e)){d._openTab(e,f)}else{d.setPage(e.pageIndex,f,e)}}},ensureTabVisible:function(d,e){e=e||EMPTY_FUNCTION;d=this._tab(d);if(this.isTabVisible(d)){e();return}this.setPage(d.pageIndex,e)},setPage:function(d,g,f){g=g||EMPTY_FUNCTION;if(this.tabs.length==0){g();return}if(d<0){d=this.getPageCount()-1}if(d<0||this.options.pageTabCount*d>=this.tabs.length){g();return}if(this.firstVisibleTab==d*this.options.pageTabCount){g();return}var e=this;e.openedTab=null;this.content.fadeOut("fast",function(){e.firstVisibleTab=d*e.options.pageTabCount;e.firstInvisibleTab=e.firstVisibleTab+e.options.pageTabCount;c.each(e.tabs,function(h){this._close();if(this.isVisible()){this._appear()}else{this._disappear()}});e._updatePager();e.content.fadeIn("fast",function(){e.resize();f=f||e.firstVisibleTab;e._openTab(f,g)})})},removeTab:function(h){h=this._tab(h);
var d=this;var g=h.isVisible(h);var e=h.index;var i=false;d.tabs.splice(h.index,1);d._reindex();if(d.openedTab==h){d.openedTab=null;i=true}if(g){var f=h.container;h._disappear(d.options.animationSpeed,function(){f.remove()});if(d.firstInvisibleTab-1<this.tabs.length){d.tabs[d.firstInvisibleTab-1]._appear(d.options.animationSpeed)}}else{h.container.remove();if(e<this.firstVisibleTab){if(this.firstVisibleTab-1<this.tabs.length){this.tabs[this.firstVisibleTab-1]._disappear(this.options.animationSpeed)}if(this.firstInvisibleTab-1<this.tabs.length){this.tabs[this.firstInvisibleTab-1]._appear(this.options.animationSpeed)}}}if(this.tabs.length>0&&this.firstVisibleTab>=this.tabs.length){this.setPage(-1)}else{d._updatePager();if(i&&this.tabs.length>0){d._openTab(this.firstVisibleTab)}}if(this.tabs.length==0){this.emptyHelp.show()}h._cleanup()},removeAllTabs:function(){while(this.tabs.length>0){this.removeTab(0)}},_reindex:function(){var e=-1;for(var d=0;d<this.tabs.length;d++){if(d%this.options.pageTabCount==0){e++
}this.tabs[d].pageIndex=e;this.tabs[d].index=d}this.pageCount=e+1},_onTabAttach:function(g,f,d,h){h=h||EMPTY_FUNCTION;d=!!d;if(f>this.tabs.length||f<0){f=this.tabs.length}if(f==this.tabs.length){this.content.append(g.container);this.tabs.push(g)}else{this.tabs[f].container.before(g.container);this.tabs.splice(f,0,g)}g.collapsible.hide();this._reindex();var e=this;if(this.isTabVisible(g)){if(this.firstInvisibleTab<this.tabs.length){this.tabs[this.firstInvisibleTab]._disappear(this.options.animationSpeed)}g._disappear();g._appear(this.options.animationSpeed,function(){e.resize();if(d){e.selectTab(g,h)}else{h()}})}else{if(d){this.selectTab(g,h)}else{g._disappear();if(f<this.firstVisibleTab){if(this.firstInvisibleTab<this.tabs.length){this.tabs[this.firstInvisibleTab]._disappear(this.options.animationSpeed)}this.tabs[this.firstVisibleTab]._appear(this.options.animationSpeed,h)}else{h()}}}this.emptyHelp.hide();this._updatePager()}};c.fn.traccordion=function(e){var d=[];this.each(function(){d.push(new c.traccordion(this,e))
});return d.length==1?d[0]:d};c.traccordion.defaults={headerClass:"tra-header",footerClass:"tra-footer",contentClass:"tra-content",tabContainerClass:"tra-tabcontainer",tabHeaderClass:null,tabContentClass:"tra-tabcontent",tabFooterClass:null,tabCollapsibleClass:"tra-collapsible",visibleClass:"tra-visible",hiddenClass:"tra-hidden",containerClass:"tra-container",selectedClass:"tra-selected",pageTabCount:5,animationSpeed:"fast",tabHeaderHeight:20,tabFooterHeight:25,headerHeight:20,footerHeight:15,emptyHelpClass:"tra-emptyhelp",onTabSelected:function(){}}})(jQuery);(function(g){var c;var j;function d(m,l){m.Clips=g.grep(m.Clips,function(n){return n.ClipId!=l.ClipId||n.MediaId!=l.MediaId});i(m)}function h(n,m,l,p){n.Clips.splice(l,1);n.Clips.splice(p,0,m);i(n)}function b(l){if(c.is(":blank")){return}TRMApi.services.uploadAudio(g("#addNewForm")[0],function(m){l.Clips.push({ClipId:0,MapItemId:0,OrderIndex:l.Clips.length,MediaId:m.MediaAudio.MediaId,Media:m.MediaAudio,Name:m.MediaAudio.FileName});
j(l);i(l)})}j=function(l){g("#addNew_uploadMediaFileSpan").empty().append(c=g('<input type="file" />').attr("name","Data"));c.bind("change",function(){b(l)})};function i(l){g("#addNew_clipHolder > div").remove();g.each(l.Clips,function(n){var p=this;var m=TRMApi.services.getMp3Url(this.MediaId);function q(){var r=g('<div class="clip_row_right" />');r.append(g('<a href="#" />').text("Remove").click(function(){d(l,p)}));if(n>0){r.append(g('<a href="#" />').text("Up").click(function(){h(l,p,n,n-1)}))}if(n<l.Clips.length-1){r.append(g('<a href="#" />').text("Down").click(function(){h(l,p,n,n+1)}))}return r}g("#addNew_clipHolder").append(g("<div />").addClass((n%2==0)?"clip_row_even":"clip_row_odd").append(g('<div class="clip_row_left" />').append(g("<p />").text(this.Name).append(g("<a />").attr("href",m).addClass("mp3player").text("play")))).append(q()))});g("#addNew_clipHolder .mp3player").neolaomp3player();g("#addNew_clipCount").val(l.Clips.length)}function k(m){this._data=m;if(this._data.UserId&&this._data.UserId!=TRMApi.session.user.UserId){g("#addNew_projectId").clearOptions().addOption(this._data.ProjectId,"Not Editable").trigger("change")
}else{g("#addNew_projectId").clearOptions().addOption("0","New").bindOptions(TRMApi.session.projects,{valueProperty:"ProjectId",textProperty:"Name",clear:false}).selectOptions(m.ProjectId).trigger("change")}if(this._data.MapItemId==0&&!this._data.City){var n=TRMApi.util.calculateBoundingBoxOfMapItem(this._data);var l=[(n.SouthWest[0]+n.NorthEast[0])/2,(n.SouthWest[1]+n.NorthEast[1])/2];TRMApi.maps.getNearestCityAndCountry(l,function(p){if(p==null){return}g("#addNew_cityName").val(p.City);g("#addNew_countryCode").selectOptions(p.CountryCode)})}this.form.unserializeMap(m);g("#addNew_image").attr("src",TRMApi.services.getImageThumbnailUrl(m.ImageId));j(m);i(m)}function f(){return this._data=g.extend({},this._data,this.form.serializeMap())}function e(){var l=this;g("#addNew_projectId").change(function(){var m=g("#addNew_newProjectName");if(g(this).val()=="0"){m.val("");m.removeAttr("disabled")}else{m.val(g(this).getSelectedOptionText());m.attr("disabled","disabled")}});g("#addNew_changePicture").click(function(){TRMApi.functions.addImageWithFormat(TRMApi.session.isBannerAdmin()?"PNG":"JPG",function(m){g("#addNew_imageId").val(m.MediaImage.MediaId);
g("#addNew_image").attr("src",TRMApi.services.getImageThumbnailUrl(m.MediaImage.MediaId))})});g("#addNew_validFrom").trdatepicker();g("#addNew_validTo").trdatepicker()}g(document).ready(function(){var l=g("#addNewDialog").registerDialog("addNewDialog",{form:"#addNewForm",init:e,load:k,gather:f,validateOptions:{rules:{NewProjectName:{required:function(m){return g("addNew_projectId").val()!=0},bytemaxlength:255},Price:{required:"#addNew_isPremium:checked"},CityName:{required:function(m){return l._data&&l._data.Type=="Poi"},bytemaxlength:255},Name:{bytemaxlength:255},Link:{bytemaxlength:255,validAdUrl:true,required:function(m){var n=g("#addNew_advertisementType").val();return(n=="Banner"||n=="Popup")}}},messages:{ClipCount:"You have to upload at least one clip."}}})})})(jQuery);(function(e){function d(f){this._data=f;this.form.unserializeMap(e.extend({Description:"",LanguageId:"",CategoryId:"",Country:{Iso3166:""},City:{Name:""}},f));if(f.TripId==0){e("#addTrip_addTripImage").show();e("#addTrip_editTripImage").hide()
}else{e("#addTrip_addTripImage").hide();e("#addTrip_editTripImage").show()}e("#addTrip_image").attr("src",TRMApi.services.getImageThumbnailUrl(f.ImageId))}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){e("#addTrip_changePicture").click(function(){TRMApi.functions.addImage(function(f){e("#addTrip_imageId").val(f.MediaImage.MediaId);e("#addTrip_image").attr("src",TRMApi.services.getImageThumbnailUrl(f.MediaImage.MediaId))})});e("#addTrip_cityName").autocomplete("CityHint.ashx",{minChars:3,selectFirst:false,extraParams:{CountryCode:function(){return e("#addTrip_countryCode").selectedValues()[0]}}})}e(document).ready(function(){e("#addTripDialog").registerDialog("addTripDialog",{form:"#addTripForm",init:b,load:d,gather:c,validateOptions:{rules:{Name:{bytemaxlength:255},Description:{bytemaxlength:2000}}}})})})(jQuery);(function(e){function d(f){this._data=f;this.form.unserializeMap(f)}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())
}function b(){}e(document).ready(function(){e("#addProjectDialog").registerDialog("addProjectDialog",{form:"#addProjectForm",init:b,load:d,gather:c,validateOptions:{rules:{Name:{bytemaxlength:255}}}})})})(jQuery);(function(f){function e(g){this._data=g;this.form.unserializeMap(g||{});c()}function d(){return this._data=f.extend({},this._data,this.form.serializeMap())}function c(){var g=f("#advancedSearch_countryId").getSelectedOptionText();if(f("#advancedSearch_city").val()!=""){g=f("#advancedSearch_city").val()+", "+g}window.setTimeout(function(){f("#advancedSearch_address").val(g)},100)}function b(){var g=this;f("#advancedSearch_countryId").change(function(){f("#controlPanel_selectCountry").selectOptions(f("#advancedSearch_countryId").selectedValues());f("#advancedSearch_city").val("");f("#controlPanel_city").val("");c()});f("#advancedSearch_city").change(function(){f("#controlPanel_city").val(f("#advancedSearch_city").val());c()});f("#advancedSearch_address").change(function(){f("#advancedSearch_city").val("");
f("#advancedSearch_countryId").val("");f("#controlPanel_city").val("");f("#controlPanel_selectCountry").val("")});f("#advancedSearch_minStarsRating").trstarrating()}f(document).ready(function(){var g=f("#advancedSearchDialog").registerDialog("advancedSearchDialog",{form:"#advancedSearchForm",init:b,load:e,gather:d,validateOptions:{rules:{}}})})})(jQuery);(function(e){function d(g){e("#uploadFootprint_iframe").attr("src","/components/upload_footprint.aspx?rnd="+Math.random())}function c(){return null}function b(){}function f(){e("#uploadFootprint_iframe").attr("src","/components/empty.htm")}e(document).ready(function(){e("#uploadFootprintDialog").bind("dialogclose",f).registerDialog("uploadFootprintDialog",{form:"#uploadFootprintForm",init:b,load:d,gather:c,validateOptions:{}})})})(jQuery);(function(h){function b(){if(!this._data){return}var t=this;setTimeout(function(){var z=h(".ui-layout-center").height()-50;var w=h(".ui-layout-center").width()/2;var y=450;var u=Math.min(t._data.Media.Height,z-h("#footprintPhoto_ownerControls").outerHeight()-35);
var A=t._data.Media.Width/t._data.Media.Height*u;if(A>w-50){A=w-50;u=t._data.Media.Height/t._data.Media.Width*A}h("#footprintPhoto_loading").css({width:A+"px",height:u+"px"});h("#footprintPhoto_video").css({width:A+"px",height:u+"px"});h("#footprintPhoto_top > div").css({width:A+"px"});h("#footprintPhoto_image").attr("src","");TRMApi.services.fillImageTag(h("#footprintPhoto_image"),t._data.Media).css({width:A+"px",height:u+"px"});h("#footprintPhotoDialog").css({width:Math.min(w,Math.max(A+15,y))+"px"});t.resize();var x=h("#footprintPhotoDialog").width();var v=h("#footprintPhotoDialog").height();if(h("#footprintPhoto_comments").is(":visible")){h("#footprintPhoto_comments").css({width:x+"px",height:(v-25)+"px"});h("#footprintPhoto_comments_comments").css({width:"100%",height:(v-25-h("#footprintPhoto_comments_comments").position().top)+"px"});h("#footprintPhoto_comments_comment").css({width:(x-10)+"px",height:"53px"})}},1)}function i(){return[h(window).width()-h("#footprintPhotoDialog").outerWidth()-15,h(window).height()-h("#footprintPhotoDialog").outerHeight()-60]
}function j(){h("#footprintPhotoDialog").hide();TRMApi.callbacks.onBlockScreen("none")}function n(){h("#footprintPhotoDialog").show()}function e(u){var t=this;TRMApi.functions.rotateFootprintPhoto(this._data,u,function(v){t.notify(v)})}function l(){h("#footprintPhoto_image").hide();h("#footprintPhoto_loading").show()}function c(){h("#footprintPhoto_image").show();h("#footprintPhoto_loading").hide()}function k(){h("#footprintPhoto_hideableEdit").show();h("#footprintPhoto_showEdit").hide();this.notifyResize()}function q(){var t=this;h("#footprintPhoto_comments_comments").empty();h.each(this._commentsDataSource.getData(),function(u){var x=this;var v=null;if(x.UserId==TRMApi.session.user.UserId||t._data.UserId==TRMApi.session.user.UserId){v=h("<div />").css({"float":"right",margin:"2px"}).append(h("<img />").css({cursor:"pointer"}).attr("src","images/global/close_button.jpg").click(function(){TRMApi.services.deleteFootprintPhotoComment(x.FootprintPhotoId,x.CommentId)}))}var w=h("<div />").css("padding","3px").addClass((u%2)?"odd":"even").append(h("<div />").addClass("user-photo-icon").append(h("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(x.UserImageId,TRMApi.constants.DEFAULT_USER_IMAGE)))).append(v).append(h("<span />").addClass("date").text(TRMApi.ui.readDate(x.CreatedOn)+" ")).append(h("<span />").addClass("name").append(TRMApi.functions.createUserLink(x.UserId,x.UserFullName))).append(h("<div />").css("margin-top","5px").text(x.Content)).append(h("<div />").css("clear","both"));
h("#footprintPhoto_comments_comments").append(w)})}function m(){if(this.inAnimation){return}var u=this;var t=h("#footprintPhoto_photoScroller").empty();var v=null;h.each(this._dataSource.getData(),function(){var x=this;var w=TRMApi.services.getImageThumbnailTag(this.Media).click(function(){u.notify(x)});if(this.FootprintPhotoId==u._data.FootprintPhotoId){v=w;w.addClass("current");if(this.UserId==TRMApi.session.user.UserId&&this.HasNewComment){h("#footprintPhoto_showComments").addClass("new-comment")}else{h("#footprintPhoto_showComments").removeClass("new-comment")}}t.append(w)});setTimeout(function(){if(v){t.scrollLeft(t.scrollLeft()+v.position().left-130)}else{j()}},1)}function s(t){switch(t){case"idle":this._dataSource.ensureData();break;case"loading":break;case"loaded":m.apply(this,[]);break}}function r(t){switch(t){case"idle":this._commentsDataSource.ensureData();break;case"loading":break;case"loaded":q.apply(this,[]);break}}function d(){TRMApi.services.getMediaVideoEmbedCode(this._data.MediaId,h("#footprintPhoto_video").width(),h("#footprintPhoto_video").height(),function(t){h("#footprintPhoto_videoContainer").html(t)
})}function p(v,u){if(this._dataSource){this._dataSource.removeObserver(this._dataSourceObserver);this._dataSource=this._dataSourceObserver=null}if(this._commentsDataSource){this._commentsDataSource.removeObserver(this._commentsDataSourceObserver);this._commentsDataSource=this._commentsDataSourceObserver=null}if(!v){j();return}var t=this;this._data=v;this.inAnimation=u;this._data.Media=TRMApi.services.getUptodateMedia(this._data.Media);if(this._data.Media&&this._data.Media.Type=="Video"&&this._data.Media.VideoState!="Ready"){h.extend(this._data.Media,{Width:104,Height:104})}TRMApi.ui.dialogs.breadcrumbPhoto.close();TRMApi.callbacks.onBlockScreen(u?"whole":"topbottom");l();h(".footprintPhoto_descriptionDiv").text(v.Description||"");h(".footprintPhoto_takenOn").text(TRMApi.util.formatRemoteDate(v.TakenOn,v.TimeZoneOffset));h("#footprintPhoto_comments_comment").val("");if(u){h("#footprintPhoto_animationControls").show();h("#footprintPhoto_ownerControls").hide();h("#footprintPhoto_showEdit").hide();
h("#footprintPhoto_delete").hide()}else{h("#footprintPhoto_animationControls").hide();h("#footprintPhoto_ownerControls").show();if(!TRMApi.session.isAdmin()&&v.UserId!=TRMApi.session.user.UserId){h("#footprintPhotoDialog .only-owner").hide()}else{h("#footprintPhotoDialog .only-owner").show()}}h("#footprintPhoto_hideableEdit").hide();h("#footprintPhoto_comments").hide();h("#footprintPhoto_showComments").text("Comments");h("#footprintPhoto_videoContainer").empty();if(this._data.Media.Type=="Video"&&this._data.Media.VideoState=="Ready"){h("#footprintPhoto_video").show()}else{h("#footprintPhoto_video").hide()}this.form.unserializeMap(v);this._dataSource=TRMApi.util.DataSource.getFootprintPhotosDataSource(v.FootprintId);this._dataSource.addObserver(this._dataSourceObserver=function(){s.apply(t,arguments)});this._commentsDataSource=TRMApi.util.DataSource.getFootprintPhotoCommentsDataSource(v.FootprintPhotoId);this._commentsDataSource.addObserver(this._commentsDataSourceObserver=function(){r.apply(t,arguments)
});n();this.notifyResize()}function g(){return this._data=h.extend({},this._data,this.form.serializeMap())}function f(){var t=this;h("#footprintPhoto_image").bind("load",c);h("#footprintPhoto_showEdit").click(function(){t.showEdit()});h("#footprintPhoto_delete").click(function(){TRMApi.functions.deleteFootprintPhoto(t._data)});h("#footprintPhoto_showComments").click(function(){TRMApi.services.ensureLoggedIn(function(){if(h("#footprintPhoto_comments").is(":visible")){if(t._resetTimeout){clearTimeout(t._resetTimeout)}h("#footprintPhoto_comments").hide();h("#footprintPhoto_showComments").text("Comments")}else{h("#footprintPhoto_comments").show();if(t._data.UserId==TRMApi.session.user.UserId&&t._data.HasNewComment){t._resetTimeout=setTimeout(function(){t._resetTimeout=null;TRMApi.services.resetFootprintPhotoHasComment(t._data.FootprintPhotoId)},1000)}h("#footprintPhoto_showComments").text("Photo");b.apply(t,[])}})});t._commentsValidator=h("#footprintPhoto_commentsForm").validate({rules:{Comment:{bytemaxlength:255}},submitHandler:function(){var u=h("#footprintPhoto_comments_comment").val();
TRMApi.services.addFootprintPhotoComment(t._data.FootprintPhotoId,u,function(){h("#footprintPhoto_comments_comment").val("")})}});h("#footprintPhoto_comments_submit").click(function(){h("#footprintPhoto_commentsForm").submit()});h("#footprintPhoto_comments_comment").backgroundText("Comment here","comment");h("#footprintPhoto_videoPlay").click(function(){d.apply(t)});h("#footprintPhoto_reportAbuse").click(function(){TRMApi.functions.reportAbuse({UserId:t._data.UserId,FootprintPhotoId:t._data.FootprintPhotoId,FootprintId:t._data.FootprintId})});TRMApi.services.addProcessedVideosObserver(function(u){if(t.isOpened()&&t._data&&t._data.Media&&t._data.Media.Type=="Video"&&t._data.Media.VideoState!="Ready"&&u[t._data.Media.MediaId]){p.apply(t,[t._data])}})}h(document).ready(function(){var t=h("#footprintPhotoDialog").registerDialog("footprintPhoto",{form:"#footprintPhotoForm",load:p,gather:g,init:f,dialogOptions:{modal:false,position:i},validateOptions:{rules:{Description:{bytemaxlength:255}}}});
h.extend(t,{hide:j,show:n,setPhoto:function(u){p.call(this,u,true)},rotate:function(u){e.call(this,u)},notifyResize:b,showEdit:k});t.element.bind("dialogclose",function(){TRMApi.callbacks.onBlockScreen("none")})})})(jQuery);(function(e){function d(f){e("#uploadKmlDialog :input").val("")}function c(){return e("#uploadKmlForm")}function b(){}e(document).ready(function(){e("#uploadKmlDialog").registerDialog("uploadKml",{form:"#uploadKmlForm",init:b,load:d,gather:c,validateOptions:{rules:{ProjectName:{bytemaxlength:255}}}})})})(jQuery);(function(e){function d(f){e("#uploadKmlFootprintDialog :input").val("")}function c(){return e("#uploadKmlFootprintForm")}function b(){e("#uploadKmlFootprint_startDate").trdatepicker({showHour:true})}e(document).ready(function(){e("#uploadKmlFootprintDialog").registerDialog("uploadKmlFootprintDialog",{form:"#uploadKmlFootprintForm",init:b,load:d,gather:c,validateOptions:{rules:{}}})})})(jQuery);(function(f){function d(i,h){i.Emails=f.grep(i.Emails,function(j){return j!=h
});g(i)}function g(h){f("#shareFootprint_emailsDiv > div").remove();f.each(h.Emails,function(j){var i=this.toString();f("#shareFootprint_emailsDiv").append(f("<div />").addClass("email-line").addClass((j%2)==0?"even":"odd").append(f("<span />").text(i)).append(" ").append(f("<a />").text("Remove").attr("href","#").click(function(){d(h,i)})))});f("#shareFootprint_emailCount").val(h.Emails.length);if(h.Emails.length>=6){f("#shareFootprint_emailRow").hide()}else{f("#shareFootprint_emailRow").show()}}function e(h){this._data=h;this.form.unserializeMap(h);g(h)}function c(){if(f("#shareFootprint_email").val()!=""){this._data.Emails.push(f("#shareFootprint_email").val())}return this._data=f.extend({},this._data,this.form.serializeMap())}function b(){var h=this;f("#shareFootprint_addButton").click(function(){var i=f("#shareFootprint_email").val();if(i!=""&&f.validator.methods.email.call(h.validator,i,f("#shareFootprint_email")[0])){h._data.Emails.push(i);f("#shareFootprint_email").val("");g(h._data)
}})}f(document).ready(function(){var h=f("#shareFootprintDialog").registerDialog("shareFootprint",{form:"#shareFootprintForm",init:b,load:e,gather:c,validateOptions:{rules:{EmailCount:{min:function(){return f("#shareFootprint_email").val()==""?1:0}}},messages:{EmailCount:"You have to put at least one email address."}}})})})(jQuery);(function(e){function d(g){e("#downloadTrip_iframe").attr("src","/components/download_trip.aspx?TripId="+g+"&rnd="+Math.random())}function c(){return null}function b(){}function f(){e("#downloadTrip_iframe").attr("src","/components/empty.htm")}e(document).ready(function(){e("#downloadTripDialog").bind("dialogclose",f).registerDialog("downloadTripDialog",{form:"#downloadTripForm",init:b,load:d,gather:c,validateOptions:{}})})})(jQuery);(function(e){function d(f){this._data=f;this.form[0].reset();this.form.unserializeMap(f);e("#editFootprint_Flags_HideTrack")[0].checked=f.Flags.indexOf("HideTrack")>=0}function c(){var f=[];if(e("#editFootprint_Flags_HideTrack")[0].checked){f.push("HideTrack")
}if(!f.length){f=["None"]}return this._data=e.extend({},this._data,this.form.serializeMap(),{Flags:f.join(", ")})}function b(){var f=this;e("#editFootprint_Publicity_Public").click(function(){if(!e("#editFootprint_cityName").val()||!e("#editFootprint_countryCode").val()){TRMApi.maps.getNearestCityAndCountry(f._data.StartPosition,function(g){if(g==null){return}e("#editFootprint_cityName").val(g.City);e("#editFootprint_countryCode").selectOptions(g.CountryCode)})}})}e(document).ready(function(){e("#editFootprintDialog").registerDialog("editFootprintDialog",{form:"#editFootprintForm",init:b,load:d,gather:c,validateOptions:{rules:{Name:{bytemaxlength:255},Description:{required:"#editFootprint_Publicity_Public:checked"},CityName:{required:"#editFootprint_Publicity_Public:checked"},CountryId:{required:"#editFootprint_Publicity_Public:checked"}},messages:{Description:"This field is required for public footprints",CityName:"This field is required for public footprints",CountryId:"This field is required for public footprints"}}})
})})(jQuery);(function(e){function d(f){e("#contentDialog_content").empty();var g=f.split("#");TRMApi.services.getContent(g[0],function(k){e("#contentDialog_content").html(k);var j,h;j=e("<ul />");function i(n){var m=e(n).position().top;e("#contentDialog_content").animate({scrollTop:e("#contentDialog_content").scrollTop()+m},"fast")}function l(m){var n=e(m).text();e(m).append(e("<a />").attr("href","#").text("back").click(function(){i("#contentDialog_content .toc-top")}));return e("<a />").text(n).attr("href","#").click(function(){i(m)})}e("#contentDialog_content .toc-top > *").each(function(){var m=this;switch(m.tagName.toLowerCase()){case"h3":e("<li />").append(l(m)).append(h=e("<ul />")).appendTo(j);break;case"h4":e("<li />").append(l(m)).appendTo(h);break}});e("#contentDialog_content .toc").append(j);if(g.length>1&&e("#contentDialog_content .anchor-"+g[1]).length==1){i(e("#contentDialog_content .anchor-"+g[1]))}})}function c(){}function b(){}e(document).ready(function(){var f=e("#contentDialog").registerDialog("contentDialog",{init:b,load:d,gather:c})
})})(jQuery);(function(e){function d(f){this._data=f;this.form.unserializeMap(f)}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var f=this}e(document).ready(function(){e("#forgottenPassword2Dialog").registerDialog("forgottenPassword2Dialog",{form:"#forgottenPassword2Form",init:b,load:d,gather:c,validateOptions:{onfocusout:false,rules:{Confirmation:{equalTo:"#forgottenPassword2_password"},UserName:{bytemaxlength:255},Password:{bytemaxlength:30,minlength:5}}}})})})(jQuery);(function(f){function e(){if(this._activePhoto>=this._photos.length){f("#embedDialog_image").attr("src","/images/content/add_new/no_image.gif").css({width:"104px",height:"104px"});f("#embedDialog_mediaId").val("");f("#embedDialog_prevImage").css("visibility","hidden");f("#embedDialog_nextImage").css("visibility","hidden")}else{f("#embedDialog_image").attr("src",TRMApi.services.getImageThumbnailUrl(this._photos[this._activePhoto].MediaId)).css({width:"104px",height:"104px"});
f("#embedDialog_mediaId").val(this._photos[this._activePhoto].MediaId);f("#embedDialog_prevImage").css("visibility",this._activePhoto>0?"visible":"hidden");f("#embedDialog_nextImage").css("visibility",this._activePhoto+1<this._photos.length?"visible":"hidden")}}function d(h){var g=this;this._data=h;this._photos=[];this._activePhoto=0;if(this._data.FootprintId){TRMApi.util.DataSource.getFootprintPhotosDataSource(this._data.FootprintId).ensureData(function(){var i=this.getData();f.each(i,function(){if(this.Media.MediaId==g._data.EmbedSourceImageId){g._activePhoto=g._photos.length}g._photos.push(this.Media)});g.repaintPhoto()});f("#embedDialog_embedTitle").text("Footprint:")}else{if(this._data.TripId){TRMApi.services.getTripPhotos(this._data.TripId,function(i){f.each(i,function(){if(this.MediaId==g._data.EmbedSourceImageId){g._activePhoto=g._photos.length}g._photos.push(this)});g.repaintPhoto()});f("#embedDialog_embedTitle").text("Trip:")}}f("#embedDialog_embed").text(this._data.Name);this.form.unserializeMap({Title:this._data.EmbedTitle||this._data.Name,MediaId:this._data.EmbedSourceImageId||""});
this.repaintPhoto()}function c(){return this._data=f.extend({FootprintId:this._data.FootprintId||null,TripId:this._data.TripId||null},this.form.serializeMap())}function b(){var g=this;f("#embedDialog_prevImage").click(function(){if(g._activePhoto>0){g._activePhoto--;g.repaintPhoto()}});f("#embedDialog_nextImage").click(function(){if(g._activePhoto+1<g._photos.length){g._activePhoto++;g.repaintPhoto()}})}f(document).ready(function(){var g=f("#embedDialog").registerDialog("embedDialog",{form:"#embedForm",init:b,load:d,gather:c,validateOptions:{rules:{Title:{bytemaxlength:60}}}});f.extend(g,{repaintPhoto:e})})})(jQuery);(function(e){function d(g){var f=this;this.form.unserializeMap(g)}function c(){return null}function b(){var f=this;e("#embed2Dialog_url").bind("focus",function(){e("#embed2Dialog_url").select()});e("#embed2Dialog_html").bind("focus",function(){e("#embed2Dialog_html").select()})}e(document).ready(function(){var f=e("#embed2Dialog").registerDialog("embed2Dialog",{form:"#embed2Form",init:b,load:d,gather:c,validateOptions:{}})
})})(jQuery);(function(e){function d(g){var f=this;if(g.TripId){e("#embedWelcomeDialog .when_trip").show();e("#embedWelcomeDialog .when_footprint").hide();e("#embedWelcomeDialog_tripName").text(g.EmbedTitle||g.Name);e("#embedWelcomeDialog_loginDownloadTrip").attr("checked","checked")}else{if(g.FootprintId){e("#embedWelcomeDialog .when_trip").hide();e("#embedWelcomeDialog .when_footprint").show();e("#embedWelcomeDialog_footprintName").text(g.EmbedTitle||g.Name);e("#embedWelcomeDialog_loginPlayFootprint").attr("checked","checked")}}e("#embedWelcomeDialog_image").attr("src",TRMApi.services.getImageThumbnailUrl(g.EmbedSourceImageId||g.RandomImageId))}function c(){return e("#embedWelcomeForm input[@name='Action']:checked").val()}function b(){var f=this}e(document).ready(function(){var f=e("#embedWelcomeDialog").registerDialog("embedWelcomeDialog",{form:"#embedWelcomeForm",init:b,load:d,gather:c,validateOptions:{}})})})(jQuery);(function(e){function d(f){this._data=f;if(this._data&&this._data.displayRegister){e("#loginDialog_registerButton").show()
}else{e("#loginDialog_registerButton").hide()}this.form.unserializeMap({Username:"",Password:""})}function c(){return this.form.serializeMap()}function b(){var f=this}e(document).ready(function(){e("#loginDialog").registerDialog("loginDialog",{form:"#loginForm",init:b,load:d,gather:c,validateOptions:{rules:{Username:{bytemaxlength:255},Password:{bytemaxlength:255}}}})})})(jQuery);(function(e){function d(g){this._data=g;if(g.IsFacebookOnly){e("#editProfileDialog .nonfacebook").hide()}else{e("#editProfileDialog .nonfacebook").show()}e("#editProfileDialog_countryId").clearOptions().addOption("","Please select...").bindOptions(TRMApi.session.countries,{valueProperty:"CountryId",textProperty:"Name",clear:false}).selectOptions("");e("#editProfileDialog_interests").empty();var f;e.each(TRMApi.session.interests,function(h){if(!(h%3)){f=e("<tr />");e("#editProfileDialog_interests").append(f)}var i=e("<td />").append(e('<input type="checkbox" />').attr({name:"Interests",value:this.InterestId})).append(e("<span />").text(this.Name));
f.append(i)});e("#editProfileDialog_imageId").val(g.ImageId);e("#editProfileDialog_image").attr("src",TRMApi.services.getImageThumbnailUrl(g.ImageId));this.form.unserializeMap(g);e("#editProfileDialog_birthDate").val(TRMApi.util.date2ISO(g.BirthDate))}function c(){return this._data=e.extend({},this._data,this.form.serializeMap(),{BirthDate:TRMApi.util.dateISO2Net(e("#editProfileDialog_birthDate").val())})}function b(){var f=this;e("#editProfileDialog_changePicture").click(function(){TRMApi.functions.addImage(function(g){e("#editProfileDialog_imageId").val(g.MediaImage.MediaId);e("#editProfileDialog_image").attr("src",TRMApi.services.getImageThumbnailUrl(g.MediaImage.MediaId,TRMApi.constants.DEFAULT_USER_IMAGE))})});e("#editProfileDialog_birthDate").trdatepicker({startDate:"1900-01-01",endDate:"today"});e("#editProfileDialog_changeEmailSettings").click(function(){e("#editProfileDialog").hide();TRMApi.ui.dialogs.modifyEmailAndPrivacySettingsDialog.run(f._data,{save:function(g){e.extend(f._data,g);
this.close()},close:function(){e("#editProfileDialog").show()}})})}e(document).ready(function(){e("#editProfileDialog").registerDialog("editProfileDialog",{form:"#editProfileForm",init:b,load:d,gather:c,validateOptions:{rules:{FirstName:{bytemaxlength:255},LastName:{bytemaxlength:255},HomeTown:{bytemaxlength:255}}}})})})(jQuery);(function(g){function f(h){this._data=g.extend({},h);if(this._data.GroupId){this.friendsSelector.enable();g("#inviteFriend_search").hide();g("#inviteFriend_invite").show()}else{this.friendsSelector.disable();g("#inviteFriend_search").show();g("#inviteFriend_invite").hide()}g("#inviteFriend_text").val("");g("#inviteFriend_results").hide();this.friendsSelector.clear();this.resize()}function c(){return this._data=g.extend({},this._data,{UserIds:g.merge(g.map(g("#inviteFriend_resultTable input[@name='UserId']:checked"),function(i,h){return g(i).val()}),g.map(g("#inviteFriendForm input[@name='UserIds']"),function(i,h){return g(i).val()}))})}function d(){g("#inviteFriend_inviteCount").val(g("#inviteFriend_resultTable input[@name='UserId']:checked").length+g("#inviteFriendForm input[@name='UserIds']").length)
}function e(i){var h=this;d();if(g("#inviteFriendForm input[@name='UserIds']").length>0){g("#inviteFriend_text").val("...");return}i.preventDefault();i.stopPropagation();if(!this.validator.element(g("#inviteFriend_text"))){return}TRMApi.services.getUsers({Text:g("#inviteFriend_text").val(),ExcludeFriends:true},function(j){g("#inviteFriend_results").show();g("#inviteFriend_resultTable tbody").empty();g.each(j.Users,function(k){var l=TRMApi.services.getImageThumbnailUrl(this.ImageId,TRMApi.DEFAULT_USER_IMAGE);g("#inviteFriend_resultTable tbody").append(g("<tr />").addClass((k%2==0)?"even":"odd").append(g("<td />").html('<img src="'+l+'" width="40" />')).append(g("<td />").text(this.UserName)).append(g("<td />").append(TRMApi.functions.createUserLink(this.UserId,this.FullName))).append(g("<td />").text(TRMApi.session.countryById(this.CountryId).Name)).append(g("<td />").append(g('<input type="checkbox" />').attr({name:"UserId",value:this.UserId}).click(d))))});h.resize()})}function b(){var h=this;
g("#inviteFriend_search").click(function(){e.apply(h,arguments)});g("#inviteFriend_invite").click(function(){e.apply(h,arguments)});this.friendsSelector=g("#inviteFriend_text").trfriendsselector({userList:"#inviteFriend_tosList"});g("#inviteFriend_inviteOutsider").click(function(){h.close();TRMApi.functions.inviteOutsider(g.extend({},h._data,{Emails:g("#inviteFriend_text").val()}))})}g(document).ready(function(){g("#inviteFriendDialog").registerDialog("inviteFriendDialog",{form:"#inviteFriendForm",init:b,load:f,gather:c,validateOptions:{rules:{Text:{bytemaxlength:255,minlength:3,inviteFriendValidSearchString:true,required:"#inviteFriend_search:visible"},inviteCount:{required:function(){return g("#inviteFriendForm input[@name='UserIds']").length==0},min:1}},messages:{inviteCount:"You have to select at least one friend to invite."}}})})})(jQuery);(function(e){function d(f){this._data=f;e("#inviteOutsider_emails").val(f.Emails||"");e("#inviteOutsider_message").val("")}function c(){return e.extend({},this._data,{Emails:e("#inviteOutsider_emails").val().split(/[,; ]+/),Message:e("#inviteOutsider_message").val()})
}function b(){}e(document).ready(function(){e("#inviteOutsiderDialog").registerDialog("inviteOutsiderDialog",{form:"#inviteOutsiderForm",init:b,load:d,gather:c,validateOptions:{rules:{Emails:{emails:true}}}})});e.validator.addMethod("inviteFriendValidSearchString",function(g,f,h){return this.optional(f)||g.replace(/\s+/," ").replace(/^\s+/,"").replace(/\s+$/,"").toLowerCase().match(/^[-0-9a-z@_+.= ]+$/)},e.format("Please enter name or email of your friend."))})(jQuery);(function(e){function d(f){this._data=f;e("#friendOptions_friendPhoto").attr("src",TRMApi.services.getImageThumbnailUrl(f.User.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE));e("#friendOptions_friendName").text(f.User.FullName);e("#friendOptionsForm input[@type='radio'][@value='0']").checkRadio(true);e("#friendOptionsForm input[@type='radio'][@value='1']").each(function(){var g=e(this);if(f.Permissions.indexOf(g.attr("name"))>=0){g.checkRadio(true)}})}function c(){var f=[];e("#friendOptionsForm input[@type='radio'][@value='1']").each(function(){var g=e(this);
if(g.is(":checked")){f.push(g.attr("name"))}});f=f.join(", ");return{User:this._data.User,Permissions:f}}function b(){var f=this}e(document).ready(function(){e("#friendOptionsDialog").registerDialog("friendOptionsDialog",{form:"#friendOptionsForm",init:b,load:d,gather:c,validateOptions:{rules:{},messages:{}}})})})(jQuery);(function(e){function d(f){this._data=f;e("#modifyEmailAndPrivacySettingsDialog_fbPublishTargetId").clearOptions().addOption("","Loading Facebook groups and pages...").selectOptions("");TRMApi.services.getFacebookPublishTargets(function(g){e("#modifyEmailAndPrivacySettingsDialog_fbPublishTargetId").bindOptions(g,{valueProperty:"Id",textProperty:"Name",clear:true}).selectOptions(f.FbPublishTargetId||"0")});this.form.unserializeMap(f);e("#modifyEmailAndPrivacySettingsForm input.isflag[@type='radio'][@value='0']").checkRadio(true);e("#modifyEmailAndPrivacySettingsForm input.isflag[@type='radio'][@value='1']").each(function(){var g=e(this);if(f.Flags.indexOf(g.attr("name"))>=0){g.checkRadio(true)
}})}function c(){var f=[];e("#modifyEmailAndPrivacySettingsForm input.isflag[@type='radio'][@value='1']").each(function(){var h=e(this);if(h.is(":checked")){f.push(h.attr("name"))}});f=f.join(", ");var g=this.form.serializeMap();return e.extend(this._data,{Flags:f,DefaultFootprintPublicity:g.DefaultFootprintPublicity,FbPublishTargetId:g.FbPublishTargetId})}function b(){var f=this}e(document).ready(function(){e("#modifyEmailAndPrivacySettingsDialog").registerDialog("modifyEmailAndPrivacySettingsDialog",{form:"#modifyEmailAndPrivacySettingsForm",init:b,load:d,gather:c,validateOptions:{rules:{},messages:{}}})})})(jQuery);(function(e){function d(f){this._data=f;this.form.unserializeMap(f)}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var f=this}e(document).ready(function(){e("#upgradeUserDialog").registerDialog("upgradeUserDialog",{form:"#upgradeUserForm",init:b,load:d,gather:c,validateOptions:{rules:{UserName:{shortNameAvailable:true,bytemaxlength:30,validShortName:true},EmailAddress:{emailDoesNotExist:true,bytemaxlength:255},Confirm:{equalTo:"#upgradeUser_password"},Password:{bytemaxlength:30}},onfocusout:false}})
})})(jQuery);(function(e){function d(f){this._data=f;this.form.unserializeMap(f)}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var f=this}e(document).ready(function(){var f=e("#changePasswordDialog").registerDialog("changePasswordDialog",{form:"#changePasswordForm",init:b,load:d,gather:c,validateOptions:{onfocusout:false,rules:{Confirmation:{equalTo:"#changePassword_password"},UserName:{bytemaxlength:255},Password:{bytemaxlength:30,minlength:5}}}});e.extend(f,{showInvalidPassword:function(){this.validator.showErrors({OldPassword:"Invalid password. Please try again."})}})})})(jQuery);(function(e){function d(g){this._data=g;var f=this;this.friendsSelector.clear();e("#newConversationForm input[@type='text']").val("");e("#newConversationForm textarea").val("");if(g.Users){e.each(g.Users,function(){f.friendsSelector.addUser(this)})}}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var f=this;this.friendsSelector=e("#newConversation_toAdd").trfriendsselector({userList:"#newConversation_tosList",excludeFriendOfAll:true})
}e(document).ready(function(){e("#newConversationDialog").registerDialog("newConversationDialog",{form:"#newConversationForm",init:b,load:d,gather:c,validateOptions:{onfocusout:false,rules:{UserIdCount:{required:true,min:1},ToAdd:{maxlength:0},Subject:{bytemaxlength:255},Content:{bytemaxlength:2000}},messages:{UserIdCount:"You have to select at least one friend to send the message to.",ToAdd:"This user was not found among your friends. Please note, that to some of the users (like Jack Hummba) you cannot send direct messages."}}})})})(jQuery);(function(f){function d(){var g=this;setTimeout(function(){var h=f(".ui-layout-center").height()-50;f("#conversation_messages").css("height",(h-150)+"px");g.resize()},100)}function e(j){var i=this;var h=0;this._data=j;f("#conversationForm textarea").val("");f("#conversation_subject").text(j.Subject);f("#conversation_toSpan").empty();f("#conversation_fromSpan").empty();var g=0;var k={};f.each(j.Members,function(){k[this.UserId]=this;var m=this.UserId;
var l=TRMApi.functions.createUserLink(this.UserId,this.User.FullName);if(j.UserId==this.UserId){f("#conversation_fromSpan").append(l)}else{if(g){f("#conversation_toSpan").append(", ")}f("#conversation_toSpan").append(l);g++}});f("#conversation_messages").empty();f.each(j.Messages,function(){var n=this;var p=k[n.UserId];var l;h=Math.max(n.ConversationMessageId,h);l=TRMApi.functions.createUserLink(p.User.UserId,p.User.FullName);var m=f("<li />").append(f("<img />").addClass("user-photo-icon").css("margin","0 3px").attr("src",TRMApi.services.getImageThumbnailUrl(p.User.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE))).append(f("<div />").append(f("<span />").addClass("date").html(TRMApi.util.formatDate(n.CreatedOn))).append(l)).append(f("<div />").addClass("conv-content").text(n.Content)).append(f("<div />").addClass("clearfix").html("&nbsp;")).addClass("clearfix");f("#conversation_messages").append(m)});TRMApi.services.markConversationAsRead(j.ConversationId,h)}function c(){return this._data=f.extend({},this._data,this.form.serializeMap())
}function b(){var g=this;f("#conversation_reportAbuse").click(function(){TRMApi.functions.reportAbuse({ConversationId:g._data.ConversationId})})}f(document).ready(function(){var g=f("#conversationDialog").registerDialog("conversationDialog",{form:"#conversationForm",init:b,load:e,gather:c,validateOptions:{onfocusout:false,rules:{Content:{bytemaxlength:2000}},messages:{}}});f.extend(g,{notifyResize:d})})})(jQuery);(function(e){function d(h){var g=this;this._data=h;this.form[0].reset();e("#editBreadcrumb_imageId").val(h.ImageId);TRMApi.services.fillImageThumbnailTag(e("#editBreadcrumb_image"),h.Image);this.form.unserializeMap(h);f(!h.Image||h.Image.Type!="Video");if(this._data.BreadcrumbId==0){TRMApi.maps.getNearestCityAndCountry(this._data.Position,function(i){if(i==null){return}e("#editBreadcrumb_cityName").val(i.City);e("#editBreadcrumb_countryCode").selectOptions(i.CountryCode)})}}function f(g){if(g){e("#editBreadcrumb_Publicity_Private").removeAttr("disabled");e("#editBreadcrumb_Publicity_FriendsOnly").removeAttr("disabled");
e("#editBreadcrumb_Publicity_Public").removeAttr("disabled")}else{e("#editBreadcrumb_Publicity_Private").attr("disabled","disabled");e("#editBreadcrumb_Publicity_FriendsOnly").attr("disabled","disabled");e("#editBreadcrumb_Publicity_Public").removeAttr("disabled");e("#editBreadcrumb_Publicity_Public")[0].checked=true}}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var g=this;e("#editBreadcrumb_Publicity_Public").click(function(){if(!e("#editBreadcrumb_cityName").val()||!e("#editBreadcrumb_countryCode").val()){TRMApi.maps.getNearestCityAndCountry(g._data.StartPosition,function(h){if(h==null){return}e("#editBreadcrumb_cityName").val(h.City);e("#editBreadcrumb_countryCode").selectOptions(h.CountryCode)})}});e("#editBreadcrumb_changePicture").click(function(){TRMApi.functions.addImage(function(h){e("#editBreadcrumb_imageId").val(h.MediaImage.MediaId);TRMApi.services.fillImageThumbnailTag(e("#editBreadcrumb_image"),h.MediaImage);f(true)})});e("#editBreadcrumb_changeVideo").click(function(){function h(){TRMApi.functions.addVideo(function(i){e("#editBreadcrumb_imageId").val(i.MediaVideo.MediaId);
TRMApi.services.fillImageThumbnailTag(e("#editBreadcrumb_image"),i.MediaVideo);f(false)})}if(!e("#editBreadcrumb_Publicity_Public").is(":checked")){TRMApi.ui.dialogs.confirmDialog.run({Message:"Hummba does not support non-public videos. Uploading a video to this breadcrumb will make it public."},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){h()}}})}else{h()}})}e(document).ready(function(){e("#editBreadcrumbDialog").registerDialog("editBreadcrumbDialog",{form:"#editBreadcrumbForm",init:b,load:d,gather:c,validateOptions:{rules:{Name:{bytemaxlength:255},Description:{required:"#editBreadcrumb_Publicity_Public:checked",bytemaxlength:4000},CityName:{required:"#editBreadcrumb_Publicity_Public:checked"},CountryId:{required:"#editBreadcrumb_Publicity_Public:checked"},ImageId:{required:true,min:1}},messages:{Description:"This field is required for public breadcrumbs and can contain at most 4000 bytes",CityName:"This field is required for public breadcrumbs",CountryId:"This field is required for public breadcrumbs",ImageId:"Breadcrumb must include image or video"}}})
})})(jQuery);(function(h){function b(){if(!this._data){return}var t=this;setTimeout(function(){var z=h(".ui-layout-center").height()-50;var w=h(".ui-layout-center").width()/2;var y=450;var u=Math.min(t._data.Image.Height,z-h("#breadcrumbPhoto_bottom").outerHeight()-35);var A=t._data.Image.Width/t._data.Image.Height*u;if(A>w-50){A=w-50;u=t._data.Image.Height/t._data.Image.Width*A}h("#breadcrumbPhoto_loading").css({width:A+"px",height:u+"px"});h("#breadcrumbPhoto_video").css({width:A+"px",height:u+"px"});h("#breadcrumbPhoto_photoHolder").css({width:A+"px"});h("#breadcrumbPhoto_image").attr("src","");TRMApi.services.fillImageTag(h("#breadcrumbPhoto_image"),t._data.Image).css({width:A+"px",height:u+"px"});h("#breadcrumbPhotoDialog").css({width:Math.min(w,Math.max(A+15,y))+"px"});t.resize();var x=h("#breadcrumbPhotoDialog").width();var v=h("#breadcrumbPhotoDialog").height();if(h("#breadcrumbPhoto_comments").is(":visible")){h("#breadcrumbPhoto_comments").css({width:x+"px",height:(v-25)+"px"});
h("#breadcrumbPhoto_comments_comments").css({width:"100%",height:(v-25-h("#breadcrumbPhoto_comments_comments").position().top)+"px"});h("#breadcrumbPhoto_comments_comment").css({width:(x-10)+"px",height:"53px"})}},1)}function i(){return[h(window).width()-h("#breadcrumbPhotoDialog").outerWidth()-15,h(window).height()-h("#breadcrumbPhotoDialog").outerHeight()-60]}function j(){h("#breadcrumbPhotoDialog").hide();TRMApi.callbacks.onBlockScreen("none")}function n(){h("#breadcrumbPhotoDialog").show()}function e(u){var t=this;TRMApi.functions.rotateBreadcrumb(this._data,u,function(v){t.notify(v)})}function l(){h("#breadcrumbPhoto_image").hide();h("#breadcrumbPhoto_loading").show()}function c(){h("#breadcrumbPhoto_image").show();h("#breadcrumbPhoto_loading").hide()}function k(){}function q(){var t=this;h("#breadcrumbPhoto_comments_comments").empty();h.each(this._commentsDataSource.getData(),function(u){var x=this;var v=null;if(x.UserId==TRMApi.session.user.UserId||t._data.UserId==TRMApi.session.user.UserId){v=h("<div />").css({"float":"right",margin:"2px"}).append(h("<img />").css({cursor:"pointer"}).attr("src","images/global/close_button.jpg").click(function(){TRMApi.services.deleteBreadcrumbComment(x.BreadcrumbId,x.CommentId)
}))}var w=h("<div />").css("padding","3px").addClass((u%2)?"odd":"even").append(h("<div />").addClass("user-photo-icon").append(h("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(x.UserImageId,TRMApi.constants.DEFAULT_USER_IMAGE)))).append(v).append(h("<span />").addClass("date").text(TRMApi.ui.readDate(x.CreatedOn)+" ")).append(h("<span />").addClass("name").append(TRMApi.functions.createUserLink(x.UserId,x.UserFullName))).append(h("<div />").css("margin-top","5px").text(x.Content)).append(h("<div />").css("clear","both"));h("#breadcrumbPhoto_comments_comments").append(w)})}function m(){var u=this;var t=h("#breadcrumbPhoto_photoScroller").empty();var v=null;h.each(this._dataSource.getData(),function(){var x=this;var w=TRMApi.services.getImageThumbnailTag(this.Image).click(function(){u.notify(x)});if(this.BreadcrumbId==u._data.BreadcrumbId){v=w;w.addClass("current");if(this.UserId==TRMApi.session.user.UserId&&this.HasNewComment){h("#breadcrumbPhoto_showComments").addClass("new-comment")
}else{h("#breadcrumbPhoto_showComments").removeClass("new-comment")}}t.append(w)});setTimeout(function(){if(v){t.scrollLeft(t.scrollLeft()+v.position().left-130)}else{j()}},1)}function s(t){switch(t){case"idle":this._dataSource.ensureData();break;case"loading":break;case"loaded":m.apply(this,[]);break}}function r(t){switch(t){case"idle":this._commentsDataSource.ensureData();break;case"loading":break;case"loaded":q.apply(this,[]);break}}function d(){TRMApi.services.getMediaVideoEmbedCode(this._data.ImageId,h("#breadcrumbPhoto_video").width(),h("#breadcrumbPhoto_video").height(),function(t){h("#breadcrumbPhoto_videoContainer").html(t)})}function p(u){if(this._dataSource){this._dataSource.removeObserver(this._dataSourceObserver);this._dataSource=this._dataSourceObserver=null}if(this._commentsDataSource){this._commentsDataSource.removeObserver(this._commentsDataSourceObserver);this._commentsDataSource=this._commentsDataSourceObserver=null}if(!u||!u.Data){j();return}var t=this;this._originalData=u;
this._data=u.Data;this._displayScroller=!!u.displayScroller;this._scrollerType=u.scrollerType||"user";this._scrollerParentId=u.scrollerParentId||this._data.UserId;this._scrollerParent=u.scrollerParent||null;this._showDelete=u.showDelete||null;this._data.Image=TRMApi.services.getUptodateMedia(this._data.Image);if(this._data.Image&&this._data.Image.Type=="Video"&&this._data.Image.VideoState!="Ready"){h.extend(this._data.Image,{Width:104,Height:104})}TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.callbacks.onBlockScreen("topbottom");l();h(".breadcrumbPhoto_name").text(this._data.Name||"");h(".breadcrumbPhoto_descriptionDiv .description").text(this._data.Description||"");h(".breadcrumbPhoto_takenOn").text(TRMApi.util.formatDate(this._data.CreatedOn));h("#breadcrumbPhoto_comments_comment").val("");if(this._displayScroller){h("#breacrumbPhoto_scrollerDiv").show()}else{h("#breacrumbPhoto_scrollerDiv").hide()}if(this._showDelete){h("#breadcrumbPhotoDialog .onDelete").show()}else{h("#breadcrumbPhotoDialog .onDelete").hide()
}if(TRMApi.session.isAdmin()||u.Data.UserId==TRMApi.session.user.UserId){if(this._data.Image.Type=="Video"){h("#breadcrumbPhotoDialog .breadcrumbPhoto_rotate").hide()}else{h("#breadcrumbPhotoDialog .only-owner").show();h("#breadcrumbPhotoDialog .breadcrumbPhoto_rotate").show()}}else{h("#breadcrumbPhotoDialog .only-owner").hide()}h("#breadcrumbPhoto_videoContainer").empty();if(this._scrollerType=="group"&&(TRMApi.session.isAdmin()||u.Data.UserId==TRMApi.session.user.UserId||(this._scrollerParent&&this._scrollerParent.IsAdmin))){h("#breadcrumbPhotoDialog .only-ownerorgroupadmin").show()}else{h("#breadcrumbPhotoDialog .only-ownerorgroupadmin").hide()}if(this._data.Image.Type=="Video"){h("#breadcrumbPhoto_video").show()}else{h("#breadcrumbPhoto_video").hide()}h("#breadcrumbPhoto_comments").hide();h("#breadcrumbPhoto_showComments").text("Comments");this.form.unserializeMap(this._data);if(this._displayScroller){switch(this._scrollerType){case"user":this._dataSource=TRMApi.util.DataSource.getBreadcrumbsDataSource(this._scrollerParentId);
break;case"group":this._dataSource=TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(this._scrollerParentId);break}this._dataSource.addObserver(this._dataSourceObserver=function(){s.apply(t,arguments)})}this._commentsDataSource=TRMApi.util.DataSource.getBreadcrumbCommentsDataSource(this._data.BreadcrumbId);this._commentsDataSource.addObserver(this._commentsDataSourceObserver=function(){r.apply(t,arguments)});n();this.notifyResize()}function g(){return this._data=h.extend({},this._data,this.form.serializeMap())}function f(){var t=this;h("#breadcrumbPhoto_image").bind("load",c);h("#breadcrumbPhoto_delete").click(function(){TRMApi.functions.deleteBreadcrumb(t._data)});h("#breadcrumbPhoto_showComments").click(function(){TRMApi.services.ensureLoggedIn(function(){if(h("#breadcrumbPhoto_comments").is(":visible")){if(t._resetTimeout){clearTimeout(t._resetTimeout)}h("#breadcrumbPhoto_comments").hide();h("#breadcrumbPhoto_showComments").text("Comments")}else{h("#breadcrumbPhoto_comments").show();
if(t._data.UserId==TRMApi.session.user.UserId&&t._data.HasNewComment){t._resetTimeout=setTimeout(function(){t._resetTimeout=null;TRMApi.services.resetBreadcrumbHasComment(t._data.BreadcrumbId)},1000)}h("#breadcrumbPhoto_showComments").text("Photo");b.apply(t,[])}})});t._commentsValidator=h("#breadcrumbPhoto_commentsForm").validate({rules:{Comment:{bytemaxlength:255}},submitHandler:function(){var u=h("#breadcrumbPhoto_comments_comment").val();TRMApi.services.addBreadcrumbComment(t._data.BreadcrumbId,u,function(){h("#breadcrumbPhoto_comments_comment").val("")})}});h("#breadcrumbPhoto_comments_submit").click(function(){h("#breadcrumbPhoto_commentsForm").submit()});h("#breadcrumbPhoto_comments_comment").backgroundText("Comment here","comment");h("#breadcrumbPhoto_videoPlay").click(function(){d.apply(t)});h("#breadcrumbPhoto_reportAbuse").click(function(){TRMApi.functions.reportAbuse({UserId:t._data.UserId,BreadcrumbId:t._data.BreadcrumbId})});TRMApi.services.addProcessedVideosObserver(function(u){if(t.isOpened()&&t._data&&t._data.Image&&t._data.Image.Type=="Video"&&t._data.Image.VideoState!="Ready"&&u[t._data.Image.MediaId]){p.apply(t,[t._originalData])
}})}h(document).ready(function(){var t=h("#breadcrumbPhotoDialog").registerDialog("breadcrumbPhoto",{form:"#breadcrumbPhotoForm",load:p,gather:g,init:f,dialogOptions:{modal:false,position:i}});h.extend(t,{hide:j,show:n,rotate:function(u){e.call(this,u)},notifyResize:b});t.element.bind("dialogclose",function(){TRMApi.callbacks.onBlockScreen("none");h("#breadcrumbPhoto_videoContainer").empty()})})})(jQuery);(function(e){function d(f){this._data=f;if(this._data.GroupId){e("#editGroup_shortName").attr("disabled","disabled")}else{e("#editGroup_shortName").removeAttr("disabled")}e("#editGroup_countryId").clearOptions().addOption("","Please select...").bindOptions(TRMApi.session.countries,{valueProperty:"CountryId",textProperty:"Name",clear:false}).selectOptions("");e("#editGroup_languageId").clearOptions().addOption("","Please select...").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name",clear:false}).selectOptions("");e("#editGroup_imageId").val(f.ImageId);
e("#editGroup_image").attr("src",TRMApi.services.getImageThumbnailUrl(f.ImageId));this.form.unserializeMap(e.extend({CountryId:"",LanguageId:""},f));e("#editGroup_adminOnlyBreadcrumbs")[0].checked=(f.Flags||"").indexOf("AdminOnlyBreadcrumbs")>-1;e("#editGroup_adminStatus")[0].checked=(f.Flags||"").indexOf("AdminStatus")>-1}function c(){var f=[];if(e("#editGroup_adminOnlyBreadcrumbs").is(":checked")){f.push("AdminOnlyBreadcrumbs")}if(e("#editGroup_adminStatus").is(":checked")){f.push("AdminStatus")}f=f.length?f.join(","):"None";return this._data=e.extend({},this._data,this.form.serializeMap(),{Flags:f})}function b(){var f=this;e("#editGroup_changePicture").click(function(){TRMApi.functions.addImage(function(g){e("#editGroup_imageId").val(g.MediaImage.MediaId);e("#editGroup_image").attr("src",TRMApi.services.getImageThumbnailUrl(g.MediaImage.MediaId,TRMApi.constants.DEFAULT_USER_IMAGE))})})}e(document).ready(function(){e("#editGroupDialog").registerDialog("editGroupDialog",{form:"#editGroupForm",init:b,load:d,gather:c,validateOptions:{rules:{Name:{bytemaxlength:255},ShortName:{bytemaxlength:30,shortNameAvailable:true,validShortName:true},Description:{bytemaxlength:2000}}}})
})})(jQuery);(function(g){function i(k){var j=this;g("#viewGroup_photoScroller").empty();g.each(k,function(){var m=this;var l=TRMApi.services.getImageThumbnailTag(this.Image,TRMApi.constants.DEFAULT_IMAGE).click(function(){j.notify(m)});g("#viewGroup_photoScroller").append(l)})}function d(k){var j=this;g("#viewGroup_comments_comments").empty();g.each(k,function(l){var p=this;var m=null;if(p.UserId==TRMApi.session.user.UserId||j._data.IsAdmin){m=g("<div />").css({"float":"right",margin:"2px"}).append(g("<img />").css({cursor:"pointer"}).attr("src","images/global/close_button.jpg").click(function(){TRMApi.services.deleteGroupComment(p.GroupId,p.CommentId)}))}var n=g("<div />").css("padding","3px").addClass((l%2)?"odd":"even").append(g("<div />").addClass("user-photo-icon").append(g("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(p.UserImageId,TRMApi.constants.DEFAULT_USER_IMAGE)))).append(m).append(g("<span />").addClass("date").text(TRMApi.ui.readDate(p.CreatedOn)+" ")).append(g("<span />").addClass("name").append(TRMApi.functions.createUserLink(p.UserId,p.UserFullName))).append(g("<div />").css("margin-top","5px").text(p.Content)).append(g("<div />").css("clear","both"));
g("#viewGroup_comments_comments").append(n)})}function h(j){switch(j){case"idle":this._dataSource.ensureData();break;case"loading":g("#viewGroup_photoScroller").text("loading...");break;case"loaded":i.apply(this,[this._dataSource.getData()]);break}}function e(j){switch(j){case"idle":this._commentsDataSource.ensureData();break;case"loading":break;case"loaded":d.apply(this,[this._commentsDataSource.getData()]);break}}function f(k){this._data=k;var j=this;if(this._dataSource){this._dataSource.removeObserver(this._dataSourceObserver);this._dataSource=this._dataSourceObserver=null}if(this._commentsDataSource){this._commentsDataSource.removeObserver(this._commentsDataSourceObserver);this._commentsDataSource=this._commentsDataSourceObserver=null}g("#viewGroup_title").text(this._data.Name);if(this._data.ImageId>0){TRMApi.services.getMedia(this._data.ImageId,function(m){var n=m.Width;var l=m.Height;if(n>170){l=Math.round(l*(170/n));n=170}if(l>170){n=Math.round(n*(170/l));l=170}g("#viewGroup_image").attr("src",TRMApi.services.getImageUrl(m.MediaId)).width(n).height(l)
})}else{g("#viewGroup_image").attr("src",TRMApi.services.getImageUrl(0)).width(170).height(170)}g("#viewGroup_hashTag").text(this._data.ShortName);g("#viewGroup_lastModifiedOn").text(TRMApi.ui.readDate(this._data.LastModifiedOn));g("#viewGroup_description").text(this._data.Description);g("#viewGroup_owner_div").hide();if(this._data.Flags&&this._data.Flags.indexOf("AdminStatus")>-1){TRMApi.services.getGroupAdmins(this._data.GroupId,function(m){if(m.length<1){return}var l=m[0];g("#viewGroup_owner_photo").attr("src",TRMApi.services.getImageThumbnailUrl(l.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE));g("#viewGroup_owner_text").empty().append(g("<div />").append(g("<span />").text(l.FullName+" Last Seen:")).append(" ").append(g("<span />").addClass("user-"+l.UserId+"-status")).append(" ").append(g("<span />").addClass("user-"+l.UserId+"-location"))).append(g("<div />").append(g("<span />").addClass("user-"+l.UserId+"-lastseen")));TRMApi.functions.fillInUser(l,g("#viewGroup_owner_text"));g("#viewGroup_owner_div").show()
})}if(this._data.IsMember){g("#viewGroupDialog .only-member").show();g("#viewGroupDialog .only-nonmember").hide()}else{g("#viewGroupDialog .only-member").hide();g("#viewGroupDialog .only-nonmember").show()}if(this._data.IsAdmin||TRMApi.session.isAdmin()){g("#viewGroupDialog .only-admin").show()}else{g("#viewGroupDialog .only-admin").hide()}if(TRMApi.session.isAdmin()||(this._data.Flags.indexOf("AdminOnlyBreadcrumbs")==-1&&this._data.IsMember)||(this._data.Flags.indexOf("AdminOnlyBreadcrumbs")>-1&&this._data.IsAdmin)){g("#viewGroupDialog .only-breadcrumber").show()}else{g("#viewGroupDialog .only-breadcrumber").hide()}this._dataSource=TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(this._data.GroupId);this._dataSource.addObserver(this._dataSourceObserver=function(){h.apply(j,arguments)});this._commentsDataSource=TRMApi.util.DataSource.getGroupCommentsDataSource(this._data.GroupId);this._commentsDataSource.addObserver(this._commentsDataSourceObserver=function(){e.apply(j,arguments)})}function c(){return this._data=g.extend({},this._data,this.form.serializeMap())
}function b(){var j=this;g("#viewGroup_addBreadcrumb").click(function(){TRMApi.functions.addGroupBreadcrumbs(j._data)});j._commentsValidator=g("#viewGroup_commentsForm").validate({rules:{Comment:{bytemaxlength:255}},submitHandler:function(){var k=g("#viewGroup_comments_comment").val();TRMApi.services.addGroupComment(j._data.GroupId,k,function(){g("#viewGroup_comments_comment").val("")})}});g("#viewGroup_comments_submit").click(function(){g("#viewGroup_commentsForm").submit()});g("#viewGroup_comments_comment").backgroundText("Comment here","comment only-member")}g(document).ready(function(){g("#viewGroupDialog").registerDialog("viewGroupDialog",{form:"#viewGroupForm",init:b,load:f,gather:c,dialogOptions:{position:[330,"middle"]}})})})(jQuery);(function(g){function c(){g("#selectBreadcrumb_breadcrumbs tbody tr").each(function(i){g(this).removeClass((i%2)?"even":"odd").addClass((i%2)?"odd":"even")})}var h=0;function e(){var i=this;if(!i.checked){h--;return}TRMApi.ui.dialogs.confirmDialog.run({Message:"Only Public Breadcrumbs can be added to a group. Hummba has detected that you have selected a Breadcrumb that is not Public. If you add this Breadcrumb to the group, its privacy setting will be changed to Public. Continue?"},{close:function(){if("no"==TRMApi.ui.dialogs.confirmDialog.result){i.checked=false
}else{h++}}})}function f(j){this._data=j;var i=this;TRMApi.util.DataSource.getBreadcrumbsDataSource(TRMApi.session.user.UserId).ensureData(function(k){g("#selectBreadcrumb_breadcrumbs tbody *").remove();g.each(k,function(l){var p=this;var m;var n=g("<tr />").append(g("<td />").append(g("<img />").attr("src",TRMApi.services.getImageThumbnailUrl(this.ImageId)))).append(g("<td />").text(TRMApi.ui.readDate(p.CreatedOn))).append(g("<td />").text(p.Country.Name)).append(g("<td />").append(m=g('<input type="checkbox" />').attr({name:"BreadcrumbId",value:p.BreadcrumbId})));g("#selectBreadcrumb_breadcrumbs tbody").append(n);if(p.Publicity!="Public"){n.find("input").click(e)}});c();h=0})}function d(){return this._data=g.extend({NonPublicBreadcrumbs:h},this._data,this.form.serializeMap())}function b(){var i=this}g(document).ready(function(){g("#selectBreadcrumbDialog").registerDialog("selectBreadcrumbDialog",{form:"#selectBreadcrumbForm",init:b,load:f,gather:d})})})(jQuery);(function(f){function e(g){f("#searchGroups_searchString").val("");
f("#searchGroups_results").hide();this.resize()}function c(){return this._data}function d(h){var g=this;h.preventDefault();h.stopPropagation();if(!this.validator.element(f("#searchGroups_searchString"))){return}TRMApi.services.getGroupsBySearch({SearchString:f("#searchGroups_searchString").val()},function(i){f("#searchGroups_results").show();f("#searchGroups_resultsContainer").empty();f.each(i,function(){var l=this;var m=f("<div />").addClass("actions");if(!l.IsMember){var k=null;m.append(f("<div />").append(k=f("<a />").text("Join Group").attr("href","#").click(function(){TRMApi.functions.joinGroup(l);k.remove()})))}m.append(f("<div />").append(f("<a />").text("View Group").attr("href","#").click(function(){TRMApi.functions.viewGroup(l)})));var j=f("<div />").append(f("<img />").attr("src",TRMApi.services.getImageThumbnailUrl(l.ImageId))).append(f("<div />").addClass("info").append(f("<div />").addClass("name").text(l.Name)).append(f("<div />").addClass("lastmodifiedon").text("Last modified "+TRMApi.ui.readDate(l.LastModifiedOn)))).append(m);
f("#searchGroups_resultsContainer").append(j)});g.resize()})}function b(){var g=this;f("#searchGroups_search").click(function(){d.apply(g,arguments)})}f(document).ready(function(){f("#searchGroupsDialog").registerDialog("searchGroupsDialog",{form:"#searchGroupsForm",init:b,load:e,gather:c,validateOptions:{rules:{SearchString:{bytemaxlength:255,minlength:3}}}})})})(jQuery);(function(e){var g=10;var f;var h=0;function i(){var m=this;setTimeout(function(){TRMApi.services.setPager("GroupMembers",h*g,h*g+g);TRMApi.services.getGroupMembers(m._data.GroupId,e("#viewGroupMembers_friendsOnly").is(":checked"),function(n){e("#viewGroupMembers_members tbody").empty();e.each(n,function(){var r=this;var q=r.UserHeader;var u=TRMApi.session.countryById(q.CountryId||0);var s=q.UserId!=TRMApi.session.user.UserId&&!TRMApi.session.isFriend(q.UserId);var p=m._requestedFriendsDataSource.containsId(q.UserId);var t=e("<tr />").append(e("<td />").append(e("<img />").attr("src",TRMApi.services.getImageThumbnailUrl(q.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE))).append(e("<span />").text(q.UserName))).append(e("<td />").append(TRMApi.functions.createUserLink(q.UserId,q.FullName))).append(e("<td />").text(u?u.Name:"")).append(e("<td />").append(!s?"":(p?e("<span />").text("Request sent"):e("<a />").attr("href","#").text("Invite Friend").click(function(){TRMApi.functions.inviteUser(q)
}))));e("#viewGroupMembers_members tbody").append(t)});if(h>0){e("#viewGroupMembers_previous").show()}else{e("#viewGroupMembers_previous").hide()}f=n.length;if(n.length>=g){e("#viewGroupMembers_next").show()}else{e("#viewGroupMembers_next").hide()}m.resize()})},1)}function j(m){switch(m){case"idle":this._requestedFriendsDataSource.ensureData();break;case"loading":break;case"loaded":i.apply(this);break}}function b(){if(this._requestedFriendsDataSource){this._requestedFriendsDataSource.removeObserver(this._requestedFriendsDataSourceObserver)}this._requestedFriendsDataSource=this._requestedFriendsDataSourceObserver=null}function l(){b.apply(this)}function k(n){this._data=n;var m=this;b.apply(this);e("#viewGroupMembers_allMembers")[0].checked=true;h=0;this._requestedFriendsDataSource=TRMApi.util.DataSource.getRequestedFriendsDataSource(TRMApi.session.user.UserId);this._requestedFriendsDataSource.addObserver(this._requestedFriendsDataSourceObserver=function(p){j.apply(m,arguments)})}function d(){return this._data=e.extend({},this._data,this.form.serializeMap())
}function c(){var m=this;e("#viewGroupMembers_previous").click(function(){if(h>0){h--}i.apply(m)});e("#viewGroupMembers_next").click(function(){if(f>=g){h++}i.apply(m)});e('#viewGroupMembersForm input[@name="FriendsOnly"]').click(function(n){h=0;i.apply(m)})}e(document).ready(function(){e("#viewGroupMembersDialog").registerDialog("viewGroupMembersDialog",{form:"#viewGroupMembersForm",init:c,load:k,gather:d,close:l})})})(jQuery);(function(e){function d(g){this._data=g;var f=this;e("#viewProfile_photo").attr("src",TRMApi.services.getImageThumbnailUrl(g.ImageId));e("#viewProfile_sex").text(g.Gender=="Unknown"?"Unknown":(g.Gender=="M"?"Male":"Female"));e("#viewProfile_country").text(g.CountryId?TRMApi.session.countryById(g.CountryId).Name:"Unknown");e("#viewProfile_city").text(g.HomeTown?g.HomeTown:"Unknown");e("#viewProfile_description").text(g.Description||"");e("#viewProfile_fullname").text(g.FullName);if(TRMApi.session.isFriend(g.UserId)){e("#viewProfile_invite").hide()}else{e("#viewProfile_invite").show()
}}function c(){return this._data=e.extend({},this._data,this.form.serializeMap())}function b(){var f=this;e("#viewProfile_invite").click(function(){TRMApi.services.inviteUsers([f._data.UserId],function(){TRMApi.functions.message({Title:"Result",Message:"Invitation has been sent."})})});e("#viewProfile_message").click(function(){TRMApi.functions.newConversation([f._data])});e("#viewProfile_reportAbuse").click(function(){TRMApi.functions.reportAbuse({UserId:f._data.UserId})})}e(document).ready(function(){e("#viewProfileDialog").registerDialog("viewProfileDialog",{form:"#viewProfileForm",init:b,load:d,gather:c})})})(jQuery);(function(d){function c(e){this._data=e;this.form.unserializeMap(e)}function b(){return this._data=d.extend({},this._data,this.form.serializeMap())}d(document).ready(function(){d("#reportAbuseDialog").registerDialog("reportAbuseDialog",{form:"#reportAbuseForm",load:c,gather:b,validateOptions:{rules:{Text:{bytemaxlength:255}}}})})})(jQuery);(function(c){function d(e){if(typeof e!="undefined"){c.cookie("facebook-tried",e)
}else{return c.cookie("facebook-tried")}}TRMApi.facebook={};TRMApi.callbacks.onFacebookPublishUserAction=function(f){if(!TRMApi.facebook.isLoggedInViaFacebook()){return}var e=FB.Connect.streamPublish(f.Message,f.FacebookAttachment||null,f.FacebookActionLinks||null,f.PublishTargetId||null,null,function(){},false,null)};TRMApi.facebook.hasFacebookSession=function(){return !!FB.Facebook.apiClient.get_session()};TRMApi.facebook.isLoggedInViaFacebook=function(){return TRMApi.facebook.hasFacebookSession()&&TRMApi.session.user.FbUserId==FB.Facebook.apiClient.get_session().uid};TRMApi.facebook.logout=function(e){FB.Connect.logout(e)};TRMApi.facebook.onStartup=function(){FB.Facebook.apiClient.users_getLoggedInUser(function(e){if(!e||e==d()){return}TRMApi.services.loginFb(FB.Facebook.apiClient.get_session(),true,function(f){if(!f){d(e)}})})};function b(){TRMApi.services.connectFb(FB.Facebook.apiClient.get_session(),function(f,e){if(f){TRMApi.services.loginFb(FB.Facebook.apiClient.get_session(),false)
}else{TRMApi.functions.connectWithFb(e)}})}TRMApi.facebook.onAfterConnect=function(){d("");var g=["offline_access","publish_stream","email","user_about_me","user_birthday","user_groups","user_hometown"];var e=new FB.BatchSequencer();var f=[];c.each(g,function(){f.push(FB.Facebook.apiClient.users_hasAppPermission(this,e))});e.execute(function(){var j=[];for(var h=0;h<g.length;h++){if(!f[h].result){j.push(g[h])}}if(!j.length){b();return}FB.Connect.showPermissionDialog(j.join(","),b)})}})(jQuery);(function(b){TRMApi.functions={};TRMApi.templates={};TRMApi.templates.EmptyUser={UserId:0,UserName:"",EmailAddress:"",FirstName:"",LastName:"",Password:"",HomePosition:[0,0],CountryId:0,ImageId:0,Confirm:"",Captcha:""};TRMApi.functions.showSuccessfullConfirmation=function(){TRMApi.ui.message({Title:"Thank you",Message:'Your account has been activated successfully. <iframe src="/components/google_registration_conversion.htm" height="5" width="5" visible=true />'})};TRMApi.functions.showWrongConfirmation=function(){TRMApi.ui.message({Title:"Error",Message:'The entered email was incorrect. <a href="javascript:TRMApi.functions.closeMessage(); TRMApi.functions.confirmEmail();">Try it again.</a>'})
};TRMApi.functions.showDupliciteConfirmation=function(){TRMApi.ui.message({Title:"Error",Message:"The entered user has already been confirmed."})};TRMApi.functions.setCaptcha=function(c){b(c).attr("src","CaptchaImageController.ashx?r="+Math.random())};TRMApi.functions.register=function(d){var c=b.extend(true,{},TRMApi.templates.EmptyUser);TRMApi.ui.dialogs.registerDialog.run(c,{save:function(e){TRMApi.services.register(e,function(f){TRMApi.functions.message({Message:"Thank you for your registration. We have sent confirmation code to the entered email address.",Title:"Thank you",OnClose:d})});this.close()}})};TRMApi.functions.forgottenPassword=function(){var c={};TRMApi.ui.dialogs.forgottenPasswordDialog.run(c,{save:function(d){TRMApi.services.forgottenPassword(d.UserName,d.EmailAddress,d.Captcha,function(e){if(e.Success){TRMApi.functions.message({Message:"We found the user mentioned and sent email to "+e.EmailAddress+". Please find the link in the email and click on it.",Title:"Request processed"})
}else{TRMApi.functions.message({Message:"Unfortunatelly, we have not found any record matching the entered data.",Title:"Request failed"})}});this.close()}})};TRMApi.functions.addImage=function(c){TRMApi.functions.addImageWithFormat("JPG",c)};TRMApi.functions.addImageWithFormat=function(c,d){TRMApi.ui.dialogs.addImageDialog.run({Type:c},{save:function(e){TRMApi.services.uploadImage(e,d);this.close()},close:function(){}})};TRMApi.functions.addVideo=function(c){TRMApi.ui.dialogs.addVideoDialog.run(null,{save:function(d){TRMApi.services.uploadVideo(d,c);this.close()},close:function(){}})};TRMApi.functions.confirmEmail=function(){TRMApi.ui.dialogs.confirmEmail.run({},{save:function(c){TRMApi.services.confirmEmail(c.Email,c.ConfirmationCode,function(d){switch(d){case"InvalidEmailAddressException":TRMApi.functions.showWrongConfirmation();break;case"UserAlreadyConfirmedException":TRMApi.functions.showDupliciteConfirmation();break;default:TRMApi.functions.showSuccessfullConfirmation()}});this.close()
}})};TRMApi.functions.connectWithFb=function(c){if(!TRMApi.facebook.hasFacebookSession()){return}if(TRMApi.session.user&&!TRMApi.session.user.IsGuest){TRMApi.ui.dialogs.confirmDialog.run({Message:"The currently logged in Hummba user "+TRMApi.session.user.FullName+" will be linked with the facebook user "+c+". Are you sure?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.linkFb(null,null,function(d){if(!d){TRMApi.functions.message({Title:"Error",Message:"There has been an error doing the linking."})}else{TRMApi.functions.message({Title:"Success",Message:"Your facebook profile has been successfully linked.",OnClose:function(){TRMApi.services.loginFb(FB.Facebook.apiClient.get_session(),false)}})}})}}})}else{TRMApi.ui.dialogs.connectFbDialog.run({FacebookFullName:c},{save:function(d){switch(d.Action[0]){case"ConnectWithFacebook":TRMApi.services.registerFb(d);break;case"LinkWithFacebook":TRMApi.services.linkFb(d.Username,d.Password,function(e){if(!e){TRMApi.ui.showValidationErrorDialog("The specified username or password was invalid or the user is not yet confirmed.",function(){TRMApi.functions.connectWithFb()
})}else{TRMApi.functions.message({Title:"Success",Message:"Your facebook profile has been successfully linked.",OnClose:function(){TRMApi.services.loginFb(FB.Facebook.apiClient.get_session(),false)}})}});break}this.close()}})}};TRMApi.functions.resendConfirmationEmail=function(){TRMApi.ui.dialogs.resendConfirmationEmailDialog.run({},{save:function(c){TRMApi.services.sendConfirmationEmail(c.Email,function(d){if(d){TRMApi.functions.message({Message:"Your confirmation email has been resent successfully.",Title:"Confirmation Email"})}else{TRMApi.functions.message({Message:"The email you entered does not correspond to any email in our database or the user has already been confirmed.",Title:"Error"})}});this.close()}})};TRMApi.functions.downloadApplication=function(){TRMApi.ui.dialogs.downloadApplicationDialog.run(null,{save:function(c){window.open(c.application.ArchiveUrl);TRMApi.functions.showContent(c.model.ZipHelpContentId);this.close()}})};TRMApi.callbacks.onUnconfirmedUserLogin=function(){TRMApi.ui.dialogs.messageDialog.run({Message:'The user is not yet confirmed. You have to <a href="#" onclick="TRMApi.ui.dialogs.messageDialog.close(\'enter-code\')">enter the confirmation code</a> first.'},{close:function(){switch(TRMApi.ui.dialogs.messageDialog.result){case"enter-code":TRMApi.functions.confirmEmail();
break}}})};TRMApi.functions.message=TRMApi.ui.message;TRMApi.functions.closeMessage=TRMApi.ui.closeMessage;TRMApi.functions.showContent=TRMApi.ui.showContent})(jQuery);(function(a7){var af;var aT;var y;var r;var M;var bq;var E;var ab;var aA;var ae;var at;var F;var ad;var A;var bh;var aJ;var m;var g;var br;var V;var a0;var aC;var bn;var O;var B={MapItemId:0,Name:"",Description:"",Publicity:"Public",CreatedBy:"",CreatedOn:"",ApprovedBy:null,ApprovedOn:null,IsPremium:false,Price:0,SpamReportedBy:null,SpamReportedOn:null,CountDownloaded:0,LanguageId:1,CategoryId:1,ImageId:null,ProjectId:0,RatingValue:0,RatingCount:0,NewProjectName:"",Tags:"",UserId:null,Clips:[]};var c={BreadcrumbId:0,Name:"",ImageId:0,Publicity:"FriendsOnly",LanguageId:null,CategoryId:null,Tags:"",Description:"",CityId:0,CountryId:0};var aj=a7.extend({Type:"Poi",Position:[0,0],CityId:0,CountryId:0},B);var aX=a7.extend({Type:"Area",Points:[]},B);var G={ClipId:0,MapItemId:0,MediaId:0,Name:"",Media:{}};var am={TripId:0,UserId:0,CreatedOn:"",CreatedBy:"",Name:""};
var x={ProjectId:0,UserId:0,CreatedOn:"",CreatedBy:"",Name:""};var a5={FootprintId:0,Emails:[]};var N={OldPassword:"",Password:"",Confirmation:""};var az={GroupId:0,Name:"",ShortName:"",Description:"",LanguageId:"",CountryId:""};var ay;var bl=0;var bu=0;var ah=0;var aD=0;var av=0;var aE=null;var a4=null;var q=null;var au=null;var aH=null;var d=null;var u=null;var Z=null;var i=null;var bk=null;var s=null;var bo=null;var a2;var n=true;var bs;var ai;function ar(){if(ah==0){a7(".onoff-anypoints").hide()}else{a7(".onoff-anypoints").show()}if(TRMApi.session.isAdmin()){a7(".adminonly").show()}else{a7(".adminonly").hide()}if(TRMApi.session.isBannerAdmin()){a7(".banneradminonly").show()}else{a7(".banneradminonly").hide()}if(TRMApi.session.user&&TRMApi.session.user.Flags&&TRMApi.session.user.Flags.indexOf("IsFacebookOnly")>-1){a7(".facebookonlyonly").show()}else{a7(".facebookonlyonly").hide()}if(TRMApi.util.userIsFriendOfAll(TRMApi.session.user)){ae.content.css("visibility","hidden");ae.content.css("height","0px")
}else{ae.content.css("visibility","");ae.content.css("height","")}}function S(by){if(!by.MapItems){by.MapItems=[]}ay=by;bl=by.Type=="Countries"?by.MapItems.length:0;bu=by.Type=="Cities"?by.MapItems.length:0;ah=by.Type=="MapItems"?by.MapItems.length:0;aD=by.Type=="Footprints"?by.MapItems.length:0;av=by.Type=="Breadcrumbs"?by.MapItems.length:0;var bx=a7("#search-tab-results-list").empty();switch(by.Type){case"Countries":a7.each(ay.MapItems,function(){var bz=this.Country;bx.append(a9(this,bz.Name,"total: "+this.Count,function(){a7("#controlPanel_selectCountry").selectOptions(bz.CountryId);a7("#controlPanel_city").val("");TRMApi.functions.panToCountry(bz)},null))});break;case"Cities":a7.each(ay.MapItems,function(bz){if(bz<25){var bA=this.City;bx.append(a9(this,bA.Name,"total: "+this.Count,function(){a7("#controlPanel_selectCountry").selectOptions(bA.CountryId);a7("#controlPanel_city").val(bA.Name);TRMApi.functions.panToCity(bA)},null))}});break;case"MapItems":var bw;for(bw=0;bw<ay.MapItems.length&&bw<25;
bw++){(function(bz){bz.Description=bz.Description||"";bx.append(a9(bz,bz.Name,bz.Description.length>50?bz.Description.substring(0,50)+"...":bz.Description,function(){af.gmap().openMapItem(bz.MapItemId)},null))})(ay.MapItems[bw])}break;case"Footprints":var bw;for(bw=0;bw<ay.MapItems.length;bw++){(function(bB){var bA=a7("<span />").append(a7("<div />").append(a7("<strong />").text("User:")).append(TRMApi.functions.createUserLink(bB.UserId,bB.User.FullName))).append(a7("<div />").append(a7("<strong />").text("Date:")).append(a7("<span />").text(TRMApi.util.formatRemoteDate(bB.StartTime,bB.TimeZoneOffset)))).append(a7("<div />").append(a7("<strong />").text("Name:")).append(a7("<span />").text(bB.Name))).append(a7("<div />").append(a7("<strong />").text("Location:")).append(a7("<span />").text(bB.StartLocation)));var bz=a7("<span />").append(a1("View",function(bC){TRMApi.functions.showFootprint(bB.FootprintId);bC.stopPropagation()},null,"View this footprint."));bx.append(l(bB,bA,function(){af.gmap().openMapItem(bB.MapItemId)
},bz))})(ay.MapItems[bw])}break;case"Breadcrumbs":var bw;for(bw=0;bw<ay.MapItems.length;bw++){(function(bB){var bA=a7("<span />").append(a7("<div />").append(a7("<strong />").text("User:")).append(TRMApi.functions.createUserLink(bB.UserId,bB.User.FullName))).append(a7("<div />").append(a7("<strong />").text("Date:")).append(a7("<span />").text(TRMApi.util.formatDate(bB.CreatedOn)))).append(a7("<div />").append(a7("<strong />").text("Name:")).append(a7("<span />").text(bB.Name))).append(a7("<div />").append(a7("<strong />").text("Location:")).append(a7("<span />").text(bB.Location)));var bz=a7("<span />").append(a1("View",function(bC){af.gmap().openMapItem(bB.MapItemId);bC.stopPropagation()},null,"View this breadcrumb."));bx.append(l(bB,bA,function(){af.gmap().openMapItem(bB.MapItemId)},bz))})(ay.MapItems[bw])}break}ar()}function bv(){af.height(M.innerHeight()-2);af.width(M.innerWidth()-1);af.gmap().notifyResize();TRMApi.ui.dialogs.footprintPhoto.notifyResize();TRMApi.ui.dialogs.breadcrumbPhoto.notifyResize();
TRMApi.ui.dialogs.conversationDialog.notifyResize();a7("#search-tab-results").height(r.innerHeight()-a7("#search-tab-header").outerHeight()-12);a7("#inbox-tab-notifications").height(r.innerHeight()-35-12);a7("#inbox-tab-conversations").height(r.innerHeight()-35-12);ad.resize(r.innerHeight()-12);A.resize(r.innerHeight()-12);bh.resize(r.innerHeight()-36);aJ.resize(r.innerHeight()-36);m.resize(r.innerHeight()-12);g.resize(r.innerHeight()-12);a7("#ui-layout-north-overlay").height(y.outerHeight());a7("#ui-layout-north-overlay").width(y.outerWidth());a7("#ui-layout-south-overlay").height(aT.outerHeight());a7("#ui-layout-south-overlay").width(aT.outerWidth());a7("#ui-layout-west-overlay").height(r.outerHeight());a7("#ui-layout-west-overlay").width(r.outerWidth());var bw=70;a7.each(a7(".main_control_widget_menu ul li"),function(){bw+=a7(this).outerWidth()+1});a7("#statusContainer").width(a7("#header_navigation_stripe").width()-bw)}function T(){a7("#header_top_bar").load("components/panel_north.aspx?rnd="+Math.random(),null,function(){a7("#northPanel_loginForm").validate({onfocusout:false,onkeyup:false,onclick:false,rules:{},showErrors:function(bw,bx){if(this.numberOfInvalids()==0){return
}TRMApi.ui.showValidationErrorDialog("Please enter both, the username and password")},submitHandler:function(bw){var bw=a7(bw).serializeMap();TRMApi.services.login(bw.Username[0],bw.Password[0])}});a7("#northPanel_logoutButton").click(function(){TRMApi.functions.logout()});a7("#northPanel_txtUsername").backgroundText("Username","username");a7("#northPanel_txtPassword").backgroundText("Password","password");if(FB.XFBML){FB.XFBML.Host.parseDomElement(a7("#header_top_bar")[0])}})}function aG(){a7("#ui-layout-north-overlay").show();a7("#ui-layout-south-overlay").show();a7("#ui-layout-west-overlay").show()}function Q(){a7("#ui-layout-north-overlay").show();a7("#ui-layout-south-overlay").show()}function aI(){a7("#ui-layout-north-overlay").hide();a7("#ui-layout-south-overlay").hide();a7("#ui-layout-west-overlay").hide()}function ax(){TRMApi.functions.message({Title:"Success",Message:"Your email address won't receive any more status emails."})}function D(){TRMApi.functions.message({Title:"Error",Message:'The entered combination of username and password reset code was incorrect. <a href="javascript:TRMApi.functions.closeMessage(); TRMApi.functions.forgottenPassword();">Try it again.</a>'})
}function aR(){TRMApi.functions.message({Title:"Error",Message:"Either the footprint does not exist on the website anymore or you don't have access to it."})}function C(bz){switch(bz){case"successfull-confirmation":TRMApi.functions.showSuccessfullConfirmation();break;case"wrong-confirmation":TRMApi.functions.showWrongConfirmation();break;case"duplicite-confirmation":TRMApi.functions.showDupliciteConfirmation();break;case"wrong-forgottenpassword":D();break;case"statusemail-disabled":ax();break;case"unknown-footprint":aR();break;case"browse":bs="browse";break;case"trips":bs="trips";break;case"uploads":bs="projects";break;case"footprints":bs="footprints";break;case"breadcrumbs":bs="breadcrumbs";break;case"friends":bs="friends";break}var bF;if(bF=bz.match(/^pan=([0-9]*)$/)){bs="browse";TRMApi.services.getMapItem(bF[1],function(bI){TRMApi.functions.panToMapItem(bI)})}var bx;if(bx=bz.match(/^pbid=([0-9]*)$/)){bs="browse";TRMApi.services.getBreadcrumb(bx[1],function(bI){TRMApi.functions.panToMapItem(bI)
})}var bE;if(bE=bz.match(/^ufid=([0-9]*),([0-9]*)(,([0-9]*))?$/)){bs="friends";q=[parseInt(bE[1]),parseInt(bE[2]),bE[4]?parseInt(bE[4]):null]}var bH;if(bH=bz.match(/^ubid=([0-9]*),([0-9]*)$/)){bs="friends";au=[parseInt(bH[1]),parseInt(bH[2])]}var bG;if(bG=bz.match(/^conv=([0-9]*)?$/)){Z=parseInt(bG[1])}var bB;if(bB=bz.match(/^uid=([0-9]*)$/)){bs="friends";u=bB[1];if(TRMApi.session.user.IsGuest){TRMApi.functions.login(function(){})}}var bC;if(bC=bz.match(/^uidp=([0-9]*),([0-9.]*),([0-9.]*)$/)){bs="friends";aH=[parseInt(bC[1]),[parseFloat(bC[2]),parseFloat(bC[3])]]}var by;if(by=bz.match(/^tid=([0-9]*)$/)){bs="trips";a4=by[1]}var bD;if(bD=bz.match(/^correct-forgottenpassword=(.*)$/)){aO(function(){TRMApi.functions.forgottenPassword2(bD[1])})}var bA;if(bA=bz.match(/^gid=([0-9]*)$/)){bs="groups";i=bA[1]}var bw;if(bw=bz.match(/^agid=([0-9]*)$/)){initialViev="browse-trip";bk=bw[1]}}var bg=false;TRMApi.callbacks.onSignalsStart=function(){bg=false};function aF(bx,by){by=by||a7(document.body);var bw=bx.CurrentLocation||"unknown";
if(bx.CurrentPosition&&TRMApi.session.user.CurrentPosition){bw+=" ("+Math.round(TRMApi.util.calculateDistanceInKm(bx.CurrentPosition,TRMApi.session.user.CurrentPosition))+" km from you)"}by.find(".user-"+bx.UserId+"-status").text(bx.Status);by.find(".user-"+bx.UserId+"-location").text(bw);by.find(".user-"+bx.UserId+"-lastseen").text(TRMApi.ui.readLastSeen(bx))}TRMApi.functions.fillInUser=aF;TRMApi.callbacks.onOtherChanged=function(bw){aF(bw);af.gmap().updateUser(bw);bg=true};var aU=0;function aK(){aU++;if(!(aU%100)){a7.each(TRMApi.session.friends(),function(bx){var bw=TRMApi.session.others[this.User2Id];aF(bw)})}a7.each(TRMApi.session.friends(),function(bx){var bw=TRMApi.session.others[this.User2Id];if(TRMApi.util.userIsLive(bw)){if(!(aU%2)){a7(".user-"+bw.UserId+"-photo").removeClass("flashNow")}else{a7(".user-"+bw.UserId+"-photo").addClass("flashNow")}}});setTimeout(aK,1000)}var aP=TRMApi.util.escapeHtml;function aZ(by){function bC(){return'<a href="javascript:TRMApi.functions.selectFriend('+by.ParamUserId+', true)">'+aP(by.ParamUserName)+"</a>"
}function bz(){return by.ParamUserGender=="M"?"his":(by.ParamUserGender=="F"?"her":"his/her")}function bH(){return'<a href="javascript:TRMApi.functions.selectFriendFootprint('+by.ParamUserId+", "+by.ParamFootprintId+', null, true)">'+aP(by.ParamFootprintName)+"</a>"}function bI(){return'<a href="javascript:TRMApi.functions.showFootprintPhotoById('+by.ParamFootprintId+", "+by.ParamFootprintPhotoId+')">'+aP(by.ParamFootprintPhotoDescription||"HERE")+"</a>"}function bw(){return'<a href="javascript:TRMApi.functions.selectFriendBreadcrumb('+by.ParamUserId+", "+by.ParamBreadcrumbId+')">'+aP(by.ParamBreadcrumbName)+"</a>"}function bF(){return'<a href="javascript:TRMApi.functions.selectFriendBreadcrumb(TRMApi.session.user.UserId, '+by.ParamBreadcrumbId+')">'+aP(by.ParamBreadcrumbName)+"</a>"}function bB(){return'<a href="javascript:TRMApi.functions.panToMapItemId('+by.ParamMapItemId+", ["+by.ParamPosition[0]+","+by.ParamPosition[1]+']);">'+aP(by.ParamMapItemName)+"</a>"}function bE(){return'<a href="javascript:TRMApi.functions.viewGroupById('+by.ParamGroupId+');">'+aP(by.ParamGroupName)+"</a>"
}function bG(){return'<a href="javascript:TRMApi.functions.showGroupBreadcrumbById('+by.ParamGroupId+", "+by.ParamBreadcrumbId+');">'+aP(by.ParamBreadcrumbName)+"</a>"}function bD(){return'<a href="javascript:TRMApi.functions.selectFriend('+by.ParamUserId+");TRMApi.functions.panTo(["+by.ParamPosition[0]+","+by.ParamPosition[1]+'], TRMApi.constants.USER_ZOOM);">'+aP(by.ParamString)+"</a>"}function bA(bK,bJ,bL){return(by.ParamFlags&&by.ParamFlags.indexOf(bK)>-1)?bJ:bL}switch(by.Type){case"StatusChanged":return bC()+" changed "+bz()+" status "+bA("IsLive","live","")+" to "+aP(by.ParamString)+".";case"PositionChanged":return bC()+" is "+bA("IsLive","travelling live at","now at")+" "+bD()+".";case"FriendRequest":return bC()+" asked to be your friend.";case"FootprintCreated":return bC()+" created new footprint "+bH()+".";case"FootprintUpdated":return bC()+" updated "+bA("IsLive","live","")+" footprint "+bH()+".";case"FootprintPhotosUploaded":return bC()+" added some photos to footprint "+bH()+".";
case"FootprintPhotoCommented":return bC()+" commented on your photo "+bI()+".";case"BreadcrumbUploaded":return bC()+" created new breadcrumb "+bw()+".";case"BreadcrumbCommented":return bC()+" commented on your photo "+bF()+".";case"GroupCommented":return bC()+" commented group "+bE()+".";case"GroupBreadcrumbAdded":var bx=parseInt(by.ParamString);if(bx==1){return bC()+" added breadcrumb "+bG()+" to group "+bE()}else{return bC()+" added breadcrumb "+bG()+" and "+(bx-1)+" more to group "+bE()}case"GroupInvitation":return bC()+" has invited you to group "+bE()+".";case"GroupJoined":return bC()+" joined group "+bE()+"."}return by.Type}function aV(bz){var by=function(bA){var bB="0"+bA;return bB.substring(bB.length-2)};var bx=new Date();var bw=Date.abbrMonthNames[bz.getMonth()]+" "+bz.getDate();if(bz.getMonth()==bx.getMonth()&&bz.getDate()==bx.getDate()){bw="today"}return bw+" "+by(bz.getHours())+":"+by(bz.getMinutes())}TRMApi.util.formatDate=aV;var K=0;TRMApi.functions.getNotifications=function(){TRMApi.services.getNotifications(function(bw){K=0;
a7("#inbox-tab-notifications-list").empty();TRMApi.functions.insertNotifications(bw)})};TRMApi.functions.insertNotifications=function(bw){a7.each(bw,function(){var bx=this;if(bx.NotificationId<K){return}a7("#inbox-tab-notifications-list").prepend(a7("<li />").html(aV(bx.HappenedOn)+" "+aZ(bx)).prepend(a7("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(bx.ParamUserImageId,TRMApi.constants.DEFAULT_USER_IMAGE)).click(function(){TRMApi.functions.selectFriend(bx.ParamUserId,true)})).append(a7("<div />").css("clear","both").text(" ")));switch(bx.Type){case"FootprintPhotoCommented":TRMApi.util.DataSource.getFootprintPhotosDataSource(bx.ParamFootprintId).clear();TRMApi.util.DataSource.getFootprintPhotoCommentsDataSource(bx.ParamFootprintPhotoId).clear();break}K=bx.NotificationId});if(a7("#inbox-tab-notifications-list li").length>0){a7("#inbox-tab-notifications-help").hide()}else{a7("#inbox-tab-notifications-help").show()}};TRMApi.callbacks.onNotifications=function(bw){a7.each(bw,function(){a7.noticeAdd({text:aZ(this),stayTime:15000})
});TRMApi.functions.insertNotifications(bw)};TRMApi.callbacks.onSignalsEnd=function(){if(bg){af.gmap().refresh()}};function al(){O.show("west");a7("#header_navigation_stripe").show();af.gmap().setInsideLayout();bv()}function aQ(){if(TRMApi.session.user.IsGuest){a7("#header_navigation_stripe .status").hide();a7("#search-tab-results-help").show();a7("#search-tab-results-guides").hide();al()}else{var bx=TRMApi.session.user.Status||"no status";if(bx.length>35){bx=bx.substr(0,35)+"..."}var bw=TRMApi.session.user.CurrentLocation||"nowhere";if(bw.length>35){bw="..."+bw.substr(bw.length-35)}a7(".myself-fullname").text(TRMApi.session.user.FullName);a7(".myself-status .text").text(bx).attr("title",TRMApi.session.user.Status||"User does not have any status set");a7(".myself-location").text(bw).attr("title",TRMApi.session.user.CurrentLocation||"User does not have any location set");a7("#header_navigation_stripe .status").show();a7("#search-tab-results-help").hide();a7("#search-tab-results-guides").show();
al()}af.gmap().setUser(TRMApi.session.user);a7("#editProfileDialog_deleteLink").attr("href","mailto:info@hummba.com?subject=Please%20delete%20my%20profile&body=I%20would%20like%20you%20to%20delete%20my%20profile,%20"+TRMApi.session.user.UserName+",%20from%20hummba.com%20%0a%0d%0a%0dThank%20you,%20"+TRMApi.session.user.FullName)}var bf=null;TRMApi.callbacks.onUserChanged=function(bw){if(TRMApi.session.user.UserId==-1){window.location.href="Map.aspx?rnd="+Math.random();return}T();aQ();if(bf==TRMApi.session.user.UserId){return}bf=TRMApi.session.user.UserId;if(TRMApi.session.user.IsGuest){a7(".onoff-loggedin").hide()}else{a7(".onoff-loggedin").show();TRMApi.ui.dialogs.loginDialog.close()}if(TRMApi.session.user.IsGuest||!TRMApi.session.homeCountry){TRMApi.functions.panToWholeWorld()}else{TRMApi.functions.panToCountry(TRMApi.session.homeCountry)}TRMApi.ui.projectTabs={};ad.removeAllTabs();TRMApi.ui.tripTabs={};A.removeAllTabs();TRMApi.ui.footprintTabs={};TRMApi.ui.breadcrumbTabs={};TRMApi.ui.groupTabs={};
bh.removeAllTabs();aJ.removeAllTabs();TRMApi.ui.friendTabs={};delete TRMApi.ui.explicitFootprintsTab;m.removeAllTabs();g.removeAllTabs();n=true;af.gmap().setPaused(true);af.gmap().clearData();af.gmap().clearFootprintData();TRMApi.ui.setInitial();TRMApi.services.getProjects(TRMApi.session.user.UserId);TRMApi.services.getTrips(TRMApi.session.user.UserId);TRMApi.services.getFootprints(TRMApi.session.user.UserId);TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);TRMApi.services.getExplicitFootprints();TRMApi.services.getUserRelations(TRMApi.session.user.UserId);TRMApi.services.getGroups(TRMApi.session.user.UserId);TRMApi.functions.getNotifications();TRMApi.util.DataSource.getConversationHeadersDataSource().clear();ar()};TRMApi.callbacks.onSessionStart=function(){bf=TRMApi.session.user.UserId;a7("#uploadKml_languageId").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name"});a7("#uploadKml_categoryId").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name"});
a7("#addNew_languageId").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name"});a7("#addNew_categoryId").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name"});a7("#addNew_countryCode").bindOptions(TRMApi.session.countries,{valueProperty:"Iso3166",textProperty:"Name"});a7("#advancedSearch_categoryId").clearOptions().addOption("","").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name",clear:false});a7("#advancedSearch_languageId").clearOptions().addOption("0","(any)").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name",clear:false});a7("#advancedSearch_countryId").clearOptions().addOption("","").bindOptions(TRMApi.session.countries,{valueProperty:"CountryId",textProperty:"Name",clear:false});a7("#editFootprint_languageId").clearOptions().addOption("","").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name",clear:false});a7("#editFootprint_categoryId").clearOptions().addOption("","").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name",clear:false});
a7("#editFootprint_countryCode").clearOptions().addOption("","").bindOptions(TRMApi.session.countries,{valueProperty:"Iso3166",textProperty:"Name",clear:false});a7("#editBreadcrumb_languageId").clearOptions().addOption("","").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name",clear:false});a7("#editBreadcrumb_categoryId").clearOptions().addOption("","").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name",clear:false});a7("#editBreadcrumb_countryCode").clearOptions().addOption("","").bindOptions(TRMApi.session.countries,{valueProperty:"Iso3166",textProperty:"Name",clear:false});a7("#addTrip_languageId").clearOptions().addOption("","").bindOptions(TRMApi.session.languages,{valueProperty:"LanguageId",textProperty:"Name",clear:false});a7("#addTrip_categoryId").clearOptions().addOption("","").bindOptions(TRMApi.session.categories,{valueProperty:"CategoryId",textProperty:"Name",clear:false});a7("#advancedSearch_countryId").clearOptions().addOption("","").bindOptions(TRMApi.session.countries,{valueProperty:"CountryId",textProperty:"Name",clear:false});
a7("#addTrip_countryCode").clearOptions().addOption("","").bindOptions(TRMApi.session.countries,{valueProperty:"Iso3166",textProperty:"Name",clear:false});TRMApi.services.getProjects(TRMApi.session.user.UserId);TRMApi.services.getTrips(TRMApi.session.user.UserId);TRMApi.services.getFootprints(TRMApi.session.user.UserId);TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);TRMApi.services.getExplicitFootprints();TRMApi.services.getUserRelations(TRMApi.session.user.UserId);TRMApi.services.getGroups(TRMApi.session.user.UserId);TRMApi.functions.getNotifications();if(TRMApi.session.user.IsGuest||!TRMApi.session.homeCountry){TRMApi.functions.panToWholeWorld()}else{TRMApi.functions.panToCountry(TRMApi.session.homeCountry)}a7.history.init(C);T();aQ();ar();TRMApi.util.DataSource.getConversationHeadersDataSource().addObserver(TRMApi.callbacks.onConversationHeadersDataSourceChanged);aK()};function a1(bw,bA,by,bz){var bx;bx=a7("<a />").addClass("global_control_button_style").text(bw);if(!!bz){bx.attr("title",bz)
}if(typeof(bA)=="string"){bx.attr("href",bA).attr("target","_new")}else{bx.click(bA)}if(typeof(by)!="undefined"){bx.addClass(by)}return bx}function a3(bx){if(bx.length<50){return a7("<div />").text(bx)}var bz=a7("<div />").addClass("expandable");var bw;var by;by=a7("<div />").addClass("short").text(bx.substring(0,50)+"... ").append(a7("<a />").text("more").attr("href","#").click(function(){bw.show("fast");by.hide("fast")}));bw=a7("<div />").addClass("long").text(bx).append("<br />").append(a7("<a />").text("less").attr("href","#").click(function(){bw.hide("fast");by.show("fast")})).css("display","none");bz.append(by).append(bw);return bz}function aY(bw){if(bw.Image||bw.Media){return TRMApi.services.getImageThumbnailTag(bw.Image||bw.Media)}else{if(bw.ImageId||bw.EmbedSourceImageId||bw.RandomImageId){return a7("<img />").attr("src",TRMApi.services.getImageThumbnailUrl(bw.ImageId||bw.EmbedSourceImageId||bw.RandomImageId))}else{if(bw.FootprintId){return a7("<img />").attr("src","images/content/default_footprint.jpg")
}else{if(bw.Country&&bw.Country.Iso3166){return a7("<img />").attr("src",TRMApi.services.getCountryFlagUrl(bw.Country.Iso3166))}}}}return a7("<div />")}function l(bB,bA,bx,bz,bC){var by;if(!bC){by=a7("<div />")}else{by=a7('<div id="'+bC+'" />')}by.data("data",bB);var bw;by.addClass("biglistitem");by.append(aY(bB).click(bx));by.append(a7("<div />").addClass("biglistitem-content").append(bA));by.append(bw=a7("<div />").addClass("biglistitem-buttons"));bw.append(bz);by.append(a7("<div />").css("clear","both"));return by}function a9(bC,by,bF,bE,bx,bz){var bw;if(!bz){bw=a7("<div />")}else{bw=a7('<div id="'+bz+'" />')}bw.data("data",bC);bw.addClass("tra-item");bw.append(aY(bC).addClass("footprint-photo-icon"));var bD;bw.append(by).append(bD=a7("<div />").addClass("global_user_style")).click(bE);if(typeof bF=="string"){bD.text(bF)}else{bD.append(bF)}if(bC.RatingValue){var bB=a7("<div />").addClass("trips_star_rating").prependTo(bw);bB.append(TRMApi.ui.createStars(bC.RatingValue))}if(bx){var bA=a7("<div />").addClass("main_control_trips_menu").prependTo(bw);
bA.append(bx);bw.bind("mouseover",function(){bA.show()}).bind("mouseout",function(){bA.hide()})}return bw}function aB(by,bA,bB,bw){var bz;var bx;bx=a7("<div />").append(bz=a7("<div />").addClass("main_control_trips_menu")).append(TRMApi.services.getImageThumbnailTag(by.Media).addClass("footprint-photo-icon")).append(a7("<span />").text(by.Description)).append(a7("<span />").addClass("global_user_style").text(TRMApi.util.formatRemoteDate(by.TakenOn,bA)+(by.CreatedVia=="Mobile"?" LIVE from the MOBILE":""))).click(bB).bind("mouseover",function(){bz.show()}).bind("mouseout",function(){bz.hide()});bz.append(bw);return bx}function f(bx,bw){return false}function R(bx,bw){return false}TRMApi.ui.projectTabs={};TRMApi.ui.tripTabs={};TRMApi.ui.footprintTabs={};TRMApi.ui.breadcrumbTabs={};TRMApi.ui.groupTabs={};TRMApi.ui.friendTabs={};TRMApi.functions.createUserLink=function(bw,bx){if(bw==TRMApi.session.user.UserId){return a7("<span />").addClass("user-link").text("You")}return a7("<a />").text(bx).attr("href","#").addClass("user-link").click(function(by){TRMApi.functions.viewUser(bw);
by.stopPropagation()})};function X(bx){var bw=0;a7("#inbox-tab-conversations-list li").remove();a7.each(bx,function(){var bA=this;if(!bA.IsRead){bw++}function bz(){var bE=a7("<span />");var bF=0;a7.each(bA.Recipients,function(){var bG=this;if(bG.UserId!=TRMApi.session.user.UserId){if(bF>0){bE.append(",")}bE.append(TRMApi.functions.createUserLink(bG.UserId,bG.FullName));bF++}});return bE}var bB;a7("#inbox-tab-conversations-list").append(bB=a7("<li />").append(a7("<img />").addClass("user-photo-icon").css("margin","0 3px").attr("src",TRMApi.services.getImageThumbnailUrl(bA.Sender.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE)).click(function(bE){TRMApi.functions.selectFriend(bA.Sender.UserId,true);bE.stopPropagation()})).append(a7("<div />").addClass("conv-header").append(a7("<span />").addClass("date").html(aV(bA.CreatedOn))).append(bz())).append(a7("<div />").addClass("conv-subject").addClass(bA.IsRead?"":"conv-unread").text("Subject: "+bA.Subject)).append(a7("<div />").addClass("conv-content").text(bA.Content.substr(0,20)+"...")).click(function(){TRMApi.functions.openConversation(bA.ConversationId)
}));function bD(){var bE=a7("<span />");bE.append(a7("<a />").attr({href:"#",title:"Delete"}).append(a7("<img />").attr("src","images/global/close_button.jpg")).click(function(bF){TRMApi.functions.deleteConversation(bA);bF.stopPropagation()}));return bE}var bC=a7("<div />").addClass("main_control_trips_menu").prependTo(bB);bC.append(bD());bB.bind("mouseover",function(){bC.show()}).bind("mouseout",function(){bC.hide()})});if(a7("#inbox-tab-conversations-list li").length>0){a7("#inbox-tab-conversations-help").hide()}else{a7("#inbox-tab-conversations-help").show()}var by="Inbox";if(bw>0){by+=" ("+bw+")"}at.text(by)}TRMApi.callbacks.onConversationHeadersDataSourceChanged=function(bw){switch(bw){case"idle":this.ensureData();break;case"loading":break;case"loaded":X(this.getData());break}};TRMApi.callbacks.onProjectsChanged=function(){a7.each(TRMApi.ui.projectTabs,function(){this.__used=false});a7.each(TRMApi.session.projects,function(bw){var by=this;var bx;if(typeof(TRMApi.ui.projectTabs[by.ProjectId])=="undefined"){bx=TRMApi.ui.projectTabs[by.ProjectId]=new a7.trdatasourceaccordiontab(ad,{footerContent:a7("<span />").append(a1("Delete Upload",function(){TRMApi.functions.deleteProject(by)
},null,"This will delete the entire set of data in that upload.")).append(" ").append(a1("Add Poi",function(){TRMApi.functions.addNewPoi({ProjectId:by.ProjectId})},null,"This will allow you to add a point of interest on the map. Once you have found where the POI should go, click on this button and add the point.")),tabIndex:bw,constructElement:function(bz){return a9(bz,bz.Name,"near "+bz.City.Name+", "+bz.Country.Name,function(){TRMApi.functions.panToMapItem(bz)})},getItemId:function(bz){return bz.MapItemId},autoOpen:!n,onHeaderClick:function(){var bz=this.getDataSource();bz.ensureData(function(){TRMApi.functions.panToMapItems(bz.getData())})},dataSource:TRMApi.util.DataSource.getProjectMapItemsDataSource(by.ProjectId)});bx._id=by.ProjectId}else{bx=TRMApi.ui.projectTabs[by.ProjectId]}bx.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(by.Name)));bx.__used=true});a7.each(TRMApi.ui.projectTabs,function(bw){if(!this.__used){ad.removeTab(this);
delete TRMApi.ui.projectTabs[bw]}})};TRMApi.callbacks.onRelationsChanged=function(){relationsOrExplicitFootprintsChanged("relations");TRMApi.ui.onRelationsChanged()};TRMApi.callbacks.onExplicitFootprintsChanged=function(){relationsOrExplicitFootprintsChanged("explicitFootprints")};relationsOrExplicitFootprintsChanged=function(bz){a7.each(TRMApi.ui.friendTabs,function(){this.__used=false});af.gmap().setFriends(TRMApi.session.friends());var by=null;if(TRMApi.session.explicitFootprints.length){var bx;if(typeof(TRMApi.ui.explicitFootprintsTab)=="undefined"){bx=TRMApi.ui.explicitFootprintsTab=new a7.traccordiontab(m,{tabIndex:0,autoOpen:!n,onHeaderClick:function(){}})}else{bx=TRMApi.ui.explicitFootprintsTab}var bA;bx.mainContent(a7("<div />").append(bA=a7("<div />").addClass("friend-content-footprints")));bx.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text("3rd Party and Public Footprints")));a7.each(TRMApi.session.explicitFootprints,function(){var bB=this;
bA.append(a9(bB,bB.Name,a7("<div />").addClass("buttons").append(a1("Play",function(bC){h(bB,true);TRMApi.functions.playFootprint(bB);bC.stopPropagation()},null,"This will play the route that your friend travelled whilst the application was running on his phone.")).append(" ").append(a1("Remove",function(bC){TRMApi.functions.removeExplicitFootprint(bB.FootprintId);bC.stopPropagation()},null,"This will remove the route from the 3rd Party Footprints")),function(){TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close();af.gmap().panTo(bB.BoundingBox.Center,bB.BoundingBox);h(bB,true)},null,"explicit_footprint_"+bB.FootprintId));bA.data("data",bB)});bx.selectFootprint=function(bB){var bE=a7("#explicit_footprint_"+bB);if(bE.length){var bD=bx.mainContent();bD.stop();bD.animate({scrollTop:bD.scrollTop()+bE.position().top-36},"fast");var bC=bE.data("data");af.gmap().panTo(bC.BoundingBox.Center,bC.BoundingBox);h(bC,true)}}}else{if(typeof(TRMApi.ui.explicitFootprintsTab)!="undefined"){m.removeTab(TRMApi.ui.explicitFootprintsTab);
delete TRMApi.ui.explicitFootprintsTab}}a7("#search_for_friends").unautocomplete();var bw=[];a7.each(TRMApi.session.relations,function(bB){if(this.Type!="Friend"&&this.Type!="FriendRequest"){return}var bF=this;var bC=TRMApi.session.others[this.User2Id];var bE;var bD=function(){};bw.push(this);if(typeof(TRMApi.ui.friendTabs[bF.UserRelationId])=="undefined"){bE=TRMApi.ui.friendTabs[bF.UserRelationId]=new a7.traccordiontab(m,{tabIndex:bB+1,autoOpen:!n,onHeaderClick:function(){bD.apply(this,arguments)}});bE._id=bF.User2Id;bE.mainContent(a7("<div />").append(a7("<div />").addClass("friend-header")).append(a7("<div />").addClass("clearfix")).append(a7("<div />").addClass("friend-content-buttons")).append(a7("<div />").addClass("friend-content").append(a7("<div />").addClass("friend-content-tabcontent").append(a7("<div />").addClass("friend-content-footprints")).append(a7("<div />").addClass("friend-content-breadcrumbs")))));bE._breadcrumbsDataSource=TRMApi.util.DataSource.getBreadcrumbsDataSource(bF.User2Id);
bE._breadcrumbsDataSource.addObserver(bE._breadcrumbsDataSourceObserver=function(bG){var bH=bE.mainContent().find(".friend-content-breadcrumbs");switch(bG){case"idle":break;case"loading":bH.empty().trwaiting();break;case"loaded":bH.empty();a7.each(this.getData(),function(){var bI=this;bH.append(a9(bI,bI.Name,TRMApi.util.formatDate(bI.CreatedOn),function(){TRMApi.functions.showBreadcrumb(bI)},null,"friend_breadcrumb_"+bI.BreadcrumbId))});if(this.getData().length==0){bH.append("This user does not have any breadcrumb.")}break}});bE._footprintsDataSource=TRMApi.util.DataSource.getFootprintsDataSource(bF.User2Id);bE._footprintsDataSource.addObserver(bE._footprintsDataSourceObserver=function(bG){var bH=bE.mainContent().find(".friend-content-footprints");switch(bG){case"idle":break;case"loading":bH.empty().trwaiting();break;case"loaded":bH.empty();a7.each(this.getData(),function(){var bI=this;bH.append(a9(bI,bI.Name,a7("<div />").addClass("buttons").append(a1("Play",function(bJ){h(bI,true);TRMApi.functions.playFootprint(bI);
bJ.stopPropagation()},null,"This will play the route that you travelled whilst the application was running on your phone.")),function(){TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close();af.gmap().panTo(bI.BoundingBox.Center,bI.BoundingBox);h(bI,true)},null,"friend_footprint_"+bI.FootprintId))});if(this.getData().length==0){bH.append("This user does not have any footprint.")}break}});switch(this.Type){case"Friend":bE.footerContent().append(a1("Remove",function(){TRMApi.functions.removeFriend(bF)},null,"Click here to remove this friend from your friends list. For more information please visit the help section located in the bottom right hand corner of the screen.")).append(" ").append(a1("Block",function(){TRMApi.functions.blockUser(bF.User2)},null,"Click here to block this friend from contacting you. For more information please visit the help section located in the bottom right hand corner of the screen.")).append(" ").append(a1("Options",function(){TRMApi.functions.setFriendOptions(bF.User2)
},null,"Click here to adjust permissions of your friend."));break;case"FriendRequest":break}}else{bE=TRMApi.ui.friendTabs[bF.UserRelationId]}bE.mainContent().find(".friend-header").empty().append(a7("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(bC.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE))).append(a7("<div />").append(a7("<span />").text(bC.FullName+" Last Seen:")).append(" ").append(a7("<span />").addClass("user-"+bC.UserId+"-status")).append(" ").append(a7("<span />").addClass("user-"+bC.UserId+"-location"))).append(a7("<div />").append(a7("<span />").addClass("user-"+bC.UserId+"-lastseen"))).append(a7("<div />").addClass("description").text(bC.Description));aF(bC,bE.mainContent());switch(this.Type){case"Friend":bE.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(bC.FullName)));bE.mainContent().find(".friend-content-buttons").empty();if(this.Permissions.indexOf("CanSeeFootprints")>=0){bE.mainContent().find(".friend-content-buttons").append(a1("Footprints",function(){bE.showFootprints()
},null,"Click here to view your friend's footprints. For more information please visit the help section located in the bottom right hand corner of the screen.")).append(" ").append(a1("Breadcrumbs",function(){bE.showBreadcrumbs()},null,"Click here to view your friend's breadcrumbs.")).append(" ");bE.showFootprints=function(){if(bE._footprintToSelect&&bE._footprintPhotoToSelect){var bG=bE._footprintPhotoToSelect;bE._footprintPhotoToSelect=null;TRMApi.util.DataSource.getFootprintPhotosDataSource(bE._footprintToSelect).ensureData(function(bH){a7.each(bH,function(){if(this.FootprintPhotoId==bG){TRMApi.functions.panToFootprintPhoto(this)}})})}TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close();W(null);bE._footprintsDataSource.ensureData(function(){if(bE._footprintToSelect){var bJ=a7("#friend_footprint_"+bE._footprintToSelect);if(bJ.length){var bI=bE.mainContent();bI.stop();bI.animate({scrollTop:bI.scrollTop()+bJ.position().top-36},"fast");var bH=bJ.data("data");
af.gmap().panTo(bH.BoundingBox.Center,bH.BoundingBox);h(bH,true);if(!bE._omitWelcome){TRMApi.functions.embedWelcome(bH)}}bE._footprintToSelect=null}});bE.mainContent().find(".friend-content-breadcrumbs").hide();bE.mainContent().find(".friend-content-footprints").show()};bE.selectFootprint=function(bG,bH,bI){bE._footprintToSelect=bG;bE._footprintPhotoToSelect=bH;bE._omitWelcome=bI;bE.showFootprints()};bE.showBreadcrumbs=function(){TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close();bE._breadcrumbsDataSource.ensureData(function(){if(bE._breadcrumbToSelect){var bH=a7("#friend_breadcrumb_"+bE._breadcrumbToSelect);if(bH.length){var bG=bE.mainContent();bG.stop();bG.animate({scrollTop:bG.scrollTop()+bH.position().top-36},"fast");var bI=bH.data("data");TRMApi.functions.showBreadcrumb(bI)}bE._breadcrumbToSelect=null}});bE.mainContent().find(".friend-content-breadcrumbs").show();bE.mainContent().find(".friend-content-footprints").hide();W(bE._breadcrumbsDataSource)};
bE.selectBreadcrumb=function(bG){bE._breadcrumbToSelect=bG;bE.showBreadcrumbs()}}else{bE.mainContent().find(".friend-content-footprints").empty();bE.mainContent().find(".friend-content-breadcrumbs").empty();bE.showFootprints=function(){};bE.showBreadcrumbs=function(){};bE.selectFootprint=function(bG){TRMApi.functions.message({Title:"Access Denied",Message:"You are not allowed to see footprints of this user."})};bE.selectBreadcrumb=function(bG){TRMApi.functions.message({Title:"Access Denied",Message:"You are not allowed to see breadcrumbs of this user."})}}bD=function(){var bG=TRMApi.session.others[bF.User2Id];if(bG.CurrentPosition){af.gmap().panTo(bG.CurrentPosition,TRMApi.constants.USER_ZOOM)}TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close()};break;case"FriendRequest":bE.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(bC.FullName+" (request)")));bE.mainContent().find(".friend-content-buttons").empty().append(a1("Accept",function(){TRMApi.functions.acceptFriend(bF)
},null,"Click here to accept friendship of your friend.")).append(" ").append(a1("Ignore",function(){TRMApi.functions.rejectFriend(bF)},null,"Click here to refuse friendship request.")).append(" ").append(a1("Block",function(){TRMApi.functions.blockUser(bF.User2)},null,"Click here to block this friend from contacting you. For more information please visit the help section located in the bottom right hand corner of the screen."));bD=function(){TRMApi.ui.dialogs.footprintPhoto.close();TRMApi.ui.dialogs.breadcrumbPhoto.close()};break;default:return}bE.__used=true;if(bF.User2Id==u){by=bE}});a7.each(TRMApi.ui.friendTabs,function(bB){if(!this.__used){this._footprintsDataSource.removeObserver(this._footprintsDataSourceObserver);this._breadcrumbsDataSource.removeObserver(this._breadcrumbsDataSourceObserver);m.removeTab(this);delete TRMApi.ui.friendTabs[bB]}});a7("#search_for_friends").autocomplete(bw,{formatItem:function(bB){return TRMApi.session.others[bB.User2Id].FullName},formatMatch:function(bB){return TRMApi.session.others[bB.User2Id].FullName
},formatResult:function(bB){return TRMApi.session.others[bB.User2Id].FullName},matchContains:true}).bind("focus",function(){a7("#search_for_friends").val("")}).bind("blur",function(){a7("#search_for_friends").val("Search friends directory")}).bind("result",function(bB,bC){TRMApi.functions.selectFriend(bC.User2Id,true);setTimeout(function(){a7("#search_for_friends")[0].blur()},1)});if(by){by.select()}if(bz=="relations"&&au&&au[0]!=TRMApi.session.user.UserId){aO(function(){TRMApi.functions.selectFriendBreadcrumb(au[0],au[1])})}if(bz=="relations"&&aH){TRMApi.functions.selectFriendPosition(aH[0],aH[1])}};TRMApi.callbacks.onBreadcrumbsChanged=function(){a7.each(TRMApi.ui.breadcrumbTabs,function(){this.__used=false});var bw=null;a7.each(TRMApi.session.breadcrumbs,function(bx){var bA=this;var by;function bz(){var bB=a7("<span />");if(bA.UserId==TRMApi.session.user.UserId){bB.append(a1("Options",function(){TRMApi.functions.editBreadcrumb(bA)},null,"This allows you to rename the breadcrumb.")).append(" ");
bB.append(a1("Delete",function(){TRMApi.functions.deleteBreadcrumb(bA)},null,"This will delete your breadcrumb.")).append(" ")}return bB}if(typeof(TRMApi.ui.breadcrumbTabs[bA.BreadcrumbId])=="undefined"){by=TRMApi.ui.breadcrumbTabs[bA.BreadcrumbId]=new a7.traccordiontab(aJ,{tabIndex:bx,autoOpen:!n,onHeaderClick:function(){TRMApi.functions.showBreadcrumb(by._breadcrumb)}});by._id=bA.BreadcrumbId}else{by=TRMApi.ui.breadcrumbTabs[bA.BreadcrumbId]}by.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(bA.Name)));by.footerContent(bz());by.mainContent(a7("<div />").append(TRMApi.services.getImageThumbnailTag(bA.Image,TRMApi.constants.DEFAULT_IMAGE).addClass("user-photo-icon")).append(a7("<div />").append(a7("<span />").text(TRMApi.util.formatDate(bA.CreatedOn)))).append(a7("<div />").addClass("clearfix")).append(a7("<div />").text(bA.Description)));by._breadcrumb=bA;by.__used=true;if(au&&bA.BreadcrumbId==au[1]){TRMApi.functions.selectView(bs="breadcrumbs");
bw=by;TRMApi.functions.showBreadcrumb(bA)}});a7.each(TRMApi.ui.breadcrumbTabs,function(bx){if(!this.__used){aJ.removeTab(this);delete TRMApi.ui.breadcrumbTabs[bx]}});if(bw){bw.select()}af.gmap().refresh()};TRMApi.callbacks.onFootprintsChanged=function(){a7.each(TRMApi.ui.footprintTabs,function(){this.__used=false});var bw=null;a7.each(TRMApi.session.footprints,function(bx){var by=this;var bz;function bB(){var bC=a7("<span />");if(by.UserId==TRMApi.session.user.UserId){bC.append(a1("Options",function(){TRMApi.functions.editFootprint(by)},null,"This allows you to rename the footprint.")).append(" ");bC.append(a1("Delete",function(){TRMApi.functions.deleteFootprint(by)},null,"This will delete your entire footprint and any pictures attached to it.")).append(" ");if(by.Publicity=="Public"||by.Publicity=="FriendsOnly"){bC.append(a1("Share",function(){TRMApi.functions.shareFootprint(by)},null,"This will allow you to send out email to all your friends and share this footprint with them.")).append(" ");
bC.append(a1("Embed",function(){TRMApi.functions.embedFootprint(by)},null,"This will allow you to create small code to insert into your web page and share this Footprint with your homepage/profile visitors.")).append(" ")}}bC.append(a1("Play",function(bD){h(by,false);TRMApi.functions.playFootprint(by);bD.stopPropagation()},null,"This will play the route that you travelled whilst the application was running on your phone."));return bC}function bA(bD){var bC=a7("<span />");if(by.UserId==TRMApi.session.user.UserId){bC.append(a7("<a />").attr({href:"#",title:"Delete"}).append(a7("<img />").attr("src","images/global/close_button.jpg")).click(function(bE){TRMApi.functions.deleteFootprintPhoto(bD);bE.stopPropagation()}))}return bC}if(typeof(TRMApi.ui.footprintTabs[by.FootprintId])=="undefined"){bz=TRMApi.ui.footprintTabs[by.FootprintId]=new a7.trdatasourceaccordiontab(bh,{tabIndex:bx,constructElement:function(bC){return aB(bC,by.TimeZoneOffset,function(){TRMApi.functions.panToFootprintPhoto(bC)
},bA(bC))},getItemId:function(bC){return bC.FootprintPhotoId},autoOpen:!n,onHeaderClick:function(){af.gmap().panTo(by.BoundingBox.Center,by.BoundingBox)},dataSource:TRMApi.util.DataSource.getFootprintPhotosDataSource(by.FootprintId)});bz._id=by.FootprintId}else{bz=TRMApi.ui.footprintTabs[by.FootprintId]}bz.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(by.Name)));bz.footerContent(bB());bz.subHeaderContent(a7("<div />").append("from "+by.StartLocation+"<br /> on "+TRMApi.util.formatRemoteDate(by.StartTime,by.TimeZoneOffset)+"<br />to "+by.EndLocation+"<br /> on "+TRMApi.util.formatRemoteDate(by.EndTime,by.TimeZoneOffset)+(by.CreatedVia=="Mobile"?" LIVE from the MOBILE":"")));bz._footprint=by;bz.__used=true;if(aN&&aN.FootprintId==by.FootprintId){h(by,aN.__isFriend)}});a7.each(TRMApi.ui.footprintTabs,function(bx){if(!this.__used){bh.removeTab(this);delete TRMApi.ui.footprintTabs[bx]}});if(bw){bw.select()}af.gmap().refresh()};TRMApi.callbacks.onTripsChanged=function(){var bw;
a7.each(TRMApi.ui.tripTabs,function(){this.__used=false});a7.each(TRMApi.session.trips,function(bx){var bA=this;var bz;function by(){var bC=a7("<span />");if(bA.UserId==TRMApi.session.user.UserId){bC.append(a1("Edit",function(){TRMApi.functions.editTrip(bA)},null,"This will allow you to change properties of your trip.")).append(" ");bC.append(a1("Delete",function(){TRMApi.functions.deleteTrip(bA)},null,"This will delete the entire trip.")).append(" ");bC.append(a1("Embed",function(){TRMApi.functions.embedTrip(bA)},null,"This will allow you to create small code to insert into your web page and share this Trip with your homepage/profile visitors.")).append(" ");if(TRMApi.session.isAdmin()){bC.append(a1("Approve All",function(){TRMApi.functions.approveMapItemsInTrip(bA)},null,"This will approve all items contained in this trip.")).append(" ")}}bC.append(a1("Download",function(){TRMApi.functions.downloadTrip(bA)},"btn-download-trip","Download trip will enable you to download the trip to either your mobile phone or on to your P.C. If downloading to your mobile phone, copy the file on to the memory card on the phone."));
return bC}function bB(bC){var bD=a7("<span />");if(bA.UserId==TRMApi.session.user.UserId){bD.append(a7("<a />").attr({href:"#",title:"Remove from trip"}).append(a7("<img />").attr("src","images/global/close_button.jpg")).click(function(bE){TRMApi.functions.deleteMapItemFromTrip(bA,bC);bE.stopPropagation()}))}return bD}if(typeof(TRMApi.ui.tripTabs[bA.TripId])=="undefined"){bz=TRMApi.ui.tripTabs[bA.TripId]=new a7.trdatasourceaccordiontab(A,{tabIndex:bx,constructElement:function(bC){return a9(bC,bC.Name,"by "+bC.User.UserName,function(){TRMApi.functions.panToMapItem(bC)},bB(bC))},getItemId:function(bC){return bC.MapItemId},autoOpen:!n,onHeaderClick:function(){var bC=this.getDataSource();bC.ensureData(function(){TRMApi.functions.panToMapItems(bC.getData())})},dataSource:TRMApi.util.DataSource.getTripMapItemsDataSource(bA.TripId),emptyHelpContent:"<p>This Trip currently has no Points Of Interest added to it. To add a Point Of Interest, click on the BROWSE tab, search for Points Of Interest and click Add All To Trip. You can also click on a Point Of Interest and click Add To Trip.</p>"});
bz._id=bA.TripId}else{bz=TRMApi.ui.tripTabs[bA.TripId]}bz.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(bA.Name)));bz.footerContent(by());bz.__used=true;if(bA.TripId==a4){bw=bz;TRMApi.functions.embedWelcome(bA)}});a7.each(TRMApi.ui.tripTabs,function(bx){if(!this.__used){A.removeTab(this);delete TRMApi.ui.tripTabs[bx]}});if(bw){bw.select()}a4=null;ar()};var aL=null;var H=null;TRMApi.callbacks.onGroupsChanged=function(){a7.each(TRMApi.ui.groupTabs,function(){this.__used=false});a7.each(TRMApi.session.groups,function(bw){var bA=this;var by;function bz(){var bC;var bE;var bD=a7("<div />").append(bE=a7("<div />").addClass("advertisement")).append(bC=a7("<span />").addClass("post-advertisement-menu"));if(TRMApi.session.isAdmin()){bC.append(a1("Advert","/admin/Default.aspx#edit-group-advert&groupId="+bA.GroupId,null,"This will delete this group.")).append(" ")}if(TRMApi.session.isAdmin()||(bA.AskingUserId==TRMApi.session.user.UserId&&bA.IsAdmin)){bC.append(a1("Delete",function(){TRMApi.functions.deleteGroup(bA)
},null,"This will delete this group.")).append(" ");bC.append(a1("Edit",function(){TRMApi.functions.editGroup(bA)},null,"This will edit this group.")).append(" ")}bC.append(a1("View",function(){TRMApi.functions.viewGroup(bA)},null,"This will view this group.")).append(" ");bC.append(a1("Leave",function(){TRMApi.functions.leaveGroup(bA)},null,"This will leave this group.")).append(" ");bC.append(a1("Invite",function(){TRMApi.functions.inviteFriend({GroupId:bA.GroupId})},null,"This will invite other people to join this group.")).append(" ");if(bA.HasAdvertisement){bE.append(a7("<a />").attr("href","/GroupClickThrough.ashx?groupId="+bA.GroupId).attr("target","_new").append(a7("<img />").attr("src",TRMApi.services.getAdvertisementUrl(bA.AdvertisementImageId))))}return bD}function bx(bD){var bC=by.mainContent().find(".group-breadcrumb-list");bC.empty();a7.each(bD,function(){var bE=this;bC.append(a7("<a />").append(TRMApi.services.getImageThumbnailTag(bE.Image,TRMApi.constants.DEFAULT_IMAGE)).attr("href","#").click(function(bF){TRMApi.functions.showGroupBreadcrumb(bA,bE)
}))})}function bB(bC){switch(bC){case"idle":this.ensureData();break;case"loading":break;case"loaded":bx(this.getData());break}}if(typeof(TRMApi.ui.groupTabs[bA.GroupId])=="undefined"){by=TRMApi.ui.groupTabs[bA.GroupId]=new a7.traccordiontab(g,{tabIndex:bw,autoOpen:!n,onHeaderClick:function(){},onOpen:function(){if(aL){aL.removeObserver(H);aL=H=null}aL=TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(bA.GroupId);aL.addObserver(H=bB)}});by._id=bA.GroupId}else{by=TRMApi.ui.groupTabs[bA.GroupId]}by.headerContent(a7("<span />").append('<span class="icon"/>').append(a7("<span />").addClass("title").text(bA.Name)));by.footerContent(bz());by.mainContent(a7("<div />").append(a7("<img />").addClass("user-photo-icon").attr("src",TRMApi.services.getImageThumbnailUrl(bA.ImageId,TRMApi.constants.DEFAULT_IMAGE))).append(a7("<div />").append(a7("<div />").text("Group updated "+TRMApi.ui.readDate(bA.LastModifiedOn))).append(a7("<span />").text(bA.Name))).append(a7("<div />").css("clear","both")).append(a3(bA.Description)).append(a7("<div />").addClass("clearfix")).append(a7("<div />").addClass("group-breadcrumb-list")));
by._group=bA;by.__used=true});a7.each(TRMApi.ui.groupTabs,function(bw){if(!this.__used){g.removeTab(this);delete TRMApi.ui.groupTabs[bw]}});if(i){aO(function(){if(TRMApi.ui.groupTabs[i]){TRMApi.ui.groupTabs[i].select()}TRMApi.functions.viewGroupById(i);i=null})}g.selectTab(g.openedTab);af.gmap().refresh()};TRMApi.callbacks.onProjectClipsChanged=function(){};function be(){if(!TRMApi.session.pendingInvitation){return}var bx=TRMApi.session.pendingInvitation;if(TRMApi.session.user.IsGuest){TRMApi.functions.loginOrRegister("You have a pending invitation. Please login or register.",function(){})}else{if(bx.UserId!=TRMApi.session.user.UserId){function bw(){if(!bx.Group){return}TRMApi.ui.dialogs.messageDialog.run({Message:bx.User.FullName+" has invited you to join group "+bx.Group.Name+". We will open it for you now."},{close:function(){TRMApi.functions.viewGroupById(bx.GroupId)}})}TRMApi.ui.dialogs.confirmDialog.run({Message:"You have a pending invitation from "+bx.User.FullName+". Do you want to accept it?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.acceptInvitation(bx.Token,function(){})
}else{if("no"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.rejectInvitation(bx.Token,function(){})}}bw()}})}else{TRMApi.ui.dialogs.messageDialog.run({Message:"You cannot accept your own invitation."})}}}function bp(){if(!Z){return}if(TRMApi.session.user.IsGuest){if(TRMApi.session.user.IsGuest){TRMApi.functions.login(function(){})}}else{TRMApi.functions.openConversation(Z);Z=null}}var bi=[];function aO(bw){if(!n){bw();return}bi.push(bw)}TRMApi.callbacks.onAfterInitialLoad=function(){a7.log("onAfterInitialLoad");af.gmap().setPaused(false);if(bs!=null){TRMApi.functions.selectView(bs)}bs=null;n=false;be();bp();if(bk){TRMApi.functions.showAudioGuideById(bk);bk=null}if(q){TRMApi.services.getFootprint(q[1],function(bw){TRMApi.functions.embedWelcome(bw.Footprint)})}a7.each(bi,function(){this()});bi=[];v()};function b(bw,bx){a7("#search-tab-header-summary-count").text(bw.Count);a7("#search-tab-header-summary").show();a7("#search-tab-results").height(r.innerHeight()-a7("#search-tab-header").outerHeight()-12);
a7(".id-reset-search").show();a7("#controlPanel_selectLanguage").selectOptions(bx.LanguageId);TRMApi.services.setLanguageId(bx.LanguageId)}function z(){a7("#search-tab-header-summary").hide();a7("#search-tab-results").height(r.innerHeight()-a7("#search-tab-header").outerHeight()-12);a7(".id-reset-search").hide()}TRMApi.functions.zoomToSearchResults=function(){if(a2){a7("#controlPanel_selectLanguage").selectOptions(bo.LanguageId);TRMApi.services.setLanguageId(bo.LanguageId);af.gmap().panTo(a2.BoundingBox.Center,a2.BoundingBox)}};TRMApi.functions.advancedSearch=function(){bo=bo||{};if(a7("#controlPanel_selectCountry").getSelectedOptionText()!=""){if(a7("#controlPanel_selectCountry").selectedValues()[0]!=bo.CountryId){bo.CountryId=a7("#controlPanel_selectCountry").selectedValues()[0];bo.City=""}if(a7("#controlPanel_city").val()!=""){bo.City=a7("#controlPanel_city").val()}}TRMApi.ui.dialogs.advancedSearchDialog.run(bo,{save:function(by){var bx=this;var bw=TRMApi.services.getLanguageId();TRMApi.services.setSearchCriteria(by);
TRMApi.services.setLanguageId(by.LanguageId);TRMApi.services.getSearchResultSummary(function(bz){bx.close();if(bz.Count==0){TRMApi.ui.dialogs.messageDialog.run({Message:"There were no matching items found. Try to broaden your criteria please."},{close:function(){TRMApi.functions.advancedSearch()}});TRMApi.services.setSearchCriteria(bo);TRMApi.services.setLanguageId(bw)}else{b(bz,by);af.gmap().clearData();var bA=a7("#advancedSearch_countryId").getSelectedOptionText();var bB=a7("#advancedSearch_address").val();if(bB){if(bB==bA){af.gmap().panTo(TRMApi.session.countryById(a7("#advancedSearch_countryId").selectedValues()[0]).Position,TRMApi.constants.COUNTRY_ZOOM)}else{af.gmap().panToAddress(bB,-1)}}else{af.gmap().panTo(bz.BoundingBox.Center,bz.BoundingBox)}a2=bz}bo=by})}})};TRMApi.functions.resetAdvancedSearch=function(){if(!bo){return}TRMApi.services.clearSearchCriteria();z();af.gmap().refresh();bo=null;a2=null};TRMApi.functions.openTrip=function(bw){TRMApi.functions.selectView("trips");if(!!TRMApi.ui.tripTabs[bw]){TRMApi.ui.tripTabs[bw].select()
}};TRMApi.functions.openFootprint=function(bw){TRMApi.functions.showOwnFootprint(bw)};TRMApi.functions.addAllVisible=function(bx){var bw=a7.map(ay.MapItems,function(by){return by.MapItemId});TRMApi.services.addTripMapItems(bx.TripId,bw,function(){})};TRMApi.functions.addMapItemsToTrip=function(bx,bw){TRMApi.services.addTripMapItems(bx,bw,function(){TRMApi.functions.openTrip(bx)})};TRMApi.functions.panToMyself=function(){af.gmap().closeWindows();if(TRMApi.session.user.CurrentPosition){af.gmap().panTo(TRMApi.session.user.CurrentPosition,TRMApi.constants.POI_ZOOM)}};TRMApi.functions.panToWholeWorld=function(){af.gmap().closeWindows();a7("#controlPanel_city").val("");a7("#controlPanel_selectCountry").selectOptions("");af.gmap().panTo([30,0],{SouthWest:[-51,-180],NorthEast:[70,180]})};TRMApi.functions.panTo=function(bw,bx){af.gmap().panTo(bw,bx)};TRMApi.functions.panToCountry=function(bw){a7.log("panToCountry: "+bw.name);af.gmap().closeWindows();a7("#controlPanel_city").val("");a7("#controlPanel_selectCountry").selectOptions(bw.CountryId);
af.gmap().panTo(bw.Position,TRMApi.constants.COUNTRY_ZOOM)};TRMApi.functions.panToCity=function(bw){a7.log("panToCity: "+bw.name);af.gmap().closeWindows();af.gmap().panToAddress(bw.Name+", "+TRMApi.session.countryById(bw.CountryId).Name,TRMApi.constants.CITY_ZOOM)};TRMApi.functions.panToMapItem=function(bw){af.gmap().closeWindows();switch(bw.Type){case"Poi":af.gmap().panTo(bw.Position,TRMApi.constants.POI_ZOOM);break;case"Area":af.gmap().panTo([(bw.BoundingBox.SouthWest[0]+bw.BoundingBox.NorthEast[0])/2,(bw.BoundingBox.SouthWest[1]+bw.BoundingBox.NorthEast[1])/2],TRMApi.constants.CITY_ZOOM);break;case"Breadcrumb":TRMApi.functions.setShowItems("Breadcrumbs");af.gmap().panTo(bw.Position,TRMApi.constants.POI_ZOOM);break}aE=bw.MapItemId};TRMApi.functions.panToMapItemId=function(bx,bw){af.gmap().setPaused(true);TRMApi.functions.resetAdvancedSearch();TRMApi.functions.setShowItems("AudioGuides");TRMApi.functions.selectView("browse");TRMApi.functions.panTo(bw,TRMApi.constants.POI_ZOOM);aE=bx;af.gmap().setPaused(false)
};TRMApi.functions.selectMapItemId=function(bw){af.gmap().selectMarker(bw)};TRMApi.functions.panToMapItems=function(bw){if(!bw){return}var bx=TRMApi.util.calculateBoundingBoxOfMapItems(bw);af.gmap().panTo(bx.Center,bx)};TRMApi.functions.panToFootprintPhoto=function(bw){af.gmap().closeWindows();TRMApi.functions.resetAdvancedSearch();af.gmap().panTo(bw.Position,TRMApi.constants.POI_ZOOM);TRMApi.functions.showFootprintPhoto(bw)};TRMApi.functions.panToBreadcrumb=function(bw){af.gmap().closeWindows();TRMApi.functions.resetAdvancedSearch();af.gmap().panTo(bw.Position,TRMApi.constants.POI_ZOOM);TRMApi.functions.showBreadcrumb(bw)};TRMApi.functions.deleteMapItemFromTrip=function(bx,bw){TRMApi.services.deleteTripMapItems(bx.TripId,[bw.MapItemId],function(by){})};TRMApi.functions.deleteTrip=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete trip "+bw.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteTrip(bw.TripId,function(){TRMApi.services.getTrips(TRMApi.session.user.UserId)
})}}})};TRMApi.functions.editFootprint=function(bw){TRMApi.ui.dialogs.editFootprintDialog.run(bw,{save:function(bx){TRMApi.services.saveFootprint(bx,function(){TRMApi.services.getFootprints(TRMApi.session.user.UserId)});this.close()}})};TRMApi.functions.editBreadcrumb=function(bw){TRMApi.ui.dialogs.editBreadcrumbDialog.run(bw,{save:function(bx){TRMApi.services.saveBreadcrumb(bx,function(){TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);TRMApi.services.refreshAllGroupBreadcrumbs()});this.close()}})};TRMApi.functions.deleteFootprint=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete footprint "+bw.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteFootprint(bw.FootprintId,function(){TRMApi.services.getFootprints(TRMApi.session.user.UserId)})}}})};TRMApi.functions.deleteBreadcrumb=function(bx){function bw(by){TRMApi.services.deleteBreadcrumb(bx.BreadcrumbId,by||"Unknown",function(){TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);
TRMApi.services.refreshAllGroupBreadcrumbs()})}if(bx.UserId==TRMApi.session.user.UserId){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete breadcrumb "+bx.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){bw()}}})}else{TRMApi.ui.dialogs.confirmDeleteDialog.result="no";TRMApi.ui.dialogs.confirmDeleteDialog.run({Message:"What is the reason to delete breadcrumb "+bx.Name+"?"},{close:function(){if("no"!=TRMApi.ui.dialogs.confirmDeleteDialog.result){bw(TRMApi.ui.dialogs.confirmDeleteDialog.result)}}})}};TRMApi.functions.joinGroup=function(bx){function bw(){TRMApi.services.joinGroup(bx.GroupId,function(){TRMApi.services.getGroups(TRMApi.session.user.UserId)})}if(TRMApi.session.user.IsGuest){TRMApi.functions.loginOrRegister("You want to join a group. Please login or register.",bw)}else{bw()}};TRMApi.functions.leaveGroup=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to leave group "+bw.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.leaveGroup(bw.GroupId,function(){TRMApi.services.getGroups(TRMApi.session.user.UserId)
})}}})};TRMApi.functions.createGroup=function(){TRMApi.services.ensureLoggedIn(function(){var bw=a7.extend(true,{},az);TRMApi.ui.dialogs.editGroupDialog.run(bw,{save:function(bx){TRMApi.services.saveGroup(bx,function(by){TRMApi.services.getGroups(TRMApi.session.user.UserId)});this.close()}})})};TRMApi.functions.searchGroups=function(){TRMApi.ui.dialogs.searchGroupsDialog.run(null,{})};TRMApi.functions.editGroup=function(bw){TRMApi.ui.dialogs.editGroupDialog.run(bw,{save:function(bx){TRMApi.services.saveGroup(bx,function(by){TRMApi.services.getGroups(TRMApi.session.user.UserId)});this.close()}})};TRMApi.functions.viewGroup=function(bw){TRMApi.ui.dialogs.viewGroupDialog.run(bw,{notify:function(bx){switch(bx){case"delete":this.close();TRMApi.functions.deleteGroup(bw);break;case"edit":this.close();TRMApi.functions.editGroup(bw);break;case"join":this.close();TRMApi.functions.joinGroup(bw);break;case"leave":this.close();TRMApi.functions.leaveGroup(bw);break;case"invite":TRMApi.functions.inviteFriend({GroupId:bw.GroupId});
break;case"members":TRMApi.functions.viewGroupMembers(bw);break;case"report-abuse":TRMApi.functions.reportAbuse({GroupId:bw.GroupId});break;default:this.close();TRMApi.functions.showGroupBreadcrumb(bw,bx,true);return}}})};TRMApi.functions.viewGroupMembers=function(bw){TRMApi.ui.dialogs.viewGroupMembersDialog.run(bw)};TRMApi.functions.addGroupBreadcrumbs=function(bw){TRMApi.ui.dialogs.selectBreadcrumbDialog.run(null,{save:function(bx){if(bx.BreadcrumbId){TRMApi.services.addGroupBreadcrumbs(bw.GroupId,bx.BreadcrumbId,function(){if(bx.NonPublicBreadcrumbs){TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId)}})}this.close()}})};TRMApi.functions.deleteGroup=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete group "+bw.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteGroup(bw.GroupId,function(){TRMApi.services.getGroups(TRMApi.session.user.UserId)})}}})};TRMApi.functions.removeExplicitFootprint=function(bw){TRMApi.services.removeExplicitFootprint(bw);
if(aN&&aN.FootprintId==bw){h(null)}};TRMApi.functions.embedFootprint=function(bw){TRMApi.ui.dialogs.embedDialog.run(bw,{save:function(bx){TRMApi.services.embedFootprint(bx,function(by){TRMApi.ui.dialogs.embed2Dialog.run(by,{save:function(){this.close()}})});this.close()}})};TRMApi.functions.embedTrip=function(bw){TRMApi.ui.dialogs.embedDialog.run(bw,{save:function(bx){TRMApi.services.embedTrip(bx,function(by){TRMApi.ui.dialogs.embed2Dialog.run(by,{save:function(){this.close()}})});this.close()}})};TRMApi.functions.embedWelcome=function(bz){var bx=bz;var by=bz;function bw(){TRMApi.util.DataSource.getTripMapItemsDataSource(by.TripId).ensureData(function(bA){if(bA.length<1){return}TRMApi.functions.setShowItems("AudioGuides");TRMApi.functions.selectView("browse");TRMApi.functions.panToMapItem(bA[0])})}a7.log("embedWelcome");if(!TRMApi.session.user.IsGuest){a7.log("not guest!");if(bz.TripId){TRMApi.functions.downloadTrip(by)}else{if(bx.UserId!=TRMApi.session.user.UserId){TRMApi.functions.selectView("friends")
}else{TRMApi.functions.selectView("footprints")}}h(bx,bx.UserId!=TRMApi.session.user.UserId);af.gmap().panTo(bx.BoundingBox.Center,bx.BoundingBox);TRMApi.functions.playFootprint(bx);return}TRMApi.ui.dialogs.embedWelcomeDialog.run(bz,{save:function(bA){this.close();switch(bA){case"LoginDownload":TRMApi.functions.login(function(){a4=by.TripId});break;case"LoginPlay":TRMApi.functions.login(function(){q=[bx.UserId,bx.FootprintId]});break;case"SignUpPlay":TRMApi.functions.register(function(){h(bx,bx.UserId!=TRMApi.session.user.UserId);af.gmap().panTo(bx.BoundingBox.Center,bx.BoundingBox);TRMApi.functions.playFootprint(bx)});break;case"Download":TRMApi.functions.downloadTrip(by);break;case"Play":h(bx,bx.UserId!=TRMApi.session.user.UserId);af.gmap().panTo(bx.BoundingBox.Center,bx.BoundingBox);TRMApi.functions.playFootprint(bx);break;case"View":bw();break}}})};TRMApi.functions.shareFootprint=function(bw){TRMApi.ui.dialogs.shareFootprint.run(a7.extend(true,{},a5,{FootprintId:bw.FootprintId}),{save:function(bx){TRMApi.services.shareFootprint(bx,function(by){var bz="";
if(by.WrongEmails.length==0){bz="Your footprint sharing email has been sent successfully."}else{if(by.WrongEmails.length<bx.Emails.length){bz="Your footprint sharing email has been sent successfully except to the following email addresses: <ul>";a7.each(by.WrongEmails,function(){bz+="<li>"+this+"</li>"});bz+="</ul>"}else{bz="Your footprint sharing email has not been sent due to problems with email."}}TRMApi.ui.dialogs.messageDialog.run({Message:bz},{})});this.close()}})};TRMApi.functions.viewUser=function(bw){TRMApi.services.getUser(bw,function(bx){TRMApi.ui.dialogs.viewProfileDialog.run(bx,{})})};TRMApi.functions.selectFriend=function(bx,bw){var by=false;TRMApi.functions.selectView("friends");a7.each(TRMApi.ui.friendTabs,function(){if(this._id==bx){m.selectTab(this);by=true}});if(bw&&TRMApi.session.others[bx]&&TRMApi.session.others[bx].CurrentPosition){TRMApi.functions.panTo(TRMApi.session.others[bx].CurrentPosition,TRMApi.constants.USER_ZOOM)}if(!by){TRMApi.functions.viewUser(bx)}};TRMApi.functions.selectGroup=function(bw){TRMApi.functions.selectView("groups");
if(TRMApi.ui.groupTabs[bw]){g.selectTab(TRMApi.ui.groupTabs[bw])}};TRMApi.functions.viewGroupById=function(bw){TRMApi.functions.selectGroup(bw);if(!TRMApi.ui.groupTabs[bw]){TRMApi.services.getGroup(bw,function(bx){if(!bx){return}TRMApi.functions.viewGroup(bx)});return}TRMApi.functions.viewGroup(TRMApi.ui.groupTabs[bw]._group)};TRMApi.functions.showGroupBreadcrumbById=function(bx,bw){TRMApi.functions.selectGroup(bx);if(!TRMApi.ui.groupTabs[bx]){return}var by=TRMApi.ui.groupTabs[bx]._group;TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(bx).ensureData(function(){var bz=this.getItemById(bw);if(bz==null){return}TRMApi.functions.showGroupBreadcrumb(by,bz)})};TRMApi.functions.selectTab=function(bw){alert("deprecated function called TRMApi.functions.selectTab()")};TRMApi.functions.selectFriendPosition=function(by,bx){a7.log("selectFriendPosition: "+by+"/"+bx);function bw(){TRMApi.functions.selectFriend(by);TRMApi.functions.panTo(bx,TRMApi.constants.USER_ZOOM);aH=null}if(TRMApi.session.user.IsGuest){aH=[by,bx];
TRMApi.functions.login(function(){})}else{bw()}};TRMApi.functions.selectFriendFootprint=function(by,bx,bz,bA){a7.log("selectFriendFootprint: "+by+"/"+bx);function bw(){TRMApi.functions.selectFriend(by);a7.each(TRMApi.ui.friendTabs,function(){if(this._id==by){this.selectFootprint(bx,bz,bA)}});q=null}if(TRMApi.session.user.IsGuest){q=[by,bx,bz];TRMApi.functions.login(function(){})}else{bw()}};TRMApi.functions.selectFriendBreadcrumb=function(by,bx){a7.log("selectFriendBreadcrumb: "+by+"/"+bx);function bw(){if(TRMApi.session.user.UserId==by){TRMApi.functions.selectView("breadcrumbs");if(TRMApi.ui.breadcrumbTabs[bx]){aJ.selectTab(TRMApi.ui.breadcrumbTabs[bx])}}else{TRMApi.functions.selectFriend(by);a7.each(TRMApi.ui.friendTabs,function(){if(this._id==by){this.selectBreadcrumb(bx)}})}au=null}if(TRMApi.session.user.IsGuest){au=[by,bx];TRMApi.functions.login(function(){})}else{bw()}};var aq=null;TRMApi.functions.selectView=function(bw){if(aq==bw){return}a7.log("selectView("+bw+")");aq=bw;TRMApi.functions.stopFootprint();
try{switch(bw){case"footprints":aA.__viewName="footprints";aA.select();V.show();aC.hide();a0[0].checked=true;bh.resize(r.innerHeight()-36);break;case"browse":bq.select();break;case"browse-trip":bq.select();break;case"trips":E.select();break;case"friends":ae.select();break;case"projects":ab.select();break;case"breadcrumbs":aA.__viewName="breadcrumbs";aA.select();V.hide();aC.show();bn[0].checked=true;aJ.resize(r.innerHeight()-36);break;case"inbox":at.select();break;case"groups":F.select();break;default:return}ai=bw;af.gmap().setPaused(true);af.gmap().closeWindows();af.gmap().setDisplayMapItems(-1<a7.inArray(ai,["browse","browse-trip","trips","projects","breadcrumbs","friends","groups"]));af.gmap().setDisplayFootprints(-1<a7.inArray(ai,["footprints","friends"]));af.gmap().setDisplayFriends(-1<a7.inArray(ai,["friends","inbox"]));af.gmap().setDisplayMyself(-1<a7.inArray(ai,["friends"]));af.gmap().clearData();af.gmap().clearFootprintData();h(null);TRMApi.ui.dialog.closeAll();switch(ai){case"trips":A.selectTab(A.openedTab);
break;case"projects":ad.selectTab(ad.openedTab);break;case"footprints":bh.selectTab(bh.openedTab);break;case"breadcrumbs":W(TRMApi.util.DataSource.getBreadcrumbsDataSource(TRMApi.session.user.UserId));aJ.selectTab(aJ.openedTab);break;case"friends":m.selectTab(m.openedTab);break;case"groups":W(null);g.selectTab(g.openedTab);break}}finally{aq=null;af.gmap().setPaused(false)}};TRMApi.functions.showOwnFootprint=function(bw){TRMApi.functions.selectView("footprints");if(!!TRMApi.ui.footprintTabs[bw]){TRMApi.ui.footprintTabs[bw].select()}};TRMApi.functions.showFriendFootprint=function(bx,bw){TRMApi.functions.selectView("friends");TRMApi.functions.selectFriendFootprint(bx,bw,null,true)};TRMApi.functions.showExplicitFootprint=function(bw){TRMApi.functions.selectView("friends");if(!TRMApi.ui.explicitFootprintsTab){return}TRMApi.ui.explicitFootprintsTab.select();TRMApi.ui.explicitFootprintsTab.selectFootprint(bw)};TRMApi.functions.showFootprint=function(bw){if(!!TRMApi.ui.footprintTabs[bw]){TRMApi.functions.showOwnFootprint(bw);
return}TRMApi.services.getFootprint(bw,function(bx){switch(bx.Action){case"Own":TRMApi.functions.showOwnFootprint(bw);break;case"Friend":TRMApi.functions.showFriendFootprint(bx.Footprint.UserId,bw);break;case"Explicit":TRMApi.services.getExplicitFootprints(function(){TRMApi.functions.showExplicitFootprint(bw)});break}})};TRMApi.functions.deleteFootprintPhoto=function(bx){function bw(by){TRMApi.services.deleteFootprintPhoto(bx.FootprintPhotoId,by||"Unknown",function(){TRMApi.services.refreshFootprintPhotos(bx.FootprintId)})}if(bx.UserId==TRMApi.session.user.UserId){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete the photo?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){bw()}}})}else{TRMApi.ui.dialogs.confirmDeleteDialog.result="no";TRMApi.ui.dialogs.confirmDeleteDialog.run({Message:"What is the reason to delete the photo?"},{close:function(){if("no"!=TRMApi.ui.dialogs.confirmDeleteDialog.result){bw(TRMApi.ui.dialogs.confirmDeleteDialog.result)
}}})}};TRMApi.functions.deleteProject=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete project "+bw.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteProject(bw.ProjectId,function(){TRMApi.services.getProjects(TRMApi.session.user.UserId);af.gmap().refresh()})}}})};TRMApi.functions.blockScreen=function(bw){switch(bw){case"none":aI();break;case"whole":aG();break;case"topbottom":Q();break}};TRMApi.callbacks.onBlockScreen=TRMApi.functions.blockScreen;FootprintPlayer=function(bx){var bw=this;this.timer=null;this.cancel=false;this.footprint=bx;this.timeout=300;this.nextStop=0;TRMApi.ui.dialogs.footprintPhoto.run(null,{close:function(){bw.dostop()},notify:function(by){switch(by){case"play":bw.tick();break}}});this.dataSource=TRMApi.util.DataSource.getCombinedDataSource([this.photosDataSource=TRMApi.util.DataSource.getFootprintPhotosDataSource(bx.FootprintId),this.pointsDataSource=TRMApi.util.DataSource.getFootprintPointsDataSource(bx.FootprintId,1)]);
this.dataSource.addObserver(this.dataSourceObserver=function(){bw.dataSourceStatusChanged.apply(bw,arguments)});af.gmap().showFootprintPlaybackControl(this)};FootprintPlayer.prototype={setNextTick:function(){var bw=this;this.timer=window.setTimeout(function(){bw.tick()},this.timeout);TRMApi.callbacks.onBlockScreen("whole")},dostop:function(){this.dataSource.removeObserver(this.dataSourceObserver);af.gmap().hideCar();af.gmap().hideFootprintPlaybackControl();TRMApi.ui.dialogs.footprintPhoto.close()},stop:function(){var bw=this;this.pause();this.dostop()},pause:function(){if(this.timer){window.clearTimeout(this.timer)}},play:function(bw){if(this.timer){window.clearTimeout(this.timer)}switch(bw){case 0:this.timeout=300;break;case 1:this.timeout=200;break;case 2:this.timeout=100;break}this.setNextTick()},tick:function(){this.timer=null;var bw=this;if(this.nextStop>=this.stops.length){this.dostop();return}var bx=this.stops[this.nextStop++];af.gmap().showCar(bx.position);if(bx.photo){TRMApi.ui.dialogs.footprintPhoto.setPhoto(bx.photo)
}else{TRMApi.ui.dialogs.footprintPhoto.hide();this.setNextTick()}},onstop:function(){this.stop()},onpause:function(){this.pause()},onplay:function(bw){this.play(bw)},dataSourceStatusChanged:function(bA){switch(bA){case"idle":this.pause();this.dataSource.ensureData();break;case"loaded":var bz=null;if(this.nextStop){bz=this.stops[this.nextStop-1].timestamp}this.stops=[];var by=0;var bx=this.pointsDataSource.getData().Times;var bD=this.pointsDataSource.getData().Points;var bC=0;var bE=this.photosDataSource.getData();while(by<bx.length){var bw=0;while(bC<bE.length&&bE[bC].TakenOn.toHummbaTimestamp()<=bx[by]){this.stops.push({timestamp:bE[bC].TakenOn.toHummbaTimestamp(),position:bE[bC].Position,photo:bE[bC]});bw=bE[bC].TakenOn.toHummbaTimestamp();bC++}if(bw<bx[by]){this.stops.push({timestamp:bx[by],position:bD[by]})}by++}while(bC<bE.length){this.stops.push({timestamp:bE[bC].TakenOn.toHummbaTimestamp(),position:bE[bC].Position,photo:bE[bC]});bC++}if(bz){for(var bB=0;bB<this.steps.length;bB++){if(this.steps[bB].timestamp>=bz){this.nextStop=bB;
break}}}this.setNextTick();break}}};var bd=null;TRMApi.functions.playFootprint=function(bw){if(bd){bd.dostop();bd=null}bd=new FootprintPlayer(bw)};TRMApi.functions.stopFootprint=function(){if(!bd){return}bd.stop(true)};TRMApi.functions.addNewTrip=function(bw,bx){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();return}var by=a7.extend(true,{},am,bw);TRMApi.ui.dialogs.addTripDialog.run(by,{save:function(bz){TRMApi.services.saveTrip(bz,function(bA){if(bx){TRMApi.functions.addMapItemsToTrip(bA.TripId,bx)}TRMApi.services.getTrips(TRMApi.session.user.UserId)});this.close()}})};TRMApi.functions.editTrip=function(bw){TRMApi.ui.dialogs.addTripDialog.run(bw,{save:function(bx){TRMApi.services.saveTrip(bx,function(){TRMApi.services.getTrips(TRMApi.session.user.UserId)});this.close()}})};TRMApi.functions.inviteOutsider=function(bw){var bx=a7.grep(bw.Emails.split(/[,; ]+/),function(by){return by.match(TRMApi.constants.EMAIL_REGEX)}).join(" ");TRMApi.services.ensureLoggedIn(function(){TRMApi.ui.dialogs.inviteOutsiderDialog.run({Emails:bx,GroupId:bw.GroupId||null},{save:function(by){if(by.Emails.length>0){TRMApi.services.inviteOthers(by,function(){})
}TRMApi.functions.message({Title:"Result",Message:"Invitations have been sent."});this.close()}})})};TRMApi.functions.inviteFriend=function(bw){TRMApi.services.ensureLoggedIn(function(){TRMApi.ui.dialogs.inviteFriendDialog.run(bw,{save:function(bx){if(bx.UserIds.length>0){if(bx.GroupId){TRMApi.services.inviteUsersToGroup(bx.UserIds,bx.GroupId,function(){})}else{TRMApi.services.inviteUsers(bx.UserIds,function(){})}}TRMApi.functions.message({Title:"Result",Message:"Invitations have been sent."});this.close()}})})};TRMApi.functions.inviteUser=function(bw){TRMApi.services.ensureLoggedIn(function(){TRMApi.services.inviteUsers([bw.UserId],function(){});TRMApi.functions.message({Title:"Result",Message:"Invitation has been sent."})})};TRMApi.functions.acceptFriend=function(bw){TRMApi.services.acceptFriend(bw.UserRelationId,function(){TRMApi.functions.message({Title:"Result",Message:"You have accepted the friendship."})})};TRMApi.functions.rejectFriend=function(bw){TRMApi.services.rejectFriend(bw.UserRelationId,function(){TRMApi.functions.message({Title:"Result",Message:"You ignored the friendship request."})
})};TRMApi.functions.removeFriend=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to remove the user ("+bw.User2.FullName+") from your friends list?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.removeFriend(bw.UserRelationId,function(){TRMApi.functions.message({Title:"Result",Message:"Your friendship has been cancelled."})})}}})};TRMApi.functions.blockUser=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to block the user ("+bw.FullName+") from contacting you?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.blockUser(bw.UserId,function(){TRMApi.functions.message({Title:"Result",Message:"The user has been successfully blocked and will not be able to contact you again."})})}}})};TRMApi.functions.setFriendOptions=function(bw){TRMApi.services.getFriendPermission(bw.UserId,function(bx){TRMApi.ui.dialogs.friendOptionsDialog.run({User:bw,Permissions:bx.Permissions},{save:function(by){TRMApi.services.setFriendPermission(bw.UserId,by.Permissions,function(){});
this.close()}})})};TRMApi.functions.addNewProject=function(bw){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();return}var bx=a7.extend(true,{},x,bw);TRMApi.ui.dialogs.addProjectDialog.run(bx,{save:function(by){TRMApi.services.saveProject(by,function(){TRMApi.services.getProjects(TRMApi.session.user.UserId)});this.close()}})};TRMApi.functions.addNewFootprint=function(){TRMApi.services.ensureLoggedIn(function(){TRMApi.ui.dialogs.uploadFootprintDialog.run(null,{})})};TRMApi.functions.downloadTrip=function(bw){TRMApi.services.ensureLoggedIn(function(){TRMApi.ui.dialogs.downloadTripDialog.run(bw.TripId,{})})};var bm;TRMApi.functions.selectFootprintPhoto=function(bw){if(bm){if(TRMApi.ui.footprintTabs[bm.FootprintId]){TRMApi.ui.footprintTabs[bm.FootprintId].unselectItems()}}if(bw){if(TRMApi.ui.footprintTabs[bw.FootprintId]){TRMApi.ui.footprintTabs[bw.FootprintId].selectItem(bw.FootprintPhotoId)}}bm=bw};TRMApi.functions.showFootprintPhotoById=function(bw,bx){TRMApi.util.DataSource.getFootprintPhotosDataSource(bw).ensureData(function(){var by=this.getItemById(bx);
if(by){TRMApi.functions.showFootprint(bw);TRMApi.functions.showFootprintPhoto(by)}})};TRMApi.functions.showFootprintPhoto=function(bw){TRMApi.functions.selectFootprintPhoto(bw);af.gmap().panToPhotoMode(bw.Position);TRMApi.ui.dialogs.footprintPhoto.run(bw,{close:function(){TRMApi.functions.selectFootprintPhoto(null)},save:function(bx){TRMApi.services.saveFootprintPhoto(bx,function(by){TRMApi.services.refreshFootprintPhotos(bw.FootprintId);TRMApi.functions.showFootprintPhoto(by.FootprintPhoto)});this.close()},notify:function(bx){this.close();TRMApi.functions.showFootprintPhoto(bx)}})};TRMApi.functions.showBreadcrumb=function(bw){af.gmap().panToPhotoMode(bw.Position);TRMApi.functions.selectMapItemId(bw.MapItemId);TRMApi.ui.dialogs.breadcrumbPhoto.run({displayScroller:ai!="browse"&&ai!="browse-trip",Data:bw},{close:function(){TRMApi.functions.selectMapItemId(null)},notify:function(bx){this.close();TRMApi.functions.showBreadcrumb(bx)}})};TRMApi.functions.showGroupBreadcrumb=function(by,bz,bx){af.gmap().panToPhotoMode(bz.Position);
var bw=d;W(TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(by.GroupId));TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(by.GroupId).ensureData(function(){TRMApi.functions.selectMapItemId(bz.MapItemId)});TRMApi.ui.dialogs.breadcrumbPhoto.run({displayScroller:true,scrollerType:"group",scrollerParentId:by.GroupId,scrollerParent:by,showDelete:true,Data:bz},{close:function(){W(bw);TRMApi.functions.selectMapItemId(null);if(bx){TRMApi.functions.viewGroup(by)}},notify:function(bA){if(bA=="remove-from-group"){this.close();TRMApi.services.deleteGroupBreadcrumb(by.GroupId,bz.BreadcrumbId)}else{TRMApi.functions.showGroupBreadcrumb(by,bA,bx)}}})};TRMApi.functions.rotateFootprintPhoto=function(bw,bx,by){TRMApi.services.rotateFootprintPhoto(bw.FootprintPhotoId,bx,function(bz){TRMApi.services.refreshFootprintPhotos(bz.FootprintPhoto.FootprintId);by(bz.FootprintPhoto)})};TRMApi.functions.rotateBreadcrumb=function(by,bw,bx){TRMApi.services.rotateBreadcrumb(by.BreadcrumbId,bw,function(bz){TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);
TRMApi.services.refreshAllGroupBreadcrumbs();bx(bz.Breadcrumb)})};TRMApi.functions.uploadModifiedFootprints=function(bw){a7.each(bw,function(){TRMApi.services.refreshFootprint(this)});TRMApi.services.getFootprints(TRMApi.session.user.UserId)};TRMApi.functions.uploadComplete=function(){TRMApi.ui.dialogs.uploadFootprintDialog.close()};TRMApi.functions.installComplete=function(){TRMApi.ui.dialogs.downloadTripDialog.close()};function aW(bx,bw){var by=a7.extend(true,{},aX,bx);a7.extend(by,{Points:bw});TRMApi.ui.dialogs.addNewDialog.run(by,{save:function(bz){TRMApi.services.saveArea(null,bz,function(bA){if(!bA.ApprovedOn){TRMApi.functions.message({Title:"Approval needed",Message:"Your area has been saved. Please note, that it will not be visible to others until an administrator approves it."})}TRMApi.services.getProjects(TRMApi.session.user.UserId);TRMApi.functions.resetAdvancedSearch();af.gmap().refresh()});this.close()}})}TRMApi.functions.addDefaultArea=function(bw){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();
return}aW(a7.extend({},bw,{City:{Name:"Cape Town"},Country:{Iso3166:"za"}}),[[0,0],[0,0]])};TRMApi.functions.addNewArea=function(bw){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();return}TRMApi.ui.selectAreaOnMap("Please select points surrounding your new area...",function(bx){if(!bx){return}aW(bw,bx)})};TRMApi.functions.addNewBreadcrumb=function(bw){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();return}TRMApi.ui.selectPointOnMap("Please select where your Breadcrumb will be...",function(bx){if(!bx){return}af.gmap().getAddressAt(bx,function(by){var bz=a7.extend(true,{},c,{Position:bx,Location:"near "+by},bw);TRMApi.ui.dialogs.editBreadcrumbDialog.run(bz,{save:function(bA){TRMApi.services.saveBreadcrumb(bA,function(bB){TRMApi.services.getBreadcrumbs(TRMApi.session.user.UserId);af.gmap().refresh()});this.close()}})})})};TRMApi.functions.addNewPoi=function(bw){if(TRMApi.session.user.IsGuest){TRMApi.ui.showLoginRequiredDialog();return}TRMApi.ui.selectPointOnMap("Please select where your POI will be...",function(bx){if(!bx){return
}var by=a7.extend(true,{},aj,{Position:bx},bw);TRMApi.ui.dialogs.addNewDialog.run(by,{save:function(bz){TRMApi.services.savePoi(null,bz,function(bA){if(!bA.ApprovedOn){TRMApi.functions.message({Title:"Approval needed",Message:"Your point has been saved. Please note, that it will not be visible to others until an administrator approves it."})}TRMApi.services.getProjects(TRMApi.session.user.UserId);TRMApi.functions.resetAdvancedSearch();af.gmap().refresh()});this.close()}})})};TRMApi.functions.editPoi=function(bw){TRMApi.services.getMapItem(bw,function(bx){if(!bx){return}af.gmap().closeWindows();TRMApi.ui.dialogs.addNewDialog.run(bx,{save:function(by){TRMApi.services.savePoi(bx,by,function(){TRMApi.services.getProjects(TRMApi.session.user.UserId);af.gmap().refresh()});this.close()}})})};TRMApi.functions.deleteMapItem=function(bw){TRMApi.services.getMapItem(bw,function(bx){if(!bx){return}TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete map item "+bx.Name+"?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteMapItem(bx,function(){af.gmap().closeWindows()
})}}})})};TRMApi.functions.approveMapItem=function(bw){TRMApi.services.approveMapItem(bw,function(){af.gmap().closeWindows();af.gmap().refresh()})};TRMApi.functions.approveMapItemsInTrip=function(bw){TRMApi.services.approveMapItemsInTrip(bw.TripId,function(){TRMApi.functions.message({Message:"All items in the trip have been approved.",Title:"Success."})})};TRMApi.functions.reportSpam=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to report this item as SPAM?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.reportSpamOnMapItem(bw,function(){af.gmap().closeWindows();TRMApi.functions.message({Message:"Thank you for caring, we will review this SPAM as soon as possible.",Title:"Thank you"})})}}})};TRMApi.functions.editArea=function(bw){TRMApi.services.getMapItem(bw,function(bx){if(!bx){return}af.gmap().closeWindows();TRMApi.ui.dialogs.addNewDialog.run(bx,{save:function(by){TRMApi.services.saveArea(bx,by,function(){TRMApi.services.getProjects(TRMApi.session.user.UserId);
af.gmap().refresh()});this.close()}})})};TRMApi.functions.upgradeUser=function(){TRMApi.ui.dialogs.upgradeUserDialog.run({UserName:"",Password:"",Confirm:"",EmailAddress:""},{save:function(bw){TRMApi.services.upgradeFbUser(bw,function(){TRMApi.functions.message({Title:"Success",Message:"You have been sent an email to confirm your email address."})});this.close()}})};TRMApi.functions.showMyProfile=function(){TRMApi.ui.dialogs.editProfileDialog.run(TRMApi.session.user,{save:function(bw){TRMApi.services.saveUser(bw,function(){});this.close()},notify:function(bw){switch(bw){case"upgrade":this.close();TRMApi.functions.upgradeUser();break}}})};TRMApi.functions.reportAbuse=function(bw){a7.extend(bw,{Reason:"",Text:""});TRMApi.ui.dialogs.reportAbuseDialog.run(bw,{save:function(bx){TRMApi.services.reportAbuse(bx,function(by){TRMApi.functions.message({Title:"Success",Message:"Your report has been submitted and we will act on it as soon as possible."})});this.close()}})};TRMApi.functions.changePassword=function(bw){TRMApi.ui.dialogs.changePasswordDialog.run(bw||N,{save:function(bx){TRMApi.services.changePassword(bx,function(by){if(by){TRMApi.functions.message({Title:"Success",Message:"Your password has been successfully changed."})
}else{TRMApi.functions.changePassword(bx);TRMApi.ui.dialogs.changePasswordDialog.showInvalidPassword()}});this.close()}})};TRMApi.functions.logout=function(){if(TRMApi.facebook.isLoggedInViaFacebook()){TRMApi.ui.dialogs.confirmDialog.run({Message:"This will log you out of Facebook as well as Hummba.com. Are you sure?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.facebook.logout(function(bw){if(bw){TRMApi.services.logout()}})}}})}else{TRMApi.services.logout()}};TRMApi.functions._login=function(bw,bx,by){TRMApi.ui.dialogs.loginDialog.run({displayRegister:bw,reason:bx},{save:function(bz){TRMApi.services.login(bz.Username[0],bz.Password[0],function(bA){if(bA&&by){by()}else{if(!bA){window.setTimeout(function(){TRMApi.functions.login(by)},1)}}});this.close()},notify:function(bz){if(bz=="register"){TRMApi.functions.register(by)}this.close()}})};TRMApi.functions.login=function(bw){return TRMApi.functions._login(false,null,bw)};TRMApi.functions.loginOrRegister=function(bw,bx){return TRMApi.functions._login(true,bw,bx)
};TRMApi.functions.forgottenPassword2=function(bx){var bw={UserName:bx};TRMApi.ui.dialogs.forgottenPassword2Dialog.run(bw,{save:function(by){TRMApi.services.forgottenPassword2(by.UserName,by.Password,function(bz){if(bz.Success){TRMApi.functions.message({Message:"Your password has been changed. You can log-in now as usual.",Title:"Password changed"})}else{TRMApi.functions.message({Message:"There has been an error trying to set new password. Please try it again.",Title:"Password change failed"})}});this.close()}})};TRMApi.functions.uploadKml=function(){TRMApi.ui.dialogs.uploadKml.run(null,{save:function(bx){var bw=this;TRMApi.services.uploadKml(bx,function(by){bw.close();TRMApi.services.getProjects(TRMApi.session.user.UserId)})},close:function(){}})};TRMApi.functions.uploadKmlFootprint=function(){TRMApi.ui.dialogs.uploadKmlFootprintDialog.run(null,{save:function(bx){var bw=this;TRMApi.services.uploadKmlFootprint(bx,function(by){bw.close();TRMApi.services.getFootprints(TRMApi.session.user.UserId)
})},close:function(){}})};TRMApi.functions.hideSearchResultsHelp=function(){a7("#search-tab-results-help").hide("fast");if(TRMApi.services.getShowItems()=="AudioGuides"){a7("#search-tab-results-guides").show("fast")}};TRMApi.functions.setShowItems=function(bw){switch(bw){case"AudioGuides":a7("#controlPanel_showMapitems")[0].checked=true;if(!a7("#search-tab-results-help").is(":visible")){a7("#search-tab-results-guides").show()}break;case"Footprints":a7("#controlPanel_showFootprints")[0].checked=true;a7("#search-tab-results-guides").hide();break;case"Breadcrumbs":a7("#controlPanel_showBreadcrumbs")[0].checked=true;a7("#search-tab-results-guides").hide();break}TRMApi.services.setShowItems(bw)};var aS=null;var a6=null;var a8=null;TRMApi.functions.cancelChangeStatus=function(bw){if(!a6){return}aS.remove();bw.show().find(".text").text(a8);a6=a8=null;a7("body").unbind("click.change-status")};TRMApi.functions.changeStatus=function(bw){if(!!a6){return}bw=a7(bw);a8=bw.find(".text").text();bw.hide().after(aS=a7("<span />").append(a6=a7('<input type="text" />').attr("maxlength","200").val(TRMApi.session.user.Status||"")).append(" ").append(a7("<img />").attr("src","images/gen/hdr-lgr-set_status.png").attr("alt","Confirm").attr("title","Click here to set your status. For more information please visit the help section located in the bottom right hand corner of the screen.").attr("valign","bottom").click(function(by){var bx=a6.val();
TRMApi.functions.cancelChangeStatus(bw);TRMApi.services.saveUserStatus(TRMApi.session.user.UserId,bx);by.stopPropagation()})));window.setTimeout(function(){a7("body").bind("click.change-status",function(bx){if(a7.inArray(aS[0],a7(bx.target).parents())==-1){TRMApi.functions.cancelChangeStatus(bw)}})},1)};TRMApi.functions.changeCurrentPosition=function(bw){TRMApi.ui.selectPointOnMap("Click on where you are currently or <a href=\"javascript:TRMApi.ui.mapHover.close('clear')\">CLEAR</a> your current position...",function(by,bx){if(bx=="clear"){TRMApi.services.saveUserPosition(TRMApi.session.user.UserId,null,null)}else{if(by!=null){af.gmap().getAddressAt(by,function(bz){TRMApi.services.saveUserPosition(TRMApi.session.user.UserId,by,"near "+bz)})}}})};TRMApi.functions.showNotifications=function(){TRMApi.functions.selectView("inbox");a7("#inbox-tab-notifications").show();a7("#inbox-tab-conversations").hide()};TRMApi.functions.showConversations=function(){TRMApi.functions.selectView("inbox");a7("#inbox-tab-notifications").hide();
a7("#inbox-tab-conversations").show()};TRMApi.functions.newConversation=function(bw){TRMApi.ui.dialogs.newConversationDialog.run({Users:bw},{save:function(bx){TRMApi.services.createConversation(bx,function(){TRMApi.functions.message({Message:"Your message has been sent successfully.",Title:"Success"})});this.close()}})};TRMApi.functions.openConversation=function(bw){TRMApi.services.getConversation(bw,function(bx){TRMApi.ui.dialogs.conversationDialog.run(bx,{save:function(by){TRMApi.services.addToConversation(bw,by.Content,function(){TRMApi.functions.openConversation(bw)});this.close()}})})};TRMApi.functions.deleteConversation=function(bw){TRMApi.ui.dialogs.confirmDialog.run({Message:"Are you sure you want to delete this conversation?"},{close:function(){if("yes"==TRMApi.ui.dialogs.confirmDialog.result){TRMApi.services.deleteConversation(bw.ConversationId)}}})};TRMApi.functions.showAudioGuideById=function(bw){TRMApi.services.getTrip(bw,function(bx){TRMApi.functions.showAudioGuide(bx)})};
TRMApi.functions.showAudioGuide=function(bw){TRMApi.functions.selectView("browse-trip");if(a7("#search-tab-results-help").is(":visible")){a7("#search-tab-results-help").hide("fast");a7("#search-tab-results-guides").show("fast")}a7("#search-tab-results-guides .guide").remove();a7("#search-tab-results-more-guides").hide();a7("#search-tab-results-guides-all").hide();a7("#search-tab-results-guides-one").hide();a7("#search-tab-results-guides").prepend(t(bw,true));var bx=TRMApi.util.DataSource.getTripMapItemsDataSource(bw.TripId);W(bx);bx.ensureData(function(bz){var by=a7("#search-tab-results-list").empty();a7.each(bz,function(bA){var bB=this;bB.Description=bB.Description||"";by.append(a9(this,bB.Name,bB.Description.length>50?bB.Description.substring(0,50)+"...":bB.Description,function(){af.gmap().openMapItem(bB.MapItemId)},null))});TRMApi.functions.panToMapItems(bz)})};var e;function J(bw){switch(bw){case"idle":this.ensureData();break;case"loaded":e=true;af.gmap().refresh();break}}function W(bw){if(d){d.unbind("statusChanged",J)
}d=bw;if(d){d.addObserver(J)}else{e=true;af.gmap().refresh()}}function aw(){}var aN;var ac;var L;var Y;var bc;var U;var aa;function h(bw,bx){if(aN&&aN==bw&&aN.__isFriend==bx){return}aN=bw;if(aN){aN.__isFriend=bx}ac=true;af.gmap().refresh()}function ag(bw){switch(bw){case"idle":this.ensureData();break;case"loaded":bc=true;af.gmap().refresh();break}}function bj(bw){switch(bw){case"idle":this.ensureData();break;case"loaded":aa=true;af.gmap().refresh();break}}function k(bx){var bw=this;if(ai=="footprints"||ai=="friends"){if(aN&&(aN.__isFriend==!!(ai=="friends"))){if(ac||Y!=bx){if(L){L.unbind("statusChanged",ag);L=null}if(aN.Flags.indexOf("HideTrack")<0){L=TRMApi.util.DataSource.getFootprintPointsDataSource(aN.FootprintId,bx);L.bind("statusChanged",ag);if(L.isDataReady()){af.gmap().setFootprintData(aN,L.getData())}else{L.ensureData()}}else{af.gmap().setFootprintData(null)}if(ac){if(U){U.unbind("statusChanged",bj)}U=TRMApi.util.DataSource.getFootprintPhotosDataSource(aN.FootprintId);U.bind("statusChanged",bj);
if(U.isDataReady()){af.gmap().setFootprintPhotos(U.getData())}else{U.ensureData()}aa=false}ac=false;Y=bx;bc=false}if(bc){bc=false;af.gmap().setFootprintData(aN,L.getData())}if(aa){aa=false;af.gmap().setFootprintPhotos(U.getData())}}else{af.gmap().clearFootprintData()}}}function t(bw,by){var bz=a7("<div />").addClass("guide");var bx;bz.append(a7("<div />").addClass("guide-intro").text("Tourism Radio Audio Guides"));bz.append(a7("<img />").attr("src",TRMApi.services.getImageThumbnailUrl(bw.ImageId)));bz.append(a7("<div />").addClass("guide-title").text(bw.Name));bz.append(a7("<div />").addClass("guide-description").text(bw.Description));bz.append(bx=a7("<div />").addClass("guide-buttons"));if(!by){bx.append(a1("View",function(){TRMApi.functions.showAudioGuide(bw)}))}else{bx.append(a1("Close",function(){TRMApi.functions.selectView("browse")}))}bx.append(" ");bx.append(a1("Download",function(){TRMApi.functions.downloadTrip(bw)}));bz.append(a7("<div />").css("clear","both"));return bz}function ao(bw,bx){TRMApi.services.getAudioGuidesOnMap(bw.lat(),bw.lng(),bx.lat(),bx.lng(),function(bz){if(ai=="browse"){a7("#search-tab-results-guides .guide").remove();
if(bz.length>0){a7("#search-tab-results-guides").prepend(t(bz[0]));var by;for(by=1;by<bz.length;by++){a7("#search-tab-results-more-guides").append(t(bz[by]))}}a7("#search-tab-results-more-guides").hide();if(bz.length>1){a7("#search-tab-results-guides-all").show();a7("#search-tab-results-guides-count").text(bz.length)}else{a7("#search-tab-results-guides-all").hide()}a7("#search-tab-results-guides-one").hide()}})}var bb=null;var bt=0;function w(bw,bx){if(bb!=null){clearTimeout(bb)}bb=setTimeout(function(){ao(bw,bx)},1000)}var j={};var I=null;function p(bB){if(an!=null){clearTimeout(an)}var bz=null;var bA=(new Date()).getTime();for(var by=0;by<bB.length;by++){var bw=bB[by];var bx=j[bw.MapItemId];if(!bx){bz=bw;break}if(bx<bA){bz=bw;bA=bx}}if(bz==null){a7("#main_header_ad").hide();I=0}else{if(bz.MapItemId!=I){a7("#main_header_ad").empty().load("/components/DisplayAd.aspx?MapItemId="+bz.MapItemId,null,function(){a7("#main_header_ad").show()})}I=bz.MapItemId;j[bz.MapItemId]=(new Date()).getTime();
ba=(new Date()).getTime()+10000;an=setTimeout(function(){p(bB)},10000)}}var ap=0;function v(){var bw=++ap;var bx=af.gmap().getBounds();TRMApi.services.getBannersByArea(bx[0][0],bx[0][1],bx[1][0],bx[1][1],function(by){if(ap==bw){p(by)}})}var an=null;var ba=0;function ak(){if(an!=null){clearTimeout(an)}var bx=(new Date()).getTime();var bw=1000;if(bx+bw<ba){bw=ba-bx}an=setTimeout(function(){v()},bw)}function P(bw,bA){var bz=this;function by(){if(aE){var bB=bz.findMarkerById(aE);aE=null;if(bB){setTimeout(function(){bB.openWindow()},100)}}}if(ai=="browse"){var bx=++bt;TRMApi.services.getMapItems(bw.lat(),bw.lng(),bA.lat(),bA.lng(),function(bB){if(ai=="browse"&&bx==bt){bz.setData(bB);S(bB);by()}});w(bw,bA)}else{if(ai=="trips"||ai=="projects"||ai=="friends"||ai=="inbox"||ai=="breadcrumbs"||ai=="groups"||ai=="browse-trip"){if(d&&d.isDataReady()){if(e){e=false;bz.setData({Type:"MapItems",MapItems:d.getData()})}setTimeout(function(){by()},1)}else{bz.setData({Type:"MapItems",MapItems:[]})}}}}function aM(){af=a7("#google_map");
r=a7(".ui-layout-west");M=a7(".ui-layout-center");y=a7(".ui-layout-north");aT=a7(".ui-layout-south");af.gmapify({onDataRequired:P,onFootprintDataRequired:k,onPositionChanged:ak});O=a7("body").layout({defaults:{spacing_open:0,fxName:"slide",fxSpeed:"slow"},north:{maxSize:136,minSize:136},west:{minSize:320,maxSize:320},center:{onresize_end:bv}});TRMApi.ui.tab.onTabSelected=function(bw){a7.log("TRMApi.ui.tab.onTabSelected "+bw.line.text());TRMApi.functions.selectView(bw.__viewName)};a7("#confirmDeleteDialog").registerDialog("confirmDeleteDialog",{load:function(bw){a7("#confirmDeleteDialog .id-content").html(bw.Message);a7("#confirmDeleteDialog h2").text(bw.Title||"Question")}});bq=TRMApi.ui.addTab("Browse",{onSelect:function(){if(r){a7("#search-tab-results").height(r.innerHeight()-a7("#search-tab-header").outerHeight()-12)}},title:"Browse allows you to search any part of the world for points of interest. You have the option to search for any particular country and city. The search results will be displayed in the accordion with the amount of points of interest that are available in that region. You can then click on these clips to display their information. With Advanced Search you can look for specific content by increasing your search criteria."});
bq.__viewName="browse";E=TRMApi.ui.addTab("Trips",{onSelect:function(){},extraClass:"adminonly",title:"Trips can be saved and downloaded on to any hummba supported phones. You can search for specific points of interest (POI) or add all the points that you can see on the map. Once you have selected you points, DOWNLOAD TRIP and save them to your memory card on your mobile phone."});E.__viewName="trips";ab=TRMApi.ui.addTab("Uploads",{onSelect:function(){},extraClass:"adminonly",title:"This will help you to store the information that you have uploaded. Each time you add a point of interest, you can either add it to a new upload, or an existing upload.\r\n\r\nE.g. – ad a point of interest to my upload Churches in Europe"});ab.__viewName="projects";aA=TRMApi.ui.addTab("Photos",{onSelect:function(){},title:"You are able to add a footprint track and add your images, which will show where they were taken."});aA.__viewName="footprints";ae=TRMApi.ui.addTab("Friends",{onSelect:function(){},title:"You can track your friends here."});
ae.__viewName="friends";F=TRMApi.ui.addTab("Groups",{onSelect:function(){},title:"Your groups."});F.__viewName="groups";at=TRMApi.ui.addTab("Inbox",{onSelect:function(){},title:"Here you see history of all notifications about your friends."});at.__viewName="inbox";at.content.append(a7("#inbox-tab-content"));bq.content.append(a7("#search-tab-content"));a7("#search-tab-header-buttons").append(a1("Advanced Search",function(){TRMApi.functions.advancedSearch()},null,"Click on Advanced Search to increase you search criteria for points of interests. For more information please visit the help section located in the bottom right hand corner of the screen.")).append(" ").append(a1("Reset Search",function(){TRMApi.functions.resetAdvancedSearch()},"id-reset-search","Reset the search filter.").hide());a7("#search-tab-functions").append(a7("<span />").addClass("adminonly").append(a1("Add All To Trip",function(){},"onoff-anypoints onoff-loggedin","This will add all the visible points of interest showing on the map to a trip that you want to download to your mobile phone.").trpopupchooser({nameField:"Name",valueField:"TripId",onSelect:function(bx){var bw=a7.map(ay.MapItems,function(by){return by.MapItemId
});if(bx==-1){TRMApi.functions.addNewTrip({},bw)}else{TRMApi.functions.addMapItemsToTrip(bx,bw)}},onAfterItemCreated:function(bw,bx){if(bx.TripId>0&&TRMApi.services.getTripMapItemCount(bx)<1){bw.addClass("empty").attr("title","This trip has no Points of Interest added")}},onShow:function(bx){var by=[];by.push({TripId:-1,Name:"Add new trip..."});for(var bw=0;bw<TRMApi.session.trips.length;bw++){by.push(TRMApi.session.trips[bw])}bx.data=by}})));ad=a7(ab.content).append(a7("<div />").addClass("tra-header-content").append(a1("Add Upload",function(){TRMApi.functions.addNewProject()},null,"Add a new upload to your profile. You can then upload new points of interest for other users.")).append(" ").append(a1("Add Poi",function(){TRMApi.functions.addNewPoi()},null,"Add new point of interest")).append(" ").append(a1("Add Area",function(){TRMApi.functions.addNewArea()},"adminonly","Add new area")).append(" ").append(a1("Add Default",function(){TRMApi.functions.addDefaultArea()},"banneradminonly","Add new default advertisement")).append(" ").append(a1("Upload KML",function(){TRMApi.functions.uploadKml()
},"adminonly","Upload KML file"))).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html('<p>Create audio points of interest to share with your friends or the hummba community.</p><p>Need help with uploading? Click <a href="#" onclick="TRMApi.functions.showContent(\'Help#uploads-create\')">here</a>.</p>')).traccordion({tabFooterHeight:25,onTabSelected:function(bw){a7.log("accProjects.onTabSelected "+(bw?bw.headerContent().text():"-"));W(bw.getDataSource())}});A=a7(E.content).append(a7("<div />").addClass("tra-header-content").append(a1("Add Trip",function(){TRMApi.functions.addNewTrip()},null,"Add a new trip to your profile. You can then save new points of interest and download them to your mobile phone."))).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html('<p>Cool things you can do with trips:</p><p>Find location-based audio points-of-interest and download them to play from your mobile phone as you travel. Choose from over 2500 audio points of interest from around the world</p><p>Need help with downloading? Click <a href="#" onclick="TRMApi.functions.showContent(\'Help#trips\')">here</a>.</p>')).traccordion({tabFooterHeight:25,onTabSelected:function(bw){a7.log("accTrips.onTabSelected "+(bw?bw.headerContent().text():"-"));
W(bw.getDataSource())}});a7(aA.content).append(br=a7("<div />").addClass("footprints-breadcrumbs-selector").append(a0=a7('<input type="radio" name="footprintsBreadcrumbsSelector" />').click(function(){TRMApi.functions.selectView("footprints")})).append("Footprints").append(bn=a7('<input type="radio" name="footprintsBreadcrumbsSelector" />').click(function(){TRMApi.functions.selectView("breadcrumbs")})).append("Breadcrumbs")).append(V=a7("<div />")).append(aC=a7("<div />"));bh=a7(V).append(a7("<div />").addClass("tra-header-content").append(a1("Upload",function(){TRMApi.functions.addNewFootprint()},null,"Once you have activated footprints on your mobile phone, your track would have been recorded. Upload will help you to add your track and any pictures that you have taken whilst the application ran.")).append(" ").append(a1("Upload KML - ZIP",function(){TRMApi.functions.uploadKmlFootprint()},"adminonly","Upload KML file"))).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html('<p>You’ll need the mobile application for this. Click <a href="#" onclick="TRMApi.functions.downloadApplication()">here</a> or go to m.hummba.com to download. <p>Cool things you can do with Photos: <ul><li>Track your travels</li><li>Create geo tagged photo albums with Footprints and Breadcrumbs</li><li>Share your photos and videos with your friends and the hummba community</li><li>Share your albums with your Facebook friends</li><li>The best part? All of this is done in real time, while you travel, from your mobile phone.</li></ul></p><p>Need help with Photos? Click <a href="#" onclick="TRMApi.functions.showContent(\'Help#photos\')">here</a>.</p>')).traccordion({tabFooterHeight:25,onTabSelected:function(bw){a7.log("accFootprints.onTabSelected "+(bw?bw.headerContent().text():"-"));
h(null);h(bw._footprint,false)}});aJ=a7(aC).append(a7("<div />").addClass("tra-header-content").append(a1("Upload",function(){TRMApi.functions.addNewBreadcrumb()},null,"")).append(" ")).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html('<p>Cool things to do with Breadcrumbs: <ul><li>Upload photos directly from your PC without using a mobile phone.</li><li>Upload geo-tagged videos</li><li>Add Breadcrumb photos and videos to groups.</li></ul></p><p>Need help with Breadcrumbs? Click <a href="#" onclick="TRMApi.functions.showContent(\'Help#breadcrumbs\')">here</a>.</p>')).traccordion({tabFooterHeight:25,onTabSelected:function(bw){a7.log("accBreadcrumbs.onTabSelected "+(bw?bw.headerContent().text():"-"))}});m=a7(ae.content).append(a7("<div />").addClass("tra-header-content").append(a1("Invite new friends",function(){TRMApi.functions.inviteFriend()},"btn-invite-new-friends","Click here to search for and invite friends on Hummba.com. For more information please visit the help section located in the bottom right hand corner of the screen.")).append(a7("<span />").css("margin","0 0 0 5px").text("Search:")).append(a7('<input type="text" id="search_for_friends" size="28" value="Search friends directory" />').addClass("search-input"))).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html('<p>Cool things to do with Friends: <ul><li>Connect with friends. Click on <i>invite</i> and find your friends anywhere in the world.</li><li>Share your Footprint and Breadcrumb photo albums</li><li>Share your videos</li><li>Share your status and location updates</li></ul></p><p>Need help with finding friends? Click <a href="#" onclick="TRMApi.functions.showContent(\'Help#friends\')">here</a>.</p>')).traccordion({tabFooterHeight:25,onTabSelected:function(bw){a7.log("accFriendList.onTabSelected "+(bw?bw.headerContent().text():"-"))
}});g=a7(F.content).append(a7("<div />").addClass("tra-header-content").append(a1("Create",function(){TRMApi.functions.createGroup()},null,"Create new group.")).append(" ").append(a1("Search",function(){TRMApi.functions.searchGroups()},null,"Search for group."))).append(a7("<div />").addClass("tra-footer-content").append('<span class="tra-pager"></span>')).append(a7("<div />").addClass("tra-emptyhelp-content").html("<p>Cool things you can do with Groups: <ul><li>Create a group and invite your friends to it.</li><li>Search for groups that interest you</li><li>Invite friends to a group that you found</li><li>Upload Breadcrumbs to a group</li>")).traccordion({tabFooterHeight:85,tabFooterClass:"groups-tab-footer",onTabSelected:function(bw){a7.log("accGroups.onTabSelected "+(bw?bw.headerContent().text():"-"));W(TRMApi.util.DataSource.getGroupBreadcrumbsDataSource(bw._id))}});bv();a7("#controlPanel_selectCountry").change(function(){a7("#controlPanel_city").val("");af.gmap().panTo(TRMApi.session.countryById(a7(this).selectedValues()[0]).Position,TRMApi.constants.COUNTRY_ZOOM)
});a7("#controlPanel_city").bind("change",function(){var bw=this;window.setTimeout(function(){af.gmap().panToAddress(a7(bw).val()+", "+a7("#controlPanel_selectCountry").getSelectedOptionText(),TRMApi.constants.CITY_ZOOM)},100)});a7("#controlPanel_selectLanguage").bind("change",function(){TRMApi.services.setLanguageId(a7(this).selectedValues()[0]);af.gmap().refresh()});a7("#controlPanel_showMapitems").bind("click",function(){TRMApi.functions.setShowItems("AudioGuides");af.gmap().clearData();af.gmap().refresh()});a7("#controlPanel_showFootprints").bind("click",function(){TRMApi.functions.setShowItems("Footprints");af.gmap().clearData();af.gmap().refresh()});a7("#controlPanel_showBreadcrumbs").bind("click",function(){TRMApi.functions.setShowItems("Breadcrumbs");af.gmap().clearData();af.gmap().refresh()});a7("#controlPanel_city").autocomplete("CityHint.ashx",{minChars:3,selectFirst:false,extraParams:{CountryId:function(){return a7("#controlPanel_selectCountry").selectedValues()[0]}}});a7("#advancedSearch_city").autocomplete("CityHint.ashx",{minChars:3,selectFirst:false,extraParams:{CountryId:function(){return a7("#advancedSearch_countryId").selectedValues()[0]
}}});a7("#controlPanel_selectLanguage").selectOptions(1);TRMApi.services.setLanguageId(1);a7("#inboxConversations").trpopupchooser({nameField:"Name",valueField:"Id",data:[{Name:"View Messages",Id:"view"},{Name:"Compose a New Message",Id:"create"}],onSelect:function(bw){switch(bw){case"view":TRMApi.functions.showConversations();break;case"create":TRMApi.functions.newConversation();break}}});bs="browse";aI();TRMApi.services.startSession();O.hide("west");a7("#header_navigation_stripe").hide()}a7(document).ready(aM)})(jQuery);function LabeledMarker(c,b){this.opts_=b;this.labelText_=b.labelText||"";this.labelClass_=b.labelClass||"LabeledMarker_markerLabel";this.labelOffset_=b.labelOffset||new GSize(0,0);this.clickable_=b.clickable||true;this.title_=b.title||"";this.labelVisibility_=true;this.ownVisibility_=true;this.div_=document.createElement("div");this.div_.className=this.labelClass_;this.div_.innerHTML=this.labelText_;this.div_.style.position="absolute";this.div_.style.cursor="pointer";this.div_.title=this.title_;
if(b.draggable){b.draggable=false}GMarker.apply(this,arguments)}LabeledMarker.prototype=new GMarker(new GLatLng(0,0));LabeledMarker.prototype.initialize=function(d){GMarker.prototype.initialize.apply(this,arguments);this.map_=d;if(!this.ownVisibility_){this.hide()}this.applyLabelVisibility_();d.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);if(this.clickable_){var e=["click","dblclick","mousedown","mouseup","mouseover","mouseout"];for(var c=0;c<e.length;c++){var b=e[c];GEvent.addDomListener(this.div_,b,GEvent.callback(GEvent,GEvent.trigger,this,b,this.getLatLng()))}}};LabeledMarker.prototype.redraw=function(b){GMarker.prototype.redraw.apply(this,arguments);this.redrawLabel_()};LabeledMarker.prototype.redrawLabel_=function(){var b=this.map_.fromLatLngToDivPixel(this.getLatLng());var c=GOverlay.getZIndex(this.getLatLng().lat());this.div_.style.left=(b.x+this.labelOffset_.width)+"px";this.div_.style.top=(b.y+this.labelOffset_.height)+"px";this.div_.style.zIndex=c};LabeledMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.div_);
if(this.div_.outerHTML){this.div_.outerHTML=""}if(this.div_.parentNode){this.div_.parentNode.removeChild(this.div_)}this.div_=null;GMarker.prototype.remove.apply(this,arguments)};LabeledMarker.prototype.copy=function(){var b=new LabeledMarker(this.getLatLng(),this.opts_);b.labelVisibility_=this.labelVisibility_;b.ownVisibility_=this.ownVisibility_;return b};LabeledMarker.prototype.show=function(){GMarker.prototype.show.apply(this,arguments);this.ownVisibility_=true;this.applyLabelVisibility_()};LabeledMarker.prototype.hide=function(){GMarker.prototype.hide.apply(this,arguments);this.ownVisibility_=false;this.applyLabelVisibility_()};LabeledMarker.prototype.setLabelVisibility=function(b){this.labelVisibility_=b;this.applyLabelVisibility_()};LabeledMarker.prototype.getLabelVisibility=function(){return this.labelVisibility_};LabeledMarker.prototype.applyLabelVisibility_=function(){if((!this.isHidden())&&this.labelVisibility_){this.div_.style.display="block"}else{this.div_.style.display="none"
}};LabeledMarker.prototype.setLabelText=function(b){this.labelText_=b;this.div_.innerHTML=b;this.opts_.labelText=b};function ExtInfoWindow(b,c,d,e){this.html_=d;this.marker_=b;this.infoWindowId_=c;this.options_=e==null?{}:e;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(map){this.map_=map;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 tempElement=document.createElement("div");tempElement.id=this.infoWindowId_+"_"+i;tempElement.style.visibility="hidden";document.body.appendChild(tempElement);tempElement=document.getElementById(this.infoWindowId_+"_"+i);var tempWrapperPart=eval("this.wrapperParts."+i);tempWrapperPart.w=parseInt(this.getStyle_(tempElement,"width"));tempWrapperPart.h=parseInt(this.getStyle_(tempElement,"height"));
document.body.removeChild(tempElement)}for(var i in this.wrapperParts){if(i=="close"){this.wrapperDiv_.appendChild(this.contentDiv_)}var wrapperPartsDiv=null;if(this.wrapperParts[i].domElement==null){wrapperPartsDiv=document.createElement("div");this.wrapperDiv_.appendChild(wrapperPartsDiv)}else{wrapperPartsDiv=this.wrapperParts[i].domElement}wrapperPartsDiv.id=this.infoWindowId_+"_"+i;wrapperPartsDiv.style.position="absolute";wrapperPartsDiv.style.width=this.wrapperParts[i].w+"px";wrapperPartsDiv.style.height=this.wrapperParts[i].h+"px";wrapperPartsDiv.style.top=this.wrapperParts[i].t+"px";wrapperPartsDiv.style.left=this.wrapperParts[i].l+"px";this.wrapperParts[i].domElement=wrapperPartsDiv}this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);this.container_.id=this.infoWindowId_;var containerWidth=this.getStyle_(document.getElementById(this.infoWindowId_),"width");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(b){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else{b.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(g){if(!g||this.container_==null){return}var f=this.contentDiv_.offsetHeight;this.contentDiv_.style.height=f+"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=f;this.wrapperParts.r.l=this.contentWidth+this.wrapperParts.l.w;this.wrapperParts.r.t=this.wrapperParts.tr.h;this.wrapperParts.r.h=f;
this.wrapperParts.bl.t=f+this.wrapperParts.tl.h;this.wrapperParts.b.l=this.wrapperParts.bl.w;this.wrapperParts.b.t=f+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=f+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 e in this.wrapperParts){if(e=="close"){this.wrapperDiv_.insertBefore(this.contentDiv_,this.wrapperParts[e].domElement)}var d=null;if(this.wrapperParts[e].domElement==null){d=document.createElement("div");this.wrapperDiv_.appendChild(d)
}else{d=this.wrapperParts[e].domElement}d.id=this.infoWindowId_+"_"+e;d.style.position="absolute";d.style.width=this.wrapperParts[e].w+"px";d.style.height=this.wrapperParts[e].h+"px";d.style.top=this.wrapperParts[e].t+"px";d.style.left=this.wrapperParts[e].l+"px";this.wrapperParts[e].domElement=d}var j=this.marker_;var h=this.map_;GEvent.addDomListener(this.wrapperParts.close.domElement,"click",function(){h.closeExtInfoWindow()});var c=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());this.container_.style.position="absolute";var b=this.marker_.getIcon();this.container_.style.left=(c.x-(this.contentWidth/2)-b.iconAnchor.x+b.infoWindowAnchor.x)+"px";this.container_.style.top=(c.y-this.wrapperParts.bl.h-f-this.wrapperParts.tl.h-this.wrapperParts.beak.h-b.iconAnchor.y+b.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 f=b.offsetHeight;document.body.removeChild(b);this.contentDiv_.style.height=f+"px";var c=this.contentDiv_.offsetWidth;var e=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var d=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;var h=this.wrapperParts.t.domElement.offsetTop;this.wrapperParts.l.domElement.style.height=f+"px";this.wrapperParts.r.domElement.style.height=f+"px";var g=this.wrapperParts.b.domElement.offsetTop-f;this.wrapperParts.l.domElement.style.top=g+"px";this.wrapperParts.r.domElement.style.top=g+"px";this.contentDiv_.style.top=g+"px";windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height);g-=windowTHeight;this.wrapperParts.close.domElement.style.top=g+this.borderSize_+"px";this.wrapperParts.tl.domElement.style.top=g+"px";
this.wrapperParts.t.domElement.style.top=g+"px";this.wrapperParts.tr.domElement.style.top=g+"px";this.repositionMap_()};ExtInfoWindow.prototype.repositionMap_=function(){var k=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());var b=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());var i=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var r=0;var p=0;var m=this.paddingX_;var l=this.paddingY_;var e=this.marker_.getIcon().infoWindowAnchor;var d=this.marker_.getIcon().iconAnchor;var g=this.wrapperParts.t.domElement;var j=this.wrapperParts.l.domElement;var s=this.wrapperParts.b.domElement;var h=this.wrapperParts.r.domElement;var c=this.wrapperParts.beak.domElement;var n=i.y-(-e.y+d.y+this.getDimensions_(c).height+this.getDimensions_(s).height+this.getDimensions_(j).height+this.getDimensions_(g).height+this.paddingY_+(this.options_.topMargin||0));if(n<k.y){p=k.y-n}else{var t=i.y+this.paddingY_;if(t>=b.y){p=-(t-b.y)}}var q=Math.round(i.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(h).width+this.paddingX_+e.x-d.x);
if(q>k.x){r=-(q-k.x)}else{var f=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(j).width+this.borderSize_+this.paddingX_)-i.x-e.x+d.x);if(f<b.x){r=b.x-f}}if(r!=0||p!=0&&this.map_.getExtInfoWindow()!=null){this.map_.panBy(new GSize(r,p))}};ExtInfoWindow.prototype.ajaxRequest_=function(b){var c=this;var e=this.map_;var d=this.callback_;GDownloadUrl(b,function(g,f){if(e.getExtInfoWindow()!=c){return}var h=document.getElementById(e.getExtInfoWindow().infoWindowId_+"_contents");if(g==null||f==-1){h.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+b+'"</span>'}else{h.innerHTML=g}if(d!=null){d(h)}e.getExtInfoWindow().resize();GEvent.trigger(e,"extinfowindowupdate")})};ExtInfoWindow.prototype.getDimensions_=function(d){var h=this.getStyle_(d,"display");if(h!="none"&&h!=null){return{width:d.offsetWidth,height:d.offsetHeight}}var c=d.style;var g=c.visibility;var e=c.position;var b=c.display;
c.visibility="hidden";c.position="absolute";c.display="block";var i=d.clientWidth;var f=d.clientHeight;c.display=b;c.position=e;c.visibility=g;return{width:i,height:f}};ExtInfoWindow.prototype.getStyle_=function(c,d){var f=false;d=this.camelize_(d);var e=c.style[d];if(!e){if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(c,null);e=b?b[d]:null}else{if(c.currentStyle){e=c.currentStyle[d]}}}if((e=="auto")&&(d=="width"||d=="height")&&(this.getStyle_(c,"display")!="none")){if(d=="width"){e=c.offsetWidth}else{e=c.offsetHeight}}return(e=="auto")?null:e};ExtInfoWindow.prototype.camelize_=function(d){var f=d.split("-"),b=f.length;if(b==1){return f[0]}var e=d.charAt(0)=="-"?f[0].charAt(0).toUpperCase()+f[0].substring(1):f[0];for(var c=1;c<b;c++){e+=f[c].charAt(0).toUpperCase()+f[c].substring(1)}return e};GMap.prototype.ExtInfoWindowInstance_=null;GMap.prototype.ClickListener_=null;GMap.prototype.InfoWindowListener_=null;GMarker.prototype.openExtInfoWindow=function(c,e,b,d){if(c==null){throw"Error in GMarker.openExtInfoWindow: map cannot be null";
return false}if(e==null||e==""){throw"Error in GMarker.openExtInfoWindow: must specify a cssId";return false}c.closeInfoWindow();if(c.getExtInfoWindow()!=null){c.closeExtInfoWindow()}if(c.getExtInfoWindow()==null){c.setExtInfoWindow_(new ExtInfoWindow(this,e,b,d));if(c.ClickListener_==null){c.ClickListener_=GEvent.addListener(c,"click",function(f){if(!f&&c.getExtInfoWindow()!=null){c.closeExtInfoWindow()}})}if(c.InfoWindowListener_==null){c.InfoWindowListener_=GEvent.addListener(c,"infowindowopen",function(f){if(c.getExtInfoWindow()!=null){c.closeExtInfoWindow()}})}c.addOverlay(c.getExtInfoWindow())}};GMarker.prototype.closeExtInfoWindow=function(b){if(b.getExtInfoWindow()!=null){b.closeExtInfoWindow()}};GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_};GMap2.prototype.setExtInfoWindow_=function(b){this.ExtInfoWindowInstance_=b};GMap2.prototype.closeExtInfoWindow=function(){if(this.getExtInfoWindow()!=null){this.ExtInfoWindowInstance_.remove()}};var TRMaps={maps:{},lastMapId:0};
(function(g){var m;var s;var n;var r;var l=null;function c(u){return new GLatLngBounds(new GLatLng(u.SouthWest[0],u.SouthWest[1]),new GLatLng(u.NorthEast[0],u.NorthEast[1]))}TRMApi.maps={};m=function(v,u){this.gmap=new GMap2(v);this.gmap.mapFunctions=this;this.element=v;this.options=g.extend({},g.fn.gmapify.defaults,u);this.element.mapId=TRMaps.lastmapId++;this.data=null;this.overlays=[];this.overlaysById={};this.footprintOverlays=[];this.footprintPhotoOverlays=[];this.friends=[];this.friendOverlays={};this.myselfOverlay=null;this.adhocPolygon=null;this.carOverlay=null;this.executeLaterJob=null;this.user=null;this.paused=1;this.displayFootprints=true;this.displayMapItems=true;this.displayFriends=true;this.displayMyself=true;TRMaps[this.element.mapId]=this;this.initialize_()};m.prototype.initialize_=function(){this.largeMapControl=new GLargeMapControl();this.scaleControl=new GScaleControl();this.mapTypeControl=new GMapTypeControl();this.mapTypeControl.__position=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(100,10));
this.gmap.addControl(this.footprintPlaybackControl=new q());this.setCenter(this.options.initialCenter,this.options.initialZoom);this.hideFootprintPlaybackControl();this.myselfOverlay=new MyselfMarker();this.gmap.addOverlay(this.myselfOverlay);this.refresh();var u=this;GEvent.addListener(this.gmap,"zoomend",function(w,v){u.refresh();u.notifyChange()});GEvent.addListener(this.gmap,"dragend",function(){u.refresh();u.notifyChange()})};m.prototype.control_=function(w,u){var v=this;if(!u){if(!!w.__visible){if(w.container_){w.container_.hide("slow",function(){v.gmap.removeControl(w)})}else{this.gmap.removeControl(w)}}w.__visible=false}else{if(!w.__visible){this.gmap.addControl(w,w.__position)}w.__visible=true}};m.prototype.setInsideLayout=function(){this.control_(this.largeMapControl,true);this.control_(this.scaleControl,true);this.control_(this.mapTypeControl,true)};m.prototype.executeLater=function(u,v){if(!this.isMoving){this.executeLaterJob=null;v.call(u);return}this.executeLaterJob=function(){v.call(u)
}};m.prototype.runExecuteLater=function(){var u=this.executeLaterJob;if(u!=null){this.executeLaterJob=null;u()}};m.prototype.setCenter=function(v,u){this.gmap.setCenter(v,u);this.refresh();return this};m.prototype.getCenter=function(){return this.gmap.getCenter()};m.prototype.getAddressAt=function(u,w){var v=this;l.getLocations(""+u[0]+","+u[1],function(x){if(!x.Status||x.Status.code!=200||x.Placemark.length<1){w(null)}else{w(x.Placemark[0].address)}})};var j=0;m.prototype.panToAddress=function(u,w){var v=this;var x=++j;l.getLocations(u,function(y){if(!y.Status||y.Status.code!=200||y.Placemark.length<1||j!=x){return}var A=y.Placemark[0];if(A.ExtendedData&&A.ExtendedData.LatLonBox){var z=A.ExtendedData.LatLonBox;w={SouthWest:[z.south,z.west],NorthEast:[z.north,z.east]}}else{if(w==-1){if(A.AddressDetails&&A.AddressDetails.Accuracy){if(A.AddressDetails.Accuracy<4){w=TRMApi.constants.COUNTRY_ZOOM}else{if(A.AddressDetails.Accuracy<6){w=TRMApi.constants.CITY_ZOOM}else{w=TRMApi.constants.STREET_ZOOM
}}}}}v.panTo([A.Point.coordinates[1],A.Point.coordinates[0]],w)})};m.prototype.getZoomForBoundingBox=function(u){return this.gmap.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(u.SouthWest[0],u.SouthWest[1]),new GLatLng(u.NorthEast[0],u.NorthEast[1])))},m.prototype.panTo=function(u,v){if(v&&v.SouthWest&&v.NorthEast){v=this.getZoomForBoundingBox(v)}this.setCenter(new GLatLng(u[0],u[1]),v)};m.prototype.notifyResize=function(){this.gmap.checkResize();return this};m.prototype.getPrecisionLevel=function(){var u=this.gmap.getZoom();if(u>11){return 1}if(u>9){return 2}if(u>7){return 3}if(u>6){return 4}if(u>4){return 5}return 6};var f={};m.prototype.setPaused=function(u){if(!!u){this.paused++}else{this.paused--}if(!this.paused){this.refresh()}};m.prototype.setDisplayMyself=function(u){this.displayMyself=u;this.setUser(this.user)};m.prototype.setDisplayFootprints=function(v){var u=this.displayFootprints;this.displayFootprints=!!v;if(u!=this.displayFootprints){this.refresh()}};m.prototype.setDisplayMapItems=function(v){var u=this.displayMapItems;
this.displayMapItems=!!v;if(u!=this.displayMapItems){this.refresh()}};m.prototype.setDisplayFriends=function(v){var u=this.displayFriends;this.displayFriends=!!v;if(u!=this.displayFriends){this.refresh()}};m.prototype.getBounds=function(){var v=this.gmap.getBounds();var u=v.getSouthWest();var w=v.getNorthEast();return[[u.lat(),u.lng()],[w.lat(),w.lng()]]};m.prototype.notifyChange=function(){if(this.options.onPositionChanged){this.options.onPositionChanged()}};m.prototype.refresh=function(){if(this.paused){return}var w=this.gmap.getBounds();var u=w.getSouthWest();var x=w.getNorthEast();if(this.displayMapItems){if(this.options.onDataRequired){this.options.onDataRequired.apply(this,[u,x])}}else{this.clearData()}var v=this;g.each(this.friends,function(){var z=v.friendOverlays[this.UserId];if(!v.displayFriends||!w.contains(z.getLatLng())){z.hide()}else{z.show()}});var y=this.getPrecisionLevel();if(this.displayFootprints){if(this.options.onFootprintDataRequired){this.options.onFootprintDataRequired.apply(this,[y])
}}else{this.clearFootprintData()}};m.prototype.clearData=function(){var u=this;g.each(this.overlays,function(){u.gmap.removeOverlay(this)});this.selectedMarker=null;this.data=null;this.overlays=[];this.overlaysById={}};m.prototype.clearFootprintData=function(){var u=this;g.each(this.footprintOverlays,function(){u.gmap.removeOverlay(this)});g.each(this.footprintPhotoOverlays,function(){u.gmap.removeOverlay(this)});this.footprintOverlays=[];this.footprintPhotoOverlays=[]};m.prototype.setUser=function(u){this.myselfOverlay.hide();this.user=u;if(u&&!u.IsGuest&&u.CurrentPosition){this.myselfOverlay.setLatLng(new GLatLng(u.CurrentPosition[0],u.CurrentPosition[1]));g("#__myself_marker_img").attr("src",TRMApi.services.getImageThumbnailUrl(u.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE));if(this.displayMyself){this.myselfOverlay.show()}}};m.prototype.setData=function(w){if(!this.displayMapItems){return}this.selectMarker(null);g.each(this.overlays,function(){this.__used=false});this.data=w;if(this.data.MapItems){for(var v=0;
v<this.data.MapItems.length;v++){var x=this.data.MapItems[v];if(typeof(this.overlaysById[x.MapItemId])!="undefined"){this.overlaysById[x.MapItemId].__used=true;continue}var u=null;switch(this.data.Type){case"Countries":u=new n(x);break;case"Cities":u=new r(x);break;case"Footprints":case"Breadcrumbs":case"MapItems":switch(x.Type){case"Poi":u=new s(x);break;case"Area":u=new AreaMarker(x);break;case"Footprint":u=new FootprintStartMarker(x);break;case"Breadcrumb":u=new BreadcrumbMarker(x);break}break}if(u!=null){u.__used=true;u.MapItemId=x.MapItemId;this.overlaysById[x.MapItemId]=u;this.overlays.push(u);this.gmap.addOverlay(u)}}}for(var v=0;v<this.overlays.length;v++){if(this.overlays[v].__used){continue}this.gmap.removeOverlay(this.overlays[v]);delete this.overlaysById[this.overlays[v].MapItemId];this.overlays.splice(v,1);v--}};m.prototype.setFootprintData=function(w,y){if(!this.displayFootprints){return}var v=this;g.each(this.footprintOverlays,function(){v.gmap.removeOverlay(this)});this.footprintOverlays=[];
if(y==null){return}var z={};if(w&&w.__isfriend){g.extend(z,{lineColor:"#00c157",beginImageUrl:"/images/global/friend-route-end.gif",endImageUrl:"/images/global/friend-route-end.gif"})}var B=[];var x=0;var u=true;function A(E){var D;if(B.length==0){B[0]=new GLatLng(0,0)}var C=g.extend({},z);if(!u){g.extend(C,{beginImageWidth:8,beginImageHeight:8})}if(!E){g.extend(C,{endImageWidth:8,endImageHeight:8})}v.footprintOverlays.push(D=new FootprintMarker(w,B,C));v.gmap.addOverlay(D);B=[];u=false}while(x<y.Points.length){if(((y.Flags[x]&1)==1)&&x>0){A()}B.push(new GLatLng(y.Points[x][0],y.Points[x][1]));x++}A(true)};m.prototype.setFriends=function(v){var u=this;g.each(this.friends,function(){u.gmap.removeOverlay(u.friendOverlays[this.UserId])});this.friends=[];this.friendOverlays={};g.each(v,function(){var w=this.User2;u.friends.push(w);var x=new UserMarker(w);u.friendOverlays[w.UserId]=x;u.gmap.addOverlay(x)})};m.prototype.updateUser=function(v){var u=this;g.each(this.friends,function(w){if(this.UserId==v.UserId){u.friends[w]=v
}});this.friendOverlays[v.UserId].setPosition(v.CurrentPosition)};m.prototype.setFootprintPhotos=function(v){var u=this;g.each(u.footprintPhotoOverlays,function(){u.gmap.removeOverlay(this)});g.each(v,function(){var w=new PhotoMarker(this,{});u.footprintPhotoOverlays.push(w);u.gmap.addOverlay(w)})};m.prototype.findMarkerById=function(u){return this.overlaysById[u]||null};m.prototype.selectMarker=function(v){if(this.selectedMarker){this.selectedMarker.setSelected(false);this.selectedMarker=null}if(v){var u=this.findMarkerById(v);if(u&&u.setSelected){u.setSelected(true);this.selectedMarker=u}}};m.prototype.closeWindows=function(){this.gmap.closeInfoWindow();if(this.gmap.getExtInfoWindow()!=null){this.gmap.closeExtInfoWindow()}};m.prototype.showFootprintPlaybackControl=function(u){this.footprintPlaybackControl.show(u)};m.prototype.hideFootprintPlaybackControl=function(){this.footprintPlaybackControl.hide()};m.prototype.openMapItem=function(v){var u=this.findMarkerById(v);if(u){setTimeout(function(){u.openWindow()
},100)}};m.prototype.ensurePointOnMap=function(v){var x=new GLatLng(v[0],v[1]);var y=this.gmap.getBounds();var u=this.gmap.getCenter();var w=u.lat();var z=u.lng();if(y.containsLatLng(x)){return}if(x.lat()<y.getSouthWest().lat()){w=u.lat()-(y.getSouthWest().lat()-x.lat())-y.toSpan().lat()/3}if(y.getNorthEast().lat()<x.lat()){w=u.lat()+(x.lat()-y.getNorthEast().lat())+y.toSpan().lat()/3}if(x.lng()<y.getSouthWest().lng()){z=u.lng()-(y.getSouthWest().lng()-x.lng())-y.toSpan().lng()/3}if(y.getNorthEast().lng()<x.lng()){z=u.lng()+(x.lng()-y.getNorthEast().lng())+y.toSpan().lng()/3}this.gmap.panTo(new GLatLng(w,z))};m.prototype.showCar=function(u){this.hideCar();this.carOverlay=new CarMarker(u);this.gmap.addOverlay(this.carOverlay);this.panToPhotoMode(u)};m.prototype.panToPhotoMode=function(u){var v=this.gmap.getBounds().toSpan();this.gmap.panTo(new GLatLng(u[0],u[1]+(v.lng()/4)))};m.prototype.hideCar=function(){if(this.carOverlay!=null){this.gmap.removeOverlay(this.carOverlay);this.carOverlay=null
}};m.prototype.showAdhocPolygon=function(v){this.hideAdhocPolygon();var w=[];for(var u=0;u<v.length;u++){w.push(new GLatLng(v[u][0],v[u][1]))}this.adhocPolygon=new GPolygon(w,"#000000",2,1,"#ff7401",0.4,{clickable:false});this.gmap.addOverlay(this.adhocPolygon)};m.prototype.hideAdhocPolygon=function(){if(this.adhocPolygon!=null){this.gmap.removeOverlay(this.adhocPolygon);this.adhocPolygon=null}};function p(w,v){var x=[];x.push({TripId:-1,Name:"Add new trip..."});for(var u=0;u<TRMApi.session.trips.length;u++){x.push(TRMApi.session.trips[u])}w=jQuery(w);w.find(".star_rating").trmapitemrating(v);w.find(".mp3player").neolaomp3player();w.find("#lnkAddToTrip").trpopupchooser({nameField:"Name",valueField:"TripId",data:x,onSelect:function(y){if(y==-1){TRMApi.functions.addNewTrip({},[v])}else{TRMApi.functions.addMapItemsToTrip(y,[v])}}})}var e=new GIcon(G_DEFAULT_ICON);e.shadow="/images/global/map_pins/global_pin_shadow.png";e.iconSize=new GSize(22,25);e.shadowSize=new GSize(28,27);e.iconAnchor=new GPoint(12,25);
e.infoWindowAnchor=new GPoint(15,13);e.imageMap=[7,0,14,0,21,6,21,10,11,24,0,10,0,6,7,0];var t=new GIcon(e);t.image="/images/global/map_pins/pin06.png";var d=new GIcon(e);d.image="/images/global/map_pins/pin07.png";var h=new GIcon(e);h.shadow="/images/global/map_pins/breadcrumb_shadow.png";h.image="/images/global/map_pins/breadcrumb_foreground.png";h.iconSize=new GSize(38,21);h.shadowSize=new GSize(38,25);h.iconAnchor=new GPoint(0,15);h.infoWindowAnchor=new GPoint(0,15);h.imageMap=[0,6,10,0,20,0,31,6,30,10,19,6,11,17,1,13,0,6];var k=new GIcon(G_DEFAULT_ICON);k.image="/images/global/map_pins/photo_pin.gif";k.shadow="/images/global/map_pins/photo_pin_shadow.png";k.iconSize=new GSize(35,40);k.shadowSize=new GSize(75,42);k.iconAnchor=new GPoint(18,40);k.infoWindowAnchor=new GPoint(20,17);k.imageMap=[0,0,33,0,33,32,22,32,16,38,10,32,0,32];var i=new GIcon(G_DEFAULT_ICON);i.image="/images/global/route-end.gif";i.shadow="";i.iconSize=new GSize(16,16);i.shadowSize=new GSize(0,0);i.iconAnchor=new GPoint(8,8);
CarMarker=function(u,v){var v=g.extend({icon:i},v);GMarker.apply(this,[new GLatLng(u[0],u[1]),v])};CarMarker.prototype=new GMarker(new GLatLng(0,0));BaseMarker=function(){GMarker.apply(this,arguments)};BaseMarker.prototype=new GMarker(new GLatLng(0,0));BaseMarker.prototype.initialize=function(v){this.parentMap=v;var u=this;GEvent.addListener(this,"click",function(){u.onClick()});GMarker.prototype.initialize.apply(this,arguments)};BaseMarker.prototype.onClick=function(){};MapItemMarker=function(v,u){if(!v){return}var u=g.extend({icon:t,title:v.Name+"\r\n\r\nSingle click for more information"},u);BaseMarker.apply(this,[new GLatLng(v.Position[0],v.Position[1]),u]);this.miData=v};MapItemMarker.prototype=new BaseMarker(new GLatLng(0,0));MapItemMarker.prototype.openWindow=function(){var u=this;if(!this.parentMap){return}this.parentMap.mapFunctions.executeLater(this,function(){this.openExtInfoWindow(this.parentMap,"mapItemMarker","<div>Loading...</div>",{ajaxUrl:"/components/popup_mapitem.aspx?MapItemId="+this.miData.MapItemId,ajaxCallback:function(v){p(v,u.miData.MapItemId)
},topMargin:40})})};MapItemMarker.prototype.onClick=function(){this.openWindow()};FootprintMarker=function(u,x,w){var v=this;this.pts_=x;this.opts_=g.extend({},FootprintMarker.defaults,w);this.footprintData=u;GPolyline.apply(this,[x,this.opts_.lineColor,3,1,{clickable:true}]);this.footprintData=u};FootprintMarker.defaults={lineColor:"#ff7401",beginImageUrl:"/images/global/route-end.gif",beginImageWidth:16,beginImageHeight:16,endImageUrl:"/images/global/route-end.gif",endImageWidth:16,endImageHeight:16};FootprintMarker.prototype=new GPolyline([]);FootprintMarker.prototype.initialize=function(w){this.beginImage_=document.createElement("img");this.beginImage_.style.position="absolute";this.beginImage_.style.cursor="pointer";this.beginImage_.src=this.opts_.beginImageUrl;this.beginImage_.style.width=this.opts_.beginImageWidth+"px";this.beginImage_.style.height=this.opts_.beginImageHeight+"px";this.endImage_=document.createElement("img");this.endImage_.style.position="absolute";this.endImage_.style.cursor="pointer";
this.endImage_.src=this.opts_.endImageUrl;this.endImage_.style.width=this.opts_.endImageWidth+"px";this.endImage_.style.height=this.opts_.endImageHeight+"px";this.map_=w;w.getPane(G_MAP_MARKER_PANE).appendChild(this.beginImage_);w.getPane(G_MAP_MARKER_PANE).appendChild(this.endImage_);GPolyline.prototype.initialize.apply(this,arguments);var u=this;var v=function(){u.click.apply(u,arguments)};GEvent.addListener(this,"click",v);g(this.beginImage_).click(v);g(this.endImage_).click(v)};FootprintMarker.prototype.redraw=function(u){GPolyline.prototype.redraw.apply(this,arguments);if(this.beginImage_&&this.endImage_){var v=this.map_.fromLatLngToDivPixel(this.pts_[0]);var w=GOverlay.getZIndex(this.pts_[0]);this.beginImage_.style.left=(v.x-this.opts_.beginImageWidth/2)+"px";this.beginImage_.style.top=(v.y-this.opts_.beginImageHeight/2)+"px";this.beginImage_.style.zIndex=w;v=this.map_.fromLatLngToDivPixel(this.pts_[this.pts_.length-1]);w=GOverlay.getZIndex(this.pts_[this.pts_.length-1]);this.endImage_.style.left=(v.x-this.opts_.endImageWidth/2)+"px";
this.endImage_.style.top=(v.y-this.opts_.endImageHeight/2)+"px";this.endImage_.style.zIndex=w}};FootprintMarker.prototype.click=function(){if(this.footprintData){TRMApi.functions.openFootprint(this.footprintData.FootprintId);this.map_.mapFunctions.panTo(this.footprintData.BoundingBox.Center,this.footprintData.BoundingBox)}};FootprintMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.beginImage_);GEvent.clearInstanceListeners(this.endImage_);if(this.beginImage_.outerHTML){this.beginImage_.outerHTML=""}if(this.endImage_.outerHTML){this.endImage_.outerHTML=""}if(this.beginImage_.parentNode){this.beginImage_.parentNode.removeChild(this.beginImage_)}if(this.endImage_.parentNode){this.endImage_.parentNode.removeChild(this.endImage_)}this.beginImage_=null;this.endImage_=null;GPolyline.prototype.remove.apply(this,arguments)};FootprintMarker.prototype.copy=function(){var u=new FootprintMarker(this.footprintData,this.pts_,this.opts_);return u};FootprintMarker.prototype.show=function(){GPolyline.prototype.show.apply(this,arguments);
this.applyVisibility()};FootprintMarker.prototype.hide=function(){GPolyline.prototype.hide.apply(this,arguments);this.applyVisibility()};FootprintMarker.prototype.applyVisibility=function(){if(this.beginImage_.style){this.beginImage_.style.display=this.isHidden()?"none":"block";this.endImage_.style.display=this.isHidden()?"none":"block"}};AreaMarker=function(w,v){var u=this;var y=[];for(var x=0;x<w.Points.length;x++){y[x]=new GLatLng(w.Points[x][0],w.Points[x][1])}this.position_=new GLatLng((w.BoundingBox.SouthWest[0]+w.BoundingBox.NorthEast[0])/2,(w.BoundingBox.SouthWest[1]+w.BoundingBox.NorthEast[1])/2);this.opts_=v;this.areaData=w;GPolygon.apply(this,[y,"#ff7401",1,0.1,"#ff7401",0.1,{clickable:false}]);this.areaData=w};AreaMarker.prototype=new GPolygon([]);AreaMarker.prototype.initialize=function(v){GPolygon.prototype.initialize.apply(this,arguments);this.image_=document.createElement("img");this.image_.src="/images/global/map_pins/pin-area.png";this.image_.style.width="22px";this.image_.style.height="18px";
this.image_.title=this.areaData.Name+"\r\n\r\nSingle click for more information";this.div_=document.createElement("div");this.div_.style.position="absolute";this.div_.style.cursor="pointer";this.div_.appendChild(this.image_);var u=this;this.map_=v;v.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);this.mouseOverListener_=GEvent.addDomListener(this.image_,"mouseover",function(){u.setFillStyle({color:"#ff7401",opacity:0.6})});this.mouseOutListener_=GEvent.addDomListener(this.image_,"mouseout",function(){u.setFillStyle({color:"#ff7401",opacity:0.1})});this.clickListener_=GEvent.addDomListener(this.image_,"click",function(){u.onClick()})};AreaMarker.prototype.redraw=function(u){GPolygon.prototype.redraw.apply(this,arguments);if(this.div_){var v=this.map_.fromLatLngToDivPixel(this.position_);var w=GOverlay.getZIndex(this.position_.lat());this.div_.style.left=(v.x-16)+"px";this.div_.style.top=(v.y-13)+"px";this.div_.style.zIndex=w}};AreaMarker.prototype.getPoint=function(){return this.position_
};AreaMarker.prototype.getIcon=function(){return{infoWindowAnchor:{x:0,y:0},iconAnchor:{x:0,y:0},iconSize:{width:0,height:0}}};AreaMarker.prototype.openExtInfoWindow=function(v,x,u,w){if(v==null){throw"Error in AreaMarker.openExtInfoWindow: map cannot be null";return false}if(x==null||x==""){throw"Error in AreaMarker.openExtInfoWindow: must specify a cssId";return false}v.closeInfoWindow();if(v.getExtInfoWindow()!=null){v.closeExtInfoWindow()}if(v.getExtInfoWindow()==null){v.setExtInfoWindow_(new ExtInfoWindow(this,x,u,w));if(v.ClickListener_==null){v.ClickListener_=GEvent.addListener(v,"click",function(y){if(!y&&v.getExtInfoWindow()!=null){v.closeExtInfoWindow()}})}if(v.InfoWindowListener_==null){v.InfoWindowListener_=GEvent.addListener(v,"infowindowopen",function(y){if(v.getExtInfoWindow()!=null){v.closeExtInfoWindow()}})}v.addOverlay(v.getExtInfoWindow())}};AreaMarker.prototype.openWindow=function(){var u=this;if(!this.map_){return}this.map_.mapFunctions.executeLater(this,function(){this.openExtInfoWindow(this.map_,"mapItemMarker","<div>Loading...</div>",{ajaxUrl:"/components/popup_mapitem.aspx?MapItemId="+this.areaData.MapItemId,ajaxCallback:function(v){p(v,u.areaData.MapItemId)
},topMargin:40})})};AreaMarker.prototype.onClick=function(){this.openWindow()};AreaMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.image_);if(this.div_.outerHTML){this.div_.outerHTML=""}if(this.div_.parentNode){this.div_.parentNode.removeChild(this.div_)}this.div_=null;GPolygon.prototype.remove.apply(this,arguments)};AreaMarker.prototype.copy=function(){var u=new AreaMarker(this.areaData,this.opts_);return u};AreaMarker.prototype.show=function(){GPolygon.prototype.show.apply(this,arguments);this.applyAreaVisibility()};AreaMarker.prototype.hide=function(){GPolygon.prototype.hide.apply(this,arguments);this.applyAreaVisibility()};AreaMarker.prototype.applyAreaVisibility=function(){this.div_.style.display=this.isHidden()?"none":"block"};s=function(v,u){MapItemMarker.apply(this,[v,u])};s.prototype=new MapItemMarker();UserMarker=function(u,v){if(!u){return}var x=u.CurrentPosition;if(!u.CurrentPosition){x=new GLatLng(0,0);this.unknownPosition=true}else{x=new GLatLng(x[0],x[1])
}var w="user-image-"+u.UserId;var v=g.extend({labelText:'<img src="'+TRMApi.services.getImageThumbnailUrl(u.ImageId,TRMApi.constants.DEFAULT_USER_IMAGE)+'" id="'+w+'" />',icon:k,title:u.FullName,labelClass:"photo_label user-"+u.UserId+"-photo",labelOffset:new GSize(-17,-39)},v);this.userData=u;LabeledMarker.apply(this,[x,v]);this.userData=u;GEvent.addListener(this,"click",function(){TRMApi.functions.selectFriend(u.UserId)});GEvent.addListener(this,"mouseover",function(){g("#"+w).parent().addClass("selected")});GEvent.addListener(this,"mouseout",function(){g("#"+w).parent().removeClass("selected")})};UserMarker.prototype=new LabeledMarker(new GLatLng(0,0),{});UserMarker.prototype.initialize=function(v){this.parentMap=v;var u=this;LabeledMarker.prototype.initialize.apply(this,arguments);if(this.unknownPosition){this.hide()}};UserMarker.prototype.show=function(){if(this.unknownPosition){return}LabeledMarker.prototype.show.apply(this,arguments)};UserMarker.prototype.setPosition=function(u){if(u==null){this.unknownPosition=true;
this.hide()}else{this.unknownPosition=false;this.setLatLng(new GLatLng(u[0],u[1]))}};MyselfMarker=function(u){var u=g.extend({labelText:'<img src="" id="__myself_marker_img" />',icon:k,title:"Me",labelClass:"photo_label",labelOffset:new GSize(-17,-39)},u);LabeledMarker.apply(this,[new GLatLng(0,0),u]);GEvent.addListener(this,"click",function(){TRMApi.functions.showMyProfile()})};MyselfMarker.prototype=new LabeledMarker(new GLatLng(0,0),{});PhotoMarker=function(x,u){if(!x){return}var w="";if(x.UserId==TRMApi.session.user.UserId&&x.HasNewComment){w=" flashNow"}var v=TRMApi.services.getImageThumbnailTagHtml(x.Media);var u=g.extend({labelText:v,icon:k,title:x.Name,labelClass:"photo_label"+w,labelOffset:new GSize(-17,-39)},u);this.photoData=x;LabeledMarker.apply(this,[new GLatLng(x.Position[0],x.Position[1]),u]);this.photoData=x};PhotoMarker.prototype=new LabeledMarker(new GLatLng(0,0),{});PhotoMarker.prototype.initialize=function(v){this.parentMap=v;var u=this;GEvent.addListener(this,"click",function(){u.openWindow()
});LabeledMarker.prototype.initialize.apply(this,arguments)};PhotoMarker.prototype.defaultOpenWindow=function(){TRMApi.functions.showFootprintPhoto(this.photoData,true)};PhotoMarker.prototype.openWindow=function(){var u=this;if(!this.parentMap){return}if(!this.parentMap.mapFunctions.options.onFootprintOpenWindow){this.defaultOpenWindow()}else{this.parentMap.mapFunctions.options.onFootprintOpenWindow.apply(this,[this.photoData,this])}};PhotoMarker.prototype.onClick=function(){this.openWindow()};BreadcrumbMarker=function(v,u){if(!v){return}var u=g.extend({icon:h},u);MapItemMarker.apply(this,[v,u])};BreadcrumbMarker.prototype=new MapItemMarker();BreadcrumbMarker.prototype.defaultOpenWindow=function(){TRMApi.functions.showBreadcrumb(this.miData)};BreadcrumbMarker.prototype.setSelected=function(u){if(u){this.setImage("/images/global/map_pins/selected_breadcrumb_foreground.png")}else{this.setImage("/images/global/map_pins/breadcrumb_foreground.png")}};BreadcrumbMarker.prototype.openWindow=function(){var u=this;
if(!this.parentMap){return}if(!this.parentMap.mapFunctions.options.onBreadcrumbOpenWindow){this.defaultOpenWindow()}else{this.parentMap.mapFunctions.options.onBreadcrumbOpenWindow.apply(this,[this.miData,this])}};FootprintStartMarker=function(u,v){if(!u){return}var v=g.extend({labelText:'<img src="'+TRMApi.services.getImageThumbnailUrl(u.EmbedSourceImageId||u.RandomImageId)+'" />',icon:k,title:u.Name,labelClass:"photo_label",labelOffset:new GSize(-17,-39)},v);LabeledMarker.apply(this,[new GLatLng(u.StartPosition[0],u.StartPosition[1]),v]);this.footprint=u};FootprintStartMarker.prototype=new LabeledMarker(new GLatLng(0,0),{});FootprintStartMarker.prototype.initialize=function(v){this.parentMap=v;var u=this;GEvent.addListener(this,"click",function(){u.openWindow()});LabeledMarker.prototype.initialize.apply(this,arguments)};FootprintStartMarker.prototype.openWindow=function(){var u=this;if(!this.parentMap){return}this.parentMap.mapFunctions.executeLater(this,function(){this.openExtInfoWindow(this.parentMap,"mapItemMarker","<div>Loading...</div>",{ajaxUrl:"components/popup_footprint.aspx?FootprintId="+this.footprint.FootprintId,ajaxCallback:function(v){p(v,u.footprint.FootprintId)
},topMargin:40})})};FootprintStartMarker.prototype.onClick=function(){this.openWindow()};n=function(v){var u={labelText:"",icon:(v.ItemTypes||"")=="Breadcrumb"?h:t,title:"There are "+v.Count+" items in "+v.Country.Name,labelClass:"marker_label",labelOffset:new GSize(-8,-33)};LabeledMarker.apply(this,[new GLatLng(v.Country.Position[0],v.Country.Position[1]),u]);this.data=v};n.prototype=new LabeledMarker(new GLatLng(0,0),{});n.prototype.initialize=function(v){this.parentMap=v;var u=this;GEvent.addListener(this,"click",function(){u.parentMap.setCenter(u.getLatLng(),TRMApi.constants.COUNTRY_ZOOM)});LabeledMarker.prototype.initialize.apply(this,arguments)};r=function(v){var u={labelText:"",icon:(v.ItemTypes||"")=="Breadcrumb"?h:d,title:"There are "+v.Count+" items in "+v.City.Name,labelClass:"marker_label",labelOffset:new GSize(-8,-33)};LabeledMarker.apply(this,[new GLatLng(v.City.Position[0],v.City.Position[1]),u]);this.data=v};r.prototype=new LabeledMarker(new GLatLng(0,0),{});r.prototype.initialize=function(v){this.parentMap=v;
var u=this;GEvent.addListener(this,"click",function(){u.parentMap.setCenter(u.getLatLng(),TRMApi.constants.CITY_ZOOM)});LabeledMarker.prototype.initialize.apply(this,arguments)};function b(u){this.html_=u}b.prototype=new GControl();b.prototype.initialize=function(v){this.map_=v;var u=this;if(g.isFunction(this.getHtml)){this.html_=this.getHtml()}this.container_=g("<div />").append(this.html_);g(this.map_.getContainer()).append(this.container_);return this.container_[0]};b.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(20,20))};function q(){GControl.apply(this,[])}q.prototype=new GControl();q.prototype.initialize=function(w){this.map_=w;var v=this;function u(x,y){return g("<img />").addClass("button").attr("src","images/global/"+x).click(y)}this.container_=g("<div />").addClass("playback-control").append(u("stop.gif",function(){v.controller_.onstop()})).append(u("pause.gif",function(){v.controller_.onpause()})).append(u("play.gif",function(){v.controller_.onplay(0)
})).append(u("forward.gif",function(){v.controller_.onplay(1)})).append(u("fast-fast-forward.gif",function(){v.controller_.onplay(2)}));g(this.map_.getContainer()).append(this.container_);return this.container_[0]};q.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(100,32))};q.prototype.show=function(u){this.controller_=u;this.container_.show()};q.prototype.hide=function(){this.container_.hide()};g.fn.gmapify=function(u){return this.each(function(){new m(this,u)})};g.fn.gmapify.defaults={largeMapControl:true,scaleControl:true,mapTypeControl:true,initialCenter:new GLatLng(0,0),initialZoom:4,onDataRequired:null,onBreadcrumbOpenWindow:null,onFootprintOpenWindow:null,onPositionChanged:null};g.fn.gmap=function(){if(this.length==0){this.log("gmap() called on empty object list. Returning null.");return null}if(this.length!=1){throw new Error("gmap() can only be called on single-item list.")}return TRMaps[this[0].mapId]};g(document).ready(function(){if(!GBrowserIsCompatible()){alert("Your browser is not compatible with Google Maps.");
this.location="http://www.mozilla.com/firefox/";return}l=new GClientGeocoder()});TRMApi.maps.getNearestCityAndCountry=function(u,v){l.getLocations(new GLatLng(u[0],u[1]),function(z){if(!z||z.Status.code!=200||z.Placemark.length==0){v(null);return}var C=z.Placemark[0].AddressDetails.Country;var B=z.Placemark[0].AddressDetails.Country.AdministrativeArea;var y=C;var D=["AdministrativeArea","SubAdministrativeArea","Locality","AddressLine"];var x=["AdministrativeAreaName","SubAdministrativeAreaName","LocalityName","0"];bigLoop:while(true){for(var A=0;A<D.length;A++){if(typeof(y[D[A]])!="undefined"){y=y[D[A]];continue bigLoop}}for(var A=0;A<x.length;A++){if(typeof(y[x[A]])=="string"){y=y[x[A]];break bigLoop}}y=null;break bigLoop}var w=C.CountryNameCode.toLowerCase();if(w=="us"){if(B&&B.AdministrativeAreaName&&B.AdministrativeAreaName.length==2){w=w+"-"+B.AdministrativeAreaName.toLowerCase()}else{w=""}}v({City:y,CountryCode:w})})};g(window).bind("unload",GUnload)})(jQuery);