(function(){function k(a){return function(b){this[a]=b}}function l(a){return function(){return this[a]}}function c(a,b,d){this.extend(c,google.maps.OverlayView);this.b=a;this.a=[];this.f=[];this.ca=[53,56,66,78,90];this.j=[];this.A=!1;d=d||{};this.g=d.gridSize||60;this.l=d.minimumClusterSize||2;this.J=d.maxZoom||m;this.j=d.styles||[];this.X=d.imagePath||this.Q;this.W=d.imageExtension||this.P;this.O=!0;if(d.zoomOnClick!=void 0)this.O=d.zoomOnClick;this.r=!1;if(d.averageCenter!=void 0)this.r=d.averageCenter;
p(this);this.setMap(a);this.K=this.b.getZoom();var e=this;google.maps.event.addListener(this.b,"zoom_changed",function(){var a=e.b.mapTypes[e.b.getMapTypeId()].maxZoom,b=e.b.getZoom();if(!(b<0||b>a)&&e.K!=b)e.K=e.b.getZoom(),e.m()});google.maps.event.addListener(this.b,"idle",function(){e.i()});b&&b.length&&this.C(b,!1)}function p(a){if(!a.j.length)for(var b=0,d;d=a.ca[b];b++)a.j.push({url:a.X+(b+1)+"."+a.W,height:d,width:d})}function o(a,b){b.s=!1;b.draggable&&google.maps.event.addListener(b,"dragend",
function(){b.s=!1;a.L()});a.a.push(b)}function q(a,b){var d=-1;if(a.a.indexOf)d=a.a.indexOf(b);else for(var e=0,c;c=a.a[e];e++)if(c==b){d=e;break}if(d==-1)return!1;a.a.splice(d,1);return!0}function r(a){if(a.A)for(var b=a.v(new google.maps.LatLngBounds(a.b.getBounds().getSouthWest(),a.b.getBounds().getNorthEast())),d=0,e;e=a.a[d];d++)if(!e.s&&b.contains(e.getPosition())){for(var c=a,f=4E4,j=m,i=0,h=void 0;h=c.f[i];i++){var g=h.getCenter();if(g){var k=e.getPosition();if(!g||!k)g=0;else var l=(k.lat()-
g.lat())*Math.PI/180,o=(k.lng()-g.lng())*Math.PI/180,g=Math.sin(l/2)*Math.sin(l/2)+Math.cos(g.lat()*Math.PI/180)*Math.cos(k.lat()*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2),g=12742*Math.atan2(Math.sqrt(g),Math.sqrt(1-g));g<f&&(f=g,j=h)}}j&&j.F.contains(e.getPosition())?j.q(e):(h=new n(c),h.q(e),c.f.push(h))}}function n(a){this.k=a;this.b=a.getMap();this.g=a.w();this.l=a.l;this.r=a.r;this.d=m;this.a=[];this.F=m;this.n=new j(this,a.z(),a.w())}function e(a){a.F=a.k.v(new google.maps.LatLngBounds(a.d,a.d))}
function j(a,b,d){a.k.extend(j,google.maps.OverlayView);this.j=b;this.fa=d||0;this.u=a;this.d=m;this.b=a.getMap();this.B=this.c=m;this.t=!1;this.setMap(this.b)}function i(a,b){var d=a.getProjection().fromLatLngToDivPixel(b);d.x-=parseInt(a.p/2,10);d.y-=parseInt(a.h/2,10);return d}function h(a){if(a.c)a.c.style.display="none";a.t=!1}function g(a,b){var d=[];d.push("background-image:url("+a.da+");");d.push("background-position:"+(a.D?a.D:"0 0")+";");typeof a.e==="object"?(typeof a.e[0]==="number"&&
a.e[0]>0&&a.e[0]<a.h?d.push("height:"+(a.h-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):d.push("height:"+a.h+"px; line-height:"+a.h+"px;"),typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.p?d.push("width:"+(a.p-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):d.push("width:"+a.p+"px; text-align:center;")):d.push("height:"+a.h+"px; line-height:"+a.h+"px; width:"+a.p+"px; text-align:center;");d.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.M?a.M:"black")+"; position:absolute; font-size:"+(a.N?a.N:
11)+"px; font-family:Arial,sans-serif; font-weight:bold");return d.join("")}var m=null,f;f=c.prototype;f.Q="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";f.P="png";f.extend=function(a,b){return function(a){for(var b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])};f.onAdd=function(){if(!this.A)this.A=!0,r(this)};f.draw=function(){};f.S=function(){for(var a=this.o(),b=new google.maps.LatLngBounds,d=0,e;e=a[d];d++)b.extend(e.getPosition());
this.b.fitBounds(b)};f.z=l("j");f.o=l("a");f.V=function(){return this.a.length};f.ba=k("J");f.I=function(){return this.J||this.b.mapTypes[this.b.getMapTypeId()].maxZoom};f.G=function(a,b){for(var d=0,e=a.length,c=e;c!==0;)c=parseInt(c/10,10),d++;d=Math.min(d,b);return{text:e,index:d}};f.$=k("G");f.H=l("G");f.C=function(a,b){for(var d=0,e;e=a[d];d++)o(this,e);b||this.i()};f.q=function(a,b){o(this,a);b||this.i()};f.Y=function(a,b){var d=q(this,a);return!b&&d?(this.m(),this.i(),!0):!1};f.Z=function(a,
b){for(var d=!1,e=0,c;c=a[e];e++)c=q(this,c),d=d||c;if(!b&&d)return this.m(),this.i(),!0};f.U=function(){return this.f.length};f.getMap=l("b");f.setMap=k("b");f.w=l("g");f.aa=k("g");f.v=function(a){var b=this.getProjection(),d=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),e=new google.maps.LatLng(a.getSouthWest().lat(),a.getSouthWest().lng()),d=b.fromLatLngToDivPixel(d);d.x+=this.g;d.y-=this.g;e=b.fromLatLngToDivPixel(e);e.x-=this.g;e.y+=this.g;d=b.fromDivPixelToLatLng(d);
b=b.fromDivPixelToLatLng(e);a.extend(d);a.extend(b);return a};f.R=function(){this.m(!0);this.a=[]};f.m=function(a){for(var b=0,d;d=this.f[b];b++)d.remove();for(b=0;d=this.a[b];b++)d.s=!1,a&&d.setMap(m);this.f=[]};f.L=function(){var a=this.f.slice();this.f.length=0;this.m();this.i();window.setTimeout(function(){for(var b=0,d;d=a[b];b++)d.remove()},0)};f.i=function(){r(this)};f=n.prototype;f.q=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var d;d=this.a[b];b++)if(d==a){b=
!0;break a}b=!1}if(b)return!1;if(this.d){if(this.r)d=this.a.length+1,b=(this.d.lat()*(d-1)+a.getPosition().lat())/d,d=(this.d.lng()*(d-1)+a.getPosition().lng())/d,this.d=new google.maps.LatLng(b,d),e(this)}else this.d=a.getPosition(),e(this);a.s=!0;this.a.push(a);b=this.a.length;b<this.l&&a.getMap()!=this.b&&a.setMap(this.b);if(b==this.l)for(d=0;d<b;d++)this.a[d].setMap(m);b>=this.l&&a.setMap(m);if(this.b.getZoom()>this.k.I())for(a=0;b=this.a[a];a++)b.setMap(this.b);else if(this.a.length<this.l)h(this.n);
else{b=this.k.H()(this.a,this.k.z().length);this.n.setCenter(this.d);a=this.n;a.B=b;a.ga=b.text;a.ea=b.index;if(a.c)a.c.innerHTML=b.text;b=Math.max(0,a.B.index-1);b=Math.min(a.j.length-1,b);b=a.j[b];a.da=b.url;a.h=b.height;a.p=b.width;a.M=b.textColor;a.e=b.anchor;a.N=b.textSize;a.D=b.backgroundPosition;this.n.show()}return!0};f.getBounds=function(){for(var a=new google.maps.LatLngBounds(this.d,this.d),b=this.o(),d=0,e;e=b[d];d++)a.extend(e.getPosition());return a};f.remove=function(){this.n.remove();
this.a.length=0;delete this.a};f.T=function(){return this.a.length};f.o=l("a");f.getCenter=l("d");f.getMap=l("b");f=j.prototype;f.onAdd=function(){this.c=document.createElement("DIV");if(this.t)this.c.style.cssText=g(this,i(this,this.d)),this.c.innerHTML=this.B.text;this.getPanes().overlayMouseTarget.appendChild(this.c);var a=this;google.maps.event.addDomListener(this.c,"click",function(){var b=a.u.k;google.maps.event.trigger(b,"clusterclick",a.u);b.O&&a.b.fitBounds(a.u.getBounds())})};f.draw=function(){if(this.t){var a=
i(this,this.d);this.c.style.top=a.y+"px";this.c.style.left=a.x+"px"}};f.show=function(){if(this.c)this.c.style.cssText=g(this,i(this,this.d)),this.c.style.display="";this.t=!0};f.remove=function(){this.setMap(m)};f.onRemove=function(){if(this.c&&this.c.parentNode)h(this),this.c.parentNode.removeChild(this.c),this.c=m};f.setCenter=k("d");window.MarkerClusterer=c;c.prototype.addMarker=c.prototype.q;c.prototype.addMarkers=c.prototype.C;c.prototype.clearMarkers=c.prototype.R;c.prototype.fitMapToMarkers=
c.prototype.S;c.prototype.getCalculator=c.prototype.H;c.prototype.getGridSize=c.prototype.w;c.prototype.getExtendedBounds=c.prototype.v;c.prototype.getMap=c.prototype.getMap;c.prototype.getMarkers=c.prototype.o;c.prototype.getMaxZoom=c.prototype.I;c.prototype.getStyles=c.prototype.z;c.prototype.getTotalClusters=c.prototype.U;c.prototype.getTotalMarkers=c.prototype.V;c.prototype.redraw=c.prototype.i;c.prototype.removeMarker=c.prototype.Y;c.prototype.removeMarkers=c.prototype.Z;c.prototype.resetViewport=
c.prototype.m;c.prototype.repaint=c.prototype.L;c.prototype.setCalculator=c.prototype.$;c.prototype.setGridSize=c.prototype.aa;c.prototype.setMaxZoom=c.prototype.ba;c.prototype.onAdd=c.prototype.onAdd;c.prototype.draw=c.prototype.draw;n.prototype.getCenter=n.prototype.getCenter;n.prototype.getSize=n.prototype.T;n.prototype.getMarkers=n.prototype.o;j.prototype.onAdd=j.prototype.onAdd;j.prototype.draw=j.prototype.draw;j.prototype.onRemove=j.prototype.onRemove})();
(function(){PICKUP.map={};PICKUP.info_window=0;PICKUP.marker_clusterer=null;var k=!1,l=!1,c=function(e){var c=e.id;if(e.alias&&e.alias!="")c=e.alias;var c='<div style="max-height: 360px; min-width: 320px">'+e.html_description+'<p><a href="map/view/'+c+'">go to game</a> / <a href="http://maps.google.com/maps?q='+parseFloat(e.lat)+","+parseFloat(e.lng)+'" target="_blank">view on google maps</a></p><span class="small">last updated on ',e=new Date(parseInt(e.last_updated,10)*1E3),i=e.toString(),i=i.split(" "),
h=parseInt(e.getHours(),10);h<10&&(h="0"+h);var g=parseInt(e.getMinutes(),10);g<10&&(g="0"+g);e=i[0]+", "+i[2]+" "+i[1]+" "+e.getFullYear()+" at "+h+":"+g;return c+e+"</span></div>"},p=function(e,j){YAHOO.util.Connect.asyncRequest("GET","api/game/"+e,{success:function(e){try{var h=YAHOO.lang.JSON.parse(e.responseText)}catch(g){PICKUP.info_window.setContent("JSON Parse Error: Please refresh the page and try again.");PICKUP.info_window.open(PICKUP.map.gmap,j);return}h.status==0?PICKUP.info_window.setContent(h.error):
PICKUP.info_window.setContent(c(h.data));PICKUP.info_window.open(PICKUP.map.gmap,j)},failure:function(){PICKUP.info_window.setContent("AJAX Failure: Please refresh the page and try again.");PICKUP.info_window.open(PICKUP.map.gmap,j)}})},o=function(e,c){return function(){PICKUP.info_window!==0&&PICKUP.info_window.close();p(e,c)}},q=function(){if(PICKUP.games&&!(PICKUP.games.length<1)){for(var e=[],c=0;c<PICKUP.games.length;c++){var i=new google.maps.Marker({position:new google.maps.LatLng(PICKUP.games[c][1],
PICKUP.games[c][2])});google.maps.event.addListener(i,"click",o(PICKUP.games[c][0],i));k!==!1&&PICKUP.games[c][0]===k&&(l=i);e.push(i)}PICKUP.marker_clusterer=new MarkerClusterer(PICKUP.map.gmap,e)}},r=function(){var e=29.53522956,c=-6.328125,i=2;YAHOO.util.Dom.inDocument("city")===!0&&(e=parseFloat(DOM.get("latitude").innerHTML),c=parseFloat(DOM.get("longitude").innerHTML),i=parseInt(DOM.get("zoom").innerHTML,10));if(YAHOO.util.Dom.inDocument("initial_game")===!0)for(var h=parseInt(YAHOO.util.Dom.get("initial_game").innerHTML,
10),g=0;g<PICKUP.games.length;g++)if(PICKUP.games[g][0]===h){e=PICKUP.games[g][1];c=PICKUP.games[g][2];i=15;k=h;break}PICKUP.map.gmap=new google.maps.Map(DOM.get("gmap_container"),{zoom:i,center:new google.maps.LatLng(e,c),mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:!1});google.maps.event.addListener(PICKUP.map.gmap,"click",function(){PICKUP.info_window!==0&&PICKUP.info_window.close()})},n=function(e){e=EVENT.getTarget(e);if(DOM.hasClass(e,"day_tab")===!0){var e=e.id.replace("days_",""),c=
DOM.getElementsByClassName("day_tab","div","map_day_tabs_container");DOM.removeClass(c,"active_day_tab");DOM.addClass("days_"+e,"active_day_tab");PICKUP.marker_clusterer.clearMarkers();c=null;e=="sun"?c=0:e=="mon"?c=1:e=="tues"?c=2:e=="wed"?c=3:e=="thurs"?c=4:e=="fri"?c=5:e=="sat"&&(c=6);if(!(e==="all"&&PICKUP.marker_clusterer.getTotalMarkers()==PICKUP.games.length)){for(var i=[],h=0;h<PICKUP.games.length;h++)if(!(e!=="all"&&PICKUP.util.in_array(c,PICKUP.games[h][3])!==!0)){var g=new google.maps.Marker({position:new google.maps.LatLng(PICKUP.games[h][1],
PICKUP.games[h][2])});google.maps.event.addListener(g,"click",o(PICKUP.games[h][0],g));i.push(g)}PICKUP.marker_clusterer.addMarkers(i)}}};EVENT.onDOMReady(function(){r();q();PICKUP.info_window=new google.maps.InfoWindow({maxWidth:375});if(k!==!1)var c=google.maps.event.addListener(PICKUP.map.gmap,"tilesloaded",function(){google.maps.event.removeListener(c);p(k,l)});EVENT.on("map_day_tabs_container","click",n)})})();

