// (c) 1999-2005 Bright Interactive Limited. All rights reserved.
// http://www.bright-interactive.com | info@bright-interactive.com
// Tel: 0870 240 6520

function highlight_nav() {
	return true;
	// Highlight the right nav item by comparing the URL with
	// the href of each <a> elt in the <div id="navigation">, or by
	// using the hint if supplied as arguments[0]. The hint
	// specifies a part of the URL, useful for actions with
	// lots of paramters
	
	var this_page = document.location.href;
	
	// Remove anchor if there is one -- anything following #, including #
	this_page = this_page.replace( /\#.*/, '' );
	
	var hint = "";
	if (arguments[0]) {
		hint = arguments[0];
	}
	
	
	// Try both subnav and subnavIndent for our item to highlight
	
	var divs = [ "navigation" ];
	for (var d = 0; d < divs.length; d++) {
	
		if (document.getElementById(divs[d])) {
			var subnav_elts = document.getElementById(divs[d]);
			var aTags = subnav_elts.getElementsByTagName("A");
			
		 
			
			var i = 0;
			for (i = 0; i < aTags.length; i++) {
				// Is this a link?
				var elt = aTags[i]
 					if (elt.parentNode.nodeName != "H2" && elt.href == this_page || (hint && elt.href.indexOf(hint) != -1) ) {
						elt.className = elt.className + " current";
						var par = elt.parentNode.parentNode.parentNode;
						if (par.nodeName == "LI"){
							par.className = "currentsub";
							par.firstChild.className += " section";
							document.getElementById("subnav").getElementsByTagName("H2")[0].className = "reset";
						}else{
							elt.parentNode.className = elt.parentNode.className + " currentsub";
						}
				}
 			}
		}
	}
}

// addLoadEvent function as seen at http://simon.incutio.com/archive/2004/05/26/addLoadEvent
// allows you to stack functions and apply them to the onload event and also means you 
// can abstract onload functions from the html
// I've added an argument 'arg' for onload functions with an argument
// Could probably be better implemented with 'arguments[]'


function addLoadEvent(func,arg) {
	
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func(arg);
    }
  }
}