var oLastMenuBtn = 0;
var lastmenu = "";
var STYLEStr="";
var menustyle="";
var ToolBarSupported=false;
var oLastBtn=0;

menubg="#50A095";
menufontcolor="#FFFFFF";
menufonthighlightcolor="#f7fbad";

if (navigator.userAgent.indexOf("MSIE")    != -1 && 
	navigator.userAgent.indexOf("Windows") != -1 && 
	navigator.appVersion.substring(0,1) > 3)
{
	ToolBarSupported = true;
}

STYLEStr=
"<STYLE TYPE='text/css'>" +
"<!--" +
".TopMenuBar"+
"{" +
//"   position:absolute;" +
//"   top:"+toolbartop+";" + 
"   BACKGROUND-COLOR: "+menubg+";" +
"   BORDER-BOTTOM: #ffffff solid 1px;" +
"   COLOR: " + menufontcolor + ";" +
"   FONT-FAMILY: verdana,Arial,Helvetica;" +
"   FONT-SIZE: 11px;" +
"   FONT-WEIGHT: bold;" +
"   LETTER-SPACING: -0.5pt;" +
"   LINE-HEIGHT: 20px;" +
"   MARGIN: 0px 0px;" +
"   TEXT-DECORATION: none;" +   
"}" +
".TopMenuButton" +
"{" +
"   BACKGROUND-COLOR: "+menubg+";" +
"   BORDER: none;" +
"   COLOR: " + menufontcolor + ";" +
"   CURSOR: hand;" +
"   FONT-FAMILY: verdana,Arial,Helvetica;" +
"   FONT-SIZE: 11px;" +
"   FONT-WEIGHT: bold;" +
"   LETTER-SPACING: -0.5pt;" +
"   LINE-HEIGHT: 20px;" +
"   MARGIN: 2px 0px;" +
"   PADDING-BOTTOM: 0px;" +
"   PADDING-LEFT: 10px;" +
"   PADDING-RIGHT: 3px;" +
"   PADDING-TOP: 0px;" +
"   TEXT-DECORATION: none;" +
"}" +
".menu" +
"{" +
"   position:absolute;" +
"   left:0;" +
"   top:"+(toolbartop+18)+";" +
"   width: 164;" +
"   background-color: "+menubg+";" +
"   BORDER-BOTTOM: none;" +
"   BORDER-LEFT: none;" +
"   BORDER-RIGHT: none;" +
"   BORDER-TOP: #ffffff solid 1px;" +
"   color: " + menufontcolor + ";" +
"   CURSOR: hand;" +
"   font-family: verdana;" +
"   font-size: 11px;" +
"   font-weight: bold;" +
"   letter-spacing: -0.5pt;" +
"   line-height: 20px;" +
"   margin: 2px 0px;" +
"   padding-bottom: 0px;" +
"   padding-left: 10px;" +
"   padding-right: 3px;" +
"   padding-top: 0px;" +
"   text-decoration: none;" +
"   visibility:hidden;" +
"}" +
"a.menulink:visited {color: " + menufontcolor + "};" +
"a.menulink:visited {text-decoration:none};" +
"a.menulink:link    {color: " + menufontcolor + "};" +
"a.menulink:link    {text-decoration:none};" +
"a.menulink:hover   {color: " + menufonthighlightcolor + "};" +
"a.menulink:hover   {text-decoration:none};" +
"a.menulink:active  {color: " + menufonthighlightcolor + "};" +
"a.menulink:active  {text-decoration:none};" +
"}" +
"-->" +
"</STYLE>";
document.write(STYLEStr);

