// ------------- SETTINGS ------------- //

cVertical = true;
cArrow = "";
// ------------- CLASSES REQUIRED -------------- //
// MenuMainTable, MenuSubTable, MenuMain, MenuMainOver, MenuSub, MenuSubOver //


// ----------------------------------- //


function fnMenuClick(arg,pageid,xtarget)
	{
	for (cnt = 1 ; cnt < aTables.length ; cnt++)
		{
		oTable = eval("document.getElementById(\"oNavTable" + aTables[cnt] + "\")");
		oTable.style.visibility = "hidden";
		}
	if (arg != "*")
		{		
			window.open("content.asp?PageID=" + pageid, xtarget);
			//getCustomer('content',pageid);
		}
	}

function fnInArray(array,string)
	{
	var isTrue;
	isTrue = 0;
	for (inArrayCnt = 0 ; inArrayCnt < array.length ; inArrayCnt ++)
		{
		if (array[inArrayCnt] == string)
			{
			isTrue = 1;
			break;
			}
		}
	if (isTrue == 1) return true;
	else return false;
	}

function fnXOffset(obj)
	{
	var iXValue;
	iXValue = -1;
	while (obj)
		{
		iXValue += obj.offsetLeft;
		obj = obj.offsetParent;
		}
	return iXValue;
	}
	
function fnYOffset(obj)
	{
	var iYValue;
	iYValue = 4;
	while (obj)
		{
		iYValue += obj.offsetTop;
		obj = obj.offsetParent;
		}
	return iYValue;
	}
	
function fnCellOverParent(source)
{
	source.className = "MenuMainOver";
}	

function fnCellOutParent(source)
{
	source.className = "MenuMain";
}


function fnCellOver(id,source)
{
	if (aNavData[id][0] == 0) 
	{	
		source.className = "MenuMainOver";
	}
	else 
	{
		source.className = "MenuSubOver";		
	}
}

function fnCellOut(id,source)
{
	if (aNavData[id][0] == 0) 
	{	
		source.className = "MenuMain";		
	}
	else 
	{
		source.className = "MenuSub";		
	}
}

	
function fnMenuOver(id,source)
	{

	if (!window.inTimer) window.inTimer = window.setInterval("fnCloser()",100);

	iCell = id;
	iPanel = aNavData[id][0];
	clearTimeout(window.toPanel);
	
	if (aNavData[iCell][3])
		{
		document.getElementById("navDescript").innerHTML = aNavData[iCell][3];
		}
	
	if(fnInArray(aTables,iCell))
		{
		oTable = eval("document.getElementById(\"oNavTable" + id + "\")");
		
		if (oTable.style.visibility == "hidden")
			{
			if ((cVertical == false)&&(iPanel == 0))
				{
				oTable.style.left = (fnXOffset(source) - 0);
				oTable.style.top = (fnYOffset(source) + source.offsetHeight);
				}
			else
				{
				oTable.style.top = (fnYOffset(source) - 0);

				if ((fnXOffset(source) + source.offsetWidth + oTable.offsetWidth) > document.body.clientWidth)
					{
					oTable.style.left = (fnXOffset(source) - oTable.offsetWidth);
					oTable.style.top = (fnYOffset(source) + 3);
					}
				else
					{
					oTable.style.left = (fnXOffset(source) + source.offsetWidth);
					oTable.style.top = (fnYOffset(source) - 0);
					}
				}
			if (window.toFirsttime) clearTimeout(window.toFirsttime);
			window.toFirsttime = window.setTimeout("document.getElementById(\"oNavTable" + id + "\").style.visibility = \"visible\"",100);
			}
		}		
	}

function fnMenuOut(out,source)
	{
	if (window.toFirsttime) clearTimeout(window.toFirsttime);	
	window.toPanel = window.setTimeout("iPanel = -1",300);
	}

