function validarForm()

{

	var doc = window.document.contato;

	

	if(doc.txtNome.value=="")

	{

		//window.alert("Preencha o campo 'Nome'!");

		msg = "Preencha o campo 'Nome'!";

		innerHtml('alerta', msg);

		doc.txtNome.focus();

		return false;

	}

	if(!checkemail(doc.txtEmail.value))

	{

		doc.txtEmail.focus();

		return false;

	}

	if(doc.txtAssunto.value=="")

	{

		//window.alert("Preencha o campo 'Assunto'!");

		msg = "Preencha o campo 'Assunto'!";

		innerHtml('alerta', msg);

		doc.txtAssunto.focus();

		return false;

	}

	if(doc.txtMensagem.value=="")

	{

		//window.alert("Preencha o campo 'Mensagem'!");

		msg = "Preencha o campo 'Mensagem'!";

		innerHtml('alerta', msg);

		doc.txtMensagem.focus();

		return false;

	}

	doc.submit();

}



function checkemail(txtEmail)

{

	var str=txtEmail;

	var filter=/^.+@.+\..{2,3}$/;

	if (filter.test(str))

		testresults = true;

	else

	{

		//window.alert("Por Favor insira um e-mail valido!");

		msg = "Insira um e-mail valido!";

		innerHtml('alerta', msg);

		testresults = false;

	}

	return testresults;

}



function innerHtml(idDiv, msg)

{

	window.document.getElementById('alerta').innerHTML = msg;

}
