String.prototype.trim = function() {
		var x = this;
		x = x.replace(/^\s*(.*)/, "$1");
		x = x.replace(/(.*?)\s*$/, "$1");
		return x;
		}

function valida_news(){

    if(document.news.nome.value.trim()==''){
        document.getElementById("error_news").innerHTML = "Por favor, informe o campo NOME!";
        document.news.nome.focus();
        return false;
    }

if (document.news.email.value.trim()==''){
        //alert('Por favor informe o E-MAIL.');
        document.getElementById("error_news").innerHTML = "Por favor, informe o campo E-MAIL!";
        document.news.email.focus();
        return false;
}else{
        aux = 0;
        if (aux==0) {
                if (document.news.email.value.indexOf("@") < 0){
                        aux=1;
                        //alert("Preencha o e-mail no formato SEU@EMAIL.COM.BR")
                        document.getElementById("error_news").innerHTML = "Preencha o e-mail no formato SEU@EMAIL.COM.BR!";
                        document.news.email.focus();
                        return false;
                }
        }
        if (aux==0) {
                if (document.news.email.value.indexOf(".") < 0){
                        aux=1;
                        //alert("Preencha o e-mail no formato SEU@EMAIL.COM.BR");
                        document.getElementById("error_news").innerHTML = "Preencha o e-mail no formato SEU@EMAIL.COM.BR!";
                        document.news.email.focus();
                        return false;
}
}
}

    if(document.news.cadastro[0].checked==false && document.news.cadastro[1].checked==false){
        document.getElementById("error_news").innerHTML = "Por favor, informe a opção Cadastrar ou Cancelar!";
        return false;
    }
    
}

function valida_contato(){

        if(document.contato.nome.value.trim()==''){
                document.getElementById("error").innerHTML = "Por favor, informe o campo NOME!";
                document.contato.nome.focus();
                return false;
        }

		if (document.contato.email.value.trim()==''){
				//alert('Por favor informe o E-MAIL.');
                                document.getElementById("error").innerHTML = "Por favor, informe o campo E-MAIL!";
				document.contato.email.focus();
				return false;
			}else{
				aux = 0;
				if (aux==0) {
					if (document.contato.email.value.indexOf("@") < 0){
						aux=1;
						//alert("Preencha o e-mail no formato SEU@EMAIL.COM.BR")
                                                document.getElementById("error").innerHTML = "Preencha o e-mail no formato SEU@EMAIL.COM.BR!";
						document.contato.email.focus();
						return false;
					}
				}
				if (aux==0) {
					if (document.contato.email.value.indexOf(".") < 0){
						aux=1;
						//alert("Preencha o e-mail no formato SEU@EMAIL.COM.BR");
                                                document.getElementById("error").innerHTML = "Preencha o e-mail no formato SEU@EMAIL.COM.BR!";
						document.contato.email.focus();
						return false;
                        }
                        }
                        }

			if(document.contato.telefone.value.trim()==''){
				//alert('Por favor informe o TELEFONE.');
                                document.getElementById("error").innerHTML = "Por favor, informe o campo TELEFONE!";
				document.contato.telefone.focus();
				return false;
			}

			if(document.contato.mensagem.value.trim()==''){
				//alert('Por favor informe a MENSAGEM.');
                                document.getElementById("error").innerHTML = "Por favor, informe o campo MENSAGEM!";
				document.contato.mensagem.focus();
				return false;
			}
}
