var map;
var allpoints;
var numcalls;
var lookup;
google.load("maps", "2");
function setmarker(point) {
allpoints.push(point);
++numcalls;
if (numcalls == 2) {
finishload();
}
}
function finishload() {
bounds = new google.maps.LatLngBounds();
for (p in allpoints) {
if (allpoints[p]) {
bounds.extend(allpoints[p]);
} else {
}
}
zoom = map.getBoundsZoomLevel(bounds);
// Zoom out a small amount to show all markers complmetely
zoom = zoom-1;
map.setCenter(bounds.getCenter(), zoom);
map.addControl(new GSmallZoomControl());
// map.addControl(new GSmallMapControl());
// map.addControl(new GMapTypeControl());
point = lookup[7];
if (!point) {
alert("Warning - unable to locate address: 2440 Sand Hill Road Menlo Park, CA 94025");
} else {
var mark = new google.maps.Marker(point);
map.addOverlay(mark);
google.maps.Event.addListener(mark,'click',function(){
// Define link to Google Maps directions with destination prefilled
dir_link = 'contact_directions_ca.php';
// Display office address in map info window with "Get Directions" link below
var myhtml = "
Silicon Valley Office
2440 Sand Hill Road, Building 2, Suite 200
Menlo Park, CA 94025
';
this.openInfoWindowHtml(myhtml, {maxWidth:400});
});
}
point = lookup[8];
if (!point) {
alert("Warning - unable to locate address: 601 Carlson Parkway Minnetonka, MN 55305");
} else {
var mark = new google.maps.Marker(point);
map.addOverlay(mark);
google.maps.Event.addListener(mark,'click',function(){
// Define link to Google Maps directions with destination prefilled
dir_link = 'contact_directions_mn.php';
// Display office address in map info window with "Get Directions" link below
var myhtml = "Minnesota Office
601 Carlson Parkway, Suite 1160
Minnetonka, MN 55305
';
this.openInfoWindowHtml(myhtml, {maxWidth:400});
});
}
}
// Call this function when the page has been loaded
function initialize() {
//alert('initializing!');
numcalls = 0;
allpoints = new Array();
lookup = new Array();
map = new google.maps.Map2(document.getElementById("google_map"));
var geo = new google.maps.ClientGeocoder;
geo.getLatLng("2440 Sand Hill Road Menlo Park, CA 94025",
function(pnt) {lookup[7] = pnt; setmarker(pnt);});
geo.getLatLng("601 Carlson Parkway Minnetonka, MN 55305",
function(pnt) {lookup[8] = pnt; setmarker(pnt);});
}
google.setOnLoadCallback(initialize);