<!--

// How to use:
// 	Id icons for a group: groupname + "GroupIcon"
//      Id group div tags: groupname + "GroupDiv".
// 	Call toggleGroup(groupname) when group icon is clicked or group heading is clicked.
//	Id item div tags: "ItemDiv" + anchorname.
//      Do not use the prefix "ItemDiv" for any div tags which will not be toggled.
//      Call toggleItem(anchorname) when item heading is clicked.
//	Call expandHash() at the bottom of the page.

// Buffer the images.
var minusImage = new Image();
minusImage.src = "images/icoMinus11.gif";

var plusImage = new Image();
plusImage.src = "images/icoPlus11.gif";

// Groups have an icon and items under them.
// The icon must be toggled and all items must be expanded or contracted 
// to match the icon's state.
function toggleGroup(id)
{
	var groupIcon = document.getElementById(id + "GroupIcon");
	var display = "";
	
	if(groupIcon.src == plusImage.src)
	{
		// Expand
		display = "";
		groupIcon.src = minusImage.src;
	}
	else
	{
		// Contract
		display = "none";
		groupIcon.src = plusImage.src;
	}
	
	// Get all items under this group and display them.
	var groupDiv = document.getElementById(id + "GroupDiv");
	var groupElements = groupDiv.getElementsByTagName("div");
	
	for(var i = 0; i < groupElements.length; i++)
	{
		var element = groupElements.item(i);
		
		if(element.id.substring(0, 7) == "ItemDiv")
		{
			element.style.display = display;
		}
	}
	
	return false;
}

function toggleItem(id)
{
	var itemDiv = document.getElementById("ItemDiv" + id);
	
	if(itemDiv.style.display == "none")
	{
		// Expand
		itemDiv.style.display = "";
	}
	else
	{
		// Contract
		itemDiv.style.display = "none";
	}
	
	return false;
}

// If we have a local (hash) anchor in the URL then
// expand the item associated with it.
function expandHash()
{
	// If we have a hash value, then expand it.
	if(document.location.hash != null && document.location.hash != "")
	{
		var nameOnly = document.location.hash.substring(1);
		var itemDiv = document.getElementById("ItemDiv" + nameOnly);
		itemDiv.style.display = "";
	}
}


//-->