gmap = {
	centerLatitude : 52.792353,
	centerLongitude : -0.452387,
	description : "<strong>Grimsthorpe Castle Park<br />and Gardens</strong><br />Bourne<br />PE10 0LZ",
	startZoom : 15,
	map : "Map object",
	id : "map_canvas",
	spotterOn : false,
	
	init : function() {
		if (GBrowserIsCompatible()) {	
			gmap.map = new google.maps.Map2(document.getElementById(gmap.id));
			var location = new google.maps.LatLng(gmap.centerLatitude, gmap.centerLongitude);
			gmap.map.setCenter(location, gmap.startZoom, G_HYBRID_MAP);
			
			gmap.map.addControl(new google.maps.SmallMapControl());
			gmap.map.addControl(new google.maps.MapTypeControl());
			
			gmap.map.removeMapType(G_SATELLITE_MAP);
			
			gmap.addMarker(gmap.centerLatitude, gmap.centerLongitude, gmap.description, false);
			
			
			if(gmap.spotterOn) {
				google.maps.Event.addListener(gmap.map, "dblclick", gmap.spotThis);
			}
		}
	},
	
	addMarker : function(latitude, longitude, description, isOpen) {
		var marker = new google.maps.Marker (new GLatLng(latitude, longitude));
		
		google.maps.Event.addListener(
			marker,
			'click',
			function() {
				marker.openInfoWindowHtml(description);
				gmap.map.setCenter(marker.getPoint(), gmap.startZoom);
			}
		);
		
		gmap.map.addOverlay(marker);
		if(isOpen){
			marker.openInfoWindow(description);
		}
	},
	
	spotThis : function (overlay, latlng) {
		var description = "Latitude: " + latlng.lat() + "<br />" + "Longitude: " + latlng.lng();
		gmap.addMarker(latlng.lat(), latlng.lng(), description, true);
	}
}
google.setOnLoadCallback(gmap.init);
