// file : menu-links.js
// d.d. : 2003-12-26
//
// Java-script menu functions
//
// The functions here arrange for click and flyover effects on menus items.
//
// All visual effects are arranged by using styles that must be defined 
// in the style sheets used for menus.
//
// The following styles are assumed to be defined :
//
// A  , A.selected  and A.flyover  for links
// TD , TD.selected and TD.flyover for table data (cells in tables)

  
function isNetscape()
{
  // Return true for Netscape's Navigator browser, 
  // If not Netscape assume Microsoft's Internet Explorer, or Mozilla
  
  return document.layers;         
}
  
function doClick( aCell)
{
  // Actions to perform when a menu is clicked
  
  ActiveCell = aCell;
    
  if( isNetscape()) 
  {
    for( var i = 1; i <= MenuCount; i++)
    {
      eval( "window.document.r" + i + ".className = 'menu';");
      eval( "window.document.a" + i + ".className = 'menu';");
    }
    if( eval( "window.document.r" + aCell))
    {
      eval( "window.document.r" + aCell + ".className = 'selected';");
    }
    if( eval( "window.document.a" + aCell))
    {
      eval( "window.document.a" + aCell + ".className = 'selected';");
    }
  }
  else 
  {
    for( var i = 1; i <= MenuCount; i++)
    {
      eval( "document.getElementById( 'r" + i + "').className = 'menu';");
      eval( "document.getElementById( 'a" + i + "').className = 'menu';");
    }
    if( eval( "document.getElementById( 'r" + aCell + "')"))
    {
      eval( "document.getElementById( 'r" + aCell + "').className = 'selected';");
    }
    if( eval( "document.getElementById( 'a" + aCell + "')"))
    {
      eval( "document.getElementById( 'a" + aCell + "').className = 'selected';");
    }
  }
}

function doMouseOver( aCell)
{ 
  // Actions to perform when the mouse hovers over a menu item
  
  if( aCell != ActiveCell)  
  {
    if( isNetscape()) 
    { 
      eval( "window.document.r" + aCell + ".className = 'flyover';");
      eval( "window.document.a" + aCell + ".className = 'flyover';");
    }
    else
    {
      eval( "document.getElementById( 'r" + aCell + "').className = 'flyover';");
      eval( "document.getElementById( 'a" + aCell + "').className = 'flyover';");
    }
  }
}

function doMouseOut( aCell)
{ 
  // Actions to perform when the mouse hovers out of a menu item
  
  if( aCell != ActiveCell)
  {
    if( isNetscape()) 
    {
      eval( "window.document.r" + aCell + ".className = 'menu';");
      eval( "window.document.a" + aCell + ".className = 'menu';");
    }
    else
    {
      eval( "document.getElementById( 'r" + aCell + "').className = 'menu';");
      eval( "document.getElementById( 'a" + aCell + "').className = 'menu';");
    }
  }
}

function ParentExists()
{
  return parent;
}

function MainMenuFrameExists()
{
  return ParentExists() && parent.header;
}

function SubMenuFrameExists()
{
  return ParentExists() && parent.sub_menu;
}

function ContentsFrameExists()
{
  return ParentExists() && parent.contents;
}

function LoadSubMenu( aPage)
{
  if ( SubMenuFrameExists()) 
  {
    parent.sub_menu.location = aPage;
  }
}

function LoadContents( aPage)
{
  if ( ContentsFrameExists()) 
  {
    parent.contents.location = aPage;
  }
}

function GotoPage( aSubIndex, anUrl)
{
  if( SubMenuFrameExists())
  {
    // presume : Framed version
    parent.contents.location = anUrl;
    if( parent.sub_menu.doClick)
    {
      parent.sub_menu.doClick( aSubIndex);
    }
  }
  else
  {
    // presume : Frameless version
    location = anUrl;
  }
}

function GotoSubMenu( aMainIndex, aSubIndex, anUrl)
{
  if( MainMenuFrameExists())
  {
    // asume : Framed version
    if( isNetscape())
    {
      parent.sub_menu.location = 
        eval( "parent.header.window.document.a" + aMainIndex + ".href");
    }
    else
    {
      parent.sub_menu.location = 
        eval( "parent.header.document.getElementById( 'a" + aMainIndex + "').href");
    }
    if( parent.header.doClick)
    {
      parent.header.doClick( aMainIndex);
    }
    if( aSubIndex > 0)
    {
      GotoPage( aSubIndex, anUrl);
    }
  }
  else
  {
    // asume : Frameless version
    location = anUrl;
  }
}



