var map;
var directions;
var directionsPanel;
function initialize(lat, lng) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(lat, lng), 15);
		var point = new GLatLng(lat, lng);
		map.addOverlay(createMarker(point));
	}
}

function getRoute(destination) {
	var address = document.getElementById("startAddress").value;
	var city = document.getElementById("startCity").value;
	var state = document.getElementById("startState").value;
	directionsPanel = document.getElementById("route");
	if (directions != null) {
		directions.clear();
	}
	directions = new GDirections(map, directionsPanel);
	//alert("from: " + address + ", "+ city + ", " + state + " to: " + destination);
	directions.load("from: " + address + ", "+ city + ", " + state + " to: " + destination);

	GEvent.addListener(directions, "error", function() { alert("Starting location could not be found.  Please try a new starting location."); } );
}

function createMarker(point) {
	// Create the store icon
	var storeIcon = new GIcon(G_DEFAULT_ICON);  
	storeIcon.image = "http://www.menards.com/web/static/images/storeLocator/menardsLogo.gif";
	storeIcon.iconSize = new GSize(90, 27);  
	// Set up our GMarkerOptions object  
	var markerOptions = { icon:storeIcon };
	var marker = new GMarker(point, markerOptions); 
	return marker;
}