// JavaScript Document
/// <reference path="mootools-core-1.3-full-compat.js"/>
var pageFunctions = function() {
	// This function highlights the navigation item that relates to the page we're on - including sub pages.
	function flagNavigation() {
		var navItems = $$('#navigation ul li a');
		var currentURL = document.location.pathname;
		currentURL = currentURL.replace("index.asp","");
		var urlElements = currentURL.split('/');
		var currentDir = "/" + urlElements[1] + "/";
		navItems.each(function(item,index){
			if (currentDir == item.getProperty('href') || currentURL == item.getProperty('href')) {
				item.addClass('activeNav');
			}
		});
	}
	return {
		load: function() {
			flagNavigation();
		}
	}
}();

window.addEvent('domready', function() {
	pageFunctions.load();
});
