// JavaScript Document
var geocoder;
var map;
var partnerTitle='';
var address='';

function load() {
	if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	//map.addControl(new GOverviewMapControl(new GSize(110,110)));
	map.setCenter(new GLatLng(36.11182, -83.29899), 7);
	/*
	GDownloadUrl("/xml/main.xml", function(data) {
		var xml = GXml.parse(data);
		var markers = xml.documentElement.getElementsByTagName("marker");
		for (var i = 0; i < markers.length; i++) {
		var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
								parseFloat(markers[i].getAttribute("lng")));

		map.addOverlay(createMarker(point,markers[i].getAttribute("trailName"),markers[i].getAttribute("trailURL")));
	
		}
	});*/
	if(address.length > 0){
			 // Create new geocoding object
      		geocoder = new GClientGeocoder();

			// Retrieve location information, pass it to addToMap()
			geocoder.getLocations(address, addToMap);
		}
	}
}

function addToMap(response)
   {
      // Retrieve the object
      place = response.Placemark[0];

      // Retrieve the latitude and longitude
      point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);

      // Center the map on this point
      map.setCenter(point, 7);		
      // Create a marker
      marker = new GMarker(point);

      // Add the marker to map
      map.addOverlay(marker);

      // Add address information to marker
      //marker.openInfoWindowHtml(partnerTitle);
	  map.setCenter(new GLatLng(36.11182, -83.29899), 7);
   }