
//<![CDATA[

function gMap_centreOnAddress(address) {
	gMap_Geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
				alert(address + " not found");
			} else {
				gMap.setCenter(point, 13);
				gMap_currentLat = point.lat();
				gMap_currentLong = point.lng();
			}
		}
	);
}

function gMap_loadMarkersAndRoutes() {
	var queryData = "";

	ajaxSendRequest("POST", "/wms/modules/maps/loadmarkersandroutes.php", queryData, function(responseText) {
		if (responseText.substring(0, 3) != "ERR") {
			var data = eval('(' + responseText + ')');
			if (data.pois.length) {
				for (var c = 0; c < data.pois.length; c++) {
					var theIcon = new GIcon(G_DEFAULT_ICON);
					theIcon.image = "/templates/images/" + data.pois[c].type.icon;
					theIcon.shadow = null;
					theIcon.iconSize = new GSize(20, 20);
					theIcon.iconAnchor = new GPoint(10, 10);

					gMap_addMarker(new GLatLng(data.pois[c].lat, data.pois[c].long), theIcon, data.pois[c]);
				}
			}
			if (data.routes.length) {
				for (var c = 0; c < data.routes.length; c++) {
					gMap_addRoute(data.routes[c]);
				}
			}
		} else {
			alert("An error occurred loading the map details: " + responseText);
		}
	});
}
//]]>

