var StyleStr = "";
var ToolBar_Supported = false;
var Frame_Supported   = false;
var DoInstrumentation = false;
var warnmsg = "You are now leaving YMG's website.  New site will open in a new window.";

//alert(navigator.userAgent);
if (navigator.userAgent.indexOf("MSIE")    != -1 && 
  navigator.userAgent.indexOf("Windows") != -1 && 
  navigator.appVersion.substring(0,1) > 3)
{
  ToolBar_Supported = true;
  StyleStr =  "<STYLE type='text/css'>" +
        ".MSMenu      { font-size:x-small;font-family:Verdana,Arial;text-decoration:none;cursor:hand;}" +
        ".ICPMenu     { font-weight:bold;font-size:x-small;font-family:Verdana,Arial;text-decoration:none;cursor:hand;}" +
        "</STYLE>";
}

if (ToolBar_Supported) {
  var newLineChar = String.fromCharCode(10);
  var char34 = String.fromCharCode(34);
  var LockMSMenu = false;
  var LockICPMenu = false;
  var LastMSMenu = "";
  var CurICPMenu = "";
  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 aDefMSColor  = new Array(3);
  var aDefICPColor = new Array(3);
  var aCurMSColor  = new Array(3);
  var aCurICPColor = new Array(3);
  var bFstICPTBMenu = true;

  // Output style sheet and toolbar ID
  document.write(StyleStr);
  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:0;'>" +
    "</DIV>" +
    "<DIV ID='idRow2' STYLE='position:relative;left:250;height:0;'>" +
    "<DIV ID='idADSBanner'   STYLE='position:absolute;top:0;left:0;height:0;width:200;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>" +
    "<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0;left:0;height:0;width:0;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>" +
    "</DIV>" +
    "<DIV ID='idRow3' STYLE='position:relative;height:0;width:100%'>" +
    "<DIV ID='idICPMenuPane' CLASS='ICPMenuPane' STYLE='position:absolute;top:0;left:0;height:0;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>" +
    "</DIV>" +
    "</DIV>" +
    "<SCRIPT TYPE='text/javascript'>" + 
    "   var ToolbarMenu = StartMenu;" + 
    "</SCRIPT>" + 
    "<DIV WIDTH=100%>";

  // Define event handlers
  window.onresize  = resizeToolbar;
  document.onmouseover = hideMenu;

  // Intialize global variables
  ToolbarBGColor  = "black";            // toolbar background color
  
  aDefMSColor[0]  = aCurMSColor[0]  = "black";  // bgcolor;
  aDefMSColor[1]  = aCurMSColor[1]  = "white";  // text font color
  aDefMSColor[2]  = aCurMSColor[2]  = "red";    // mouseover font color
  
//  aDefICPColor[0] = aCurICPColor[0] = "#0000DD";  // bgcolor;
//  aDefICPColor[1] = aCurICPColor[1] = "white";  // text font color
//  aDefICPColor[2] = aCurICPColor[2] = "cyan";    // mouseover font color

  aDefICPColor[0] = aCurICPColor[0] = "green";  // 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>";
  document.write(HTMLStr);
  ToolbarLoaded = true;

  //MSMenuWidth     = Math.max(idMSMenuPane.offsetWidth, (200+112));

  ToolbarMinWidth = (120) ;

  idToolbar.style.backgroundColor     = ToolbarBGColor;

  idToolbar.style.top = 1500;

  //idMSMenuPane.style.backgroundColor  = aDefMSColor[0];
  //idICPMenuPane.style.backgroundColor = aDefICPColor[0];
  // controls where the menu appears
  //idICPMenuPane.style.top = 111;             // main menu top
  //idICPMenuPane.style.height = 118;          // main menu height

  resizeToolbar();
}

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   = ( 200);
  
  //idICPMenuPane.style.width = ToolbarMinWidth;
}

function setToolbarBGColor(color)
{ 
  ToolbarBGColor = color;
  if (ToolbarLoaded == true)
    idToolbar.style.backgroundColor = ToolbarBGColor;
} 

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 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);
        }
      }
    }
  }
}

/**** Banner functions ****
 ****/
function setAds(Gif,Url,AltStr)
{ setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
}

function setICPBanner(Gif,Url,AltStr)
{ setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
}

function setMSBanner(Gif,Url,AltStr)
{ tempGif = "/library/toolbar/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 + "' ALT='" + BanAltStr + "' BORDER=0>";
  if (BanUrl != "")
    SrcStr += "</A>";
  SrcStr = BanBegTag + SrcStr + BanEndTag;
  HTMLStr = HTMLStr.replace(SubStr, SrcStr);  
}

/**** Add Menu Function ***
 ****/
