function DetectorNavegador() {
  this.NS4 = document.layers;
  this.IE4 = document.all;
  this.DHTML = this.NS4 || this.IE4;
}

var soporta = new DetectorNavegador();
var menu = new Array();
var menuActivo = null;

function activarMenu() {
  if (soporta.DHTML && menuActivo != this) {
    if (menuActivo) menuActivo.ocultar();
    menuActivo = this;
    this.mostrar();
  }
}

function mostrarMenu() {
  eval(this.capaRefStr + this.estiloRefStr + '.visibility = "visible"');
}

function ocultarMenu() {
  eval(this.capaRefStr + this.estiloRefStr + '.visibility = "hidden"');
}

function cambiarPosicionMenu(top, left) {
  if (soporta.DHTML) {
    eval(this.capaRefStr + this.estiloRefStr + this.topRefStr + ' = top');
    eval(this.capaRefStr + this.estiloRefStr + this.leftRefStr + ' = left');
  }
}

function Menu(capaID, top, left) {
  this.activar = activarMenu;
  this.mostrar = mostrarMenu;
  this.ocultar = ocultarMenu;
  this.cambiarPosicion = cambiarPosicionMenu;
  this.capaRefStr = (soporta.NS4) ?
    'document["'+capaID+'"]' :
    'document.all["'+capaID+'"]';
  this.estiloRefStr = (soporta.NS4) ? '' : '.style';
  this.topRefStr = (soporta.NS4) ? '.top' : '.pixelTop';
  this.leftRefStr = (soporta.NS4) ? '.left' : '.pixelLeft';
  this.cambiarPosicion(top, left);
}

function ocultarMenuActivo(e) {
  if (menuActivo) {
    menuActivo.ocultar();
    menuActivo = null;
  }
}

function inicializar() {
  if (soporta.DHTML) {
    if (soporta.NS4)
      document.captureEvents(Event.MOUSEUP);
    document.onmouseup = ocultarMenuActivo;
  }
  menu[0] = new Menu("menu0", 79, 44);
  menu[1] = new Menu("menu1", 79, 129);
  menu[2] = new Menu("menu2", 79, 250);
  menu[3] = new Menu("menu3", 79, 377);
//  menu[4] = new Menu("menu4", 79, 438);

}

window.onload = inicializar;

