var geocoder = new GClientGeocoder();
var directionsPanel;
var directions  = false;
var origin_marker = false;

function showAddress(address, destLat, destLng) {
	geocoder.getLatLng(
		address,
		function(point) {
		if (!point) {
		alert(address + " not found");
		} else {

		myLat = point.lat();
		myLng = point.lng();
		destLat = destLat || dest_lat;
		destLng = destLng || dest_lng;
		myDest = destLat+ ' ' + destLng;

		map.setCenter(point, 13);
		//cleanup any old marker
		if (origin_marker) origin_marker.hide();
		origin_marker = new GMarker(point);
		map.addOverlay(origin_marker);
		//get direction Code ///////
		if (!directions) directions = new GDirections (map,document.getElementById('gm_directions'));
		directions.load(myLat + " " + myLng  + " to " + myDest);
		var html =address + '<br/>' + directions.getSummaryHtml();
		html += "<br /><form name='findRoot'><input id='getNewAddress' name='getNewAddress' type='text' style='width:225px;' value='Try Another Address' onClick=\"value=''\"> ";
		html += "<input name='getDirections' type='button' value='GO' onClick=\"showAddress(document.getElementById('getNewAddress').value)," + destLat +","+ destLng +"\"> </form>";
		origin_marker.openInfoWindowHtml(html);

		}
		}
		);
}
