function ToggleFAQ(id) {
  e = $('faq'+id);
  if (e) {
    if (e.className == 'off') {
      // change class
      e.className = 'on';
      
      // track view
      var url    = '/ajax_track_faq_view.php';
      var pars   = 'id=' + id;
      var myAjax = new Ajax.Request(
        url,
        {
          method:'get',
          parameters:pars
        }
      );
    } else {
      // change class
      e.className = 'off';
    }
  }
}
function OpenFAQs() {
  var list  = document.getElementsByTagName('dl');
  var nodes = $A(list);
  var regex = new RegExp('faq([0-9])+');
  
  // find the matching nodes
  nodes = nodes.findAll(
    function(node) {
      return regex.test(node.id);
    }
  );
  
  // show all
  nodes.each(
    function(node) {
      node.className = 'on';
    }
  );
  
  // switch links
  $('open_all_top', 'close_all_top').invoke('toggle');
  $('open_all_bottom', 'close_all_bottom').invoke('toggle');
  $$('p.top').invoke('show');
}
function CloseFAQs() {
  var list  = document.getElementsByTagName('dl');
  var nodes = $A(list);
  var regex = new RegExp('faq([0-9])+');
  
  // find the matching nodes
  nodes = nodes.findAll(
    function(node) {
      return regex.test(node.id);
    }
  );
  
  // show all
  nodes.each(
    function(node) {
      node.className = 'off';
    }
  );
  
  // switch link
  $('close_all_top', 'open_all_top').invoke('toggle');
  $('close_all_bottom', 'open_all_bottom').invoke('toggle');
  $$('p.top').invoke('hide');
}