function buildnavbar(options, urls)
{
var HTMLStr = "";
if (ToolBarSupported==true)
{
  // Toolbar for IE
  HTMLStr = "<TABLE class='TopMenuBar' onMouseOver='overtable();' BGCOLOR='" + menubg + "' CELLPADDING='0' CELLSPACING='0' BORDER='0' HEIGHT='20'><TR>";
  HTMLStr += "<td VALIGN='TOP' BACKGROUND='' nowrap width=130 onMouseOver='overbody();'>&nbsp</td><td class='TopMenuButton' VALIGN='TOP' ALIGN='CENTER' BACKGROUND='' nowrap>|</td>";
  for (j=0; j<options.length; j++)
  {
    HTMLStr += "<TD id='b" + (j+1) + "' CLASS='TopMenuButton' VALIGN='TOP' HALIGN='CENTER' BACKGROUND='' nowrap>";
//    HTMLStr += "<SPAN id='b" + (j+1) + "' CLASS='TopMenuButton'>...<a id='a" + (j+1) + "' class='menulink' href=" + urls[j] + ">" + options[j] + "</a>" + "::::::::</SPAN>";
    HTMLStr += "&nbsp;&nbsp;&nbsp;<a id='a" + (j+1) + "' class='menulink' href=" + urls[j] + ">" + options[j] + "</a>" + "&nbsp;&nbsp;&nbsp;";
    HTMLStr += "</td>";
    HTMLStr += "<td class='TopMenuButton' VALIGN='TOP' HALIGN='CENTER' BACKGROUND='' nowrap>|</td>";
  }
  HTMLStr += "<TD width='100%' VALIGN='TOP' BACKGROUND='' onMouseOver='overbody();'>";
  HTMLStr += "&nbsp;";
  HTMLStr += "</TD>";
  HTMLStr += "</TR>";
  HTMLStr += "</TABLE>";
}
else
{
  // Toolbar for Navigator and Opera
  HTMLStr = "<TABLE  CELLPADDING='0' CELLSPACING='0' BORDER='0' HEIGHT='22'><TR>";
  HTMLStr += "<td BGCOLOR='" + menubg + "' VALIGN='TOP' BACKGROUND='' width=131 nowrap>&nbsp</td>";
  HTMLStr += "<td BGCOLOR='" + menubg + "' VALIGN='TOP' BACKGROUND='' nowrap><b><font size='2' face='MS Sans Serif' color='" + menufontcolor + "'>|</font></b></td>"
  for (j=0; j<options.length; j++)
  {
    HTMLStr += "<TD BGCOLOR='" + menubg + "' VALIGN='TOP' BACKGROUND='' nowrap ><b>";
    HTMLStr += "&nbsp;&nbsp;&nbsp;<a id='a" + (j+1) + "' class='menulink' href=" + urls[j] + "><font size='2' face='MS Sans Serif' color='" + menufontcolor + "'>" + options[j] + "</font></a>" + "&nbsp;&nbsp;&nbsp;";
    HTMLStr += "</b></td>";
    HTMLStr += "<td BGCOLOR='" + menubg + "' VALIGN='TOP' BACKGROUND='' nowrap><b><font size='2' face='MS Sans Serif' color='" + menufontcolor + "'>|</font></b></td>";
  }
  HTMLStr += "<TD BGCOLOR='" + menubg + "' width='100%' VALIGN='TOP' BACKGROUND=''>";
  HTMLStr += "&nbsp;";
  HTMLStr += "</TD>";
  HTMLStr += "</TR>";
  HTMLStr += "<TR>";
  HTMLStr += "<TD>";
  HTMLStr += "</TD>";
  HTMLStr += "</TR>";
  HTMLStr += "</TABLE>";
}

document.write(HTMLStr);
}
function overmenu()
{
  window.event.cancelBubble=true;
}
function overbutton(oBtn)
{
  window.event.cancelBubble = true;
  hidemenu();
  menuname = "menu" + oBtn.id.substr(1,1);
  lastmenu = menuname;
  oBtn.style.color = menufonthighlightcolor;
  oLastMenuBtn = oBtn;
  showmenu(menuname, oBtn);
  return true;
}
function overtable()
{
  window.event.cancelBubble = true;
  oBtn = window.event.srcElement;
  buttonsuffix = oBtn.id.substr(0,1);
  oBtn = document.all["b"+oBtn.id.substr(1,1)]
  if ((buttonsuffix=="b") || (buttonsuffix=="a")) overbutton(oBtn);
}
function hideall()
{
  if (document.readyState != "complete") return;  
  window.event.cancelBubble=true;
  hidemenu();
  HideButton();
}
function showmenu(menuname, src)
{ 
  curstyle = document.all[menuname].style;
  curstyle.left = src.offsetLeft + src.offsetParent.offsetLeft+10;
  curstyle.visibility = "visible";
  return true;
}
function hidemenu()
{
  if (lastmenu!="")
  {
      oLastMenuBtn.style.color = menufontcolor;
      document.all[lastmenu].style.visibility = "hidden";
  }
}

function RaiseButton()
{
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	var bChosen = false;
        hidemenu();

	if(oLastBtn && oLastBtn != oBtn)
	{
		HideButton();
	}

	if(oBtn.buttonType)
	{
		oBtn.className = oBtn.buttonType + "Up";
		oLastBtn=oBtn;
	}
	else
	{
		oLastBtn = 0;
	}
}

function DepressButton()
{
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	if(oBtn.buttonType)
	{
		oBtn.className = oBtn.buttonType + "Down";
	}
}

function HideButton()
{
	if ((oLastBtn.buttonType == "LeftNavChosen") || (oLastBtn.buttonType == "LeftNavSubChosen") ||  (oLastBtn.buttonType == "appNavChosen") || (oLastBtn.buttonType == "appNavSubChosen"))
	{
		oLastBtn.className = oLastBtn.buttonType;
	}
	else
	{
		oLastBtn.className = oLastBtn.buttonType + "Off";
	}
}


