function limparFormulario(form)
{
	document[form].reset();
	fechaMensagemSistema();
}

function exibeMensagemSistema(msg)
{
	var m = document.getElementById("msgSistema");

	m.style.display = "block";
	m.innerHTML = msg;
	
}

function fechaMensagemSistema()
{
	var m = document.getElementById("msgSistema");

	m.innerHTML = "";
	m.style.display = "none";
}


function exibeFormularioContato()
{
	window.document.getElementById("boxFormContato").style.display = "block";
	window.document.getElementById("boxContatoTexto").style.display = "block";
	window.document.getElementById("boxFormEnviado").style.display = "none";
	window.document.getElementById("boxFormEnviando").style.display = "none";
	window.document.getElementById("boxFormErro").style.display = "none";
	window.document.getElementById("msgSistema").style.display = "none";
}


function exibeFormularioEnviando()
{
	window.document.getElementById("boxFormContato").style.display = "none";
	window.document.getElementById("boxContatoTexto").style.display = "none";
	window.document.getElementById("boxFormEnviado").style.display = "none";
	window.document.getElementById("boxFormEnviando").style.display = "block";
	window.document.getElementById("boxFormErro").style.display = "none";
	window.document.getElementById("msgSistema").style.display = "none";
}

function exibeFormularioEnviado()
{
	window.document.getElementById("boxFormContato").style.display = "none";
	window.document.getElementById("boxContatoTexto").style.display = "none";
	window.document.getElementById("boxFormEnviado").style.display = "block";
	window.document.getElementById("boxFormEnviando").style.display = "none";
	window.document.getElementById("boxFormErro").style.display = "none";
	window.document.getElementById("msgSistema").style.display = "none";
}

function exibeFormularioErro()
{
	window.document.getElementById("boxFormContato").style.display = "none";
	window.document.getElementById("boxContatoTexto").style.display = "none";
	window.document.getElementById("boxFormEnviado").style.display = "none";
	window.document.getElementById("boxFormEnviando").style.display = "none";
	window.document.getElementById("boxFormErro").style.display = "block";
	window.document.getElementById("msgSistema").style.display = "none";
}

function exibeMensagemAguarde()
{
			
	var mensagem = "Por favor, aguarde o envio da mensagem <br> ao servidor de e-mails. Obrigado.";
	
	exibeMensagemSistema(mensagem)
}


function verificaFormularioContato()
{

	fechaMensagemSistema();
	
	var d = document.frmContato;

	if ( trim(d.strNome.value) == '')
	{
		exibeMensagemSistema('O nome não foi informado');
		d.strNome.value = '';
		d.strNome.focus();
		d.strNome.select();
		return false;
	}

	if ( trim(d.strDDD.value) == '')
	{
		exibeMensagemSistema('O DDD de contato não foi informado');
		d.strDDD.value = '';
		d.strDDD.focus();
		d.strDDD.select();
		return false;
	}

	if ( d.strDDD.value.length < 2)
	{
		exibeMensagemSistema('O DDD de contato está incorreto');
		d.strDDD.value = '';
		d.strDDD.focus();
		d.strDDD.select();
		return false;
	}

	
	if ( trim(d.strTelefone.value) == '')
	{
		exibeMensagemSistema('O número de contato não foi informado');
		d.strTelefone.value = '';
		d.strTelefone.focus();
		d.strTelefone.select();
		return false;
	}

	if (d.strTelefone.value.length < 5)
	{
		exibeMensagemSistema('O número de contato está incorreto');
		d.strTelefone.value = '';
		d.strTelefone.focus();
		d.strTelefone.select();
		return false;
	}

	if ( trim(d.strEmail.value) == '')
	{
		exibeMensagemSistema('O e-mail não foi informado');
		d.strEmail.value = '';
		d.strEmail.focus();
		d.strEmail.select();
		return false;
	}

	if ( !emailCheck(d.strEmail, '') )
	{
		exibeMensagemSistema('O e-mail informado é inválido');
		d.strEmail.value = '';
		d.strEmail.focus();
		d.strEmail.select();
		return false;
	}

	d.strEmail.value = d.strEmail.value.toLowerCase();

	if ( trim(d.strComentario.value) == '')
	{
		exibeMensagemSistema('Nenhum comentário foi descrito');
		d.strComentario.value = '';
		d.strComentario.focus();
		d.strComentario.select();
		return false;
	}

	exibeFormularioEnviando();

	//var t = window.setTimeout('exibeFormularioEnviado()',5000);
	//var x = window.setTimeout('exibeFormularioErro()',10000);
	

	//return false;

	d.method = 'post';
	d.target = 'reposit';
	d.action = '/webSite/action/insereFaleConsoco.asp';
	d.submit();

}
