    if (GBrowserIsCompatible()) {
    	
      // this variable will collect the html which will eventualkly be placed in the side_bar
      var side_bar_html = "";
      side_bar_html += "<h3>Event</h3>" + "<p><em>Pan and zoom<br>Click on flag for OS map and directions</em></p>";
      side_bar_html += "<ul>";
   
      // arrays to hold copies of the markers and html used by the side_bar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      // arrays to hold variants of the info window html with get direction forms open
      var to_htmls = [];
      var from_htmls = [];

      // Create custom image
      var Icon = new GIcon();
      Icon.image = "oflag.PNG";
      Icon.iconSize = new GSize(16, 16);
      Icon.iconAnchor = new GPoint(5, 15);
      Icon.infoWindowAnchor = new GPoint(5, 2);

      // A function to read the header
      function qs() {
      var query = window.location.search.substring(1);
      var parms = query.split('&');
      for (var i=0; i<parms.length; i++) {
        var pos = parms[i].indexOf('=');
        if (pos > 0) {
          var key = parms[i].substring(0,pos);
          key = key.toLowerCase();
          var val = parms[i].substring(pos+1);
          qsParm[key] = val;
          }
        }
      }
 

      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point,Icon);

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
           '<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                  // "(" + name + ")" + 
           '"/>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
           '<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" + 
           '"/>';
        // The inactive version of the direction info
        html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';

        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;
        // add a line to the side_bar html
        side_bar_html += '<li><a href="javascript:myclick(' + i + ')">' + name + '</a></li>';
        i++;
        return marker;
      }

      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }

      // functions that open the directions forms
      function tohere(i) {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }
      function fromhere(i) {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
      }

     // Get data from command line
     var qsParm = new Array();
     qsParm['os'] = null;
     qsParm['label'] = null;
     qsParm['text'] = null;
     qs();
        
      os6 = qsParm['os'].toUpperCase();     
      var os6x = getOSRefFromSixFigureReference(os6);
      var ll1w = os6x.toLatLng(os6x);
      ll1w.OSGB36ToWGS84();
      lat = ll1w.lat;
      lng = ll1w.lng;    
      var east  = os6x.easting;
      var north = os6x.northing;
      os6Streetmap = "X=" + east.toString() + "&amp;Y=" + north.toString();

      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(lat,lng), 10);
    

      // Set up markers with info windows 
  
      var point = new GLatLng( lat,lng);
      label = "Event";
      if (qsParm['label']) label = qsParm['label'];
      label = label.replace(/_/g," ");
      html = label + ": " + os6;
      if (qsParm['text']) html = html + '<br>' + qsParm['text'];
      html = html.replace(/_/g," ");
      html = html +'<br>'+ '<a href="http://www.streetmap.co.uk/streetmap.dll?G2M?'+ os6Streetmap + '&A=Y&Z=4" target="_blank"> Click here for OS map</a></br>';

 
      var marker = createMarker(point,label,html);
      map.addOverlay(marker);

         // put the assembled side_bar_html contents into the side_bar div
          document.getElementById("leftnavigation").innerHTML = side_bar_html;

    }
 
    
    // display a warning if the browser was not compatible
    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/

