Index: dhtml_menu.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dhtml_menu/dhtml_menu.install,v
retrieving revision 1.9
diff -u -p -r1.9 dhtml_menu.install
--- dhtml_menu.install	8 Jul 2008 13:44:25 -0000	1.9
+++ dhtml_menu.install	3 Apr 2009 22:49:10 -0000
@@ -70,3 +70,14 @@ function dhtml_menu_update_6002() {
   return array();
 }
 
+/**
+ * #7101: 7.x-1.x-dev upgrade (duplicated in 6.x-3.x). Remove two obsolete variables and rebuild all themes.
+ */
+function dhtml_menu_update_7101() {
+  variable_del('dhtml_menu_theme_menu_item');
+  variable_del('dhtml_menu_theme_menu_item_link');
+
+  drupal_theme_rebuild();
+  return array();
+}
+
Index: dhtml_menu.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dhtml_menu/dhtml_menu.module,v
retrieving revision 1.39
diff -u -p -r1.39 dhtml_menu.module
--- dhtml_menu.module	20 Nov 2008 19:12:51 -0000	1.39
+++ dhtml_menu.module	3 Apr 2009 22:49:10 -0000
@@ -43,9 +43,12 @@ function dhtml_menu_init() {
  * follow the recursion of menu_tree_output().
  */
 function dhtml_menu_theme_menu_item_link($link) {
-  static $disabled;
+  global $theme;
+  static $disabled, $function;
   if (!isset($disabled)) {
     $disabled = variable_get('dhtml_menu_disabled', array());
+    $registry = variable_get('dhtml_menu_theme', array());
+    $function = isset($registry[$theme]) && drupal_function_exists($registry[$theme]['menu_item_link']) ? $registry[$theme]['menu_item_link'] : 'theme_menu_item_link';
   }
 
   // TODO: Find out why options sometimes are serialized. Fix this workaround before D7 release!
@@ -54,7 +57,8 @@ function dhtml_menu_theme_menu_item_link
   }
 
   if (!isset($link['menu_name']) || !isset($link['mlid']) || !empty($disabled[$link['menu_name']])) {
-    $link['dhtml_disabled'] = TRUE;
+    $link['dhtml_disabled'] = TRUE; 
+    return $function($link);
   }
 
   $link['localized_options']['attributes']['id'] = 'dhtml_menu-' . _dhtml_menu_unique_id($link['mlid']);
@@ -63,8 +67,7 @@ function dhtml_menu_theme_menu_item_link
   _dhtml_menu_stack($link);
 
   // Pass the altered variables to the normal menu themer.
-  $theme = variable_get('dhtml_menu_theme_menu_item_link', 'theme_menu_item_link');
-  return $theme($link);
+  return $function($link);
 }
 
 /**
@@ -73,9 +76,12 @@ function dhtml_menu_theme_menu_item_link
  * were not rendered, and loads and renders them.
  */
 function dhtml_menu_theme_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
-  static $cookie;
+  global $theme;
+  static $cookie, $function;
   if (!isset($cookie)) {
     $cookie = explode(',', @$_COOKIE['dhtml_menu']);
+    $registry = variable_get('dhtml_menu_theme', array());
+    $function = isset($registry[$theme]) && drupal_function_exists($registry[$theme]['menu_item']) ? $registry[$theme]['menu_item'] : 'theme_menu_item';
   }
 
   /* When theme('menu_item') is called, the menu tree below it has been
@@ -91,7 +97,8 @@ function dhtml_menu_theme_menu_item($lin
   $current = current($stack);
   if (!empty($current['dhtml_disabled'])) {
     $extra_class .= ' no-dhtml ';
-    return theme_menu_item($link, $has_children, $menu, $in_active_trail, $extra_class);
+  
+    return $function($link, $has_children, $menu, $in_active_trail, $extra_class);
   }
   
   // If there are children, but they were not loaded...
@@ -110,8 +117,7 @@ function dhtml_menu_theme_menu_item($lin
   }
 
   // Cascade up to the original theming function.
-  $theme = variable_get('dhtml_menu_theme_menu_item', 'theme_menu_item');
-  return $theme($link, $has_children, $menu, $in_active_trail, $extra_class);
+  return $function($link, $has_children, $menu, $in_active_trail, $extra_class);
 }
 
 /**
Index: dhtml_menu.rebuild.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dhtml_menu/dhtml_menu.rebuild.inc,v
retrieving revision 1.2
diff -u -p -r1.2 dhtml_menu.rebuild.inc
--- dhtml_menu.rebuild.inc	20 Nov 2008 19:12:51 -0000	1.2
+++ dhtml_menu.rebuild.inc	3 Apr 2009 22:49:10 -0000
@@ -10,12 +10,21 @@
 /** 
  * Implementation of hook_theme_registry_alter().
  * Replaces the theme functions for the menu_item functions, and stores the
- * original functions in order to cascade to them.
+ * original functions in order to call them when this module is done with preprocessing.
  */
 function dhtml_menu_theme_registry_alter(&$theme_registry) {
-  variable_set('dhtml_menu_theme_menu_item', $theme_registry['menu_item']['function']);
+  global $theme;
+
+  // Back up the existing theme functions.
+  $themes = variable_get('dhtml_menu_theme', array());
+  $themes[$theme] = array(
+    'menu_item' => $theme_registry['menu_item']['function'],
+    'menu_item_link' => $theme_registry['menu_item_link']['function'],
+  );
+  variable_set('dhtml_menu_theme', $themes);
+
+  // Replace them with our own. These will "preprocess" and call the real functions.
   $theme_registry['menu_item']['function'] = 'dhtml_menu_theme_menu_item';
-  variable_set('dhtml_menu_theme_menu_item_link', $theme_registry['menu_item_link']['function']);
   $theme_registry['menu_item_link']['function'] = 'dhtml_menu_theme_menu_item_link';
 }
 
@@ -35,3 +44,12 @@ function dhtml_menu_menu() {
   return $menu;
 }
 
+/**
+ * Implementation of hook_theme().
+ */
+function dhtml_menu_theme() {
+  $theme['dhtml_menu_theme_radio'] = array(
+    'arguments' => array('radio' => array()),
+  );
+  return $theme;
+}
