<!--

var bgColour;
var highlightColour='#ffff80';
var itemSelectedColour='#ffCC10';
var prevNode = null;
var prevSelection = null;

function highlightMenu(val)
{	
	if ((val == "-1") && (prevNode != null))
	{
		prevNode.style.backgroundColor = bgColour;
		prevNode = null;
	}
	
	if (prevNode == null)
	{
		node = document.getElementById(val);
		
		if (node && (prevSelection != node))
		{
			bgColour = node.style.backgroundColor;
			node.style.backgroundColor=highlightColour;
			
			prevNode = node;
		}
	}
	else
	{
		node = document.getElementById(val);

		if ((node) && (node != prevNode) && (prevSelection != node))
		{
			node.style.backgroundColor=highlightColour;

			prevNode.style.backgroundColor=bgColour;
			prevNode = node;
		}
	}
}

function unhighlightMenu(val)
{	
	node = document.getElementById(val);
	
	if (node && (prevSelection != node))
	{
		if (prevNode)
		{
			prevNode.style.backgroundColor=bgColour;
		}
		node.style.backgroundColor=bgColour;
		prevNode = null;
	}
}

//this function highlights a menu item in the selected color
function selectMenu(val)
{
  if ((val == "-1") && (prevSelection != null))
	{
		prevSelection.style.backgroundColor = bgColour;
		prevSelection = null;
	}
	
	//if there is no previously selected item, select this item
	if (prevSelection == null)
	{
		var node = document.getElementById(val);
		
		if (node)
		{
			bgColour = node.style.backgroundColor;
			node.style.backgroundColor = itemSelectedColour;
			
			prevNode = null; //remove reference to any previously highlighted node
			prevSelection = node;
		}
	}
	else
	{
	  //there is a previously selected item, so de select it and select this item
		node = document.getElementById(val);

		if ((node) && (node != prevSelection))
		{
			node.style.backgroundColor = itemSelectedColour;

			prevNode = null; //remove reference to any previously highlighted node
			prevSelection.style.backgroundColor = bgColour;
			prevSelection = node;
		}
	}
}
//-->

