    if (GBrowserIsCompatible()) {
      var side_bar_html = "";
      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 normIcon = new GIcon();
      normIcon.image = "http://www.icandyworld.com/images/map_stockist2010.png";
      normIcon.shadow = "images/map/shadow.png";
      normIcon.iconSize = new GSize(32, 37);
      normIcon.shadowSize = new GSize(56, 20);
      normIcon.iconAnchor = new GPoint(16, 37);
      normIcon.infoWindowAnchor = new GPoint(9, 2);
      normIcon.infoShadowAnchor = new GPoint(18, 25);
	  
	  var homeIcon = new GIcon();
      homeIcon.image = "http://www.icandyworld.com/images/map_home2010.png";
      homeIcon.shadow = "images/map/shadow.png";
      homeIcon.iconSize = new GSize(32, 37);
      homeIcon.shadowSize = new GSize(56, 20);
      homeIcon.iconAnchor = new GPoint(16, 37);
      homeIcon.infoWindowAnchor = new GPoint(9, 2);
      homeIcon.infoShadowAnchor = new GPoint(18, 25);

       
      
      // An array of GIcons, to make the selection easier
      var icons = [];
      icons[0] = normIcon;
	  icons[1] = homeIcon;
	 

      // the icon information is passed to this function
      function createMarker(point,name,html,icontype,lat,lng) {
        var marker = new GMarker(point,icons[icontype]);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml("<div style='width:200px;font-size:10px;line-height:14px;'>"+html+"</div>");
        });
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
		
		var style = [];		
		style[0]='stockist';
		style[1]='userhome';
		
        // add a line to the side_bar html
        side_bar_html += '<li class="'+style[icontype]+'"><a class="maplink" href="javascript:myclick(' + i + ','+lat+','+lng+')">' + name + '</li>';
        i++;
        return marker;
      }

      function myclick(i,lat,lng) {
        gmarkers[i].openInfoWindowHtml("<div style='width:200px;font-size:10px;line-height:14px;'>"+htmls[i]+"</div>");
		map.setCenter(new GLatLng(lat,lng), 10);
      }

		var map = new GMap2(document.getElementById("map"));
      	map.addControl(new GLargeMapControl());
      	//map.addControl(new GMapTypeControl());
      	
		if(mlat=='0' || mlon=='0'){
			map.setCenter(new GLatLng(53.69,-2.25), 6);
		}else{
			map.setCenter(new GLatLng(mlat,mlon), mzoom);
		}
		
		map.enableScrollWheelZoom();
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		

      // Read the data from custom.xml
      var request = GXmlHttp.create();
      request.open("GET", saxmlfile, 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"));
            // create the marker
            var marker = createMarker(point,label,html,icontype,lat,lng);
            map.addOverlay(marker);
          }
		  
          // put the assembled side_bar_html contents into the side_bar div
		  //var nl="</a><br/>";
		  //side_bar_html=side_bar_html.replace(/newline/g,nl);
          //document.getElementById("side_bar").innerHTML = "<ul>"+side_bar_html+"</ul>";
        }
      }
      request.send(null);
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }  

