// JavaScript Document, (c) Copyright by Changrong LI, changrong.li@gmail.com //

 //<![CDATA[ http://www.google.com/apis/maps/documentation/index.html
    function load() {
      if (GBrowserIsCompatible()) {
       	var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		//map.setCenter(new GLatLng(41.50400,-81.610000), 16);
		map.setCenter(new GLatLng(41.5020,-81.6075), 16);
		// Our info window content//2160+Adelbert+Road--Lot53?		
		var infoTabs = [
 			new GInfoWindowTab("Coordinate", "The coordinate of White Building is roughly (41.5020,-81.6075); <br />while lot 53 garage entrance is marked at (41.5029, -81.6053)."),
  			new GInfoWindowTab("Direction", "Get the direction from anywhere in US to DMSE@Case: <form action=\"http://maps.google.com/maps\" method=\"get\" target=\"_blank\"><input type=\"text\" name=\"saddr\" id=\"mapsUsSaddr\" value=\"\" size=\"30\" class=\"smalltext\"/><input name=\"daddr\" value=\"2160+Adelbert+Road,+Cleveland,+OH 44106\" type=\"hidden\"><input type=\"submit\" class=\"smalltext\" value=\"Get Directions\"/><input type=\"hidden\" name=\"hl\" value=\"en\"/></form>"),
			new GInfoWindowTab("Map", "The default zoon is set as level 16.<br /> Try hybrid instead of the default map mode.")			
		];
		// Place a marker in the center of the map and open the info window automatically
		var marker = new GMarker(map.getCenter());
		GEvent.addListener(marker, "click", function() {
 			marker.openInfoWindowTabsHtml(infoTabs);
		});
		map.addOverlay(marker);
		marker.openInfoWindowTabsHtml(infoTabs);
		
		// Download the data in data.xml and load it on the map. The format we expect is:
		// <markers>
		//   <marker lat="37.441" lng="-122.141"/>
		//   <marker lat="37.322" lng="-121.213"/>
		// </markers>
		GDownloadUrl("mapsdata.xml", function(data, responseCode) {
  			var xml = GXml.parse(data);
  			var markers = xml.documentElement.getElementsByTagName("marker");
  			for (var i = 0; i < markers.length; i++) {
    		var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                            parseFloat(markers[i].getAttribute("lng")));
    		map.addOverlay(new GMarker(point));
  			}
		});

	//original code as follows	
      }
    }
    //]]>