<!--hide this script from non-javascript-enabled browsers

var ToolBar_Supported = false;
var Frame_Supported   = false;
var DoInstrumentation = false;

//if (navigator.userAgent.indexOf("MSIE")    != -1 && 
//	navigator.appVersion.substring(0,1) > 3)
//{
//	ToolBar_Supported = true;
//	navigator.userAgent.indexOf("Windows") != -1 && 
//}

ToolBar_Supported = true;
if (ToolBar_Supported)
{
	var newLineChar = String.fromCharCode(10);
	var char34 = String.fromCharCode(34);
	var LastMSMenu = "";
	var CurICPMenu = "";
	var CurDropDown = "";
	var IsMSMenu = false;
	var IsMenuDropDown = true;
	var HTMLStr;
	var x = 0;
	var y = 0;
	var x2 = 0;
	var y2 = 0;
	var MSMenuWidth;
	var ToolbarMinWidth;
	var ToolbarMenu;
	var ToolbarBGColor;
	var ToolbarLoaded = false;
	var SideMenu;
	
	var Debug;
	
	var aDefMSColor  = new Array(3);
	var aDefICPColor = new Array(3);
	var aDefSIDEColor = new Array(3);
	var aCurMSColor  = new Array(3);
	var aCurICPColor = new Array(3);
	var aCurSIDEColor = new Array(3);
	var MSFont;
	var ICPFont;
	var SIDEFont;
	var MaxMenu = 30;
	var TotalMenu = 0;
	var arrMenuInfo = new Array(30);
	var clientX;
	var clientY;
	var dropX;
	var dropX2;
	var dropY;
	var dropY2;
	var sideX;
	var sideX2;
	var sideY;
	var sideY2;
	var IsSideMenu = false;
	var IsDropMenu = false;
	var arrowX;
	var arrowColor = "black";
	
	// Output style sheet and toolbar ID
	document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");

	// Build toolbar template
	HTMLStr = 
		"<DIV ID='idToolbar'     STYLE='background-color:white;width:100%;'>" +
		"<DIV ID='idRow1'        STYLE='position:relative;height:20;top:0'>" +
			"<a name=CGATop><DIV ID='idICPBanner'   STYLE='position:absolute;top:0;left:0;height:160;width:100%;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>" +
			"<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0;left:250;height:20;width:18;overflow:hidden;vertical-align:top;'><img src='images/curve.gif' width=18 height=20 hspace=0 vspace=0 border=0 align=left></DIV>" +
			"<DIV ID='idMSMenuPane'  STYLE='position:absolute;top:0;left:250;height:20;width:10;background-color:black;float:right;' NOWRAP><!--MS_MENU_TITLES--></DIV>" + 
		"</DIV>" +
		"<DIV ID='idRow2' STYLE='position:relative;left:355;height:55;'>" +
			"<DIV ID='idADSBanner'   STYLE='position:absolute;left:0;top:0;width:201;vertical-align:top;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>" +
			"<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0;width:112;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>" +
		"</DIV>" +
		"<DIV ID='idRow3' STYLE='position:relative;height:20;width:100%;z-index:100;'>" +
		"<DIV ID='idICPMenuPane' STYLE='position:absolute;top:0;left:0;height:20;background-color:black;z-index:100;' NOWRAP><!--ICP_MENU_TITLES--></DIV>" +
		"</DIV>" +
		"<DIV ID='sideArrow' STYLE='position:absolute;top:0;left:0;height:20;font-weight:bold;color:black;display:none;' NOWRAP>&raquo;</DIV>" +
		"</DIV>" +
		"</DIV>" +
		"<SCRIPT TYPE='text/javascript'>" + 
		"   var ToolbarMenu = StartMenu;" + 
		"</SCRIPT>" + 
		"<DIV WIDTH=100%>";

	// Define event handlers
	window.onresize  = resizeToolbar;

	
	
	aDefMSColor[0]	= aCurMSColor[0]  = "white";	// bgcolor;
	aDefMSColor[1]	= aCurMSColor[1]  = "white";	// text font color
	aDefMSColor[2]  = aCurMSColor[2]  = "red";		// mouseover font color
	
	aDefICPColor[0]	= aCurICPColor[0] = "#6699CC";	// bgcolor;
	aDefICPColor[1] = aCurICPColor[1] = "white";	// text font color
	aDefICPColor[2] = aCurICPColor[2] = "red";		// mouseover font color			
}

