function Trim(str){
	if(typeof(str) != "string") return "";
	
	var regexp = /[\t\r\n ]+$/;
	str = str.replace(regexp, "");
	
	regexp = /^[\t\r\n ]+/;
	str = str.replace(regexp, "");
	
	return str;
}

function EhVazio(valor){
	valor = Trim(valor);
	if (valor == ''){
		return true;
	}else{
		return false;
	}
}

function valida(frm){
	
	if(EhVazio(frm.TxtNome.value)){
		alert('Informe seu nome');
		frm.TxtNome.focus();
		return false;
	}
	
	if(EhVazio(frm.TxtEmail.value)){
		alert('Informe seu email');
		frm.TxtEmail.focus();
		return false;
	}
	else
	{
		var RegExpEmail = /^([a-zA-Z0-9._-]*)@[a-zA-Z0-9._-]+(\.[a-zA-Z0-9._-]*)+$/i;
		
		var valorCampo = frm.TxtEmail.value;
		var nomeCampo = frm.TxtEmail.name;
		
		var validado = RegExpEmail.test(valorCampo);
		
		if(!validado){
			alert("Verifique se o e-mail está correto.");
			frm.TxtEmail.focus();
			frm.TxtEmail.select();
			return false;
		}
	}
	
	if(EhVazio(frm.TxtComentario.value)){
		alert('Informe seu comentário');
		frm.TxtComentario.focus();
		return false;
	}
}