function initialize(gmapW,gmapH) {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map_canvas"), {size: new GSize(gmapW,gmapH)}); // GMap2 -The Elementary Object

		// map.removeMapType(G_NORMAL_MAP);
		map.removeMapType(G_SATELLITE_MAP);
		// map.removeMapType(G_HYBRID_MAP);
		map.setCenter(new GLatLng(37.075942, -93.22723), 10); // Initializing the map
		map.addControl(new GMapTypeControl());
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());

		// Create our "tiny" marker icon
		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.image = "http://jamesriver.org/xml/gmap_icon.png";
		tinyIcon.shadow = "http://jamesriver.org/xml/gmap_icon_shadow.png";
		tinyIcon.iconSize = new GSize(25, 25);
		tinyIcon.shadowSize = new GSize(25, 25);
		tinyIcon.iconAnchor = new GPoint(12, 12);
		tinyIcon.infoWindowAnchor = new GPoint(12, 1);					                

		// Set up our GMarkerOptions object
		markerOptions = { icon:tinyIcon, draggable:false };
		
		GDownloadUrl("/xml/gmap.xml", function(data, responseCode) {
				if(data == null || responseCode == -1) {alert("Error: timed out.");}

			    var xml = GXml.parse(data);
			    var markers = xml.documentElement.getElementsByTagName("marker");				

			    for (var m = 0; m < markers.length; m++) {
			        var point = new GLatLng(parseFloat(markers[m].getAttribute("lat")),
			                    parseFloat(markers[m].getAttribute("lng")));

			        var marker = new GMarker(point, markerOptions);

			        var mTitle = markers[m].getElementsByTagName("data")[0].getAttribute("title");
			        var mImage = markers[m].getElementsByTagName("data")[0].getAttribute("img");
			        var mAddress = markers[m].getElementsByTagName("data")[0].getAttribute("address");
			        var mCity = markers[m].getElementsByTagName("data")[0].getAttribute("city");
			        var mState = markers[m].getElementsByTagName("data")[0].getAttribute("state");
			        var mZip = markers[m].getElementsByTagName("data")[0].getAttribute("zip");

					marker.XMLInfo = "<img src='" + mImage + "' width='220' height='140' alt='" + mTitle + "' \/> <h3>" + mTitle + "</h3> <strong>JamesRiverAssembly</strong> <br />" + mAddress + "<br />" + mCity + ", " + mState + " " + mZip;

			        map.addOverlay(marker);

					// Create Info Window
					if (m == 0) {marker.openInfoWindow(marker.XMLInfo);}
			    }
			});

		GEvent.addListener(map, "click", function(marker) {
		    if (!marker || !marker.XMLInfo) return;

		    marker.openInfoWindow(marker.XMLInfo);
		});

		var directionsPanel = document.getElementById("directions");
		gdir = new GDirections(map, directionsPanel);

	    function handleErrors(){
		   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
		   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
		     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
		   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
		     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
	     
		   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
		     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

		   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
		     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
		   else alert("An unknown error occurred.");
	   
		}

		GEvent.addListener(gdir, "error", handleErrors);        
	}
}

/* 	Latitude/Longitude
	
	**JamesRiver**
	Center of Building = 37.075942, -93.22723
	Better Driving Directions = 37.075646, -93.221440 

	**WilsonsCreek**
	Center of Building = 37.148341, -93.360615
	Better Driving Directions = 37.146087, -93.361838
*/

   function setDirections(fromAddress,toLatLng) {
   	gdir.load(fromAddress + " to " + toLatLng);
   }
