// ------------- SETTINGS ------------- //

cVertical = true;
cCellWidth = 153;
cFlyCellWidth = 210;

cRootFontStyle = "height: 22px; background-image: url(images/button_chevron.gif); background-repeat: no-repeat; background-position: right top; background-color: #B6D1E6; border-top: 1px solid #E2EDF7; border-right: 1px solid #76A1BF; border-bottom: 1px solid #517AA7; border-left: 1px solid #E2EDF7; font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #3F6F9C; padding-left: 8px;"
cFontStyle = "height: 22px; background-image: url(images/button_chevron.gif); background-repeat: no-repeat; background-position: right top; background-color: #B6D1E6; border-top: 1px solid #E2EDF7; border-right: 1px solid #76A1BF; border-bottom: 1px solid #517AA7; border-left: 1px solid #E2EDF7; font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #3F6F9C; padding-left: 8px;"

cRootBGColor = "";
cRootHoverColor = "";
cRootHoverTextColor =  "";
cRootOutTextColor =  "";

cBGColor = "";
cHoverColor = "";
cHoverTextColor =  "";
cOutTextColor =  "";

// ----------------------------------- //


if (navigator.userAgent.indexOf("MSIE") != -1) cHoverCursor = "hand";
else cHoverCursor = "pointer";

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.location.href = "?page=" + arg ;
		//window.location.target=xtarget;
		//alert(window.location.target);
		window.open('content.asp?pageID=' + pageid,xtarget) ;		
		}
	}

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 = 0;
	while (obj)
		{
		iXValue += obj.offsetLeft;
		obj = obj.offsetParent;
		}
	return iXValue;
	}
	
function fnYOffset(obj)
	{
	var iYValue;
	iYValue = 0;
	while (obj)
		{
		iYValue += obj.offsetTop;
		obj = obj.offsetParent;
		}
	return iYValue;
	}
	
	
function fnCellOver(id,source)
{
	if (aNavData[id][0] == 0) 
	{	
		//source.style.color = cRootHoverTextColor;
	}
	else 
	{
		//source.style.color = cHoverTextColor;
	}
}

function fnCellOut(id,source)
{
	if (aNavData[id][0] == 0) 
	{	
		//source.style.color = cRootOutTextColor;
	}
	else 
	{
		//source.style.color = cOutTextColor;
	}
}

	
function fnMenuOver(id,source)
	{
	source.style.cursor = cHoverCursor;

	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) + 0);
					}
				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);
			

			
			}
		}
		
	if (aNavData[id][0] == 0) 
	{	
		source.style.backgroundColor = cRootHoverColor;
	}
	else 
	{
		source.style.backgroundColor = cHoverColor;
	}

	}

function fnMenuOut(out,source)
	{
		
	if (window.toFirsttime) clearTimeout(window.toFirsttime);	

	if (aNavData[out][0] == 0) 
	{
		source.style.backgroundColor = cRootBGColor;
	}
	else 
	{
		source.style.backgroundColor = cBGColor;
	}
	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\" bgcolor=\"#76A1BF\" border=\"0\" width=\"" + cFlyCellWidth + "\"";
			else strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"" + cCellWidth + "\"";
			if (aNavData[cnt][0] != 0) strTemp += " style=\"position : absolute ; visibility : hidden ; z-index: 3;\""; 
			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)
			{
			cnfBGColor = cRootBGColor;
			cnfFontStyle = cRootFontStyle;
			}
		else
			{
			cnfBGColor = cBGColor;
			cnfFontStyle = cFontStyle;
			}
		strTemp += "<td bgcolor=\"" + cnfBGColor + "\"";
		strTemp += " width=\"100%\">";
		if (aNavData[cnt][0] != 0) strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
		else  strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
		strTemp += "<tr onmouseover=\"fnMenuOver(" + cnt + ",this);\"  onmouseout=\"fnMenuOut(" + cnt + ",this)\"";
		if (aNavData[cnt][2]) strTemp += " onclick=\"fnMenuClick('" + aNavData[cnt][2] + "','" + aNavData[cnt][4] + "','" + aNavData[cnt][5] + "')\"";
		strTemp += ">";
		strTemp += "<td onmouseover=\"fnCellOver(" + cnt + ",this);\" onmouseout=\"fnCellOut(" + cnt + ",this);\" style=\"" + cnfFontStyle + "";
		if (aNavData[cnt][0] != 0) strTemp += "";
		strTemp += "\" width=\"100%\">";
		strTemp += aNavData[cnt][1];
		strTemp += "</td>";
		
		strTemp += "</tr></table></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>";
		}
	}


document.write(strTemp);