--- D:/webdesign/drupal/Drupal-6/imagemenu-6.x-1.0/imagemenu/imagemenu.admin.inc	Fri Mar 21 19:27:28 2008
+++ D:/webdesign/drupal/Drupal-6/updates/imagemenu-6.x-1.0/imagemenu.admin.inc	Sat Jul 25 23:56:54 2009
@@ -8,2 +8,6 @@
 
+/**
+ * 2009-07-24	hovel	Incorect parent problem repaired. Ref http://drupal.org/node/523354
+ * 2009-07-25 hovel	Watchdog calls converted to D6 format
+ */
 
@@ -286,4 +290,9 @@
 function imagemenu_edit_item(&$form_state, $type, $item, $menu) {
-  $mid = isset($menu['mid']) ? $menu['mid'] : 0;
-
+  if ($type == 'add' || empty($item)) {
+    $mid = isset($menu['mid']) ? $menu['mid'] : 0;
+    }
+  if ($type == 'edit') {
+    $mid = $item['mid'];
+  }
+  
   $form['menu'] = array(
@@ -385,3 +394,3 @@
   // comfortable redirects after adding/editing
-  if ($mid) {
+  if ($type == 'add')  { // ($mid)
     $pmid = $mid;
@@ -422,3 +431,3 @@
     $t_args = array('%title' => $item['title']);
-    watchdog('imagemenu', t('Added new Imagemenu menu item %title', $t_args), WATCHDOG_NOTICE);
+    watchdog('imagemenu', 'Added new Imagemenu menu item %title', $t_args, WATCHDOG_NOTICE);
   }
@@ -428,3 +437,3 @@
     $t_args = array('%title' => $item['title']);
-    watchdog('imagemenu', t('Updated Imagemenu menu item %title', $t_args), WATCHDOG_NOTICE);
+    watchdog('imagemenu', 'Updated Imagemenu menu item %title', $t_args, WATCHDOG_NOTICE);
   }
