var PICKUP = { gmap_div : null, gmap : null, data : {"latitude":45.404653,"longitude":-75.695972,"zoom":11,"games":[]}, markers : [], funcFactory : function(x) { return function() { PICKUP.markers[x].openInfoWindowHtml('
' + PICKUP.data.games[x].html_description + '
'); }; }, init : function() { if (! GMap2) { alert('PickupUltimate.com: You must include the Google Map API for the embedded map to work.'); return; } PICKUP.gmap_div = document.getElementById("pickupultimate_gmap"); if (! PICKUP.gmap_div) { alert('PickupUltimate.com: You must include a
for the embedded map to work.'); return; } if (GBrowserIsCompatible() == false) { gmap_div.innerHTML = 'Your browser cannot load the google map of pickup games on this page. Please upgrade or visit http://pickupultimate.com/map/city/ottawa.'; return; } PICKUP.load_map(); }, load_map : function() { var parent_height = parseInt(PICKUP.gmap_div.style.height, 10) - 15; var html = '
'; html += '
'; html += '
'; html += '
games powered by PickupUltimate.com
'; html += '
'; PICKUP.gmap_div.innerHTML = html; PICKUP.gmap = new GMap2(document.getElementById("pickupultimate_gmap2")); PICKUP.gmap.addControl(new GLargeMapControl()); PICKUP.gmap.addControl(new GMapTypeControl()); PICKUP.gmap.setCenter(new GLatLng(PICKUP.data.latitude, PICKUP.data.longitude), parseInt(PICKUP.data.zoom)); for (var i = 0; i < PICKUP.data.games.length; i++) { var options = { draggable: false }; PICKUP.markers[i] = new GMarker(new GLatLng(PICKUP.data.games[i].latitude, PICKUP.data.games[i].longitude), options); GEvent.addListener(PICKUP.markers[i], "click", PICKUP.funcFactory(i)); PICKUP.gmap.addOverlay(PICKUP.markers[i]); } }, change_day : function() { var select = document.getElementById("pickupultimate_day_select"); if (! select) return; var value = select.options[select.selectedIndex].value; for (var i = 0; i < PICKUP.data.games.length; i++) { if (value == "all") PICKUP.markers[i].show(); else if (PICKUP.data.games[i].days_played.search(value + '.') != -1) PICKUP.markers[i].show(); else { PICKUP.markers[i].closeInfoWindow(); PICKUP.markers[i].hide(); } } } }; GEvent.addDomListener(window, "load", PICKUP.init);