// data: xx março 2008
// coder: brancher
// descricao: exibe/oculta proximas reunioes dos comites
function toogle_reunioes() {
	var mais_reunioes = document.getElementById("mais_reunioes");
	var mais_reunioes_control = document.getElementById("mais_reunioes_control")
	var status = mais_reunioes.style.display;
	if (status == "none") {
		mais_reunioes.style.display = "block";
		mais_reunioes_control.innerHTML = "–";
	} else if (status == "block") {
		mais_reunioes.style.display = "none";
		mais_reunioes_control.innerHTML = "+";
	}
}
// data: xx março 2008
// coder: brancher
// descricao: limpa campo dos formularios
function clear_field(field) {
	var valor_padrao = field.defaultValue;
	if (field.value == valor_padrao) {
		field.value = "";
	}
}
// data: xx março 2008
// coder: brancher
// descricao: retorna valor default se o campo do formulario estiver vazio
function populate_field(field) {
	valor_padrao = field.defaultValue;
	if (field.value == (" " || null)) {
		field.value = valor_padrao;
	}
}
// data: 24 abril 2008
// coder: brancher
// descricao: faz show/hide do conteúdo MMEDIA na notícia
function exibir_menu_mmedia(mmedia) {
	irmaos = document.getElementById(mmedia).parentNode.childNodes;
	for (i=0; i<irmaos.length; i++) {
		if (irmaos[i].nodeType == 1) {
		 	if (irmaos[i] != document.getElementById(mmedia)) irmaos[i].style.display="none";
		}
	}
	var mmedia_nav = mmedia + "_navegador";
	irmaos_nav = document.getElementById(mmedia_nav).parentNode.childNodes;
	for (j=0; j<irmaos_nav.length; j++) {
		if (irmaos_nav[j].nodeType == 1) {
		 	if (irmaos_nav[j] != document.getElementById(mmedia_nav)) irmaos_nav[j].style.display="none";
		}
	}
	document.getElementById(mmedia).style.display = "block";
	document.getElementById(mmedia_nav).style.display = "block";
}
// data: 24 abril 2008
// coder: brancher
// descricao: faz requisição de IMAGEM via ajax
function exibir_imagem(imagem_id) {
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null) {
		alert ("Seu browser não suporta AJAX!");
		return;
	}
	var url="ajax/exibir_imagem.php?imagem_id="+imagem_id;
	xmlHttp.onreadystatechange = function() {
		document.getElementById("loading").style.display = "block";
		//document.getElementById("imagens").style.display = "none";
		if (xmlHttp.readyState==4) {
			//alert(xmlHttp.responseText);
			document.getElementById("imagens").innerHTML = xmlHttp.responseText;
			//document.getElementById("imagens").style.display = "block";
			document.getElementById("loading").style.display = "none";
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
// data: 24 abril 2008
// coder: brancher
// descricao: faz requisição de VIDEO via ajax
function exibir_video(video_id) {
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null) {
		alert ("Seu browser não suporta AJAX!");
		return;
	}
	var url="ajax/exibir_video.php?video_id="+video_id;	
	xmlHttp.onreadystatechange = function() {
		document.getElementById("loading").style.display = "block";
		document.getElementById("videos").style.display = "none";
		if (xmlHttp.readyState==4) {
			document.getElementById("videos").innerHTML = xmlHttp.responseText;
			document.getElementById("videos").style.display = "block";
			document.getElementById("loading").style.display = "none";
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
// data: 24 abril 2008
// coder: brancher
// descricao: faz requisição de AUDIO via ajax
function exibir_audio(audio_id) {
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null) {
		alert ("Seu browser não suporta AJAX!");
		return;
	}
	var url="ajax/exibir_audio.php?audio_id="+audio_id;	
	xmlHttp.onreadystatechange = function() {
		document.getElementById("loading").style.display = "block";
		document.getElementById("audios").style.display = "none";
		if (xmlHttp.readyState==4) {
			document.getElementById("audios").innerHTML = xmlHttp.responseText;
			document.getElementById("audios").style.display = "block";
			document.getElementById("loading").style.display = "none";
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
// data: 24 abril 2008
// coder: biblioteca
// descricao: cria objeto XMLHttp para ajax
function GetXmlHttpObject() {
	var xmlHttp = null;
	try {
		// Cria o HttpXMLRequest para Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	} catch (e) {
		// Cria o HttpXMLRequest para Internet Explorer 6.0+ e, depois, 5.5
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}