var directions;
var agua_blanca;
var cornerstone;
var monterey_43585;
var milestone_building_72980;
var milestone_building_72960;
var monterey_44300_44350;
var monterey_44200_44250;
var hms_plaza_east;
var hms_plaza_west;
Ext.onReady(function() {
if (GBrowserIsCompatible()) {
// Set the center and some controls
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
// Create an object for driving directions
directions = new GDirections(map, document.getElementById('directions'));
GEvent.addListener(directions, 'error', handleErrors);
// Set the markers
var aguaBlanca = function() {
this.className = 'agua_blanca';
this.point = new GLatLng(33.7424203, -116.4104580);
this.html = 'Agua Blanca 41-750 Rancho Las Palmas Dr. Rancho Mirage, CA 92270';
this.default_html = this.html + '
Directions: To here - From here' +
' Start address: ' +
'' +
' ' +
'';
this.from_html = this.html + '
Directions: To here - From here' +
' End address: ' +
'' +
' ' +
'';
this.createMarker = function() {
var default_html = this.default_html;
var marker = new GMarker(this.point);
this.marker = marker;
map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(default_html);
});
}
this.toHere = function() {
this.marker.openInfoWindowHtml(this.to_html);
}
this.fromHere = function() {
this.marker.openInfoWindowHtml(this.from_html);
}
}
map.setCenter(new GLatLng(33.741483, -116.412095), 13);
agua_blanca = new aguaBlanca();
agua_blanca.createMarker();
cornerstone = new cornerStone();
cornerstone.createMarker();
monterey_43585 = new monterey43585();
monterey_43585.createMarker();
milestone_buildings = new milestoneBuildings();
milestone_buildings.createMarker();
monterey_44300_44350 = new monterey4430044350();
monterey_44300_44350.createMarker();
monterey_44200_44250 = new monterey4420044250();
monterey_44200_44250.createMarker();
hms_plaza_east = new hmsPlazaEast();
hms_plaza_east.createMarker();
hms_plaza_west = new hmsPlazaWest();
hms_plaza_west.createMarker();
}
});
function setDirections(fromAddress, toAddress) {
directions.load("from: " + fromAddress + " to: " + toAddress);
}
function handleErrors(){
if (directions.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: " + directions.getStatus().code);
else if (directions.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: " + directions.getStatus().code);
else if (directions.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: " + directions.getStatus().code);
else if (directions.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: " + directions.getStatus().code);
else if (directions.getStatus().code == G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.\n Error code: " + directions.getStatus().code);
else alert("An unknown error occurred.");
}