if(typeof(Meetup)=="undefined"){Meetup={}}Meetup.GMap=function(a,b,d,e,f,c){this.window=a;this.div=b;this.centLat=d;this.centLon=e;this.width=f;this.height=c;this.editable=false;this.zoom=11;this.bounds=[];this.frame=null;this.gmap=null;this.data=[];this.points=[];this.pendData=[];this.displayed=false;this.isOverlay=false};Meetup.GMap.prototype.getData=function(){return this.data};Meetup.GMap.prototype.getPoints=function(){return this.points};Meetup.GMap.prototype.getCentLat=function(){return this.centLat};Meetup.GMap.prototype.getCentLon=function(){return this.centLon};Meetup.GMap.prototype.getEditable=function(){return this.editable};Meetup.GMap.prototype.getGMap=function(){return this.gmap};Meetup.GMap.prototype.isDisplayed=function(){return this.displayed};Meetup.GMap.prototype.getZoom=function(){return this.zoom};Meetup.GMap.prototype.setData=function(b,a){this.data[a]=b};Meetup.GMap.prototype.setZoom=function(a){this.zoom=a};Meetup.GMap.prototype.setEditable=function(a){this.editable=a};Meetup.GMap.prototype.setIsTopicMap=function(){this.isTopicMap=true};Meetup.GMap.prototype.insertMap=function(){var b=this.zoom;var a='<iframe name="mapFrame" frameborder="0" scrolling="no" id="mapFrame" style="width: 100%; '+(this.width>0?"width: expression('"+this.width+"px');":"")+"height: "+this.height+'px" src="http://www.meetup.com/gmaps/gmap_frame.jsp?lat='+this.centLat+"&lon="+this.centLon+"&zoom="+(b?b:"11")+"&smallMap=1"+(this.width>0?"&width="+this.width:"")+"&height="+this.height+""+(this.editable?"&edit=1":"")+'"></iframe>';this.div.innerHTML=a};Meetup.GMap.prototype.setGMap=function(b){this.gmap=b;if(this.isOverlay){b.addOverlay(this)}if(this.pendData&&this.pendData.length>0){for(var a in pendData){this.plotPoints(this.pendData[a],a)}this.pendData=null}};Meetup.GMap.prototype.setIsOverlay=function(){this.isOverlay=true};Meetup.GMap.prototype.plotPoints=function(d,a,b){this.points[a]=d;if(d.length<=0){return}if(!this.data[a]){this.data[a]=d}else{for(var c=0;c<d.length;c++){this.data[a].push(d[c])}}if(this.gmap&&b){if(!this.frame){this.frame=this.window.frames.mapFrame}this.frame.plotWrapper(this)}};Meetup.GMap.prototype.safeClearMap=function(){try{for(var c=0;c<this.points.length;c++){if(this.points[c]){this._map.removeOverlay(this.points[c])}}}catch(a){}try{if(this.isOverlay){var b=this.getGMap().getPane(4);b.innerHTML=""}}catch(a){}this.data=[];this.points=[];this.pendData=[]};Meetup.GMap.prototype.clearMap=function(){this.data=[];this.points=[];this.pendData=[];try{this.gmap.clearOverlays()}catch(a){}try{if(this.isOverlay){var b=this.getGMap().getPane(4);b.innerHTML=""}}catch(a){}};Meetup.GMap.markerImg={black:"http://img1.meetupstatic.com/img/2488446748541153454/pin/mm_20_black.png",blue:"http://img1.meetupstatic.com/img/64790047439921006386/pin/mm_20_blue.png",green:"http://img1.meetupstatic.com/img/18662801922109144641/pin/mm_20_green.png",orange:"http://img1.meetupstatic.com/img/226313160543752026850315/pin/mm_20_orange.png",purple:"http://img1.meetupstatic.com/img/4247736108188103220/pin/mm_20_purple.png",red:"http://img1.meetupstatic.com/img/4539485612517706134105/pin/mm_20_red.png",white:"http://img1.meetupstatic.com/img/10681591495432/pin/mm_20_white.png",yellow:"http://img1.meetupstatic.com/img/3576654891864924693/pin/mm_20_yellow.png"};Meetup.GMap.drawMap=function(b){this.displayed=true;var d=b.getGMap();d.checkResize();var f=b.getData();var n=b.getPoints();var k=b.getZoom();var j=b.isTopicMap;var i=[];function o(q){var s=[];var u=0;for(var v in q){var r=q[v];for(var e=0;e<r.length;e++){var t=r[e];t.color=v;var p=t.latitude+":"+t.longitude;if(!s[p]){s[p]=[];s[p]["index"]=u++;s[p]["data"]=new Array();u++}s[p]["data"].push(t)}}s.index=u;return s}i=o(n);if(i.index>0){delete i.index;if(b.isOverlay){var m=b.getGMap().getPane(4)}else{var g=new GIcon();g.shadow="http://img1.meetupstatic.com/img/772253502061727480041584/pin/mm_20_shadow.png";g.iconSize=new GSize(13,18);g.shadowSize=new GSize(22,20);g.iconAnchor=new GPoint(6,20);g.infoWindowAnchor=new GPoint(5,1);g.infoShadowAnchor=new GPoint(11,15)}for(var l in i){var c=i[l];if(b.isOverlay){this.addOverlayNode(c,b,c.data[0].color)}else{g.image=Meetup.GMap.markerImg[c.data[0].color];d.addOverlay(Meetup.GMap.makeMarker(c,g,b))}}}i=o(f);if(i.index>0){delete i.index;var h=Meetup.GMap.getBounds(i);if(j){k=(d.getBoundsZoomLevel(h)>4?4:d.getBoundsZoomLevel(h))}else{k=d.getZoom()}d.setCenter(h.getCenter(),k,G_NORMAL_MAP)}else{try{d.setCenter(new GLatLng(b.getCentLat(),b.getCentLon()),k,G_NORMAL_MAP)}catch(a){}}};Meetup.GMap.addOverlayNode=function(d,e,c){var g=e.getGMap().getPane(4);var b=d.data[0];var a=new GLatLng(b.latitude,b.longitude);var f=gmap.fromLatLngToDivPixel(a);b.point=a;b.node=document.createElement("div");b.node.style.left=f.x+"px";b.node.style.top=f.y+"px";b.node.className="marker-"+c;b.node.onclick=function(){gmap.openInfoWindowHtml(a,Meetup.GMap.getMarkup(d))};g.appendChild(b.node)};Meetup.GMap.prototype.copy=function(){};Meetup.GMap.prototype.initialize=function(a){};Meetup.GMap.prototype.redraw=function(a){if(a){for(var c in this.data){var f=this.data[c];for(var e in f){var d=f[e];if(d.node&&d.point){var b=this.gmap.fromLatLngToDivPixel(d.point);d.node.style.left=b.x+"px";d.node.style.top=b.y+"px"}}}}};Meetup.GMap.getBounds=function(d){try{var f=new GLatLngBounds();for(var c in d){var b=c.split(":");f.extend(new GLatLng(parseFloat(b[0]),parseFloat(b[1])))}return f}catch(a){return[]}};Meetup.GMap.makeMarker=function(c,f,g){var e="meetup.com";var d=new GIcon(f);var a=new GLatLng(c.data[0].latitude,c.data[0].longitude);var b;if(g.getEditable()){b=new GMarker(a,{icon:d,draggable:true});GEvent.addListener(b,"dragend",function(){Meetup.GMap.reportNewCoords(b.getPoint())})}else{b=new GMarker(a,d)}if(typeof(c.data[0]["count"])!=="undefined"){GEvent.addListener(b,"click",function(){b.openInfoWindowHtml(Meetup.GMap.getMarkup(c))})}return b};Meetup.GMap.getMarkup=function(e){var b;for(var d=0;d<e.data.length;d++){var a=e.data[d];var c=Meetup.Copy.memberLbl.replace("__MEMBER_CNT__",a.note);if(a.url){mu='<nobr><a target="_top" href="'+a.url+'">'+a.count+"</a></nobr><br />"+(a.photo?('<img style="float: left" src="'+a.photo+'"/>'):"")+"<nobr>"+c+"</nobr><br />"}else{mu="<strong>"+Meetup.Copy.waitingLbl.replace("__MEMBER_CNT__",a.count).replace("__CITY__",a.city)+"</strong><br />"+(a.photo?('<img style="float: left" src="'+a.photo+'"/>'):"")+"<br />"}}return mu};Meetup.GMap.reportNewCoords=function(a){top.setCoords(a.lat(),a.lng())};Meetup.GMap.icon={red:null,blue:null,yellow:null,green:null,orange:null,purple:null,white:null,black:null};