<!--
	///////////////////////////////////////////////////////////////////////////////////
	// This file contains javascript for the partial navigation functionality.
	///////////////////////////////////////////////////////////////////////////////////
	
	//the expand function for the partial nav
	function expand(event) {
		
		evt = new xEvent(event)
		
		if(evt.target.tagName == "SPAN" && evt.target.className=="expand plusMinus") {
			var span = evt.target;
			span.className='contract plusMinus';
			span.onclick=contract;
			span.nextSibling.style.display='block';
			if(span.getAttribute('url') != '')
				window.setTimeout('getContent(\''+span.id+'\')', 10);
		}
	}
	
	//the contract function for the partial nav
	function contract(event) {
	
		evt = new xEvent(event)
		
		if(evt.target.tagName == "SPAN" && evt.target.className=="contract plusMinus") {
			var span = evt.target;
			span.className='expand plusMinus';
			span.onclick=expand;
			span.nextSibling.style.display='none';
		}
	}
	
	//this function goes to the span's url property to dynamically fill in part of the navigation
	function getContent(spanID) 
	{
		var mainframe = window.top.mainframe
		
		if(mainframe && (mainframe.document.readyState == 'complete' || mainframe.ConnectPage_IsLoaded)) {
			var span = document.all[spanID];
			
			var xmlhttp
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (exception)
			{
				xmlhttp = new XMLHttpRequest();
			}
			xmlhttp.open("GET", span.getAttribute('url'), false);
			xmlhttp.send("");
			
			var temp = xmlhttp.responseText;			
			if(temp == "LOGOUT") {
				window.top.mainframe.document.location.href = window.top.mainframe.document.location.href;
			} else
				span.nextSibling.innerHTML = temp;
				
			span.setAttribute('url', '');
		} else
			window.setTimeout('getContent(\''+spanID+'\')', 10);

	}

	//the function to show the nav after a refresh or login
	function showAllNavigation(parentControlId) {
		var expLoadingDiv = document.getElementById('expLoadingDiv');
		var expAllNavigationDiv = document.getElementById('expAllNavigationDiv');
		
		expLoadingDiv.style.display = "none";
		expAllNavigationDiv.style.visibility = "visible";

		var highlightIndex = document.location.href.indexOf("Highlight");
		if((window.top.NavID != 0) && (highlightIndex == -1)) {
			var navLink = document.getElementById(parentControlId + '_link_'+window.top.NavID);
			
			if(navLink) {
				if(navLink.className == navLink.getAttribute('normalClass'))
					itemClick(navLink);
				
				navLink.scrollIntoView(true);
			}
			
			window.top.NavID = 0;
		} else
			HighlightDefault();

	}
	
	//this variable keeps track of the currently highlighted item
	var lastNavLink;

	//the function to change the style when an item is clicked (plus expand its children)
	function itemClick(navLink, evt) {
		if(ConfirmLink(evt)) {
			if (lastNavLink && lastNavLink.className == lastNavLink.getAttribute('selectedClass')) {
				lastNavLink.className = lastNavLink.getAttribute('normalClass');
			}
			
			if (navLink && navLink.className == navLink.getAttribute('normalClass')) {
				navLink.className = navLink.getAttribute('selectedClass');
				lastNavLink = navLink;	
				
				var parent = navLink.parentNode;
				if(parent.className == 'expand plusMinus') {
					parent.click();
				}
			}
		}
	}