if (GBrowserIsCompatible()) {
	//var sidebar_html = "";
	var gmarkers = [];
	var linePoints = [];
	var htmls = [];
	var i = 0;

    // A function to create the marker and set up the event window
	function createMarker(point,name,html,icon) {
	     var marker = new GMarker(point,icon);
	     /*GEvent.addListener(marker, "click", function() {
		   try {
		       marker.openInfoWindowHtml(html);
		   }

		   catch(e) {}
	     });*/
		gmarkers[i] = marker;
		htmls[i] = html;
		i++;
		return marker;
	}

	//shrink copyright to fit
    function MakeCopyrightSmaller() {
		for(var i = 0; i < map.getContainer().childNodes.length; ++i){
			if(map.getContainer().childNodes[i].innerHTML.indexOf(String.fromCharCode(169))!== -1) {
				map.getContainer().childNodes[i].style.fontSize = '7px';
		  break;
			}
		}
	}

	// create the map
	var map = new GMap2(document.getElementById("map"));
	//map.addControl(new GSmallMapControl());
   	map.disableDragging();

    map.getContainer().style.overflow="hidden";

	setTimeout('MakeCopyrightSmaller();', 2000);

	// Create our "tiny" marker icon
	/*var currentIcon = new GIcon();
	currentIcon.image = "http://labs.google.com/ridefinder/images/mm_20_yellow.png";
	currentIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	currentIcon.iconSize = new GSize(12, 20);
	currentIcon.shadowSize = new GSize(22, 20);
	currentIcon.iconAnchor = new GPoint(6, 20);
	currentIcon.infoWindowAnchor = new GPoint(5, 1);

	var notExactIcon = new GIcon();
	notExactIcon.image = "http://www.offexploring.com/journal/includes/maps/images/yellow_unk.png";
	notExactIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	notExactIcon.iconSize = new GSize(12, 20);
	notExactIcon.shadowSize = new GSize(22, 20);
	notExactIcon.iconAnchor = new GPoint(6, 20);
	notExactIcon.infoWindowAnchor = new GPoint(5, 1);*/

	function readMap(url) {

		//loading message
		var tip = document.createElement('div');
		tip.setAttribute('id','map_loading'); 
		document.getElementById('map').appendChild(tip); 
		tip.style.visibility = 'visible'; 
		var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize((map.getSize().width/2)-77,(map.getSize().height/2)-17));
		pos.apply(document.getElementById('map_loading')); 
		document.getElementById('map_loading').innerHTML = 'Loading&hellip;';

		var request = GXmlHttp.create();
		request.open("GET", url, true);
		request.onreadystatechange = function() {
			if (request.readyState == 4) {
				tip.style.visibility = 'hidden';
				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();

				// clear all existing markers
				// (currently theres a bug in clearOverlays that criples the info window
				// but removing them one-by-one is OK)
				for (i=0; i<gmarkers.length; i++) {
					map.removeOverlay(gmarkers[i]);
				}
				// empty the array
				gmarkers = [];
				linePoints = [];

				for (var i = 0; i < markers.length; i++) {

                   	linePoints = new Array();

					// 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 exact = markers[i].getAttribute("exact");

					var isCenter = markers[i].getAttribute("isCenter");
					var zoom = parseInt(markers[i].getAttribute("zoom"));

					if (isCenter == 1) {
                        map.setCenter(point, zoom);
					}

					else if (i == 0) {
						map.setCenter(point, 3);
					}

					map.setMapType(G_PHYSICAL_MAP);

					if (prevLat && prevLng) {
						linePoints.push(new GLatLng(lat,lng));
						linePoints.push(new GLatLng(prevLat,prevLng));
						//arrowHead(linePoints);
						map.addOverlay(new GPolyline(linePoints,'#666666',2,1));
					}

					var prevLat = lat;
					var prevLng = lng;

					if (exact == 0) {
					   icon = notExactIcon;
					}

					else {
						icon = currentIcon;
					}

					if (markers[i].getAttribute("isFuture") == 1) {
						icon = futureIcon;
					}

					// create the marker
					if (isCenter != 1) {
						var marker = createMarker(point,label,html,icon);
						map.addOverlay(marker);
					}
				}
			}
		}
		request.send(null);
	}
}