    var map;
    var baseIcon;
    var idList = new Array();
    var markers = new Array();
    var queueInfoWindow;

    // Creates a marker whose info window displays the caption
    function createMarker(map, latitude, longitude, html_caption, icon, id, marker_type, name) {
      inArray = 0;
      if (id > 0) {
        for (i=0; i<idList.length; i++) {
           if (idList[i] == id) inArray = 1;
        }
      }

      if (!inArray) {
        idList[idList.length] = id;
        var point = new GPoint(longitude, latitude);
        var marker = new GMarker(point, icon);
        GEvent.addListener(marker, "click", markers[id] = function() {
          marker.openInfoWindowHtml(html_caption);
        });
        //GEvent.addListener(marker, "mouseover", markers[id]);
        map.addOverlay(marker);
      }
    }

   function update_results() {
   }

   function map_update() {
      bounds = map.getBounds();
      sw = bounds.getSouthWest();
      ne = bounds.getNorthEast();
      lat1 = sw.lat();
      lat2 = ne.lat();
      lng1 = sw.lng();
      lng2 = ne.lng();
      new Ajax.Updater('ajaxdiv', '/txorails/public/misc/map_ajax?lat1='+lat1+'&lat2='+lat2+'&lng1='+lng1+'&lng2='+lng2+'&maptype=campgrounds_lakes', {asynchronous:true, evalScripts:true});
    }

    function map_zoomin(overlay, point) {
      if (map.getZoom() < 12 && overlay) {
        map.setZoom(12);
      }
    }

    function map_init(latitude, longitude, zoom) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        GEvent.addListener(map, "moveend", map_update);
          
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(latitude, longitude), zoom);

        icon_lake = new GIcon();
        icon_lake.iconSize = new GSize(25, 30);
        icon_lake.iconAnchor = new GPoint(12, 30);
        icon_lake.infoWindowAnchor = new GPoint(18, 3);
        icon_lake.image = "/images/icons/sail_lake_blue.png";

        icon_lake_rated = new GIcon();
        icon_lake_rated.iconSize = new GSize(25, 30);
        icon_lake_rated.iconAnchor = new GPoint(12, 30);
        icon_lake_rated.infoWindowAnchor = new GPoint(18, 3);
        icon_lake_rated.image = "/images/icons/sail_lake_red.png";

   
        icon_campground_1 = new GIcon();
        icon_campground_1.iconSize = new GSize(22, 14);
        icon_campground_1.iconAnchor = new GPoint(11, 14);
        icon_campground_1.infoWindowAnchor = new GPoint(11, 3);
     
        icon_campground_1.image = "/images/icons/statePark.png";
     

     
        icon_campground_rated_1 = new GIcon();
        icon_campground_rated_1.iconSize = new GSize(22, 14);
        icon_campground_rated_1.iconAnchor = new GPoint(11, 14);
        icon_campground_rated_1.infoWindowAnchor = new GPoint(11, 3);
     
        icon_campground_rated_1.image = "/images/icons/statePark2.png";
     
        icon_campground_2 = new GIcon();
        icon_campground_2.iconSize = new GSize(20, 11);
        icon_campground_2.iconAnchor = new GPoint(10, 11);
        icon_campground_2.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_2.image = "/images/icons/cmpgrnd.png";
     

     
        icon_campground_rated_2 = new GIcon();
        icon_campground_rated_2.iconSize = new GSize(20, 11);
        icon_campground_rated_2.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_2.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_2.image = "/images/icons/cmpgrnd2.png";
     
        icon_campground_3 = new GIcon();
        icon_campground_3.iconSize = new GSize(20, 11);
        icon_campground_3.iconAnchor = new GPoint(10, 11);
        icon_campground_3.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_3.image = "/images/icons/cmpgrnd.png";
     

     
        icon_campground_rated_3 = new GIcon();
        icon_campground_rated_3.iconSize = new GSize(20, 11);
        icon_campground_rated_3.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_3.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_3.image = "/images/icons/cmpgrnd2.png";
     
        icon_campground_4 = new GIcon();
        icon_campground_4.iconSize = new GSize(20, 11);
        icon_campground_4.iconAnchor = new GPoint(10, 11);
        icon_campground_4.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_4.image = "/images/icons/cmpgrnd.png";
     

     
        icon_campground_rated_4 = new GIcon();
        icon_campground_rated_4.iconSize = new GSize(20, 11);
        icon_campground_rated_4.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_4.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_4.image = "/images/icons/cmpgrnd2.png";
     
        icon_campground_5 = new GIcon();
        icon_campground_5.iconSize = new GSize(20, 11);
        icon_campground_5.iconAnchor = new GPoint(10, 11);
        icon_campground_5.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_5.image = "/images/icons/cmpgrnd.png";
     

     
        icon_campground_rated_5 = new GIcon();
        icon_campground_rated_5.iconSize = new GSize(20, 11);
        icon_campground_rated_5.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_5.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_5.image = "/images/icons/cmpgrnd2.png";
     
        icon_campground_7 = new GIcon();
        icon_campground_7.iconSize = new GSize(20, 11);
        icon_campground_7.iconAnchor = new GPoint(10, 11);
        icon_campground_7.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_7.image = "/images/icons/dayPark_bwn.png";
     

     
        icon_campground_rated_7 = new GIcon();
        icon_campground_rated_7.iconSize = new GSize(20, 11);
        icon_campground_rated_7.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_7.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_7.image = "/images/icons/dayPark_bwn.png";
     
        icon_campground_8 = new GIcon();
        icon_campground_8.iconSize = new GSize(20, 11);
        icon_campground_8.iconAnchor = new GPoint(10, 11);
        icon_campground_8.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_8.image = "/images/icons/cmpgrnd.png";
     

     
        icon_campground_rated_8 = new GIcon();
        icon_campground_rated_8.iconSize = new GSize(20, 11);
        icon_campground_rated_8.iconAnchor = new GPoint(10, 11);
        icon_campground_rated_8.infoWindowAnchor = new GPoint(10, 3);
     
        icon_campground_rated_8.image = "/images/icons/cmpgrnd2.png";
     
      }
    }

