var menuExtensaoAberto = false;
var menuPesquisaAberto = false;
var menuComunidadeAberto = false;

function mudaMenuExtensao(obj) {
	var dtExtensao = document.getElementById('dtExtensao');
	
	if(menuExtensaoAberto) {
		dtExtensao.style.backgroundPosition = "0px -39px";
		$("#extensao").slideUp("slow");
		menuExtensaoAberto = false;
	} else {
		dtExtensao.style.backgroundPosition = "0px 0px";
		$(obj).parent().next().slideDown("slow");	
		menuExtensaoAberto = true;
	}
	return false;
}

function mudaMenuPesquisa(obj) {
	var dtPesquisa = document.getElementById('dtPesquisa');
	
	if(menuPesquisaAberto) {
		dtPesquisa.style.backgroundPosition = "0px -39px";
		$("#pesquisa").slideUp("slow");
		menuPesquisaAberto = false;
	} else {
		dtPesquisa.style.backgroundPosition = "0px 0px";
		$(obj).parent().next().slideDown("slow");	
		menuPesquisaAberto = true;
	}

	return false;
}

function mudaMenuComunidade(obj) {

	var dtComunidade = document.getElementById('dtComunidade');
	
	if(menuComunidadeAberto) {
		dtComunidade.style.backgroundPosition = "0px -39px";
		$("#comunidade").slideUp("slow");
		menuComunidadeAberto = false;
	} else {
		dtComunidade.style.backgroundPosition = "0px 0px";
		$(obj).parent().next().slideDown("slow");	
		menuComunidadeAberto = true;
	}

	return false;
}

$(document).ready(function() {
 	$("dd").hide();
});

function menuCemPorCento() {
       var corpo = document.getElementById("corpo");
       var conteudo = document.getElementById("conteudo");
       var colunaEsquerda = document.getElementById("colunaEsquerda");

       //Descobre se o browser é IE
       var browser = navigator.appName;
       var b_version = navigator.appVersion;
       var version = b_version.substr(17,8);

       if ( browser=="Microsoft Internet Explorer" && version == "MSIE 7.0") { //IE 7

               conteudo.style.height = 0 + "px";
               conteudo.style.height = "auto";

               colunaEsquerda.style.height = 0 + "px";
               colunaEsquerda.style.minHeight = conteudo.offsetHeight + "px";
               colunaEsquerda.style.height = "auto";

               corpo.style.height = 0 + "px";
               corpo.style.height = "auto";

       } else if ( browser=="Microsoft Internet Explorer") { //IE 6

               var colunaEsquerdaIE = document.getElementById("colunaEsquerdaIE");

               colunaEsquerdaIE.style.height = conteudo.offsetHeight + "px";

       } else {

               conteudo.style.height = 0 + "px";
               conteudo.style.height = "auto";

               colunaEsquerda.style.height = 0 + "px";
               colunaEsquerda.style.minHeight = conteudo.offsetHeight + "px";
               colunaEsquerda.style.height = "auto";

               corpo.style.height = 0 + "px";
               corpo.style.height = "auto";

       }

}

function buscaAvancada(idEnabled, idDisabled, ambos) {
	if(ambos == true){ //se selecionar o radio "ambos", então desativa os dois
		(document.getElementById(idEnabled)).disabled = true;
		(document.getElementById(idDisabled)).disabled = true;
	}else{
		var habilitado = document.getElementById(idEnabled);
		var desabilitado = document.getElementById(idDisabled);
		habilitado.disabled = false;
		desabilitado.disabled = true;
	}
}

function pintarMenu(a) {
	apagarMenu();
	a.style.color = "yellow";	  
	for (i=0; i < a.childNodes.length; i++) {
	  node = a.childNodes[i];
	  if (node.nodeName == "IMG") {
		  node.src = 'imagens/icones/seta_menu_selecionada.gif'
	  }
	}
	a.id = "menuSelecionado";
}

function apagarMenu() {
	var menuSelecionado = document.getElementById('menuSelecionado');

	if (menuSelecionado) {
		menuSelecionado.id = null;
		menuSelecionado.style.color = "white";

		for (i=0; i < menuSelecionado.childNodes.length; i++) {
		  node = menuSelecionado.childNodes[i];
		  if (node.nodeName == "IMG") {
			  node.src = 'imagens/icones/seta_menu.gif'
		  }
		}

	}
}
