	//SETS AN ELEMENTS CLASSNAME DEPEDNING ON BROWSER AGENT
	function setClassName( element, className) {
		agt = navigator.userAgent.toLowerCase();
		if (agt.indexOf('mozilla')!=-1 && agt.indexOf('spoofer')==-1 && agt.indexOf('compatible') == -1) {
			element.setAttribute("class", className);
		}
		else {
			iePos = agt.indexOf('msie');
			ieVersion = parseFloat(agt.substring(iePos + 5, agt.indexOf(";", iePos)));

			if (ieVersion > 7) { 
				element.setAttribute("class", className);
			}
			else {
				element.setAttribute("className", className);
			}
		}
	}

	//GETS AN ARRAY OF ELEMENTS IN THE SPECIFIED NODE CONTAINING THE SPECIFIED CSS CLASS
	function getElementsByClass(searchClass,node,tag) {
		var classElements = new Array();
		if (node == null)
			node = document;
		if (tag == null)
			tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
		for (i = 0, j = 0; i < elsLen; i++) {
			if (pattern.test(els[i].className) ) {
			  classElements[j] = els[i];
			  j++;
			}
		}
		return classElements;
	}
	

	//HANDLES DISPLAYING AND HIDING OF SUBMENU DIV ELELMENTS ONCLICK
	function showSubMenu(elementId, callingElement, returnToUrl) {				
		var subMenuElement = document.getElementById(elementId);
		toggleLeftNavCookies(subMenuElement, callingElement);		
		hideLeftNavItems();			
		if (readCookie('leftNavSection') == null || readCookie('leftNavSectionDirection') == 'down') {
			toggleLeftNavItem(subMenuElement, callingElement);								
		}
		if (returnToUrl != null)
			window.location = returnToUrl;
	}
	
	//HIDES ALL EXPANDED LEFT NAV MENUS
	function hideLeftNavItems() {
		//GET ALL THE SECOND LEVEL ELEMENTS WITHIN THE MENU DIV TO BE HIDDEN			
		var secondlevel = getElementsByClass('secondlevel', document.getElementById('sideBar1Nav'));
		var secondlvelOpen = getElementsByClass("secondlevel_open", document.getElementById('sideBar1Nav'));
		var e = secondlevel.concat(secondlvelOpen);
		
		//CHANGE ARROW GLYPH TO CLOSED FOR TOPLEVELX_OPEN CLASS (TOPLEVEL)
		var toplevelx = getElementsByClass('toplevelx_open', document.getElementById('sideBar1Nav'));
		for (var i = 0; i < toplevelx.length; i++){
			setClassName(toplevelx[i], 'toplevelx');
		}						
		
		//HIDE THE MENUITEM CHILD DIVs
		for (var i = 0; i < e.length; i++) {
			e[i].style.display = 'none';
		}	
	}
	
	//TOGGLES A LEFT NAV ITEM EXPANDED/ROLLED-UP
	function toggleLeftNavItem(subMenuElement, callingElement) {
		//DISPLAY THE MENUITEM CHILD DIVs
		if (subMenuElement != null && subMenuElement.style.display == 'none') {
			subMenuElement.style.display = 'block';
		}		
		else {
			subMenuElement.style.display = 'none';
		}
		
		//CHANGE ARROW GLYPH TO OPEN
		if (callingElement != null && callingElement.className == 'toplevelx_open') {
			setClassName(callingElement, 'toplevelx');
		}			
		else {
			setClassName(callingElement, 'toplevelx_open');
		}
	}	
	
	//TOGGLES THE LEFT NAV COOKIES
	function toggleLeftNavCookies(subMenuElement, callingElement) {
		//SET NAV SECTION COOKIE
		createCookie('leftNavSection', callingElement.id);
		
		//SET NAV DIRECTION COOKIE
		if (callingElement.className == 'toplevelx_open' )
		{
			createCookie('leftNavSectionDirection', 'up');
		}
		else {
			createCookie('leftNavSectionDirection', 'down');
		}
	}	
	
	//LOADS COOKIE AND SETS-UP LEFT NAV DISPLAY
	function loadLeftNavCookie() {	
		if (document.getElementById("sideBar1Nav") != null && readCookie('leftNavSection') != null) {
			var callingElement = document.getElementById(readCookie('leftNavSection'));
			if (callingElement != null) {
				var elementToShow = document.getElementById(callingElement.id+'Sub');
				hideLeftNavItems();
				if (readCookie('leftNavSectionDirection') != null && readCookie('leftNavSectionDirection') == 'down') {
					toggleLeftNavItem(elementToShow, callingElement);
				}
			}
		}	
	}