    //<![CDATA[


    if (GBrowserIsCompatible()) {
      var gmarkers = [];
      var gicons = [];
	  
	  
	  var baseicon = new GIcon(G_DEFAULT_ICON);
         
          baseicon.iconSize = new GSize(16, 25);
          baseicon.shadowSize = new GSize(0, 0); 

      gicons["attractions"] = new GIcon(baseicon,"../map/attractions-icon.png");
      gicons["hotels"] = new GIcon(baseicon,"../map/hotel-icon.png");
      gicons["restaurants"] = new GIcon(baseicon,"../map/restaurants-icon.png");
      gicons["warrat"] = new GIcon(baseicon,"../map/warwickattr-icon.png");
      gicons["travel"] = new GIcon(baseicon,"../map/travel-icon.png");
	  





      // A function to create the marker and set up the event window
      function createMarker(point,name,html,category) {
        var marker = new GMarker(point,gicons[category]);
        // === Store the category and name info as a marker properties ===
        marker.mycategory = category;                                 
        marker.myname = name;
        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(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].show();
          }
        }
        // == check the checkbox ==
        document.getElementById(category+"box").checked = true;
      }

      // == hides all markers of a particular category, and ensures the checkbox is cleared ==
      function hide(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].hide();
          }
        }
        // == clear the checkbox ==
        document.getElementById(category+"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,category) {
        if (box.checked) {
          show(category);
        } else {
          hide(category);
        }
        // == 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 html1 = "";var html2="";var html3="";var html4="";var html5="";
        
		for (var i=0; i<gmarkers.length; i++) {
		
		 if (gmarkers[i].mycategory == "attractions"){
		  if (!gmarkers[i].isHidden()) {
		  html1 += '<div style="margin-left:10px; margin-right:10px;"><p class="map-links"><a class="map-side-links" href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a></p></div>';
		  }
		  document.getElementById("side_bar1").innerHTML = html1; 
		 }
		 else if (gmarkers[i].mycategory == "warrat"){
		  if (!gmarkers[i].isHidden()) {
		  html2 += '<div style="margin-left:10px; margin-right:10px;"><p class="map-links"><a class="map-side-links" href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a></p></div>';
		  }
		  document.getElementById("side_bar2").innerHTML = html2;
		 }
		 else if (gmarkers[i].mycategory == "hotels"){
		  if (!gmarkers[i].isHidden()) {
		  html3 += '<div style="margin-left:10px; margin-right:10px;"><p class="map-links"><a class="map-side-links" href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a></p></div>';
		  }
		  document.getElementById("side_bar3").innerHTML = html3;
		 }
		 else if (gmarkers[i].mycategory == "restaurants"){
		  if (!gmarkers[i].isHidden()) {
		  html4 += '<div style="margin-left:10px; margin-right:10px;"><p class="map-links"><a class="map-side-links" href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a></p></div>';
		  }
		  document.getElementById("side_bar4").innerHTML = html4;
		 }
		 else if (gmarkers[i].mycategory == "travel"){
		  if (!gmarkers[i].isHidden()) {
		  html5 += '<div style="margin-left:10px; margin-right:10px;"><p class="map-links"><a class="map-side-links" href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + '</a></p></div>';
		  }
		  document.getElementById("side_bar5").innerHTML = html5;
		 }

} 
      }

      // create the map
      var map = new GMap2(document.getElementById("google-map"));
      map.addControl(new GLargeMapControl3D());
	  map.addControl(new GOverviewMapControl());
      map.addControl(new GMapTypeControl());
	  map.setCenter(new GLatLng(52.194000, -1.709000), 14);
	  map.addControl(new GScaleControl());
      map.enableDoubleClickZoom();
      map.enableContinuousZoom();
      map.enableScrollWheelZoom();
          

// Read the data
      GDownloadUrl("../map/categories.xml", function(doc) {
        var xmlDoc = GXml.parse(doc);
        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 markerinfo = markers[i].getAttribute("markerinfo");
          var name = markers[i].getAttribute("name");
          var html = "<b>"+name+"</b><p>"+markerinfo;
          var category = markers[i].getAttribute("category");
          // create the marker
          var marker = createMarker(point,name,html,category);
          map.addOverlay(marker);
        }

        // == show or hide the categories initially ==
        show("attractions");
        show("restaurants");
        show("hotels");
		show("warrat");
		show("travel")
        // == create the initial sidebar ==
        makeSidebar();
      });
    }

    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://econym.googlepages.com/index.htm

    //]]>
	

