function showAddress() 
{
    // daniel@klixo.net.nz
    // http://www.google.com/apis/maps/documentation/reference.html
    if (GBrowserIsCompatible()) 
    {
    	var address = document.getElementById("oAddress").value;
    	var sGLatLng = document.getElementById("oGLatLng").value;
    	
    	// If a GLatLng value exists for this story, use it to create a point
    	if (sGLatLng.length > 0)
    	{
    		eval("var point = new GLatLng(" + sGLatLng + ");");
    		DrawMarker(point);
    	}
    	else
    	{
    		// Geocode the address and draw a point in the callback
    		var geocoder = new GClientGeocoder();
    		geocoder.getLatLng(address, DrawMarker);
    	}    
    }
}

function DrawMarker(point)
{
	var gZoomLevel = 16; //starting zoom level

	if (!point) 
	{
		newP = document.createElement("p");
		newText = document.createTextNode("Map not available");
		newP.appendChild(newText);
		document.getElementById("map").appendChild(newP);
	} 
	else 
	{
		// Initialise the map object
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());

		// center the map
		map.setCenter(point, gZoomLevel);
		// draw the marker
		var marker = new GMarker(point);
		map.addOverlay(marker);
		// Show the info
		var info = document.getElementById("info");
		info.style.display = "block"; 
		marker.openInfoWindow(info);
	}
}				   