// The hard-coded numbers in functions - drawToolbar() & resizeToolbar()
// correspond to the dimension of the four gif files:
//		ICP_BANNER: 60h x 250w
//		ADS_BANNER: 40h x 200w
//		MSC_BANNER: 40h x 112w
//		Curve:	    20h x 18w

function drawToolbar()
{
	HTMLStr += "</DIV><div style='position:absolute;top:30;left:70%;z-index:1;font-family:arial;font-size:16px;font-style:italic;font-weight:bold;'>"
	HTMLStr += "(781) 335-5200<br><a href=mailto:info@electroswitch.com>info@electroswitch.com</a></div>";
	document.write(HTMLStr);
	ToolbarLoaded = true;

	MSMenuWidth     = Math.max(idMSMenuPane.offsetWidth, (200+20)); //after + is right margin
	ToolbarMinWidth = (250+18) + MSMenuWidth;

	idToolbar.style.backgroundColor     = ToolbarBGColor;
	idMSMenuPane.style.backgroundColor  = aDefMSColor[0];
	idICPMenuPane.style.backgroundColor = aDefICPColor[0];
	resizeToolbar();

	for (i = 0; i < TotalMenu; i++) 
	{
		thisMenu = document.all(arrMenuInfo[i].IDStr);
		if (thisMenu != null)
		{
			if (arrMenuInfo[i].IDStr == LastMSMenu && arrMenuInfo[i].type == "R")
			{
				//Last MSMenu has to be absolute width
				arrMenuInfo[i].type = "A";
				arrMenuInfo[i].unit = 200;
			}
			if (arrMenuInfo[i].type == "A")
				thisMenu.style.width = arrMenuInfo[i].unit;
			else 
				thisMenu.style.width = Math.round(arrMenuInfo[i].width * arrMenuInfo[i].unit) + 'em';
		}
	}
}

function resizeToolbar()
{
	if (ToolBar_Supported == false) return;

	w = Math.max(ToolbarMinWidth, document.body.clientWidth) - ToolbarMinWidth;
	
	idMSMenuCurve.style.left  = (250+w);
	idMSMenuPane.style.left   = (250+w+18);
	idMSMenuPane.style.width  = MSMenuWidth;

	idADSBanner.style.left    = (w+18);

	idMSCBanner.style.left    = (w+18+200);
	idMSCBanner.style.width   = (MSMenuWidth - 200);
	
	idICPMenuPane.style.width = ToolbarMinWidth + w;
}

function setToolbarBGColor(color)
{	
	ToolbarBGColor = color;
	if (ToolbarLoaded == true)
		idToolbar.style.backgroundColor = ToolbarBGColor;
}	

function setMSMenuFont(sFont)
{	MSFont = sFont;
}

function setICPMenuFont(sFont)
{	ICPFont = sFont;
}

function setSIDEMenuFont(sFont)
{	SIDEFont = sFont;
}

function setDefaultMSMenuColor(bgColor, fontColor, mouseoverColor)
{	
	if (bgColor   != "")	  aDefMSColor[0] = bgColor;
	if (fontColor != "")	  aDefMSColor[1] = fontColor;
	if (mouseoverColor != "") aDefMSColor[2] = mouseoverColor;
}

function setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor)
{	
	if (bgColor   != "")	  aDefICPColor[0] = bgColor;
	if (fontColor != "")	  aDefICPColor[1] = fontColor;
	if (mouseoverColor != "") aDefICPColor[2] = mouseoverColor;
}

function setDefaultSIDEMenuColor(bgColor, fontColor, mouseoverColor)
{	
	if (bgColor   != "")	  aDefSIDEColor[0] = bgColor;
	if (fontColor != "")	  aDefSIDEColor[1] = fontColor;
	if (mouseoverColor != "") aDefSIDEColor[2] = mouseoverColor;
}

function setDefaultSIDEArrowColor(color)
{	if ( (color != null) && (color != "") )	
		arrowColor = color;
}

function setICPMenuColor(MenuIDStr, bgColor, fontColor, mouseoverColor)
{	
	if (ToolbarLoaded == false) return;

	// Reset previous ICP Menu color if any
	if (CurICPMenu != "")
	{
		PrevID = CurICPMenu.substring(4);
		CurICPMenu = "";
		setICPMenuColor(PrevID, aDefICPColor[0], aDefICPColor[1], aDefICPColor[2]);
	}

	var	id = "AM_" + "ICP_" + MenuIDStr;
	var thisMenu = document.all(id);
	if (thisMenu != null)
	{
		CurICPMenu = "ICP_" + MenuIDStr;
		aCurICPColor[0] = bgColor;
		aCurICPColor[1] = fontColor;
		aCurICPColor[2] = mouseoverColor;

		// Change menu color
		if (bgColor != "")
			thisMenu.style.backgroundColor = bgColor;
		if (fontColor != "")
			thisMenu.style.color = fontColor;

		// Change subMenu color
		id = "ICP_" + MenuIDStr;
		thisMenu = document.all(id);
		if (thisMenu != null)
		{
			if (bgColor != "")
				thisMenu.style.backgroundColor = bgColor;
			
			if (fontColor != "")
			{
				i = 0;
				id = "AS_" + "ICP_" + MenuIDStr;
				thisMenu = document.all.item(id,i);
				while (thisMenu != null)
				{
					thisMenu.style.color = fontColor;
					i += 1;
					thisMenu = document.all.item(id,i);
				}
			}
		}
	}
}

function setAds(Gif,Url,AltStr)
{	

//setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
//cas start
//HTMLstr = "<DIV ID='CAS' STYLE='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; position:absolute;top:30;left:650;height:40;width:800;vertical-align:top;'>"
	
	begPos = HTMLStr.indexOf("<!--BEG_ADS_BANNER-->");
	endPos = HTMLStr.indexOf("<!--END_ADS_BANNER-->") + 21;
	SubStr = HTMLStr.substring(begPos, endPos);
	SrcStr = "";
	SrcStr = SrcStr + "<form name='frmCGAQuick' ACTION='' target=new>";
	SrcStr = SrcStr + "<BR><FONT COLOR=" + CGAOverColor +">Quick Search:  ";
	SrcStr = SrcStr + "<input size='10' name='bill_num' maxlength='50'>  ";
	//SrcStr = SrcStr + " Year <input size='4' name='which_year' maxlength='4'></FONT>";
	SrcStr = SrcStr + "</FORM>";
	SrcStr = SrcStr + "</DIV>";
	SrcStr = SrcStr + "<!--END_ADS_BANNER-->";
	SrcStr = "<!--BEG_ADS_BANNER-->" + SrcStr;
	HTMLStr = HTMLStr.replace(SubStr, SrcStr);	

//cas end

}

function setICPBanner(Gif,Url,AltStr)
{	setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
}

function setMSBanner(Gif,Url,AltStr)
{	tempGif = "/images/" + Gif;
		
	setBanner(tempGif,Url,AltStr,"<!--BEG_MSC_BANNER-->","<!--END_MSC_BANNER-->");
}

function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
{
	begPos = HTMLStr.indexOf(BanBegTag);
	endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
	
	SubStr = HTMLStr.substring(begPos, endPos);
	SrcStr = "";
	if (BanUrl != "")
		SrcStr += "<A Target='_top' HREF='" + formatURL(BanUrl, BanGif) + "'>";
	SrcStr += "<IMG SRC='" + BanGif + "' height='75' width='100%' ALT='" + BanAltStr + "' BORDER=0>";
	if (BanUrl != "")
		SrcStr += "</A>";
	SrcStr = BanBegTag + SrcStr + BanEndTag;
	HTMLStr = HTMLStr.replace(SubStr, SrcStr);	
}

function setICPSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{	tempID = "ICP_" + MenuIDStr;
	setSubMenuWidth(tempID, WidthType, WidthUnit);
}

function setMSSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{	tempID = "MS_" + MenuIDStr;
	setSubMenuWidth(tempID, WidthType, WidthUnit);
}

function setSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{
	var fFound = false;
	if (TotalMenu == MaxMenu)
	{
		alert("Unable to process menu. Maximum of " + MaxMenu + " reached.");
		return;
	}
	
	for (i = 0; i < TotalMenu; i++)
		if (arrMenuInfo[i].IDStr == MenuIDStr)
		{
			fFound = true;
			break;
		}

	if (!fFound)
	{
		arrMenuInfo[i] = new menuInfo(MenuIDStr);
		TotalMenu += 1;
	}

	if (!fFound && WidthType.toUpperCase().indexOf("DEFAULT") != -1)
	{
		arrMenuInfo[i].type = "A";
		arrMenuInfo[i].unit = 199;
	}
	else
	{
		arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
		arrMenuInfo[i].unit = WidthUnit;
	}
}

// This function creates a menuInfo object instance.
function menuInfo(MenuIDStr)
{
	this.IDStr = MenuIDStr;
	this.type  = "";
	this.unit  = 0;
	this.width = 0;
	this.count = 0;
}

function updateSubMenuWidth(MenuIDStr)
{
	for (i = 0; i < TotalMenu; i++)
		if (arrMenuInfo[i].IDStr == MenuIDStr)
		{
			if (arrMenuInfo[i].width < MenuIDStr.length) 
				arrMenuInfo[i].width = MenuIDStr.length;
			arrMenuInfo[i].count = arrMenuInfo[i].count + 1;
			break;
		}
}

function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{ 	
	if (addICPMenu.arguments.length > 4)
		TargetStr = addICPMenu.arguments[4];
	else
		TargetStr = "_top";
	tempID = "ICP_" + MenuIDStr;
	addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true); 
}

function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{	
	TargetStr = "_top";
	tempID = "MS_" + MenuIDStr;
	addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false); 
	LastMSMenu = tempID;
}

function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
{
	cFont   = bICPMenu? ICPFont : MSFont;
	cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
	cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
	cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
	tagStr  = bICPMenu? "<!--ICP_MENU_TITLES-->" : "<!--MS_MENU_TITLES-->";

	MenuStr = newLineChar;
	if (bICPMenu == false && LastMSMenu != "")
		MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'>|&nbsp;</SPAN>"; 
	MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
			   "   ID='AM_" + MenuIDStr + "'" +
			   "   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";'";
	if (MenuURLStr != "")
	{
		if (bICPMenu)
			MenuStr += " HREF='" + formatURL(MenuURLStr, ("ICP_" + MenuDisplayStr)) + "'";
		else
			MenuStr += " HREF='" + formatURL(MenuURLStr, ("MS_" + MenuDisplayStr)) + "'";
	}
	else
		MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
	MenuStr += 	" onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
				" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
				"&nbsp;" + MenuDisplayStr + "&nbsp;</a>";
	if (bICPMenu)
		MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'>&nbsp;|</SPAN>";
	MenuStr += tagStr;
	
	HTMLStr = HTMLStr.replace(tagStr, MenuStr);	
	setSubMenuWidth(MenuIDStr,"default",0);
}

function addICPSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{	
	if (addICPSubMenu.arguments.length > 3)
		TargetStr = addICPSubMenu.arguments[3];
	else
		TargetStr = "_top";
	tempID = "ICP_" + MenuIDStr;
	addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true); 
}

function addICPSideMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{	
	if (addICPSideMenu.arguments.length > 3)
		TargetStr = addICPSideMenu.arguments[3];
	else
		TargetStr = "_top";
	tempID = "ICPSide_" + MenuIDStr;
	addSideMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true); 
}

function addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{	
	TargetStr = "_top";
	tempID = "MS_" + MenuIDStr;
	addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false); 
}

