// JavaScript Document

function ajaxInit() {
	
	var xmlhttp;
	
	try {
		xmlhttp = new XMLHttpRequest();
	} catch(ee) {
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(E) {
				xmlhttp = false;
			}
		}
	}
	return xmlhttp;
}

//-----------------Fundo linha Formulário---------------------------
function fundo_linha(obj, acao){
	if (acao=='focus'){
		obj.parentNode.style.backgroundColor='#FFFAF2';
	} else {
		obj.parentNode.style.backgroundColor='transparent';
	}
}
//-----------------Final Fundo linha Formulário---------------------------





//-------------------Muda IMG--------------------------------
function mudaimg(obj, ext){
var img=obj.src.substring(0,(obj.src.length)-4);
	if(img.substring(img.length-6)!='_hover'){
		obj.src=img+"_hover."+ext;
	}
}


function voltarimg(obj, ext){
	var img=obj.src.substring(0,(obj.src.length)-4);
	if(img.substring(img.length-6)=='_hover'){
	obj.src=img.substring(0,img.length-6)+"."+ext;
	}
}
//-------------------Final Muda IMG--------------------------------



//----------------------Loading------------------------------------

function loading(obj){
	document.getElementById(obj).innerHTML=""				
	var img=document.createElement('img');
	img.setAttribute('src','imagens/loading.gif');
	img.setAttribute('alt','Carregando Dados');
	document.getElementById(obj).appendChild(img);
}

//----------------------Final Loading------------------------------------





//----------------------Menu------------------------------------
mostra_submenu=new Array();
some_submenu=new Array();
function inicia_menu(){
	var submenus = document.getElementById('submenus').getElementsByTagName('ul');
	for (var s=0; s<submenus.length; s++){
		hidden_submenu(submenus[s].id, s);
	}
}

function show_submenu(nome, posicao, menu_atual, obj){
	clearInterval(some_submenu[nome]);
	var menu=document.getElementById('menu').getElementsByTagName('a');
	document.getElementById('menu_atual').innerHTML=nome;
	var submenu = document.getElementById(nome);
	if (navigator.appName=='Microsoft Internet Explorer'){
		var opacidade=submenu.style.filter;
		if(opacidade==undefined || opacidade==''){
			submenu.style.filter="alpha(opacity=0)";
			opacidade=0;
		} else {
			opacidade=parseInt(opacidade.substr(opacidade.substr(0,14).length, (opacidade.length-opacidade.substr(0,14).length)-1))/10;
		}
	}else{
		var opacidade=submenu.style.opacity;
		if(opacidade==undefined || opacidade==''){
		submenu.style.opacity=0;
		}
		opacidade=opacidade*10;
	}
	submenu.style.display="block";
	submenu.style.marginLeft=posicao+"px";
	var i=opacidade;
	mostra_submenu[nome] = setInterval(function (){
		if (i<=10){
			submenu.style.filter="alpha(opacity="+(i*10)+")";
			submenu.style.opacity=i/10;	
		} else {
			clearInterval(mostra_submenu[nome]);
		}
		i++
	}, 40);
}

function hidden_submenu(nome, obj){
	var submenu = document.getElementById(nome);
	var menu=document.getElementById('menu').getElementsByTagName('a');
	if (navigator.appName=='Microsoft Internet Explorer'){
		var opacidade=submenu.style.filter;
		if(opacidade==undefined || opacidade==''){
			opacidade=0;
		} else {
			opacidade=parseInt(opacidade.substr(opacidade.substr(0,14).length, (opacidade.length-opacidade.substr(0,14).length)-1))/10;
		}
	} else {
		var opacidade=submenu.style.opacity;
		if(opacidade==undefined || opacidade==''){
			opacidade=0;
		}
		opacidade=opacidade*10;
	}
	v=opacidade;
	some_submenu[nome] = setInterval(function (){
		if (v>0){
			submenu.style.filter="alpha(opacity="+(v*10)+")";
			submenu.style.opacity=v/10;
		} else {
			submenu.style.display="none";
			clearInterval(some_submenu[nome]);
		}
		v--
	}, 40);
}
//----------------------Final Menu------------------------------





