window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(D){var G=this;var F=navigator.userAgent.toLowerCase();var A=navigator.platform.toLowerCase();var H=navigator.vendor||"";if(H==="KDE"){this.isKonqueror=true;this.isSupported=false}else{if(typeof window.opera!=="undefined"){this.isOpera=true;this.isSupported=true}else{if(typeof document.all!=="undefined"){this.isIE=true;this.isSupported=true}else{if(H.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(A.indexOf("mac")>-1)}else{if(F.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(D);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var B=this.getCurrentLocation();this.currentLocation=B;if(this.isIE){this.createIE(B)}var E=function(){G.firstLoad=null};this.addEventListener(window,"unload",E);if(this.isIE){this.ignoreLocationChange=true}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}var C=function(){G.checkLocation()};setInterval(C,100)},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.fireOnNewListener=true;this.firstLoad=false}}},addListener:function(A){this.listener=A;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},addEventListener:function(C,B,A){if(C.addEventListener){C.addEventListener(B,A,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){A(window.event)})}}},add:function(C,D){if(this.isSafari){C=this.removeHash(C);historyStorage.put(C,D);this.currentLocation=C;window.location.hash=C;this.putSafariState(C)}else{var B=this;var A=function(){if(B.currentWaitTime>0){B.currentWaitTime=B.currentWaitTime-B.waitTime}C=B.removeHash(C);if(document.getElementById(C)&&B.debugMode){var E="Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+C;throw new Error(E)}historyStorage.put(C,D);B.ignoreLocationChange=true;B.ieAtomicLocationChange=true;B.currentLocation=C;window.location.hash=C;if(B.isIE){B.iframe.src="/blank.html?"+C}B.ieAtomicLocationChange=false};window.setTimeout(A,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){var A=(this.isSafari?this.getSafariState():this.getCurrentHash());return A},getCurrentHash:function(){var B=window.location.href;var A=B.indexOf("#");return(A>=0?B.substr(A+1):"")},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(A){this.waitTime=400;var B=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var D="rshHistoryFrame";var C='<iframe frameborder="0" id="'+D+'" style="'+B+'" src="/blank.html?'+A+'"></iframe>';document.write(C);this.iframe=document.getElementById(D)},createOpera:function(){this.waitTime=400;var A='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(A)},createSafari:function(){var E="rshSafariForm";var D="rshSafariStack";var C="rshSafariLength";var B=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var A=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var F='<form id="'+E+'" style="'+B+'"><input type="text" style="'+A+'" id="'+D+'" value="[]"/><input type="text" style="'+A+'" id="'+C+'" value=""/></form>';document.write(F);this.safariStack=document.getElementById(D);this.safariLength=document.getElementById(C);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},getSafariStack:function(){var A=this.safariStack.value;return historyStorage.fromJSON(A)},getSafariState:function(){var A=this.getSafariStack();var B=A[history.length-this.safariHistoryStartPoint-1];return B},putSafariState:function(B){var A=this.getSafariStack();A[history.length-this.safariHistoryStartPoint]=B;this.safariStack.value=historyStorage.toJSON(A)},fireHistoryEvent:function(A){var B=historyStorage.get(A);this.listener.call(null,A,B)},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return }if(!this.isIE&&this.ieAtomicLocationChange){return }var A=this.getCurrentLocation();if(A==this.currentLocation){return }this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=A){this.iframe.src="/blank.html?"+A}else{if(this.isIE){return }}this.currentLocation=A;this.ieAtomicLocationChange=false;this.fireHistoryEvent(A)},getIframeHash:function(){var B=this.iframe.contentWindow.document;var A=String(B.location.search);if(A.length==1&&A.charAt(0)=="?"){A=""}else{if(A.length>=2&&A.charAt(0)=="?"){A=A.substring(1)}}return A},removeHash:function(B){var A;if(B===null||B===undefined){A=null}else{if(B===""){A=""}else{if(B.length==1&&B.charAt(0)=="#"){A=""}else{if(B.length>1&&B.charAt(0)=="#"){A=B.substring(1)}else{A=B}}}}return A},iframeLoaded:function(A){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return }var B=String(A.search);if(B.length==1&&B.charAt(0)=="?"){B=""}else{if(B.length>=2&&B.charAt(0)=="?"){B=B.substring(1)}}window.location.hash=B;this.fireHistoryEvent(B)}};window.historyStorage={setup:function(B){if(typeof B!=="undefined"){if(B.debugMode){this.debugMode=B.debugMode}if(B.toJSON){this.toJSON=B.toJSON}if(B.fromJSON){this.fromJSON=B.fromJSON}}var D="rshStorageForm";var F="rshStorageField";var A=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var E=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var C='<form id="'+D+'" style="'+A+'"><textarea id="'+F+'" style="'+E+'"></textarea></form>';document.write(C);this.storageField=document.getElementById(F);if(typeof window.opera!=="undefined"){this.storageField.focus()}},put:function(A,B){this.assertValidKey(A);if(this.hasKey(A)){this.remove(A)}this.storageHash[A]=B;this.saveHashTable()},get:function(A){this.assertValidKey(A);this.loadHashTable();var B=this.storageHash[A];if(B===undefined){B=null}return B},remove:function(A){this.assertValidKey(A);this.loadHashTable();delete this.storageHash[A];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(A){this.assertValidKey(A);this.loadHashTable();return(typeof this.storageHash[A]!=="undefined")},isValidKey:function(A){return(typeof A==="string")},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(A){var B=this.isValidKey(A);if(!B&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+A+".")}},loadHashTable:function(){if(!this.hashLoaded){var A=this.storageField.value;if(A!==""&&A!==null){this.storageHash=this.fromJSON(A);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();var A=this.toJSON(this.storageHash);this.storageField.value=A},toJSON:function(A){return A.toJSONString()},fromJSON:function(A){return A.parseJSON()}};if(window.GControl){function IndicatorControl(){}IndicatorControl.prototype=new GControl();IndicatorControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0))};IndicatorControl.prototype.initialize=function(A){this.searchResultsWord=Dic.word("searchResults");this.callersCount=0;this.searching=Builder.node("h3.loading",Dic.word("searching"));this.loadingMarkers=Builder.node("h3.loading",Dic.word("loadingMarkers"));this.nothingFound=Builder.node("h3.nothing",Dic.word("nothingFound"));this.resultHeader=Builder.node("h3",this.searchResultsWord);this.close=Builder.node("a",Dic.word("hide_search_results"));this.children=$A([this.searching,this.loadingMarkers,this.nothingFound]);this.container=Builder.node("div#map_messages",[this.resultHeader,this.close,this.searching,this.loadingMarkers,this.nothingFound]);this.hide();this.container.hide();[this.resultHeader,this.close].invoke("hide");A.getContainer().appendChild(this.container);GEvent.addDomListener(this.container,"click",(function(B){if(!Event.isLeftClick(B)){return }this.hideSearch();$("search_form").reset();window.Anchor.remove("search");window.map.setZoom(window.map.getZoom())}).bind(this));this.hide=this.hide.bind(this);this.show=this.show.bind(this);this.setResults=this.setResults.bind(this);return this.container};IndicatorControl.prototype.hide=function(A){A=A||this.callersCount;if(A!=this.callersCount){return }if(this.resultHeader.visible()){this.children.invoke("hide")}else{this.container.hide();this.children.invoke("hide")}};IndicatorControl.prototype.hideSearch=function(){[this.resultHeader,this.close].invoke("hide");this.hide()};IndicatorControl.prototype.disable=function(A){this.disabled=true};IndicatorControl.prototype.show=function(A){if(this.disabled){return }this.children.invoke("hide");if(this[A]&&this[A].show){this[A].show();this.container.show();return ++this.callersCount}};IndicatorControl.prototype.setResults=function(A){this.children.invoke("hide");this.show("resultHeader");this.resultHeader.show().update(this.searchResultsWord.format(A));this.close.show()};function MapTypeControl(){}MapTypeControl.prototype=new GControl();MapTypeControl.prototype.enableList=function(B){this.buttons.last().show().up().up().id="mapTypeControlsContainerLink";GEvent.addListener(map,"moveend",A);GEvent.addListener(map,"zoomend",A);var C=this.listLink,D=this.mapObject;function A(){var E={json:$H(getGeoBox()).toJSON()},F=window.location.href;F=F.replace(/\bplaces\b/,"places/search").replace(/\/fullscreen\/?/,"").replace(/\/map\/?/,"").replace(/#.*/,"").replace(/(\?|&)?json=[^&]/,"");F+=(F.match(/\?/)?"&":"?")+$H(E).toQueryString();C.href=F;if(window.location.href.match("fullscreen")){C.target="_blank"}}};MapTypeControl.prototype.initialize=function(A){var B=Builder.node("span",Dic.word("map")),G=Builder.node("span",Dic.word("satellite")),H=this.listLink=Builder.node("a",Dic.word("list")),E=Builder.node("span",H).hide(),F=this.buttons=$A([B,G,E]);this.mapObject=A;var I=function(J){return function(K){A.setMapType(J);var L;switch(J){case G_NORMAL_MAP:L="normal";break;case G_HYBRID_MAP:L="satellite";break}Cookie.set("map",L);loadMarkersData.ignore=1}};GEvent.addListener(A,"maptypechanged",function(){var J=A.getCurrentMapType();var K=B;switch(J){case G_NORMAL_MAP:K=B;break;case G_HYBRID_MAP:K=G;break}F.invoke("removeClassName","active");K.addClassName("active")});var C=Builder.node("div",F);var D=Builder.node("div.mapTypeControlsContainer",Builder.node("div",F));GEvent.addDomListener(B,"click",I(G_NORMAL_MAP));GEvent.addDomListener(G,"click",I(G_HYBRID_MAP));A.getContainer().appendChild(D);return D};MapTypeControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(5,5))};function MapZoomControl(A){this.zoomersCount=A}MapZoomControl.prototype=new GControl();MapZoomControl.prototype.initialize=function(A){var C=(this.zoomersCount!=undefined)?this.zoomersCount:16;var G={17:"house",15:"street",12:"rayon",8:"city",4:"country"};var I=$A();var H=18;C.times(function(J){var K=Builder.node("span.zoomer","".nbsp);if(G[H-J]){G[H-J]={node:Builder.node("span",Builder.node("span",Dic.word("map_zoomer_"+G[H-J]))),parent:K,text:G[H-J]}}GEvent.addDomListener(K,"click",function(){A.setZoom(H-J)});I.push(K)});var D=Builder.node("span.zoomIn","".nbsp);var E=Builder.node("span.zoomOut","".nbsp);var F=Builder.node("div",I);var B=Builder.node("div.mapZoomControlsContainer",[D,F,E]);GEvent.addListener(A,"zoomend",function(){var K=A.getZoom();var J=0;var L="removeClassName";C.times(function(M){if(M+K>=H){L="addClassName"}I[M][L]("active")})});GEvent.addDomListener(D,"click",function(){A.setZoom(A.getZoom()+1)});GEvent.addDomListener(E,"click",function(){A.setZoom(A.getZoom()-1)});B.delayedHover(function(J){if(!G[17].node){return }$(G[17].node.parentNode)[J?"show":"hide"]();if(!J){return }G[17].node.parentNode.show();$H(G).each(function(K){K=K.value;var L=K.parent.cumulativeOffset();K.node.setStyle({position:"absolute",left:L[0]-70+"px",top:L[1]-5+"px"})})});(function(){document.body.appendChild(Builder.node("div.map_zoom_tooltips",$H(G).values().pluck("node")).hide())}).defer();A.getContainer().appendChild(B);return B};MapZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(5,38))};function MapDirectionsControl(){}MapDirectionsControl.prototype=new GControl();MapDirectionsControl.prototype.initialize=function(E){var D=Builder.node("a.button_green_xsm",Dic.word("map_create_route")),A=Builder.node("div.map_route",[Builder.node("div"),D]),B=$A([{domain:"framemsk",zoom:10,bounds:new GBounds([new GLatLng(55.547280698640805,37.231292724609375),new GLatLng(55.94458588614092,38.0181884765625)])}]);function C(){var F=map.getCenter(),H=map.getZoom(),G;if(G=B.find(function(I){return H>=I.zoom&&(I.bounds.containsPoint(F))})){A.show();D.href="/directions?clat="+F.lat()+"&clng="+F.lng()+"&mscale="+H+"&domain="+G.domain;if(window.location.href.match("fullscreen")){D.target="_blank"}}else{A.hide()}}GEvent.addListener(E,"dragend",C);GEvent.addListener(E,"zoomend",C);E.getContainer().appendChild(A);return A};MapDirectionsControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(208,5))}}if(window.GOverlay){function MTMarkerProto(A){var B=new GOverlay();B.markerType=A;B.zIndex=0;B.initialize=function(C){this.map=C};B.getLatLng=B.getPoint=function(){return this.center};B.setLatLng=B.setPoint=function(C){this.center=C;return this};B.getKey=function(){return this.id};B.copy=function(){return new window[A](this.center,this.name)};B.append=function(){this.map.getPane(G_MAP_MARKER_PANE).appendChild(this.div)};B.remove=function(){if(this.div.parentNode){this.div.remove()}if(this.completedSizes){delete this.completedSizes.l}};B.makeClickable=function(){this.div.observe("click",function(C){if(!C.isLeftClick()){return }this.setSize("l")}.bind(this))};B.realMouseClick=function(){var C=true;function D(){C=false}$(this.div).observe("mousedown",function(){C=true;document.observe("mousemove",D)});this.div.observe("click",function(E){E.stop();document.stopObserving("mousemove",D);if(C){Event.fire.delay(0,E.element(),"mouse:click")}})};B.makeHoverable=function(){return this.div.delayedHover(function(C){if(this.size=="l"){return }this.setSize(C?"m":"s")}.bind(this))};B.checkZeroHeight=function(C){if(!C){setTimeout(function(){this.redraw(true)}.bind(this),20)}};B.raise=function(C){if(C==undefined){C=true}if(!this.div.parentNode){return }this.div.style.zIndex=this.div.parentNode.style.zIndex*2+B.zIndex++};B.setSize=function(C,D){if(!D&&this.props.unresizable){return }if(C=="l"){window.map.infoWindow(this)}this.size=C;this.redraw(true)};B.redraw=function(D){if(!D){return }var C=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=C.x+"px";this.div.style.top=C.y+"px"};return B}function PersonChatMarker(A,B){this.center=A;this.id=B.id;this.props=B}PersonChatMarker.prototype=MTMarkerProto("PersonChatMarker");PersonChatMarker.prototype.initialize=function(A){this.map=A};PersonChatMarker.prototype.getDom=function(A){this.div=$(A)};PersonChatMarker.prototype.redraw=function(B){if(!B){return }if(!this.div){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-12+"px";this.div.style.top=A.y-12+"px"};function LiveMarker(A,B){this.center=A;this.id=B.id;this.name=B.name;this.text=B.text;this.props=B}LiveMarker.prototype=MTMarkerProto("LiveMarker");LiveMarker.prototype.initialize=function(A){this.map=A;this.div=Builder.node("div.portrait_marker",[Builder.node("p",Builder.node("a",{href:this.props.page_url},Builder.node("img",{src:this.props.photo_url,width:48,height:48}))),Builder.node("div.hidden blockquote",Builder.node("a",{href:this.props.post_url},this.text))])};LiveMarker.prototype.showQuote=function(A){this.div.lastChild[A?"removeClassName":"addClassName"]("hidden");return this};LiveMarker.prototype.redraw=function(B){if(!B){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-30+"px";this.div.style.top=A.y-70+"px"};function NoticeMarker(A,B){this.center=A;this.props=B}NoticeMarker.prototype=MTMarkerProto("LiveMarker");NoticeMarker.prototype.initialize=function(A){this.map=A;this.div=Builder.node("div.notice_marker",Builder.node("img",{src:"/images/adv_balloon.gif"}))};NoticeMarker.prototype.redraw=function(B){if(!B){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-80+"px";this.div.style.top=A.y-65+"px"};function PlacesAddMarker(A,B){this.center=A;this.props=B;this.id=B.id;this.name=B.name.replace(/\s+/g,"".nbsp);this.isHouse=this.props.isHouse;this.isPoint=(window.type=="pointsadd");this.size=(this.isHouse?"s":"m");if(B.size){this.size=B.size}if(!this.isHouse){this.props.unresizable=true}this.completedSizes={s:true,m:true};this.sizeClassNames={s:"house_marker_small",m:"house_marker_medium",l:"house_marker_large"};this.elements={}}PlacesAddMarker.getHtml=function(A){return HtmlBuilder.node("div",HtmlBuilder.node("div",[HtmlBuilder.node("a.title",A.name),HtmlBuilder.node("img.rightBorder",{src:"/images/bg_balloon_sm_right.gif"})]))};PlacesAddMarker.prototype=MTMarkerProto("PlacesAddMarker");PlacesAddMarker.prototype.getDom=function(A){var B=this.div=$(A)};PlacesAddMarker.prototype.initialize=function(A){this.map=A;this.div.observe("click",function(B){if(!B.isLeftClick()){return }if(B.element().match("a.close")){B.stop();this.setSize("s");return }if(!this.isHouse){A.setCenter(this.center,this.props.zoomTo)}else{this.setSize("l")}}.bind(this));this.makeHoverable()};PlacesAddMarker.prototype.largeElements=function(C){if(this.completedSizes[this.size]){return }this.completedSizes[this.size]=true;var B;if(this.isPoint){if(window.location.href.match(/\d+/)){B=window.location.href.replace(/#.*$/,"")+"?house_id="+this.id}else{B="/places/create/?house_id="+this.props.id}}else{B=window.location.href.add2url(this.props.id)}var F=Dic.word(this.isPoint?"add_point_balloon_button":"add_place_balloon_button");var A,D,E;if(PlacesAddMarker.needsName){A=Builder.node("form.simple",{method:"post"},[Builder.node("input",{type:"hidden",name:"csrf",value:PlacesAddMarker.csrf}),Builder.node("input",{type:"hidden",name:"geo[geo_id]",value:this.props.id}),Builder.node("input",{type:"hidden",name:"geo[lat]",value:this.props.lat}),Builder.node("input",{type:"hidden",name:"geo[lng]",value:this.props.lng}),Builder.node("input",{name:"place[name]"}).observe("click",function(){(function(){A.focus()}).defer()})]);E=Builder.node("p.content",[Builder.node("span",Dic.word("place_marker_address_label")+": "),Builder.node("br"),this.name]);D=Builder.node("p",Builder.node("label",[Builder.node("span",Dic.word("place_marker_name_label")+": "),A]))}else{A="";E="";D=Builder.node("p",this.name)}this.div.appendChild(Builder.node("div.add_place_balloon",[Builder.node("a.close"),D,E,Builder.node("div",Builder.node("a.button_dark",{href:B},F).observe("click",function(G){if(!G.isLeftClick()){return }if(A&&A.value.empty()){G.stop();EffectHighlight(A);return }if(A){G.stop();A.form.submit();return }if(!this.clickHandler){return }G.stop();this.clickHandler(this.id)}.bind(this)))]));if(PlacesAddMarker.needsName){A=A["place[name]"]}};PlacesAddMarker.prototype.redraw=function(B){if(!B){return }if(!this.div){return }if(!this.props.hidden){this.div.show()}if(this.size!="s"){this.raise()}if(!this.completedSizes[this.size]&&this.size=="l"){this.largeElements()}$(this.div[(this.size=="l")?"firstChild":"lastChild"]).hide();$(this.div[(this.size!="l")?"firstChild":"lastChild"]).show();this.div.className=this.sizeClassNames[this.size];var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-((this.size!="l")?15:23)+"px";this.div.style.top=A.y-((this.size!="l")?30:this.div.lastChild.offsetHeight-this.div.style.padding-17)+"px";this.checkZeroHeight(this.div.offsetHeight)};ArrowIcon=new GIcon();ArrowIcon.image="/images/map_arrow.png";ArrowIcon.iconSize=new GSize(32,32);ArrowIcon.iconAnchor=new GPoint(16,29);FirTreeIcon=new GIcon();FirTreeIcon.image="/images/plc_ny2008.png";FirTreeIcon.iconSize=new GSize(32,32);FirTreeIcon.iconAnchor=new GPoint(16,29);function PhotoMarker(A,D){D.size="l";var C='<a href="'+D.page_url+'"><img src="'+D.photo_url+'" width="48" height="48" /></a>';var B=new HoverMarker(A,D,C,{s:"photo_marker_small",l:"photo_marker"});B.redraw=function(F){if(!F){return }if(this.div.className!=this.classes.s){this.raise()}var E=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=E.x-((this.div.className==this.classes.l)?24:9)+"px";this.div.style.top=E.y-((this.div.className==this.classes.l)?62:20)+"px"};return B}function HuMarker(A,C){C.size="l";C.xOffset=-19;C.yOffset=-37;if(C.name){C.name=C.name.truncate(8)}C.href=C.id?'href="/people/'+C.id+'/"':"";var B=new Template('<p><a #{href}><img src="#{photo_url}" width="48" height="48" /></a></p>');return new HoverMarker(A,C,B.evaluate(C),{s:"portrait_marker",l:"portrait_marker stub"})}function BlogMarker(A,C){C.size="l";C.name=C.name.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");var B='<img src="/images/icon_blog_balloon.gif" class="icon" /><a class="title" href="'+C.page_url+'">'+C.name+'</a><img src="/images/bg_balloon_sm_right.gif" class="rightBorder" />';return new HoverMarker(A,C,B,{s:"blog_marker_small",l:"blog_marker"})}function PlaceMarker(A,C){C.size="s";C.yOffset=-11;C.line1=C.line1.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");C.line2=C.line2.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");var B;if(!window.fullscreen){B='<p class="'+C.type+'"><span>'+C.line1+"<br />"+C.line2+"</span></p>"}else{B=('<p class="#{type}"><a style="text-decoration: none;" href="/world#goto&#{lat}&#{lng}&12"><span>#{line1}<br />#{line2}</span></a></p>').interpolate(C)}return new HoverMarker(A,C,B,{s:"place_marker_small",l:"place_marker"})}function NewyearMarker(A,C){C.size="s";C.yOffset=-11;C.name=C.name.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");var B=('<p class="place_ny2008"><a href="#{page_url}">#{name}</span></p>').interpolate(C);return new HoverMarker(A,C,B,{s:"place_marker_small",l:"place_marker"})}function HoverMarker(A,C,D,B){this.center=A;this.inner=D;this.classes=B;this.props=C;this.xOffset=C.xOffset||0;this.yOffset=C.yOffset||0;this.id=C.id;this.name=C.name?C.name.replace(/\s+/g,"".nbsp):""}HoverMarker.prototype=MTMarkerProto("HoverMarker");HoverMarker.prototype.initialize=function(A){this.map=A;var B=this.div=Builder.node("div",{className:this.classes[this.props.size],id:(this.props.isMain?"main_marker":"")});B.innerHTML=this.inner;B.delayedHover(function(C){if(this.props.size!="l"){B.className=C?this.classes.l:this.classes.s}this.redraw(C)}.bind(this));B.observe("click",function(D){if(!D.isLeftClick()){return }var C=B.down("a");if(C&&C.href){window.top.location.href=C.href}})};HoverMarker.prototype.redraw=function(B){if(!B){return }if(this.div&&this.div.className!=this.classes.s){this.raise()}var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-15+this.xOffset+"px";this.div.style.top=A.y-30+this.yOffset+"px"};function getMarkerType(C,A){var B={blogs:"BlogMarker",friends:"HumanMarker",groups:"GroupMarker",world:"HumanMarker",live:"LiveMarker",places:"PlaceMarker",newyear:"NewyearMarker",people:"HumanMarker",photos:"PhotoMarker",placesadd:"PlacesAddMarker",pointsadd:"PlacesAddMarker",points:"PointMarker",chat:"ChatMarker",start:"HuMarker",igoogle:"IgoogleMarker",generic:"GenericMarker"};return B[C]||"LongMarker"}function LongMarker(A,B){this.center=A;this.id=B.id;this.name=B.name?B.name.replace(/\s+/g,"".nbsp):"";this.zoomTo=B.zoomTo;this.props=B}LongMarker.getHtml=function(A){var B={className:"title"};if(A.page_url){B.href=A.page_url}return HtmlBuilder.node("div.geo_marker",[HtmlBuilder.node("a",B,A.name),HtmlBuilder.node("img.rightBorder",{src:"/images/bg_balloon_sm_right.gif"})])};LongMarker.prototype=MTMarkerProto("LongMarker");LongMarker.prototype.getDom=function(A){var B=this.div=A;B.observe("click",function(C){if(!C.isLeftClick()){return }window.map.setCenter(this.center,this.zoomTo)}.bind(this));B.delayedHover(function(C){if(C){this.raise()}}.bind(this))};LongMarker.prototype.redraw=function(B){if(!B){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-15+"px";this.div.style.top=A.y-30+"px"};function IgoogleMicroMarker(A,B){this.center=A;this.div=Builder.node("div",{style:"position: absolute;"},Builder.node("div.igoogle_marker",Builder.node("a",Builder.node("img",{src:B.photo_url}))))}IgoogleMicroMarker.prototype=MTMarkerProto("IgoogleMicroMarker");function IgoogleMarker(A,B){this.center=A;this.id=B.id;this.props=B}IgoogleMarker.getHtml=function(A){var B={className:"title"};if(A.page_url){B.href=A.page_url}return HtmlBuilder.node("div",{style:"position: absolute;"},HtmlBuilder.node("div.igoogle_marker",HtmlBuilder.node("a",{href:A.page_url,target:"_blank"},HtmlBuilder.node("img",{src:A.photo_url,height:48,width:48}))))};IgoogleMarker.prototype=MTMarkerProto("IgoogleMarker");IgoogleMarker.prototype.getDom=function(A){var B=this.div=A;this.realMouseClick();B.observe("mouse:click",function(C){document.fire("igoogleMarker:clicked",this)}.bind(this));B.delayedHover(function(C){if(C){this.raise()}}.bind(this))};function GroupMarker(A,B){this.center=A;this.props=B;this.id=B.id;this.name=B.name.replace(/\s+/g,"".nbsp);this.size=B.size||"s";this.completedSizes={s:true,m:true,l:false};this.largeClass="group_popup";this.xOffsets={s:16,m:16,l:29}}GroupMarker.getHtml=function(A){return HtmlBuilder.node("div",{style:"position:absolute;"},HtmlBuilder.node("div.geo_marker",[HtmlBuilder.node("a.title",{href:A.page_url},A.name),HtmlBuilder.node("img.rightBorder",{src:"/images/bg_balloon_sm_right.gif"})]))};GroupMarker.prototype=MTMarkerProto("GroupMarker");GroupMarker.prototype.getDom=function(A){var B=this.div=$(A);A.down().down().observe("click",function(C){if(!C.isLeftClick()){return }C.stop();this.setSize("l")}.bind(this));this.smallDiv=$(this.div.firstChild)};GroupMarker.prototype.initialize=function(A){this.map=A;this.makeHoverable();this.makeClickable()};GroupMarker.prototype.largeElements=function(){if(this.completedSizes.l){this.smallDiv.hide();this.largeDiv.show();return }this.completedSizes.l=true;if(!this.largeDiv){this.smallDiv.insert({after:'<div class="balloon '+this.largeClass+'"><div class="top"><div><hr /></div></div><div class="content"><span class="loading">'+Dic.word("baloon_loading")+'</span></div><div class="bottom"><div class="map"><hr /></div></div></div>'});this.largeDiv=this.smallDiv.next();this.largeDiv.style.bottom="0"}this.redraw(true);setTimeout(function(){var B=$(this.largeDiv).down().next();if(this.props.baloon_url){var A=this.props.baloon_url}else{var A=this.props.page_url.add2url("baloon")}new Ajax.Updater(B,A,{method:"get",onComplete:function(){var C=B.down();if(C){C.observe("click",function(D){if(!D.isLeftClick()){return }D.stop();this.setSize("s")}.bind(this))}}.bind(this)});window.urchinTracker&&window.urchinTracker(A.replace(/^https?:\/\/.*?(?=\/)/,""))}.bind(this),50)};GroupMarker.prototype.redraw=function(B){if(!B){return }if(!this.div){return }if(this.size!="s"){this.raise()}if(this.size=="l"){this.largeElements()}else{if(this.largeDiv){this.largeDiv.hide()}this.smallDiv.show()}if(this.sizeClassNames){this.smallDiv.className=this.sizeClassNames[this.size]}var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-this.xOffsets[this.size]+"px";this.div.style.top=A.y-3+"px";this.div.firstChild.style.bottom="0"};function HumanMarker(A,B){if(B.name&&B.name.length>7&&!(B.lost&&B.photo==0)){B.name=B.name.truncate(8)}this.center=A;this.props=B;this.id=B.id;this.name=B.name.replace(/\s+/g,"".nbsp);this.size=B.size||"s";this.completedSizes={s:true,m:true,l:false};this.largeClass="user_popup";this.xOffsets={s:29,m:29,l:29}}HumanMarker.getHtml=function(A){return HtmlBuilder.node("div",{style:"position:absolute;"},HtmlBuilder.node("div.portrait_marker"+(A.lost?" lost_marker":""),HtmlBuilder.node("p",[HtmlBuilder.node("img",{src:A.photo_url,height:((A.lost&&A.photo==0)?32:48),width:48}),HtmlBuilder.node("a.title",{href:A.page_url},A.name)])))};Object.extend(HumanMarker.prototype,GroupMarker.prototype);HumanMarker.prototype.copy=function(){return new HumanMarker(this.center,this.props)};HumanMarker.prototype.getDom=function(A){var D=this.div=$(A);var B=this.image=A.down().down().down();var C=B.next();if(!this.props.lost){C.observe("click",function(E){if(!E.isLeftClick()){return }E.stop();this.setSize("l")}.bind(this))}if(this.props.lost&&this.props.photo==1){B.parentNode.insertBefore(Builder.node("img.magnifier",{src:"/images/icon_magnifier.gif"}),B)}this.smallDiv=$(this.div.firstChild)};HumanMarker.prototype.initialize=function(A){this.map=A;this.image.observe("load",function(){this.redraw(true)}.bind(this));this.makeHoverable();if(!this.props.lost){this.makeClickable()}};function PointMarker(A,B){this.center=A;this.props=B;this.id=B.id;this.name=B.name.replace(/\s+/g,"".nbsp);this.size=B.size||"s";this.completedSizes={s:true,m:true,l:false};this.largeClass="poi_popup";this.xOffsets={s:16,m:16,l:29};this.sizeClassNames={s:"poi_marker_small",m:"poi_marker",l:"poi_marker"}}PointMarker.getHtml=function(A){return HtmlBuilder.node("div",{style:"position:absolute;"},HtmlBuilder.node("div.poi_marker_small",[HtmlBuilder.node("p.place_category_"+A.cat,HtmlBuilder.node("span",A.name))]))};Object.extend(PointMarker.prototype,GroupMarker.prototype);PointMarker.prototype.copy=function(){return new PointMarker(this.center,this.props)};PointMarker.prototype.getDom=function(A){var B=this.div=$(A);this.smallDiv=$(this.div.firstChild)};PointMarker.prototype.initialize=function(A){this.map=A;this.makeHoverable();this.makeClickable()};function ChatMarker(A,B){this.center=A;this.props=B;this.id=B.id;this.name=(B.name||"").replace(/\s+/g,"".nbsp);this.size=B.size||"s";this.completedSizes={s:true,m:true,l:true};this.largeClass="chat_popup";this.xOffsets={s:42,m:42,l:42};this.sizeClassNames={s:"chat_marker",m:"chat_marker",l:"chat_marker chat_marker_active"}}ChatMarker.getCounter=function(A){return[A.online_count?"online":"offline",A.online_count?Dic.word("chat_marker_people_counter").format(A.online_count):Dic.word("chat_marker_people_counter_empty")]};ChatMarker.timeDiff=function(B){var A=new Date(B.updated*1000),C=new Date();return Math.floor(Math.max((C-A)/(15*60*1000),0))};ChatMarker.getColor=function(A){var C=ChatMarker.timeDiff(A),B="rgb(77,77,77)";if(C<6){B="rgb("+$R(1,3).collect(function(){return(C+2)*11}).join(",")+")"}return B};ChatMarker.getHtml=function(B){var A=ChatMarker.getCounter(B);var C={style:"background: "+ChatMarker.getColor(B)};return HtmlBuilder.node("div",{style:"position:absolute;"},HtmlBuilder.node("div.chat_marker",C,[HtmlBuilder.node("span.pointer"),HtmlBuilder.node("div.main",[HtmlBuilder.node("a.photo",HtmlBuilder.node("img",{src:B.leader_photo_url})),HtmlBuilder.node("p",[HtmlBuilder.node("a.header",String.replaceSmiles(B.leader_text.escapeHTML())),HtmlBuilder.node("span.counter "+A[0],A[1]),HtmlBuilder.node("span.messages_notice ",Dic.word("mapchat_new_messages"))])]),HtmlBuilder.node("div.reply",{style:"display:none"},[HtmlBuilder.node("a.photo",HtmlBuilder.node("img",{src:B.follower_photo_url})),HtmlBuilder.node("p",[HtmlBuilder.node("a.header",B.follower_text)])])]))};Object.extend(ChatMarker.prototype,GroupMarker.prototype);ChatMarker.prototype.copy=function(){return new ChatMarker(this.center,this.props)};ChatMarker.prototype.getDom=function(A){var B=this.div=$(A);this.smallDiv=this.largeDiv=$(this.div.firstChild)};ChatMarker.prototype.initialize=function(A){this.map=A;this.makeHoverable();this.makeClickable()};ChatMarker.prototype.update2=function(B){var A=ChatMarker.getCounter(B);this.smallDiv.setStyle({background:ChatMarker.getColor(B)}).down().next().down().next().down().next().removeClassName("online").removeClassName("offline").addClassName(A[0]).update(A[1])};ChatMarker.prototype.update=function(D){this.update2(D);this.div.fire("marker:updated",D);if(this.props.updated>=D.updated){return }var C=$(this.smallDiv.lastChild);var A=C.previous();var B=true;C.down().down().writeAttribute("src",D.follower_photo_url).up().next().down().update(String.replaceSmiles(D.follower_text.escapeHTML()));if(this.size=="l"){return }$A([10,200,400,600,800,4000]).each(function(E){(function(){A[B?"hide":"show"]();C[B?"show":"hide"]();B=!B}).delay(E/1000)});A.addClassName("new_messages");this.props=D};ChatMarker.prototype.redraw=ChatMarker.prototype.redraw.wrap(function(A,B){A.call(this,B);if(!this.map){return }this.div.style.top=this.map.fromLatLngToDivPixel(this.center).y-20+"px";if(this.div.parentNode&&this.div.parentNode.style){this.div.style.zIndex=this.div.parentNode.style.zIndex*2+this.constructor.prototype.zIndex+++3000-10*Math.min(ChatMarker.timeDiff(this.props),200);this.constructor.prototype.zIndex=Math.max(this.constructor.prototype.zIndex,this.div.style.zIndex)}});ChatMarker.prototype.setSize=ChatMarker.prototype.setSize.wrap(function(B,A){var C=this.size;B.call(this,A);if(A!="l"){if(Anchor.data.show==this.id){Chat.hideChat(true);this.map.enableScrollWheelZoom()}return }if(C!=A){Chat.showChat(Object.extend({center:this.center},this.props),this)}this.map.disableScrollWheelZoom();this.smallDiv.down().next().removeClassName("new_messages")});ChatMarker.prototype.largeElements=function(){};function GenericMarker(A,B){this.center=A;this.props=B;this.id=B.id;this.name=(B.name||"").replace(/\s+/g,"".nbsp);this.size=B.size||"s";this.completedSizes={s:true};this.xOffsets={s:16};this.yOffsets={s:32};this.sizeClassNames={s:"generic_marker"}}GenericMarker.prototype=MTMarkerProto("GenericMarker");GenericMarker.prototype.initialize=function(A){this.map=A;this.div=Builder.node("div.generic_marker")};GenericMarker.prototype.showQuote=function(A){this.div.lastChild[A?"removeClassName":"addClassName"]("hidden");return this};GenericMarker.prototype.redraw=function(B){if(!B){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.style.left=A.x-16+"px";this.div.style.top=A.y-32+"px"}}var MarkerManager=Class.create({initialize:function(B){this.map=B;this.enabled=true;this.allMarkers={};this.markerZooms={};this.displayedMarkers={};this.coordsOfMarkers={};this.halfBoundsWidth=0.5;this.expireTimeout=15000;this.minZoom2Expire=15;this.placeMarkerSpiral=true;this.loadRect={sw:{lat:0,lng:0},ne:{lat:0,lng:0}};this.tilesRect={sw:{lat:0,lng:0},ne:{lat:0,lng:0},latCount:0,lngCount:0,tileSize:0};var A=this;document.observe("markerManager:toggle",function(C){A[C.memo.state?"enable":"disable"]()})},attach:function(){var A=this.refresh.bind(this);GEvent.addListener(this.map,"zoomend",A);GEvent.addListener(this.map,"moveend",A)},enable:function(){this.enabled=true;this.refresh()},disable:function(){this.enabled=false;$H(this.allMarkers).values().each(this.hideMarker,this)},hasMarker:function(A){return !!(this.allMarkers["_"+A.id])},__addMarker:function(C,B){var D="_"+C.getKey();B=C.zoomRange||B;if(this.allMarkers[D]){if(this.allMarkers[D].update&&C.props){this.allMarkers[D].update(C.props)}this.markerZooms[D]=B||this.markerZooms[D]||[];return false}this.allMarkers[D]=C;this.markerZooms[D]=B||[];var E=C.getPoint();E=" "+E.lat()+E.lng();var A=this.coordsOfMarkers[E];if(this.placeMarkerSpiral){switch(true){case (A instanceof MarkerSpiral):A.addMarker(C);break;case (A!=undefined):this.coordsOfMarkers[E]=new MarkerSpiral(A,[C]);break;default:this.coordsOfMarkers[E]=C;break}}else{this.coordsOfMarkers[E]=C}return D},addMarker:function(B,A){var C=this.__addMarker(B,A);this.checkMarker([C,B])},removeMarker:function(A){var B="_"+A.getKey();if(!this.allMarkers[B]){return }if(this.map.infoWindow.current==A){this.map.infoWindow.current=undefined}this.map.removeOverlay(this.allMarkers[B]);delete this.allMarkers[B];delete this.displayedMarkers[B];delete this.markerZooms[B];delete this.coordsOfMarkers[B]},replaceKey:function(A,B){A="_"+A;B="_"+B;if(!this.allMarkers[A]){return }this.allMarkers[B]=this.allMarkers[A];this.displayedMarkers[B]=this.displayedMarkers[A];this.markerZooms[B]=this.markerZooms[A];delete this.allMarkers[A];delete this.displayedMarkers[A];delete this.markerZooms[A]},addMarkers:function(D,A,B){$A(D).each(function(E){this.__addMarker(E,A)},this);if(B){return }var C=1;C=setInterval(function(){this.expireMarkers(D,C)}.bind(this),this.expireTimeout)},expireMarkers:function(C,B){var A=false;$A(C).each(function(D){var E="_"+D.getKey();var F=this.markerZooms[E];if(F&&F[0]<this.minZoom2Expire){return }if(this.displayedMarkers[E]){A=true;return }delete this.allMarkers[E]},this);if(!A){clearTimeout(B)}},checkMarker:function(G){var F=G[0],C=G[1],A=C.getPoint(),H=A.lat(),E=A.lng();var B=this.markerZooms[F]||[];if(!B[0]){B[0]=-1}if(!B[1]){B[1]=1000}var D;if(this.loadRect.sw.lng<this.loadRect.ne.lng){D=(E<this.loadRect.ne.lng)&&(E>this.loadRect.sw.lng)}else{D=(E>this.loadRect.ne.lng)||(E<this.loadRect.sw.lng)}if((H<this.loadRect.ne.lat)&&(H>this.loadRect.sw.lat)&&D&&(this.currentZoom>=B[0])&&(this.currentZoom<=B[1])){this.showMarker(C)}else{this.hideMarker(C)}},showMarker:function(A){if(!this.enabled){return }var B="_"+A.getKey();if(this.displayedMarkers[B]){return }this.displayedMarkers[B]=true;this.map.addOverlay(A);A.append()},hideMarker:function(A){var B="_"+A.getKey();if(!this.displayedMarkers[B]){return }delete this.displayedMarkers[B];this.map.removeOverlay(A)},refresh:function(){this.loadRectRefresh();this.currentZoom=this.map.getZoom();$H(this.allMarkers).each(this.checkMarker,this)},loadRectRefresh:function(){var F=this.map.getBounds(),C,G,B=this.loadRect.sw=F.getSouthWest(),H=this.loadRect.ne=F.getNorthEast();this.loadRect.latSpan=(H.lat()-B.lat());this.loadRect.lngSpan=(H.lng()-B.lng());G=this.tilesRect.tileSize=360/Math.pow(2,this.map.getZoom()+1);C=this.tilesRect.splitted=this.loadRect.lngSpan<0;this.tilesRect.lat={s:Math.floor(B.lat()/G)*G,n:Math.ceil(H.lat()/G)*G};this.tilesRect.latCount=(this.tilesRect.lat.n-this.tilesRect.lat.s)/G;if(!C){this.tilesRect.lng={w:Math.floor(B.lng()/G)*G,e:Math.ceil(H.lng()/G)*G};this.tilesRect.lngCount=(this.tilesRect.lng.e-this.tilesRect.lng.w)/G}else{this.tilesRect.lng={w:Math.floor(B.lng()/G)*G,e:180};this.tilesRect.lngCount=(180-this.tilesRect.lng.w)/G;this.tilesRect.lng2={w:-180,e:Math.ceil(H.lng()/G)*G};this.tilesRect.lngCount2=(this.tilesRect.lng2.e+180)/G}var E=this.loadRect.latSpan*this.halfBoundsWidth,D=this.loadRect.lngSpan*this.halfBoundsWidth;this.loadRect.sw={lat:A(B.lat()-E),lng:A(B.lng()-D)};this.loadRect.ne={lat:A(H.lat()+E),lng:A(H.lng()+D)};function A(I){if(I>180){return 180}if(I<-180){return -180}return I}},clear:function(){$H(this.displayedMarkers).each(function(A){map.removeOverlay(this.allMarkers[A.key])},this);this.displayedMarkers={};this.allMarkers={};this.markerZooms={};this.coordsOfMarkers={}},getDisplayedMarker:function(A){var B="_"+A.getKey();if(this.displayedMarkers[B]){return this.allMarkers[B]}else{return }}});var ChatMarkerManager=Class.create(MarkerManager,{refresh:function(){this.loadRectRefresh();this.currentZoom=this.map.getZoom();if(this.currentZoom>17){$H(this.allMarkers).each(this.checkMarker,this);return }this.fillMap={};$H(this.allMarkers).values().each(this.isCluttering,this);var A=$H(this.fillMap).values().collect(function(B){return $H(B).values()}).flatten();$H(this.allMarkers).each(function(B){this[(A.indexOf(B.value)>-1)?"showMarker":"hideMarker"](B.value)},this)},isCluttering:function(C){var B=C.getLatLng(),E=this.tilesRect.splitted,G=Math.floor((B.lat()-this.tilesRect.lat.s)/this.tilesRect.tileSize),A=Math.floor((B.lng()-this.tilesRect.lng.w)/this.tilesRect.tileSize),D=E?Math.floor((B.lng()+180)/this.tilesRect.tileSize):undefined;if(G<0||G>this.tilesRect.latCount){return }if(!E){if(A<0||A>this.tilesRect.lngCount){return }}else{if(A<0||A>this.tilesRect.lngCount){if(D<0||D>this.tilesRect.lngCount2){return }A=D+this.tilesRect.lngCount+this.tilesRect.lngCount2+10}}this.fillMap[A]=this.fillMap[A]||{};var F=this.fillMap[A][G];if(F&&F.id==Anchor.data.show){return }if(!F||F.props.updated<C.props.updated||C.id==Anchor.data.show){this.fillMap[A][G]=C}}});function initBigMap(params){var mapDiv=$("map");if(!mapDiv||!GBrowserIsCompatible()){return }if(Prototype.Browser.IE&&window.GUnload){document.observe("unload",GUnload)}window.defaultMapParams=params;var realMapDiv=$("realMap");if(realMapDiv&&!mapDiv.hasClassName("smallMap")){realMapDiv.show();realMapDiv.className=mapDiv.className;mapDiv.style.border="";function updateMapDivPosition(){realMapDiv.clonePosition(mapDiv)}try{updateMapDivPosition()}catch(e){updateMapDivPosition.defer()}Event.observe(window,"resize",updateMapDivPosition);document.observe("map:resized",updateMapDivPosition)}else{realMapDiv=mapDiv}var mapOptions={};if(params.gMapOptions){$H(params.gMapOptions).each(function(pair){if(pair.value instanceof Array){try{eval('mapOptions["'+pair.key+'"] = new '+pair.value[0]+"("+pair.value[1]+");")}catch(e){}}else{mapOptions[pair.key]=pair.value}})}window.map=new GMap2(realMapDiv,mapOptions);window.manager=new window[params.manager||"MarkerManager"](map);window.manager.attach();if(!mapDiv.hasClassName("smallMap")){patchWheel(realMapDiv);addBigMapControls();if(!window.type.match(/^(friends|places|live|groupsitem|riddles|groupsinvite|generic)$/)){initMarkerLoader()}if(window.location&&window.location.hash){Anchor.hasHashOnload=true;mapHistoryListener(window.location.hash)}initSearch();updateMenuLinks(location.hash.substring(1));if(window.type=="friends"&&window.friends){setMarkersCenter(friends,"HumanMarker")}if(window.type=="places"&&window.places){setMarkersCenter(places,"PlaceMarker")}map.isLoaded()||map.setCenter(new GLatLng(params.latitude,params.longitude),params.zoom);if(!params.noHistory){if(dhtmlHistory.currentLocation===null){dhtmlHistory.create();dhtmlHistory.initialize()}dhtmlHistory.addListener(mapHistoryListener)}GEvent.addListener(map,"maptypechanged",saveMapStep);GEvent.addListener(map,"dragend",function(){Anchor.remove("show")})}else{map.addControl(new MapZoomControl(0));map.addControl(new MapTypeControl());map.setCenter(new GLatLng(params.latitude,params.longitude),params.zoom);function maxZoomDetector(message){var delayed=(function(hover){if(hover){window.map.setZoom(window.map.getZoom()-1)}}).getDelayedHandlers({over:300,out:0});return function(){delayed.handlers.out();delayed.handlers.over();return message}}G_NORMAL_MAP.getErrorMessage=maxZoomDetector(G_NORMAL_MAP.getErrorMessage());G_HYBRID_MAP.getErrorMessage=maxZoomDetector(G_HYBRID_MAP.getErrorMessage())}var containterHeight=$(map.getContainer()).getStyle("height").parseInt();if(containterHeight<$(map.getContainer()).getWidth()){while(containterHeight>256*Math.pow(2,map.getZoom())){map.setZoom(map.getZoom()+1)}if(containterHeight==256*Math.pow(2,map.getZoom())){map.setCenter(new GLatLng(0,map.getCenter().lng()))}}if(Anchor.data.go&&Anchor.data.go.type=="satellite"){map.setMapType(G_HYBRID_MAP)}if(!Anchor.data.go&&params.type=="satellite"){map.setMapType(G_HYBRID_MAP)}map.infoWindow=function(marker){if(map.infoWindow.current===marker){return }if(map.infoWindow.current){map.infoWindow.current.setSize("s")}map.infoWindow.current=marker};$A(window.mapReady).invoke("call")}function myPlacesSwitch(){var B=$("my_places");if(!B){return }var C=false;function A(){if(!window.map||B.value=="0"){return }var D=B.options[B.selectedIndex];if(!D){return }var E=D.className.split("|");window.map.setCenter(new GLatLng(parseFloat(E[0]),parseFloat(E[1])),parseInt(E[2]));C||GEvent.addListener(map,"dragend",function(){B.value=0});C=true;breadCrumbs.update(D.innerHTML)}B.observe(["change","click","keypress"],A)}function setMarkersCenter(E,A){if(E.length==0){return }var D=$A();var F=$A();var C=[];$A(E).each(function(H){var G=new GLatLng(H.lat,H.lng);D.push(G);F.push(new window[A](G,H));if(window[A].getHtml){C.push(window[A].getHtml(H))}});if(C.length){var B=Builder.node("div").hide();B.innerHTML=C.join("");document.body.appendChild(B)}(function(){if(C.length){F.each(function(G,H){G.getDom(B.childNodes[H])})}manager.addMarkers(F,undefined,true);manager.refresh()}).defer();showPoints(D)}function saveMapStep(){if(Anchor.forbidSaving){return }Anchor.update("go",{lat:map.getCenter().y,lng:map.getCenter().x,zoom:map.getZoom(),type:(map.getCurrentMapType()==G_NORMAL_MAP?"normal":"satellite")}).save();updateMenuLinks(Anchor.get())}function getGeoBox(){var B=map.getBounds(),A=B.getSouthWest(),C=B.getNorthEast();return{sw:{lat:A.lat(),lng:A.lng()},ne:{lat:C.lat(),lng:C.lng()},zoom:map.getZoom(),type:map.getCurrentMapType()==G_NORMAL_MAP?"normal":"satellite"}}function updateMenuLinks(A){if(map.getCenter()){var E=$H(getGeoBox()).toJSON();updateMenuLinks.links=updateMenuLinks.links||$A(document.getElementsByName("map_url"));updateMenuLinks.links.each(function(F){F._href=F._href||F.href;F.href=F._href+"&json="+E})}if(!$("menu")){return }if(A&&A.length>0){A="?"+A}var D=$("place_create");if(D&&Anchor.data.go){D.href=D.href.replace(/\?.*/,"")+"?geo[lat]="+Anchor.data.go.lat+"&geo[lng]="+Anchor.data.go.lng+"&geo[zoom]="+Anchor.data.go.zoom}var B=$("view_selector");if(updateMenuLinks.layers||B){updateMenuLinks.layers=updateMenuLinks.layers||B.childElements();var C=Anchor.get();updateMenuLinks.layers.each(function(F){F._href=F._href||F.href;F.href=F._href+"#"+C})}}function mapHistoryListener(){var D=Anchor.data;var B=D.search;Anchor.parse();D=Anchor.data;if(Anchor.parseCount==1&&Anchor.hasHashOnload){B=[]}else{Anchor.forbidSaving++}if(D.search){var C=$("search_form");if(C.q&&D.search[0]){C.q.value=D.search[0]}if(C.addr&&D.search[1]){C.addr.value=D.search[1]}if(D.search[0]){window.map.indicator.setResults(D.search[0])}if(!D.go){window.map.setCenter(new GLatLng(defaultMapParams.latitude,defaultMapParams.longitude),defaultMapParams.zoom)}}if(D.go){var A=window.map.getMapTypes();window.map.setCenter(new GLatLng(D.go.lat,D.go.lng),D.go.zoom);if(D.go.type){window.map.setMapType(D.go.type=="normal"?A[0]:A[1])}}if(Anchor.empty&&window.defaultMapParams&&window.dhtmlHistory.firstLoad){window.map.setCenter(new GLatLng(defaultMapParams.latitude,defaultMapParams.longitude),defaultMapParams.zoom)}}function addBigMapControls(){window.breadCrumbs=new Breadcrumbs("breadcrumbs_search",window.map);if(window.type=="chat"){var B=new GLargeMapControl();B.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(20,50))};map.addControl(B);map.addControl(new GMapTypeControl())}else{map.addControl(new MapZoomControl());var A=new MapTypeControl();map.addControl(A);if(/^(people|groups|photos|points)$/.test(window.type)){A.enableList();map.addControl(new MapDirectionsControl())}}map.indicator=new IndicatorControl();map.addControl(map.indicator);map.enableDoubleClickZoom();map.enableScrollWheelZoom();map.enableContinuousZoom()}function patchWheel(A){Event.observe(Prototype.Browser.IE?document:window,Event.SCROLL,function(B){if(!B.element().descendantOf(A)){return }B.stop()})}function initMarkerLoader(){loadMarkersData.indicatorHandle=-1;var A=(function(B){if(!B){return }if(loadMarkersData.ignore-->0){return }loadMarkersData();if(Anchor.data.search){Anchor.forbidSaving++}}).getDelayedHandlers({out:0});GEvent.addListener(map,"movestart",A.handlers.out);GEvent.addListener(map,"moveend",function(){A.handlers.out();A.handlers.over()});GEvent.addListener(map,"zoomstart",A.handlers.out);GEvent.addListener(map,"zoomend",function(){A.handlers.out();A.handlers.over()})}function initSearch(){var C=$("search_form");if(!C){return }var D,B,A=!!(window.type=="pointsadd");E();C.observe("submit",function(F){F.stop();if(C.addr&&!A){D=D||Builder.node("ul.address_search").hide();if(D.firstChild){D.update()}C.addr.parentNode.insertBefore(D,C.addr.nextSibling)}Anchor.update("search",[C.q&&C.q.value,C.addr&&C.addr.value]);if(Anchor.data.search[0]){window.map.indicator.setResults(Anchor.data.search[0])}else{window.map.indicator.hideSearch()}window.manager.clear();if(!Anchor.data.search[1]){loadMarkersData()}else{B&&B.transport&&B.transport.abort();D.update(Builder.node("li.loading")).show();B=new Ajax.Request("/resolver/json",{method:"get",parameters:{addr:C.addr.value},onSuccess:function(H){D.hide().update();var G=Ajax.parseResult(H);if(!G.results){return }if(G.results.length==0){if(!A){D.show().appendChild(Builder.node("li",Dic.word("no_address_found")))}return }if(G.results.length==1||A){D.hide();window.map.setCenter(new GLatLng(parseFloat(G.results[0].lat),parseFloat(G.results[0].lng)),parseInt(G.results[0].zoom));return }$A(G.results).each(function(I){D.show().appendChild(Builder.node("li",I.name).observe("click",function(J){if(!J.isLeftClick()){return }window.map.setCenter(new GLatLng(parseFloat(I.lat),parseFloat(I.lng)),parseInt(I.zoom))}))})}})}});function E(){var F=$("view_selector"),G="?"+C.serialize();if(!F||!/=(?!&|$)/.test(G)){return }F.childElements().each(function(H){if(!/^a$/i.test(H.nodeName)){return }H.href=H.href.replace(/(\?.*)|$/,G)})}C.style.visibility="visible"}function showPoints(C,E){var D=new GLatLngBounds();C.each(function(G){D.extend(G)});window.map.setCenter(D.getCenter(),E||window.map.getBoundsZoomLevel(D));function F(H){var G=H.getSouthWest(),I=H.getNorthEast();return[I.lat()-G.lat(),I.lng()-G.lng()]}var B=F(D),A=F(map.getBounds());if((A[0]-B[0])/A[0]<0.15||(A[1]-B[1])/A[1]<0.15){map.setZoom(map.getZoom()-1)}}function loadMarkers(G,D){D=D||{};var E=[],C;var B=Ajax.parseResult(G,function(){map.indicator.hide(D.indicatorHandle)});if(B.world){Object.extend(B,B.people)}if(B.loadEvents){$A(B.loadEvents).each(function(H){document.fire(H[0],H[1])})}var F=$A();var A=$A();$A(B.markers.reverse()).each(function(I,J){var H=new GLatLng(parseFloat(I.lat),parseFloat(I.lng));A.push(H);I.zoomTo=I.zoomTo||B.zoomTo;D.markerType=D.markerType||getMarkerType(window.type,I);var L=window[D.markerType];var K=new L(H,I);F.push(K);if(I.zoom){K.zoomRange=I.zoom}if(L.getHtml){E.push(L.getHtml(I))}});if(E.length){var C=Builder.node("div").hide();C.innerHTML=E.join("");document.body.appendChild(C)}(function(){if(E.length){F.each(function(H,I){H.getDom(C.childNodes[I])})}manager.addMarkers(F,B.zoom);manager.refresh();if(E.length){F.each(function(H){if(Anchor.data.show!=H.id){return }var H=manager.getDisplayedMarker(H);H&&H.setSize("l")})}}).defer();if(map.indicator){map.indicator.hide(loadMarkersData.indicatorHandle)}return B}function loadMarkersData(){if(Anchor.forbidSaving){Anchor.forbidSaving--}else{saveMapStep()}if(map.indicator){loadMarkersData.indicatorHandle=map.indicator.show("loadingMarkers")}var C=getGeoBox();C.type=window.type;C.full=(window.type=="world")?1:0;if(window.type=="newyear"){C.tp="ny_2008"}if(window.type=="world"){C.longName=1}if(Anchor.data.show){C.show=Anchor.data.show}if(Anchor.data.cat){C.cat=Anchor.data.cat}loadMarkersData.searchForm=loadMarkersData.searchForm||$("search_form");if(loadMarkersData.searchForm){Object.extend(C,loadMarkersData.searchForm.serialize(true))}if(loadMarkersData.background){C.background=true}var B,A=window.location.href.match(/\?(.*?)(#|$)/);if(A){B=$A(A[1].split(/&/)).inject({},function(E,F){var D=F.indexOf("=");if(D){E[F.substring(0,D)]=F.substring(D+1)}return E})}if(B&&B.pp){$A(B.pp.split(/,/)).each(function(D){C[D]=B[D]})}if(!window.mapMarkersUrl&&window.notify){notify("no mapMarkersUrl given for page")}new Ajax.Request(window.mapMarkersUrl,{method:"get",parameters:{json:$H(C).toJSON()},onSuccess:function(E){var D=loadMarkers(E,{indicatorHandle:loadMarkersData.indicatorHandle});if(window.type=="world"&&window.updateWorldPage){updateWorldPage(D)}if(DoublePost){window.DoublePost.hide();preventDoubleSubmits()}}})}window.dhtmlHistory.create=window.dhtmlHistory.create.wrap(function(A){return A.call(this,{toJSON:Object.toJSON,fromJSON:function(B){return B.evalJSON()}})});function instaMaps(){if(!window.GMap2){return }var B=Anchor.clone();var A=function(){if(Prototype.Browser.IE&&window.GUnload){document.observe("unload",GUnload)}A=Prototype.emptyFunction};document.observe("mouseup",function(F){if(!F.isLeftClick()){return }var E=F.findElement("div.post a");if(!E||!E.href){return }var G=E.href.match(/#.*/);if(!G){return }B.parse(G[0]);var D=B.data.go;if(!D){return }var I=Builder.node("div.postMap");E.replace(I);var H=new GMap2(I);var C=new GLatLng(D.lat,D.lng);H.addControl(new MapZoomControl());H.addControl(new MapTypeControl());H.setCenter(C,D.zoom);A()})}function showMarker(E,D,C,B){var A=Builder.node("div");A.innerHTML=window[D].getHtml(C);(function(){B.getDom(A.firstChild);E.addOverlay(B);B.append()}).defer()}function fitObjectOnMap(L,E,B,D){var G=B.width;var F=B.height;var J=D.fromLatLngToContainerPixel(L);var N=J.x+E.x;var M=J.y+E.y-F;var I=$(D.getContainer());var C=I.getWidth();var A=I.getHeight();var K=0,H=0;if(N<0){K=40-N}if(M<0){H=40-M}if(N+G+K>C){K=(C-(N+G))}if(M+F+H>A){H=(A-(M+F))}if(!K&&!H){return }D.setCenter(D.fromContainerPixelToLatLng(new GPoint(C/2-K,A/2-H)))}function activatePolygon(){var C;var B=$("riddle_area"),D=$("delete_polygon")||null;if(!B.value.empty()){C=new GPolygon($A(B.value.split("|")).collect(function(E){E=E.split(":");return new GLatLng(parseFloat(E[0]),parseFloat(E[1]))}),"#f00",3,1,"#600",0.3);if(D){D.show()}var A=C.getBounds();map.setCenter(A.getCenter());map.setZoom(map.getBoundsZoomLevel(A));map.addOverlay(C);C.enableEditing()}else{C=new GPolygon([],"#f00",3,1,"#600",0.3);map.addOverlay(C);C.enableDrawing()}GPolygon.prototype.getData=function(){var E=this;vertexCount=this.getVertexCount();for(vertexData=[];vertexCount>0;vertexCount--){currentVertex=E.getVertex(vertexCount-1);vertexData.push(currentVertex.lat()+":"+currentVertex.lng())}return vertexData.join("|")};D.observe("click",function(){C.disableEditing();map.removeOverlay(C);if(B.value){B.value=""}D.hide();C=new GPolygon([],"#f00",3,1,"#600",0.3);map.addOverlay(C);GEvent.addListener(C,"endline",function(){C.enableEditing();B.value=C.getData()});GEvent.addListener(C,"lineupdated",function(){D.show()});C.enableDrawing()});GEvent.addListener(C,"endline",function(){C.enableEditing();B.value=C.getData()});GEvent.addListener(C,"lineupdated",function(){D.show()});Event.SCROLL=(Prototype.Browser.IE||Prototype.Browser.Opera||Prototype.Browser.WebKit)?"mousewheel":"DOMMouseScroll";Event.observe(Prototype.Browser.IE?document:window,Event.SCROLL,function(E){if(!E.element().descendantOf(mapDiv)){return }E.stop()})}function showPolygon(){var C;var B=$("riddle_area");if(!B.value.empty()){C=new GPolygon($A(B.value.split("|")).collect(function(D){D=D.split(":");return new GLatLng(parseFloat(D[0]),parseFloat(D[1]))}),"#f00",3,1,"#600",0.3);var A=C.getBounds();map.setCenter(A.getCenter());map.setZoom(map.getBoundsZoomLevel(A));map.addOverlay(C)}}function placeCategories(){var B=$("place_categories"),A=$("search_category");if(Anchor.data.cat){A.value=Anchor.data.cat;var C=B.childElements().find(function(D){var E=D.down().href.match(new RegExp("/"+Anchor.data.cat+"/?$","i"));return E});if(C){C.addClassName("act").siblings().invoke("removeClassName","act")}}B.observe("click",function(D){if(!D.isLeftClick()){return }var E=D.element();if(!/^a$/i.test(E.nodeName)){return }D.stop();E.up().siblings().invoke("removeClassName","act");if(E.up().hasClassName("any_link")){Anchor.remove("cat").save();A.value="";B.childElements().first().hide()}else{if(!E.href.match(/(\w+)\/?$/)){return }E.up().addClassName("act");B.childElements().first().show();Anchor.update("cat",RegExp.$1).save();A.value=RegExp.$1}manager.clear();map.setZoom(map.getZoom())})}function markerCreator(A){var E=$("map_arrow");(function B(){var J=E.up();E.observe("mousedown",function(){if(E.hasClassName("inactive")){E.removeClassName("inactive")}window.placeMarker.hide();document.fire("marker:dragstart")});var G;var I=[E.offsetLeft,E.offsetTop];function F(){G=J.cumulativeOffset();G=[G[0]+I[0],G[1]+I[1]];if(window.placeArrow&&!window.placeArrow.dragging){placeArrow.returnBack()}}F();setInterval(F,100);var H=E.cumulativeOffset();window.placeArrow=new GDraggableObject(E,{delayDrag:true,left:H.left,top:H.top});GEvent.addListener(window.placeArrow,"dragstart",function(){window.placeArrow.dragging=true});GEvent.addListener(window.placeArrow,"dragend",function(K){window.placeArrow.dragging=false;C(Event.extend(K))});window.placeArrow.returnBack=function(){window.placeArrow.moveTo(new GPoint(G[0],G[1]))};document.body.appendChild(E);placeArrow.returnBack();E.removeClassName("inactive")})();(function D(){window.placeMarker=new GMarker(new GLatLng($F("geo_other_lat"),$F("geo_other_lng")),{icon:A||ArrowIcon,bouncy:false,draggable:true});window.mapReady.push(function(){window.map.addOverlay(window.placeMarker);if(!$F("geo_other_lat")){placeMarker.hide()}})})();function C(J){if(this&&this.getPoint){var G=this.getPoint()}else{Position.prepare();if(!Position.withinIncludingScrolloffsets(window.map.getContainer(),J.pointerX(),J.pointerY())){placeArrow.returnBack();E.removeClassName("inactive");return }var H=$(window.map.getContainer()).cumulativeOffset();var F=J.pointerX()-H[0];var M=J.pointerY()-H[1]+12;var G=window.map.fromContainerPixelToLatLng(new GPoint(F,M))}placeArrow.returnBack();E.addClassName("inactive");var L=20;var I;if(map.getZoom()>=17){$H(manager.displayedMarkers).each(function(O){var N=manager.allMarkers[O.key];var P=G.distanceFrom(N.getPoint());if(P<L){I=O.key;L=P}})}var K=$("geo_other_point_is_custom");marker=manager.allMarkers[I];if(L<20&&marker.markerType=="PlacesAddMarker"){marker.div.show();placeMarker.hide();if(marker.setSize){marker.setSize("l")}E.removeClassName("inactive");if(K){K.value=0}}else{placeMarker.setPoint(G);placeMarker.show();$("geo_other_lat").value=G.lat();$("geo_other_lng").value=G.lng();if(K){K.value=1}document.fire("marker:placed",G)}document.fire("placesNearby:update")}GEvent.addListener(placeMarker,"dragend",C);GEvent.addListener(placeMarker,"dragstart",function(){document.fire("marker:dragstart")});return window.mapReady.last()}function updateGeoparentsList(A,D){var C=$("radios");var B=C.up("div.balloon");document.observe("marker:placed",function(E){B.show();C.update().up().addClassName("loading");(function(){document.fire("marker:resized")}).defer();$("geo_other_zoom").value=map.getZoom();new Ajax.Request(A,{method:"get",parameters:{lat:$F("geo_other_lat"),lng:$F("geo_other_lng"),type:window.type},onSuccess:function(G){var F=Ajax.parseResult(G);$A(F.markers).each(function(H){C.appendChild(Builder.node("label",[Builder.node("input.checker",{name:"geo[geo_id]",type:"radio",value:H.id})," "+H.name]))});(function(){document.fire("marker:resized")}).defer()},onComplete:function(){C.up().removeClassName("loading")}})})}function detectGeoparent(){var G=$("radios");var F=G.up("div.balloon");if(Prototype.Browser.IE){document.body.appendChild(F)}var C,B,E;window.mapReady.push(function(){C=$(window.map.getContainer());E=C.down().down();B=C.cumulativeOffset();var H=F.getOffsetParent().cumulativeOffset();B=[B[0]-H[0],B[1]-H[1]];GEvent.addListener(window.map,"dragstart",function(){F.addClassName("hidden")});GEvent.addListener(window.map,"zoomstart",function(){F.addClassName("hidden")});GEvent.addListener(window.map,"dragend",function(){F.removeClassName("hidden");A()});GEvent.addListener(window.map,"zoomend",function(){F.removeClassName("hidden");A()})});function A(){var K=window.placeMarker.getPoint();if(K.lat()==0&&K.lng()==0){return }var I=window.map.fromLatLngToDivPixel(K);var H=I.x+parseInt(E.getStyle("left"));var L=I.y+parseInt(E.getStyle("top"));if(0>H||H>C.getWidth()||0>L||L>C.getHeight()){F.hide();return }else{F.show()}var J={top:L+B[1]-F.getHeight()-24,left:H+B[0]-29};F.setStyle({left:J.left+"px",top:J.top+"px"})}var D=new Helper(Dic.word("error_required_missed"));$("button").observe("click",function(H){if(!G.childElements().find(function(I){return I.down().checked})){H.stop();D.show($("button"))}else{D.hide()}});F.down("a.close").observe("click",function(){F.hide()});document.observe("marker:dragstart",function(){F.hide()});document.observe(["marker:placed","marker:resized"],function(H){A()});return window.mapReady.last()}Breadcrumbs=Class.create();Breadcrumbs.prototype={initialize:function(A,F){this.update=this.update.bind(this);var C=this.container=$(A);if(!this.container){return }this.map=F;this.untouchable=false;this.container.observe("focus",function(G){this.untouchable=true}.bind(this));this.container.observe("blur",function(G){this.untouchable=false}.bind(this));var D,B=this;var E=(function(){D&&D.transport&&D.transport.abort();this.container.addClassName("loading");D=new Ajax.Request("/resolver/json",{method:"get",parameters:{addr:C.value},onSuccess:function(H){var G=Ajax.parseResult(H);G=G.results;if(!G||G.length<1){EffectHighlight(B.container,{startColor:["ff","88","88"]});return }F.setCenter(new GLatLng(G[0].lat.parseFloat(),G[0].lng.parseFloat()),parseInt(G[0].zoom));if(typeof window.breadcrumbsHandler=="function"){breadcrumbsHandler(G)}document.fire("breadcrumbs:mapcentered")},onComplete:(function(){this.container.removeClassName("loading")}).bind(this)})}).bind(this);this.container.next().observe("click",E);this.container.observe("keypress",function(G){if(G.keyCode==Event.KEY_RETURN){G.stop();E()}})},update:function(A){if(this.untouchable||!A||!A.length){return }this.container.value=Object.isString(A)?A:$A(A).pluck("name").join(", ")}};var MarkerSpiral=Class.create();MarkerSpiral.prototype={lat:undefined,lng:undefined,central:undefined,markers:$A(),defaults:{angle:90,radius:0.0002,deltaRadius:0.00008},initialize:function(A,B){this.central=A;this.lat=parseFloat(this.central.getPoint().lat());this.lng=parseFloat(this.central.getPoint().lng());if(!B){return }this.markers=$A(B);this.recalc()},addMarker:function(A){this.markers.push(A);if(this.markers.length>9){A.setLatLng(this.nextStep()).redraw()}else{this.recalc()}},nextStep:function(){var A=new GLatLng(this.lat+this.radius*Math.sin(this.angle),this.lng+2*this.radius*Math.cos(this.angle));this.angle+=this.deltaAngle;this.radius+=this.deltaRadius;this.deltaAngle*=0.95;return A},recalc:function(){Object.extend(this,this.defaults);this.deltaAngle=2*Math.PI/Math.min(9,this.markers.length);this.markers.each(function(A){A.setLatLng(this.nextStep()).redraw()},this)}};Anchor={data:{},empty:true,forbidSaving:1,parseCount:0,hasHashOnload:false,clone:function(){var A=Object.clone(Anchor);A.data={};return A},parse:function(A){this.data={};this.empty=true;this.parseCount++;A=A||window.location.hash;A.substring(1).split(/[\/^](?=search|goto|show|cat)/).each(function(D){var C=D.split(/&/);var B;switch(C[0]){case"goto":B={lat:parseFloat(C[1]),lng:parseFloat(C[2]),zoom:parseInt(C[3])};C[0]="go";if(B.zoom==undefined||B.zoom==NaN){B.zoom=14}if(C.length==5&&$A(["normal","satellite"]).indexOf(C[4])>=0){B.type=C[4]}break;case"cat":case"show":B=C.slice(1).join("&");break;case"search":B=$A(C.slice(1)).map(decodeURIComponent);break}if(B!=undefined){this.data[C[0]]=B;this.empty=false}},this);return this},get:function(){var A=[];$H(this.data).each(function(B){switch(B.key){case"go":B.key=["goto",B.value.lat,B.value.lng,B.value.zoom,B.value.type].join("&");break;case"cat":case"show":B.key+="&"+B.value;break;case"search":B.key+="&"+B.value.join("&");break}A.push(B.key)});return A.join("/")},set:function(B,A){this.empty=false;this.data={};this.data[B]=A;return this},update:function(B,A){this.empty=false;this.data[B]=A;return this},remove:function(A){delete this.data[A];if($H(this.data).keys().length==0){this.empty=true}return this},save:function(){var A=this.get();if(this.forbidSaving||A==window.location.hash){return this}window.dhtmlHistory.add(A);return this}};Anchor.parse();Anchor.parseCount=0;function initIGoogle(A){var i=$("searchToggle"),f=$("advanced_search"),g,d=[],l=$("address_advanced"),S=$("address_search"),m=$("address_options"),p=$("address_options_none"),T=$("address_options_hide"),E=$("profile"),F=$("profilePreview"),M=$("nextProfile"),h=$("hideProfile"),c=$("backOnMap"),j=$("befriend"),H=$("searchAgain"),I=$("friends"),Z=$("unreadMessageLink"),X=$("toggleFriends"),P=$("messages"),J=$("toggleMessages"),V=$("controls"),N=$("map"),D=N.up(),B,n=$("main_tabs"),O=$("personal_stream"),a=$("login_form");if(!GBrowserIsCompatible()){return }if(Prototype.Browser.IE&&window.GUnload){document.observe("unload",GUnload)}n.observe("click",function(q){q.stop();var r=q.element();if(!r.match("a")){return }r=r.up();if(r.hasClassName("act")){return }r.addClassName("act").siblings().invoke("removeClassName","act");P&&P.hide();if(r.hasClassName("tab_friends")){if(window.isGuest){a.up().up().show();$(a["auth[login]"]).focus()}else{O.up().show()}document.cookie="tab=person_stream;path=/igoogle"}else{O&&O.up().hide();window.isGuest&&a.up().up().hide();document.cookie="tab=;path=/igoogle"}});a&&a.observe("submit",function L(r){r.stop();a.request({add2url:"json",onSuccess:function(s){Ajax.parseResult(s);window.location.reload()},onFailure:q,onException:q});function q(){a.stopObserving("submit",L);a.submit()}});X&&X.observe("click",function(q){q.stop();I.toggleClassName("small")});document.observe("click",function(q){var r=q.element();if(!r.match(".popout")){return }q.stop();r.fire("popout:clicked")});O&&O.up().observe("click",function(q){if(!q.element().match("a")){return }q.element().target="_blank"});J.observe("click",function(q){q.stop();if(window.isGuest){a.up().up().show();$(a["auth[login]"]).focus()}else{P.show()}n.childElements().invoke("removeClassName","act");document.cookie="tab=messages;path=/igoogle"});$(l.form).observe("submit",function(q){q.stop();G()});l.observe("focus",function(q){if(!m.down()||m.down()==p){return }m.show();T.show()});T.observe("click",function(q){q.stop();m.hide();T.hide()});function G(){var q;T.hide();m.hide().update();f.addr.value=l.value;new Ajax.Request("/resolver/json",{method:"get",parameters:{addr:l.value},onSuccess:function(s){var r=Ajax.parseResult(s);if(!r.results){return }if(r.results.length==1&&(q=r.results[0])){window.map.setCenter(new GLatLng(parseFloat(q.lat),parseFloat(q.lng)),parseInt(q.zoom));return }m.show();T.show();if(r.results.length==0){m.appendChild(p);return }$A(r.results).each(function(t){m.appendChild(Builder.node("li",t.name).observe("click",function(u){if(!u.isLeftClick()){return }window.map.setCenter(new GLatLng(parseFloat(t.lat),parseFloat(t.lng)),parseInt(t.zoom));this.addClassName("act").siblings().invoke("removeClassName","act")}))})}})}document.observe("keypress",function(q){if(q.keyCode!=Event.KEY_ESC){return }f.removeClassName("advanced");manager.enable();K(true);F.hide();m.hide();T.hide()});f.down().observe("click",function(q){q.stop();f.removeClassName("advanced");manager.enable()});i.observe("click",function(q){q.stop();if(window.isGuest){a.up().up().show();$(a["auth[login]"]).focus()}else{f.show().addClassName("advanced")}});f.observe("submit",function(q){q.stop();g=0;d=[];R()});if(!window.isGuest){popout(j)}M.observe("click",function(q){q.stop();g++;R()});document.observe("igoogleMarker:clicked",function(q){U(q.memo.props.page_url,q.memo.getLatLng())});$A([h,c]).invoke("observe","click",function(){B&&W.removeOverlay(B);manager.enable();K(true);F.hide()});H.observe("click",function(q){K(true);F.hide();f.show().addClassName("advanced")});function R(){manager.disable();K(false);B&&W.removeOverlay(B);E.addClassName("loading");F.removeClassName("empty").addClassName("from_search").show();f.hide();l.value=f.addr.value;var t=Object.extend(f.serialize(true),{offset:g});if(!$F("address")){var q=W.getCenter(),r=q.lat(),u=q.lng(),s=0.5;t=Object.extend(t,{sw:{lat:r-s,lng:u-s}});t=Object.extend(t,{ne:{lat:r+s,lng:u+s}})}if(d&&d.length){t.id={not_in:d}}new Ajax.Request(f.action,{method:"get",parameters:{json:$H(t).toJSON()},onSuccess:function(x){var w=Ajax.parseResult(x);E.removeClassName("loading").update(w.html);j.href=w.message_url;B=undefined;if(!w.lat){F.addClassName("empty");return }d.push(w.id);var v=new GLatLng(parseFloat(w.lat),parseFloat(w.lng));k(v,w);W.panTo(o(v))}})}function U(r,q){manager.disable();K(false,o(q));E.addClassName("loading");F.removeClassName("empty").removeClassName("from_search").show();new Ajax.Request(f.action,{method:"get",parameters:{json:$H({id:r.match(/\d+/)[0]}).toJSON()},onSuccess:function(t){var s=Ajax.parseResult(t);E.update(s.html).removeClassName("loading");j.href=s.message_url;k(q,s)}})}function K(r,q){q=q||W.getCenter();if(r){D.addClassName("large")}else{D.removeClassName("large")}W.checkResize();W.setCenter(q)}function k(r,q){B=new IgoogleMicroMarker(r,{page_url:q.page_url,photo_url:q.photo_url});W.addOverlay(B);B.append()}function o(q){var r=W.fromLatLngToContainerPixel(q);return W.fromContainerPixelToLatLng(new GPoint(r.x,r.y-30))}Anchor.forbidSaving=10000;var W=window.map=new GMap2(N);window.manager=new window[A.manager||"MarkerManager"](W);window.manager.attach();V.down().down().observe("click",function(){W.setMapType(G_NORMAL_MAP)}).next().observe("click",function(){W.setMapType(G_HYBRID_MAP)}).up().next().down().next().observe("click",function(){W.zoomOut()}).next().observe("click",function(){W.zoomIn()});$("top").observe("click",function(){W.panDirection(0,1)});$("left").observe("click",function(){W.panDirection(1,0)});$("right").observe("click",function(){W.panDirection(-1,0)});$("bottom").observe("click",function(){W.panDirection(0,-1)});GEvent.addListener(W,"maptypechanged",function(){var q;switch(W.getCurrentMapType()){case G_HYBRID_MAP:q=V.down().down().next();Cookie.set("map","satellite");break;default:q=V.down().down();Cookie.set("map","normal");break}q.siblings().invoke("removeClassName","active");q.addClassName("active")});initMarkerLoader();if(W.getCurrentMapType()==G_NORMAL_MAP&&A.type=="satellite"){W.setMapType(G_HYBRID_MAP)}W.setCenter(new GLatLng(A.latitude,A.longitude),A.zoom);var C=20000,Q=$("igoogle_unmarkedCount"),b=$("unreadMessagesList"),Y=$("friendsList");if(!Y){return }Y=Y.childElements();function e(){new Ajax.Request("/im/json",{method:"get",parameters:{background:true},onSuccess:function(s){var q=Ajax.parseResult(s),r=q.messages&&q.messages.length||0;Q.update(r?"("+r+")":"");Q.up()[r?"addClassName":"removeClassName"]("mail_new");b.next()[r?"hide":"show"]();b.update(contactListHandler.makeUnreadMessagesHtml(q.messages));Y.each(function(v,t){var u=A.friendsIds;v.down().next().next().replaceClassNameWith("online|away|offline",q.onlineFriends[u]||"offline")})},on403:function(){a.up().up().show();$(a["auth[login]"]).focus()}});C*=1.5;setTimeout(e,C)}setTimeout(e,C);b.observe("click",function(){e.delay(3)})}window.domReady.push(function(){var A=$("chat_starter"),K=$("chat_starter_button");if(!K){return }var L=true,E,J,F=$("chat_start_marker").up(),D=$("chat_start_area"),P=$("chat_chooser"),O=P.down().next().next(),I=O.down(),G=I.down(),H=false;K.observe("click",function(Q){targetSpan=K.down();if(targetSpan.hasClassName("disabled")){alert(targetSpan.title);return }Chat.hideChat();if(J){map.removeOverlay(J)}J=undefined;if(L){C(Q);A.show();document.observe("mousemove",C);E=GEvent.addListener(map,"click",M);document.fire("markerManager:toggle",{state:false});this.addClassName("shouting")}else{N()}L=!L});function C(Q){A.style.top=(Q.pointerY()-52)+"px";A.style.left=(Q.pointerX()-42)+"px"}function N(){A.hide();document.stopObserving("mousemove",C);GEvent.removeListener(E);document.fire("markerManager:toggle",{state:true});K.removeClassName("shouting")}function M(R,W){N();if(J){map.removeOverlay(J)}J=undefined;L=true;var Q=map.getBounds(),X=Q.getSouthWest(),T=Q.getNorthEast(),V=0.05,S=V*(T.lat()-X.lat()),U=V*(T.lng()-X.lng()),Z={sw:{lat:W.lat()-S,lng:W.lng()-U},ne:{lat:W.lat()+S,lng:W.lng()+U},startChat:true};new Ajax.Request(window.mapMarkersUrl,{method:"get",parameters:{json:$H(Z).toJSON()},onSuccess:function(e){loadMarkers(e);var d;(function(){d=Object.clone(window.manager.allMarkers)}).defer();var a=Ajax.parseResult(e);if(a.markers.length==0){Y();return }if(!H){H=true;P.down().observe("click",function(){P.hide()});O.observe("submit",function(g){g.stop();var h=O.getElements().find(function(i){return i.checked});if(!h){return }P.hide();if(h.value==-1){Y();return }var f=d["_"+h.value];Chat.showChat(Object.extend({center:f.getLatLng()},f.props),f)})}var c=$A();$A(a.markers).sortBy(function(f){return f.online_count}).reverse().each(function(g,f){if(f>7){return }c.push(Builder.node("li",Builder.node("label",[Builder.node("input",{type:"radio",value:g.id,name:"chat[id]"}),Builder.node("span.online counter").update(g.online_count),Builder.node("span.text").update(String.replaceSmiles(g.leader_text.escapeHTML()))])))});if(c.length==0){Y();return }G.remove();I.update();c.each(function(f){I.appendChild(f)});I.appendChild(G);var b=map.fromLatLngToContainerPixel(W);P.setStyle({left:b.x-42+"px",top:b.y-20-P.getHeight()+"px"}).show()}});function Y(){J=new StartChatMarker(W,F);map.addOverlay(J);D.focus()}}F.down().down().observe("click",function(){if(J){map.removeOverlay(J)}J=undefined;N();L=true});D.observe("click",function(){(function(){D.focus()}).defer()}).observe("keypress",function(Q){if(!Event.isCtrlEnter(Q)){return }Q.stop();Chat.postMessage(D,J,B)});$("chat_start_submit").observe("click",function(Q){Q.stop();Chat.postMessage(D,J,B)});function B(T,Q){var S=new ChatMarker(J.getPoint(),T);S.size="l";var R=Builder.node("div");R.update(ChatMarker.getHtml(T));document.body.appendChild(R);(function(){S.getDom(R.firstChild);manager.addMarker(S);Chat.showChat(Object.extend({center:S.getPoint()},T),S,Q)}).defer();map.removeOverlay(J);J=undefined;D.value="";return S}$("smileys_start").observe("click",function(Q){var R=Q.element();if(R.match("div")){return }if(R.match("img")){R=R.parentNode}$("chat_start_area").value+=" "+R.title+" ";$("chat_start_area").focus()});$("shoutbox_holder").down().observe("click",function(Q){var R=Q.element();if(R.match("a.collapse")){R.up().toggleClassName("collapsed");return }})});if(window.isGuest){window.domReady.push(function(){var D=$("lightbox_holder");if(!D){return }var B=$("registration_form");var C=$("login_form");var A=$("auth_nav")?$("auth_nav").childElements():undefined;window.manageAuth=function(F,E){if(!E){if(A){if(A[0].hasClassName("act")){A[0].removeClassName("act")}else{A[1].removeClassName("act")}}D.hide();B&&B.hide();C&&C.hide();$$("#chat .chat_users").first().show()}else{manageAuth(0,0);A&&A[F].addClassName("act");D.show();if(F==0){B&&B.show()}else{C&&C.show()}$$("#chat .chat_users").first().hide()}};D.down().next().down().observe("click",function(){manageAuth(0,0)});if(!C){return }if(A[0]){A[0].observe("click",function(){manageAuth(0,1)})}if($("avatar1")){$("avatar1").observe("click",function(){manageAuth(0,1)})}if(A[1]){A[1].observe("click",function(){manageAuth(1,1)})}$("user_name").makeRequired();$("user_email").makeRequired();$("user_password2").makeRequiredEqualTo("user_password",function(F,G,E){G.up(".required")[F?"addClassName":"removeClassName"]("requirementsMet")});(new Helper()).input("user_password");$($("user_name").form).observe("submit",function(E){if($("user_name","user_email","user_password","user_password2").find(function(F){return !F.up(".required").hasClassName("requirementsMet")})){E.stop();alert(Dic.word("error_fill_in_required_fields"))}})})}window.mapReady.push(function(){if(window==window.top){parentDomain=window.location.domain}var G=$("onlineCount");if(!G){return }map.removeMapType(G_SATELLITE_MAP);var A=new MarkerManager(map);setInterval(function(){GEvent.trigger(map,"zoomend")},15000);GEvent.addListener(map,"zoomend",function(H,I){if(I>18){map.setZoom(18)}});if(window!=window.parent&&parentDomain){GEvent.addListener(map,"zoomend",C);GEvent.addListener(map,"dragend",C);C()}var F=$("quest_text");document.observe("quest:changed",function(H){if(!F){return }F.update(H.memo.riddleText.escapeHTML());if(!H.memo.riddleText){F.up(".quest_banner").hide()}});document.observe("chat:peopleNumbersUpdated",function(H){G.update(H.memo.online).up().show()});document.observe("chat:peopleMarkersUpdated",function(K){var J=K.memo.people;if(!Object.isArray(J)){return }var I=$A(J).collect(function(M){return'<div class="chat_person_marker"><a target="_blank" href="'+M.page_url+'"><img src="'+M.photo_url+'" alt="" /></a></div>'});var L=$A();J.each(function(N){var M=new GLatLng(parseFloat(N.lat),parseFloat(N.lng));var O=new PersonChatMarker(M,N);L.push(O)});var H=Builder.node("div").hide();H.innerHTML=I.join("");document.body.appendChild(H);(function(){L.each(function(M,N){M.getDom(H.childNodes[N])});A.addMarkers(L);A.refresh()}).defer()});function C(){var I=map.getCurrentMapType()==G_NORMAL_MAP?"normal":"satellite";var J=["http://mirtesen.ru/chat?export=on#goto",map.getCenter().lat(),map.getCenter().lng(),map.getZoom(),I].join("&");var H=Builder.node("iframe",{style:"width:0; height:0;",src:"http://"+parentDomain+"/cdm.html#"+encodeURIComponent(J)});document.body.appendChild(H)}var B="",E=$("chat_shoutbox");function D(){new Ajax.Request("/chat/shoutbox/json",{method:"get",parameters:{background:true,time:new Date(),global:true,latest:B},onSuccess:function(I){var H=Ajax.parseResult(I);B=H.latest;if(!H.html){return }E.update(H.html.replace(/target="\w+"/g,""))},on403:Prototype.emptyFunction})}D();setInterval(D,14000)});window.domReady.push(function(){window.Chat=(function(){var Y=$("chat");if(!Y){return }var A=Y.down(),R=A.next(),H=R.next(),e=H.next(),W=e.next(),F=W.next(),M=F.next().next(),T=M.next(),U=T.next(),B=$("chat_form"),O=B.up(),L=$("smileys"),Z=$(B["message[text]"]),X=$(B["message[initial_message_id]"]),b,c,N="",E,J;L.observe("click",function(f){var g=f.element();if(g.match("div")){return }if(g.match("img")){g=g.parentNode}Z.value+=" "+g.title+" ";Z.focus()});Z.observe("keypress",function(f){if(Event.isCtrlEnter(f)&&!Z.value.empty()){B.submit.click()}});A.observe("click",function(){V()});window.mapReady.push(function(){GEvent.addListener(map,"movestart",function(){V()})});Event.observe(window,"resize",K);popout(R);function V(f){Q();Y.hide();window.map&&Anchor.remove("show").save();f||J&&J.setSize("s");map.enableScrollWheelZoom()}function I(i,g,f){Q();J=g;window.map&&Anchor.update("show",J.id).save();window.MyChats.noNew&&window.MyChats.noNew(J.id);W.update(String.replaceSmiles(i.leader_text.escapeHTML()));e.update();F.update();H.href=i.leader_page_url;H.down().src=i.leader_photo_url;var h=ChatMarker.getCounter(i);M.update(h[1]);R.href=i.popout_url;R.className=R.className.replace(/popout_name_chat_\w+/,"")+" popout_name_chat_"+J.id;U.update();Z.value="";X.value=i.id;B["message[lat]"].value=i.center.lat();B["message[lng]"].value=i.center.lng();B["message[zoom]"].value=map.getZoom();G(f);Y.show();Z.focus();K();window.map&&d(i.center,J)}function G(f){if(f){C(f,true)}else{P(true)}E=setInterval(P,3000)}function d(g,h){var i=Y.cumulativeOffset();i.top+=Y.getHeight()+h.div.getHeight()+20;i.left+=43;var f=map.fromContainerPixelToLatLng(new GPoint(i.left,i.top));map.setCenter(new GLatLng(map.getCenter().lat()-(f.lat()-g.lat()),map.getCenter().lng()-(f.lng()-g.lng())))}function Q(){clearInterval(E);E=undefined;b=a(b,true);c=a(c);N=""}function a(f,g){if(!f){return }g&&f.transport.abort();return undefined}B.observe("submit",function(f){f.stop();D(Z,J);Z.focus()});Y.observe("click",function(f){if(f.element().match("a.register")){manageAuth(0,1)}});function D(h,f,g){if(c||h.value.empty()){return }b=a(b);B.historyBefore.value=N;if(window.map){X.value=f.props&&f.props.initial_message_id||"";B["message[lat]"].value=f.center.lat();B["message[lng]"].value=f.center.lng();if(B["message[text]"].value!=h.value){B["message[text]"].value=h.value}if(!B["message[zoom]"].value){B["message[zoom]"].value=map.getZoom()}}c=B.request({onSuccess:function(m){try{var i=Ajax.parseResult(m)}catch(l){if(!(l instanceof MirTesenException)){throw l}if(l.data&&l.data.parsed&&l.data.parsed.result&&l.data.parsed.result.chat_anonymous_messages_left<=0){manageAuth(0,1);return }throw l}if(i.banned){manageAuth(0,1);alert(Dic.word("chat_address_banned"));return }X.value=X.value||i.initial_message_id;if(f&&f.props){f.props.updated=i.updated}S(i);var j,k=$("logged_url");if(g){j=g({id:i.initial_message_id,initial_message_id:i.initial_message_id,leader_text:h.value,leader_page_url:k.href,leader_photo_url:k.down().src,online_count:i.online_count||1,updated:i.updated,popout_url:i.popout_url},i)}else{C(i)}window.MyChats.newChat&&window.MyChats.newChat(f.id||i.initial_message_id,j||f);if(f){f.update2&&f.update2({online_count:i.online_count||1,updated:i.updated});if(f.props){f.props.updated=i.updated}}h.value="";Cookie.set(i.initial_message_id,i.updated,10)},onComplete:function(){B.enable();h.focus();c=undefined},onException:function(){B.enable();h.focus()}});B.disable()}function P(f){if(b||c||!X.value){return }var g={initial_message_id:X.value,background:true};if(N){g.historyBefore=N}b=new Ajax.Request(B.action,{method:"get",parameters:g,onSuccess:function(i){var h=Ajax.parseResult(i);C(h,f);S(h);if(Cookie.get(X.value)){Cookie.set(X.value,h.updated,10)}Cookie.erase("chat_unread_messages")},onComplete:function(){b=undefined}})}function S(f){if(!("riddleText" in f)){return }if(f.riddleText){document.fire("quest:changed",f)}if(!f.riddleText){$("quest_text")&&$("quest_text").up(".quest_banner").hide()}}function C(f,g){if(!f){return }if(f.html){g=g||(U.getHeight()+U.scrollTop+10>U.scrollHeight);U.insert({bottom:f.html});if(g){(function(){U.scrollTop=10000000}).defer()}}if(f.participants){M.update(ChatMarker.getCounter({online_count:f.participants.length})[1]);var h=HtmlBuilder.node,i=T.scrollTop;T.update($A(f.participants).collect(function(j){return h("p",[h("a.photo",{href:j.page_url},h("img",{src:j.photo_url})),h("a.name online",{href:j.page_url,title:j.name},j.name),h("br"),h("span",(j.distance)?(j.distance+" "+Dic.word("mapchat_user_direction_"+j.direction)):"")])}).join(""));T.scrollTop=i;(function(){T.scrollTop=i}).defer()}if(f.supertitle){e.update().insert(f.supertitle+": ")}if(f.place){F.update().insert(f.place[0]);F.insert(" "+Dic.word("mapchat_user_direction_"+f.place[1]))}N=f.historyBefore||N}function K(){if(Prototype.Browser.IE){U.setStyle({height:Y.offsetHeight-O.offsetHeight-80+"px",width:Y.offsetWidth-190+"px"});T.setStyle({height:Y.offsetHeight-O.offsetHeight-95+"px"})}else{$(U,T).invoke("setStyle",{bottom:O.offsetHeight+14+"px"})}}return{showChat:I,hideChat:V,postMessage:D,start:G,setChatDimensions:K}})();window.MyChats=(function(){var B=$("my_chats"),L="chats1",D=Cookie.get(L),O=$A(D?D.split(/,/):[]).uniq(),E={},A={},F=Builder.node("span.no_items",Dic.word("my_chats_no_items"));if(!B){return{}}function J(){Cookie.set(L,O.uniq().join(","),100)}function I(Q,P){E[Q]=P;if(O.indexOf(Q)>-1){return }N(Q,P)}function N(Q,P){E[Q]=P;O.push(Q);A[Q]=Builder.node("div.item",Builder.node("p",[Builder.node("a.close","x"),Builder.node("a.link"),Builder.node("span.messages_notice",Dic.word("mapchat_new_messages"))]));A[Q].down().down().next().innerHTML=String.replaceSmiles(P.props.leader_text.escapeHTML());B.show().down().next().appendChild(A[Q]);J();M()}function G(P){O=O.without(P);A[P]&&A[P].remove();delete E[P];delete A[P];J();Cookie.erase(P);Cookie.erase("chat_unread_messages");M()}function K(Q){A[Q].removeClassName("new_messages");var P=E[Q];Chat.showChat(Object.extend({center:P.center},P.props),P)}function H(Q,P){if(!E[Q.id]||E[Q.id].props.updated>=Q.updated){return }if(!P){E[Q.id].update(Q)}if(Anchor.data.show!=Q.id){A[Q.id].addClassName("new_messages")}}function M(P){if(O.length==0){B.down().next().appendChild(F);return }else{if(F.parentNode){F.remove()}}new Ajax.Request("/chat/json",{method:"get",parameters:{json:$H({id:O,background:true}).toJSON()},onSuccess:function(R){var Q=Ajax.parseResult(R);if(P===true){loadMarkers(R);(function(){$A(Q.markers).each(function(T){N(T.id,manager.allMarkers["_"+T.id]);var S=Cookie.get(T.id);if(S){E[T.id].props.updated=S}});B.show()}).delay(0.02);return }$A(Q.markers).each(H)}})}function C(P){if(!A[P]){return }A[P].removeClassName("new_messages")}B.observe("click",function(Q){var R=Q.element(),P=R.up("div.item"),S=O.find(function(T){return A[T]==P});if(R.match("a.close")){G(S);return }if(R.match("a.collapse")){R.up().toggleClassName("collapsed");return }K(S)});document.observe("marker:updated",function(P){H(P.memo,true)});M(true);setInterval(M,10000);return{newChat:I,noNew:C}})()});if(window.GOverlay){function StartChatMarker(A,B){this.center=A;this.div=B}StartChatMarker.prototype=MTMarkerProto("StartChatMarker");StartChatMarker.prototype.initialize=function(A){this.map=A;this.map.getPane(G_MAP_MARKER_PANE).appendChild(this.div.show())};StartChatMarker.prototype.redraw=function(B){if(!B){return }var A=this.map.fromLatLngToDivPixel(this.center);this.div.down().setStyle({marginLeft:0,left:0});this.div.style.left=A.x-42+"px";this.div.style.top=A.y-20+"px"}}function targetPseudoselectorShim(){if(!Prototype.Browser.IE){return }var A;document.observe("click",function(C){var B=C.element().readAttribute("href");if(!B||!B.startsWith("#")){return }A&&A.removeClassName("pseudo-selector-target");A=$(B.substring(1));if(!A){return }A.addClassName("pseudo-selector-target")})}if(window.isGuest){window.domReady.push(function(){var A=$("login_field");if(!A){return }A.focus();var B=$("remember");if(!B){return }B.observe("click",C);function C(){(function(){var F="";var E=new Date();var D=E.getFullYear();var G=E.getMonth();F+="mirtesen_dontremember="+(B.checked?"0":"1")+";";F+="expires="+(new Date(D+1,G)).toUTCString()+";";document.cookie=F}).defer()}})}window.domReady.push(function userClicksMonitor(){var A;if(A=window.location.hash.match(/^#?showCoords:(\d+):(\d+)/)){document.body.appendChild(Builder.node("div").setStyle({position:"absolute",top:"0px",left:parseInt(A[1])-3+"px",width:"6px",height:"10000px",background:"green",opacity:".2"}));document.body.appendChild(Builder.node("div").setStyle({position:"absolute",left:"0px",top:parseInt(A[2])-3+"px",width:"1280px",height:"6px",background:"green",opacity:".2"}))}if(!Cookie.get("click")){return }document.observe("click",function(B){var D,E,C=[B.pointerX(),B.pointerY()];if(E=B.findElement("a")){D=$H({page:window.location.href,type:"link",target:E.href,name:E.innerHTML,"coords[]":C}).toQueryString()}if(E=B.findElement("input[type=submit]")){D=$H({page:window.location.href,type:"button",target:E.form.action||window.location.href,name:E.value,"coords[]":C}).toQueryString()}if(D){(new Image()).src="/click?"+D}})});window.domReady.push(function ctrlNavigation(){document.observe("keyup",function A(D){if(!D.ctrlKey||(D.keyCode!=Event.KEY_LEFT&&D.keyCode!=Event.KEY_RIGHT)){return }if(D.element().nodeName.match(/input|textarea/i)){return }var B='link[rel="'+(D.keyCode==Event.KEY_LEFT?"prev":"next")+'"]';var C=$(document.lastChild.firstChild).childElements().find(function(E){return E.match(B)});if(C){window.location=C.href}})});function supportCollapsibleContent(){window.supportCollapsibleContent=Prototype.emptyFunction;document.observe("click",function A(F){var G=F.element();if(!G.ancestors){return }var D=[G].concat(G.ancestors());var B=D.find(function(H){return H.hasClassName("collapse")});var E=D.find(function(H){return H.hasClassName("expand")});if(!B&&!E){return }var C=D.find(function(H){return H.hasClassName("collapsible")});if(!C){return }F.stop();if(B){C.removeClassName("expanded").addClassName("collapsed")}if(E){C.removeClassName("collapsed").addClassName("expanded")}})}function KindaLightBoxer(){window.KindaLightBoxer=Prototype.emptyFunction;document.observe("click",function A(B){if(!B.isLeftClick()){return }var C=B.element();if(/img/i.test(C.nodeName)){C=C.parentNode}if(!/kindaLightbox/i.test(C.className)){return }B.stop();if(C.href){kindaLightbox(C.href)}})}window.domReady.push(function focusOnload(){var A=$(window.focus_onload_id||"focus_onload");if(A){A.activate()}});if(!window.isGuest){window.domReady.push(function geostatusChanger(){var E=$("status_selector");if(!E){return }var C=E.previous();var D=C.down().down();Prototype.Browser.IE&&C.hover("status_hover");var A=false;C.observe("click",function B(){if(!A){A=true;E.cleanWhitespace().hideOnOuterClick(C,function(){E.hide();C.removeClassName("status_act")});new Ajax.Request("/profile/places/json?type=places",{method:"get",onSuccess:function(H){var G=Ajax.parseResult(H);$A(G.places).each(function(I){if(I.id!=G.main){E.insertBefore(Builder.node("li.place#place_"+I.id,Builder.node("span",I.name)).hover(),E.lastChild)}});if(Prototype.Browser.IE){E.style.width=Math.max(142,E.getWidth())+"px"}}});E.observe("click",function(G){if(!G.isLeftClick()){return }var H=G.findElement("li.place");if(!H){return }E.hide();C.removeClassName("status_act");if(H.hasClassName("act")){return }D.addClassName("loading").update(Dic.word("updating_geostatus"));new Ajax.Request("/profile/places/"+H.id.replace(/place_/,"")+"/edit/json/",{method:"post",parameters:{main_place:1,csrf:E.className},onSuccess:function(J){var I=Ajax.parseResult(J);E.childElements().invoke("removeClassName","act");H.addClassName("act");D.removeClassName("loading").update(H.down().firstChild.nodeValue)},onFailure:function(I){D.removeClassName("loading").addClassName("error").update(Dic.word("error_setting_geostatus"))}})});if(Prototype.Browser.IE){E.style.left="-10000px";E.show();E.hide();E.style.left=""}}E.toggle();C.toggleClassName("status_act");if(Prototype.Browser.Gecko&&E.previous()==C){var F=E.cumulativeOffset();document.body.appendChild(E);E.setStyle({left:F[0]+"px",top:F[1]+"px"})}})})}window.domReady.push(function preventDoubleSubmits(){document.observe("click",function A(B){if(B?!B.isLeftClick():true){return }var C=B.element();if(!C||!/input/i.test(C.nodeName)||!/submit/i.test(C.type)){return }if(!$(C.form)){return }if(!C.form.hasClassName("needDouble")&&(C.hasClassName("ignoreDouble"))){return }window.DoublePost.prevent(C)});Event.observe(window,"unload",function(B){window.DoublePost.hide();A()})});window.domReady.push(function createNotifier(){var A;window.notify=function(B){if(!A){A=Builder.node("span#notifier").hide();document.body.appendChild(A)}A.update(B).show();setTimeout(function(){A.hide()},10000)}});function highlightInReplyComment(){document.observe("click",function A(E){if(!E.isLeftClick()){return }var F=E.element();if(!/inReplyTo/i.test(F.name)){return }var C=F.href.match(/#(.*)/)[1];var D=null;var G=document.getElementsByName(C);for(var B=0;B<G.length;B++){if(!G[B].hasClassName("comment_in_widget_mode")&&G[B].up()&&G[B].up().down("span.commentContents")){D=G[B].up().down("span.commentContents").innerHTML;break}}if(!D){D=additionalCommentsText&&additionalCommentsText[C]}if(!D){return }E.stop();if(!F.hasClassName("clicked")){F.addClassName("clicked");F.next(1).show().update(D)}})}function resizeTextarea(){window.resizeTextarea=Prototype.emptyFunction;function A(C){var B=C.element();if(!/textarea/i.test(B.nodeName)){return }if(B.fitText){B.fitText()}}document.observe(["keyup","click"],A)}function supportVoting(A){window.supportVoting=Prototype.emptyFunction;document.observe("click",function B(G){if(!G.isLeftClick()){return }var H=G.element();if(H.disabled||!/rate\[(plus|minus)\]/i.test(H.name)){return }G.stop();var F=$(H.form);var E=$(F["rate[plus]"]);var C=$(F["rate[minus]"]);var D=(H==E);H.addClassName("butt_"+(D?"plus":"minus")+"_selected").blur();if(E){E.disable("butt_plus_disabled")}if(C){C.disable("butt_minus_disabled")}var I={};I[D?"rate[plus]":"rate[minus]"]=1;F.request({add2url:"json",method:"post",parameters:I,onSuccess:function(N){var K=Ajax.parseResult(N);var M=F.down("span");if(!M){return }if(K.mark==0){M.className="mark"}else{if(K.mark>0){M.className="mark_plus";K.mark="+"+K.mark}else{M.className="mark_minus"}}M.replaceChild(document.createTextNode(K.mark),M.firstChild);var L=M.up("div.has_counter");if(L){L=L.next();L.innerHTML=L.innerHTML.replace(/\d+/,K.count)}if(H.hasClassName("replaceable")){var J=Builder.node("span.submitted",(A||""));H.replace(J)}}})})}function supportFavoring(){window.supportFavoring=Prototype.emptyFunction;document.observe("click",function A(D){if(!D.isLeftClick()){return }var E=D.element();if(E.disabled||!/favorite_button/i.test(E.name)){return }D.stop();var C=$(E.form);var B=(C.favorite.value=="t")?true:false;E.addClassName("busy").blur();C.request({add2url:"json",method:"post",isFav:B,onSuccess:function(F){starInput=C.down("input[name=favorite_button]");starInput.removeClassName("busy").toggleClassName("active");starInput.title=(B?Dic.word("unmark_as_favorite"):Dic.word("mark_as_favorite"))}})})}if(window.isGuest){window.domReady.push(function(){var A=$("password_recovery_link");if(!A){return }var B=A.href;$("login_field").observe("change",function(){A.href=B+"?email="+encodeURIComponent($F("login_field"))})})}function getCookie(B){var D=" "+document.cookie;var C=" "+B+"=";var E=null;var F=0;var A=0;if(D.length>0){F=D.indexOf(C);if(F!=-1){F+=C.length;A=D.indexOf(";",F);if(A==-1){A=D.length}E=unescape(D.substring(F,A))}else{return""}}return(E)}function updateUnreadMessagesCounter(){var I=$("unmarkedCount");if(!I){return }var A=I.down("span");var C=60000;var J=0;var D=I.next();var B=D&&D.hasClassName("helper")&&D.down().down();var H;function F(){new Ajax.Request("/messages/json/",{method:"get",parameters:{background:true},onSuccess:function(O){var K=Ajax.parseResult(O);if(A){A.update(K.unmarkedCount?K.unmarkedCount:"")}else{I.update(K.unmarkedCount?"("+K.unmarkedCount+")":"")}if(K.unmarkedCount!="0"){I.show();var M=getCookie("mirtesen_messages_unread_id");if($("navigation")&&M==K.message.id){$("msg_popup").style.display="none"}if($("navigation")&&M!=K.message.id){var N=$("msg_popup");$("msg_popup").style.display="block";$("msg_popup").down("a",1).href=K.message.page_url;$("msg_popup").down("a",1).className=$("msg_popup").down("a",1).className.substr(0,28)+K.message.author.id;$("msg_popup").down("span.top").update(K.message.author.name.truncate(21));$("msg_popup").down("span.bot").update(String.replaceSmiles(K.message.text));$("messages").addClassName("there_is_new");$("messages").addClassName("new_msg");function L(){if($("messages").hasClassName("new_msg")){Effect.Pulsate("messages");Effect.Pulsate("letter")}setTimeout(function(){L()},4000)}setTimeout(function(){L()},2222)}else{titleTicker.stop()}}else{if($("navigation")){$("msg_popup").style.display="none";balloonIsClose=true;$("messages").removeClassName("new_msg");$("messages").removeClassName("there_is_new");titleTicker.stop()}}if(K.message&&J<K.unmarkedCount&&!Cookie.get(K.message.id)&&(!D||D.style.display=="none")){J=K.unmarkedCount;if(window.type=="chat"){I.show().previous().addClassName("mail_new")}else{B&&(B.id="close"+K.message.id);D&&E(K.message.author,K.message.text,K.message.page_url);if($("navigation")&&M!=K.message.id){H=titleTicker((K.message.author.name+": "+K.message.text).truncate(50))}}}}});C*=1.5;setTimeout(F,C)}setTimeout(F,window.messagesUnreadCountFirstInterval?window.messagesUnreadCountFirstInterval:C);if(!D){return }if(B){B.observe("click",function(){D.hide();Cookie.set(this.id.replace("close",""),1);titleTicker.stop()});var G=D.down().down().next();G.observe("click",function(){D.hide();titleTicker.stop()})}function E(L,M,K){G.update().insert(L.name).insert(Builder.node("br")).insert(M.truncate(100));G.href=K;D.show()}}if(!window.isGuest){window.domReady.push(function(){updateUnreadMessagesCounter()})}window.domReady.push(function initScrollToSmoother(){scrollToSmoother()});if(!window.isGuest&&window.DEBUG_MODE){window.domReady.push(function instaEditDictionary(){if(Prototype.Browser.IE){return }document.observe("keypress",function(A){if(!A.shiftKey||String.fromCharCode(A.charCode||A.which)!="!"){return }$$("samp.editable_dictionary").each(function(D){D.observe("click",Event.stop);var B={cancelLink:false,handleLineBreaks:false,onComplete:Prototype.K};if(D.innerHTML.length>50){B.rows=5}else{B.size=D.innerHTML.length;B.okButton=false}var C=new Ajax.InPlaceEditor(D,"/dictionary/edit/"+D.id.replace(/editable_key_/,""),B);C.onEnterEditMode=function(){D.innerHTML=D.innerHTML.replace(/^&gt;/,"").replace(/^\?\?\?/,"").replace(/&lt;$/,"").replace(/\?\?\?$/,"");(function(){this.editField.style.width="auto"}).bind(C).defer(0);var E=D.match("a")?D:D.up("a");if(E){E.href=null;E.removeAttribute("href")}}});$(document.body).insert(Builder.node("script",{src:"/js/lib/effects.js"}))});$$("input[type=button]","input[type=submit]").each(function(A){if(/editable_dictionary/i.match(A.value)){A.value=A.value.stripTags()}});$$("option","button").each(function(A){if(/editable_dictionary/i.match(A.innerHTML)){A.innerHTML=A.innerHTML.stripTags()}})})}var IEPNGFix=window.IEPNGFix||{};IEPNGFix.tileBG=function(F,P,M){var b=this.data[F.uniqueID],B=Math.max(F.clientWidth,F.scrollWidth),G=Math.max(F.clientHeight,F.scrollHeight),I=F.currentStyle.backgroundPositionX,H=F.currentStyle.backgroundPositionY,N=F.currentStyle.backgroundRepeat;if(!b.tiles){b.tiles={elm:F,src:"",cache:[],img:new Image(),old:{}}}var X=b.tiles,S=X.img.width,C=X.img.height;if(P){if(!M&&P!=X.src){X.img.onload=function(){this.onload=null;IEPNGFix.tileBG(F,P,1)};return X.img.src=P}}else{if(X.src){M=1}S=C=0}X.src=P;if(!M&&B==X.old.w&&G==X.old.h&&I==X.old.x&&H==X.old.y&&N==X.old.r){return }var D={top:"0%",left:"0%",center:"50%",bottom:"100%",right:"100%"},K,J,A;K=D[I]||I;J=D[H]||H;if(A=K.match(/(\d+)%/)){K=Math.round((B-S)*(parseInt(A[1])/100))}if(A=J.match(/(\d+)%/)){J=Math.round((G-C)*(parseInt(A[1])/100))}K=parseInt(K);J=parseInt(J);var Z={repeat:1,"repeat-x":1}[N],W={repeat:1,"repeat-y":1}[N];if(Z){K%=S;if(K>0){K-=S}}if(W){J%=C;if(J>0){J-=C}}this.hook.enabled=0;if(!({relative:1,absolute:1}[F.currentStyle.position])){F.style.position="relative"}var E=0,L,V=Z?B:K+0.1,Q,T=W?G:J+0.1,U,O,Y;if(S&&C){for(L=K;L<V;L+=S){for(Q=J;Q<T;Q+=C){Y=0;if(!X.cache[E]){X.cache[E]=document.createElement("div");Y=1}var R=(L+S>B?B-L:S),a=(Q+C>G?G-Q:C);U=X.cache[E];O=U.style;O.behavior="none";O.left=L+"px";O.top=Q+"px";O.width=R+"px";O.height=a+"px";O.clip="rect("+(Q<0?0-Q:0)+"px,"+R+"px,"+a+"px,"+(L<0?0-L:0)+"px)";O.display="block";if(Y){O.position="absolute";O.zIndex=-999;if(F.firstChild){F.insertBefore(U,F.firstChild)}else{F.appendChild(U)}}this.fix(U,P,0);E++}}}while(E<X.cache.length){this.fix(X.cache[E],"",0);X.cache[E++].style.display="none"}this.hook.enabled=1;X.old={w:B,h:G,x:I,y:H,r:N}};IEPNGFix.update=function(){for(var B in IEPNGFix.data){var A=IEPNGFix.data[B].tiles;if(A&&A.elm&&A.src){IEPNGFix.tileBG(A.elm,A.src)}}};IEPNGFix.update.timer=0;if(window.attachEvent&&!window.opera){window.attachEvent("onresize",function(){clearTimeout(IEPNGFix.update.timer);IEPNGFix.update.timer=setTimeout(IEPNGFix.update,100)})};