function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
{
	cFont   = bICPMenu? ICPFont : MSFont;
	cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
	cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
	cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
	
	var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
	if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
	InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;;
	URLStr        = formatURL(SubMenuURLStr, InstrumentStr);

	var LookUpTag  = "<!--" + MenuIDStr + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos <= 0)
	{
		HTMLStr += newLineChar + newLineChar +
				"<SPAN ID='" + MenuIDStr + "'" +
				" STYLE='display:none;position:absolute;width:160;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'" +
				" >";
		if (Frame_Supported == false || bICPMenu == false)
			HTMLStr += "<HR  STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
		HTMLStr += "<DIV STYLE='position:relative;left:0;top:8;'>";
	}

	TempStr = newLineChar +
				"<A ID='AS_" + MenuIDStr + "'" +
				"   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + "'" +
				"   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
				" onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
				" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doSideMenu('" + SubMenuStr + "');" + char34 + ">" +
				"&nbsp;" + SubMenuStr + "</A><BR>" + LookUpTag;
	if (sPos <= 0)
		HTMLStr += TempStr + "</DIV></SPAN>";
	else
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);	

	updateSubMenuWidth(MenuIDStr);	
	//alert("Sub Menu Tempstr: " + TempStr);
}

function addSideMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
{
	cFont   = SIDEFont;
	cColor0 = aDefSIDEColor[0];
	cColor1 = aDefSIDEColor[1];
	cColor2 = aDefSIDEColor[2];
	
	var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
	if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
	InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;;
	URLStr        = formatURL(SubMenuURLStr, InstrumentStr);

	var LookUpTag  = "<!--" + MenuIDStr + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos <= 0)
	{
		HTMLStr += newLineChar + newLineChar +
				"<SPAN ID='" + MenuIDStr + "'" +
				" STYLE='display:none;position:absolute;width:199;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'" +
				" >";
		if (Frame_Supported == false || bICPMenu == false)
			HTMLStr += "<HR  STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
		HTMLStr += "<DIV STYLE='position:relative;left:0;top:8;'>";
		//alert(HTMLStr);
	}

	TempStr = newLineChar +
				"<A ID='AS_" + MenuIDStr + "'" +
				"   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + "'" +
				"   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
				" onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
				" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
				"&nbsp;" + SubMenuStr + "</A><BR>" + LookUpTag;
	if (sPos <= 0)
		HTMLStr += TempStr + "</DIV></SPAN>";
	else
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);	

	updateSubMenuWidth(MenuIDStr);	
	//alert(TempStr);
}

function addICPSubMenuLine(MenuIDStr)
{	
	tempID = "ICP_" + MenuIDStr;
	addSubMenuLine(tempID,true);
}

function addMSSubMenuLine(MenuIDStr)
{	
	tempID = "MS_" + MenuIDStr;
	addSubMenuLine(tempID,false);
}

function addSubMenuLine(MenuIDStr, bICPMenu)
{
	var LookUpTag = "<!--" + MenuIDStr + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos > 0)
	{
		cColor  = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
		TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
	}
}

function mouseMenu(id, MenuIDStr) 
{
	IsMSMenu   = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
	IsOnSideMenu = (MenuIDStr.toUpperCase().indexOf("ICPSIDE_") != -1);
	IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);
	
	if (IsMouseout)
	{
		color = IsMSMenu? aDefMSColor[1] : aDefICPColor[1];
		if (MenuIDStr == CurICPMenu && aCurICPColor[1] != "")
			color = aCurICPColor[1];
		if (IsOnSideMenu)
			color = aDefSIDEColor[1];
	}
	else
	{
		color = IsMSMenu? aDefMSColor[2] : aDefICPColor[2];
		if (MenuIDStr == CurICPMenu && aCurICPColor[2] != "") 
			color = aCurICPColor[2];
		if (IsOnSideMenu)
			color = aDefSIDEColor[2];	
	}
	window.event.srcElement.style.color = color;
}

