// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
// This file has species and commonname refs and needs to be updated with more field


var map;
var geocoder = null;

function init() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
        map.setMapType(G_HYBRID_MAP);
        geocoder = new GClientGeocoder();
        map.enableScrollWheelZoom();

      }
}

window.onload = init;

function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 16);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }

