  var map = null;
  var geocoder = null;
  var icon = null;
  function showPosition(lon, lat){
    document.getElementById("map").style.display = "block"; 
    map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(lat,lon), 14);
    map.addControl(new GSmallMapControl());
    //map.addControl(new GOverviewMapControl());
    map.addControl(new GMapTypeControl());
    geocoder = new GClientGeocoder();

    icon = new GIcon();
    icon.image = "/images/map_pin.png";
    icon.iconSize = new GSize(17, 28);
    icon.iconAnchor = new GPoint(50, 50);
    var marker = new GMarker(map.getCenter(), icon);
    map.addOverlay(marker);

    GEvent.addListener(map, "move", function() { 
        map.clearOverlays()
        marker = new GMarker(map.getCenter(), icon);
        map.addOverlay(marker);
        showLatLon();
        });

  }

  function showAddress(address) {
    geocoder = new GClientGeocoder();
    if (geocoder) {
      geocoder.getLatLng(
      address,
      function (point) {
        if (!point) {
          //nothing to display
        } else {
          document.getElementById("map").style.display = "block"; 
          map = new GMap2(document.getElementById("map"));
          map.addControl(new GSmallMapControl());
          map.addControl(new GMapTypeControl());
          map.setCenter(point, 14);

          icon = new GIcon();
          icon.image = "/images/map_pin.png";
          icon.iconSize = new GSize(17, 28);
          icon.iconAnchor = new GPoint(50, 50);
          var marker = new GMarker(point);
          map.addOverlay(marker);
        }
      }
      );
    }
  }
    showLatLon= function(){
      var pointc = map.getCenter()
          try{
      parent.document.getElementById("item_lon").value=pointc.x;
      parent.document.getElementById("item_lat").value=pointc.y;
          }catch(e){};
    };

