// Java Document

function Browser() {
  var ua, s, i;
  this.isIE    = false;  
  this.isNS    = false;  
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

function gE(e) {
	if (document.layers) return document.layers[e];
	if (document.all) return document.all[e];
	return document.getElementById(e);
}

function PosicionarMenu() {
	//window.alert("PosicionarMenu");
	var mt = 0;
	if (browser.isIE) {mt = document.body.scrollTop;}
	else {if (browser.isNS) {mt = window.pageYOffset;}}
	if (mt > 120) {mt = mt > 131 ? mt - 111 : 20 - (131 - mt);}
	else {mt = 0};
	if (mt != MargeSuperiorMenu) {
		var menu = document.getElementById(IdDivMenu);
		if (mt > MargeSuperiorMenu) {
			var mt_max = menu.parentNode.offsetHeight - menu.offsetHeight - 5;
			if (mt > mt_max) mt = mt_max;
		}
		if (mt != MargeSuperiorMenu) {
			MargeSuperiorMenu = mt;
			menu.style.marginTop = mt + 'px';
		}
	}
}

function EngegarTimerPosicionarMenu() {
	IdTimerPosMenu = window.setInterval(FuncioTimerPosMenu,IntervalTimerPosMenu);
}

function AturarTimerPosicionarMenu() {
	window.clearInterval(IdTimerPosMenu);
}

var IdDivMenu = "menu_i_info";
var FuncioTimerPosMenu = "PosicionarMenu()";
var IntervalTimerPosMenu = 500;
var IdTimerPosMenu;
var MargeSuperiorMenu = 0;
var browser = new Browser();

