var ws = new Array();
var browser;
if(navigator.userAgent.indexOf('Gecko')!=-1) {
  if(navigator.userAgent.indexOf('Firefox')!=-1) {
    browser='ff';
  } else {
    if(parseInt(navigator.appVersion) < 5) {
      browser='nsbad';
    } else {
      browser='nsok';
    }
  }
} else if(navigator.userAgent.indexOf('MSIE')!=-1) {
  if(parseInt(navigator.appVersion ) >= 5) {
    browser='ieok';
  } else {
    browser='iebad';
  }
} else {
  browser = 'unknow';
}

//alert( navigator.userAgent );
//alert( navigator.appName );
//alert("browser: " + browser);

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//
// Coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// If want to use this code, feel free to do so, but please leave this message intact.
//
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


//-----------------------------------------------------------
Menu = {timer : null, current : null};
Menu.getStyle = function(name){
  if(browser=='nsbad') return;
	if( document.getElementById(name)!=null ) return document.getElementById(name).style;
	else if(document.all!=null) {
	  if(document.all[name]!=null) { return document.all[name].style; }
	} else if(document.layers) return document.layers[name];
}
Menu.show = function(name,txt){
  if(browser=='nsbad') return;
  if(txt!='') {
  	if(this.timer) clearTimeout(this.timer);
  	if(this.getStyle(name)!=null) {
  	  if(browser=='nsok') {
  	    this.getStyle(name).left = getLeft(name) + "px";
  	    this.getStyle(name).top = "118px";
  	  };
  	  this.getStyle(name).visibility = "visible";
  	}
  	this.current = name;
  }
}
Menu.hide = function(){
  if(browser=='nsbad') return;
	this.timer = setTimeout("Menu.doHide()",300);
}
Menu.doHide = function(){
  if(browser=='nsbad') return;
	if(this.current){
    if(this.getStyle(this.current)!=null) this.getStyle(this.current).visibility = "hidden";
	  this.current = null;
	}
}


//-----------------------------------------------------------
function menu_image_swap(nom, dir) {
  var x;
  if ((verok == 1) && (nom != 'none') && (nom != imagidx)) {
    x = buscarIMG(nom);
    if (x) {
      x.src = '';
      x.src = dir;
      return true;
    };
  };
};



//-----------------------------------------------------------
function buscarIMG(nom) {
  var i;
  if (document[nom]) {
    return document[nom];
  };
  if (document.layers) {
    for(i=0; i < document.layers.length; i++) {
      // alert('entro find ' + eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom + '.src') + ' ' + nom);
      if (document.layers[i].document[nom]) {
        return document.layers[i].document[nom];
      }else if (eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom)) {
        return eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom);
      };
    };
  }else{
    if (document.all) {if (document.all[nom]) { return document.all[nom]; }; };
    if (document.getElementById(nom)) { return document.getElementById(nom); };
  };
}; // findIMG



// ----------------------------------------------------------
function getLeft(name) {
  if(browser=='nsok') {
    number = name.substring(name.length-1, name.length);
    var total = 0;
    for(var k=1; k < number; k++) {total += ws[k];}
    if(window.innerWidth < 780) {
      left = total + 10;
    } else {
      left = total + 10 + (window.innerWidth-780)/2;
    }
    return left;
  };
};


// ----------------------------------------------------------
window.onload = function() {
  if(browser=='nsok') {
    for(i=1; i < 8; i++) {
      x = buscarIMG('menuimag'+i);
      if(x) {
        if(x.width) ws[i]=x.width; else ws[i]=0;
      } else { ws[i]=0; }
    };
  };
};