/*
	Website scripts
	(c) Kerve Design
	Google Map Scripts
*/

function showAddress(address,lonlat) {
	var map = null;
    var geocoder = null;
	/*var address = address + ", United Kingdom";*/
	
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map_canvas"));
    	geocoder = new GClientGeocoder();
    }
	if (geocoder) {
    	geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					/*alert(address + " not found");*/
					/*
						If Google can't find the address use Lon/Lat data to find place
						Lon/Lat must exist in the database for this to work.
					*/
					geocoder.getLatLng(
						lonlat,
						function(point) {
							if (!point) {
								/*alert("Long/Lat" + lonlat + " not found");*/
							} else {
								map.setCenter(point, 10);
								var marker = new GMarker(point);
								map.addOverlay(marker);
								/*map.addControl(new GSmallMapControl());*/
								/*marker.openInfoWindowHtml(address);*/
							}
						}
					)
				} else {
					map.setCenter(point, 10);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					/*map.addControl(new GSmallMapControl());*/
					/*marker.openInfoWindowHtml(address);*/
				}
			}
		);
	}
}