function doMenu(MenuIDStr) 
{
	var thisMenu = document.all(MenuIDStr);
	if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) 
	{
		window.event.cancelBubble = true;
		return false;
	}
	// Reset dropdown menu
	window.event.cancelBubble = true;
	ToolbarMenu.style.display = "none";
	if (SideMenu != null && SideMenu != "") {
		SideMenu.style.display = "none";
		sideArrow.style.display = "none";
		IsSideMenu = false;
		}	
	//**DEBUG
	
	showElement("SELECT");
	showElement("OBJECT");
	
	
	ToolbarMenu = thisMenu;
	IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);

	// Set dropdown menu display position
	x  = window.event.srcElement.offsetLeft +
	 	 window.event.srcElement.offsetParent.offsetLeft;
	if (MenuIDStr == LastMSMenu) 
		x += (window.event.srcElement.offsetWidth - thisMenu.style.posWidth);
	x2 = x + window.event.srcElement.offsetWidth;
	y  = (IsMSMenu)? 
		 (idRow1.offsetHeight) :
		 (idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight);
	thisMenu.style.top  = y;
	thisMenu.style.left = x;
	thisMenu.style.clip = "rect(0 0 0 0)";
	thisMenu.style.display = "block";
	
	dropX = x;
	dropX2 = x + 200;
	dropY = y;
	dropY2 = dropY + thisMenu.offsetHeight;
	
	
	// delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
	window.setTimeout("showMenu()", 2);
	return true;
}

function doSideMenu(MenuIDStr) 
{
	//alert(MenuIDStr);
	MenuIDStr = "ICPSide_" + MenuIDStr;
	var thisMenu = document.all(MenuIDStr);
	//SideMenu = thisMenu;
	if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) 
	{
		if (SideMenu != null && SideMenu != "") {
		SideMenu.style.display = "none";
		sideArrow.style.display = "none";
		IsSideMenu = false;
		}	
		window.event.cancelBubble = true;
		return false;
	} 
	
	CurDropDown = ToolbarMenu;
	// Reset dropdown menu
	//window.event.cancelBubble = true;
	if (SideMenu != null && SideMenu != "") {
		sideArrow.style.display = "none";
		SideMenu.style.display = "none";
		IsSideMenu = true;
	}	
	//ToolbarMenu.style.display = "none";
	
	//**DEBUG
	
	showElement("SELECT");
	showElement("OBJECT");
	
	SideMenu = thisMenu;
	if (SideMenu == null || SideMenu == "") {
		IsSideMenu = false;
	} else {
		IsSideMenu = true;
	}	
	
	//ToolbarMenu = thisMenu;
	IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
	
	// Set dropdown menu display position
	x  = window.event.srcElement.offsetLeft +
	 	 window.event.srcElement.offsetParent.offsetLeft + 1;
	if (MenuIDStr == LastMSMenu) 
		x += (window.event.srcElement.offsetWidth - thisMenu.style.posWidth);
	x2 = x + window.event.srcElement.offsetWidth;
	x3 = x + window.event.srcElement.offsetParent.offsetWidth;
	 
	y  = window.event.srcElement.offsetTop +  idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight;
	
	sideX = x3;
	sideX2 = x2 + sideX + 200;
	sideY = y - 6;
	
	thisMenu.style.top  = sideY;
	thisMenu.style.left = dropX2;
	thisMenu.style.clip = "rect(0 0 0 0)";
	thisMenu.style.display = "block";
	
	sideY2 = y + thisMenu.offsetHeight;
		
	arrowX = dropX2 - 16;
	arrowY = sideY + 2;
	sideArrow.style.zIndex = 1000;
	sideArrow.style.color = arrowColor;
	sideArrow.style.top  = arrowY;
	sideArrow.style.left = arrowX;
	sideArrow.style.display = "";
	
	// delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
	window.setTimeout("showSideMenu()", 2);
	return true;
}

