// JavaScript Document

/* Função para redimensionar #conteudo caso seja menor que <html>
 * author: Tiago Santos
 * colocar no "onload" e "onresize"
 */
redConteudo = function(){
	var bodyWidth = document.body.clientWidth;
	var htmlHeight = document.documentElement.clientHeight;
	var obj = document.getElementById('conteudo');
	
	if( (htmlHeight-181) > obj.offsetHeight ){
		obj.style.height = (htmlHeight-181) + 'px';
	}
	obj.style.width = (bodyWidth - 64) + 'px';				
}

frmSubmit = function(form){
	if(!form)
		fError('erro','resp_form');
	else
		document.forms[form].submit();
}

esqueceuSenha = function(){
	var user = document.getElementById('ds_login').value;
	if(user.length == 0)
		fError('Favor digitar o usuário','resp_form');
	else
		document.location = "?esqueceu_senha&login="+user;
}

fError = function(strErro,id){
	var divDestino = document.getElementById(id);
	if(divDestino)
		divDestino.innerHTML = strErro;
	else
		alert(strErro);
}

criaComentario = function(){
	if(document.getElementById('ds_login'))
		fError('Você precisa estar logado para comentar.','resp_comentario');
	else{
		
	}
}

var divAberta = null;
mostraDiv = function(div){
	var obj = document.getElementById(div);
	if (divAberta != null) {
		document.getElementById(divAberta).style.display = 'none';
		if (divAberta != div) {			
			obj.style.display = '';
		}
	} else {
		obj.style.display = '';
	}
	if (divAberta != div) {
		divAberta = div;
	} else {
		divAberta = null;
	}
}