current_menu = "";
current_global_menu = "";
menu_on = 0;
global_menu_on = 0;


//------------------------------- Code for Navigation -------------------//


function buildMenu(menu_name, menu_array, section)
{
	// [0] - Background Color
	// [1] - Border Color
	// [2] - Highlight Color
	// [3] - Link Name
	// [4] - Link HREF
	// [5] - Link Target

	document.write("<span id=\"" + menu_name + "\" style=\"position: Relative; top: 2px; left: 0px; display: none;\" onMouseOver=\"stopTimer();\" onMouseOut=\"startTimer();\">\n");   
	document.write("<table class=mainnav border=0 cellpadding=0 cellspacing=0>\n");
	document.write("<tr>\n");
	
	for (i = 3; i < menu_array.length; i = i + 3)
	{
		if (menu_array[i] == "")
		{
			break;
		}
		
		document.write("<td id=\"" + menu_name + i + "\" style=\"border-bottom: 0px solid #" + menu_array[1] + "; border-left: 0px solid #" + menu_array[1] + "; border-right: 0px solid #" + menu_array[1] + ";\"\n");

		if(menu_array[i+1].indexOf("javascript:")==-1){
			document.write("<span onClick=\"goUrl('" + menu_array[i+1] + "', '" + menu_array[i+2] + "');\" onMouseOver=\"stopTimer(), menuItemOn('" + menu_name + i + "', '" + menu_array[2] + "');\" onMouseOut=\"menuItemOff('" + menu_name + i + "', '" + menu_array[0] + "');\">\n");
		}
		else{
			document.write("<span onClick=\""+menu_array[i+1]+"\" onMouseOver=\"stopTimer(), menuItemOn('" + menu_name + i + "', '" + menu_array[2] + "');\" onMouseOut=\"menuItemOff('" + menu_name + i + "', '" + menu_array[0] + "');\">\n");
		}
		
		document.write("<table width=\"100%\" border=0 cellpadding=0 cellspacing=0><tr><td class=\"dhtml_link_cell\" width=\"100%\">\n");
		
		if (menu_array[i+2] == "")
		{
			if(menu_array[i+1].indexOf("javascript:")==-1){
				document.write("<a class=\"dhtml_link\" href=\""  + menu_array[i+1] + "\">" + menu_array[i] + "</a>\n");
			}
			else{
				document.write("<a class=\"dhtml_link\" href=\"javascript:doNothing();\">" + menu_array[i] + "</a>\n");
			}	
			
		}
		else
		{
			document.write("<a class=\"dhtml_link\" href=\"javascript:doNothing();\">" + menu_array[i] + "</a>\n");	
		}
		
		document.write("</td></tr></table>\n");
		document.write("</span>\n");
		document.write("</td>\n");
		
	}
	
	document.write("</tr>\n");
	document.write("</table>\n");
	document.write("</span>\n");

}

function buildParentLink(nav_font_color, nav_format, menu_counter, link_name, link_url)
{
	document.write("<tr>");
	
	document.write("<td>");
		document.write("<span id=\"parent_span_menu_" + menu_counter + "\" onMouseOver=\"stopTimer(), showMenu('menu_" + menu_counter + "');\" onMouseOut=\"startTimer();\">");
		document.write("<table id=\"parent_menu_" + menu_counter + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"150\">");
		document.write("<tr>");
		
		document.write("<td valign=\"top\" width=\"5\"><img src=\"images/home_" + nav_format + "_arrow.gif\" width=\"5\" height=\"10\" hspace=\"0\" vspace=\"4\" alt=\"nav arrow\" border=\"0\" id=\"parent_arrow_menu_" + menu_counter + "\"/></td>");
		document.write("<td width=\"110\" class=\"dhtml_parent_cell\"><a href=\"" +js_section_special +js_section + "_nav_go.asp?name=" + escape(link_name) + "&url=" + escape(link_url) + "\" style=\"color: #" + nav_font_color + "; text-decoration: none; font-weight: bold; font-size: 13px;\" id=\"parent_link_menu_" + menu_counter + "\">" + link_name + "</a></td>");
		
		document.write("</tr>");
		document.write("</table>");
		document.write("</span>");
	
	document.write("</td>");
	
	document.write("</tr>");
}

function buildParentGlobalLink(nav_font_color, nav_format, menu_counter, link_name, link_url)
{
	if (link_url.search(/javascript\:/) == -1)
	{
		rtn_string = "<span id=\"parent_link_global_menu_" + menu_counter + "\"><a class=\"topnav\" href=\"global_" +js_section + "_nav_go.asp?name=" + escape(link_name) + "&url=" + escape(link_url) + "\" onMouseOver=\"stopTimer(), showGlobalMenu('global_menu_" + menu_counter + "');\" onMouseOut=\"startTimer();\">" + link_name + "</a></span> &nbsp;&nbsp;|&nbsp;&nbsp;";
	}
	else
	{
		rtn_string = "<span id=\"parent_link_global_menu_" + menu_counter + "\"><a class=\"topnav\" href=\"" + link_url + "\">" + link_name + "</a><span> &nbsp;&nbsp;|&nbsp;&nbsp;";
	}
	
	return rtn_string;
}

function menuItemOn(element_name)
{
	eval("document.getElementById(\"" + element_name + "\")");
}

function menuItemOff(element_name)
{
	//alert("in");
	eval("document.getElementById(\"" + element_name + "\")");
}

function showMenu(menu_name)
{
	if (current_menu != "")
	{
		hideMenu();
	}
	
	current_menu = menu_name;
	
	parentWidth = eval("document.getElementById(\"parent_" + menu_name + "\").offsetWidth");

	xPos = getAbsPos("parent_" + menu_name)[0];
	yPos = getAbsPos("parent_" + menu_name)[1];
	xPos += parentWidth - 5;
	
	// show menu
	eval("document.getElementById(\"" + menu_name + "\").style.left='" + xPos + "'");
	eval("document.getElementById(\"" + menu_name + "\").style.top='" + yPos + "'");
	eval("document.getElementById(\"" + menu_name + "\").style.display='block'");
	
	// highlight parent link
//	eval("document.getElementById(\"parent_link_" + menu_name + "\").style.textDecoration='underline'");
	//eval("document.getElementById(\"parent_arrow_" + menu_name + "\").src=nav_arrow_on.src");
	//eval("document.getElementById(\"parent_" + menu_name + "\").style.background='#BBCDDF'");
}

//-->
