Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java	(revision 29380)
@@ -1,4 +1,5 @@
 package iodb;
 
+import iodb.QuerySuccessListener;
 import java.awt.event.ActionEvent;
 import java.io.UnsupportedEncodingException;
@@ -18,4 +19,5 @@
 public class DeprecateOffsetAction extends AbstractAction {
     private ImageryOffsetBase offset;
+    private QuerySuccessListener listener;
     
     public DeprecateOffsetAction( ImageryOffsetBase offset ) {
@@ -37,8 +39,16 @@
             return;
         }
-        deprecateOffset(offset);
+        deprecateOffset(offset, listener);
+    }
+
+    public void setListener( QuerySuccessListener listener ) {
+        this.listener = listener;
     }
 
     public static void deprecateOffset( ImageryOffsetBase offset ) {
+        deprecateOffset(offset, null);
+    }
+
+    public static void deprecateOffset( ImageryOffsetBase offset, QuerySuccessListener listener ) {
         String userName = JosmUserIdentityManager.getInstance().getUserName();
         if( userName == null ) {
@@ -58,4 +68,6 @@
                 + "&reason=" + URLEncoder.encode(reason, "UTF8");
             SimpleOffsetQueryTask depTask = new SimpleOffsetQueryTask(query, tr("Notifying the server of the deprecation..."));
+            if( listener != null )
+                depTask.setListener(listener);
             Main.worker.submit(depTask);
         } catch( UnsupportedEncodingException ex ) {
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java	(revision 29380)
@@ -61,22 +61,7 @@
             return;
         }
-        final ImageryOffsetBase offset = new OffsetDialog(offsets).showDialog();
-        if( offset != null ) {
-            if( offset instanceof ImageryOffset ) {
-                ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset)offset);
-                Main.map.repaint();
-            } else if( offset instanceof CalibrationObject ) {
-                CalibrationLayer clayer = new CalibrationLayer((CalibrationObject)offset);
-                Main.map.mapView.addLayer(clayer);
-                clayer.panToCenter();
-                if( !Main.pref.getBoolean("iodb.calibration.message", false) ) {
-                    JOptionPane.showMessageDialog(Main.parent,
-                            tr("A layer has been added with a calibration geometry. Hide data layers,\n"
-                            + "find the corresponding feature on the imagery layer and move it accordingly."),
-                            ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
-                    Main.pref.put("iodb.calibration.message", true);
-                }
-            }
-        }
+        OffsetDialog offsetDialog = new OffsetDialog(offsets);
+        if( offsetDialog.showDialog() != null )
+            offsetDialog.applyOffset();
     }
 
@@ -92,5 +77,5 @@
                 int radius = Main.pref.getInteger("iodb.radius", -1);
                 if( radius > 0 )
-                    query = query + "?radius=" + radius;
+                    query = query + "&radius=" + radius;
                 setQuery(query);
             } catch( UnsupportedEncodingException e ) {
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java	(revision 29380)
@@ -1,4 +1,5 @@
 package iodb;
 
+import java.text.MessageFormat;
 import java.util.*;
 import org.openstreetmap.josm.Main;
@@ -177,5 +178,5 @@
         LatLon correctedCenterLL = proj.eastNorth2latlon(pos.add(dx, dy));
         double length = correctedCenterLL.greatCircleDistance(offset.getImageryPos());
-        double direction = length < 1e-3 ? 0.0 : correctedCenterLL.heading(offset.getImageryPos());
+        double direction = length < 1e-2 ? 0.0 : correctedCenterLL.heading(offset.getImageryPos());
         // todo: north vs south. Meanwhile, let's fix this dirty:
         direction = Math.PI - direction;
@@ -186,11 +187,15 @@
 
     public static String formatDistance( double d ) {
-        if( d < 0.0095 ) return tr("{0,number,0} mm", d * 1000);
-        if( d < 0.095 ) return tr("{0,number,0.0} cm", d * 100);
-        if( d < 0.95) return tr("{0,number,0} cm", d * 100);
-        if( d < 9.5 ) return tr("{0,number,0.0} m", d);
-        if( d < 950 ) return tr("{0,number,0} m", d);
-        if( d < 9500 ) return tr("{0,number,0.0} km", d / 1000);
-        return tr("{0,number,0} km", d / 1000);
+        if( d < 0.0095 ) return formatDistance(d * 1000, tr("mm"), false);
+        if( d < 0.095 )  return formatDistance(d * 100,  tr("cm"), true );
+        if( d < 0.95 )   return formatDistance(d * 100,  tr("cm"), false);
+        if( d < 9.5 )    return formatDistance(d,        tr("m"),  true );
+        if( d < 950 )    return formatDistance(d,        tr("m"),  false );
+        if( d < 9500 )   return formatDistance(d / 1000, tr("km"), true);
+        return formatDistance(d / 1000, tr("km"), false);
+    }
+
+    private static String formatDistance( double d, String si, boolean floating ) {
+        return MessageFormat.format(floating ? "{0,number,0.0} {1}" : "{0,number,0} {1}", d, si);
     }
 
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 29380)
@@ -11,6 +11,10 @@
 import javax.swing.border.EmptyBorder;
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.gui.JosmUserIdentityManager;
+import org.openstreetmap.josm.gui.NavigatableComponent;
+import org.openstreetmap.josm.gui.layer.ImageryLayer;
 import static org.openstreetmap.josm.tools.I18n.tr;
