current_menu = "";
current_global_menu = "";
menu_on = 0;
global_menu_on = 0;

function buildMenu(menu_name, menu_array, section)
{
	//alert("buildmenu - " + menu_name);
	// [0] - Background Color
	// [1] - Border Color
	// [2] - Highlight Color
	// [3] - Link Name
	// [4] - Link HREF
	// [5] - Link Target

  //document.write(menu_array[5] + "<br>")

	if (section == "members") {
	  document.write("<span id=\"" + menu_name + "\" style=\"position: absolute; top: 100px; left: 100px; display: none;\" onMouseOver=\"stopTimer(),hideSelect('members');\" onMouseOut=\"startTimer(),showSelect('members');\">\n");
	}
	else {
	  if (section == "providers") {
	    document.write("<span id=\"" + menu_name + "\" style=\"position: absolute; top: 100px; left: 100px; display: none;\" onMouseOver=\"stopTimer(),hideSelect('providers');\" onMouseOut=\"startTimer(),showSelect('providers');\">\n");
	  }
	  else {
	    document.write("<span id=\"" + menu_name + "\" style=\"position: absolute; top: 100px; left: 100px; display: none;\" onMouseOver=\"stopTimer();\" onMouseOut=\"startTimer();\">\n");
	  }
	}
	
//document.write("<span id=\"" + menu_name + "\" style=\"position: absolute; top: 100px; left: 100px; display: none;\" onMouseOver=\"stopTimer();\" onMouseOut=\"startTimer();\">\n");

	
	if (menu_name == "global_menu_3")
	{
	document.write("<table border=0 cellpadding=0 cellspacing=0 bgcolor='#FEF0D8' width='150'>\n");
	}
	else if (menu_name == "global_menu_4")
	{
	document.write("<table border=0 cellpadding=0 cellspacing=0 bgcolor='#FEF0D8' width='200'>\n");
	}
	else
	{
	document.write("<table border=0 cellpadding=0 cellspacing=0 bgcolor='#FEF0D8' >\n");
	}
	
	for (i = 3; i < menu_array.length; i = i + 4)
	{
		if (menu_array[i] == "")
		{
			break;
		}
	
		document.write("<tr>\n");
	
		if (i == 4)
		{
			document.write("<td id=\"" + menu_name + i + "\" style=\"border-bottom: 1px solid #" + menu_array[1] + "; border-left: 5px solid #" + menu_array[1] + "; border-top: 1px solid #" + menu_array[1] + ";  border-right: 1px solid #" + menu_array[1] + ";\"\n");
		}
		else
		{
			document.write("<td id=\"" + menu_name + i + "\" style=\"border-bottom: 1px solid #" + menu_array[1] + "; border-left: 5px solid #" + menu_array[1] + "; border-right: 1px 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] + "'); " + menu_array[i+3] + "\" 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){
			// commented by tanuj 04/25/2006, escape is limiting the use of ? in the url.
				//document.write("<a class=\"dhtml_link\" href=\""  + escape(menu_array[i+1]) + "\">" + menu_array[i] + "</a>\n");
				document.write("<a class=\"dhtml_link\" href=\""  + menu_array[i+1] + "\" onClick=\"" + menu_array[i+3] + "\">" + menu_array[i] + "</a>\n");
			}
			else{
				document.write("<a class=\"dhtml_link\" href=\"javascript:doNothing();\" onClick=\"" + menu_array[i+3] + "\">" + menu_array[i] + "</a>\n");
			}	
			
		}
		else
		{
			document.write("<a class=\"dhtml_link\" href=\"javascript:doNothing();\" onClick=\"" + menu_array[i+3] + "\">" + 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, element_color)
{
	eval("document.getElementById(\"" + element_name + "\").style.background='#" + element_color + "'");
}

function menuItemOff(element_name, element_color)
{
	//alert("in");
	eval("document.getElementById(\"" + element_name + "\").style.background='#" + element_color + "'");
}

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'");
}

function showGlobalMenu(menu_name)
{
	if (current_menu != "")
	{
		hideMenu();
	}
	
	current_menu = menu_name;
	
	xPos = getAbsPos("parent_link_" + menu_name)[0];
	yPos = getAbsPos("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 hideMenu()
{
	// 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 startTimer()
{
	menu_on = setTimeout("hideMenu()", 500);
}

function stopTimer()
{
	if (menu_on != 0)
	{
		clearTimeout(menu_on);
	}
}

function goUrl(go_url, go_target)
{
	if (go_url != "")
	{
		if (go_target != "")
		{
			window.open(go_url);
		}
		else
		{
			location.href = go_url;
		}
	}
}

function getX(el) 
{ 
	xPos = el.offsetLeft; 
	tempEl = el.offsetParent; 
	while (tempEl != null) 
	{ 
		xPos += tempEl.offsetLeft; 
		tempEl = tempEl.offsetParent; 
	} 
	return xPos; 
} 

function getY(el) 
{ 
	yPos = el.offsetTop; 
	tempEl = el.offsetParent; 
	
	while (tempEl != null) 
	{ 
		yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; 
	} 
	
	return yPos; 
} 

function getAbsPos(id) 
{ 
	var el = document.all ? document.all(id) : document.getElementById ? document.getElementById(id) : null; 
	
	if (el) 
	{ 
		var trueX = getX(el); 
		var trueY = getY(el); 
	} 
	
	return new Array(trueX, trueY);
} 

function underLine(learn_link){

	eval("document.getElementById(\"learn_"+learn_link+"\").style.textDecorationUnderline");

}

function removeU(learn_link){

	eval("document.getElementById(\"learn_"+learn_link+"\").style.textDecorationNone");

}

function myHealthManagerDemoSm()
	{ w= 880;
	  h = 660;
	  w += 0;
      h += 0;
      wleft = (screen.width - w) / 2;
      wtop  = (screen.height - h) / 2;

	  window.open('/myhealthyhorizon/webDemo/index.html','physdir','width=' + w + ', height=' + h + ', ' +
				  'left=' + wleft + ', top=' + wtop + ', ' +
			  	  'location=no, menubar=no, ' +
				  'status=no, toolbar=no, scrollbars=auto, resizable=yes');
}

function popMembersTutorial()
{
	window.open('/redir/093002_tutorial.asp','membersTutorial','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=798,height=553');
}

// A Bucket scripts **********************************************
function writeLayer(layerID,txt){
	var ly
	if(document.all){
		ly=document.all[layerID]
		if(typeof(ly)=='object') ly.innerHTML=txt
		return;
	}
	if(document.getElementById){
		ly=document.getElementById(layerID) 
		if(typeof(ly)=='object') ly.innerHTML=txt
		return;
	}	
	if(document.layers){
		ly = document.layers[layerID]
		if(typeof(ly)=='object') {
			ly.document.open();
			ly.document.write(txt);
			ly.document.close();
		}
    }
}
function showAbucketCopy(active) {
	if (active=="claimstatus") {
		writeLayer("abucket_copy","Check the status of your claims and view your claim history.");
	}
	if (active=="eligibility") {
		writeLayer("abucket_copy","Confirm who in your family is covered under your plan. Review your plan's coinsurance and copay amounts.");
	}
	if (active=="authorizations") {
		writeLayer("abucket_copy","View authorizations and referrals that your physicians have generated and submitted on your behalf within 24 to 48 hours of submission.");
	}
	if (active=="IDcards") {
		writeLayer("abucket_copy","Request a new or replacement ID card or print a temporary coverage letter.");
	}
}

function hideAbucketCopy() {
	writeLayer("abucket_copy","Welcome to Member Online Services – the secure and easy way to better manage your health care!");
}

function showSubmenu_1() {
	document.getElementById("submenu_2").style.display="none";
	document.getElementById("submenu_3").style.display="none";
	document.getElementById("submenu_4").style.display="none";
	document.getElementById("submenu_5").style.display="none";
	document.getElementById("submenu_1").style.display="";	
}
function showSubmenu_2() {
	document.getElementById("submenu_1").style.display="none";
	document.getElementById("submenu_3").style.display="none";
	document.getElementById("submenu_4").style.display="none";
	document.getElementById("submenu_5").style.display="none";
	document.getElementById("submenu_2").style.display="";
}
function showSubmenu_3() {
	document.getElementById("submenu_1").style.display="none";
	document.getElementById("submenu_2").style.display="none";
	document.getElementById("submenu_4").style.display="none";
	document.getElementById("submenu_5").style.display="none";
	document.getElementById("submenu_3").style.display="";
}
function showSubmenu_4() {
	document.getElementById("submenu_1").style.display="none";
	document.getElementById("submenu_2").style.display="none";
	document.getElementById("submenu_3").style.display="none";
	document.getElementById("submenu_5").style.display="none";
	document.getElementById("submenu_4").style.display="";
}
function showSubmenu_5() {
	document.getElementById("submenu_1").style.display="none";
	document.getElementById("submenu_2").style.display="none";
	document.getElementById("submenu_3").style.display="none";
	document.getElementById("submenu_4").style.display="none";
	document.getElementById("submenu_5").style.display="";
}