<!--
// Objeto de deteccion del navegador

var soporta = new DetectorNavegador();
var menu = new Array();
var menuActivo = null;
var framemenus = window;
var IdEsperaTimeout = false;
// Objeto Menu
function activarMenu() {
  if (soporta.DHTML && menuActivo != this) {
    if (menuActivo) menuActivo.ocultar();
    menuActivo = this;
    this.mostrar();
  }
}

function mostrarMenu() {
  if (!eval(this.capaRefStr)) return;
  this.cambiarPosicion();
  eval(this.capaRefStr + this.estiloRefStr + '.visibility = "visible"');
  if (soporta.DOM)
	this.domRef.style.display = "block";
}

function ocultarMenu() {
  if (!eval(this.capaRefStr)) return;
  eval(this.capaRefStr + this.estiloRefStr + '.visibility = "hidden"');
  if (soporta.DOM)
	this.domRef.style.display = "none";
}

function cambiarPosicionMenu() {
//  eval(this.capaRefStr + this.estiloRefStr + this.topRefStr + ' = this.top + ' + this.topOffsetStr);
//  eval(this.capaRefStr + this.estiloRefStr + this.leftRefStr + ' = this.left + ' + this.leftOffsetStr);
  var corregirY = (soporta.NS6 || soporta.opera5) ? this.topOffsetStr : 0;
  var corregirX = (soporta.NS6 || soporta.opera5) ? this.leftOffsetStr : 0;
  eval(this.capaRefStr + this.estiloRefStr + this.topRefStr + ' = this.top - ' + corregirY);
  eval(this.capaRefStr + this.estiloRefStr + this.leftRefStr + ' = this.left - ' + corregirX);
}

function Menu(capaID, top, left, width) {
  this.activar = activarMenu;
  this.mostrar = mostrarMenu;
  this.ocultar = ocultarMenu;
  this.cambiarPosicion = cambiarPosicionMenu;
  if (soporta.DOM) {
    this.domRef = window.document.getElementById(capaID);
	if (!soporta.IE) {
	  this.domRef.style.width = width;
	  this.domRef.style.position = "fixed";
	}
  }	
  this.capaRefStr = (soporta.NS4) ?
    'window.document["'+capaID+'"]' :
    ((soporta.IE) ? 'window.document.all["'+capaID+'"]' : 'this.domRef');
  this.estiloRefStr = (soporta.NS4) ? '' : '.style';
  this.topRefStr = (soporta.IE) ? '.pixelTop' : '.top';
  this.leftRefStr = (soporta.IE) ? '.pixelLeft' : '.left';
//  this.topOffsetStr = (soporta.NS4) ? 'window.pageYOffset' : (soporta.IE ? 'window.document.body.scrollTop' : '0');
  this.topOffsetStr = (soporta.NS6 || soporta.opera5) ? 'window.document.body.scrollTop' : (soporta.NS4) ? 'window.pageYOffset' : (soporta.IE ? 'window.document.body.scrollTop' : '0');
  this.leftOffsetStr = (soporta.NS6 || soporta.opera5) ? 'window.document.body.scrollLeft' : (soporta.NS4) ? 'window.pageXOffset' : (soporta.IE ? 'window.document.body.scrollLeft' : '0');
  this.top = top;
  this.left = left;
  this.cambiarPosicion();
  if (soporta.DOM)
	this.domRef.style.display = "none";
}

// Manejo de eventos
function ocultarMenuActivo(e) {
  if (menuActivo) {
    menuActivo.ocultar();
    menuActivo = null;
    MirarBotones();
  }
}

function moverMenuActivo(e) {
  if (menuActivo)
    menuActivo.cambiarPosicion();
}

// Inicializacion

function inicializar() {
  if (soporta.DHTML) {
    if (soporta.NS4)
      document.captureEvents(Event.MOUSEUP);
    if(!soporta.NS6)
      document.onmouseup = ocultarMenuActivo;
  }
  menu[0] = new Menu("menu0", 130, 0, 100);
  OpcionesPrincipalesY = SacarCoordenadas();
  var nmenus = tienemenu ? OpcionesPrincipales.length + 1 : OpcionesPrincipales.length;
  for (var i = 1; i < nmenus; i++) {
      var mn = "menu" + i.toString();
      var xposicion = PPrincipal ?  100 + OpcionesPrincipalesX[i] : OpcionesPrincipalesX[i];
      menu[i] = new Menu(mn, OpcionesPrincipalesY, xposicion, 120);
  }
}

function ComenzarTiempo() {
    Comienzo = new Date();
    BanderaComenzarTiempo = true;
    IdEsperaTimeout = setTimeout("Oculta()", 1000);    
}
function FinalizarTiempo() {
        if (IdEsperaTimeout) clearTimeout(IdEsperaTimeout);
        IdEsperaTimeout = null;
        BanderaComenzarTiempo = false;    
}
function Oculta() {
        if (!BanderaComenzarTiempo) return;
        var TiempoPasado = new Date() - Comienzo;
        if (TiempoPasado < 1000) {
                IdEsperaTimeout = setTimeout("Oculta()", 1100-TiempoPasado);
                return;
        }
        BanderaComenzarTiempo = false;
        if (menuActivo) {
           menuActivo.ocultar();
           menuActivo = null;
           MirarBotones()
        }
}
function MirarBotones() {
    if (boton_activado) DesactivaBoton(boton_activado)
}
// -->





