// -- menu.js -- client code for menu item mouseovers, footer positioning. --

// -- see which document object model we have. --
var brwsr = '';
if (document.getElementById) brwsr = 'w3c';
else if (document.all)       brwsr = 'ie';
else                         brwsr = 'nn';   //Netscape 4.x

//alert('browser = \'' + brwsr + '\'.');

//***************************************************************************
function showMsg(msg)
{
   window.status = msg;
}

//***************************************************************************
// set height of scrolling div so footer is always at the bottom of the window
//***************************************************************************
function setObjHeight(obj, fhgt)
{
   var hgt = 0;
   var winObj = false;
   var winRef = 'document.';

   if (window.innerHeight) hgt = window.innerHeight;  //browser = nn
   else                    hgt = document.body.clientHeight;
   //alert('height = \'' + hgt + '\'.');           //debug
   hgt = Math.abs(hgt - fhgt);                     //subtract height of footer

   if      (brwsr == 'w3c') winRef += 'getElementById(\'' + obj + '\')';
   else if (brwsr == 'ie')  winRef += 'all.' + obj;
   else                     winRef += obj;

   if (brwsr == 'nn') winObj = eval(winRef);
   else eval("try {winObj = eval(" + winRef + ");} catch(e) { }");

   if ( winObj )
   {
      //alert('winObj.style.height = \'' + hgt + '\'.');   //debug
      if (brwsr == 'w3c' || brwsr == 'ie') winObj.style.height = hgt;
      else                                 winObj.height = hgt;
   }
}

//***************************************************************************
function SetObjVisibility(obj, visi)
{
   var winObj = false;
   var winRef = 'document.';

   if      (brwsr == 'w3c') winRef += 'getElementById(\'' + obj + '\')';
   else if (brwsr == 'ie')  winRef += 'all.' + obj;
   else                     winRef += obj;

   winObj = eval(winRef);

   if ( winObj )
   {
      if (brwsr == 'w3c' || brwsr == 'ie') winObj.style.visibility = visi;
      else                                 winObj.visibility = visi;
   }
}

//***************************************************************************
// if main.asp is in the right frame, have it display/hide a menu item description.
//***************************************************************************
function switchDivState(div1,div2)
{
   var winObj = false;
   if (parent.main)
   {
      var winRef = 'parent.main.document.';
      if      (brwsr == 'w3c') winRef += 'getElementById(\'' + div1 + '\')';
      else if (brwsr == 'ie')  winRef += 'all.' + div1;
      else                     winRef += div1;

      if (brwsr == 'nn') winObj = eval(winRef);
      else eval("try {winObj = eval(" + winRef + ");} catch(e) { }");

      if ( winObj )
      {
         parent.main.SetObjVisibility(div1,'hidden');
         parent.main.SetObjVisibility(div2,'visible');
      }
   }
   return true;
}

//***************************************************************************
// Displays/hides alternate (highlighted) menu item (nn), and if main.asp is in
// the right frame, has it display/hide a corresponding menu item description.
//***************************************************************************
function switchState(first,second,div1,div2)
{
   SetObjVisibility(first,'hidden');
   SetObjVisibility(second,'visible');

   switchDivState(div1,div2);
   return true;
}

//***************************************************************************
function doMenuPick(theURL)
{
   top.contents.location.href = theURL;
}

//***************************************************************************
function doMainPick(theURL)
{
   top.main.location.href = theURL;
}
