    //<![CDATA[

	var side_bar_html = "";
	var gmarkers = [];
	var htmls = [];
	var to_htmls = [];
	var from_htmls = [];
	//var location = [];
	var i=0;
	var map = "";
	
	  // This function picks up the click and opens the corresponding info window
      function myclick(i) 
	  {	
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }
      // functions that open the directions forms
      function tohere(i) 
	  {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }
      function fromhere(i) 
	  {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
      }
	  		// === Create an associative array of GIcons() ===
 function loadGoogleMap(){

    // Check to see if this browser can run the Google API
	if (GBrowserIsCompatible()) 
	{		
      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
		  map.addControl(new GLargeMapControl());
		  map.addControl(new GMapTypeControl());
      map.addControl(new GScaleControl(),
               new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 50)));
		  map.setCenter(new GLatLng(38.1432, -76.4923), 8);
		  map.enableContinuousZoom();
		  map.continuousZoomEnabled() 
		  map.enableDoubleClickZoom();
		  map.hideControls();

		new GKeyboardHandler(map,window);
		
var gicons = [];
     
 		gicons["1"] = new GIcon(G_DEFAULT_ICON, "http://www.derby-college.ac.uk/modules/map/pins/whiteDCpin.png");
		gicons["1"].iconSize = new GSize(23, 37);
		
////'mouseover' listener shows controls

GEvent.addListener(map, "mouseover", function(){
map.showControls();
});

////'mouseout' listener hides controls

GEvent.addListener(map, "mouseout", function(){
map.hideControls(); 
});
 location[0] = '14180 General Puller Highway, 23070';

var point = new GLatLng(37.55570,-76.39400);  
var marker = createMarker(point, 'Heaven Scent' , '<div  id="infowindow" class="bubble"><h4>Heaven Scent</h4>14180 Gen. Puller Hwy., Route 33<br/>Deltaville, Middlesex<br/>(804) 832-6200</div>', '1', '../profiles/heavenscent.aspx');
map.addOverlay(marker);


// put the assembled side_bar_html contents into the side_bar div
      document.getElementById("side_bar").innerHTML = side_bar_html;
    //]]>
	}  //end gbrowser function
		else 
	{
		  alert("Sorry, the Google Maps API is not compatible with this browser");
	}//end else
	
	// A function to create the marker and set up the event window
      	function createMarker(point,name,html,icontype,infoUrl) 
		{		var marker = new GMarker(point,{gicons:icontype, title:name});
				// The info window version with the "to here" form open
				to_htmls[i] = html + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
				   '<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
				   '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
				   '<INPUT value="Get Directions" TYPE="SUBMIT">' +
				   '<input type="hidden" name="daddr" value="'+ location[i] +'"/>';
				// The info window version with the "to here" form open
				from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
				   '<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
				   '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
				   '<INPUT value="Get Directions" TYPE="SUBMIT">' +
				   '<input type="hidden" name="saddr" value="'+ location[i] +'"/>';
				// The inactive version of the direction info
				html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';
		
				GEvent.addListener(marker, "click", function() 
				{
					window.setTimeout(function() {map.setZoom(16)},2400); 
					window.setTimeout(function() {map.setCenter(point)},2400); 
          
						window.setTimeout(function() {marker.openInfoWindowHtml(html,{maxUrl:infoUrl})},2400);
						});
						GEvent.addListener(marker, "infowindowclose", function() {
						window.setTimeout(function() {map.setCenter(new GLatLng(37.5517, -76.39350), 8)
						},2500);
						});
				gmarkers[i] = marker;
				htmls[i] = html;
			  side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
				i++;
					return marker;  
				}//end create marker
}//end loadGoogleMap

