//////////////////////////////
// DHTML Expandable TOC Library
// By Nicholas Skapura
// Version 1.5
// 15 May 2001
// Copyright (c) 2001 Nicholas Skapura
//////////////////////////////

////////// Global Variables //////
var mnuIndent,MouseOver = false;

////////// Toggle Menu //////////
// Called locally (do not call in main page)
// Object - The sub menu container
//   to make visible.
/////////////////////////
function ToggleMenu(Object)
{
	if(!Object.ISOPEN)
	{
		Object.style.display = 'none';
		Object.ISOPEN = true;
	}
	else
	{
		Object.style.display = 'block';
		Object.ISOPEN = false;
	}
}

////////// Set Indent //////////
// Sets the indentation of the
// sub-menus.
// String - The string of
// indentation characters.
////////////////////////////////
function SetIndent(String)
{
	mnuIndent = String;
}

////////// Add Menu //////////
// Adds a Main Menu Item and
// Begins the sub-menu container.
// Name - Name label to display
// SubName - ID of sub-menu container
// Title - Optional title to assign
/////////////////////////
function AddMenu(Name,SubName,Title,Address,Color)
{
	if(Color != null)
	{
		if(Address != null)
		{
			if(Title != null)
				document.write("<A CLASS='MenuContainer' STYLE='color:" + Color + ";' TITLE='" + Title + "' HREF='" + Address + "'>");
			else
				document.write("<A CLASS='MenuContainer' STYLE='color:" + Color + ";' HREF='" + Address + "'>");
			document.write(Name);
			document.write("</A>");
		}
		else
		{
			if(Title != null)
				document.write("<DIV TITLE='" + Title + "' CLASS='MenuContainer' STYLE='color:" + Color + ";' ONMOUSEOVER='Highlight(this);' ONMOUSEOUT='Highlight(this);' ONCLICK='ToggleMenu(" + SubName + ");'>" + Name + "</DIV>");
			else
				document.write("<DIV CLASS='MenuContainer' STYLE='color:" + Color + ";' ONMOUSEOVER='Highlight(this);' ONMOUSEOUT='Highlight(this);' ONCLICK='ToggleMenu(" + SubName + ");'>" + Name + "</DIV>");
		}
	}
	else
	{
		if(Address != null)
		{
			if(Title != null)
				document.write("<A CLASS='MenuContainer' TITLE='" + Title + "' HREF='" + Address + "'>");
			else
				document.write("<A CLASS='MenuContainer' HREF='" + Address + "'>");
			document.write(Name);
			document.write("</A>");
		}
		else
		{
			if(Title != null)
				document.write("<DIV TITLE='" + Title + "' CLASS='MenuContainer' ONMOUSEOVER='Highlight(this);' ONMOUSEOUT='Highlight(this);' ONCLICK='ToggleMenu(" + SubName + ");'>" + Name + "</DIV>");
			else
				document.write("<DIV CLASS='MenuContainer' ONMOUSEOVER='Highlight(this);' ONMOUSEOUT='Highlight(this);' ONCLICK='ToggleMenu(" + SubName + ");'>" + Name + "</DIV>");
		}
	}
	document.write("<DIV CLASS='SubMenu' ID='" + SubName + "' ISOPEN=false>");
}

////////// CloseMenu ////
// Closes the sub-menu container
/////////////////////////
function CloseMenu()
{
	document.write("</DIV>");
}

////////// Add Sub-Menu //
// Adds a sub-menu item.
// Name - Name label to display
// Address - document URL when clicked
// Title - optional title to assign
/////////////////////////
function AddSubMenu(Name,Address,Title,Color)
{
	document.write(mnuIndent);
	if(Color != null)
	{
		if(Title != null)
			document.write("<A CLASS='MenuSub' STYLE='color:" + Color + ";' TITLE='" + Title + "' HREF='" + Address + "'>");
		else
			document.write("<A CLASS='MenuSub' STYLE='color:" + Color + ";' HREF='" + Address + "'>");
	}
	else
	{
		if(Title != null)
			document.write("<A CLASS='MenuSub' TITLE='" + Title + "' HREF='" + Address + "'>");
		else
			document.write("<A CLASS='MenuSub' HREF='" + Address + "'>");
	}
	document.write(Name);
	document.write("</A><BR>");
}