+import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.OpenBrowser;
 
 /**
@@ -19,8 +23,9 @@
  * @author zverik
  */
-public class OffsetDialog extends JDialog implements ActionListener {
+public class OffsetDialog extends JDialog implements ActionListener, NavigatableComponent.ZoomChangeListener {
     protected static final String PREF_CALIBRATION = "iodb.show.calibration";
     protected static final String PREF_DEPRECATED = "iodb.show.deprecated";
     private static final int MAX_OFFSETS = Main.main.pref.getInteger("iodb.max.offsets", 5);
+    private static final boolean MODAL = false; // modal does not work for executing actions
 
     private List<ImageryOffsetBase> offsets;
@@ -29,8 +34,10 @@
 
     public OffsetDialog( List<ImageryOffsetBase> offsets ) {
-        super(JOptionPane.getFrameForComponent(Main.parent), ImageryOffsetTools.DIALOG_TITLE, ModalityType.DOCUMENT_MODAL);
+        super(JOptionPane.getFrameForComponent(Main.parent), ImageryOffsetTools.DIALOG_TITLE,
+                MODAL ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
         setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-//        setResizable(false);
+        setResizable(false);
         this.offsets = offsets;
+        NavigatableComponent.addZoomChangeListener(this);
 
         // make this dialog close on "escape"
@@ -61,12 +68,15 @@
         checkBoxPanel.add(calibrationBox);
         checkBoxPanel.add(deprecatedBox);
-        JButton cancelButton = new JButton("Cancel");
+        JButton cancelButton = new JButton(tr("Cancel"), ImageProvider.get("cancel"));
         cancelButton.addActionListener(this);
-        cancelButton.setAlignmentX(CENTER_ALIGNMENT);
+        JButton helpButton = new JButton(new HelpAction());
+        JPanel cancelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        cancelPanel.add(cancelButton);
+        cancelPanel.add(helpButton);
 
         Box dialog = new Box(BoxLayout.Y_AXIS);
         dialog.add(buttonPanel);
         dialog.add(checkBoxPanel);
-        dialog.add(cancelButton);
+        dialog.add(cancelPanel);
 
         dialog.setBorder(new CompoundBorder(dialog.getBorder(), new EmptyBorder(5, 5, 5, 5)));
@@ -87,6 +97,9 @@
             JPopupMenu popupMenu = new JPopupMenu();
             popupMenu.add(new OffsetInfoAction(offset));
-            if( !offset.isDeprecated() )
-                popupMenu.add(new DeprecateOffsetAction(offset));
+            if( !offset.isDeprecated() ) {
+                DeprecateOffsetAction action = new DeprecateOffsetAction(offset);
+                action.setListener(new DeprecateOffsetListener(offset));
+                popupMenu.add(action);
+            }
             button.setComponentPopupMenu(popupMenu);
             buttonPanel.add(button);
@@ -110,4 +123,12 @@
         return filteredOffsets;
     }
+
+    public void zoomChanged() {
+        for( Component c : buttonPanel.getComponents() ) {
+            if( c instanceof OffsetDialogButton ) {
+                ((OffsetDialogButton)c).updateLocation();
+            }
+        }
+    }
     
     public ImageryOffsetBase showDialog() {
@@ -118,4 +139,31 @@
     }
 
+    public void applyOffset() {
+        if( selectedOffset instanceof ImageryOffset ) {
+            ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
+            ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset)selectedOffset);
+            Main.map.repaint();
+            if( !Main.pref.getBoolean("iodb.offset.message", false) ) {
+                JOptionPane.showMessageDialog(Main.parent,
+                        tr("The topmost imagery layer has been shifted to presumably match\n"
+                        + "OSM data in the area. Please check that the offset is still valid\n"
+                        + "by downloading GPS tracks and comparing them and OSM data to the imagery."),
+                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
+                Main.pref.put("iodb.offset.message", true);
+            }
+        } else if( selectedOffset instanceof CalibrationObject ) {
+            CalibrationLayer clayer = new CalibrationLayer((CalibrationObject)selectedOffset);
+            Main.map.mapView.addLayer(clayer);
+            clayer.panToCenter();
+            if( !Main.pref.getBoolean("iodb.calibration.message", false) ) {
+                JOptionPane.showMessageDialog(Main.parent,
+                        tr("A layer has been added with a calibration geometry. Hide data layers,\n"
+                        + "find the corresponding feature on the imagery layer and move it accordingly."),
+                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
+                Main.pref.put("iodb.calibration.message", true);
+            }
+        }
+    }
+
     public void actionPerformed( ActionEvent e ) {
         if( e.getSource() instanceof OffsetDialogButton ) {
@@ -123,5 +171,36 @@
         } else
             selectedOffset = null;
+        NavigatableComponent.removeZoomChangeListener(this);
         setVisible(false);
+        if( !MODAL && selectedOffset != null )
+            applyOffset();
+    }
+
+    private class DeprecateOffsetListener implements QuerySuccessListener {
+        ImageryOffsetBase offset;
+
+        public DeprecateOffsetListener( ImageryOffsetBase offset ) {
+            this.offset = offset;
+        }
+
+        public void queryPassed() {
+            offset.setDeprecated(new Date(), JosmUserIdentityManager.getInstance().getUserName(), "");
+            updateButtonPanel();
+        }
+    }
+
+    class HelpAction extends AbstractAction {
+
+        public HelpAction() {
+            super(tr("Help"));
+            putValue(SMALL_ICON, ImageProvider.get("help"));
+        }
+
+        public void actionPerformed( ActionEvent e ) {
+            String base = "http://wiki.openstreetmap.org/wiki/";
+            String page = "Imagery_Offset_Database";
+            String lang = "RU:"; // todo: determine it
+            OpenBrowser.displayUrl(base + lang + page);
+        }
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java	(revision 29380)
@@ -24,14 +24,21 @@
     public OffsetDialogButton( ImageryOffsetBase offset ) {
         super();
+        this.offset = offset;
         setMinimumSize(new Dimension(500, 10));
         setMaximumSize(new Dimension(500, 150));
-        setText("<html>"
-                + Math.round(offset.getPosition().greatCircleDistance(ImageryOffsetTools.getMapCenter())) + " m: "
-                + offset.getDescription() + "</html>");
+        setRelevantText();
         setIcon(new OffsetIcon(offset));
-        this.offset = offset;
 
         offsetLength = offset instanceof ImageryOffset ? getLengthAndDirection((ImageryOffset)offset)[0] : 0.0;
         // todo: layout, info, map distance and direction
+    }
+
+    /**
+     * Update text on the button. This method is to be deleted by release.
+     */
+    public void setRelevantText() {
+        setText("<html>"
+                + ImageryOffsetTools.formatDistance(offset.getPosition().greatCircleDistance(ImageryOffsetTools.getMapCenter()))
+                + ": " + offset.getDescription() + "</html>");
     }
 
@@ -46,4 +53,12 @@
         size.height = 70;
         return size;
+    }
+
+    /**
+     * Update arrow for the offset location.
+     */
+    public void updateLocation() {
+        // map was moved, update arrow.
+        setRelevantText();
     }
 
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java	(revision 29380)
@@ -36,5 +36,5 @@
         if( offset instanceof ImageryOffset ) {
             double[] ld = ImageryOffsetTools.getLengthAndDirection((ImageryOffset)offset);
-            sb.append(ld[0] < 1e-3 ? tr("An imagery offset of 0 mm") : tr("An imagery offset of {0} to {1}",
+            sb.append(ld[0] < 1e-2 ? tr("An imagery offset of 0 mm") : tr("An imagery offset of {0} to {1}",
                     ImageryOffsetTools.formatDistance(ld[0]), explainDirection(ld[1]))).append('\n');
             sb.append("Imagery ID: ").append(((ImageryOffset)offset).getImagery()).append('\n');
@@ -44,6 +44,6 @@
         
         double dist = ImageryOffsetTools.getMapCenter().greatCircleDistance(offset.getPosition());
-        double heading = dist < 1 ? 0.0 : ImageryOffsetTools.getMapCenter().heading(offset.getPosition());
-        sb.append(dist < 10 ? tr("Determined right here") : tr("Determined at a point {0} to the {1}",
+        double heading = dist < 10 ? 0.0 : ImageryOffsetTools.getMapCenter().heading(offset.getPosition());
+        sb.append(dist < 50 ? tr("Determined right here") : tr("Determined at a point {0} to the {1}",
                 ImageryOffsetTools.formatDistance(dist), explainDirection(heading)));
         
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java	(revision 29380)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java	(revision 29380)
@@ -0,0 +1,14 @@
+package iodb;
+
+/**
+ * A listener for {@link SimpleOffsetQueryTask}.
+ *
+ * @author zverik
+ */
+interface QuerySuccessListener {
+
+    /**
+     * Query has been processed and did not fail.
+     */
+    void queryPassed();
+}
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java	(revision 29380)
@@ -22,4 +22,5 @@
     private String title;
     protected boolean cancelled;
+    private QuerySuccessListener listener;
 
     public SimpleOffsetQueryTask( String query, String title ) {
@@ -32,4 +33,12 @@
     public void setQuery( String query ) {
         this.query = query;
+    }
+
+    public void setListener( QuerySuccessListener listener ) {
+        this.listener = listener;
+    }
+
+    public void removeListener() {
+        this.listener = null;
     }
 
@@ -50,5 +59,5 @@
         try {
             URL url = new URL(ImageryOffsetTools.getServerURL() + query);
-            System.out.println("url=" + url);
+            System.out.println("url=" + url); // todo: remove in release
             HttpURLConnection connection = (HttpURLConnection)url.openConnection();
             connection.connect();
@@ -79,4 +88,6 @@
         if( errorMessage != null ) {
             JOptionPane.showMessageDialog(Main.parent, errorMessage, tr("Imagery Offset"), JOptionPane.ERROR_MESSAGE);
+        } else if( listener != null ) {
+            listener.queryPassed();
         }
     }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 29379)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 29380)
@@ -132,4 +132,6 @@
         if( ImageryOffsetTools.getTopImageryLayer() == null )
             state = false;
+        if( getCurrentDataSet() == null )
+            state = false;
         setEnabled(state);
     }
Index: plications/editors/josm/plugins/imagery_offset_db/src/iodb/UploadDialog.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/UploadDialog.java	(revision 29379)
+++ 	(revision )
@@ -1,42 +1,0 @@
-package iodb;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.*;
-import org.openstreetmap.josm.Main;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-/**
- * A dialog for uploading stuff. Can be extended for different types of offsets.
- * 
- * @author zverik
- */
-public class UploadDialog extends JDialog implements ActionListener {
-
-    public UploadDialog() {
-        super(JOptionPane.getFrameForComponent(Main.parent), tr("Imagery Offset"), ModalityType.DOCUMENT_MODAL);
-        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-    }
-    
-    private void prepareDialog() {
-        JPanel dialogPanel = new JPanel(new BorderLayout());
-        setContentPane(dialogPanel);
-        pack();
-        setLocationRelativeTo(Main.parent);
-    }
-
-    public ImageryOffsetBase showDialog() {
-        prepareDialog();
-        setVisible(true);
-        return null;
-    }
-    
-    protected void constructImageryOffset() {
-        
-    }
-
-    public void actionPerformed( ActionEvent e ) {
-        setVisible(false);
-    }
-}
