// (c) 1999-2005 Bright Interactive Limited. All rights reserved.
// http://www.bright-interactive.com | info@bright-interactive.com
// Tel: 0870 240 6520

var v_appVersion = navigator.appVersion.toLowerCase();
var v_platform = navigator.platform.toLowerCase();
var navDisable = false;

if(v_platform.indexOf('win') != -1) {
	if(v_appVersion.indexOf('msie 6') != -1) {
		navDisable = true;
	} else if(v_appVersion.indexOf('msie 7') != -1) {
		navDisable = true;
	} else {
		//This is most likely FF
	}
} 

function highlight_nav() {
		
	// highlight primary nav
	var primaryHighlight = jQuery('#secondaryNav li').attr('id') //find which section we are in using the include in the secondaryNav and get the ID
	var primaryHighlight = jQuery('#primaryNav li[id$="'+primaryHighlight+'"]') //find the nav option in the primary nav which matches it
	primaryHighlight.addClass("highlight") // highlight it
	
	// highlight secondary nav
	var pathname = window.location.pathname; // getUrl
	var link = jQuery('#secondaryNav a[href$="'+pathname+'"]') //find the link which links to the page we are on
	link.addClass("current"); // highlight the link
	link.parent().parent().parent().parent().find('a:first').removeClass("current"); // if the section title and a sublink have the same URL, remove the class on the section title

}

// 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);
    }
  }
}


