leftedge = 0;

var mnumber = new Array();
var hiddens = new Array();
var closing = new Array();
var mparent = new Array();
for (i=0; i<=0; i++)
{
	mnumber[i] = 0;
	hiddens[i] = new Array();
	closing[i] = new Array();
	mparent[i] = new Array();
}

function displayMenu(type,which)
{
	clearTimeout(closing[type][which]);
	if ((ie || n6) && (eval("document.getElementById('menu" + type + "_" + which + "').style.visibility == 'hidden'")))
	{
		eval("document.getElementById('menu" + type + "_" + which + "').style.visibility = 'visible'");
	}
	else if (n4) {eval("document.menu" + type + "_" + which + ".visibility = 'visible'");}
	for (i=0; i<hiddens[type].length; i++)
	{
		if (i != which) {hideMenu(type,i);}
	}
	hiddens[type][which] = false;

	if (type > 0)
	{
		ptype = type - 1;
		displayMenu(ptype,mparent[type][which]);
	}
}

function delayHide(type,which)
{
	clearTimeout(closing[type][which]);
	closing[type][which] = setTimeout('hideMenu(' + type + ',' + which + ')',300);
	if (type > 0)
	{
		ptype = type - 1;
		delayHide(ptype,mparent[type][which]);
	}
}

function hideAll(type)
{
	for (i=0; i<hiddens[type].length; i++)
	{
		hideMenu(type,i);
	}
	if (type > 0)
	{
		ptype = type - 1;
		hideAll(ptype);
	}
}

function hideMenu(type,which)
{
	clearTimeout(closing[type][which]);
	if (ie || n6) {eval("document.getElementById('menu" + type + "_" + which + "').style.visibility = 'hidden'");}
	else if (n4) {eval("document.menu" + type + "_" + which + ".visibility = 'hidden'");}
	hiddens[type][which] = true;
}

var arrowcount = 0;

function createMenu(type,mtop,mleft,labellist,linklist)
{
	ptype = type - 1;
	ctype = type + 1;
	var labels = labellist.split('|');
	var links = linklist.split('|');
	var mheight = labels.length * 19 + 4;

	mleft = leftedge + 193
	mtop = mnumber[type] * 20 + 102;
	if (ie || n6) {document.write('<DIV id="menu'+type+'_'+mnumber[type]+'" style="TOP:'+mtop+'; LEFT:' + mleft + '; VISIBILITY:hidden; OVERFLOW:visible; POSITION:absolute; Z-INDEX:3;" onMouseOver = "displayMenu('+type+','+mnumber[type]+')" onMouseOut = "delayHide('+type+','+mnumber[type]+')">');}
	else if (n4) {document.write('<LAYER id="menu'+type+'_'+mnumber[type]+'" TOP="'+mtop+'" LEFT="' + mleft + '" HEIGHT="'+mheight+'" VISIBILITY="hide" onMouseOver = "displayMenu('+type+','+mnumber[type]+')" onMouseOut = "delayHide('+type+','+mnumber[type]+')" Z-INDEX="3">');}

	if (labellist != '')
	{
		document.write('<table width="310" border="0" cellpadding="0" cellspacing="0">');
		for (i=0; i<labels.length; i++)
		{
			var linkinfo = links[i].split('^');
			if (linkinfo[1])
			{
				mparent[ctype][linkinfo[1]] = mnumber[type];
				if (ie || n6)
				{
					document.write('<tr><td width="310" height="16" bgcolor="#5974a3" style="padding-left:8px;"><a class="submenu" href="'+linkinfo[0]+'">'+labels[i]+'</a></td></tr>');
				}
			}
			else
			{
				document.write('<tr><td width="310" height="16" bgcolor="#5974a3" style="padding-left:8px;"><a class="submenu" href="'+linkinfo[0]+'">'+labels[i]+'</a></td></tr>');
			}
			if (i < labels.length - 1)
			{
				document.write('<tr><td height="1" bgcolor="#768eb4"><img src="/images/spacer.gif" width="1" height="1" border="0" hspace="0" vspace="0"></td></tr>');
			}
			arrowcount++;
		}
		document.write('</table>');
	}
	if (ie || n6) {document.writeln('</DIV>');}
	else if (n4) {document.write('</LAYER>');}
	hiddens[type][mnumber[type]] = true;
	closing[type][mnumber[type]] = 0;
	mnumber[type]++;
}

