var corErro = "#FFE0E0";
var corAcerto = "";

function abreNewsletter(urlNewsletter){
	var classe1 = new classeAjax("get", "", urlNewsletter + "|popup!1$1*500,400<1>0^0~0-");
}

function newsletterCadastro(){
	var idCampo = document.getElementById("nome");
	idCampo.value = idCampo.value.replace(/^\s+|\s+$/g, "");
	if(idCampo.value == "" || idCampo.value.length < 2){
		alert("Preencha corretamente o campo NOME!");
		idCampo.style.backgroundColor = corErro;
		idCampo.focus();
		return(false)
	}else
		idCampo.style.backgroundColor = corAcerto
	idCampo = document.getElementById("email");
	idCampo.value = idCampo.value.replace(/^\s+|\s+$/g, "");
	if(idCampo.value.length > 0){
		parte1 = idCampo.value.indexOf("@");
		parte2 = idCampo.value.indexOf(".");
		parte3 = idCampo.value.length;
		if(!(parte1 >= 2 && parte2 >= 1 && parte3 >= 8)){
			alert ("Informe corretamente o E-MAIL!");
			idCampo.select();
			idCampo.style.backgroundColor = corErro;
			return(false)
		}else{
			idCampo.value = idCampo.value.toLowerCase();
			idCampo.style.backgroundColor = corAcerto;
		}
	}else{
		alert ("Informe corretamente o E-MAIL!");
		idCampo.select();
		idCampo.style.backgroundColor = corErro;
		return(false)
	}
	var classe1 = new classeAjax("get", "", "../includes/aguarde.asp?idImg=2&msgAguarde=validando|divAguarde!0$0*0,0<0>0^0~0-");
	var classe2 = new classeAjax("frmNesletter", "newsletterCadastro2", "../page/newsletter_cadastro_inc.asp?actionForm=cadNewsletter");
	return(false)
}
function newsletterCadastro2(retornoForm){
	document.getElementById("divAguarde").innerHTML = "&nbsp;";
	if(retornoForm == 1){
		alert("Erro ao cadastrar seus dados na tabela de newsletter!\nPor favor, cheque todos os campos e tente novamente.");
		document.getElementById("divCadastro").style.display = "block";
		document.getElementById("divResultado").style.display = "none";
		document.getElementById("nome").select()
	}else if(retornoForm == 2){
		alert("Este e-mail já está cadastrado!");
		document.getElementById("divCadastro").style.display = "block";
		document.getElementById("divResultado").style.display = "none";
		document.getElementById("email").select()
	}else{
		document.getElementById("divCadastro").style.display = "none";
		document.getElementById("divResultado").style.display = "block";
	}
}