window.defaultStatus = "SGS - Sistema de Gerenciamento do Site";

function preenche(num, id)
{
	obj = document.getElementById(id);
	val = obj.value;
	fim = val + num;
	obj.value = "";
	obj.value = fim;
}

function testaSenha(senha,confirmacao,formulario)
{
	if (erro == true) 
		return true;
	obj1 = eval("document."+formulario+"."+senha);
	obj2 = eval("document."+formulario+"."+confirmacao);
	if (obj1.value != obj2.value)
	{
		alert ('Sua senha não foi confirmada!');
		document.formulario.senha.focus();
		return true;
	}
	else 
		return false;
}

function testaVazio(campo,comparacao,formulario,mensagem,erro) 
{
	if (erro == true)
		return true;
	obj1 = eval("document."+formulario+"."+campo);
	if (obj1.value == comparacao)
	{
		alert (mensagem);
		obj1.focus();
		return true;
	}
	else 
		return false;
}

function testaNumero(campo,formulario,mensagem,erro)
{
	if (erro == true)
		return true;
	obj1 = eval("document."+formulario+"."+campo);
	if (isNaN(obj1.value)) 
	{
		obj1.value = "";
		alert (mensagem);
		obj1.focus();
		return true;
	}
	else 
		return false;
}

function mostraConteudo(id_cont,  id_local)
{
	obj_cont = document.getElementById(id_cont);
	obj_local = document.getElementById(id_local);
	
	obj_local.innerHTML = obj_cont.innerHTML;
}

function verDados(valor, option)
{
	if(valor == "")
	{
		alert("Você deve escolher um valor válido!");
	}
	else if(valor == 0)
	{
		alert("Você deve escolher um valor, não uma categoria!");
	}
	else
	{
		document.location = "principal.php?m=" + option + "&action=ver&valor=" + valor	;
	}
}

function closeObj(id, method)
{
	obj = document.getElementById(id);
	
	if(method == 'display')
		obj.style.display = 'none';
	else
		obj.style.visibility = 'hidden';
	
}

function openObj(id, method)
{
	obj = document.getElementById(id);
	
	if(method == 'display')
		obj.style.display = 'block';
	else
		obj.style.visibility = 'visible';
	
}