//-----------------------------------------------------------------------------
// quicktools submit function
function quicktoolsGo()
{
	quicktools_val = document.quicktools_form.quicktools.options[document.quicktools_form.quicktools.selectedIndex].value;

	// trigger Javascript function
	if (quicktools_val.search(/javascript\:/gi) != -1)
	{
		eval(quicktools_val.replace(/javascript\:/gi, ""));	
	}
	else
	{
		// trigger normal URL
		if (quicktools_val != "")
		{
			if (quicktools_val.split("|").length == 1)
			{
				// quicktools with no target specified
				parent.content.document.location.href = quicktools_val;
			}
			else
			{
				// target specified, use it.
				if (quicktools_val.split("|")[1] == "_top")
				{
					parent.location.href = quicktools_val.split("|")[0];
				}
			
				if (quicktools_val.split("|")[1] == "_blank" || quicktools_val.split("|")[1] == "_new")
				{
					window.open(quicktools_val.split("|")[0]);
				}
			}
		}
	}
}

//-----------------------------------------------------------------------------
// opens a new window to the Provider Directory.
function physicianDirectory()
{
	window.open('../physicianDirectory.asp','physdir','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=630,height=560');
}

//-----------------------------------------------------------------------------
// builds Breadcrumb navigation
function buildBreadcrumb(list)
{
	// expects a pipe delimited list of Name|URL|Target groups
	// At minimum, there must be 2 Name|URL pairs, one for the Home link, and one for the Constituent group
	bc_array = list.split("|");
	bc_string = "";
	bc_icon = "trans.gif";
	
	// determine which subnav icon to use
	if (bc_array[3] == "Me")
	{
		bc_icon = "icon_me.gif"
	}
	
	if (bc_array[3] == "My Company")
	{
		bc_icon = "icon_mycompany.gif";
	}
	
	if (bc_array[3] == "My Career")
	{
		bc_icon = "icon_mycareer.gif"
	}
	
	if (bc_array[3] == "Managers")
	{
		bc_icon = "icon_managers.gif";
	}

	bc_string += "<table border=0 cellpadding=0 cellspacing=0>";
	bc_string += "<tr>";
	bc_string += "<td><img src=\"images/" + bc_icon + "\" border=0 width=25 height=23 alt=\"Members Icon\"></td>";
	
	for (i = 0; i < bc_array.length; i = i + 3)
	{
		if ((i+3) == bc_array.length)
		{
			// current page identifier
			bc_string += "<td bgcolor=\"#003399\">&nbsp;&nbsp;</td>";
			
			if (bc_array[i+2] != "")
			{
				// link with specified target
				bc_string += "<td bgcolor=\"#003399\" class=\"breadcrumb_current\"><a href=\"" + bc_array[i+1]+ "\" class=\"breadcrumb\" target=\"" + bc_array[i+2] + "\">" + bc_array[i] + "</a></td>";
			}
			else
			{
				// target specified
				bc_string += "<td bgcolor=\"#003399\" class=\"breadcrumb_current\"><a href=\"" + bc_array[i+1]+ "\" class=\"breadcrumb\" target=\"content\">" + bc_array[i] + "</a></td>";
			}
			
			bc_string += "<td bgcolor=\"#003399\">&nbsp;&nbsp;</td>";
		}
		else
		{
			bc_string += "<td>&nbsp;&nbsp;</td>";
			if (bc_array[i+2] != "")
			{
				// link with specified target
				bc_string += "<td class=\"breadcrumb_noncurrent\"><a href=\"" + bc_array[i+1]+ "\" class=\"breadcrumb\" target=\"" + bc_array[i+2] + "\">" + bc_array[i] + "</a></td>";
			}
			else
			{
				// target specified
				bc_string += "<td class=\"breadcrumb_noncurrent\"><a href=\"" + bc_array[i+1]+ "\" class=\"breadcrumb\" target=\"content\">" + bc_array[i] + "</a></td>";
			}
			
			bc_string += "<td>&nbsp;&nbsp;</td>";
		}
	}
	
	bc_string += "</tr>";
	bc_string += "</table>";
	
	return bc_string;
}

//-----------------------------------------------------------------------------
// bulds Subnav bar
function buildSubnav(list)
{
	// expects a pipe delimited list of Name|URL|Target groups
	sn_array = list.split("|");
	sn_string = "";

	
	sn_string += "<table border=0 cellpadding=0 cellspacing=0>";
	sn_string += "<tr align=center>";
	sn_string += "<td nowrap valign=bottom align=center><img src=\"images/trans.gif\" border=0 width=2 height=1></td>";

	if (list == "")
	{
		sn_string += "<td class=subnav>&nbsp;</td>";
	}

	for (i = 0; i < sn_array.length; i = i + 3)
	{
		if (sn_array[i+2] != "")
		{
			// target defined
			sn_string += "<td nowrap class=subnav><a href=\"" + sn_array[i+1] + "\" class=subnav target=\"" + sn_array[i+2] + "\">" + sn_array[i] + "</a></td>";
		}
		else
		{
			// no target defined
			sn_string += "<td nowrap class=subnav><a href=\"" + sn_array[i+1] + "\" class=subnav target=\"content\">" + sn_array[i] + "</a></td>";
		}
		
		sn_string += "<td><img src=\"images/trans.gif\" border=0 width=16 height=1></td>";
	}

	sn_string += "</tr>";
	sn_string += "</table>";
	
	return sn_string;
}

//-----------------------------------------------------------------------------
// highlights the correct constituent tab
function setTab(list)
{
	me_tab_on = new Image();
	me_tab_on.src = "images/sub_tab_me_on.gif";
	
	mycompany_tab_on = new Image();
	mycompany_tab_on.src = "images/sub_tab_mycompany_on.gif";
	
	mycareer_tab_on = new Image();
	mycareer_tab_on.src = "images/sub_tab_mycareer_on.gif";
	
	managers_tab_on = new Image();
	managers_tab_on.src = "images/sub_tab_managers_on.gif";
	
	tab_array = list.split("|");
	
	if (tab_array[3] == "Me")
	{
		document.me_tab.src = me_tab_on.src;
	}
	
	if (tab_array[3] == "My Company")
	{
		document.mycompany_tab.src = mycompany_tab_on.src;
	}
	
	if (tab_array[3] == "My Career")
	{
		document.mycareer_tab.src = mycareer_tab_on.src;
	}
	
	if (tab_array[3] == "Managers")
	{
		document.managers_tab.src = managers_tab_on.src;
	}
}

//-----------------------------------------------------------------------------
// builds the quicktools dropdown
function buildQuicktools(qt_array)
{
	// uses the breadcrumb_list to determine what section to create the quicktools for

	qt_string = "";
	qt_string += "<option style=\"font-size: 11px:\" value=\"\">Quick Tools"
	
	for (i = 0; i < qt_array.length; i = i + 2)
	{
		qt_string += "<option style=\"font-size: 11px:\" value=\"" + qt_array[i+1] + "\">" + qt_array[i];
	}
	
	return qt_string;
}