
    //<![CDATA[
	
    function loadMap(myDataXML) {
      if (GBrowserIsCompatible()) {
	  
	  
	   // this variable will collect the html which will eventualkly be placed in the sidebar
      var sidebar_html = "";
    
      // arrays to hold copies of the markers and html used by the sidebar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
	  
	  	// A function to create the marker and set up the event window
		function createMarker(point,name,html,category) {
			if(category == "solo"){
				var marker = new GMarker(point, iconSolo);
			} else if(category == "pair"){
				var marker = new GMarker(point, iconPair);
			} else if(category == "togo"){
				var marker = new GMarker(point, iconTogo);
			} else if(category == "business"){
				var marker = new GMarker(point, iconBusiness);
			} else {
				var marker = new GMarker(point);
			}
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(html);
			});
			// save the info we need to use later for the sidebar
			gmarkers[i] = marker;
			htmls[i] = html;
			// add a line to the sidebar html
			sidebar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
			i++;
			return marker;
		}
	  
	  
	  
	  
	  	// define custom icon types
		var baseLargeIcon = new GIcon();
		baseLargeIcon.shadow = "http://www.nymag.com/daily/food/assets/pin_shadow_large.png";
		baseLargeIcon.iconSize = new GSize(31, 40);
		baseLargeIcon.shadowSize = new GSize(61, 40);
		baseLargeIcon.iconAnchor = new GPoint(15, 39);
		baseLargeIcon.infoWindowAnchor = new GPoint(15, 1);
		baseLargeIcon.infoShadowAnchor = new GPoint(15, 39);
		
		var iconSolo = new GIcon(baseLargeIcon);
		iconSolo.image = "http://www.nymag.com/daily/food/assets/pin_solo_large.png";
		var iconPair = new GIcon(baseLargeIcon);
		iconPair.image = "http://www.nymag.com/daily/food/assets/pin_pair_large.png";
		var iconTogo = new GIcon(baseLargeIcon);
		iconTogo.image = "http://www.nymag.com/daily/food/assets/pin_togo_large.png";
		var iconBusiness = new GIcon(baseLargeIcon);
		iconBusiness.image = "http://www.nymag.com/daily/food/assets/pin_business_large.png";
		
		
		
		var lunchMap = new GMap2(document.getElementById("lunchMap"));
        //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
		lunchMap.setCenter(new GLatLng(0,0),0);
		lunchMap.addControl(new GSmallMapControl());
		//map.addControl(new GMapTypeControl());
		
		//var address = testAddress;
		var geocoder = new GClientGeocoder();
		
		
		
		var bounds = new GLatLngBounds();
		
		
		// Read the data from the XML
		var request = GXmlHttp.create();
		request.open("GET", myDataXML, true);
		request.onreadystatechange = function() {
			if (request.readyState == 4) {
				var xmlDoc = request.responseXML;
				// obtain the array of markers and loop through it
				var markers = xmlDoc.documentElement.getElementsByTagName("marker");
				  
				for (var i = 0; i < markers.length; i++) {
					// obtain the attribues of each marker
					var lat = parseFloat(markers[i].getAttribute("lat"));
					var lng = parseFloat(markers[i].getAttribute("lng"));
					var point = new GLatLng(lat,lng);
					var html = "";
					if(GXml.value(markers[i].getElementsByTagName("myLink")[0])){
						html = "<a target='_top' href='" + GXml.value(markers[i].getElementsByTagName("myLink")[0]) + "'>";
					}						
					html += "<b>" + GXml.value(markers[i].getElementsByTagName("myName")[0]) + "</b>";
					if(GXml.value(markers[i].getElementsByTagName("myLink")[0])){
						html += "</a>";
					}						
					html += "<br />" + GXml.value(markers[i].getElementsByTagName("myAddress")[0]) + "<br />";
					html += GXml.value(markers[i].getElementsByTagName("myPhone")[0]);
					var category = markers[i].getAttribute("category");
					var label = markers[i].getAttribute("label");
					
					// extend bounds
					bounds.extend(point);
					
					// create the marker
					var marker = createMarker(point,label,html, category);
					lunchMap.addOverlay(marker);
				}
				
				// zoom and center map to fit contents
				lunchMap.setZoom(lunchMap.getBoundsZoomLevel(bounds));
				
				
				var clat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) /2;
				var clng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) /2;
				lunchMap.setCenter(new GLatLng(clat,clng));
				
				
				  // put the assembled sidebar_html contents into the sidebar div
				  //document.getElementById("sidebar").innerHTML = sidebar_html;
			}
		}
		request.send(null);
		
		
		
		
		
      }
    }

    //]]>