function coordToLocationInfoPost(url, closure_key, lat, lng) {
  var map = new GMap2(document.getElementById('map'));
  map.setCenter(new GLatLng(lat, lng), 13);
  var reversegeocoder = new GReverseGeocoder(map);
  GEvent.addListener(reversegeocoder, "load",
		     function(placemark) {
		       var details = placemark.AddressDetails.Country;
		       var country_code = details.CountryNameCode;
		       var admin_area = details.AdministrativeArea;
		       var administrative_area_name = admin_area.AdministrativeAreaName;
		       var locality_name = admin_area.Locality.LocalityName;
		       var post_params = {
			 'country-code' : country_code,
			 'administrative-area-name' : administrative_area_name, // state
			 'locality-name' : locality_name // city
		       };
		       call_closure(url, closure_key, post_params);
		     }
		     );
  reversegeocoder.reverseGeocode(new GLatLng(lat, lng));
  // no return value
}

/* jquery does something like this, but it wasn't working with Google maps. */

var onLoadThunks = [];

function addOnLoadThunk(thunk) {
  onLoadThunks[onLoadThunks.length] = thunk;
}

function runOnLoadThunks() {
  for (var i = 0; i < onLoadThunks.length; i++) {
    var thunk = onLoadThunks[i];
    thunk();
  }
}

