var upactive=0;
var start=false;
var bAv = true;
var v  = 0;
var v1 = 0;
var browserImg = false;
function RetornaV() {
	return v;
}
function SetaV(valor) {
	v = valor;
}
function RetornaV1() {
	return v1;
}
function SetaV1(valor) {
	v1 = valor;
}
function Timeout(NomeDIV) {
	return setTimeout(NomeDIV + '.hide();',500);
}
function MostraMenu(NomeMenu,NomeFrame) {
	eval(NomeMenu+'Div.innerHTML = parent.'+NomeFrame+'.'+NomeMenu+'Div.innerHTML;');
	eval(NomeMenu+'.show();');
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function escondeobjs () {
        var i, obj;
        for (i = 0; i < document.all.tags("SELECT").length; i ++) {
            obj = document.all.tags("SELECT")[i];
            obj.style.visibility = "hidden";
        }
}

function mostraobjs () {
        var i, obj;
        for (i = 0; i < document.all.tags("SELECT").length; i ++) {
            obj = document.all.tags("SELECT")[i];
            obj.style.visibility = "inherit";
        }
}
// **********

function navigate(start){
  document.navigation.P_START.value = start;
  document.navigation.submit();
}
function MudaCorFundo(src,cor) { 
  src.bgColor = cor; 
} 
function MudaCor(src,cor) {
  src.style.color = cor; 
} 
//**************
function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.ie5) this.v = 5;
	this.min = (this.ns||this.ie);
}
//  objeto "is" 
is = new BrowserCheck();
function DynLayer(id,nestref,frame) {
	if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit()
	this.frame = frame || self
	if (is.ns) {
		if (is.ns4) {
			if (!frame) {
				if (!nestref) var nestref = DynLayer.nestRefArray[id]
				if (!DynLayerTest(id,nestref)) return
				this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
			}
			else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		else if (is.ns5) {
			this.elm = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
		}
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
	}
	else if (is.ie) {
		this.elm = this.event = this.frame.document.all[id]
		this.css = this.frame.document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DynLayer"
	eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (is.ns) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (is.ns) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}
function DynLayerMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
	if (start) this.css.visibility = (is.ns4)? "show" : "visible"
	if (start) this.css.display = (is.ns4)? "" : ""
}
function DynLayerHide() {
	if (start) this.css.visibility = (is.ns4)? "hide" : "hidden"
	if (start) this.css.display = (is.ns4)? "none" : "none"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')

// DynLayerInit Function
function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true
	if (is.ns) {
		if (nestref) ref = eval('document.'+nestref+'.document')
		else {nestref = ''; ref = document;}
		for (var i=0; i<ref.layers.length; i++) {
			var divname = ref.layers[i].name
			DynLayer.nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
			}
			if (ref.layers[i].document.layers.length > 0) {
				DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
			}
		}
		if (DynLayer.refArray.i < DynLayer.refArray.length) {
			DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
		}
	}
	else if (is.ie) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
		}
	}
	return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

//***
function init(poState) {
	DynLayerInit();
	start=true;
	//if ((self.name!='superior')&&(self.name!='')&&(self.name!='principalCab')&&(self.name!='superiorCab'))
	if (self.name=='principal')
		parent.SetaTemMenuPrincipal(true);
}
function finish() {
	if (self.name!='superior') parent.SetaTemMenuPrincipal(false);
}
window.onscroll=function(){
	if ((parent.RetornaTemMenuPrincipal)&&(start)) {
		var AuxArrMenu = parent.RetornaArrMenu();
		for (var i=0; i<AuxArrMenu.length; i++) {
			eval(AuxArrMenu[i]+'Div.style.top = '+AuxArrMenu[i]+'.y + document.body.scrollTop;');
		}
	}
	//logoit();
}
window.onload=function(){
	init();
	if (document.NOVO)    document.NOVO.tx_email.focus();
	if (document.ALTERAR) document.ALTERAR.tx_email.focus();
	if (document.DADOS) document.DADOS.tx_nome.focus();
	//if (self.name!='superior'){
	//	fillup();
	//	initFull();
	//	Ini_Menu_ServInfo();
	//	setTimeout('TrocaBanner()',3000);
	//	insertimage();
	//}
}
window.onunload=finish;
function MenuOnOver(indice,NomeMenu) {
	if (indice >=0) {
		if (browserImg) eval('TrocaImagem(document.img'+indice+',Imagens[indice].on);');
	}
	if (NomeMenu) {
		if (parent.RetornaTemMenuPrincipal()) {
			var AuxArrMenu = parent.RetornaArrMenu();
			if ((NomeMenu)&&(NomeMenu!='')) {
				parent.principal.MostraMenu(NomeMenu,self.name);
				for (var i=0; i<AuxArrMenu.length; i++) {
					if (AuxArrMenu[i]!=NomeMenu) eval('parent.principal.'+AuxArrMenu[i]+'.hide();');
				}
			}
			else {
				for (var i=0; i<AuxArrMenu.length; i++) {
					parent.principal.SetaV(parent.principal.clearTimeout(parent.principal.RetornaV()));
					eval('parent.principal.'+AuxArrMenu[i]+'.hide();');
				}
			}
		}
	}
}
function MenuOnOut(indice,NomeMenu) {
	if (indice >=0) {
		if (browserImg) eval('TrocaImagem(document.img'+indice+',Imagens[indice].off);');
	}
	if (parent.RetornaTemMenuPrincipal()) {
		if ((NomeMenu)&&(NomeMenu!='')) {
			parent.principal.SetaV(parent.principal.Timeout(NomeMenu));
		}
	}
}
function TrocaCorMenu(objMenu,corMenu,objLink,corLink) {
	objMenu.style.backgroundColor = corMenu;
	objLink.style.color = corLink;
}



