current_menu = "";
current_global_menu = "";
menu_on = 0;
global_menu_on = 0;

function buildMenu1(menu_name, menu_array)
{
	// [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: absolute; top: 100px; left: 100px; display: none;\" onMouseOver=\"stopTimer1();\" onMouseOut=\"startTimer1();\">\n");
	document.write("<table border=0 cellpadding=0 cellspacing=0 background='../images/home_white.gif'>\n");
	
	for (i = 3; i < menu_array.length; i = i + 3)
	{
		if (menu_array[i] == "")
		{
			break;
		}
	
		document.write("<tr>\n");
	
		if (i == 3)
		{
			document.write("<td id=\"" + menu_name + i + "\" style=\"border: 1px solid #" + menu_array[1] + ";\">\n");
		}
		else
		{
			document.write("<td id=\"" + menu_name + i + "\" style=\"border-bottom: 1px solid #" + menu_array[1] + "; border-left: 1px solid #" + menu_array[1] + "; border-right: 1px solid #" + menu_array[1] + ";\"\n");
		}
		
		if(menu_array[i+1].indexOf("javascript:")==-1){
			document.write("<span onClick=\"goUrl1('" + menu_array[i+1] + "', '" + menu_array[i+2] + "');\" onMouseOver=\"stopTimer1(), menuItemOn1('" + menu_name + i + "', '" + menu_array[2] + "');\" onMouseOut=\"menuItemOff1('" + menu_name + i + "', '" + menu_array[0] + "');\">\n");
		}
		else{
			document.write("<span onClick=\""+menu_array[i+1]+"\" onMouseOver=\"stopTimer1(), menuItemOn1('" + menu_name + i + "', '" + menu_array[2] + "');\" onMouseOut=\"menuItemOff1('" + menu_name + i + "', '" + menu_array[0] + "');\">\n");
		}
		
		document.write("<table width=\"100%\" border=0 cellpadding=0 cellspacing=0 style=\"padding-left:3px;padding-right:3px;padding-bottom:2px\"><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 buildParentLink1(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=\"stopTimer1(), showMenu1('menu_" + menu_counter + "');\" onMouseOut=\"startTimer1();\">");
		document.write("<table id=\"parent_menu_" + menu_counter + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"115\">");
		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=\"" + 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 buildParentGlobalLink1(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=\"" + link_url + "\" onMouseOver=\"stopTimer1(), showGlobalMenu1('global_menu_" + menu_counter + "');\" onMouseOut=\"startTimer1();\">" + 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 menuItemOn1(element_name, element_color)
{
	eval("document.getElementById(\"" + element_name + "\").style.background='#" + element_color + "'");
}

function menuItemOff1(element_name, element_color)
{
	eval("document.getElementById(\"" + element_name + "\").style.background='#" + element_color + "'");
}

function showMenu1(menu_name)
{
	if (current_menu != "")
	{
		hideMenu1();
	}
	
	current_menu = menu_name;
	
	parentWidth = eval("document.getElementById(\"parent_" + menu_name + "\").offsetWidth");

	xPos = getAbsPos1("parent_" + menu_name)[0];
	yPos = getAbsPos1("parent_" + menu_name)[1];
	xPos += parentWidth;
	
	// 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='underLine1'");
	eval("document.getElementById(\"parent_arrow_" + menu_name + "\").src=nav_arrow_on.src");
	eval("document.getElementById(\"parent_" + menu_name + "\").style.background='#BBCDDF'");
}

function showGlobalMenu1(menu_name)
{
	if (current_menu != "")
	{
		hideMenu1();
	}
	
	current_menu = menu_name;
	
	xPos = getAbsPos1("parent_link_" + menu_name)[0];
	yPos = getAbsPos1("parent_link_" + menu_name)[1];
	yPos += 16;
	xPos -= 2;
	
	// 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'");
}

function hideMenu1()
{
	// hide menu
	eval("document.getElementById(\"" + current_menu + "\").style.display='none'");
	
	// un-highlight parent link
//	eval("document.getElementById(\"parent_link_" + current_menu + "\").style.textDecoration='none'");
	if (eval("document.getElementById(\"parent_arrow_" + current_menu + "\")") != null)
	{
		eval("document.getElementById(\"parent_arrow_" + current_menu + "\").src=nav_arrow_off.src");
		eval("document.getElementById(\"parent_" + current_menu + "\").style.background='#ffffff'");
	}
	
	current_menu = "";
}

function startTimer1()
{
	menu_on = setTimeout("hideMenu1()", 500);
}

function stopTimer1()
{
	if (menu_on != 0)
	{
		clearTimeout(menu_on);
	}
}

function goUrl1(go_url, go_target)
{
	if (go_url != "")
	{
		if (go_target != "")
		{
			window.open(go_url);
		}
		else
		{
			location.href = go_url;
		}
	}
}

function getX1(el) 
{ 
	xPos = el.offsetLeft; 
	tempEl = el.offsetParent; 
	while (tempEl != null) 
	{ 
		xPos += tempEl.offsetLeft; 
		tempEl = tempEl.offsetParent; 
	} 
	return xPos; 
} 

function getY1(el) 
{ 
	yPos = el.offsetTop; 
	tempEl = el.offsetParent; 
	
	while (tempEl != null) 
	{ 
		yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; 
	} 
	
	return yPos; 
} 

function getAbsPos1(id) 
{ 
	var el = document.all ? document.all(id) : document.getElementById ? document.getElementById(id) : null; 
	
	if (el) 
	{ 
		var trueX = getX1(el); 
		var trueY = getY1(el); 
	} 
	
	return new Array(trueX, trueY);
} 

function underLine1(learn_link){

	eval("document.getElementById(\"learn_"+learn_link+"\").style.textDecorationunderLine1");

}

function removeU1(learn_link){

	eval("document.getElementById(\"learn_"+learn_link+"\").style.textDecorationNone");

}

function showMenuSide1(menu_name, side)
{
	if (current_menu != "")
	{
		hideMenu1();
	}
	
	current_menu = menu_name;
	
	parentWidth = eval("document.getElementById(\"parent_" + menu_name + "\").offsetWidth");
	parentHeight =  eval("document.getElementById(\"parent_" + menu_name + "\").offsetHeight");


	if (side == "left")
	{
		xPos = getAbsPos1("parent_" + menu_name)[0];
		yPos = getAbsPos1("parent_" + menu_name)[1];
		
//		xPos -= (eval("document.getElementById(\"" + menu_name + "\").offsetWidth"));
		xPos -= 152;
//		alert(menu_name);
//		yPos -= parentHeight;
	}
	
	if (side == "bottom")
	{
		xPos = getAbsPos1("parent_" + menu_name)[0];
		yPos = getAbsPos1("parent_" + menu_name)[1];
		yPos += parentHeight + 2;
	}
	
	// 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'");
	
}