// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

	var map = null;
    var geocoder = null;

    function initialize(address, infotext) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(47.60343, -122.32972), 13);
        geocoder = new GClientGeocoder();
        showAddress(address, infotext);
      }
    }

    function showAddress(address, infotext) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
	          var point = new GLatLng(47.60343, -122.32972);  
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml('The event location cannot be found');
              map.addControl(new GLargeMapControl());
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(infotext);
              map.addControl(new GLargeMapControl());
            }
          }
        );
      }
    }

//############

	function setElementStyle(id, contentClass) {
		document.getElementById(id).className = contentClass
	}