//<![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(40.660598, -111.963951), 10, G_NORMAL_MAP);
var bds = new GLatLngBounds(new GLatLng(40.08689084, -112.32498102), new GLatLng(41.23430516, -111.60292098));
map.setZoom(map.getBoundsZoomLevel(bds));
map.addControl(new GSmallMapControl());
var point = new GLatLng(40.601528,-112.317902);
var marker = createMarker(point,"Erda","http://www.americanhomeguides.com/homes/new_communities/utah/erda.html", 0);
map.addOverlay(marker);
var point = new GLatLng(40.09814,-111.730858);
var marker = createMarker(point,"Benjamin","http://www.americanhomeguides.com/homes/new_communities/utah/benjamin.html", 1);
map.addOverlay(marker);
var point = new GLatLng(40.391667,-111.85);
var marker = createMarker(point,"Lehi","http://www.americanhomeguides.com/homes/new_communities/utah/lehi.html", 2);
map.addOverlay(marker);
var point = new GLatLng(40.165278,-111.61);
var marker = createMarker(point,"Springville","http://www.americanhomeguides.com/homes/new_communities/utah/springville.html", 3);
map.addOverlay(marker);
var point = new GLatLng(41.223056,-111.973056);
var marker = createMarker(point,"Ogden","http://www.americanhomeguides.com/homes/new_communities/utah/ogden.html", 4);
map.addOverlay(marker);
var point = new GLatLng(40.69651,-112.091784);
var marker = createMarker(point,"Magna","http://www.americanhomeguides.com/homes/new_communities/utah/magna.html", 5);
map.addOverlay(marker);
var point = new GLatLng(40.343333,-111.72);
var marker = createMarker(point,"Lindon","http://www.americanhomeguides.com/homes/new_communities/utah/lindon.html", 6);
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();
    }
}
	