//<![CDATA[
var points = [];
var markers = [];
var counter = 0;
var icon = [];
icon[0] = new GIcon();
icon[0].image = "http://www.americanhomeguides.com/apps/googlemaps/images/mm_20_red.png";
icon[0].shadow = "http://www.americanhomeguides.com/apps/googlemaps/images/mm_20_shadow.png";
icon[0].shadowSize = new GSize(22,20);
icon[0].iconSize = new GSize(12,20);
icon[0].iconAnchor = new GPoint(0,0);
icon[0].infoWindowAnchor = new GPoint(10,10);
var map = null;
function onLoad() {
if (GBrowserIsCompatible()) {
var mapObj = document.getElementById("map");
if (mapObj != "undefined" && mapObj != null) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.955753, -77.44935), 10, G_NORMAL_MAP);
var bds = new GLatLngBounds(new GLatLng(37.19237072, -77.9283318), new GLatLng(38.71913528, -76.9703682));
map.setZoom(map.getBoundsZoomLevel(bds));
map.addControl(new GSmallMapControl());
var point = new GLatLng(38.704167,-77.228056);
var marker = createMarker(point,"Lorton","http://www.americanhomeguides.com/homes/incentive_offers/virginia/lorton.html", 0);
map.addOverlay(marker);
var point = new GLatLng(37.66535,-77.50413);
var marker = createMarker(point,"Glen Allen","http://www.americanhomeguides.com/homes/incentive_offers/virginia/glen_allen.html", 1);
map.addOverlay(marker);
var point = new GLatLng(37.50363,-77.65127);
var marker = createMarker(point,"Midlothian","http://www.americanhomeguides.com/homes/incentive_offers/virginia/midlothian.html", 2);
map.addOverlay(marker);
var point = new GLatLng(37.553611,-77.460556);
var marker = createMarker(point,"Richmond","http://www.americanhomeguides.com/homes/incentive_offers/virginia/richmond.html", 3);
map.addOverlay(marker);
var point = new GLatLng(37.61265,-77.37841);
var marker = createMarker(point,"Mechanicsville","http://www.americanhomeguides.com/homes/incentive_offers/virginia/mechanicsville.html", 4);
map.addOverlay(marker);
var point = new GLatLng(37.35746,-77.44269);
var marker = createMarker(point,"Chester","http://www.americanhomeguides.com/homes/incentive_offers/virginia/chester.html", 5);
map.addOverlay(marker);
var point = new GLatLng(37.207339,-77.391488);
var marker = createMarker(point,"Petersburg","http://www.americanhomeguides.com/homes/incentive_offers/virginia/petersburg.html", 6);
map.addOverlay(marker);
var point = new GLatLng(37.51727,-76.97976);
var marker = createMarker(point,"New Kent","http://www.americanhomeguides.com/homes/incentive_offers/virginia/new_kent.html", 7);
map.addOverlay(marker);
var point = new GLatLng(37.292531,-77.297966);
var marker = createMarker(point,"Hopewell","http://www.americanhomeguides.com/homes/incentive_offers/virginia/hopewell.html", 8);
map.addOverlay(marker);
var point = new GLatLng(37.265166,-77.397071);
var marker = createMarker(point,"Colonial Heights","http://www.americanhomeguides.com/homes/incentive_offers/virginia/colonial_heights.html", 9);
map.addOverlay(marker);
var point = new GLatLng(37.76884,-77.37109);
var marker = createMarker(point,"Hanover","http://www.americanhomeguides.com/homes/incentive_offers/virginia/hanover.html", 10);
map.addOverlay(marker);
var point = new GLatLng(37.54159,-77.91894);
var marker = createMarker(point,"Powhatan","http://www.americanhomeguides.com/homes/incentive_offers/virginia/powhatan.html", 11);
map.addOverlay(marker);
var point = new GLatLng(37.6087561,-77.3733139);
var marker = createMarker(point,"Mechanicsvlle","http://www.americanhomeguides.com/homes/incentive_offers/virginia/mechanicsvlle.html", 12);
map.addOverlay(marker);
}
} else {
alert("Sorry, the Google Maps API is not compatible with this browser.");
}
}
function createMarker(point, title, html, n) {
if(n >= 1) { n = 0; }
var marker = new GMarker(point,{icon: icon[n], title: title});
GEvent.addListener(marker, "click", function() {location.href = html; });
points[counter] = point;
markers[counter] = marker;
counter++;
return marker;
}
function showInfoWindow(idx,html) {
map.centerAtLatLng(points[idx]);
markers[idx].openInfoWindowHtml(html);
}
//]]>

function WindowOnload(oNewOnloadFunction) {
    var oPreviousOnloadFunction = window.onload;
    window.onload = function() {
        if (oPreviousOnloadFunction) { oPreviousOnloadFunction(); }
        oNewOnloadFunction();
    }
}
	