// JavaScript Document
function enviarDados(){
	if(document.formCadastroItens.nome.value != ""){
		document.getElementById('enviando_dados').style.display = "block";
		document.formCadastroItens.btnEnviar.disabled = "disabled";
		document.formCadastroItens.btnEnviar.value = "aguarde...";
		document.formCadastroItens.submit();
	}
	else{
		window.alert('É necessário o preenchimento do campo NOME!');
	}
}

function excluir(cod, nome){
	confirmar = confirm("Confirma a exclusão de " + nome + "?");
	if(confirmar){
		window.location.href="excluirItem.php?acao=excluir&item=" + cod;
	}
}

function moveRelogio(){
    momentoAtual = new Date();
    hora = momentoAtual.getHours();
    minuto = momentoAtual.getMinutes();
    segundo = momentoAtual.getSeconds();

    horaImprimivel = hora + " : " + minuto + " : " + segundo;

    document.getElementById('relogio').innerHTML = horaImprimivel;

    setTimeout("moveRelogio()",1000);
}

function enviarEmail(){
	if(document.formContato.email.value.indexOf("@") > -1 && document.formContato.email.value.indexOf(".") > -1 || document.formContato.telefone.value != ''){
		if(document.formContato.nome.value != '' && document.formContato.mensagem.value != ''){
			document.formContato.submit();
		}
		else  window.alert('Informe seu NOME e sua MENSAGEM!');
	}
	else window.alert('Informe seu endereço de E-MAIL corretamente ou seu TELEFONE para que possamos entrar em contato com você.');
	
}

function buscar(){
	if(document.formBusca.q.value != ""){
		document.formBusca.submit();
	}
	else{
		window.alert('Informe algo a ser pesquisado!');
	}
}

function openclose(cod){
	if(document.getElementById(cod).style.display == "none"){
		document.getElementById(cod).style.display = "block";
		document.getElementById('pasta'+cod).src = "arquivos/pastaAberta.gif";
	}
	else{
		document.getElementById(cod).style.display = "none";
		document.getElementById('pasta'+cod).src = "arquivos/pastaFechada.gif";
	}
}


function iniciar(){
	moveRelogio();
	document.getElementById('carregando').style.display = 'none';
}
