function forum(id){
	if(document.getElementById(id).style.display=="none"){
		document.getElementById(id).style.display = "";
		document.getElementById("txt"+id).innerHTML = 'Fechar <img src="../../__img/bt_sobe.gif" width="13" height="8" border="0" />';
	}else{
		document.getElementById(id).style.display = "none";
		document.getElementById("txt"+id).innerHTML = 'Abrir <img src="../../__img/bt_desce.gif" width="13" height="8" border="0" />';
	}
}
function val_resp_forum(){
	val_respForum();
}
function val_respForum(){
	obj = document.Resp;
	if(emBranco(obj.resposta.value)){
		alert("Por favor informe a sua resposta!");
		obj.resposta.focus();
		return false;
	}
	obj.resposta.value.replace('"',"'");
	obj.submit();
}
function val_add_forum(){
	val_addForum();
}
function val_addForum(){
	obj = document.newTopico;
	if(emBranco(obj.topico.value)){
		alert("Por favor informe o título da sua discussão!");
		obj.topico.focus();
		return false;
	}
	if(emBranco(obj.mensagem.value)){
		alert("Por favor informe a sua discussão!");
		obj.mensagem.focus();
		return false;
	}
	obj.submit();
}
function findPost(){
	obj = xGetElementById("boxBusca");
	if(viewFind){
		tmpFind = '<strong>Buscar:</strong> <input id="txt_busca" type="text" size="20" maxlength="80" style="font-size:9px" />';
		tmpFind+= ' <input type="button" class="botao" value="ok" onclick="goFind()" style="font-size:9px; height:19px"/>';
		tmpFind+= ' <input type="button" class="botao" value="fechar" onclick="findPost()" style="font-size:9px; height:19px"/>';
		obj.innerHTML = tmpFind;
		viewFind = 0;
	}else{
		tmpFind = "";
		if(aluno>0){
		tmpFind = '<input type="button" class="botao" value="Novo post" onclick="addPost()" style="font-size:9px; height:19px" />&nbsp; ';
		}
		tmpFind+= '<input type="button" class="botao" value="Busca" onclick="findPost()" style="font-size:9px; height:19px"/>&nbsp; ';
		tmpFind+= '<input type="button" class="botao" value="Filtro" onclick="findFiltro()" style="font-size:9px; height:19px"/>&nbsp; ';
		obj.innerHTML = tmpFind;
		viewFind = 1;
	}
}
function findFiltro(aluno){
	obj = xGetElementById("boxBusca");
	if(viewFind){
		tmpFind = '<strong>Filtro:</strong> <select id="txt_data" style="font-size:10px" />';
		tmpFind+= '<option value="1" selected>postado Hoje</option>';
		tmpFind+= '<option value="7">uma semana</option>';
		tmpFind+= '<option value="30">um mês</option>';
		tmpFind+= '<option value="180">seis meses</option>';
		tmpFind+= '<option value="365">um ano</option>';
		tmpFind+= '</select>';
		tmpFind+= ' <input type="button" class="botao" value="ok" onclick="gofindFiltro()" style="font-size:9px; height:19px"/>';
		if(aluno>0){
		tmpFind+= ' <input type="button" class="botao" value="Só meus" onclick="goFindMeus()" style="font-size:9px; height:19px"/>';
		}	
		tmpFind+= ' <input type="button" class="botao" value="fechar" onclick="findPost()" style="font-size:9px; height:19px"/>';
		obj.innerHTML = tmpFind;
		viewFind = 0;
	}else{
		tmpFind = "";
		if(aluno>0){
		tmpFind+= '<input type="button" class="botao" value="Novo post" onclick="addPost()" style="font-size:9px; height:19px" />&nbsp; ';
		}
		tmpFind+= '<input type="button" class="botao" value="Busca" onclick="findPost()" style="font-size:9px; height:19px"/>&nbsp; ';
		tmpFind+= '<input type="button" class="botao" value="Filtro" onclick="findFiltro()" style="font-size:9px; height:19px"/>&nbsp; ';
		obj.innerHTML = tmpFind;
		viewFind = 1;
	}
}
function goFind(forum){
	obj = xGetElementById("buscaforum");
	if(obj.value!=" Buscar no fórum..." && obj.value!="Buscar no fórum..."){
		location.href = 'forum_search.php?ID=b84cc9abd108e6951bb0840dd9558482&f='+forum+'&b='+obj.value;
	}
}
function addPost(){
	if(document.getElementById("formAdd").style.display == "none"){
		document.getElementById("formAdd").style.display = "block";
	}else{
		document.getElementById("formAdd").style.display = "none";
	}	
}
function realcFind(op){
	if(op==1){
		document.getElementById("buscaforum").style.color = "#000000";
		if(document.getElementById("buscaforum").value==" Buscar no fórum..."){
			document.getElementById("buscaforum").value = "";
		}
	}else{
		document.getElementById("buscaforum").style.color = "#999999";
		if(emBranco(document.getElementById("buscaforum").value)){
			document.getElementById("buscaforum").value=" Buscar no fórum...";
		}
	}
}
function voltaaddPost(url){
	location.href = "forum.php?ID=bbdbe444288550204c968fe7002a97a9"+url;
}
