--- sites/all/modules/imagemenu/_imagemenu.module.orig	Mon Mar 08 15:33:52 2010
+++ sites/all/modules/imagemenu/imagemenu.module	Mon Apr 12 06:44:03 2010
@@ -440,6 +440,39 @@
  */
 function theme_imagemenu_item($item, $has_children, $prefix = '', $layout = 'vertical', $menu = '') {
   $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
+
+  // Set active menu item by checking for path alias, then drupal path, then plain path.
+  $active_path = drupal_lookup_path("alias", $_GET["q"]) ? drupal_lookup_path("alias", $_GET["q"]) : (drupal_lookup_path("source", $_GET["q"]) ? drupal_lookup_path("source", $_GET["q"]) :  $_GET["q"]);
+
+  // Evaluate whether the active path is the imagemenu item
+  if ($active_path == $item['path']) {
+    $item_path = $item['path'];
+  } else {
+    $item_path['alias'] = drupal_lookup_path("alias", $item['path']);
+    $item_path['source'] = drupal_lookup_path("source", $item['path']);
+    
+    switch ($active_path) {
+      case $item_path['alias']:
+        $item_path = $item_path['alias'];
+        break;
+      case $item_path['source']:
+        $item_path = $item_path['source'];
+        break;
+    }
+  }
+
+  //check for <front>
+  if ($active_path == variable_get('site_frontpage', '') && $item['path'] == '<front>') {
+    $active_path = $item['path'];
+  }
+  
+  if ($item_path == $active_path) {
+    $class .= ' current active-trail';
+    if ($item['mouseover']) {
+      $item['imagepath'] = $item['mouseover'];
+    }
+  }
+
   switch ($layout) {
     case 'vertical':
       $listyle = '';
