
var NS4 = document.layers;
var IE4 = document.all;
var ver4 = NS4 || IE4;

var browsername=navigator.appName;
if (browsername=="Microsoft Internet Explorer") browsername="ms";
if (browsername=="Netscape") browsername="ns";
var version = navigator.appVersion.substring(0,1);

function getStyle(id)
{
   if (browsername=="ns" && version=="5") {  //check for Netscape ver 6+
      idString = "window.document.getElementById('"+id+"').style"; 
   } else if (NS4) {
      idString = "window.document." + id;
   } else {
      idString = "window.document.all." + id + ".style";
   }
   return eval(idString);
}

function getObject(id)
{
   if (browsername=="ns" && version=="5") {
      idString = "window.document.getElementById("+id+").style"; 
   } else if (NS4) {
      idString = "window.document." + id;
   } else {
   idString = "window.document.all." + id;
   }
   return eval(idString);
}

function onResize()
{
  if (NS4) 
  {
    location.reload();
    buildArray();
    junk.length=-0;
  }
}

function selectModule(combo)
{
  // IGNORE module item
  var selectedUrl = combo.options[combo.selectedIndex].value;
  if (selectedUrl && selectedUrl.length>0) 
  {
    var formTarget = combo.form.target;
    // If target is self then set URL
    if (selectedUrl.charAt(0) == 'h')
       {
       top.location = selectedUrl;
       }
    else if (!formTarget || formTarget=="_self")
    {
      window.location= selectedUrl;
    }
    else
    {
      var targetFrame = eval("parent."+formTarget);
      // IF target frame exists set location
      if (targetFrame) 
      {
        targetFrame.location = selectedUrl;
      }
      else // ELSE open in new window.
      {
        window.open(selectedUrl, formTarget);
      }
    }
  }
}

function NavMenu(menuName,graphicsDir)
{ 
  // Methods
  this.show   = NavMenu_show;
  this.hide   = NavMenu_hide;
  // Data
  this.name   = menuName;
  this.active = new Image();
  this.active.src=  graphicsDir+"/menu_"+menuName+"_active.gif";
  this.inactive = new Image();
  this.inactive.src=graphicsDir+"/menu_"+menuName+"_inactive.gif";
  return this;
}

function NavMenu_show()
{
   alert("here");
  var divId = "div"+divName;
  if (browsername=="ns" && version=="5") {
            window.document.getElementById(divId).style.visibility = "visible"; 
  }
  var style= getStyle("div"+this.name);
  if (style) 
  {
    style.visibility="visible";
  }
  var img  = getObject("img"+this.name);
  if (img) 
  {
    img.src= this.active.src;
  }

}

function NavMenu_hide()
{
   var divId = "div"+divName;
   if (browsername=="ns" && version=="5") {
      window.document.getElementById(divId).style.visibility = "hidden"; 
   }
  var style= getStyle("div"+this.name);
  if (style) 
  {
    style.visibility="hidden";
  }
  var img  = getObject("img"+this.name);
  if (img) 
  {
    img.src= this.inactive.src;
  }
}


function NavMenuArray()
{
  // Methods 
  this.add = NavMenuArray_add;
  this.showItem = NavMenuArray_showItem;
  // Data
  this.items= new Array();
  this.selectedItem=null;
  return this;
}

function NavMenuArray_add(navMenu,active)
{
  this.items[this.items.length]= navMenu;
  if (active) 
  {
    this.selectedItem=navMenu;
  }
}

function NavMenuArray_showItem(index)
{
  if (this.selectedItem) 
  {
    this.selectedItem.hide();
  }
  this.selectedItem= this.items[index];
  this.selectedItem.show();
  return true;    // Return true so default action of tab will work
}