//----------------------------Validação Campos----------------------------------------
	//-------Nome-------------
	function valida_nome(obj){
		var nome = obj.value;
		if (nome.length<4 || nome.indexOf(" ")<1){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//-------Final Nome---------------
	
	//---------Emal--------------------
	function valida_email(obj){
		var email = obj.value;
		obj.value=email.toLowerCase();
		email = obj.value;
		var comando = /^[a-z0-9_-]+(\.[a-z0-9_-]+)*@[a-z0-9-]+\.[a-z0-9-]+(\.[a-z0-9-]+)*$/;
		var valida = comando.exec(email);
		if (!valida){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//-----------Final Email----------------
	
	//-----------CNPJ-----------------------
	function valida_cnpj(obj,erro){
		var cnpj = obj.value;
		if(cnpj.length==14){
			for(var i=0; i<cnpj.length; i++){
				if(isNaN(cnpj.charAt(i))==true){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			cnpj = obj.value=obj.value.substr(0,2)+"."+obj.value.substr(2,3)+"."+obj.value.substr(5,3)+"/"+obj.value.substr(8,4)+"-"+obj.value.substr(12);
		}else if(cnpj.length==18){
			obj.value=obj.value.substr(0,2)+"."+obj.value.substr(3,3)+"."+obj.value.substr(7,3)+"/"+obj.value.substr(11,4)+"-"+obj.value.substr(16);
			cnpj = obj.value;
		} else{
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;			
		}
		
		if (cnpj.length<18 || cnpj.charAt(2)!="." || cnpj.charAt(6)!="." || cnpj.charAt(10)!="/" || cnpj.charAt(15)!="-" || cnpj=="00.000.000/0000-00" || cnpj=="11.111.111/1111-11" || cnpj=="22.222.222/2222-22" || cnpj=="33.333.333/3333-33" || cnpj=="44.444.444/4444-44" || cnpj=="55.555.555/5555-55" || cnpj=="66.666.666/6666-66" || cnpj=="77.777.777/7777-77" || cnpj=="88.888.888/8888-88" || cnpj=="99.999.999/9999-99"){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			// Primeiro Calculo
			calculo1 = new Array(17)
			for (i=0; i<=17; i++){
				calculo1[i]=cnpj.charAt(i);
			} 
			valor_cal=(calculo1[0]*5)+(calculo1[1]*4)+(calculo1[3]*3)+(calculo1[4]*2)+(calculo1[5]*9)+(calculo1[7]*8)+(calculo1[8]*7)+(calculo1[9]*6)+(calculo1[11]*5)+(calculo1[12]*4)+(calculo1[13]*3)+(calculo1[14]*2);
			valor_cal=valor_cal%11;
				if (valor_cal<2){
					valor_cal=0;
				} else {
					valor_cal=11-valor_cal;
				}
				
				
			// Segundo Calculo
			calculo2 = new Array(17)
			for (i=0; i<=17; i++){
				calculo2[i]=cnpj.charAt(i);
			} 
			valor_cal2=(calculo2[0]*6)+(calculo2[1]*5)+(calculo2[3]*4)+(calculo2[4]*3)+(calculo2[5]*2)+(calculo2[7]*9)+(calculo2[8]*8)+(calculo2[9]*7)+(calculo2[11]*6)+(calculo2[12]*5)+(calculo2[13]*4)+(calculo2[14]*3)+(valor_cal*2);
			valor_cal2=valor_cal2%11;
				if (valor_cal2<2){
					valor_cal2=0;
				} else {
					valor_cal2=11-valor_cal2;
				}
				if (valor_cal == calculo1[16] && valor_cal2 == calculo1[17]){
					for(var i=0; i<cnpj.length; i++){
						if(isNaN(cnpj.charAt(i))==true && i!=2 && i!=6 && i!=10 && i!=15){
							obj.style.borderColor="#900";
							obj.style.borderRightWidth="5px";
							return false;
						}
					}
					obj.style.borderColor="#063";
					obj.style.borderRightWidth="5px";
				} else {
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
		}
	}
	//------------Final CNPJ----------------
	
	
	
	
	//---------------CPF--------------------
	function valida_cpf(obj,erro){
		var cpf=obj.value;
		if(cpf.length==11){
			for(var i=0; i<cpf.length; i++){
				if(isNaN(cpf.charAt(i))==true){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			cpf = obj.value=obj.value.substr(0,3)+"."+obj.value.substr(3,3)+"."+obj.value.substr(6,3)+"-"+obj.value.substr(9);
		}else if(cpf.length==14){
			obj.value=obj.value.substr(0,3)+"."+obj.value.substr(4,3)+"."+obj.value.substr(8,3)+"-"+obj.value.substr(12);
			cpf = obj.value;
		} else{
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;			
		}
		if (cpf.length<14 || cpf.charAt(3)!="." || cpf.charAt(7)!="." || cpf.charAt(11)!="-" || cpf=="000.000.000-00" || cpf=="111.111.111-11" || cpf=="222.222.222-22" || cpf=="333.333.333-33" || cpf=="444.444.444-44" || cpf=="555.555.555-55" || cpf=="666.666.666-66" || cpf=="777.777.777-77" || cpf=="888.888.888-88" || cpf=="999.999.999-99"){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
		// Primeiro Calculo
		calculo1 = new Array(13)
			for (i=0; i<=13; i++){
				calculo1[i]=cpf.charAt(i);
			} 
			valor_cal=(calculo1[0]*10)+(calculo1[1]*9)+(calculo1[2]*8)+(calculo1[4]*7)+(calculo1[5]*6)+(calculo1[6]*5)+(calculo1[8]*4)+(calculo1[9]*3)+(calculo1[10]*2);
			valor_cal=valor_cal%11;
				if (valor_cal<2){
					valor_cal=0;
				} else {
					valor_cal=11-valor_cal;
				}
				
				
			// Segundo Calculo
			calculo2 = new Array(10)
			for (i=0; i<=10; i++){
				calculo2[i]=cpf.charAt(i);
			} 
			valor_cal2=(calculo2[0]*11)+(calculo2[1]*10)+(calculo2[2]*9)+(calculo2[4]*8)+(calculo2[5]*7)+(calculo2[6]*6)+(calculo2[8]*5)+(calculo2[9]*4)+(calculo2[10]*3)+(valor_cal*2);
			valor_cal2=valor_cal2%11;
			if (valor_cal2<2){
				valor_cal2=0;
			} else {
				valor_cal2=11-valor_cal2;
			}
			if (valor_cal == calculo1[12] && valor_cal2 == calculo1[13]){
				for(var i=0; i<cpf.length; i++){
					if(isNaN(cpf.charAt(i))==true && i!=3 && i!=7 && i!=11){
						obj.style.borderColor="#900";
						obj.style.borderRightWidth="5px";
						return false;
					}
				}
				obj.style.borderColor="#063";
				obj.style.borderRightWidth="5px";				
			} else {
				obj.style.borderColor="#900";
				obj.style.borderRightWidth="5px";
				return false;
			}
		}
	}
	//---------------Final CPF--------------
	
	
	
	//------------Telefone------------------
	function valida_telefone(obj){
		var tel = obj.value;
		if(tel.length==10){
			for(var i=0; i<tel.length; i++){
				if(isNaN(tel.charAt(i))==true){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			obj.value="("+obj.value.substr(0,2)+") "+obj.value.substr(2,4)+"-"+obj.value.substr(6);
			tel = obj.value;
		}else if(tel.length==14){
			obj.value="("+obj.value.substr(1,2)+") "+obj.value.substr(5,4)+"-"+obj.value.substr(10,4);
			tel = obj.value;
		} else{
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;			
		}
		if (tel.length<14 || tel.charAt(4)!=" " || tel.charAt(9)!="-" || tel.charAt(0)!="(" || tel.charAt(3)!=")"){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			for(var i=0; i<tel.length; i++){
				if(isNaN(tel.charAt(i))==true && i!=0 && i!=3 && i!=4 && i!=9){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//------------Final Telefone------------
	
	
	
	//------------Twitter------------------
	function valida_twitter(obj){
		var twitter = obj.value;
		var arroba = /^@/
		if (!arroba.exec(twitter) || twitter.length<3){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;			
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";			
		}
	}
	//------------Final Twitter------------
	
	
	
	//------------CEP------------------
	function valida_cep(obj){
		var cep = obj.value;
		if(cep.length==8){
			for(var i=0; i<cep.length; i++){
				if(isNaN(cep.charAt(i))==true){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			obj.value=obj.value.substr(0,5)+"-"+obj.value.substr(5);
			cep = obj.value;
		}else if(cep.length==9){
			obj.value=obj.value.substr(0,5)+"-"+obj.value.substr(6);
			cep = obj.value;
		} else{
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;			
		}
		if (cep.length<9 || cep.charAt(5)!="-"){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			for(var i=0; i<cep.length; i++){
				if(isNaN(cep.charAt(i))==true && i!=5){
					obj.style.borderColor="#900";
					obj.style.borderRightWidth="5px";
					return false;
				}
			}
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//------------Final CEP------------
	
	
	
	//------------Quantidade de Caracteres------------------
	function valida_length_numero(obj, maior, menor){
		var campo = obj.value;
		for(var i=0; i<campo.length; i++){
			if(isNaN(campo.charAt(i))==true){
				obj.style.borderColor="#900";
				obj.style.borderRightWidth="5px";
				return false;
			}
		}
		if (campo.length<menor || campo.length>maior){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//------------Final Quantidade de Caracteres------------
	
	
	
	//------------Quantidade de Caracteres Números------------------
	function valida_length(obj, maior, menor){
		var campo = obj.value;
		if (campo.length<menor || campo.length>maior){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//------------Final Quantidade de Caracteres Números------------
	
	
	
	//---------------- Contato -------------------
	function valida_contato(obj){
		var contato=obj.value;
		if (contato==''){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//------------------Final Contato--------------
	
	
	
	//-----------------Como nos conheceu?----------------
	function valida_combo(obj){
		var combo=obj.value;
		if (combo==''){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}
	//-----------------Final Como nos conheceu?----------------
	
	
	
	
	//-----------------Final Assunto----------------
	function valida_assunto(obj){
		var assunto = obj.value;
		if (assunto.length<5){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}
	}	
	//-----------------Final Assunto----------------
	
	
	
	
	//-----------------Final Mensagem----------------
	function valida_msg(obj){
		var msg = obj.value;
		if (msg.length<10 || msg=='Deixe aqui sua mensagem!'){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";
		}		
	}
	//-----------------Final Mensagem----------------
	
	
	
	//-----------------Data Nascimento---------------
	function valida_nasc(obj){
		var nasc = obj.value;
		if (nasc.length<10){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";	
		}
	}
	//-----------------Final Data Nascimento---------------
	
	
	
	//-----------------Site---------------
	function valida_site(obj){
		var site = obj.value;
		if (site.length<5){
			obj.style.borderColor="#900";
			obj.style.borderRightWidth="5px";
			return false;
		} else {
			if(site.substr(0,7)!="http://" && site.substr(0,8)!="https://"){
				obj.value="http://"+site;
			}
			obj.style.borderColor="#063";
			obj.style.borderRightWidth="5px";	
		}
	}
	//-----------------Final Site---------------

//----------------------------Final Validação Campos----------------------------------




//---------------------Pontuações Campos-------------------------------------
	
	//------Somente Números-----------------------		
	function numeros(e){
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode; 
		} else if(e.which) {
			tecla = e.which; 
		} else {
			return true;
		}
		
		if(((tecla < 48) || (tecla > 57)) && (tecla!=8)){
			return false;
		}
		
	}
	//-------------Final Somente Números----------------
	
	
	//-------Pontuação CNPJ-------------
	function pontuacao_cnpj(obj, e){		
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode;
		} else if(e.which) {
			tecla = e.which;
		} else {
			return true;
		}
			
		cnpj=obj.value;
		if ((cnpj.length==2 || cnpj.length==6) && tecla!=8){
			obj.value=cnpj+".";
		}
				
		if ((cnpj.length==10) && tecla!=8){
			obj.value=cnpj+"/";
		}	
			
		if (cnpj.length==15 && tecla!=8){
			obj.value=cnpj+"-";
		}
	}
	//-------Final Pontuação CNPJ-------------
	
	//-------Pontuação Telefone-------------
	function traco_tel(obj, e){			
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode;
		} else if(e.which) {
			tecla = e.which;
		} else {
			return true;
		}
		
		tel=obj.value;
		if (tel.length==2 && tel.charAt(0)!="(" && tecla!=8){
				obj.value="("+tel+") ";
		}
		
		if (tel.length==3 && tel.charAt(0)=="(" && tecla!=8){
				obj.value=tel+") ";
		}
		
		if (tel.length==9 && tecla!=8){
			obj.value=tel+"-";
			}
	}
	//-------Final Pontuação Telefone-------------

	//----------pontuação do CPF----------------------
	function pontuacao_cpf(obj, e){
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode;
		} else if(e.which) {
			tecla = e.which;
		} else {
			return true;
		}
		
		cpf=obj.value;
		if ((cpf.length==3 || cpf.length==7) && tecla!=8){
			obj.value=cpf+".";
		}
		if (cpf.length==11 && tecla!=8){
			obj.value=cpf+"-";
		}
	}

	//----------Final pontuação do CPF----------------------
	
	
	
	//--------------Pontuação CEP----------------------
	function traco_cep(obj, e){
			
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode;
		}
		else if(e.which) {
			tecla = e.which;
		}
		else {
			return true;
		}
		
		cep=obj.value;
		if (cep.length==5 && tecla!=8){
			obj.value=cep+"-";
		}
	}
	//--------------Final Pontuação CEP----------------------
	
	
	
	//-------------Barras Data---------------------------
	function barra_data(obj,e){
		var tecla=new Number();
		if(window.event) {
			tecla = e.keyCode;
		} else if(e.which) {
			tecla = e.which;
		} else {
			return true;
		}
			
		data=obj.value;
		if ((data.length==2 || data.length==5) && tecla!=8){
			obj.value=data+"/";
		}
	}
	//-------------Final Barras Data---------------------------
//---------------------Final Pontuações Campos-------------------------------------

function valida_form(obj){
	var erro=0;
	//Valida Nome
	if(valida_nome(obj.nome)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_email(obj.email)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_tel(obj.tel)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_contato(obj.contato)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_como(obj.como)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_assunto(obj.assunto)==false){
		erro=1;
	}
	//Valida Nome
	if(valida_msg(obj.msg)==false){
		erro=1;
	}
	
	if (erro!=0){
		return false;
	}
}

//================================ Input Padrão =====================================

function input_padrao(obj){
		obj.style.border = "1px solid #CCC";
}
//================================ Final Input Padrão ===============================


//================================ Valida Fale Conosco =====================================

function valida_fale_conosco(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite seu nome corretamente!";
		input[erro]=0;
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite seu E-mail corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_telefone(obj.telefone)==false){
		desc_erro[erro]="Digite seu Telefone corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_combo(obj.fale_com)==false){
		desc_erro[erro]="Escolha com que setor você deseja falar!";
		input[erro]=2;
		erro = erro + 1;
	}
	
	if (valida_combo(obj.como_conheceu)==false){
		desc_erro[erro]="Diga-nos como você nos conheceu!";
		input[erro]=3;
		erro = erro + 1;
	}
	
	if (valida_length(obj.assunto, 60, 3)==false){
		desc_erro[erro]="Digite o Assunto corretamente!";
		input[erro]=4;
		erro = erro + 1;
	}
	
	if (valida_length(obj.msg,1200,10)==false){
		desc_erro[erro]="Digite a Mensagem Corretamente!";
		input[erro]=5;
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var titulo_erro = document.createElement('li');
		titulo_erro.className="titulo_erro";
		titulo_erro.appendChild(document.createTextNode('Clique em um dos erros abaixo para identificar o local do mesmo:')); 
		document.getElementById('erros').appendChild(titulo_erro);
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
			li[i].onclick = function (i){
				for (a=0; a<lis.length; a++){
					if (lis[a]==this){
						elementos[input[a-1]].focus();
						break;
					}
				}
			}
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Final Fale Conosco ===========================================


//================================ Valida Plantur Quitado =====================================

function valida_plantur_quitado(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite seu nome corretamente!";
		input[erro]=0;
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite seu E-mail corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_telefone(obj.telefone)==false){
		desc_erro[erro]="Digite seu Telefone corretamente!";
		input[erro]=2;
		erro = erro + 1;
	}
	
	if (valida_length(obj.msg,1200,10)==false){
		desc_erro[erro]="Digite a Mensagem Corretamente!";
		input[erro]=3;
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var titulo_erro = document.createElement('li');
		titulo_erro.className="titulo_erro";
		titulo_erro.appendChild(document.createTextNode('Clique em um dos erros abaixo para identificar o local do mesmo:')); 
		document.getElementById('erros').appendChild(titulo_erro);
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
			li[i].onclick = function (i){
				for (a=0; a<lis.length; a++){
					if (lis[a]==this){
						elementos[input[a-1]].focus();
						break;
					}
				}
			}
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Final Plantur Quitado ===========================================


//================================ Valida Fomulário Twitter =====================================

function valida_form_twitter(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite seu nome corretamente!";
		input[erro]=0;
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite seu E-mail corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_twitter(obj.twitter)==false){
		desc_erro[erro]="Digite seu Twitter corretamente!";
		input[erro]=2;
		erro = erro + 1;
	}
	
	if (valida_telefone(obj.telefone)==false){
		desc_erro[erro]="Digite seu Telefone corretamente!";
		input[erro]=3;
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var titulo_erro = document.createElement('li');
		titulo_erro.className="titulo_erro";
		titulo_erro.appendChild(document.createTextNode('Clique em um dos erros abaixo para identificar o local do mesmo:')); 
		document.getElementById('erros').appendChild(titulo_erro);
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
			li[i].onclick = function (i){
				for (a=0; a<lis.length; a++){
					if (lis[a]==this){
						elementos[input[a-1]].focus();
						break;
					}
				}
			}
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Final Frormulário Twitter ===========================================


//================================ Valida Cadatro Convênio Empresa =====================================

function valida_form_convenio(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite o nome da Empresa corretamente!";
		input[erro]=0;
		erro = erro + 1;
	}
	
	if (valida_cnpj(obj.cnpj)==false){
		desc_erro[erro]="Digite o CNPJ da Empresa corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_nome(obj.nome_responsavel)==false){
		desc_erro[erro]="Digite o Nome do Diretor Responsavel corretamente!";
		input[erro]=2;
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite o E-mail da Empresa corretamente!";
		input[erro]=3;
		erro = erro + 1;
	}
	
	if (valida_telefone(obj.telefone)==false){
		desc_erro[erro]="Digite o Telefone da Empresa corretamente!";
		input[erro]=5;
		erro = erro + 1;
	}
	
	if (valida_cep(obj.cep)==false){
		desc_erro[erro]="Digite o CEP da Empresa corretamente!";
		input[erro]=6;
		erro = erro + 1;
	}
	
	if (valida_nome(obj.endereco)==false){
		desc_erro[erro]="Digite o Endereço da Empresa corretamente!";
		input[erro]=7;
		erro = erro + 1;
	}
	
	if (valida_length(obj.numero,5,1)==false){
		desc_erro[erro]="Digite o Número do Endereço da Empresa corretamente!";
		input[erro]=9;
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var titulo_erro = document.createElement('li');
		titulo_erro.className="titulo_erro";
		titulo_erro.appendChild(document.createTextNode('Clique em um dos erros abaixo para identificar o local do mesmo:')); 
		document.getElementById('erros').appendChild(titulo_erro);
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
			li[i].onclick = function (i){
				for (a=0; a<lis.length; a++){
					if (lis[a]==this){
						elementos[input[a-1]].focus();
						break;
					}
				}
			}
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Final Valida Cadatro Convênio Empresa ===========================================


//================================ Valida Contrato =====================================

function valida_contrato(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite seu NOME corretamente!";
		erro = erro + 1;
	}
	
	if (valida_cpf(obj.cpf)==false){
		desc_erro[erro]="Digite seu CPF corretamente!";
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite seu e-mail corretamente!";
		erro = erro + 1;
	}
	
	if (valida_nasc(obj.data_nasc)==false){
		desc_erro[erro]="Digite a data de seu nascimento corretamente!";
		erro = erro + 1;
	}
	
	if (concorda(document.form.acordo, 'contrato')==false){
		desc_erro[erro]="Para continuar a compra você deve CONCORDAR com nosso Termo de Acordo!";
		document.getElementById('contrato').style.borderColor="#900";
		document.getElementById('contrato').style.borderRight="5px solid #900";
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Final Valida Contrato ===========================================


//================================ Valida Cadatro Convênio Hotel =====================================

function valida_form_convenio_hotel(obj){
	var erro = 0
	var desc_erro = new Array();
	var input = new Array();
	if (valida_nome(obj.nome)==false){
		desc_erro[erro]="Digite o nome da Empresa corretamente!";
		input[erro]=0;
		erro = erro + 1;
	}
	
	if (valida_cnpj(obj.cnpj)==false){
		desc_erro[erro]="Digite o CNPJ da Empresa corretamente!";
		input[erro]=1;
		erro = erro + 1;
	}
	
	if (valida_nome(obj.nome_responsavel)==false){
		desc_erro[erro]="Digite o Nome do Diretor Responsavel corretamente!";
		input[erro]=2;
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite o E-mail da Empresa corretamente!";
		input[erro]=3;
		erro = erro + 1;
	}
	
	if (valida_telefone(obj.telefone)==false){
		desc_erro[erro]="Digite o Telefone da Empresa corretamente!";
		input[erro]=5;
		erro = erro + 1;
	}
	
	if (valida_cep(obj.cep)==false){
		desc_erro[erro]="Digite o CEP da Empresa corretamente!";
		input[erro]=6;
		erro = erro + 1;
	}
	
	if (valida_nome(obj.endereco)==false){
		desc_erro[erro]="Digite o Endereço da Empresa corretamente!";
		input[erro]=7;
		erro = erro + 1;
	}
	
	if (valida_length(obj.numero,5,1)==false){
		desc_erro[erro]="Digite o Número do Endereço da Empresa corretamente!";
		input[erro]=9;
		erro = erro + 1;
	}
	
	if (valida_length_numero(obj.temporada_turistica,3,1)==false){
		desc_erro[erro]="Digite o Desconto na Temporada Turistica corretamente!";
		input[erro]=10;
		erro = erro + 1;
	}
	
	if (valida_length_numero(obj.temporada_baixa,3,1)==false){
		desc_erro[erro]="Digite o Desconto na Temporada Baixa corretamente!";
		input[erro]=11;
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros').innerHTML="";
		var li = new Array();
		var total_erros = desc_erro.length;
		var titulo_erro = document.createElement('li');
		titulo_erro.className="titulo_erro";
		titulo_erro.appendChild(document.createTextNode('Clique em um dos erros abaixo para identificar o local do mesmo:')); 
		document.getElementById('erros').appendChild(titulo_erro);
		var elementos = document.form.elements;
		var lis = document.getElementById('erros').getElementsByTagName('li');
		for (var i=0; i<total_erros; i++){
			li[i] = document.createElement('li');
			li[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros').appendChild(li[i]);
			li[i].onclick = function (i){
				for (a=0; a<lis.length; a++){
					if (lis[a]==this){
						elementos[input[a-1]].focus();
						break;
					}
				}
			}
		}
		if (animacao==0){
			anima_erros();
		}
		return false;
	}
}
//================================ Valida Cadatro Convênio Empresa ===========================================


//================================ Valida Newsletter =====================================

function valida_newsletter(obj){
	var erro = 0
	var desc_erro = new Array();
	if (valida_length(obj.nome,150,3)==false){
		desc_erro[erro]="Digite seu Nome corretamente!";
		erro = erro + 1;
	}
	
	if (valida_email(obj.email)==false){
		desc_erro[erro]="Digite seu e-mail corretamente!";
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros_newsletter').innerHTML="";
		var p = new Array();
		var total_erros = desc_erro.length;
		for (var i=0; i<total_erros; i++){
			p[i] = document.createElement('p');
			p[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros_newsletter').appendChild(p[i]);
		}
		var a = document.createElement('a');
		var center = document.createElement('center');
		a.appendChild(document.createTextNode("Fechar"));
		a.setAttribute('href','javascript://');
		a.onclick = function (){
			none_obj('erros_newsletter');
		}
		center.appendChild(a);
		document.getElementById('erros_newsletter').appendChild(center);
		if (animacao==0){
			document.getElementById('erros_newsletter').style.border="1px solid #900";
			document.getElementById('erros_newsletter').style.backgroundColor="#C05656";
			anima_erros2("erros_newsletter");
		}
		return false;
	} else {
		document.getElementById('erros_newsletter').style.border="1px solid #063";
		document.getElementById('erros_newsletter').style.backgroundColor="#2DB530";
		ajax=ajaxInit();
		ajax.open('GET','valida_newsletter.php?nome='+obj.nome.value+'&email='+obj.email.value,true);				
		ajax.onreadystatechange=function(){		
			if(ajax.readyState == 1){
				loading('erros_newsletter');
			}
			if(ajax.readyState == 4){
				if(ajax.status == 200){
					document.getElementById("erros_newsletter").innerHTML=ajax.responseText;
					anima_erros2("erros_newsletter");
				}
			}
		}
		ajax.send(null);
		input_padrao(obj.nome);
		input_padrao(obj.email);
		obj.nome.value="";
		obj.email.value="";
	}
	return false;
}
//================================ Final Valida Newsletter ===========================================


//================================ Valida Indiquenos =====================================

function valida_indiquenos(obj){
	var erro = 0
	var desc_erro = new Array();
	if (valida_length(obj.nome_indicador,150,3)==false){
		desc_erro[erro]="Digite o seu Nome corretamente!";
		erro = erro + 1;
	}
	if (valida_length(obj.nome_indicado,150,3)==false){
		desc_erro[erro]="Digite o Nome do indicado corretamente!";
		erro = erro + 1;
	}
	
	if (valida_email(obj.email_indicado)==false){
		desc_erro[erro]="Digite o e-mail do Indicado corretamente!";
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros_indiquenos').innerHTML="";
		var p = new Array();
		var total_erros = desc_erro.length;
		for (var i=0; i<total_erros; i++){
			p[i] = document.createElement('p');
			p[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros_indiquenos').appendChild(p[i]);
		}
		var a = document.createElement('a');
		var center = document.createElement('center');
		a.appendChild(document.createTextNode("Fechar"));
		a.setAttribute('href','javascript://');
		a.onclick = function (){
			none_obj('erros_indiquenos');
		}
		center.appendChild(a);
		document.getElementById('erros_indiquenos').appendChild(center);
		if (animacao==0){
			document.getElementById('erros_indiquenos').style.border="1px solid #900";
			document.getElementById('erros_indiquenos').style.backgroundColor="#C05656";
			anima_erros2("erros_indiquenos");
		}
		return false;
	} else {
		document.getElementById('erros_indiquenos').style.border="1px solid #063";
		document.getElementById('erros_indiquenos').style.backgroundColor="#2DB530";
		ajax=ajaxInit();
		ajax.open('GET','valida_indiquenos.php?nome_indicador='+obj.nome_indicador.value+'&nome_indicado='+obj.nome_indicado.value+'&email='+obj.email_indicado.value,true);				
		ajax.onreadystatechange=function(){		
			if(ajax.readyState == 1){
				loading('erros_indiquenos');
			}
			if(ajax.readyState == 4){
				if(ajax.status == 200){
					document.getElementById("erros_indiquenos").innerHTML=ajax.responseText;
					anima_erros2("erros_indiquenos");
				}
			}
		}
		ajax.send(null);
		input_padrao(obj.nome_indicador);
		input_padrao(obj.nome_indicado);
		input_padrao(obj.email_indicado);
		obj.nome_indicador.value="";
		obj.nome_indicado.value="";
		obj.email_indicado.value="";
	}
	return false;
}
//================================ Final Valida Indiquenos ===========================================

//================================ Fechar Objetos ===========================================
	function none_obj(obj){
		document.getElementById(obj).style.display="none";
	}
//================================ Final Fechar Objetos ===========================================

//================================ Anima Listagem de Erros =========================================
animacao=0;
function anima_erros(){
	animacao=1;
	var erros = document.getElementById('erros');
	var overflow = document.getElementById('overflow');
	overflow.style.display="block";
	var h_erros = erros.offsetHeight;
	var novo_h=0;
	mostra_erros = setInterval(function () {
		if(novo_h<h_erros){
			novo_h=parseInt(((h_erros*5)/100) + novo_h);
			if(novo_h>h_erros){
				novo_h=h_erros;
			}
			overflow.style.height=novo_h+"px";
		} else {
			animacao=0;
			clearInterval(mostra_erros)
		}
	}, 40);
}
//================================ Final Anima Listagem de Erros =========================================


//================================ Anima Listagem de Erros Newsletter =========================================
animacao=0;
function anima_erros2(obj){
	animacao=1;
	var erros = document.getElementById(obj);
	erros.style.filter="alpha(opacity="+0+")";
	erros.style.opacity=0;
	erros.style.display="block";
	var h_erros = erros.offsetHeight;
	var novo_h=0;
	mostra_erros = setInterval(function () {
		if (navigator.appName=='Microsoft Internet Explorer'){
			var opacidade=erros.style.filter;
			if(opacidade==undefined || opacidade==''){
				erros.style.filter="alpha(opacity=0)";
				opacidade=0;
			} else {
				opacidade=parseInt(opacidade.substr(opacidade.substr(0,14).length, (opacidade.length-opacidade.substr(0,14).length)-1))/10;
			}
		}else{
			var opacidade=erros.style.opacity;
			if(opacidade==undefined || opacidade==''){
			erros.style.opacity=0;
			}
			opacidade=opacidade*10;
		}
		if(opacidade<=8){
			erros.style.filter="alpha(opacity="+(novo_h*10)+")";
			erros.style.opacity=novo_h/10;
		} else {
			animacao=0;
			clearInterval(mostra_erros)
		}
		novo_h++
	}, 40);
}
//================================ Final Anima Listagem de Erros Newsletter =========================================


//================================ Valida Concorda =========================================

function concorda(obj, contrato){
	if(obj.checked==true){
		document.getElementById(contrato).style.borderColor="#006633";
		document.getElementById(contrato).style.borderRight="5px solid #063";
	} else {
		document.getElementById(contrato).style.borderColor="#006633";
		document.getElementById(contrato).style.border="1px solid #CCC";
		return false;
	}
}
//================================ Final Valida Concorda =========================================


//================================ Checa Radio =========================================

function check_radio(obj, plano, redirect){
	var erro=0;
	for(var i=0; i<obj.length; i++){
		if (obj[i].value==plano){
			erro=1;
			obj[i].checked="checked";
			break;
		}
	}
	
	if(redirect.length>0){
		
		if (erro==0){
			window.location=redirect;
		}
	}
}

//================================ Final Checa Radio ====================================


//================================ Radio Vazio =========================================
function radio_vazio(obj){
	var check=0;
	for(var i=0; i<obj.length; i++){
		if (obj[i].checked==true){
			check=1;
			break;
		}
	}
	
	if (check==0){
		return false;
	} else {
		return true;
	}
}
//================================ Final Radio Vazio =========================================


//================================ Valor do Radio Selecionado =========================================
function valor_radio_selecionado(obj){
	for(var i=0; i<obj.length; i++){
		if (obj[i].checked==true){
			return obj[i].value;
			break;
		}
	}
}
//================================ Final Valo do Radio Selecionado =========================================


//================================ Desmarca Radios =========================================
function limpa_radios(obj){
	for(var i=0; i<obj.length; i++){
		obj[i].checked=false;
	}
}
//================================ Desmarca Radios =========================================



//================================ Conta Caracteres ====================================

function conta_caracteres(obj){
	var sugestao = obj.value;
	var caracteres = 200-sugestao.length;
	document.getElementById('caracteres').innerHTML =caracteres+" Caracteres";
	if(caracteres<0){
		document.getElementById('caracteres').style.color="#900";
	} else {
		document.getElementById('caracteres').style.color="#333";
	}
}

//================================ Final Conta Caracteres ====================================


//================================ Valida Enquete =====================================

function valida_enquete(obj){
	var erro = 0;
	var desc_erro = new Array();
	if (radio_vazio(obj.enquete)==false){
		desc_erro[erro]="Escolha uma opção entre Ótimo à Péssimo!";
		erro = erro + 1;
	}
	
	if (erro>0){ 	
		document.getElementById('erros_enquete').innerHTML="";
		var p = new Array();
		var total_erros = desc_erro.length;
		for (var i=0; i<total_erros; i++){
			p[i] = document.createElement('p');
			p[i].appendChild(document.createTextNode(desc_erro[i]));
			document.getElementById('erros_enquete').appendChild(p[i]);
		}
		var a = document.createElement('a');
		var center = document.createElement('center');
		a.appendChild(document.createTextNode("Fechar"));
		a.setAttribute('href','javascript://');
		a.onclick = function (){
			none_obj('erros_enquete');
		}
		center.appendChild(a);
		document.getElementById('erros_enquete').appendChild(center);
		if (animacao==0){
			document.getElementById('erros_enquete').style.border="1px solid #900";
			document.getElementById('erros_enquete').style.backgroundColor="#C05656";
			anima_erros2('erros_enquete');
		}
		return false;
	} else {
		document.getElementById('erros_enquete').style.border="1px solid #063";
		document.getElementById('erros_enquete').style.backgroundColor="#2DB530";
		ajax=ajaxInit();
		ajax.open('GET','valida_enquete.php?radio='+valor_radio_selecionado(obj.enquete)+'&sugestao='+obj.sugestao.value,true);
		ajax.onreadystatechange=function(){		
			if(ajax.readyState == 1){
				loading('erros_enquete');
			}
			if(ajax.readyState == 4){
				if(ajax.status == 200){					
					document.getElementById('erros_enquete').innerHTML=ajax.responseText;
					anima_erros2('erros_enquete');
				}
			}
		}
		ajax.send(null);
		limpa_radios(obj);
		obj.sugestao.value="";
	}
	return false;
}
//================================ Final Valida Enquete ===========================================


//================================ Mostra Resultado da Enquete =====================================

function resultado_enquete(){
	ajax=ajaxInit();
	ajax.open('GET','resultado-enquete.php',true);
	ajax.onreadystatechange=function(){		
		if(ajax.readyState == 1){
			loading('resultado');
		}
		if(ajax.readyState == 4){
			if(ajax.status == 200){					
				document.getElementById('resultado').innerHTML=ajax.responseText;
				anima_erros2('resultado');
			}
		}
	}
	ajax.send(null);
}

//================================ Final Mostra Resultado da Enquete =====================================

//=============================== Segundos ============================================

function segundos(){
	var segundos = document.getElementById('segundos');
	var a=7;
	var intevalo = setInterval(function (){
		if(a>=0){
			segundos.innerHTML=a+" Segundos";
			a=a-1;
		} else {
			document.formpagseguro.submit();
		}
	}, 1000);
}

//=============================== Final Segundos ============================================