function load() {
//~Check to see if object exists
    if (document.getElementById("map"))
    {
//~All this stuff draws the static lines and route markers(70)
//~A function to create the marker and set up the event window

      function createMarker(point,name,html,icon) {
        var marker = new GMarker(point,{icon:icon});
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }

//~This function picks up the click and opens the corresponding info window
//~for the route70 markers
//~      function myclick(i) {
//~        gmarkers[i].openInfoWindowHtml(htmls[i]);
//~      }

//~ Read the data from routes100.xml
      var request = GXmlHttp.create();
      request.open("GET", "routes100.xml", 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");
          
          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 = markers[i].getAttribute("icontype");
              var icontype = icon70;
//~create the marker
            var marker = createMarker(point,label,html,icontype);
            map.addOverlay(marker);
          }
 
//~========= Now process the polylines ===========
          var lines = xmlDoc.documentElement.getElementsByTagName("line");
//~read each line
          for (var a = 0; a < lines.length; a++) {
//~get any line attributes
            var colour = lines[a].getAttribute("colour");
            var width  = parseFloat(lines[a].getAttribute("width"));
//~read each point on that line
            var points = lines[a].getElementsByTagName("point");
            var pts = [];
            for (var i = 0; i < points.length; i++) {
               pts[i] = new GLatLng(parseFloat(points[i].getAttribute("lat")),
                                   parseFloat(points[i].getAttribute("lng")));
            }
            map.addOverlay(new GPolyline(pts,colour,width));
          }
//~================================================           
        }
      }
      request.send(null);
//~If object exists - end bracket
  }
//~********************************
}
    
window.onload = load; 



