var mapControl = new GLargeMapControl();
var mapCenter = new GLatLng(56.944974, -98.613281);
var mapZoom = 3;

var iconPath = "/templates/markers";
var iconBase = "red_Marker";
var iconExt = ".png";

var iconSize = new GSize(20, 34);
var iconAnchor = new GPoint(10, 34);
var infoWindowAnchor = new GPoint(5, 5);

var map;
var manager;
var icons = []
var markers = [];
var geocoder = new GClientGeocoder();

var centerOnLocationZoom = 11;

function initializeIcons() {
	for (var i = 65; i < 90; i++) {		
		var icon = new GIcon();
		icon.image = iconPath+"/"+iconBase+String.fromCharCode(i)+iconExt;
		icon.iconSize = iconSize;
		icon.iconAnchor = iconAnchor;
		icon.infoWindowAnchor = infoWindowAnchor;
		
		// Add icon to array.
		icons[String.fromCharCode(i)] = icon;
	}
}

function initializeMap(element) {
	map = new GMap2(element);
	
	map.addControl(mapControl);
	map.addControl(new GMapTypeControl());
	
	//map.setCenter(mapCenter, mapZoom);

	selectProvince( "All Locations" );
	
}

function addMarker(id, location, icon, markerContent) {
	var marker = new GMarker(location, {icon: icons[icon]});
	marker.bindInfoWindowHtml(markerContent);
	marker.textContent = markerContent;
	
	markers[id] = marker;
	
	map.addOverlay(marker);
	
}

function clearMarkers() {
	markers = [];
	map.clearOverlays();
}

function resetMap() {
	
}

function centerOnLocation(str, zoom) {
	//alert(str);
	geocoder.getLatLng(str,	function(point) {
			if (point) {
				map.setCenter(point, zoom);
			}
		}
	);
}

function highlightMarker(marker) {
	markers[marker].openInfoWindowHtml(markers[marker].textContent);
}
