/*	Google Maps Display & Geocoder
	      For mapping forums
	------------------------------	*/

var map = null;
var geocoder = null;

function initialize(address) {
  if (GBrowserIsCompatible()) {
	/*var myMap = new YAHOO.util.Anim('map', {
		height: { to: 300 }
	}, 2, YAHOO.util.Easing.easeBoth);*/

	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	geocoder = new GClientGeocoder();
	showAddress(address);
	//myMap.animate();
	recenter(address);
  }
}

function recenter(address) {
	geocoder = null;
	showAddress(address);
}

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);
		}
	  }
	);
  }
}
