function addMarkers() {

    if (GBrowserIsCompatible()) {

      var gmarkers = [];
      var htmls = [];
      var i = 0;
      
      // Create some custom icons
      
      // This icon uses the same shape as the default Google marker
      // So we can use its details for everything except the image 
      var blueIcon = new GIcon();
      blueIcon.image = "images/coldmarker.png";
      blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
      blueIcon.iconSize = new GSize(20, 34);
      blueIcon.shadowSize = new GSize(37, 34);
      blueIcon.iconAnchor = new GPoint(9, 34);
      blueIcon.infoWindowAnchor = new GPoint(9, 2);
      blueIcon.infoShadowAnchor = new GPoint(18, 25);
      blueIcon.transparent = "http://www.google.com/intl/en_ALL/mapfiles/markerTransparent.png";
      blueIcon.printImage = "coldmarkerie.gif";
      blueIcon.mozPrintImage = "coldmarkerff.gif";


      // This icon is a different shape, so we need our own settings       
      var fingerIcon = new GIcon();
      fingerIcon.image = "images/finger.png";
      fingerIcon.shadow = "images/fingershadow.png";
      fingerIcon.iconSize = new GSize(20, 34);
      fingerIcon.shadowSize = new GSize(36, 34);
      fingerIcon.iconAnchor = new GPoint(5, 34);
      fingerIcon.infoWindowAnchor = new GPoint(5, 2);
      fingerIcon.infoShadowAnchor = new GPoint(14, 25);
      fingerIcon.transparent = "fingertran.png";
      fingerIcon.printImage = "fingerie.gif";
      fingerIcon.mozPrintImage = "fingerff.gif";
      
      // An array of GIcons, to make the selection easier
      var icons = [];
      icons[0] = blueIcon;
      icons[1] = fingerIcon;

      // the icon information is passed to this function
      function createMarker(point,name,html,icontype) {
        var marker = new GMarker(point,icons[icontype]);
        /*GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });*/
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;

        return marker;
      }

      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }

      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(54.450553,-5.651229), 9)


      // Read the data from custom.xml
      var request = GXmlHttp.create();
      request.open("GET", "XML/custommarkers.xml", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          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 = markers[i].getAttribute("html");
            var label = markers[i].getAttribute("label");
            var icontype = parseInt(markers[i].getAttribute("icontype"));
			var address = markers[i].getAttribute("address");
            // create the marker
            var marker = createMarker(point,label,html,icontype);
            map.addOverlay(marker);
          }

        }
      }
      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://econym.googlepages.com/index.htm
}
 window.onload = addMarkers;
window.onunload = GUnload;   
