function ativa(mn, bt){
//alert ("divmenu"+mn+bt);
	menu = document.getElementById("divmenu"+mn);
	prevBut = menu.getAttribute('ativbut');
	leng = menu.getAttribute('leng');
	turnOff(mn, prevBut);
	turnOn(mn, bt);
	return false;
}
function turnOn(mn, bt){
//alert ("divmenu"+mn);
	menu = document.getElementById("divmenu"+mn);
	leng = menu.getAttribute('leng');
	menu.setAttribute('ativbut', bt);
	document.getElementById("m"+mn+"b"+bt+"off").style.display='none';
	document.getElementById("m"+mn+"b"+bt+"hov").style.display='none';
	document.getElementById("m"+mn+"b"+bt+"on").style.display='inline';
//alert ("m"+mn+"b"+bt+"len"+leng);
	if (bt > 0){
		document.getElementById("m"+mn+"i"+(bt-1)+"01").style.display = 'inline';
		document.getElementById("m"+mn+"i"+(bt-1)+"00").style.display = 'none';
		}
	if (bt < (leng-1)){
		document.getElementById("m"+mn+"i"+bt+"10").style.display = 'inline';
		document.getElementById("m"+mn+"i"+bt+"00").style.display = 'none';
		}
}
function turnOff(mn, bt){
	if (bt == ""){
		return;
	}
	document.getElementById("m"+mn+"b"+bt+"on").style.display='none';
	document.getElementById("m"+mn+"b"+bt+"hov").style.display='none';
	document.getElementById("m"+mn+"b"+bt+"off").style.display='inline';
	if (bt > 0){
		document.getElementById("m"+mn+"i"+(bt-1)+"00").style.display = 'inline';
		document.getElementById("m"+mn+"i"+(bt-1)+"01").style.display = 'none';
		}
	if (bt < leng){
		document.getElementById("m"+mn+"i"+bt+"00").style.display = 'inline';
		document.getElementById("m"+mn+"i"+bt+"10").style.display = 'none';
		}
}
function hov(mn, elem){
	id = elem.id;
	numBut = id.charAt(3);
	butName = 'm'+mn+'b'+numBut;
	menu = document.getElementById("divmenu"+mn);
	ativBut = menu.getAttribute('ativbut');
	if (numBut != ativBut){                  // Se nao eh o botao ativo
		document.getElementById(butName+"hov").style.display='inline';
		btoff = document.getElementById(butName+"off").style.display='none';
	}
	return false;
}
function mou(mn, elem){
	id = elem.id;
	numBut = id.charAt(3);
	butName = "m"+mn+"b"+numBut;
	menu = document.getElementById("divmenu"+mn);
	ativBut = menu.getAttribute('ativbut');
	if (numBut != ativBut){                  // Se nao eh o botao ativo
		document.getElementById(butName+"hov").style.display='none';
		document.getElementById(butName+"off").style.display='inline';
	}
	return false;
}
function clik0(elem){
	id = elem.id;
	numBut = id.charAt(3);
	if (numBut == 9){
		location = "mailto:pedro@espacorenoir.com.br";
	}else{
		location = "index.php?pg="+numBut;
	}
}
function clik1(elem){
	id = elem.id;
	numBut = id.charAt(3);
	location = "index.php?pg=2&sp="+numBut;
}
function clik2(elem){
	id = elem.id;
	numBut = id.charAt(3);
	location = "index.php?pg=2&sp=2&ssp="+numBut;
}
function clik3(elem){
	id = elem.id;
	numBut = id.charAt(3);
	location = "index.php?pg=1&sp="+numBut;
}
function clik4(elem){
	id = elem.id;
	numBut = id.charAt(3);
	location = "index.php?pg=4&sp="+numBut;
}
function edita(idalu){
	location = "index.php?pg=0&act=edi&id="+idalu;
}
function inclui(){
	location = "index.php?pg=0&act=inc";
}
function apaga(idalu){
	if (confirma()){
		location = "index.php?pg=0&act=del&opera=Salvar&id="+idalu;
		return true;
	}
	return false;
}
function confirma(){
	alerta = "Por segurança, confirme a operação";
	return confirm(alerta);
}
function ajustalt(pg){
	if (pg == 6){
		div1 = document.getElementById("cont");
		div2 = document.getElementById("tabdep");
		div3 = document.getElementById("divpage");
		alt1 = div1.scrollHeight;
		alt2 = div2.scrollHeight;
		div3.style.height = Math.ceil(alt2 * 1.1)+"px";
	}
}
