var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
document.getElementById("date").innerHTML = (curr_date + "-" + curr_month + "-" + curr_year);
    //<![CDATA[
    if (GBrowserIsCompatible()) {
      var sidebar_html = "";
      var gmarkers = [];
      var htmls = [];
      var thums = [];
      var i = 0;
	  var oneIcon = new GIcon();
      oneIcon.image = "markers/hemiT.png";
      oneIcon.shadow = "markers/shadowhemi.png";
      oneIcon.iconSize = new GSize(17, 17);
      oneIcon.shadowSize = new GSize(22, 17);
      oneIcon.iconAnchor = new GPoint(9, 9);
      oneIcon.infoWindowAnchor = new GPoint(9, 9);
      oneIcon.infoShadowAnchor = new GPoint(9, 9);
      oneIcon.printImage = "markers/hemiT.gif";
      oneIcon.mozPrintImage = "markers/hemiT.gif";
      // A function to create the marker and set up the event window
      function markerdata(dmarker, bounds){         
              // obtain the attribues of each marker
              var lat = parseFloat(dmarker.getAttribute("lat"));
              var lng = parseFloat(dmarker.getAttribute("lng"));
              var point = new GLatLng(lat,lng);
			  bounds.extend(point);
              var html = dmarker.getAttribute("html");
              var label = dmarker.getAttribute("label");
              var county = dmarker.getAttribute("county");
              var num = dmarker.getAttribute("num");
              // create the marker
              var marker = createMarker(point,label,county, num);
			  return marker

            }

      // A function to create the marker and set up the event window
      function createMarker(point,label,county, num) {
        var marker = new GMarker(point, oneIcon);
		var nhtml=''
		var town = label.toLowerCase() 
		var bigtown = label.toUpperCase() 
		nhtml= '<font color=#0000CC face=verdana><A href="http://www.discount-hotels-uk.com/mapdata/'+town+'_'+county+'_map.html">'+bigtown+'</A><BR><BR>Click to go to town page<BR>There are '+num+' hotels listed in '+bigtown;
		GEvent.addListener(marker, "click", function() {
		  nhtml= '<font color=#0000CC face=verdana><A href="http://www.discount-hotels-uk.com/mapdata/'+town+'_'+county+'_map.html">'+bigtown+'</A><BR><BR>Click to go to town page<BR>There are '+num+' hotels listed in '+bigtown;
		  marker.openInfoWindowHtml(nhtml);
        });
        gmarkers[i] = marker;
        htmls[i] = nhtml;
        sidebar_html += '<A href="http://www.discount-hotels-uk.com/mapdata/'+town+'_'+county+'_map.html">' + bigtown + '</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:myclick(' + i + ')"><small>map</small></a><HR>';
        i++;
        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( xu,yu), 9);

      // A function to read the data
      function readMap(url) {
		var bounds = new GLatLngBounds();
        var request = GXmlHttp.create();
        request.open("GET", url, true);
        request.onreadystatechange = function() {
          if (request.readyState == 4) {
            var xmlDoc = request.responseXML;
            // obtain the array of markers and loop through it
            var markers = xmlDoc.documentElement.getElementsByTagName("marker");
            
            // hide the info window, otherwise it still stays open where the removed marker used to be
            map.getInfoWindow().hide();
            
            map.clearOverlays();
            
            // empty the array
            gmarkers = [];

            // reset the sidebar
            sidebar_html="";
            for (var i = 0; i < markers.length; i++) {
              marker = markerdata(markers[i], bounds);
			  map.addOverlay(marker);}
            // put the assembled sidebar_html contents into the sidebar div
			map.setZoom(map.getBoundsZoomLevel(bounds));
            var clat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) /2;
            var clng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) /2;
            map.setCenter(new GLatLng(clat,clng));
            document.getElementById("sidebar").innerHTML = sidebar_html;
          }
        }
        request.send(null);
      }
      

    }

    //]]>
