var map;
var tinyIcon = new GIcon();

tinyIcon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
tinyIcon.iconSize = new GSize(12, 20);
tinyIcon.shadowSize = new GSize(22, 20);
tinyIcon.iconAnchor = new GPoint(6, 20);
tinyIcon.infoWindowAnchor = new GPoint(5, 1);


var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);

function createMarker(point, index, desc) {
  // Create a lettered icon for this point using our icon class
  var letter = String.fromCharCode("A".charCodeAt(0) + index);
  var letteredIcon = new GIcon(tinyIcon);

  // letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";



  // Set up our GMarkerOptions object
  markerOptions = { icon:letteredIcon };
  var marker = new GMarker(point, markerOptions);

  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(desc);
  });
  
  return marker;
}

function initialize() {
  if (GBrowserIsCompatible()) {
    	map = new GMap2(document.getElementById("zoom_content"));
    	
    	pageID = ($("body").attr("id")).split("_")[3];
    	
    	
    	var latlng0 = new GLatLng(37.076665, -8.117566); // marina mar
    	
    	var zoomoutCentre = new GLatLng(37.076665, -8.117566); // centered between all courses
    	
		map.addOverlay(new createMarker(latlng0,0, "<strong>Marina Mar</strong>"));		
    	
		zoomLevel = 14;
		
    	switch(pageID) {
    		

			default:
				toCentre = zoomoutCentre;
				zoomLevel = 14;
				break;
    	}
    	
    	
    	map.setCenter(toCentre, zoomLevel);
    	map.setUIToDefault();		
	}
}

