
// create a new locator (map with a fixed point in the center)
function create_locator(elm, lat, lon, zoom, callback, localsearch, searchcallback) {
  Event.observe(document, 'dom:loaded', function(){
    elm = $(elm);

    if (GBrowserIsCompatible()) {
      // create our map within the given element
      var map = new GMap2(elm);
      // general controls
      map.addControl(new GSmallMapControl());
      
      if (localsearch) {
        // add the search control
        var ls = new google.maps.LocalSearch(
            {
              resultList : $('deadlist')
            , suppressInitialResultSelection : true
            , onMarkersSetCallback : searchcallback
            });
        map.addControl(ls, new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10)));
      }

      // start with the map in the desired location
      map.setCenter(new GLatLng(lat, lon), zoom);

      // put a marker in the center
      var marker = map.addOverlay(new GMarker(map.getCenter()));

      // when the map is moved around...
      GEvent.addListener(map, "moveend", function() {
        // remove the old marker
        map.clearOverlays();

        // set a new one at the new center
        var center = map.getCenter();
        map.addOverlay(new GMarker(center));

        // do the callback with the new lat/lon
        if (callback)
          callback(center);
      });
    }
  });
}
