// ------------- SETTINGS ------------- //

cVertical = true;
cCellWidth = 141;
cRootFontStyle = "font-family: Georgia, Times New Roman, Times, serif;font-size: 10px;font-weight: bold;text-transform: uppercase;color: #EDAB51;padding-left: 17px;border: 1px solid #878106;height: 18px;background-image: url(images/menu_arrow.gif);background-repeat: no-repeat;background-position: left top;"
cFontStyle = "font-family: Georgia, Times New Roman, Times, serif;font-size: 10px;font-weight: bold;text-transform: uppercase;color: #EDAB51;padding-left: 17px;	height: 18px;	background-image: url(images/menu_arrow.gif);	background-repeat: no-repeat;	background-position: left top;cTextCellPadding = 1;"

cRootBGColor = "#706902";
cRootHoverColor = "#990000";
cRootHoverTextColor =  "#EDAB51";
cRootOutTextColor =  "#EDAB51";


cBGColor = "#706902";
cHoverColor = "#990000";
cHoverTextColor =  "#EDAB51";
cOutTextColor =  "#EDAB51";

cBorderColor = "#BBBBBB";
cArrow = "images/spacer.gif";
cArrowOver = "images/spacer.gif";
cSpacerImage = "images/spacer.gif";

// ----------------------------------- //


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;
		window.location.href = "content.asp?pageID=" + 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 = 2;
	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;
	}

	if (eval("document.getElementById(\"oMenuArrow" + id + "\")"))
		{
		eval("document.getElementById(\"oMenuArrow" + id + "\").src = \"" + cArrowOver + "\"");
		}		
	}

function fnMenuOut(out,source)
	{
	if (eval("document.getElementById(\"oMenuArrow" + out + "\")"))
		{
		eval("document.getElementById(\"oMenuArrow" + out + "\").src = \"" + cArrow + "\"");
		}
	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=\"1\" style=\"position : absolute ; visibility : hidden ; widht : auto;\" border=\"0\" bgcolor=\"#878106\" width=\"200\"";
			else strTemp += "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" width=\"" + cCellWidth + "\"";
			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%\"  style=\"border-bottom:1px solid #878106;\">";
		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 + ";border-bottom:#FFFFFF;";
		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);
