//<![CDATA[

// arrays to hold copies of the markers and html used by the side_bar
// because the function closure trick doesnt work there
var gmarkers = [];

// Create our new marker icon
var busterIcon = new GIcon();
busterIcon.image = "/_images/_google_maps/pylon-icon.png";
busterIcon.shadow = "";
busterIcon.iconSize = new GSize(64, 64);
busterIcon.shadowSize = new GSize(0, 0);
busterIcon.iconAnchor = new GPoint(10, 64);
busterIcon.infoWindowAnchor = new GPoint(60, 15);

// Set up our GMarkerOptions object literal
markerOptions = { icon:busterIcon };


function start_map() 
	{
	if (GBrowserIsCompatible())
		{
	  	var map = new GMap2(document.getElementById('bootcamp_map'));
	    map.addControl(new GLargeMapControl());
	    map.addControl(new GMapTypeControl());
	    map.setCenter(new GLatLng(43.6498,-79.4398), 11);
    
		function createMarker(point,html,id) 
			{
	    	var marker = new GMarker(point, markerOptions);
	    	GEvent.addListener(marker, 'click', function() 
	    		{
	      		marker.openInfoWindowHtml(html); switchTab(id);
	   		 	});
				// save the info we need to use later for the side_bar
				gmarkers.push(marker);
				return marker;
 			 }
 		 
		var point = new GLatLng(43.603958,-79.537867);
		var marker = createMarker(point,'<div style="width:240px"><b>Etobicoke South<br/>Franklin Horner Community Centre</b><br/>Year Round<br/>Monday, Wednesday, Friday<br/>6:00AM, 6:30PM, 7:30PM<br/><a href="/registration.php?location=es">Register now.</a></div>', '0')
		map.addOverlay(marker);
		
		var point = new GLatLng(43.666194,-79.54549);
		var marker = createMarker(point,'<div style="width:240px"><b>Etobicoke Central<br/>St. Wilfrid\'s Church</b><br/><b>Year Round</b><br/><b>November/December</b><br/>Tuesday, Thursday - 6:00AM<br/><a href="/registration.php?location=ec">Register now.</a></div>','1')
		//map.addOverlay(marker);
					
		var point = new GLatLng(43.6597909,-79.5657901);
		var marker = createMarker(point,'<div style="width:260px"><b>Etobicoke Central<br/>Josyf Cardinal Slipyj Catholic School</b><br/>October to April<br/>Tuesday, Thursday - 6:15PM, 7:30PM<br/><a href="/registration.php?location=ec">Register now.</a></div>','2')
		//map.addOverlay(marker);
		
		var point = new GLatLng(43.661134,-79.580896);
		var marker = createMarker(point,'<div style="width:240px"><b>Etobicoke West<br/>Richview United Church</b><br/>Year Round<br/>Monday, Wednesday - 9:30AM<br/>Tuesday, Thursday - 6:15PM<br/><a href="/registration.php?location=ew">Register now.</a></div>','3')
		map.addOverlay(marker);
		
		var point = new GLatLng(43.6464886,-79.4730715);
		var marker = createMarker(point,'<div style="width:240px"><b>High Park<br/>Morningside-High Park Presbyterian Church</b><br/>Tuesday, Thursday - 6:30PM<br/><a href="/registration.php?location=hp">Register now.</a></div>','4')
		map.addOverlay(marker);
		
		var point = new GLatLng(43.6602129,-79.4742959);
		var marker = createMarker(point,'<div style="width:240px"><b>High Park<br/>St. Cecilia Catholic School</b><br/>October to April<br/>Monday, Wednesday, Friday<br/>6:30PM, 7:30PM<br/><a href="/registration.php?location=hp">Register now.</a></div>','5')
		//map.addOverlay(marker);

		var point = new GLatLng(43.6518132,-79.4666932);
		var marker = createMarker(point,'<div style="width:240px"><b>High Park<br/>Picnic Area 3</b><br/>May to September<br/>Monday, Wednesday, Friday<br/>6:00AM, 6:30PM, 7:30PM<br/><a href="/registration.php?location=hp">Register now.</a></div>','6')
		map.addOverlay(marker);

		var point = new GLatLng(43.673559,-79.547969);
		var marker = createMarker(point,'<div style="width:240px"><b>Etobicoke Central<br/>St. Luke\'s United Curch</b><br/>January to June 2010<br/>Tuesday, Thursday - 6:00AM<br/><a href="/registration.php?location=ec">Register now.</a></div>','7')
		//map.addOverlay(marker);

		var point = new GLatLng(43.669693,-79.298943);
		var marker = createMarker(point,'<div style="width:240px"><b>The Beach United Church<br/>(across from Kew Gardens)</b><br/>Tuesday, Thursday<br/>6:00AM<br/><a href="/the-beaches">Register now.</a></div>','8')
		map.addOverlay(marker);
		
		var point = new GLatLng(43.674098, -79.345945);
		var marker = createMarker(point,'<div style="width:240px"><b>Withrow Park</b><br/>Starting April 26, 2010<br/>Monday, Wednesday, Friday<br/>6:30PM<br/><a href="/the-danforth">Register now.</a></div>','9')
		map.addOverlay(marker);

		var point = new GLatLng(43.618755,-79.608187);
		var marker = createMarker(point,'<div style="width:240px"><b>Church Of The Holy Spirit</b><br/>Starting April 26, 2010<br/>Mon, Wed, Fri 6:00AM<br/>Mon, Wed 6:30PM<br/>Mon, Wed 7:30PM<br/><a href="/mississauga-boot-camp">Register now.</a></div>','10')
		map.addOverlay(marker);
		
		var point = new GLatLng(43.660715,-79.557469);
		var marker = createMarker(point,'<div style="width:240px"><b>West Deane Park</b><br/>Tuesday + Thursday<br/>6:00AM, 6:30PM, 7:30PM<br/><a href="/registration.php?location=ec">Register now.</a></div>','11')
		map.addOverlay(marker);

		}
	}

    //]]>
function switchTab(tabid)
	{
	var id = tabid;
	for (i=0;i<=11;i++)
		{
		document.getElementById('lt'+i).className='tab_unselected';
		document.getElementById('lp'+i).style.display='none';
		}
	document.getElementById('lt'+id).className='tab_selected';
	document.getElementById('lp'+id).style.display='';
	}

function myclick(i) // This function picks up the click and opens the corresponding info window
	{
	GEvent.trigger(gmarkers[i], 'click');
	}