var map; //Remembers the map
var PlaceCoordinates=[39.244734,-76.847498];
var PlaceName='Woodland Wellness Center, 4620 Woodland Rd., Ellicott City, MD 21042';
function initialize()
{
	if(GBrowserIsCompatible())
	{
		map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(PlaceCoordinates[0], PlaceCoordinates[1]), 16);
		map.setUIToDefault();
		var MyMarker=new GMarker(new GLatLng(PlaceCoordinates[0], PlaceCoordinates[1]), { title: PlaceName, clickable:true });
		GEvent.addListener(MyMarker, "click", function() { this.openInfoWindowHtml(PlaceName.replace(/,/g,'<br>')); });
		map.addOverlay(MyMarker);
	}
}

function GetDirections()
{
	var DirInfo=document.getElementById('DirectionInformation');
	DirInfo.style.height='150px';
	DirInfo.innerHTML='';
	try {
		directions = new GDirections(map, DirInfo);
		GEvent.addListener(directions, "error", function() { DirInfo.innerHTML='<b>An error occured while retrieving the origin address:</b> '+DirectionError(directions.getStatus().code); });
		directions.load("from: "+document.getElementById('DirectionsTo').value+" to: "+PlaceCoordinates.join(', '), {getPolyline:true});
	} catch(e) {DirInfo.innerHTML='An Error Occured'+e.toString();}
	return false;
}

function DirectionError(ErrNum)
{
	Errors={
		200:'(G_GEO_SUCCESS) No errors occurred; the address was successfully parsed and its geocode has been returned.',
		400:'(G_GEO_BAD_REQUEST) A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.',
		500:'(G_GEO_SERVER_ERROR) A geocoding, directions or maximum zoom level request could not be successfully processed, yet the exact reason for the failure is not known.',
		601:'(G_GEO_MISSING_QUERY) The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.',
		601:'(G_GEO_MISSING_ADDRESS) Synonym for G_GEO_MISSING_QUERY.',
		602:'(G_GEO_UNKNOWN_ADDRESS) No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect.',
		603:'(G_GEO_UNAVAILABLE_ADDRESS) The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.',
		604:'(G_GEO_UNKNOWN_DIRECTIONS) The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region.',
		610:'(G_GEO_BAD_KEY) The given key is either invalid or does not match the domain for which it was given.',
		620:'(G_GEO_TOO_MANY_QUERIES)'
	}
	return Errors[ErrNum];
}