Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java	(revision 2968)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java	(revision 2969)
@@ -122,7 +122,6 @@
          * in the last panel anyway.
          */
-        int k = N-1;                // index of the current Panel (start with last one)
-        JPanel p = panels.get(k);   // current Panel
-        k = -1;                     // indicates that the current Panel index is N-1, but no default-view-Dialog was added to this Panel yet.
+        JPanel p = panels.get(N-1); // current Panel (start with last one)
+        int k = -1;                 // indicates that the current Panel index is N-1, but no default-view-Dialog has been added to this Panel yet.
         for (int i=N-1; i >= 0 ; --i) {
             final ToggleDialog dlg = allDialogs.get(i);
@@ -171,12 +170,20 @@
                 if (dlg.isDialogInDefaultView()) {
                     if (dlg != triggeredBy) {
-                        final int ph = dlg.getPreferredHeight();
-                        final int ah = dlg.getHeight();
-                        sumP += ph;
-                        sumA += ah;
+                        sumP += dlg.getPreferredHeight();
+                        sumA += dlg.getHeight();
                     }
                 } else if (dlg.isDialogInCollapsedView()) {
                     sumC += dlg.getHeight();
                 }
+            }
+            
+            /**
+             * If we add additional dialogs on startup (e.g. geoimage), they may 
+             * not have an actual height yet.
+             * In this case we simply reset everything to it's preferred size.
+             */
+            if (sumA == 0) {
+                reconstruct(Action.ELEMENT_SHRINKS, null);
+                return;
             }
 
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 2968)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 2969)
@@ -50,4 +50,5 @@
     protected ToggleDialogAction toggleAction;
     protected String preferencePrefix;
+    final protected String name;
 
     /** DialogsPanel that manages all ToggleDialogs */
@@ -100,4 +101,5 @@
         super(new BorderLayout());
         this.preferencePrefix = iconName;
+        this.name = name;
 
         /** Use the full width of the parent element */
@@ -516,4 +518,10 @@
         return "Dialog/"+help;
     }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
     /**
      * Replies true if this dialog is showing either as docked or as detached dialog
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java	(revision 2968)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java	(revision 2969)
@@ -236,18 +236,10 @@
                 Main.main.addLayer(layer);
                 layer.hook_up_mouse_events(); // Main.map.mapView should exist
-                // now. Can add mouse listener
+                                              // now. Can add mouse listener
                 Main.map.mapView.addPropertyChangeListener(layer);
-                if (!addedToggleDialog) {
-                    // TODO Workaround for bug in DialogsPanel
-                    // When GeoImageLayer is added as a first layer, division by zero exception is thrown
-                    // This is caused by DialogsPanel.reconstruct method which use height of other dialogs
-                    // to calculate height of newly added ImageViewerDialog. But height of other dialogs is
-                    // zero because it's calculated by layout manager later
-                    SwingUtilities.invokeLater(new Runnable() {
-                        public void run() {
-                            Main.map.addToggleDialog(ImageViewerDialog.getInstance());
-                        }
-                    });
-                    addedToggleDialog = true;
+                if (Main.map.getToggleDialog(ImageViewerDialog.class) == null) {
+                    System.err.println("JO");
+                    ImageViewerDialog.newInstance();// = new ImageViewerDialog();
+                    Main.map.addToggleDialog(ImageViewerDialog.getInstance());
                 }
 
@@ -271,6 +263,4 @@
     }
 
-    private static boolean addedToggleDialog = false;
-
     public static void create(Collection<File> files, GpxLayer gpxLayer) {
         Loader loader = new Loader(files, gpxLayer);
@@ -291,5 +281,5 @@
         return ImageProvider.get("dialogs/geoimage");
     }
-    
+
     public static interface LayerMenuAddition {
         public Component getComponent(Layer layer);
@@ -306,5 +296,5 @@
         JMenuItem correlateItem = new JMenuItem(tr("Correlate to GPX"), ImageProvider.get("dialogs/geoimage/gpx2img"));
         correlateItem.addActionListener(new CorrelateGpxWithImages(this));
-        
+
         List<Component> entries = new ArrayList<Component>();
         entries.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)));
@@ -323,5 +313,5 @@
 
         return entries.toArray(new Component[0]);
-        
+
     }
 
@@ -335,5 +325,5 @@
         + " " + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", i, i);
     }
-    
+
     @Override public Object getInfoComponent() {
         return infoText();
@@ -752,5 +742,5 @@
         Main.map.mapView.repaint();
     }
-    
+
     public List<ImageEntry> getImages() {
         List<ImageEntry> copy = new ArrayList<ImageEntry>();
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java	(revision 2968)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java	(revision 2969)
@@ -44,14 +44,18 @@
     private boolean centerView = false;
 
-    // Only one instance of that class
-    static private ImageViewerDialog INSTANCE = null;
+    // Only one instance of that class is present at one time
+    private static ImageViewerDialog dialog;
 
     private boolean collapseButtonClicked = false;
 
+    static void newInstance() {
+        dialog = new ImageViewerDialog();
+    }
+
     public static ImageViewerDialog getInstance() {
-        if (INSTANCE == null) {
-            INSTANCE = new ImageViewerDialog();
-        }
-        return INSTANCE;
+        if (dialog == null) {
+            throw new AssertionError(); // a new instance needs to be created first
+        }
+        return dialog;
     }
 
@@ -63,14 +67,8 @@
         super(tr("Geotagged Images"), "geoimage", tr("Display geotagged images"), Shortcut.registerShortcut("tools:geotagged", tr("Tool: {0}", tr("Display geotagged images")), KeyEvent.VK_Y, Shortcut.GROUP_EDIT), 200);
 
-        if (INSTANCE != null) {
-            throw new IllegalStateException("Image viewer dialog should not be instanciated twice !");
-        }
-
         /* Don't show a detached dialog right from the start. */
         if (isShowing && !isDocked) {
             setIsShowing(false);
         }
-
-        INSTANCE = this;
 
         JPanel content = new JPanel();
@@ -254,5 +252,5 @@
             //    osd.append(tr("\nImage gps time: {0}", Long.toString(entry.getGpsTime().getTime())));
             //}
-            
+
             imgDisplay.setOsdText(osd.toString());
         } else {
Index: /trunk/styles/standard/elemstyles.xml
===================================================================
--- /trunk/styles/standard/elemstyles.xml	(revision 2968)
+++ /trunk/styles/standard/elemstyles.xml	(revision 2969)
@@ -4237,5 +4237,5 @@
 	<rule>
 		<condition k="tiger:reviewed" v="no"/>
-		<linemod mode="under" width="10" colour="tiger_data#808000"/>
+		<linemod mode="under" width="10" colour="tiger_data#80800090"/>
 	</rule>
 
