--- nice_menus.module.orig	2009-02-06 15:40:37.000000000 +0100
+++ nice_menus.module	2009-02-09 13:54:29.000000000 +0100
@@ -361,6 +361,13 @@ function theme_nice_menus_tree($menu_nam
  */
 function theme_nice_menus_build($menu, $depth = -1, $trail = NULL) {
   $output = '';
+  $i=0;
+  $count = 0;
+  foreach ($menu as $menu_count) {
+    if ($menu_count['link']['hidden'] == 0) {
+      $count++;
+    }
+  }
   foreach ($menu as $menu_item) {
     $mlid = $menu_item['link']['mlid'];
     // Check to see if it is a visible menu item.
@@ -372,6 +379,14 @@ function theme_nice_menus_build($menu, $
       // Convert slashes to dashes.
       $clean_path = str_replace('/', '-', $clean_path);
       $class = 'menu-path-'. $clean_path;
+      $extra_class = ' leaf';
+      $i++;
+      if ($i==1) {
+        $extra_class .= ' first';
+      }
+      elseif ($i==$count) {
+        $extra_class .= ' last';
+      }
       if ($trail && in_array($mlid, $trail)) {
         $class .= ' active-trail';
       }
@@ -381,7 +396,7 @@ function theme_nice_menus_build($menu, $
         $children = theme('nice_menus_build', $menu_item['below'], $depth, $trail);
         // Set the class to parent only of children are displayed.
         $parent_class = $children ? 'menuparent ' : '';
-        $output .= '<li id="menu-'. $mlid .'" class="'. $parent_class . $class .'">'. theme('menu_item_link', $menu_item['link']);
+        $output .= '<li id="menu-'. $mlid .'" class="'. $parent_class . $class . $extra_class .'">'. theme('menu_item_link', $menu_item['link']);
         // Check our depth parameters.
         if ($menu_item['link']['depth'] <= $depth || $depth == -1) {
           // Build the child UL only if children are displayed for the user.
@@ -394,7 +409,7 @@ function theme_nice_menus_build($menu, $
         $output .= "</li>\n";
       }
       else {
-        $output .= '<li id="menu-'. $mlid .'" class="'. $class .'">'. theme('menu_item_link', $menu_item['link']) .'</li>'."\n";
+        $output .= '<li id="menu-'. $mlid .'" class="'. $class . $extra_class .'">'. theme('menu_item_link', $menu_item['link']) .'</li>'."\n";
       }
     }
   }
