//*****************************************************************************
// navbar.js
//
// This javascript code is used to create the popup menu for the website.
// This code is called from another javascript file called 'popup.js',
// the popup menu configuration can be changed from that file.
//
// The html page that is going to use this menu has to put onload=init(); 
// on the body tag.
//
// The dropdown colors are controlled from this javacript file.
// 
// 
//
// Modified by                      Date
// ---------------                  ----------------
// Claudia Caballero                08/24/2004
//
//
//*****************************************************************************

var dom = (document.getElementById && !document.all) ? 1: 0;

// Content code
window.onresize = init;
function init()
{
 var obj;
 var height;

 if(dom){
  // adjust menubar for NS/Mozilla (Not used)
  // document.getElementById('menubar').style.width = window.innerWidth - 3;
  // document.getElementById('menubar').style.width = 800;
  // Adjust height
  height = document.getElementById('menubar').offsetHeight; //+ document.getElementById('copyright').offsetHeight;
  //  obj = document.getElementById('contentarea');
  //  obj.style.height = "100px"; // for NS/Mozilla
  height = window.innerHeight - height - 5;
 } 
 else {
  height = document.all['menubar'].offsetHeight;
  //  obj = document.all.contentarea;
  height = document.body.offsetHeight - height - 5;
 }
  // obj.style.height = height + "px";
}

// Menu code
var oldMenu = null;
var oldSubMenu = null;

function onDrop(obj, sub)
{
 onUndrop();
 
 obj.style.backgroundColor = "#e7e7e7";
 obj.style.color = "#666666";
 oldMenu = obj;

 if(sub != ''){
  var subMenu = (dom)? document.getElementById(sub): document.all[sub];

  subMenu.style.top = obj.offsetHeight + 2;
  subMenu.style.left = obj.offsetLeft;
  subMenu.style.visibility = "visible";

  oldSubMenu = subMenu;
 }
}

function onUndrop()
{
 if(oldMenu != null){
  oldMenu.style.backgroundColor = "#ffffff";
  oldMenu.style.color = "#666666";
 }
 oldMenu = null;  
 if(oldSubMenu != null){
  oldSubMenu.style.visibility = "hidden";
 }
 oldSubMenu = null;  
}

function onItemHilite(obj, mode)
{
 if(mode == 1){
  obj.style.backgroundColor = "#ffffff";
  obj.style.color = "#666666";
 }
 else {
  obj.style.backgroundColor = "#e7e7e7";
  obj.style.color = "#666666";
 }
}
