    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
      	map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(43.2134, 27.9243), 13);
      }
    }


	// this is the Javascript that makes the map.
		var GMapSidebar_html = "";
		var picStr = "../imgs/site/10_t.jpg";
		
	  // arrays to hold copies of the markers and html used by the GMapSidebar
      // 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 = [];
	
	
	// global variables
		var map;
		var request;
		
	// Create our "tiny" marker icon 
	var icons = new Array();
	icons["red"] = new GIcon(); 
	icons["red"].image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; 
	icons["red"].shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; 
	icons["red"].iconSize = new GSize(12, 20);
	icons["red"].shadowSize = new GSize(22, 20); 
	icons["red"].iconAnchor = new GPoint(6, 20); 
	icons["red"].infoWindowAnchor = new GPoint(5, 1); 
	icons["red"].imageMap = [4,0,0,4,0,7,3,11,4,19,7,19,8,11,11,7,11,4,7,0]; 
	icons["red"].transparent = "mapIcons/mm_20_transparent.png";


	//If no color is set in xml then default color red is set.
	//Else color of icon will generate for xml locations.
	
	function get_icon(iconColor) {
	if ((typeof(iconColor)=="undefined") || (iconColor==null)) { 
		iconColor = "red"; 
	}
	if (!icons[iconColor]) {
		icons[iconColor] = new GIcon(icons["red"]);
		icons[iconColor].image = "http://labs.google.com/ridefinder/images/mm_20_"+ iconColor +".png";
	} 
	return icons[iconColor];
	}


// A function to create the marker and set up the event window
// function createMarker(point,name,html) {
function createMarker(point,name,html,labelStr,iconStr,picStr) {

		i++;
		
		if ((typeof(picStr)=="undefined") || (picStr==null) || (picStr=="")) { 
			var picStr = "logo.jpg";
		}
		
		//Create sidebar before the extra window html is created
		GMapSidebar_html += '<font size="1" face="arial"><a href="javascript:myclick(' + i + ')">' + html + '</a></font><br><br>';
		
		//address of location
		html = html + '<br><font size="2" face="arial">' + labelStr + '</font>';
		
		//Picture of location
		html = html + '<br><br><img src="images/'+picStr+'">';  
		
		// The info window version with the "to here" form open
        to_htmls[i] = html + '<font size="2" face="arial"><br><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=35 MAXLENGTH=70 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + //point.lat() + ',' + point.lng() + 
                  "(" + name + ")" + 
           '"/></font><br>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<font size="2" face="arial"><br><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=35 MAXLENGTH=70 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + //point.lat() + ',' + point.lng() +
                  "(" + name + ")" + 
           '"/></font><br>';
      
        // The inactive version of the direction info
        html = html + '<font size="2" face="arial"><br><br><b>Directions:</b> <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a></font><br><br>';
        
        //FF 1.5 fix
        //html = '<div style="white-space:nowrap;">' + html + '</div>';
        //var marker = new GMarker(point);
	
		if (iconStr) {
            var marker = new GMarker(point, get_icon(iconStr));
        }
		
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        
        // save the info we need to use later for the GMapSidebar
        gmarkers[i] = marker;
        htmls[i] = html;
        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]);
      }


function makeMap() {
    if (GBrowserIsCompatible()) {
      // resize the map
      var m = document.getElementById("map");
      m.style.height = "600px";
      m.style.width = "500px";

      // create the map
      map = new GMap(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(40.3130432088809, -85.858154296875), 8);
      
		// indiana tech image anchor on map	vvvvvvvvvvvvvvvvvvvvvv
		var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(65,5));
      	pos.apply(document.getElementById("control"));
      	map.getContainer().appendChild(document.getElementById("control"));
      
    } else {
      alert("your browser does not support Google Maps!");
    }

   getXMLfile();

}

function getXMLfile() {
   // Read the data from xml
   request = GXmlHttp.create();
   filename = "locations.xml";
   request.open("GET", filename, true);
   request.onreadystatechange = processXMLfile;
   request.send(null);
   return false;
}

function processXMLfile() {

  if (request.readyState == 4) {
    if ((request.status == 200) || (request.status == 304)) {
       var xmlDoc = request.responseXML;
       if (xmlDoc.documentElement) {
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");

          map.clearOverlays();
          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 icon = markers[i].getAttribute("icon");
            var pic = markers[i].getAttribute("pic");
            // create the marker
            var marker = createMarker(point,label,html,label,icon,pic);
            map.addOverlay(marker);
          }
          // put the assembled GMapSidebar_html contents into the GMapSidebar div
          document.getElementById("GMapSidebar").innerHTML = GMapSidebar_html;
       } 
    } 
  }
}

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team

    //]]>