function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{   
  if (LockICPMenu == true) return;

  if (addICPMenu.arguments.length > 4)
    TargetStr = addICPMenu.arguments[4];
  else
    TargetStr = "_top";
  tempID = "ICP_" + MenuIDStr;
  addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true); 
  bFstICPTBMenu=false;    

}

function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{ 
  if (LockICPMenu == true) return;
  TargetStr = "_top";
  tempID = "MS_" + MenuIDStr;
  addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false); 
  LastMSMenu = tempID;
}

function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
{
  cStyle  = bICPMenu? "ICPMenu"        : "MSMenu";
  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 CLASS='" + cStyle + "' STYLE='color:" + cColor1 + "'>|&nbsp;</SPAN>"; 
  MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
             "   ID='AM_" + MenuIDStr + "'" +
             "   CLASS='" + cStyle + "'" +
             "   STYLE='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 + "'); hideMenu();" + char34 + 
        " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
        "&nbsp;" + MenuDisplayStr + "&nbsp;</a><br>";
  if (bICPMenu)
    MenuStr += "<SPAN CLASS='" + cStyle + "' STYLE='color:" + cColor1 + "'></SPAN>";

  MenuStr += tagStr;
  HTMLStr = HTMLStr.replace(tagStr, MenuStr); 
//  setSubMenuWidth(MenuIDStr,"default",0);
}

function addBlankRow()
{
  MenuStr += "<h3>aada</h3><p>";
  HTMLStr += "<h3>aada</h3><p>";
}

/**** Add SubMenu Function ****
 ****/
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 addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{ 
  TargetStr = "_top";
  tempID = "MS_" + MenuIDStr;
  addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false); 
}

function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
{
  cStyle  = bICPMenu? "ICPMenu"       : "MSMenu";
  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;'" +
        " onmouseover='keepMenu();'>";
    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;'>" +
        "<A ID='AS_" + MenuIDStr + "'" +
        "   CLASS='" + cStyle + "'" + 
        "   STYLE='color:" + cColor1 + "'" +
        "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
        " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
        " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
        "&nbsp;" + SubMenuStr + "</A><BR>" + LookUpTag +
        "</DIV>" +
        "</SPAN>";
  }
  else{
    TempStr = newLineChar +
        "<A ID='AS_" + MenuIDStr + "'" +
        "   CLASS='" + cStyle + "'" + 
        "   STYLE='color:" + cColor1 + "'" +
        "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
        " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
        " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
        "&nbsp;" + SubMenuStr + "</A><BR>" + LookUpTag;
    HTMLStr = HTMLStr.replace(LookUpTag, TempStr);  
  }
}

/**** Add SubMenuLine Functions ****
 ****/
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);
  }
}

/**** Event Functions ****
 ****/

// Change menu mouseover / mouseout color
function mouseMenu(id, MenuIDStr) 
{
  IsMSMenu   = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);

  if (IsMouseout) {
    color = IsMSMenu? aDefMSColor[1] : aDefICPColor[1];
    if (MenuIDStr == CurICPMenu && aCurICPColor[1] != "") 
      color = aCurICPColor[1];
    window.event.srcElement.style.backgroundColor = "#003366"      // dark blue background color
  }
  else {
    color = IsMSMenu? aDefMSColor[2] : aDefICPColor[2];
    if (MenuIDStr == CurICPMenu && aCurICPColor[2] != "") 
      color = aCurICPColor[2];
    window.event.srcElement.style.backgroundColor = "#669999"     // dark cyan, mouseover background  
  }
  window.event.srcElement.style.color = color;
}


// this if where the sub menus appear
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";
  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 +120;
  if (MenuIDStr == LastMSMenu)  {
    x += (window.event.srcElement.offsetWidth - 160);
    x2 = x + 160;
  }
  else{
    x2 = x + window.event.srcElement.offsetWidth;
  }
  y  = (IsMSMenu)? 
     (idRow1.offsetHeight) :
     (idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight);
  y = y+200;                                 // submenu top, move with cursor
  thisMenu.style.top  = event.clientY - 10;
  thisMenu.style.left = x+20;                // submenu left side
  thisMenu.style.width = 220;                // submenu width
  thisMenu.style.clip = "rect(0 0 0 0)";
  thisMenu.style.display = "block";

  // delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
  window.setTimeout("showMenu()", 2);
  return 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");
//    x2 = x + ToolbarMenu.offsetWidth;
//    if (x2 < ToolbarMinWidth ) x2 = ToolbarMinWidth;
  }
}

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;
    cX = event.clientX; 
    // these coordinates control when the submenu disappear, x and y of mouse
    if ( cX<=ToolbarMinWidth+100 &&
      ((IsMenuDropDown == true  && cY > (y-20) && cY <= y2 -30 )      ||
       (IsMenuDropDown == false && cY >= y     && cY <= (y2)) ))    {
         window.event.cancelBubble = true;
         return; 
    }

