function ToggleFAQ(id) {
  e = $('faq'+id);
  if (e) {
    if (e.className == 'off') {
      // change class
      e.className = 'on';
      
      // track view
      /*
      var url    = '/_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 link
  $('open_all', 'close_all').invoke('toggle');
}
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', 'open_all').invoke('toggle');
}

function FilterCategory(filter_category) {
  
  var list  = document.getElementsByTagName('div');
  var nodes = $A(list);
	var regex = new RegExp('faqcategory([0-9])+');
	
  // find the matching nodes
  nodes = nodes.findAll(
    function(node) {
		  
      return regex.test(node.id);
    }
  );

  // hide all except current
  nodes.each(
    function(node) {
		
      if (filter_category == 0) {
				node.style.display = 'block';
			} else {
			 
				if (node.id == 'faqcategory'+filter_category) {
					node.style.display = 'block';
				} else {
					node.style.display = 'none';
				}
			}
    }
  );
}