(function(G,B,E,H){var A=G.google,C=G.console;function F(I){return A&&A.maps&&A.maps[I]||G["G"+I]}if(!F("Map2")){var D=arguments;return G.setTimeout(function(){D.callee.apply(null,D)},100)}(function(L,O,b,e,j,J,Q,M,f){function K(l,n){for(var m in n){l[m]=n[m]}return l}function i(m,l){var n={};for(var o=0;o<arguments.length;o++){K(n,arguments[o])}return n}var X;if("forEach" in E){X=E.forEach}else{X=function(p,q,o){for(var n=0,m=p.length;n<m;n++){q.call(o,p[n],n)}return p}}function V(n,o,m){var l=new E(n.length);X(n,function(p,q){l[q]=o.call(this,p,q)},m);return l}function g(p,q,o){for(var n=0,m=p.length;n<m;n++){if(q.call(o,p[n],n)){return p[n]}}return false}function S(l){return V(l,function(m){return m})}function I(l){var n=[];for(var m in l){n.push(H(m)+"="+H(l[m]))}return n.join("&")}function N(l,n){var m=l.initialize||function(){};delete l.initialize;K(m.prototype,l);return K(m,n||{})}function P(l){if(G.console&&G.console.debug){G.console.debug(l)}}function Z(l){return S(B.getElementsByTagName(l))}var Y=Z("head")[0];var d=K(N({initialize:function(l,m,n){this._b=l;this._c=n;this._d=m},_e:function(){var o=++d._f,n=this._c,l;d._g[o]=n;function m(){setTimeout(function(){Y.removeChild(l);delete d._g[o];l.onerror=l.onload=null},5000)}Y.appendChild(l=K(this._h(o),{onerror:m,onload:m}))},_h:function(l){return K(B.createElement("script"),{src:this._b+"?"+I(K(this._d,{callback:d._i+"["+l+"]"})),type:"text/javascript"})}}),{_f:0,_i:"Mapeed._g",_g:{},send:function(l,m,n){return new d(l,m,n)._e()}});function c(m,l){this.latlng_=m;this.opts_=l;this.labelText_=l.labelText||"";this.labelClass_=l.labelClass;this.labelOffset_=l.labelOffset||new e(0,0);this.clickable_=l.clickable||true;this.title_=l.title||"";this.labelVisibility_=true;if(l.draggable){l.draggable=false}Q.apply(this,arguments)}c.prototype=K(new Q(new b(0,0)),{initialize:function(o){Q.prototype.initialize.apply(this,arguments);this.map_=o;this.div_=B.createElement("div");this.div_.className=this.labelClass_;this.div_.innerHTML=this.labelText_;this.div_.style.position="absolute";this.div_.style.cursor="pointer";this.div_.title=this.title_;o.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);if(this.clickable_){function l(r,q){return function(){L.trigger(r,q)}}var p=["click","dblclick","mousedown","mouseup","mouseover","mouseout"];for(var n=0;n<p.length;n++){var m=p[n];L.addDomListener(this.div_,m,l(this,m))}}},redraw:function(l){Q.prototype.redraw.apply(this,arguments);var m=this.map_.fromLatLngToDivPixel(this.latlng_);var n=GOverlay.getZIndex(this.latlng_.lat());this.div_.style.left=(m.x+this.labelOffset_.width)+"px";this.div_.style.top=(m.y+this.labelOffset_.height)+"px";this.div_.style.zIndex=n},remove:function(){L.clearInstanceListeners(this.div_);if(this.div_.outerHTML){this.div_.outerHTML=""}if(this.div_.parentNode){this.div_.parentNode.removeChild(this.div_)}this.div_=null;Q.prototype.remove.apply(this,arguments)},copy:function(){return new c(this.latlng_,this.opt_opts_)},show:function(){Q.prototype.show.apply(this,arguments);if(this.labelVisibility_){this.showLabel()}else{this.hideLabel()}},hide:function(){Q.prototype.hide.apply(this,arguments);this.hideLabel()},setLabelVisibility:function(l){this.labelVisibility_=l;if(!this.isHidden()){if(this.labelVisibility_){this.showLabel()}else{this.hideLabel()}}},getLabelVisibility:function(){return this.labelVisibility_},hideLabel:function(){this.div_.style.visibility="hidden"},showLabel:function(){this.div_.style.visibility="visible"}});var U=N({initialize:function(o,m,l,n){this._j=o;this._k=m;this._l=l;this._m=n},getId:function(){return this._j},getCategories:function(){return this._l},hasCategory:function(l){return this._l.indexOf(Number(l))>-1},setGMarker:function(l){this._n=l},getCount:function(){return 1},createGMarker:function(l){return this._n=this._o(l)},getGMarker:function(){return this._n||this.createGMarker()},getGLatLng:function(){return this._k},_o:function(l){return new Q(this.getGLatLng(),i(this._p,l))},_q:function(l,m){l.addOverlay(this.getGMarker());if(this._m){this._r=L.bind(this.getGMarker(),"click",this,function(){this._m(this,this._j)})}},_s:function(l){l.removeOverlay(this.getGMarker());if(this._r){L.removeListener(this._r)}},_p:{icon:K(new j(),{image:"http://www.mapeed.com/images/maps/cluster.png",iconSize:new e(22,33),iconAnchor:new J(11,33),infoWindowAnchor:new J(11,2),infoShadowAnchor:new J(18,25)})}},{_t:function(l,m){var n=k(l.ll);return l.n?new a(l.id,n,l.cat,m.onZoomMaxClusterClicked,new M(k(l.sw),k(l.ne)),l.n,l.region):new U(l.id,n,l.cat,m.onMarkerClicked)},setGMarkerDefaultOptions:function(l){this.prototype._p=l||{}},getGMarkerDefaultOptions:function(){return this.prototype._p}});var a=N(i(U.prototype,{initialize:function(r,o,l,q,n,m,p){U.call(this,r,o,l,q);this._u=n;this._v=m;this._w=p},getCount:function(){return this._v},getGLatLngBounds:function(){return this._u},zoomIn:function(l){l.setCenter(this.getGLatLng(),l.getBoundsZoomLevel(this.getGLatLngBounds()))},_p:[{icon:new j({image:"http://www.mapeed.com/images/maps/5.png",iconSize:new e(50,50),iconAnchor:new J(25,25),infoWindowAnchor:new J(25,25),infoShadowAnchor:new J(25,25)}),labelClass:"mapeed_cluster_0",labelOffset:new e(-25,-25)},{icon:new j({image:"http://www.mapeed.com/images/maps/4.png",iconSize:new e(55,55),iconAnchor:new J(28,28),infoWindowAnchor:new J(28,28),infoShadowAnchor:new J(28,28)}),labelClass:"mapeed_cluster_1",labelOffset:new e(-28,-28)},{icon:new j({image:"http://www.mapeed.com/images/maps/3.png",iconSize:new e(62,62),iconAnchor:new J(31,31),infoWindowAnchor:new J(31,31),infoShadowAnchor:new J(31,31)}),labelClass:"mapeed_cluster_2",labelOffset:new e(-31,-31)},{icon:new j({image:"http://www.mapeed.com/images/maps/2.png",iconSize:new e(71,71),iconAnchor:new J(35,35),infoWindowAnchor:new J(35,35),infoShadowAnchor:new J(35,35)}),labelClass:"mapeed_cluster_3",labelOffset:new e(-35,-35)},{icon:new j({image:"http://www.mapeed.com/images/maps/1.png",iconSize:new e(85,85),iconAnchor:new J(42,42),infoWindowAnchor:new J(42,42),infoShadowAnchor:new J(42,42)}),labelClass:"mapeed_cluster_4",labelOffset:new e(-42,-42)}],_o:function(l){var m=parseInt(Math.log(this._v)/Math.log(10));return new c(this.getGLatLng(),i(this._p[m],{labelText:this.getCount()},l))},_q:function(l,m){l.addOverlay(this.getGMarker());this._r=L.bind(this.getGMarker(),"click",this,function(){var q=this.getGLatLngBounds(),n=q.getNorthEast(),o=q.getSouthWest();if(this._m&&(m.isZoomMax()||(n.lat()-o.lat())<0.000001||(n.lat()-o.lat()<0.000001))){var p=this;m.getClusterIds(this,function(r){p._m(p,r)})}else{this.zoomIn(l)}})}}),{setGMarkerDefaultOptions:function(l){this.prototype._p=l||{}},getGMarkerDefaultOptions:function(){return this.prototype._p}});var T=N({_x:new b(0,0),_y:new M(new b(10,10),new b(10,10)),_z:{onMarkerReceived:function(){},onMarkerClicked:null,onClusterReceived:function(){},onZoomMaxClusterClicked:null,onMarkersLoaded:function(){}},initialize:function(m,l){var n=this;K(n,{_aa:m,_ab:[],_u:new M(n._x,n._x),_ac:m.getZoom(),_ad:i(n._z,l)});L.bind(m,"moveend",n,n._ae);if(h){m.addControl(n._af())}if(R){n._ag()}n._ah()},filterAnyCategory:function(l){},isZoomMax:function(){return this._aa.getBoundsZoomLevel(this._y)==this._aa.getZoom()},getClusterIds:function(l,m){d.send(W+"cluster_ids",{cluster_id:l.getId()},m)},getMarkers:function(){return this._ab},getMarkerCount:function(){var l=0,m=this._aa.getBounds();X(this._ab,function(n){if(m.contains(n.getGLatLng())){l+=n.getCount()}});return l},getMarkerForId:function(o,n){var m=this;var l=g(this._ab,function(p){return p._j==o});if(l){n(l);return }d.send(W+"marker_id",{legacy_id:o},function(r){var p=r.point;var q=g(m._ab,function(s){var t=s._w.split("|");return g(t,function(u){if(u[0]=="-"){if(u.substr(1)==p.id){return true}}else{if(p.path.indexOf(u)==0){return true}}})});n(q)})},_ah:function(){var n=this._aa,p=n.getBounds(),o=n.getZoom(),m=new f(o+1),l=m.fromLatLngToPixel(p.getSouthWest(),o),q=m.fromLatLngToPixel(p.getNorthEast(),o);l=m.fromPixelToLatLng(new J(l.x-256,l.y+256),o,true);q=m.fromPixelToLatLng(new J(q.x+256,q.y-256),o,true);if((q.lng()>l.lng()&&p.getNorthEast().lng()<=p.getSouthWest().lng())){p=new M(new b(-90,-180),new b(90,180))}else{p=new M(l,q)}this._ai(p)},_ae:function(){var l=this._aa.getZoom();if(this._ac!=l||!this._u.containsBounds(this._aa.getBounds())){this._ah();this._ac=l}},_ai:function(l){var m=this;d.send(W+"markers",{sw:l.getSouthWest().toUrlValue(),ne:l.getNorthEast().toUrlValue(),zoom:m._aa.getZoom()},function(n){m._aj(n,l)})},_aj:function(p,n){var o=this,m=o._ad,l=o._aa;o._u=n;o._ak();o._ab=V(p,function(q){q=U._t(q,m);if(q instanceof a){m.onClusterReceived(q)}else{m.onMarkerReceived(q)}q._q(l,o);return q});m.onMarkersLoaded()},_ak:function(){var l=this._aa;X(this._ab,function(m){m._s(l)});this._ab=[]},_af:function(){return K(new GControl,{initialize:function(n){var m=B.createElement("a"),l=m.style;l.width="30px";l.height="100px";l.background="url(http://www.mapeed.com/images/mapeed_sticker_on_map.png)";l.cursor="pointer";m.href="http://www.mapeed.com";m.target="_blank";n.getContainer().appendChild(m);return m},getDefaultPosition:function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new e(0,40))}})},_ag:function(){var o=this._aa,n=o.getSize(),m=B.createElement("div"),l=m.style;l.position="absolute";l.width=n.width+"px";l.height=n.height+"px";l.background="url(http://www.mapeed.com/images/watermark.png)";L.bind(o,"moveend",this,function(){l.left=-parseInt(m.parentNode.parentNode.style.left)+"px";l.top=-parseInt(m.parentNode.parentNode.style.top)+"px"});o.getPane(G_MAP_MAP_PANE).appendChild(m)}});var W;X(Z("script"),function(l){if(l.src.match(/\/api\/beta\/.*\/embed/)){W=l.src.replace(/embed.*/,"")}});function k(l){var m=l.split(/\s*,\s*/);return new b(m[0],m[1])}var h=false;var R=false;G.Mapeed={Map:T,Marker:U,ClusterMarker:a,_g:d._g}})(F("Event"),F("Bounds"),F("LatLng"),F("Size"),F("Icon"),F("Point"),F("Marker"),F("LatLngBounds"),F("MercatorProjection"))})(window,document,Array,encodeURIComponent);