    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);
        });
        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?type=public&lat1='+lat1+'&lat2='+lat2+'&lng1='+lng1+'&lng2='+lng2+'&maptype=golf_courses', {asynchronous:true, evalScripts:true});
    }

    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);

        baseIcon = new GIcon();
        baseIcon.shadow = "/images/golf/teeShadow.png";
        baseIcon.iconSize = new GSize(19, 28);
        baseIcon.shadowSize = new GSize(27, 28);
        baseIcon.iconAnchor = new GPoint(10, 28);
        baseIcon.infoWindowAnchor = new GPoint(12, 5);

  
        icon_golf_1 = new GIcon(baseIcon);
    
        icon_golf_1.image = "/images/golf/tee1.png";
    

        icon_golf_rated_1 = new GIcon(baseIcon);
       
        icon_golf_rated_1.image = "/images/golf/tee2.png";
    
  
        icon_golf_2 = new GIcon(baseIcon);
    
        icon_golf_2.image = "/images/golf/tee5.png";
    

        icon_golf_rated_2 = new GIcon(baseIcon);
       
        icon_golf_rated_2.image = "/images/golf/tee2.png";
    
  
        icon_golf_3 = new GIcon(baseIcon);
    
        icon_golf_3.image = "/images/golf/tee4.png";
    

        icon_golf_rated_3 = new GIcon(baseIcon);
       
        icon_golf_rated_3.image = "/images/golf/tee2.png";
    
  
        icon_golf_4 = new GIcon(baseIcon);
    
        icon_golf_4.image = "/images/golf/tee3.png";
    

        icon_golf_rated_4 = new GIcon(baseIcon);
       
        icon_golf_rated_4.image = "/images/golf/tee2.png";
    
  
        icon_golf_5 = new GIcon(baseIcon);
    
        icon_golf_5.image = "/images/golf/tee1.png";
    

        icon_golf_rated_5 = new GIcon(baseIcon);
       
        icon_golf_rated_5.image = "/images/golf/tee2.png";
    
  
      }
    }

