function addme(myaddress, map, id) {
	geocoder.getLatLng (
		myaddress + ", ottawa, on",
		function(point) {
			if (!point) {
				//alert(myaddress + " not found");
				//addme(myaddress, map, id);
			} else {
				//map.setCenter(point, 15);
				var marker = new GMarker(point, myicon);
				GEvent.addListener(marker, "click", function() { window.location = "/ottawa-apartments.aspx?listingid=" + id; });
				map.addOverlay(marker);
			}
		}
	);
}

if (GBrowserIsCompatible()) {
	var myicon = new GIcon();
	myicon.image = "/images/mappin3.png";
	myicon.iconSize = new GSize(25, 25);
	myicon.iconAnchor = new GPoint(13, 13);
	
	var geocoder = new GClientGeocoder();
	var map = new GMap2(document.getElementById("homemap"));

	map.setCenter(new GLatLng(45.395067,-75.685501), 11);
	map.addControl(new GLargeMapControl());
	//map.addControl(new GMapTypeControl()); // Crashes IE6

	addme("1545 Alta Vista Drive", map, 2);
	addme("2385 Carling Avenue", map, 12);
	addme("60 Cartier Street", map, 11);
	addme("400 Slater Street", map, 6);
	addme("475 Elgin Street", map, 7);
	addme("2600 Draper Avenue", map, 15);
	addme("2765 Innes Road", map, 3);
	addme("1401 Prince of Wales Drive", map, 1);
	addme("2201 Riverside Drive", map, 5);
	addme("180 Lees Avenue", map, 4);
	addme("1400 Appleton Drive", map, 13);
	addme("1720 Baseline Road", map, 9);
	addme("2969 Fairlea Crescent", map, 10);
	addme("1265 Wellington Street", map, 14);
	addme("3590 Downpatrick Road", map, 8);
}
