//window.onerror = erros;
window.onload = focar;

var W = function(lnk,w,h) {
	var aleat = "W" + parseInt(Math.random()*100000);
	var janela = window.open(lnk,aleat,"width="+w+",height="+h+",top="+(((screen.height-h)/2)-30)+",left="+((screen.width-w)/2)+",status=yes,scrollbars=yes,menubar=no,toolbar=no,titlebar=no,location=no,fullscreen=no,directories=no,resizable=yes");
	janela.focus();
}

var WM = function(lnk,w,h) { var modal = window.showModalDialog(lnk, "", "Resizable:yes; DialogHeight:" + h + "px; DialogWidth:" + w + "px; Edge:raised; Help:no; Scroll:yes; Status:no; Center:yes;"); }

var S = function(txt) { window.status = txt; }

var E = function(obj) { return document.getElementById(obj); }

var I = function(fr,it) { return document.forms[fr][it]; }

var L = function(lnk,alvo) { window.parent.frames[alvo].location.href = lnk; }

var R = function(alvo) { window.parent.frames[alvo].location.reload(); }

function focar() {
	if (document.forms.length>0) {
		try { I(0,0).focus(); } catch(e) {}
	}
}

var h = {
	classe: "",
	lastid: "",
	on: function(id) {
		this.classe = E(id).className;
		this.lastid = id;
		E(id).className = "MenuHover";
	},

	off: function() { E(this.lastid).className = this.classe; },

	v: function(id) { if (E(id).style.display==="none") { E(id).style.display = "" } else { E(id).style.display = "none" } }
}

var inText = {
	gett: function(id) {
		if (document.all) {	return E(id).innerText; }
		else { return E(id).textContent; }
	},
	
	putt: function(id,valor) {
		if (document.all) {	E(id).innerText = valor; }
		else { E(id).textContent = valor }
	}
}

var Ajuda = function(id) { W("gerAjuda.asp?contexto=" + escape(id),700,500); }

var oClock = function(){
	now = new Date();
	tempo = new Date(now.getTime());
	hora = tempo.getHours();
	minutos = tempo.getMinutes();
	segundos = tempo.getSeconds();
	if (minutos<=9) minutos = "0" + minutos;
	if (segundos<=9) segundos = "0" + segundos;
	horas = hora + ":" + minutos + ":" + segundos;
	E("relogio").value = horas;
	var temp = setTimeout( "oClock()", 500);
}

function erros(){
	alert("Ocorreu um erro de execução JavaScript. Isto pode fazer com que o sistema comporte-se de maneira irregular. Contate o administrador do FUTSite para informar o problema, informando também onde ele ocorreu.");
	return false;
}

