<!--

var timeout = 100;
var timerID;

var childNameBase = 'child';
var iframeSuffix = 'Iframe';
var parentElement = 0;


function swapImages(image, state)
{
	var imageSrc = image.src;
	var extension = imageSrc.substr(imageSrc.lastIndexOf('.'), imageSrc.length);
	imageSrc = imageSrc.substr(0, imageSrc.lastIndexOf('-') + 1);
	imageSrc = imageSrc + state + extension;
	image.src = imageSrc;
}

function menuOn(element, id)
{
	try
	{
		if (timerID)
		{
			clearTimeout(timerID);
			menusOff();
		}

		// hightlight title
		parentElement = element;
		parentElement.style.color = '#FF6600';
		swapImages(parentElement.getElementsByTagName('IMG')[0], 'on');

		// show menu
		if (id)
		{
			// show menu
			id = childNameBase + id;
			document.getElementById(id).style.visibility = 'visible';
			// show iframe
			id += iframeSuffix;
			if(iframeElement = document.getElementById(id))
				iframeElement.style.visibility = 'visible';	

		}		
	}
	catch(e){}
}

function menuOff(id)
{
	try
	{
		if (parentElement)
		{
			parentElement.style.color = 'black';
			swapImages(parentElement.getElementsByTagName('IMG')[0], 'off');
			parentElement = 0;
		}

		if (id)
		{
			// hide menu
			id = childNameBase + id;

			var element = document.getElementById(id);
			if (element)
			{
				element.style.visibility = 'hidden';
			}

			// hide iframe
			id += iframeSuffix;

			if(iframeElement = document.getElementById(id))
			{
				iframeElement.style.visibility = 'hidden';
			}
		}
	}
	catch(e){}
}

function menusOff()
{
	try
	{
		if (parentElement)
		{
			parentElement.style.color = 'black';
			swapImages(parentElement.getElementsByTagName('IMG')[0], 'off');
			parentElement = 0;
		}

		var id = '';

		for (var i = 0; i < gNumMenus; i++)
		{
			// hide menu
			id = childNameBase + (i+1);
			document.getElementById(id).style.visibility = 'hidden';
			
			// hide iframe
			id += iframeSuffix;
			if(iframeElement = document.getElementById(id))
				iframeElement.style.visibility = 'hidden';
		}
	}
	catch(e){}
}

function menuIn()
{
	clearTimeout(timerID);
}

function menuOut(id)
{
	timerID = setTimeout("menuOff('" + id + "')", timeout);
}

function hover(element, on)
{
	on ? element.style.backgroundColor = '#E8E8E8' : element.style.backgroundColor = 'white';
	on ? element.style.color = '#FF6600' : element.style.color = '#666666';
}