    //<![CDATA[

	  var total = null;
      var gmarkers = [];
	  var map = null;
	  var markers = null;
	  
	  	  
      // A function to create the marker and set up the event window
      function createMarker(point,title, description, species, thumbnail, pid) {
        var marker = new GMarker(point,customIcons[species]);
        // === Store the category and name info as a marker properties ===
        marker.mycategory = species;                                 
        marker.myname = title;
        var html = "<div style='width:300px; padding:10px; height:135px;'><font style='font-family:Arial, Helvetica, san-serif; font-size:12px; color:000034; font-weight:bold' ><u>" + title + "</u></font><p style='font-family:Arial, Helvetica, san-serif; font-size:10px'><a href='http://www.myoutdoortv.com/video/video.php?v=" + pid + "'><img src='" + thumbnail + "' align='left' style='padding-right:5px; padding-bottom:5px; border:none' width='90'></a>" + description + "</p><p align='right' style='font-family:Arial, Helvetica, san-serif; font-size:10px; color:FFCC66;'><a href='http://www.myoutdoortv.com/video/video.php?v=" + pid + "' target='blank'><font style='font-family:Arial, Helvetica, san-serif; font-size:12px; color:000034; font-decoration:none; font-weight:bold'>Watch Now</font></a></div>";
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        gmarkers.push(marker);
        return marker;
      }

      // == shows all markers of a particular category, and ensures the checkbox is checked ==
      function show(species) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == species) {
            map.addOverlay(gmarkers[i]);
		    }
        }
        // == check the checkbox ==
        document.getElementById(species+"box").checked = true;
	//	total = gmarkers.length;
	//	alert(total);
      }

      // == hides all markers of a particular category, and ensures the checkbox is cleared ==
      function hide(species) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == species) {
            map.removeOverlay(gmarkers[i]);
          }
        }
        // == clear the checkbox ==
        document.getElementById(species+"box").checked = false;
        // == close the info window, in case its open on a marker that we just hid
        //map.closeInfoWindow();
      }

      // == a checkbox has been clicked ==
      function boxclick(box,species) {
        if (box.checked) {
          show(species);
        } else {
          hide(species);
        }
        // == rebuild the side bar
      //  makeSidebar();
      }

      function myclick(i) {
        GEvent.trigger(gmarkers[i],"click");
      }


      // == rebuilds the sidebar to match the markers currently displayed ==
      function makeSidebar() {
        var html = "";
        for (var i=0; i<gmarkers.length; i++) {
          if (!gmarkers[i].isHidden()) {
            html += '<a href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a><br>';
          }
        }
        document.getElementById("side_bar").innerHTML = html;
      }
	
		function initialHide(){
		
        // == show or hide the categories initially ==
        hide("Bass");
        hide("Crappie");
        hide("Walleye");
        hide("Pike");
        hide("Tarpon");
        hide("Sailfish");
        hide("Red_Fish");
        hide("Snapper");
        hide("Grouper");
        hide("Tuna");
        hide("Trout");
        hide("Deer");
        hide("Elk");
		hide("Moose");
		hide("Bear");
		hide("Antelope");
		hide("Quail");
		hide("Grouse");
		hide("Pheasant");
		hide("Dove");
		hide("Turkey");
		hide("Targets");
		hide("Bow_Hunting");
		hide("Ducks");
		hide("Geese");
		hide("Coyote");
		hide("Squirrel");
		hide("Wild_Hogs");
		hide("Rabbit");
		hide("Conservation");
		hide("Environment");
		hide("Wild_Life");
		hide("Bird_Watching");
		hide("Parks_and_Recreation");	
		hide("Fishing_Other");
		hide("Hunting_Other");		
		
		}

function loadMap(){
      // create the map
      map = new GMap2(document.getElementById("map"));
	  map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
    //  map.setMapType(G_HYBRID_TYPE);
	  map.setCenter(new GLatLng(29.525987, -102.341861), 2);
}

function load(){
    if (GBrowserIsCompatible()) {

      // Read the data
      GDownloadUrl("/map/sql_to_xml.php", function(doc) {
        var xmlDoc = GXml.parse(doc);
        markers = xmlDoc.documentElement.getElementsByTagName("marker");
        for (var i = 0;i < markers.length; i++) {
          // obtain the attribues of each marker
          var lat = parseFloat(markers[i].getAttribute("lat"));
          var lng = parseFloat(markers[i].getAttribute("lng"));
          var point = new GLatLng(lat,lng);
          var title = markers[i].getAttribute("title");
          var description = markers[i].getAttribute("description");
		  description = description.replace("'", "&#39;");
		  title = title.replace("'", "&#39;");
		  var thumbnail = markers[i].getAttribute("thumbnail");
		  var pid = markers[i].getAttribute("pid");
          var species = markers[i].getAttribute("species");
          // create the marker
          var marker = createMarker(point,title, description, species, thumbnail, pid);
		  
		  	  
        }
		
		
      });
	 	  
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
	initialHide();


}
    //]]>