function showSideMenu() 
{
	if (SideMenu != null) 
	{ 
		IsMenuDropDown = (Frame_Supported && IsMSMenu == false)? false : true;
		if (IsMenuDropDown == false)
		{
			//sideY1 = (SideMenu.offsetHeight - idRow3.offsetHeight);
			if (y < 0) y = 0;
			SideMenu.style.top = y;
		}
			
		y2 = y + SideMenu.offsetHeight;

		SideMenu.style.clip = "rect(auto auto auto auto)";
		hideElement("SELECT");
		hideElement("OBJECT");
		IsSideMenu = true;
	}
}

function showMenu() 
{
	if (ToolbarMenu != null) 
	{ 
		IsMenuDropDown = (Frame_Supported && IsMSMenu == false)? false : true;
		if (IsMenuDropDown == false)
		{
			y = (y - ToolbarMenu.offsetHeight - idRow3.offsetHeight);
			if (y < 0) y = 0;
			ToolbarMenu.style.top = y;
		}
		y2 = y + ToolbarMenu.offsetHeight;

		ToolbarMenu.style.clip = "rect(auto auto auto auto)";
		hideElement("SELECT");
		hideElement("OBJECT");
		IsDropMenu = true;
	}
}

function hideMenu()
{
	if (ToolbarMenu != null && ToolbarMenu != StartMenu) 
	{
		// Don't hide the menu if the mouse move between the menu and submenus
		
		cY = event.clientY + document.body.scrollTop;
		if ( (event.clientX >= (x+5) && event.clientX <= x2) &&
			 ((IsMenuDropDown == true  && cY > (y-10) && cY <= y2)      ||
			  (IsMenuDropDown == false && cY >= y     && cY <= (y2+10)) ))
		{
			window.event.cancelBubble = true;
			return; 
		} else {
			//CurDropDown.style.display = "none";
		}		
		//if ( (IsSideMenu == true && (event.clientX <= ( x2 + window.event.srcElement.offsetParent.offsetWidth)) ) ||
			//	cY > y ||
				//cY < ( y + window.event.srcElement.offsetParent.offsetHeight) ) 
		//{
			//window.event.cancelBubble = true;
		//	return; 
		//}
	}	
		//alert("IsSideMenu: " + IsSideMenu + "  x2: " + x2 + " cY: " + cY + " y: " + y);
	if (IsSideMenu) {
		
		if ( (event.clientX > ( window.event.srcElement.offsetLeft + window.event.srcElement.offsetParent.offsetLeft)) ) 
		{	
			window.event.cancelBubble = true;
			return; 
		}
	}
		
		SideMenu.style.display = "none";
		ToolbarMenu.style.display = "none";
		ToolbarMenu = StartMenu;
		window.event.cancelBubble = true;

		showElement("SELECT");
		showElement("OBJECT");
}

function hideSideMenu()
{
	//alert("IsSideMenu: " + IsSideMenu + "  x2: " + x2);
	if (IsSideMenu != true) {
		SideMenu.style.display = "none";
		CurDropDown.style.display = "none";
		ToolbarMenu = StartMenu;
		window.event.cancelBubble = true;
	}	else {
			window.event.cancelBubble = true;
			return; 
	}
	showElement("SELECT");
	showElement("OBJECT");
}

function hideElement(elmID)
{
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)
			continue;

		// Find the element's offsetTop and offsetLeft relative to the BODY tag.
		objLeft   = obj.offsetLeft;
		objTop    = obj.offsetTop;
		objParent = obj.offsetParent;
		while (objParent.tagName.toUpperCase() != "BODY")
		{
			objLeft  += objParent.offsetLeft;
			objTop   += objParent.offsetTop;
			objParent = objParent.offsetParent;
		}
		// Adjust the element's offsetTop relative to the dropdown menu
		objTop = objTop - y;

		if (x > (objLeft + obj.offsetWidth) || objLeft > (x + ToolbarMenu.offsetWidth))
			;
		else if (objTop > ToolbarMenu.offsetHeight)
			;
		else if (IsMSMenu && (y + ToolbarMenu.offsetHeight) <= 80)
			;
		else
		{
			obj.style.visibility = "hidden";
		}
	}
}

function showElement(elmID)
{
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)
			continue;
		obj.style.visibility = "";
	}
}

