    if (GBrowserIsCompatible()) {
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point,icons[0]);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        gmarkers[i] = marker;
        htmls[i] = html;
        i++;
        return marker;
      }


      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
		//alert(i);
      }


      // create the map
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
	  /*map.addControl(new GOverviewMapControl(new GSize(100,100)));*/
      map.setCenter(new GLatLng( 34.0625,-98.677068), 3);
	  
	  // ========= Replace Marker Image ================
	  
	  var Icon = new GIcon();
      Icon.image = "gmapGfx/pin-small.png";
      Icon.iconSize = new GSize(15, 15);
      /*Icon.shadow = "gmapGfx/pinShadow.png";
      Icon.shadowSize = new GSize(29, 45);*/
	  Icon.iconAnchor = new GPoint(12, 12);
	  Icon.infoWindowAnchor = new GPoint(12, 12);
      Icon.infoShadowAnchor = new GPoint(12, 12);
	  
	  // An array of GIcons, to make the selection easier
      var icons = [];
      icons[0] = Icon;
	  
	  //  ======== A function to adjust the positioning of the overview ========
      /*function positionOverview(x,y) {
        var omap=document.getElementById("map_overview");
        omap.style.left = x+"px";
        omap.style.top = y+"px";
        omap.firstChild.firstChild.style.left="5px";
        omap.firstChild.firstChild.style.top="5px";
        omap.firstChild.firstChild.style.width="190px";
        omap.firstChild.firstChild.style.height="190px";
      }*/

      //  ======== Cause the overview to be positioned AFTER IE sets its initial position ======== 
      /*setTimeout("positionOverview(445,345)",1);*/

      
	  // Read the data from data.xml
      var mapRequest = GXmlHttp.create();
	  //var side_bar_html="";
      var rand = Math.random()*10000; 
	  mapRequest.open("GET", "data.xml?rand=" + rand + "", true);
      mapRequest.onreadystatechange = function() {
        if (mapRequest.readyState == 4) {
          var xmlDoc = mapRequest.responseXML;
          
		  // read the array of states and loop through it
		  var states = xmlDoc.documentElement.getElementsByTagName("state");
		  for (var s = 0; s < states.length; s++) {
			  
			  state = states[s].getAttribute("name");
		  	  //side_bar_html += '<h3><a href="#' + state + '" onclick="callState(\'' + state + '\');">' + state + '</a></h3>';
			  //alert(s);
			  // obtain the array of markers and loop through it
			  var markers = states[s].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 html = markers[i].getAttribute("html");
				var html = GXml.value(markers[i].getElementsByTagName("infowindow")[0]);
				var label = markers[i].getAttribute("label");
				//alert(label);
				// create the marker
				var marker = createMarker(point,label,html);
				map.addOverlay(marker);
			  }
		  }
		  //document.getElementById("mapsNav").innerHTML = side_bar_html;
        }
      }
      mapRequest.send(null);
	  
    } else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/

    //]]>

