function limparFormularioCadastro(form)
{
	document[form].reset();
	fechaMensagemSistemaCadastro();
}

function exibeMensagemSistemaCadastro(msg)
{
	var m = document.getElementById("msgSistemaCadastro");

	m.style.display = "block";
	m.innerHTML = msg;
	
}

function fechaMensagemSistemaCadastro()
{
	var m = document.getElementById("msgSistemaCadastro");

	m.innerHTML = "";
	m.style.display = "none";
}


function exibeFormularioCadastro()
{
	window.scrollTo(0,0);
	window.document.getElementById("boxFormCadastroPF").style.display = "block";
	window.document.getElementById("boxFormEnviadoCadastro").style.display = "none";
	window.document.getElementById("boxFormEnviandoCadastro").style.display = "none";
	window.document.getElementById("boxFormErroCadastro").style.display = "none";
	window.document.getElementById("msgSistemaCadastro").style.display = "none";
}


function exibeFormularioEnviandoCadastro()
{
	window.scrollTo(0,0);
	window.document.getElementById("boxFormCadastroPF").style.display = "none";
	window.document.getElementById("boxFormEnviadoCadastro").style.display = "none";
	window.document.getElementById("boxFormEnviandoCadastro").style.display = "block";
	window.document.getElementById("boxFormErroCadastro").style.display = "none";
	window.document.getElementById("msgSistemaCadastro").style.display = "none";
}

function exibeFormularioEnviadoCadastro()
{
	window.scrollTo(0,0);
	window.document.getElementById("boxFormCadastroPF").style.display = "none";
	window.document.getElementById("boxFormEnviadoCadastro").style.display = "block";
	window.document.getElementById("boxFormEnviandoCadastro").style.display = "none";
	window.document.getElementById("boxFormErroCadastro").style.display = "none";
	window.document.getElementById("msgSistemaCadastro").style.display = "none";
}

function exibeFormularioErroCadastro()
{
	window.scrollTo(0,0);
	window.document.getElementById("boxFormCadastroPF").style.display = "none";
	window.document.getElementById("boxFormEnviadoCadastro").style.display = "none";
	window.document.getElementById("boxFormEnviandoCadastro").style.display = "none";
	window.document.getElementById("boxFormErroCadastro").style.display = "block";
	window.document.getElementById("msgSistemaCadastro").style.display = "none";
}

function enviarFormularioCadastro()
{
	var d = document.frmCadastro;

	if (d.strNomeRazaoSocial.value == "")
	{
		window.scrollTo(0,0);
		exibeMensagemSistemaCadastro('O nome/razão social não foi informado');
		d.strNomeRazaoSocial.value = '';
		d.strNomeRazaoSocial.className = 'erroForm';
		return false;
	} else {
		d.strNomeRazaoSocial.className = 'formNormal';
	}

	if ( trim(d.strEmail.value) == '')
	{
		window.scrollTo(0,0);
		exibeMensagemSistemaCadastro('O e-mail não foi informado');
		d.strEmail.value = '';
		d.strEmail.className = 'erroForm';
		return false;
	} else {
		d.strEmail.className = 'formNormal';
	}

	if ( !emailCheck(d.strEmail, '') )
	{
		window.scrollTo(0,0);
		exibeMensagemSistemaCadastro('O e-mail informado é inválido');
		d.strEmail.value = '';
		d.strEmail.className = 'erroForm';
		return false;
	} else {
		d.strEmail.className = 'formNormal';
	}

	d.strEmail.value = d.strEmail.value.toLowerCase();

	exibeFormularioEnviandoCadastro();

	//var t = window.setTimeout('exibeFormularioEnviadoCadastro()',5000);
	//var x = window.setTimeout('exibeFormularioErroCadastro()',10000);

	//return false;

	d.action = "/webSite/eMail/action/cadastro.asp";
	d.method = "post";
	d.target = "reposit";
	d.submit();
}
