function disparaInformativo(){
	var nome = document.getElementById("informativoNome").value;
	var email = document.getElementById("informativoEmail").value;
	nome = trim(nome);
	email = trim(email);
	if ((nome!="")&&(email!="")&&(nome.length>4)&&(email.length>6)){
		window.open("cadInformativo.php?nome="+nome+"&email="+email,"Informativo","height=100,width=400,status=no,toolbar=no");
		pegaErroInformativo();
	}
	else{
		pegaErroInformativo();
	}
}
function pegaErroInformativo(){
	var nome = document.getElementById("informativoNome").value;
	var email = document.getElementById("informativoEmail").value;
	
	if((nome=="")||(nome.length<4))
		document.getElementById("spanNome").className = "spanErro";
	else
		document.getElementById("spanNome").className = "spanCerto";
		
	if((email=="")||(email.length<6))
		document.getElementById("spanEmail").className = "spanErro";
	else
		document.getElementById("spanEmail").className = "spanCerto";
}
function trim(str){
				var retorno = "";
				for(x=0;x<=str.length;x++){
					if((str.charCodeAt(x) != 9)&&(str.charCodeAt(x) != 10)&&(str.charCodeAt(x) != 32)&&((str.charCodeAt(x) <= 0)||(str.charCodeAt(x) >= 0)) ){
						retorno = retorno+str.charAt(x);
					}	
				}
				
				return retorno;
				
				
			}
function calcMeio(ID){
	var tela = screen.availWidth;
	var corpo = document.getElementById(ID);
	corpo.style.left = ((tela-760)/2)+'px';
}
function submenu(ID,act){
	
	var elemento = document.getElementById(ID);
	if (((elemento.style.visibility == "")||(elemento.style.visibility == "hidden"))&&(act=="ap")){
		elemento.style.visibility = "visible";
	}
	else
		elemento.style.visibility = "hidden";
		
	
}
function removeErro(ID){
	var elemento = document.getElementById(ID);	
	alert(elemento.childNodes[2].childNodes.length);
	
}

function mudaCSS(ELEM){
	if (ELEM.className == "over")
		ELEM.className = "";
	else
		ELEM.className = "over";
}

function verificaCampoEmail(){
	var elementos = new Array(5);
	elementos[0] = document.getElementById("nome");
	elementos[1] = document.getElementById("email");
	elementos[2] = document.getElementById("assunto");
	elementos[3] = document.getElementById("mensagem");
	//elementos[1] = document.getElementById("telefone");
	for (r=0; r<elementos.length;r++){
		 
		if(trim(elementos[r].value)<=1){
			criaErro(elementos[r]);
		}else{
			removeErro(elementos[r]);
		}
//		alert(elementos[x].parentNode.nodeName);	
	}
}

function criaErro(elemento){
	if(elemento.parentNode.lastChild.nodeName =="SPAN"){
		elemento.parentNode.removeChild(elemento.parentNode.lastChild);
	}
	var textoErro = document.createTextNode("Informe "+elemento.id);
	var filho = document.createElement('SPAN');
	filho.appendChild(textoErro);
	elemento.parentNode.appendChild(filho); 
	
}
function removeErro(elemento){
	if(elemento.parentNode.lastChild.nodeName =="SPAN"){
		elemento.parentNode.removeChild(elemento.parentNode.lastChild);
	}	
}
function redirect(local){
	var seg = document.getElementById("seg");
	var total = seg.childNodes[0].nodeValue;
	if (total>0){
		seg.childNodes[0].nodeValue  = total-1;
	}else{
		if(local !='')
			location.href = local;	
		else
			self.close();	
	}
	
}