<!--
var all_layers = new Array();
var heirarchy  = new Array();
var mouse_x = 0;
var mouse_y = 0;

if (window.addEventListener)
  document.addEventListener("mousemove", OnMouseMove, true);
else
  document.attachEvent("onmousemove", OnMouseMoveIE);

//-----------------------------------------------------------------
// OpenDropdown()
//-----------------------------------------------------------------
function OpenDropdown(thelayer, obj, submenu)
  {
  var posx = 0;
  var posy = 0;

  if (!all_layers[thelayer])
    all_layers[thelayer] = new Array(obj, 0);

  if (all_layers[thelayer][1] == 1)
    return; // this drop menu is already visible

  if (!submenu)
    {
    // This is a regular menu (not a submenu), so it should be the only menu in the heirachy
    heirarchy = new Array(thelayer);

    // Hide all menus that are currently open
    for (var key in all_layers)
      {
      ShowDropdown(key, false);
      }
    }
  else
    {
    // Starting with the most recently opened submenu, cycle through (back towards the first submenu) and close
    // submenus until we find the submenu that the mouse is currently hovering over. This leaves the current menu
    // and all of its parent menus open, but closes all of its child menus
    while (CheckMousePosition(heirarchy[heirarchy.length-1], false) == 1)
      {
      ShowDropdown(heirarchy[heirarchy.length-1], false);
      heirarchy.pop();
      }

    // Append this menu to the heirarchy
    heirarchy[heirarchy.length] = thelayer;
    }

  if (obj)
    {
    var bounds = GetBoundingBox(obj);
    posx   = (bounds.r - bounds.l)  / 2 + bounds.l;
    posy   = bounds.t;
    if (!submenu)
      posy = bounds.b;
    else
      posx = bounds.r;

    var menu = GetObject(thelayer);
    if (typeof menu.style != 'undefined')
      {
      menu.style.left = eval('"'+(posx)+'px"');
      menu.style.top  = eval('"'+(posy)+'px"');
      }
    else if (typeof menu.left != 'undefined')
      {
      menu.left = eval('"'+(posx)+'"');
      menu.top  = eval('"'+(posy)+'"');
      }
    }

  // Show this menu
  ShowDropdown(thelayer, posx, obj)
  all_layers[thelayer][1] = 1;
  }

//-----------------------------------------------------------------
// ShowDropdown()
//-----------------------------------------------------------------
function ShowDropdown(thelayer, visible, parent)
  {
  ShowObject(GetObject(thelayer), (visible === false ? false : true));

	if (visible !== false && visible !== true)
		{
		var obj = GetObject(thelayer);
  	var bounds = GetBoundingBox(obj);
		var posx = visible  - ((bounds.r - bounds.l) / 2);// + 10;

		if (parent.className == 'first')
		  posx -= 20;
//		else if (parent.className == 'last')
//		  posx -= 30;

    if (typeof obj.style != 'undefined')
      {
      obj.style.left = eval('"'+(posx)+'px"');
      }
    else if (typeof obj.left != 'undefined')
      {
      obj.left = eval('"'+(posx)+'"');
      }
    }


  all_layers[thelayer][1] = visible ? 1 : 0;
  }


//-----------------------------------------------------------------
// CheckMousePosition()
//-----------------------------------------------------------------
function CheckMousePosition(thelayer, useopener)
  {
  var hideit=0;

  if (!all_layers[thelayer])
    return hideit;

  theopener = all_layers[thelayer][0];

  thelayer = GetObject(thelayer);

  layerbounds  = GetBoundingBox(thelayer);
  openerbounds = GetBoundingBox(theopener);
  if (mouse_x >= layerbounds.l && mouse_x <= layerbounds.r && mouse_y >= layerbounds.t && mouse_y <= layerbounds.b)
    hideit = 0;
  else if (useopener && (mouse_x >= openerbounds.l && mouse_x <= openerbounds.r && mouse_y >= openerbounds.t && mouse_y <= openerbounds.b))
    hideit = 0;
  else
    hideit = 1;

  return hideit
  }

//-----------------------------------------------------------------
// CheckMouse()
//-----------------------------------------------------------------
function CheckMouse()
  {
  if (mouse_x < 0) mouse_x = 0;
  if (mouse_y < 0) mouse_y = 0;

  if (heirarchy.length > 0)
    {
    // Cycle through the menu heirarchy backwards, hiding each menu until we find the menu that the mouse is over.
    // Once the menu that the mouse is over is found, we can stop hiding menus
    for (var i=heirarchy.length-1; i>=0; i--)
      {
      if (CheckMousePosition(heirarchy[i], true) == 1)
        {
        ShowDropdown(heirarchy[i], false);
        heirarchy.pop();
        }
      else
        break;
      }
    }
  }

//-----------------------------------------------------------------
// OnMouseMove()
//-----------------------------------------------------------------
function OnMouseMove(e)
  {
  if (typeof e.pageX != 'undefined')
    {
    mouse_x=e.pageX;
    mouse_y=e.pageY;
    }

  CheckMouse();
  }

//-----------------------------------------------------------------
// OnMouseMoveIE()
//-----------------------------------------------------------------
function OnMouseMoveIE()
  {
  mouse_x=event.clientX;
  mouse_y=event.clientY;

  CheckMouse();
  }
//-->
