	function iniFromField(){
	
	addEvent($('dir_from'), 'focus', fromFocus);
	addEvent($('dir_from'), 'blur', fromBlur);
	$('dir_from').value = defaultFromValue;
	
	}
	
	function fromFocus(){
		var fr = $('dir_from');
		var val = $F('dir_from');
		if (val == defaultFromValue){
			fr.value = '';
		}
	
	}
		
		
	function fromBlur(){
		var fr = $('dir_from');
		var val = $F('dir_from');
		if (trim(val) == ''){
			fr.value = defaultFromValue;
		}
	
	}
	function iniDirections(){
	 			if (GBrowserIsCompatible()) {
					gdir = new GDirections(map, document.getElementById("directions"));
					GEvent.addListener(gdir, "load", onGDirectionsLoad);
					GEvent.addListener(gdir, "error", handleErrors);
				}
	}
function setDirections(fromAddress, toAddress, locale) {
	//alert("from: " + fromAddress + " to: " + toAddress + " locale: " + locale);
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
								 $('direction-warning').hide();
    }

	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}
	function addEvent(obj, evType, fn){ 
	 if (obj.addEventListener){ 
		 obj.addEventListener(evType, fn, false); 
		 return true; 
	 } else if (obj.attachEvent){ 
		 var r = obj.attachEvent("on"+evType, fn); 
		 return r; 
	 } else { 
		 return false; 
	 } 
	}
	
	
	
	function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     msg = ("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\n Please corect your address and try again."); //Error code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     msg = ("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     msg = ("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     msg = ("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     msg = ("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else msg = ("An unknown error occurred.");
	   
		 $('direction-warning').show();
		 $('direction-warning').update(msg);
	}
	
	
	function initialize() {

 if (GBrowserIsCompatible()) {
	 
	 	// set up map objects
    map 		= new GMap2($("map_canvas"));
		//center 	= new GLatLng(defaultlat, defaultlon); // center on default
		//geo 		= new GClientGeocoder();
		
		// make center the lat lon fields
		center 	= new GLatLng(lat, lon);
		lev = 15;	
		// set up the draggable marker
		marker 	= new GMarker(center, {draggable: false, title: ''});
		// center the map
		map.setCenter(center, lev);
		// add the marker
		map.addOverlay(marker);
		// map zoom controls
		map.addControl(new GSmallMapControl());
		
	}// end if browser compatible...

}