﻿function CreateMarker(objPoint, varIndex) {
	var objMarker = new GMarker(objPoint);
	GEvent.addListener(objMarker, "mouseover", function() {
		var objLocation = objLocations.Item(varIndex);
		objMarker.openInfoWindowHtml(objLocation.ToHtml(), {pixelOffset: new GSize(0,-32)});
	});
	return objMarker;
}

function LoadMap(varPageID) {
	if (GBrowserIsCompatible()) {
		objMap = new GMap2(document.getElementById("divMap"));
		objMap.addControl(new GSmallMapControl());
		var objPoint = new GLatLng(objLocations.Item(0).Latitude, objLocations.Item(0).Longitude);
		objMap.setCenter(objPoint, 14);
		for (i = 0; i < objLocations.Count(); i++) {
			var objPoint = new GLatLng(objLocations.Item(i).Latitude, objLocations.Item(i).Longitude);
			objMap.addOverlay(CreateMarker(objPoint, i));
		}
		objMap.openInfoWindowHtml(objMap.getCenter(), objLocations.Item(0).ToHtml(varPageID), { pixelOffset: new GSize(0, -32) });
	}
}

var objMap = null;
var objLocations = new LocationCollection();
