Index: faq.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.js,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 faq.js
--- faq.js	11 Apr 2007 16:13:39 -0000	1.1.2.3
+++ faq.js	24 Apr 2007 20:24:18 -0000
@@ -4,6 +4,7 @@
     $('dd.faq_answer').hide();
     $("dt.faq_question").click(function() {
       $(this).next("dd.faq_answer").toggle();
+      return false;
     });
 
 
@@ -11,6 +12,7 @@
     $('div.faq_qa_hide').hide();
     $(".faq_qa_header").click(function() {
       $(this).next("div.faq_qa_hide").toggle();
+      return false;
     });
 
 
Index: faq.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v
retrieving revision 1.1.4.36
diff -u -r1.1.4.36 faq.module
--- faq.module	24 Apr 2007 11:31:30 -0000	1.1.4.36
+++ faq.module	24 Apr 2007 21:40:50 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: faq.module,v 1.1.4.36 2007/04/24 11:31:30 snpower Exp $
+// $Id: faq.module,v 1.1.4.34 2007/04/20 11:28:27 snpower Exp $
 
 /**
 * Display help and module information
@@ -73,7 +73,7 @@
     );
     $items[] = array('path' => 'faq', 
 						'title' => variable_get('faq_title', t('Frequently Asked Questions')),
-      'callback' => t('faq_page'),
+      'callback' => 'faq_page',
       'access' => user_access('view faq'),
       'weight' => 1
     );
@@ -126,7 +126,7 @@
     );
     $items[] = array('path' => 'faq', 
 						'title' => variable_get('faq_title', t('Frequently Asked Questions')),
-      'callback' => t('faq_page'),
+      'callback' => 'faq_page',
       'access' => user_access('view faq'),
       'weight' => 1
     );
@@ -286,6 +286,13 @@
     '#default_value' => variable_get('faq_display', 'questions_top'),
     );
 
+  $form['questions']['question_listing'] = array('#type' => 'select',
+    '#options' => array('ol' => 'Ordered list', 'ul' => 'Unordered list'),
+    '#title' => t('Questions listing style'),
+    '#description' => t('This allows to select how the questions listing is presented, wherever it applies. An Ordered listing would number the questions, whereas an Unordered list will have a bullet to the left of each question.'),
+    '#default_value' => variable_get('faq_question_listing', 'ol'),
+    );
+
   $form['questions']['back_to_top'] = array('#type' => 'textfield',
     '#title' => t('"Back to Top" link text'),
     '#description' => t('This allows the user to change the text displayed for the links which return the user to the top of the page on certain page layouts.  Defaults to "Back to Top".  Leave blank to have no link.'),
@@ -342,6 +349,13 @@
     '#default_value' => variable_get('faq_category_display', 'categories_inline'),
     );
 
+  $form['category']['category_listing'] = array('#type' => 'select',
+    '#options' => array('ol' => 'Ordered list', 'ul' => 'Unordered list'),
+    '#title' => t('Categories listing style'),
+    '#description' => t('This allows to select how the categories listing is presented, wherever it applies. An Ordered listing would number the questions, whereas an Unordered list will have a bullet to the left of each question.'),
+    '#default_value' => variable_get('faq_category_listing', 'ol'),
+    );
+
   $form['category']['answer_category_name'] = array('#type' => 'checkbox',
     '#title' => t('Display category name for answers'),
     '#description' => t("This allows the user to toggle the visibility of the category name above each answer section for the 'Clicking on question takes user to answer further down the page' question/answer display."),
@@ -431,10 +445,22 @@
 				$category = $form_values['faq_category'];
 				if (empty($category)) {
 						$category = 0;
-						$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 ORDER BY weight ASC, n.sticky DESC, n.created DESC", "n", "nid"), $category);
+						if (module_exists("i18n") && variable_get('i18n_node_faq', 0)) {
+								$lang = i18n_get_lang();
+								$result = db_query("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {i18n_node} i ON i.nid = n.nid LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 AND i.language = '%s' ORDER BY weight ASC, n.sticky DESC, n.created DESC", $category, $lang);
+						}
+						else {
+								$result = db_query("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 ORDER BY weight ASC, n.sticky DESC, n.created DESC", $category);
+						}
 				} 
 				else {
-						$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 AND tn.tid = %d ORDER BY weight ASC, n.sticky DESC, n.created DESC", "n", "nid"), $category, $category);
+						if (module_exists("i18n") && variable_get('i18n_node_faq', 0)) {
+								$lang = i18n_get_lang();
+								$result = db_query("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 AND tn.tid = %d AND i.language = '%s' ORDER BY weight ASC, n.sticky DESC, n.created DESC", $category, $category, $lang);
+						}
+						else {
+								$result = db_query("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 AND tn.tid = %d ORDER BY weight ASC, n.sticky DESC, n.created DESC", $category, $category);
+						}
 				}
 
 
@@ -494,6 +520,7 @@
 function faq_questions_settings_form_submit($form_id, $form_values) {
   if ($form_values['op'] == t('Update')) {
     variable_set('faq_display', $form_values['display']);
+    variable_set('faq_question_listing', $form_values['question_listing']);
     variable_set('faq_back_to_top', $form_values['back_to_top']);
     variable_set('faq_use_teaser', $form_values['use_teaser']);
     variable_set('faq_more_link', $form_values['more_link']);
@@ -506,6 +533,7 @@
   if ($form_values['op'] == t('Update')) {
     variable_set('faq_use_categories', $form_values['categories']);
     variable_set('faq_category_display', $form_values['category_display']);
+    variable_set('faq_category_listing', $form_values['category_listing']);
     variable_set('faq_group_questions_top',$form_values['group_questions_top']);
     variable_set('faq_hide_sub_categories',$form_values['hide_sub_categories']);
     variable_set('faq_show_cat_sub_cats' ,$form_values['show_cat_sub_cats']);
@@ -557,6 +585,11 @@
 				$tid = 0;
 		}
 
+		// check if we need multi-lingual support
+		if (module_exists("i18n") && variable_get('i18n_node_faq', 0)) {
+				$display_vars["lang"] = i18n_get_lang();
+		}
+
 		// configure the breadcrumb trail
 		$breadcrumb = array();
 
@@ -599,23 +632,28 @@
 
   // non-categorized questions and answers
   if (!$use_categories) {
-				$result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid LEFT JOIN {faq_weights} w ON w.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND (w.tid = 0 OR w.tid IS NULL) ORDER BY weight, n.sticky DESC, n.created DESC", "n", "nid"));
+				if (!empty($display_vars["lang"])) {
+						$result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid LEFT JOIN {i18n_node} i ON i.nid = n.nid LEFT JOIN {faq_weights} w ON w.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND i.language = '%s' AND (w.tid = 0 OR w.tid IS NULL) ORDER BY weight, n.sticky DESC, n.created DESC", $display_vars["lang"]);
+				}
+				else {
+						$result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid LEFT JOIN {faq_weights} w ON w.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND (w.tid = 0 OR w.tid IS NULL) ORDER BY weight, n.sticky DESC, n.created DESC");
+				}
 
     switch ($faq_display) {
       case 'questions_top':
-        $output = theme('questions_top', $result, $display_vars);
+        $output = theme_questions_top($result, $display_vars);
         break;
 
       case 'hide_answer':
-        $output = theme('hide_answer', $result);
+        $output = theme_hide_answer($result);
         break;
 
       case 'questions_inline':
-        $output = theme('questions_inline', $result, $display_vars);
+        $output = theme_questions_inline($result, $display_vars);
         break;
 
       case 'new_page':
-        $output = theme('new_page', $result);
+        $output = theme_new_page($result);
         break;
         
     } // end of switch
@@ -633,7 +671,7 @@
     if ($tid != 0) {
       $term = taxonomy_get_term($tid);
 						$title = variable_get('faq_title', t('Frequently Asked Questions'));
-						drupal_set_title($title .($title ? ' - ' : ''). check_plain(t($term->name)));
+						drupal_set_title($title .($title ? ' - ' : ''). check_plain($term->name));
       if ($category_display == 'hide_qa') {
         drupal_add_js(drupal_get_path('module', 'faq') .'/faq.js', 'module');
       }
@@ -660,7 +698,8 @@
         switch ($category_display) {
 
           case 'new_page':
-            $indent = '<ul class="faq_category_indent">' ."\n";
+            $list_style = variable_get('faq_category_listing', 'ol');
+            $indent = '<'. $list_style .' class="faq_category_indent">' ."\n";
             if (taxonomy_term_count_nodes($term->tid, 'faq')) {
 
               // check if we need to indent the categories
@@ -676,7 +715,7 @@
                 $depth_diff = $depth - $term->depth;
                 $depth = $term->depth;
                 while ($depth_diff > 0) {
-                  $output .= "</ul>\n";
+                  $output .= "</$list_style>\n";
                   $depth_diff--;
                 }
               }
@@ -684,17 +723,22 @@
               $desc = '';
               if (!empty($term->description)) {
                 $desc = '<div class="faq_qa_description"><p>';
-                $desc .= t($term->description) ."</p></div>";
+                $desc .= $term->description ."</p></div>";
               }
               // see if this term has any nodes itself, should it be a link?
-														$result = db_query(db_rewrite_sql("SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND n.type = 'faq' AND t.tid = '%d' ", "n", "nid"), $term->tid);
+														if (!empty($display_vars["lang"])) {
+																$result = db_query("SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.status = 1 AND n.type = 'faq' AND t.tid = '%d' AND i.language = '%s'", $term->tid, $display_vars["lang"]);
+														} 
+														else {
+																$result = db_query("SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND n.type = 'faq' AND t.tid = '%d'", $term->tid);
+														}
               $count = db_fetch_object($result);
 
               if ($count->c > 0) {
-                $output .= "<li>". l(t($term->name), "faq/$term->tid"). $desc ."</li>\n";
+                $output .= "<li>". l($term->name, "faq/$term->tid"). $desc ."</li>\n";
               }
               else {
-                $output .= "<li>". check_plain(t($term->name)) ."$desc</li>\n";
+                $output .= "<li>". check_plain($term->name) ."$desc</li>\n";
               }
 
             }
@@ -718,7 +762,7 @@
     } // end of foreach vocab
 
     if ($category_display == "new_page") {
-      $output = "\n" .'<ul class="faq_ul_cat_new_page">'. $output ."</ul>\n";
+      $output = "\n" .'<'. $list_style .' class="faq_ul_cat_new_page">'. $output ."</$list_style>\n";
     }
   }
 
@@ -729,7 +773,7 @@
     $faq_description = check_markup($faq_description, $format, FALSE);
   }
   if (!empty($faq_description)) {
-    $desc = '<div class="faq_description">'. t($faq_description) ."</div>\n";
+    $desc = '<div class="faq_description">'. $faq_description ."</div>\n";
   }
   $output = '<div class="content"><div class="faq">'. $desc. $output;
   $output .= $output_answers ."</div></div>\n";
@@ -741,7 +785,12 @@
 
 function _display_faq_by_category($faq_display, $category_display, $term, $display_header, &$output, &$output_answers) {
 
-		$result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY weight, n.sticky DESC, n.created DESC", "n", "nid"), $term->tid);
+		if (!empty($display_vars["lang"])) {
+				$result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' AND i.language = '%s' ORDER BY weight, n.sticky DESC, n.created DESC", $term->tid, $display_vars["lang"]);
+		}
+		else {
+				$result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY weight, n.sticky DESC, n.created DESC", $term->tid);
+		}
 
   $display_vars['display_header'] = $display_header;
   $display_vars['faq_display'] = $faq_display;
@@ -772,26 +821,24 @@
   switch ($faq_display) {
 
     case 'questions_top':
-      theme('category_questions_top', $result, $display_vars, $term, $faq_class,
+      theme_category_questions_top($result, $display_vars, $term, $faq_class, 
         $output, $output_answers);
       break;
 
 
     case 'hide_answer':
-      $output .= theme('category_hide_answer', $result, $display_vars, $term, 
-								$faq_class);
+      $output .= theme_category_hide_answer($result, $display_vars, $term, $faq_class);
       break;
 
 
     case 'questions_inline':
-      $output .= theme('category_questions_inline', $result, $display_vars,
+      $output .= theme_category_questions_inline($result, $display_vars,
         $term, $faq_class);
       break;
 
 
     case 'new_page':
-      $output .= theme('category_new_page', $result, $display_vars, $term, 
-								$faq_class);
+      $output .= theme_category_new_page($result, $display_vars, $term, $faq_class);
       break;
 
   } // end of switch (faq_display)
@@ -811,16 +858,16 @@
   $back_to_top = '';
   if (!empty($display_vars['back_to_top'])) {
     $back_to_top = '<p class="faq_top_link">';
-    $back_to_top .= l(t($display_vars['back_to_top']), 'faq') .'</p>';
+    $back_to_top .= l($display_vars['back_to_top'], 'faq', array(), NULL, '') .'</p>';
   }
 
   // loop through results
   while ($node = db_fetch_object($result)) {
     $anchor = "n". $node->nid;
 
-    $questions .= '<li class="faq_li_questions_top">'. l(t($node->title), 'faq', NULL, NULL, $anchor) ."</li>\n";
+    $questions .= '<li class="faq_li_questions_top">'. l($node->title, 'faq', NULL, NULL, $anchor) ."</li>\n";
 
-    $answers .= '<dt class="faq_dt_questions_top">'. l(t($node->title), "node/$node->nid", array("name" => "$anchor")) ."</dt>\n";
+    $answers .= '<dt class="faq_dt_questions_top">'. l($node->title, "node/$node->nid", array("name" => "$anchor")) ."</dt>\n";
 
     // should we display teaser or full text
     if ($display_vars['use_teaser']) {
@@ -830,19 +877,20 @@
         $more_link .= l($display_vars['more_link'], "node/$node->nid") .'</p>';
       }
       $answers .= '<dd class="faq_dd_questions_top">';
-      $answers .= t(check_markup($node->teaser, $node->format, FALSE));
+      $answers .= check_markup($node->teaser, $node->format, FALSE);
       $answers .= $more_link. $back_to_top ."</dd>\n";
     }
 
     // full text
     else {
       $answers .= '<dd class="faq_dd_questions_top">';
-      $answers .= t(check_markup($node->body, $node->format, FALSE));
+      $answers .= check_markup($node->body, $node->format, FALSE);
       $answers .= $back_to_top ."</dd>\n";
     }
   }
 
-  $output = '<ul class="faq_ul_questions_top">'."\n". $questions ."</ul>\n";
+  $list_style = variable_get('faq_question_listing', 'ol');
+  $output = '<'. $list_style .' class="faq_ul_questions_top">'."\n". $questions ."</'. $list_style .'>\n";
   $output .= '<dl class="faq_dl_questions_top">'. "\n". $answers ."</dl>\n";
 
   return $output;
@@ -861,20 +909,20 @@
   $back_to_top = '';
   if (!empty($display_vars['back_to_top'])) {
     $back_to_top = '<p class="faq_top_link">';
-    $back_to_top .= l(t($display_vars['back_to_top']), $this_page) .'</p>';
+    $back_to_top .= l($display_vars['back_to_top'], $this_page, array(), NULL, '') .'</p>';
   }
 
   // configure header
-		$header = '<h5 class="faq_header">' .check_plain(t($term->name)) ."</h5>\n";
+		$header = '<h5 class="faq_header">' .check_plain($term->name) ."</h5>\n";
 		if ($term->depth > 0) {
-				$header = '<h6 class="faq_header">' .check_plain(t($term->name)) ."</h6>\n";
+				$header = '<h6 class="faq_header">' .check_plain($term->name) ."</h6>\n";
 		}
 
   $answer_category_name = variable_get('faq_answer_category_name', FALSE);
   $desc = '';
   if (!empty($term->description)) {
     $desc = '<div class="faq_qa_description"><p>';
-    $desc .= t($term->description) ."</p></div>\n";
+    $desc .= $term->description ."</p></div>\n";
   }
 
   // get list of sub-categories if necessary
@@ -882,19 +930,20 @@
   if (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'new_page') {
     $list = taxonomy_get_children($term->tid);
 
-    $sub_cats .= '<ul class="faq_category_list">' ."\n";
+    $list_style = variable_get('faq_category_listing', 'ol');
+    $sub_cats .= '<'. $list_style .' class="faq_category_list">' ."\n";
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
         $sub_cat_desc = '';
         if (!empty($sub_term->description)) {
           $sub_cat_desc = '<div class="faq_qa_description"><p>';
-          $sub_cat_desc .= t($sub_term->description) ."</p></div>";
+          $sub_cat_desc .= $sub_term->description ."</p></div>";
         }
-        $sub_cats .= "<li>". l(t($sub_term->name), "faq/$sub_term->tid");
+        $sub_cats .= "<li>". l($sub_term->name, "faq/$sub_term->tid");
         $sub_cats .= $sub_cat_desc ."</li>\n";
       }
     }
-    $sub_cats .= "</ul>\n";
+    $sub_cats .= "</$list_style>\n";
   }
 
 
@@ -921,10 +970,15 @@
 
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
-								$sub_result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", "n", "nid"), $sub_term->tid);
+								if (!empty($display_vars["lang"])) {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' AND i.language = '%s' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid, $display_vars["lang"]);
+								}
+								else {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid);
+								}
 								$display_vars['display_header'] = 1;
         $sub_cats .= '<div class="faq_category_indent">';
-        theme('category_questions_top', $sub_result, $display_vars, $sub_term, $class, $sub_cats, $sub_cat_output_answers);
+        theme_category_questions_top($sub_result, $display_vars, $sub_term, $class, $sub_cats, $sub_cat_output_answers);
         $sub_cats .= '</div>';
       }
     }
@@ -938,9 +992,9 @@
       $node = node_load($node->nid);
       $anchor = $term->tid ."n". $node->nid;
 
-      $questions .= '<li class="faq_li_questions_top">'. l(t($node->title), $this_page, NULL, NULL, $anchor) ."</li>\n";
+      $questions .= '<li class="faq_li_questions_top">'. l($node->title, $this_page, NULL, NULL, $anchor) ."</li>\n";
 
-      $answers .= '<dt class="faq_dt_questions_top">'. l(t($node->title), "node/$node->nid", array("name" => "$anchor")) ."</dt>\n";
+      $answers .= '<dt class="faq_dt_questions_top">'. l($node->title, "node/$node->nid", array("name" => "$anchor")) ."</dt>\n";
 
       // should we display teaser or full text
       if ($display_vars['use_teaser']) {
@@ -950,20 +1004,21 @@
           $more_link.= l($display_vars['more_link'], "node/$node->nid") .'</p>';
         }
         $answers .= '<dd class="faq_dd_questions_top">';
-        $answers .= t(check_markup($node->teaser, $node->format, FALSE));
+        $answers .= check_markup($node->teaser, $node->format, FALSE);
         $answers .= $more_link. $back_to_top ."</dd>\n";
       }
 
       // full text
       else {
         $answers .= '<dd class="faq_dd_questions_top">';
-        $answers .= t(check_markup($node->body, $node->format, FALSE));
+        $answers .= check_markup($node->body, $node->format, FALSE);
         $answers .= $back_to_top ."</dd>\n";
       }
 
     } // end of while
 
-    $output .= '<ul class="faq_ul_questions_top">' ."\n$questions\n</ul>\n";
+    $list_style = variable_get('faq_question_listing', 'ol');
+    $output .= '<'. $list_style .' class="faq_ul_questions_top">' ."\n$questions\n</'. $list_style .'>\n";
 
   }
 
@@ -1034,9 +1089,9 @@
   $output = '<dl class="faq_dl">' ."\n";
   while ($node = db_fetch_object($result)) {
     $output .= '<dt class="faq_question">';
-    $output .= check_plain(t($node->title)) ."</dt>\n";
+    $output .= l($node->title, "node/$node->nid") ."</dt>\n";
     $output .= '<dd class="faq_answer">';
-    $output .= t(check_markup($node->body, $node->format, FALSE)) ."</dd>\n";
+    $output .= check_markup($node->body, $node->format, FALSE) ."</dd>\n";
   }
   $output .= "</dl>\n";
 
@@ -1053,15 +1108,15 @@
   drupal_add_js(drupal_get_path('module','faq').'/faq.js','module');
 
   // configure header
-		$header = '<h5 class="faq_header">' .check_plain(t($term->name)) ."</h5>\n";
+		$header = '<h5 class="faq_header">' .check_plain($term->name) ."</h5>\n";
 		if ($term->depth > 0) {
-				$header = '<h6 class="faq_header">'.check_plain(t($term->name))."</h6>\n";
+				$header = '<h6 class="faq_header">'.check_plain($term->name)."</h6>\n";
 		}
 
   $desc = '';
   if (!empty($term->description)) {
     $desc = '<div class="faq_qa_description"><p>';
-    $desc .= t($term->description) ."</p></div>\n";
+    $desc .= $term->description ."</p></div>\n";
   }
 
   // get list of sub-categories if necessary
@@ -1069,19 +1124,20 @@
   if (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'new_page') {
     $list = taxonomy_get_children($term->tid);
 
-    $sub_cats .= '<ul class="faq_category_list">' ."\n";
+    $list_style = variable_get('faq_category_listing', 'ol');
+    $sub_cats .= '<'. $list_style  .' class="faq_category_list">' ."\n";
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
         $sub_cat_desc = '';
         if (!empty($sub_term->description)) {
           $sub_cat_desc = '<div class="faq_qa_description"><p>';
-          $sub_cat_desc .= t($sub_term->description) ."</p></div>";
+          $sub_cat_desc .= $sub_term->description ."</p></div>";
         }
-        $sub_cats .= "<li>". l(t($sub_term->name), "faq/$sub_term->tid");
+        $sub_cats .= "<li>". l($sub_term->name, "faq/$sub_term->tid");
         $sub_cats .= $sub_cat_desc ."</li>\n";
       }
     }
-    $sub_cats .= "</ul>\n";
+    $sub_cats .= "</$list_style>\n";
   }
 
 
@@ -1109,10 +1165,15 @@
 
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
-								$sub_result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", "n", "nid"), $sub_term->tid);
+								if (!empty($display_vars["lang"])) {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' AND i.language = '%s' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid, $display_vars["lang"]);
+								}
+								else {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid);
+								}
 								$display_vars['display_header'] = 1;
         $sub_cats .= '<div class="faq_category_indent">';
-        $sub_cats .= theme('category_hide_answer', $sub_result, $display_vars, $sub_term, $class);
+        $sub_cats .= theme_category_hide_answer($sub_result, $display_vars, $sub_term, $class);
         $sub_cats .= '</div>';
       }
     }
@@ -1126,9 +1187,9 @@
     while ($node = db_fetch_object($result)) {
       $node = node_load($node->nid);
       $output .= '<dt class="faq_question">';
-      $output .= check_plain(t($node->title)) ."</dt>\n";
+      $output .= l($node->title, "node/$node->nid") ."</dt>\n";
       $output .= '<dd class="faq_answer">';
-      $output .= t(check_markup($node->body, $node->format, FALSE)) ."</dd>\n";
+      $output .= check_markup($node->body, $node->format, FALSE) ."</dd>\n";
     }
     $output .= "</dl>\n";
   }
@@ -1143,12 +1204,12 @@
   $back_to_top = '';
   if (!empty($display_vars['back_to_top'])) {
     $back_to_top = '<p class="faq_top_link">';
-    $back_to_top .= l(t($display_vars['back_to_top']), 'faq') .'</p>';
+    $back_to_top .= l($display_vars['back_to_top'], 'faq', array(), NULL, '') .'</p>';
   }
 
   $output = "<dl>\n";
   while ($node = db_fetch_object($result)) {
-    $output .= "<dt>". l(t($node->title), "node/$node->nid") ."</dt>\n";
+    $output .= "<dt>". l($node->title, "node/$node->nid") ."</dt>\n";
 
     // should we display teaser or full text
     if ($display_vars['use_teaser']) {
@@ -1158,14 +1219,14 @@
         $more_link .= l($display_vars['more_link'], "node/$node->nid") .'</p>';
       }
       $output .= '<dd class="faq_dd_questions_inline">';
-      $output .= t(check_markup($node->teaser, $node->format, FALSE));
+      $output .= check_markup($node->teaser, $node->format, FALSE);
       $output .= $more_link. $back_to_top ."</dd>\n";
     }
 
     // full text
     else {
       $output .= '<dd class="faq_dd_questions_inline">';
-      $output .= t(check_markup($node->body, $node->format, FALSE));
+      $output .= check_markup($node->body, $node->format, FALSE);
       $output .= $back_to_top ."</dd>\n";
     }
   }
@@ -1186,20 +1247,20 @@
   $back_to_top = '';
   if (!empty($display_vars['back_to_top'])) {
     $back_to_top = '<p class="faq_top_link">';
-    $back_to_top .= l(t($display_vars['back_to_top']), $this_page) .'</p>';
+    $back_to_top .= l($display_vars['back_to_top'], $this_page, array(), NULL, '') .'</p>';
   }
 
   // configure header
-		$header = '<h5 class="faq_header">' .check_plain(t($term->name)) ."</h5>\n";
+		$header = '<h5 class="faq_header">' .check_plain($term->name) ."</h5>\n";
 		if ($term->depth > 0) {
-				$header = '<h6 class="faq_header">' .check_plain(t($term->name)) ."</h6>\n";
+				$header = '<h6 class="faq_header">' .check_plain($term->name) ."</h6>\n";
 		}
 
   // configure category description
   $desc = '';
   if (!empty($term->description)) {
     $desc = '<div class="faq_qa_description"><p>';
-    $desc .= t($term->description) ."</p></div>\n";
+    $desc .= $term->description ."</p></div>\n";
   }
 
 
@@ -1208,19 +1269,20 @@
   if (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'new_page') {
     $list = taxonomy_get_children($term->tid);
 
-    $sub_cats .= '<ul class="faq_category_list">' ."\n";
+    $list_style = variable_get('faq_category_listing', 'ol');
+    $sub_cats .= '<'. $list_style .' class="faq_category_list">' ."\n";
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
         $sub_cat_desc = '';
         if (!empty($sub_term->description)) {
           $sub_cat_desc = '<div class="faq_qa_description"><p>';
-          $sub_cat_desc .= t($sub_term->description) ."</p></div>";
+          $sub_cat_desc .= $sub_term->description ."</p></div>";
         }
-        $sub_cats .= "<li>". l(t($sub_term->name), "faq/$sub_term->tid");
+        $sub_cats .= "<li>". l($sub_term->name, "faq/$sub_term->tid");
         $sub_cats .= $sub_cat_desc ."</li>\n";
       }
     }
-    $sub_cats .= "</ul>\n";
+    $sub_cats .= "</$list_style>\n";
   }
 
 
@@ -1249,10 +1311,15 @@
 
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
-								$sub_result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", "n", "nid"), $sub_term->tid);
+								if (!empty($display_vars["lang"])) {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' AND i.language = '%s' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid, $display_vars["lang"]);
+								}
+								else {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid);
+								}
 								$display_vars['display_header'] = 1;
         $sub_cats .= '<div class="faq_category_indent">';
-        $sub_cats .= theme('category_questions_inline', $sub_result, $display_vars, $sub_term, $class);
+        $sub_cats .= theme_category_questions_inline($sub_result, $display_vars, $sub_term, $class);
         $sub_cats .= '</div>';
       }
     }
@@ -1266,7 +1333,7 @@
     while ($node = db_fetch_object($result)) {
       $node = node_load($node->nid);
       $output .= '<dt class="faq_dt_questions_inline">';
-      $output .= l(t($node->title), "node/$node->nid") ."</dt>\n";
+      $output .= l($node->title, "node/$node->nid") ."</dt>\n";
 
       // should we display teaser or full text
       if ($display_vars['use_teaser']) {
@@ -1276,14 +1343,14 @@
           $more_link.= l($display_vars['more_link'], "node/$node->nid") .'</p>';
         }
         $output .= '<dd class="faq_dd_questions_inline">';
-        $output .= t(check_markup($node->teaser, $node->format, FALSE));
+        $output .= check_markup($node->teaser, $node->format, FALSE);
         $output .= $more_link. $back_to_top ."</dd>\n";
       }
 
       // full text
       else {
         $output .= '<dd class="faq_dd_questions_inline">';
-        $output .= t(check_markup($node->body, $node->format, FALSE));
+        $output .= check_markup($node->body, $node->format, FALSE);
         $output .= $back_to_top ."</dd>\n";
       }
     }
@@ -1295,13 +1362,14 @@
 }
 
 function theme_new_page($result) {
-  $output = '<ul class="faq_ul_new_page">' ."\n";
+  $list_style = variable_get('faq_question_listing', 'ol');
+  $output = '<'. $list_style .' class="faq_ul_new_page">' ."\n";
 
   while ($node = db_fetch_object($result)) {
     $output .= '<li class="faq_li_new_page">';
-    $output .= l(t($node->title), "node/$node->nid") ."</li>\n";
+    $output .= l($node->title, "node/$node->nid") ."</li>\n";
   }
-  $output .= "</ul>\n";
+  $output .= "</$list_style>\n";
 
   return $output;
 }
@@ -1315,15 +1383,15 @@
   }
 
   // configure header
-		$header = '<h5 class="faq_header">' .check_plain(t($term->name)) ."</h5>\n";
+		$header = '<h5 class="faq_header">' .check_plain($term->name) ."</h5>\n";
 		if ($term->depth > 0) {
-				$header = '<h6 class="faq_header">' .check_plain(t($term->name)) ."</h6>\n";
+				$header = '<h6 class="faq_header">' .check_plain($term->name) ."</h6>\n";
 		}
 
   $desc = '';
   if (!empty($term->description)) {
     $desc = '<div class="faq_qa_description"><p>';
-    $desc .= t($term->description) ."</p></div>\n";
+    $desc .= $term->description ."</p></div>\n";
   }
 
   // get list of sub-categories if necessary
@@ -1331,19 +1399,20 @@
   if (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'new_page') {
     $list = taxonomy_get_children($term->tid);
 
-    $sub_cats .= '<ul class="faq_category_list">' ."\n";
+    $list_style = variable_get('faq_category_listing', 'ol');
+    $sub_cats .= '<'. $list_style .' class="faq_category_list">' ."\n";
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
         $sub_cat_desc = '';
         if (!empty($sub_term->description)) {
           $sub_cat_desc = '<div class="faq_qa_description"><p>';
-          $sub_cat_desc .= t($sub_term->description) ."</p></div>";
+          $sub_cat_desc .= $sub_term->description ."</p></div>";
         }
-        $sub_cats .= "<li>". l(t($sub_term->name), "faq/$sub_term->tid");
+        $sub_cats .= "<li>". l($sub_term->name, "faq/$sub_term->tid");
         $sub_cats .= $sub_cat_desc ."</li>\n";
       }
     }
-    $sub_cats .= "</ul>\n";
+    $sub_cats .= "</$list_style>\n";
   }
 
 
@@ -1369,10 +1438,15 @@
 
     foreach ($list as $tid => $sub_term) {
       if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) {
-								$sub_result = db_query(db_rewrite_sql("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", "n", "nid"), $sub_term->tid);
+								if (!empty($display_vars["lang"])) {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' AND i.language = '%s' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid, $display_vars["lang"]);
+								}
+								else {
+										$sub_result = db_query("SELECT n.title, n.nid, r.body, r.teaser, r.format FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY n.sticky DESC, n.created DESC", $sub_term->tid);
+								}
 								$display_vars['display_header'] = 1;
         $sub_cats .= '<div class="faq_category_indent">';
-        $sub_cats .= theme('category_new_page', $sub_result, $display_vars, $sub_term, $class);
+        $sub_cats .= theme_category_new_page($sub_result, $display_vars, $sub_term, $class);
         $sub_cats .= '</div>';
       }
     }
@@ -1381,14 +1455,15 @@
 
 
   if (db_num_rows($result)) {
-    $output .= '<ul class="faq_ul_new_page">'. "\n";
+    $list_style = variable_get('faq_question_listing', 'ol');
+    $output .= '<'. $list_style .' class="faq_ul_new_page">'. "\n";
 
     while ($node = db_fetch_object($result)) {
       $node = node_load($node->nid);
       $output .= '<li class="faq_li_new_page">';
-      $output .= l(t($node->title), "node/$node->nid") ."</li>\n";
+      $output .= l($node->title, "node/$node->nid") ."</li>\n";
     }
-    $output .= "</ul>\n";
+    $output .= "</$list_style>\n";
   }
   $output .= "</div>\n</div>\n";
 
@@ -1415,14 +1490,14 @@
                 $terms[$term->name] = $term->tid;
               }
             }
-            ksort($terms);
             if (sizeof($terms) > 0) {
+              $list_style = variable_get('faq_category_listing', 'ol');
               $block['subject'] = t('FAQ Categories');
-              $block['content'] = "<ul>\n";
+              $block['content'] = "<$list_style>\n";
               foreach ($terms as $name => $tid) {
                 $block['content'] .= '<li>'. l($name, 'faq/'. $tid) ."</li>\n";
               }
-              $block['content'] .= "</ul>\n";
+              $block['content'] .= "</$list_style>\n";
             }
           }
           break;
@@ -1431,7 +1506,7 @@
         case 1:
           // Recent FAQs
           $block['subject'] = t('Recent FAQs');
-          $block['content'] = theme('faq_highlights', variable_get('faq_block_recent_faq_count', 5));
+          $block['content'] = theme_faq_highlights(variable_get('faq_block_recent_faq_count', 5));
           break;
 
       } // end switch($delta)
@@ -1462,15 +1537,21 @@
 
 function theme_faq_highlights($num = 5) {
 
-		$result = db_query_range(db_rewrite_sql("SELECT n.title, n.nid FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid WHERE n.type='faq' AND n.status = 1 ORDER BY n.created DESC", "n", "nid"), 0, $num);
-
-  $output .= "<ul>\n"; 
+		if (module_exists("i18n") && variable_get('i18n_node_faq', 0)) {
+				$lang = i18n_get_lang();
+				$result = db_query("SELECT n.title, n.nid FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid LEFT JOIN {i18n_node} i ON i.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND i.language = '%s' ORDER BY n.created DESC LIMIT %d", $lang, $num);
+		}
+		else {
+				$result = db_query("SELECT n.title, n.nid FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid WHERE n.type='faq' AND n.status = 1 ORDER BY n.created DESC LIMIT %d", $num);
+		}
+  $list_style = variable_get('faq_question_listing', 'ol');
+  $output .= "<$list_style>\n"; 
   while ($node = db_fetch_object($result)) {
     $node = node_load(array('nid' => $node->nid));
     $node = node_prepare($node);
     $output .= '<li>'. l($node->title, 'node/'.$node->nid) ."</li>\n";
   }
-  $output .= "</ul>\n";
+  $output .= "</$list_style>\n";
   $output .= l(t('All FAQs'), 'faq');
 
   return $output;

