﻿
for (j=1; j<navMenu.length; j++) {
//initialize flag array to keep track of which menu is open

//set up a flag for each menu, to tell whether it's on or off
 	navMenu[j][1]=0;
	// sets all menu flags as "off"
	// indicating that all menus are thought to be invisible
}

navMenu[0][1]=1;  //this is a hack to indicate that the first list is actually open

function ChangeImage (ImageName,FileName) {
document[ImageName].src = FileName;
}

function openMenu(strOpen)
{
	var ImageElement
	ImageElement = strOpen + "Image";
	
	for (i=0; i<navMenu.length; i++)
	{ 
		// find the menu
		
		if ((navMenu[i][0]==strOpen)&&(navMenu[i][1]==0))
		{
			// check the menu's state
		
			show(navMenu[i][0]);
			// show the menu, because it's not visible
			
			navMenu[i][1]=1;
			// set the flag indicating the menu state is now visible
			
			ChangeImage (ImageElement,"/images/R9/minus.gif"); 
			// toggle image to minus sign
			
			break;
			// break out of the function, we've found our menu
		}
		else if ((navMenu[i][0]==strOpen)&&(navMenu[i][1]==1))
		{
			//check the menu's state
		
			hide(navMenu[i][0]);
			//hide the menu, because it's already open
		
			navMenu[i][1]=0;
			//set the flag indicating the menu state is hidden
			
			ChangeImage (ImageElement,"/images/R9/plus.gif"); 
			// toggle image to plus sign
		
			break;
			// break out of the function, we've found our menu
		}
	}
}

function openAll()
{
	for (i=0; i<navMenu.length; i++)
	{ 
		strOpen = navMenu[i][0]
		
		var ImageElement
		ImageElement = strOpen + "Image";
		
		if (navMenu[i][1]==0)
		{
			show(navMenu[i][0]);
			// show the menu, because it's not visible
			navMenu[i][1]=1;
			// set the flag indicating the menu state is now visible
			
			ChangeImage (ImageElement,"/images/R9/minus.gif"); 
			// toggle image to minus sign
		}
	}
}

function closeAll()
{
	for (i=0; i<navMenu.length; i++)
	{ 
		strOpen = navMenu[i][0]
		
		var ImageElement
		ImageElement = strOpen + "Image";
		
		if (navMenu[i][1]==1)
		{
			hide(navMenu[i][0]);
			// hide the menu
			navMenu[i][1]=0;
			// set the flag indicating the menu state is now hidden
			
			ChangeImage (ImageElement,"/images/R9/plus.gif"); 
			// toggle image to plus sign
		}
	}
}

function hide(str) {
x = document.getElementById(str);
x.style.display = 'none'; // hide the element
flagState = 0; // now it's off, keeping track of its state
}
function show(str) {
x = document.getElementById(str);
x.style.display = 'block'; // show the element
flagState = 1; // now it's on, keeping track of its state
}





/* not used */

function showHide(element) {
	if (document.getElementById) {
		// W3C standard
		var style2 = document.getElementById(element).style;
		style2.display = style2.display ? "" : "block";
	}
	else if (document.all) {
		// old MSIE versions
		var style2 = document.all[element].style;
		style2.display = style2.display ? "" : "block";
	}
	else if (document.layers) {
		// Netscape 4
		var style2 = document.layers[element].style;
		style2.display = style2.display ? "" : "block";
	}
}