--- ../glossary2/glossary/glossary.module	2008-04-24 10:56:50.000000000 -0700
+++ glossary.module	2008-04-24 15:41:30.000000000 -0700
@@ -183,15 +183,17 @@ function glossary_search_form_submit($fo
 
 function glossary_search_results($keys = null) {
   $vids = _glossary_get_filter_vids();
-  $output = '<dl class="glossary-list">';
+  $output = '<div class="glossary-list">';
  
   $sql = db_rewrite_sql("SELECT td.tid FROM {term_data} td WHERE td.vid IN (%s) AND (td.description LIKE '%%%s%%' OR td.name LIKE '%%%s%%')", '{term_data}', 'tid');
   $result = db_query($sql, implode(',', $vids), $keys, $keys);
   while ($row = db_fetch_object($result)) {
     $term = taxonomy_get_term($row->tid);
+    $output .= '<dl>';
     $output .= theme('glossary_overview_item', $term, true);
+    $output .= '</dl>';
   }
-  return $output .'</dl>';
+  return $output .'</div>';
 }
 
 function theme_glossary_search_form($form) {
@@ -200,13 +202,15 @@ function theme_glossary_search_form($for
 
 function glossary_term($tid) { 
   $result = db_query(db_rewrite_sql('SELECT td.* FROM {term_data} td WHERE td.tid=%d', '{term_data}', 'tid'), $tid);
-  $output .= '<dl class="glossary-list">'."\n";
+  $output .= '<div class="glossary-list">'."\n";
   while ($row = db_fetch_object($result)) {
     $term = taxonomy_get_term($row->tid);
+    $output .= '<dl>';
     $output .= theme('glossary_overview_item', $term, true);
+    $output .= '</dl>';
     $vid = $row->vid;
   }  
-  $output .= "</dl>\n";
+  $output .= "</div>\n";
   
   $tree = taxonomy_get_tree($vid);
   $alphabar = _glossary_alphabar($vid, $tree);    
@@ -563,31 +567,38 @@ function glossary_overview($vocab, $lett
   if ($letter) {
     $letter = drupal_substr($letter, 6, 1, 'UTF-8');
   }
-  $first_let = '';
+  $current_let = '';
 
   $show_desc = variable_get('glossary_show_description', false);
   $separate = variable_get('glossary_separate_letters', false);
   $tree = taxonomy_get_tree($vid);
   $output .= _glossary_alphabar($vid, $tree);
-  $output .= '<dl class="glossary-list">'."\n";
+  $output .= '<div class="glossary-list">'."\n";
   if ($tree) {
     foreach ($tree as $term) {
       $term_let = drupal_strtolower(drupal_substr($term->name, 0, 1, 'UTF-8'));
       // If we're looking for a single letter, see if this is it.
       if (!$letter || $term_let == $letter) {
         // See if it's a new section.
-        if ($term_let != $first_let) {
+        if ($term_let != $current_let) {
+          if ($current_let != '') {
+            $output .= '</dl>';
+          }
           $output .= "\n".'<a id="letter'. $term_let .'"></a>';
           if ($separate && $term->depth == 0) {
             $output .= '<div class="glossary-letter">'. $term_let .'</div>';
-            $first_let = $term_let;
           }
+          $output .= '<dl>';
+          $current_let = $term_let;
         }
         $output .= theme('glossary_overview_item', $term, $show_desc, $dest);
       }
     }
+    if ($current_let != '') {
+      $output .= '</dl>';
+    }
   }
-  $output .= '</dl>';
+  $output .= '</div>';
   $output .= glossary_admin_links($vocab, $dest);
   return $output .'</div>';
 }
@@ -595,10 +606,6 @@ function glossary_overview($vocab, $lett
 function theme_glossary_overview_item($term, $show_desc = true, $destination = null) {
   $click_option = variable_get('glossary_click_option', 0);
   
-  if (isset($term->firstletter)) {
-    $output .= "\n".'<a id="letter'. $term->firstletter .'"></a>';
-  }
-  $output .= '<a id="term'. $term->tid .'"></a>';
   if (module_exists('taxonomy_image') && $show_desc) {
     $img = taxonomy_image_display($term->tid);
     if ($img) {
@@ -616,33 +623,26 @@ function theme_glossary_overview_item($t
     $img = null;
   }
   $output .= '<dt class="depth'. $term->depth .'">'. $img;
+  $output .= '<a id="term'. $term->tid .'"></a>';
   if ($show_desc) {
 //    $output .= $term->name;
-    $output .= str_repeat('--', $term->depth) . $term->name;
+    $output .= str_repeat('--', $term->depth) . check_plain($term->name);
   }
   else {
     $output .= l($term->name, 'glossary/term/'. $term->tid);
   }
   $links = array();
   if (user_access('administer taxonomy')) {
-    $links['glossary-edit-term'] = array(
-      'title' => t('edit term'), 
-      'href' => 'admin/content/taxonomy/edit/term/'. $term->tid,
-      'attributes' => array('title' => t('edit this term and definition')),
-      'query' => drupal_get_destination(),  // we need to know where we came from.
+    $output .= ' '.l(t('edit term'), 'admin/content/taxonomy/edit/term/'. $term->tid,
+      array('title' => t('edit this term and definition')), 
+      drupal_get_destination()  // we need to know where we came from.
       );
   }
   if (user_access('search content')) {
-    $links['glossary-search-term'] = array(
-      'title' => t('search for term'), 
-      'href' => 'search/node/"'. $term->name .'"',
-      'attributes' => array('title' => t('search for content using this term')),
-//      'query' => $destination,
+    $output .= ' '.l(t('search for term'), 'search/node/"'. $term->name .'"',
+      array('title' => t('search for content using this term'))
       );
   }
-  if (!empty($links)) {
-    $output .= theme('links', $links, array('class' => 'links inline'));
-  }
   $output .= '</dt><dd class="depth'. $term->depth .'">';
   if ($term->description) {
     $output .= check_markup($term->description);