//    if ( (event.clientX >= x && event.clientX <= x2+300 && event.clientX != (x+1)) &&
//       ((IsMenuDropDown == true  && cY > (y-10) && cY <= y2)      ||
//        (IsMenuDropDown == false && cY >= y     && cY <= (y2+10)) ))
//    {
//      window.event.cancelBubble = true;
//      return; 
//    }

    ToolbarMenu.style.display = "none";
    ToolbarMenu = StartMenu;
    window.event.cancelBubble = true;

//    showElement("SELECT");
//    showElement("OBJECT");
  }
}

function keepMenu()
{
  window.event.cancelBubble = true;
}

function hideElement(elmID)
{
  // Hide any element that overlaps with the dropdown menu
  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)
{
  // Display any element that was hiddend
  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=");

    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 = URLStr + tempStr + InstrumentStr;
  }
  return tempStr;
}

function Lock(FunctionName )
{
  var FName = FunctionName.toUpperCase();
  if ( FName == "ADDICPMENU" ){
    LockICPMenu = true;
  }
  else if ( FName == "ADDMSMENU" ){
    LockMSMenu = true;  
  }
}

function openWindow (earl,name,widgets) 
{
  host = location.hostname;
  var url = earl;
  popupWin = window.open (url,name,widgets);
  popupWin.opener.top.name="opener";
  popupWin.focus();
}

function mOvr(src,clrOver,imgSrc)
{
  if (!src.contains(event.fromElement)){
    src.style.cursor = 'hand'; 
    if(clrOver =='')
      src.background = imgSrc;
    else
      src.bgColor = clrOver;
  }
}
function mOut(src,clrIn)
{
  if (!src.contains(event.toElement)){
    src.style.cursor = 'default';
    if(clrIn=='') 
      src.bgColor = '';
    else 
      src.bgColor = clrIn;
  }
}

function mClk(src)
{
  if(event.srcElement.tagName=='TD'){
    src.children.tags('A')[0].click();
  }
}


function warn(anHREF) 
{
  if (confirm(warnmsg)) {
    if (self.clientweb) {
      if (self.clientweb.closed) {
        popupwin = window.open(anHREF,"clientweb","toolbar=yes,location=yes,directories=yes,resizable=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes");
        self.clientweb = popupwin;
      } else {
        self.clientweb.focus();
        self.clientweb.location.href = anHREF;
      }
    } else {
      popupwin = window.open(anHREF,"clientweb","toolbar=yes,location=yes,directories=yes,resizable=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes");
      self.clientweb = popupwin;
      //self.clientweb.focus();
    }
  }
}

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 = 160;
  }
  else  {
    arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
    arrMenuInfo[i].unit = WidthUnit;
  }
}

function navBar( tableCellRef, hoverFlag, navStyle ) {
  if ( hoverFlag ) {
    switch ( navStyle ) {
      case 1:
//        tableCellRef.style.backgroundColor = '#69c';    // dark blue:onmouseover comes into here
        break;
      default:
        if ( document.getElementsByTagName ) {
          tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
        }
    }
  } else {                     // on mouse out
    switch ( navStyle ) {
      case 1:
//        tableCellRef.style.backgroundColor = '#036';   // light blue: onmouseout
        break;
      default:
        if ( document.getElementsByTagName ) {
          tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
        }
    }
  }
}

function navBarPW( tableCellRef, hoverFlag, navStyle ) {
  if ( hoverFlag ) {
    switch ( navStyle ) {
      case 1:
//        tableCellRef.style.backgroundColor = '#003366';    // onmouseover comes into here
//        tableCellRef.style.backgroundColor = '#036';   // dark blue: onmouseover
        break;
      default:
        if ( document.getElementsByTagName ) {
          tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
        }
    }
  } else {                     // on mouse out
    switch ( navStyle ) {
      case 1:
//        tableCellRef.style.backgroundColor = '#6699cc';    // light blue:on mouse out
//        tableCellRef.style.backgroundColor = '#004E9B';
        break;
      default:
        if ( document.getElementsByTagName ) {
          tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
        }
    }
  }
}

function YMG_navBarClick( tableCellRef, navStyle, url ) {
  navBar( tableCellRef, 0, navStyle );
  window.location.href = url;
}

function goToLoc(){
    var URL = document.gotoForm.SiteLoc.options[document.gotoForm.SiteLoc.selectedIndex].value;
    window.location.href = URL;
}
