    //<![CDATA[

    if (GBrowserIsCompatible()) {
      // this variable will collect the html which will eventualkly be placed in the sidebar
      
      
      var side_bar_html = "";
    
      // arrays to hold copies of the markers and html used by the sidebar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      
      var lastlinkid;


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);
        
         var linkid = "link"+i;
        
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
          
          //document.getElementById(linkid).style.background="#fff";
          lastlinkid=linkid;
          
        });
        // save the info we need to use later for the sidebar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the sidebar html
        //side_bar_html += '<div id="'+linkid+'"><a href="javascript:Linkclicked(' + i + ')">'
        //   + name + '</a><br></div>';
        i++;
        return marker;
      }


      // This function picks up the click and opens the corresponding info window
      function Linkclicked(i) {
        GEvent.trigger(gmarkers[i], "click");
      }


      // create the map
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng( 48.842908317434436,2.2750496864318848), 13);

      var mm = new GMarkerManager(map);

      // Read the data from example.xml
      var request = GXmlHttp.create();
      request.open("GET", "/mapdata", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {

        // this line depends on actually serving XML with the right MIME type
        //  var xmlDoc = request.responseXML;
		// if you don't hack TXP publish.php then use this line instead:
		 var xmlDoc = GXml.parse(request.responseText);

          // obtain the array of markers and loop through it
          var 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 html = GXml.value(markers[i].getElementsByTagName("infowindow")[0]);
            var label = markers[i].getAttribute("label");
            // create the marker
            var marker = createMarker(point,label,html);
            map.addOverlay(marker);
          }
          // put the assembled sidebar_html contents into the sidebar div
          // Removed 22 10 07 was throwing errors
          //document.getElementById("sidebar").innerHTML = sidebar_html;
          
                
            GEvent.addListener(map,"infowindowclose", function() {
        document.getElementById(lastlinkid).style.background="#ffffff";
      });

        mm.addMarkers(gmarkers,0,17);
        mm.refresh();
                       
      // put the assembled side_bar_html contents into the side_bar div
      //document.getElementById("side_bar").innerHTML = side_bar_html;
      //document.getElementById("side_bar").style.height = "338px";
      //document.getElementById("side_bar").style.width = "153px";
      
        }
      }
      request.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/

	// Modified by David Ramos (ns@davidramos.org) 

    //]]>

