<!-- hide script from old browsers

// create map variables
var map = null;
var geocoder = null;
var localSearch = new GlocalSearch();

function createAccidentSummaryMap(dblLatitude, dblLongitude, enumType, lngZoom) {
// creates a map with a single event marker, map type controls and full zoom controls
// and centers it on the event coordinates
	if (GBrowserIsCompatible()) {
	// checks for compatible browser
		map = new GMap(document.getElementById("map"));
		map.addControl(new GSmallZoomControl());
        map.addControl(new GMapTypeControl());
		map.addControl(new GScaleControl());
		map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom);
		map.enableDoubleClickZoom();
		var icon = createEventIcon(enumType);
		var point = new GLatLng(dblLatitude, dblLongitude);
        var marker = new GMarker(point, icon);
		map.addOverlay(marker);
	// } else {
	// message for incompatible browsers
		// document.write("&nbsp;<p/>your browser is not compatible with our maps. See the <a  href=\"http://www.google.co.uk/help/faq_maps.html#addto\" class=\"normal\">google maps documentation</a> for browser compatibility details");
	}
}

function createAccidentBulletinMap(dblLatitude, dblLongitude, enumType, lngZoom, mapNumber) {
// creates a map with a single event marker and small zoom controls
// and centers it on the event coordinates
	if (GBrowserIsCompatible()) {
	// checks for compatible browser
		map = new GMap(document.getElementById(mapNumber));
		map.addControl(new GSmallZoomControl());
		map.addControl(new GScaleControl());
		map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom);
		map.enableDoubleClickZoom();
		var icon = createEventIcon(enumType);
		var point = new GLatLng(dblLatitude, dblLongitude);
        var marker = new GMarker(point, icon);
		map.addOverlay(marker);
	// } else {
	// message for incompatible browsers
		// document.write("&nbsp;<p/>your browser is not compatible with our maps. See the <a  href=\"http://www.google.co.uk/help/faq_maps.html#addto\" class=\"normal\">google maps documentation</a> for browser compatibility details");
	}
}

function createMediumMap(dblLatitude, dblLongitude, lngZoom) {
// creates a map with a single event marker and large zoom controls
// and centers it on the event coordinates
	if (GBrowserIsCompatible()) {
	// checks for compatible browser
		map = new GMap(document.getElementById("map"), {draggableCursor: 'crosshair', draggingCursor: 'pointer'});
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
		map.addControl(new GScaleControl());
		map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom);
		var point = new GLatLng(dblLatitude, dblLongitude);
		var marker = new GMarker(point);
		map.addOverlay(marker);
		geocoder = new GClientGeocoder();
	// } else {
	// message for incompatible browsers
		// document.write("&nbsp;<p/>your browser is not compatible with our maps. See the <a  href=\"http://www.google.co.uk/help/faq_maps.html#addto\" class=\"normal\">google maps documentation</a> for browser compatibility details");
	}
}

function createMapNoMarkers(dblLatitude, dblLongitude, lngZoom) {
// creates a large map with no markers and large zoom controls, for displaying markers
	if (GBrowserIsCompatible()) {
		map = new GMap(document.getElementById("map"), {draggableCursor: 'crosshair', draggingCursor: 'pointer'});
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
		map.addControl(new GScaleControl());
		map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom);
		map.enableDoubleClickZoom();
		geocoder = new GClientGeocoder();
	}
}

function createMapForPlacingMarkers(dblLatitude, dblLongitude, lngZoom) {
// creates a small map with no markers and large zoom controls, with cursor set for placing a marker
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"), {draggableCursor: 'crosshair', draggingCursor: 'pointer'});
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom);
		map.enableDoubleClickZoom();
	}
}

function createEventMarker(dblLatitude, dblLongitude, eventName, enumType, eventID, imagePath, imageWidth, imageHeight) {
// creates a marker on a previously created map, and adds callout window with link to event

		var icon = createEventIcon(enumType);
		var point = new GLatLng(dblLatitude, dblLongitude);
        var marker = new GMarker(point, icon);
		var html = "&nbsp;<br/><a href=\"eventsummary.php?eventID=" + eventID + "\" class=\"normal\">";
		html = html + eventName  + "</a>";
		if (imagePath != '') {
		// add event image
			html = html + "<p/><img src=\"" + imagePath + "\" width=\"" + imageWidth + "\" height=\"" + imageHeight + "\"></img>";
		}
		GEvent.addListener(marker, "click", function() {
    		marker.openInfoWindowHtml(html);
  		});
     	map.addOverlay(marker);

}

function createEventIcon(enumType) {

// Create an event marker icon based on the type of event
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);
		var icon = new GIcon(baseIcon);

		if (enumType == 'accident') {
		// if accident, specify accident icon
			icon.image = "./images/markerAccident.png";
		} else if (enumType == 'robbery') {
			icon.image = "./images/markerRobbery.png";
		}

		return icon;

}

function getLatLon(latElementID, longElementID) {
// get latitude and longitude of a click, pan map, move marker, and return coordinates to longElementID and latElementID
	GEvent.addListener(map, "click", function(overlay, point){
		map.clearOverlays();
		if (point) {
			map.addOverlay(new GMarker(point));
			map.recenterOrPanToLatLng(point);
			longMsg = point.x;
			latMsg = point.y;
			document.getElementById(longElementID).value = longMsg;
			document.getElementById(latElementID).value = latMsg;
		}
	})
}

function showAddress(address) {
	if (geocoder) {
		geocoder.getLatLng(
			address,
				function(point) {
					if (!point) {
						alert(address + " not found");
            			} else {
              				map.setCenter(point, 13);
              				var marker = new GMarker(point);
              				map.addOverlay(marker);
              				marker.openInfoWindowHtml(address);
					}
				}
        	);
	}
}

function createMapWithPostcode(postcode, mapNumber) {
// creates a map with a single marker based on postcode
// and centers it on the postcodecoordinates

    	var map = null;
    	var geocoder = null;

	if (GBrowserIsCompatible()) {
	// checks for compatible browser
		map = new GMap(document.getElementById(mapNumber));
        	// map.addControl(new GSmallZoomControl());
		geocoder = new GClientGeocoder();
		geocoder.getLatLng(
			postcode,
				function(point) {
					if (!point) {
						alert("Sorry, Google Maps was unable to resolve the postcode " + postcode);
            			} else {
              				map.setCenter(point, 7);
              				var marker = new GMarker(point);
              				map.addOverlay(marker);
					}
				}
        	);
	// } else {
	// message for incompatible browsers
		// document.write("&nbsp;<p/>your browser is not compatible with our maps. See the <a  href=\"http://www.google.co.uk/help/faq_maps.html#addto\" class=\"normal\">google maps documentation</a> for browser compatibility details");
	}

}

// end hiding script from old browsers -->