// JavaScript Document

var locationsAdded = false;

function InitializeLocations() {
	if ( ! locationsAdded ) {
		AddStoreLocationMarkers(wpts);
		window.setTimeout('GV_Filter_Waypoints(gmap,wpts)',100); // the delay lets IE6 realize the markers are in the cache
		locationsAdded = true;
	}
}

function MoveMapFocusToLatLongFromZip(aGeocoder, zipcode, aMap) {
	
	aGeocoder.getLatLng(
		zipcode,
		function(point) {
			if (!point) {
				alert("Location '" + zipcode + "' not found");
			} else {
				//Load locations if not done yet
				InitializeLocations();
				// Move map
				aMap.setCenter(point, 9);
			}
		}
	);
}

function FindStoresSubmit(aGeocoder, zipcode, aMap) {
	MoveMapFocusToLatLongFromZip(aGeocoder, zipcode, aMap);
	return (false);
}