    //<![CDATA[
var map;
var geocoder;

function load() {
	if (GBrowserIsCompatible()) {
    	map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.setCenter(new GLatLng(30.266748, -97.74176), 13);
		geocoder = new GClientGeocoder();
	}
}

// addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
	var nam = document.getElementById("n") ;
	var name = nam.value;
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
		//alert(response.name);
		//alert(place.AddressDetails.Country.AdministrativeArea);
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        //marker.openInfoWindowHtml('<strong style="color: #0071BC;">'+ name + '</strong>' + '<br><hr style="color: #0071BC; width:220px">' + place.place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName + '<br>' + place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName + ', ' + place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName + ' ' + place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber );
		
		marker.openInfoWindowHtml('<strong style="color: #0071BC;">'+ name + '</strong>' + '<br><hr style="color: #0071BC; width:220px">' + response.name );
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
	  var add = document.getElementById("q") ;
	  
      var address = add.value;
	  
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address, name) {
	  var q = document.getElementById("q") ;
	  var n = document.getElementById("n") ;
	  q.value = address;
	  n.value = name;
      showLocation();
    }
    //]]>
