var map = null;
var geocoder = null;


function map_initialize() {
	if(window.document.getElementById("map_adress")) {
	  var adress_span = window.document.getElementById("map_adress");
	  if (GBrowserIsCompatible()) {
	    map = new GMap2(window.document.getElementById("map_canvas"), { size: new GSize(800,400) });
	    var customUI = map.getDefaultUI();
	    // Remove MapType.G_HYBRID_MAP
	    //customUI.maptypes.hybrid = false;
	    map.setUI(customUI);
	    geocoder = new GClientGeocoder();
	  }
	  showAddress(adress_span.value);
	}
}

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);
          marker.openInfoWindowHtml(address);
        }
      }
    );
  }
}
function gooleMapsView() {
	var map_canv = document.getElementById('map_td');
	if(map_canv.style.display == "none") {
		map_canv.style.display = '';		
		map_initialize();
	} else {
		map_canv.style.display = 'none';
	}
}