function formatURL(URLStr, InstrumentStr)
{
	var tempStr = URLStr;

	if (DoInstrumentation && URLStr != "" )
	{
		var ParamPos1 = URLStr.indexOf("?");
		var ParamPos2 = URLStr.lastIndexOf("?");
		var ParamPos3 = URLStr.toLowerCase().indexOf("target=");
		var ParamPos4 = URLStr.indexOf("#");
		var Bookmark  = "";
		var URL = URLStr;
		if (ParamPos4 >= 0)
		{
		 	URL = URLStr.substr(0, ParamPos4);
			Bookmark = URLStr.substr(ParamPos4);
		}
		
		if (ParamPos1 == -1)
			tempStr = "?MSCOMTB=";
		else if (ParamPos1 == ParamPos2 && ParamPos3 == -1)	
			tempStr = "&MSCOMTB=";
		else if (ParamPos1 == ParamPos2 && ParamPos3 != -1)	
			tempStr = "?MSCOMTB=";
		else if (ParamPos1 < ParamPos2)
			tempStr = "&MSCOMTB=";

		tempStr = URL + tempStr + InstrumentStr.replace(" ","%20") + Bookmark;
	}
	return tempStr;
}

function hideMenus(debug) {
	//alert(debug);
	if (IsSideMenu) {
		sideArrow.style.display = "none";
		SideMenu.style.display = "none";
		CurDropDown.style.display = "none";
	}
	if (ToolbarMenu != null && ToolbarMenu != StartMenu) {
		ToolbarMenu.style.display = "none";
		ToolbarMenu = StartMenu;
		window.event.cancelBubble = true;
	} 	
	
	IsDropMenu = false;
	IsSideMenu = false;
}

function x_y_position() {
	var x_y_status;
	//dropX = 50;
	//dropX2 = 320;
	dropY = 0;
	//dropY2 = 156;
		
	clientX = window.event.clientX + document.body.scrollLeft;
    clientY = window.event.clientY + document.body.scrollTop;
	//IsSideMenu = true;
	if ( (IsSideMenu) && ( (clientX < dropX) ||  (clientX > sideX2) ) ){
		hideMenus('1');	
	} else if ( (IsSideMenu) && (clientX >= sideX) && (clientX <= sideX2) ) {
		if ( (clientY < sideY) || (clientY > sideY2) ) {
			hideMenus('2');
		}	
	} else if ( !(IsSideMenu) && ( (clientX < dropX) || (clientX > dropX2) || (clientY < dropY) || (clientY > dropY2) ) ){
		hideMenus('3');
	} else if ( (IsSideMenu) && (clientX > dropX) && (clientX < dropX2) && (clientY > dropY2) ) {
		hideMenus('4');
	}
	
	//x_y_status = "sideY: " + sideY + " | sideY2: " + sideY2+ " | clientX: " + clientX + " | clientY: " + clientY + " | sideX2: " + sideX2 + " | dropY2: " + dropY2 + " | sideTF: " + IsSideMenu;
	//window.status = x_y_status;	
}

function pdfPopupOLD(filename) {
	pdfPage="pdf.asp?pdfPage=" + filename;
	pdfWindow = window.open(pdfPage, 'pdfWind', 'toolbar=yes,scrollbars=no,location=no,border="0",width=540,height=270,left=220,top=200');
	pdfWindow.focus();
}
function pdfPopup(filename, filesize) {
	if (confirm("This pdf file is " + filesize + ". If you are on a slow connection this could take over 10 minutes to download. Are you sure that you want to continue?")) {
		pdfWindow = window.open(filename, 'pdfWind', 'toolbar=yes,scrollbars=no,location=no,border="0",width=700,height=500,left=20,top=20');
		pdfWindow.focus();
	}
}

function newsPopup(filename) {
	newsWindow = window.open(filename, 'newsWind', 'toolbar=yes,scrollbars=yes,resize=yes,location=no,border="0",width=800,height=500,left=0,top=0');
	newsWindow.focus();
}
// stop hiding -->
