function ToggleHelpfulHint(id) {
  e = $('helpful_hint'+id);
  if (e) {
    if (e.className == 'off') {
      // change class
      e.className = 'on';
      
      // track view
      var url    = '/_track_helpful_hint_view.php';
      var pars   = 'id=' + id;
      var myAjax = new Ajax.Request(
        url,
        {
          method:'get',
          parameters:pars
        }
      );
    } else {
      // change class
      e.className = 'off';
    }
  }
}
function OpenHelpfulHints() {
  var list  = document.getElementsByTagName('dl');
  var nodes = $A(list);
  var regex = new RegExp('helpful_hint([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
  Element.toggle('open_all', 'close_all');
}
function CloseHelpfulHints() {
  var list  = document.getElementsByTagName('dl');
  var nodes = $A(list);
  var regex = new RegExp('helpful_hint([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
  Element.toggle('open_all', 'close_all');
}
function FilterCategory(filter_category) {
  
  var list  = document.getElementsByTagName('div');
  var nodes = $A(list);
  var regex = new RegExp('helpfulhintcategory([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 == 'helpfulhintcategory'+filter_category) {
					node.style.display = 'block';
				} else {
					node.style.display = 'none';
				}
			}
    }
  );
}