function fnCloser()
	{
	if (iPanel == -1)
		{
		for (cnt = 1 ; cnt < aTables.length ; cnt++)
			{
			oTable = eval("document.getElementById(\"oNavTable" + aTables[cnt] + "\")");
			oTable.style.visibility = "hidden";
			}
		}
	else
		{
		for (cnt = 1 ; cnt < aTables.length ; cnt++)
			{
			if (!fnInArray(aNavData[iCell][13],aTables[cnt]))
				{
				oTable = eval("document.getElementById(\"oNavTable" + aTables[cnt] + "\")");
				oTable.style.visibility = "hidden";				
				}
			}
		}
	}

var aTables, aTableData, iCell, iPanel, oSource, strTemp;

aTables = Array();
aTableData = Array();

for (cnt = 1 ; cnt < aNavData.length ; cnt++)
	{
	if (aNavData[cnt])
		{
		if (!fnInArray(aTables,aNavData[cnt][0]))
			{
			aTables[aTables.length] = aNavData[cnt][0];
			strTemp = "";
			if (aNavData[cnt][0] != 0)strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" style=\"visibility:hidden;\"  class=\"MenuSubTable\" border=\"0\"";
			else strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"MenuMainTable\"";
			
			strTemp += " id=\"oNavTable" + aNavData[cnt][0] + "\">";
			if ((cVertical == false)&&(aNavData[cnt][0] == 0)) strTemp += "<tr>";
			aTableData[aNavData[cnt][0]] = strTemp;
			}
		}	
	}

for (cnt = 1 ; cnt < aNavData.length ; cnt++)
	{
	if (aNavData[cnt])
		{
		strTemp = "";
		if ((cVertical == true)||(aNavData[cnt][0] != 0)) strTemp += "<tr>";

		if (aNavData[cnt][0] == 0)
			{
			cnfClass = "MenuMain";
			}
		else
			{
			cnfClass = "MenuSub";
			}
		if (aNavData[cnt][0] != 0)
		{
			strTemp += "<td class=\"" + cnfClass + "\" onmouseover=\"fnCellOverParent(tbl" + aNavData[cnt][0] + ");fnMenuOver(" + cnt + ",this);fnCellOver(" + cnt + ",this);\"  onmouseout=\"fnCellOutParent(tbl" + aNavData[cnt][0] + ");fnMenuOut(" + cnt + ",this);fnCellOut(" + cnt + ",this);\" style=\"cursor:pointer;\"";
		}
		else
		{
			strTemp += "<td id=\"tbl" + cnt + "\" class=\"" + cnfClass + "\" onmouseover=\"fnMenuOver(" + cnt + ",this);fnCellOver(" + cnt + ",this);\"  onmouseout=\"fnMenuOut(" + cnt + ",this);fnCellOut(" + cnt + ",this);\" style=\"cursor:pointer;\"";
		}
		if (aNavData[cnt][2]) strTemp += " onclick=\"fnMenuClick('" + aNavData[cnt][2] + "','" + aNavData[cnt][4] + "','" + aNavData[cnt][5] + "')\"";
		strTemp += ">";
		if (fnInArray(aTables,cnt) && aNavData[cnt][0] != 0)	strTemp += "<img src=\"" + cArrow + "\" align=\"right\">";		
	strTemp += aNavData[cnt][1];
		strTemp += "</td>";
		if ((cVertical == true)||(aNavData[cnt][0] != 0)) strTemp += "</tr>";
		aTableData[aNavData[cnt][0]] += strTemp;
		id = cnt;
		aNavData[cnt][13] = Array();
		while (id > 0)
			{
			for (x = 1 ; x < aNavData.length ; x++)
				{
				if (aNavData[x])
					{
					if (x == id)
						{
						aNavData[cnt][13][aNavData[cnt][13].length] = id; 

						id = aNavData[x][0];
						break;
						}
					}
				}
			}
		}
	}	

strTemp = "";

for (cnt = 0 ; cnt < aTableData.length ; cnt++)
	{
	if (aTableData[cnt])
		{
		strTemp += aTableData[cnt];
		if ((cVertical == false)&&(aNavData[cnt][0] == 0)) strTemp += "</tr>";
		strTemp += "</table>";
		}
	}


//window.clipboardData.setData("Text", strTemp);
document.write(strTemp);