anchor.diff:  function getAddress(latlng) {
     $('location-fields').addClassName("loading");
   
  -   if (latlng != null) {
  +  if (latlng != null) {
       geocoder.geocode( {'latLng': latlng}, showAddress);
  -   }
  +  }
   }
   
   function codeAddress() {
  
positive.code:     }
    });
  
  
    jQuery("#profile_data_city").catcomplete({
      source: "../maps/search_city",
      minLength: 3,
  
negative.code: }
  
  function showAddress(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      updateFields(results[0]);
      map.setCenter(marker.getPosition());
    } else {
      alert("<%=_("Address not found, reason:")%>" + translate_status(status));
    }
  }
  
  function updateFields(place) {
    $('location-fields').removeClassName("loading");
  
    var position = marker.getPosition();
    $('profile_data_lat').value = position.lat();
    $('profile_data_lng').value = position.lng();
  
    form = jQuery('#location-form')[0];
    form.lat = marker.getPosition().lat();
    form.lng = marker.getPosition().lng();
  
    var components_len = place.address_components.size();
    if (components_len < 2)
      return;
  
    var address = "";
    var zip_code = "";
    var city = "";
    var state = "";
    var country_code = "";
  
    var i;
    for(i=0; i < components_len; i++) {
      type = place.address_components[i].types[0];
      value = place.address_components[i];
      if (type == 'country')
        country_code = value.short_name;
      else if (type == 'administrative_area_level_1')
        state = value.long_name;
      else if (type == 'locality')
        city  = value.long_name;
      else if (type == 'sublocality')
        address  = value.long_name  + "-" + address;
      else if (type == "route")
        address = value.long_name + address;
      else if (type == "street_number")
        address =  address + "," + value.short_name;
      else if (type == 'postal_code')
        zip_code = value.short_name;
    }
  
    if (country_code)
      $('profile_data_country').value = country_code;
    if (state)
      $('profile_data_state').value = state;
    if (address)
      $('profile_data_address').value = address;
    if (city)
      $('profile_data_city').value = city;
    if (zip_code)
      $('profile_data_zip_code').value = zip_code;
  }
  
  
  