    $(function() {
        $("span[title]").tooltip({
            showURL: false,
            delay: 0,
            fade: 250,
            track: true,
            top: 25
        });
    });
    // Load the Visualization API and packages.
    google.load('visualization', '1', {'packages':['piechart','columnchart','barchart','linechart','areachart','annotatedtimeline']});

    google.setOnLoadCallback(drawCharts);
    function switchMapControlTab(tab) {
      document.getElementById("map_controls_borders").style.display='none';
      document.getElementById("map_controls_external").style.display='none';
      document.getElementById("map_controls_minerals").style.display='none';
      document.getElementById("map_controls_other").style.display='none';
      document.getElementById("map_controls_" + tab).style.display='block';
    }
    var map;
    var map_float;
    var kmls = new Array();
    var kml_sets = new Array();
    function checkPreloadKml(kml) {
      // like checkKmlLoaded(), but do not show upon finish
      if (kmls[kml].hasLoaded()) {
        document.getElementById("map_kml_" + kml + "_button").value = "Show";
        document.getElementById("map_kml_" + kml + "_button").disabled = false;
      } else {
        setTimeout("checkPreloadKml('" + kml + "')",5000);
      }
    }
    function checkKmlLoaded(kml) {
      // check manually, since the load event from Google Maps does not fire properly
      if (kmls[kml].hasLoaded()) {
        toggleKml(kml);
      } else {
        setTimeout("checkKmlLoaded('" + kml + "')",5000);
      }
    }
    function loadKml(kml) {
      kmls[kml + "_visible"] = false;
      if (kml_sets[kml].indexOf("http://") == 0) {
        kmls[kml] = new GGeoXml(kml_sets[kml]);
        kmls[kml + "_float"] = new GGeoXml(kml_sets[kml]);
      } else if (location.href.indexOf("include.js",0) > 0) {
        kmls[kml] = new GGeoXml(location.href.substr(0,location.href.indexOf("include.js",0)) + kml_sets[kml]);
        kmls[kml + "_float"] = new GGeoXml(location.href.substr(0,location.href.indexOf("include.js",0)) + kml_sets[kml]);
      } else {
        kmls[kml] = new GGeoXml(location.href + kml_sets[kml]);
        kmls[kml + "_float"] = new GGeoXml(location.href + kml_sets[kml]);
      }
    }
    function toggleKml(kml) {
      if (kmls[kml] == undefined) {
        document.getElementById("map_kml_" + kml + "_button").disabled = true;
        document.getElementById("map_kml_" + kml + "_button").value = "Loading";
        loadKml(kml);
        checkKmlLoaded(kml);
      } else if (kmls[kml + "_visible"]) {
        map.removeOverlay(kmls[kml]);
        map_float.removeOverlay(kmls[kml + "_float"]);
        kmls[kml + "_visible"] = false;
        document.getElementById("map_kml_" + kml + "_button").value = "Show";
        document.getElementById("map_kml_" + kml + "_button").disabled = false;
      } else {
        map.addOverlay(kmls[kml]);
        map_float.addOverlay(kmls[kml + "_float"]);
        kmls[kml + "_visible"] = true;
        document.getElementById("map_kml_" + kml + "_button").value = "Hide";
        document.getElementById("map_kml_" + kml + "_button").disabled = false;
      }
    }
    var court_markers = new Array();
    var court_markers_float = new Array();
    function toggleCourtMarker(court,lat,lon,title) {
      if (GBrowserIsCompatible()) {
        if (typeof(court_markers[court]) == "undefined") {
          var point = new GLatLng(lat,lon);
          map.setCenter(point);
          var marker = new GMarker(point);
          GEvent.addListener(marker,"click",function() {
            marker.openInfoWindowHtml(title);
          });
          map.addOverlay(marker);
          map_float.setCenter(point);
          var marker_float = new GMarker(point);
          GEvent.addListener(marker_float,"click",function() {
            marker.openInfoWindowHtml(title);
          });
          map_float.addOverlay(marker_float);
        } else if (court_markers[court].isHidden()) {
          map.setCenter(court_markers[court].getLatLng());
          map_float.setCenter(court_markers_float[court].getLatLng());
          court_markers[court].show();
          court_markers_float[court].show();
        } else {
          court_markers[court].hide();
          court_markers_float[court].hide();
        }
      }
    }
    function drawCharts() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_div"));
        map.setCenter(new GLatLng(15.0652615, 162.733924), 4);
        map.setMapType(G_NORMAL_MAP);
        map.setUIToDefault();
        map.disableScrollWheelZoom();
        map_float = new GMap2(document.getElementById("map_float_div"));
        map_float.setCenter(new GLatLng(15.0652615, 162.733924), 2);
        map_float.setMapType(G_NORMAL_MAP);
        map_float.setUIToDefault();
        map_float.disableScrollWheelZoom();
        kml_sets["nuclear"] = "../includes/us_nuclear.kmz";
        kml_sets["weather_radar"] = "../includes/nexrad.kmz";
        kml_sets["mines"] = "../includes/mineplant-fUS.kmz";
        kml_sets["river"] = "http://www.weather.gov/ahps/worldfiles/ahps_national_obs.kmz";
        kml_sets["fire"] = "http://activefiremaps.fs.fed.us/kml/conus.kmz";
        kml_sets["border"] = "border.kmz";
        kml_sets["counties"] = "border_counties.kmz";
        toggleKml("border");
        for (var kml in kml_sets) {
          if ((kml_sets[kml].indexOf("http://") != 0) && (kml != "border")) {
            loadKml(kml);
            document.getElementById("map_kml_" + kml + "_button").disabled = true;
            document.getElementById("map_kml_" + kml + "_button").value = "Loading";
            checkPreloadKml(kml);
          }
        }
      } else {
        document.getElementById("map_controls_span").style.display = "none";
      }
      doTimeUpdate();
    }

    function doTimeUpdate() {
    }

    function toggleDiv(div_name) {
      var the_div = document.getElementById(div_name);
      if (document.getElementById(div_name).style.display == 'none') {
        document.getElementById(div_name).style.display = 'block';
      } else {
        document.getElementById(div_name).style.display = 'none';
      }
    }