﻿//
//**********************************************************************************************//
//								Livraria Javascript - módulo site								//
//											versão 1.1											//
//																								//
//	Este código pertence á seu desenvolvedor e está protegido por direitos autorais previstos	//
//	na Lei de Software pela constituição Brasileira. Sua cópia, venda utilização sem autoriza-	//
// 				ção é CRIME. Seja legal, produza seu software. Diga não à pirataria.			//
//																								//
//										Desenvolvedores											//
//								José Eduardo Perotta de Almeida									//
//								  eduardo@web2solutions.com.br									//
//									Alvaro Luiz dos Santos										//
//								  alvaro@web2solutions.com.br									//
//																								//
//								  web2 Soluções para internet									//
//								    www.web2solutions.com.br									//
//																								//
//								 última atualização: 15/01/2010									//
//								atualizado por: Eduardo Almeida									//
//**********************************************************************************************//
//
// Variáveis Globais
var timerfechamento=0;
var idqp=1;
var stridqp='';
// Funções
function pega(elemento)
{
	return document.getElementById(elemento);
};
function manipulaelemento(objetotela, acao)
{
	var objetotela = pega(objetotela);
	if (acao == "o"){$(objetotela).fadeOut("slow");}
	if (acao == "e"){$(objetotela).fadeIn("slow");}
	if (acao == "l"){$(objetotela).val("");} 
};
var xmlhttp = inciaAjax();
function inciaAjax()
{
	if (window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	} else if (window.ActiveXObject)
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
};
function clsinput(id){
	pega(id).value='';
};
function populainput(id,oque){
	if(pega(id).value=='')
	{
		pega(id).value=oque;	
	}
};
function mostrasubmenu(id){
	if(timerfechamento)
	{	
		window.clearTimeout(timerfechamento);
		timerfechamento = null;
	}
	pega(id).style.display='block';
};
function ocultasubmenu(id){
	timerfechamento = window.setTimeout(function()
		{
			pega(id).style.display='none';
		}, 5000);
};
function reloadpagina()
{
	document.location=location.href;
};
function navega(pagina)
{
	document.location=pagina;
};
function buscar(){
	document.location='busca.asp';
};
function limparvisualizados(idvisualizado)
{
	if (confirm('Deseja realmente excluir o imóvel da lista de vizualizados?')){
		xmlhttp.open("GET", "scripts/processalimparvisualizados.asp?id=" + idvisualizado + "", true);
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState==4)
			{
				window.alert('Imóvel excluído da lista de vizualizados com sucesso!');
				setTimeout("reloadpagina()", 1000);
			}
		};
		xmlhttp.send(null);
	}
};
function limpartodosvisualizados()
{
	if (confirm('Deseja realmente excluir todos os imóveis da lista de vizualizados?')){
		xmlhttp.open("GET", "scripts/processalimpartodosvisualizados.asp", true);
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState==4)
			{
				window.alert('A lista de imóveis vizualizados foi limpa com sucesso!');
				setTimeout("reloadpagina()", 1000);
			}
		};	
		xmlhttp.send(null);
	}
};
function marcavoto(qualvoto)
{
	pega('opcaoh').value=qualvoto;
};
function votar(){
	if (confirm('Deseja realmente votar nesta opção?'))
	{
		var opcao = pega('opcaoh').value;
		var idenqueteh = pega('idenqueteh').value;
		pega('qenquetemeio').innerHTML = '<br><br><br><img src=assets/ajax-loader.gif style=margin-left:70px; /><br><br><br><br>';
		window.setTimeout(function()
			{
				xmlhttp.open("GET", "scripts/processavoto.asp?id=" + idenqueteh + "&opcao=" + opcao + "&votar=ok", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						window.alert('Voto computado com sucesso!');
						pega('qenquetemeio').innerHTML = xmlhttp.responseText;
					}
				};
				xmlhttp.send(null);
			}, 1000); /*  milisegundos */
	}
};
function registrarcliente(nome,email,usuario,senha)
{
				xmlhttp.open("GET", "scripts/processaregistrocliente.asp?nome=" + nome + "&email=" + email + "&usuario=" + usuario + "&senha=" + senha + "", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						if (xmlhttp.responseText=='emailemuso')
						{
							window.alert('O e-mail fornecido ja está sendo utilizado!');
							return (false);
						}
						if (xmlhttp.responseText=='usuarioemuso')
						{
							window.alert('O nome de usuário fornecido ja está sendo utilizado!');
							return (false);
						}
						if (xmlhttp.responseText=='sucesso')
						{
							window.alert('Registro efetuado com sucesso!');
							window.location='default.asp';
						}
					}
				};	
				xmlhttp.send(null);
};
function logincliente(usuario,senha){
				xmlhttp.open("GET", "scripts/processalogincliente.asp?usuario=" + usuario + "&senha=" + senha + "", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						if (xmlhttp.responseText=='naologou')
						{
							window.alert('Usuário ou senha incorretos!');
							return (false);
						}
						if (xmlhttp.responseText=='logado')
						{
							window.alert('Login efetuado com sucesso!');
							window.location='default.asp';
						}
					}
				};	
				xmlhttp.send(null);
};
function indicaimovel(idimovel,nome,email,nomepara,emailpara,resposta,container)
{
		window.alert('Aguarde um segundo!');
		var nomede = pega(nome).value;
		var emailde = pega(email).value;
		var nomepara = pega(nomepara).value;
		var emailpara = pega(emailpara).value;
		pega(resposta).innerHTML = '<br><br><br><br><img src=assets/ajax-loader.gif /><br><br>';
		window.setTimeout(function()
			{
				xmlhttp.open("GET", "scripts/processaindicaimovel.asp?id=" + idimovel + "&nome=" + nomede + "&email=" + emailde + "&nomepara=" + nomepara + "&emailpara=" + emailpara + "", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						pega(resposta).innerHTML = xmlhttp.responseText;
						window.setTimeout(function()
									{
										pega(resposta).innerHTML = '<strong>Forneça seu nome, seu e-mail, nome e <br />e-mail do seu amigo(a)</strong><br /><br /><label><input name="'+ nome +'" id="'+ nome +'" class="inputp" type="text" value="seu nome" onclick="clsinput(this.id);" onblur="populainput(this.id,\'seu nome\');" /></label><label><input name="'+ email +'" id="'+ email +'" class="inputp" type="text" value="seu e-mail" onclick="clsinput(this.id);" onblur="populainput(this.id,\'seu e-mail\');" /></label><label><input name="'+ nomepara +'" id="'+ nomepara +'" class="inputp" type="text" value="nome do amigo" onclick="clsinput(this.id);" onblur="populainput(this.id,\'nome do amigo\');" /></label><label><input name="'+ emailpara +'" id="'+ emailpara +'" class="inputp" type="text" value="e-mail do amigo" onclick="clsinput(this.id);" onblur="populainput(this.id,\'e-mail do amigo\');" /></label><br /><img src="imagens/bt_enviar.png" alt="indicar" style="cursor:pointer; margin-top:5px;" onclick="indicaimovel('+ idimovel +',\''+ nome +'\',\''+ email +'\',\''+ nomepara +'\',\''+ emailpara +'\',\''+ resposta +'\',\''+ container +'\');" />';
										window.setTimeout(function()
											{
												manipulaelemento(container,'o');
											}, 3000);
									}, 3000);
					}
				};	
				xmlhttp.send(null);
			}, 1000); /*  milisegundos */
};
function enviarfotos(idimovel,nomef,emailf,resposta,container)
{
		window.alert('Aguarde enquanto enviamos as fotos!');
		var nome = pega(nomef).value;
		var email = pega(emailf).value;
		pega(resposta).innerHTML = '<br><br><br><br><img src=assets/ajax-loader.gif /><br><br>';
		window.setTimeout(function()
			{
				xmlhttp.open("GET", "scripts/processaenviafotos.asp?id=" + idimovel + "&nome=" + nome + "&email=" + email + "", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						pega(resposta).innerHTML = '<br><br><br>Fotos enviadas com sucesso para o e-mail ' + email + '!';
						window.setTimeout(function()
									{
										pega(resposta).innerHTML = '<br /><strong>Forneça seu nome e o endereço de e-mail para receber as fotos do imóvel</strong><br /><br /><label><input name="'+ nomef +'" id="'+ nomef +'" type="text" value="seu nome" class="inputp" onclick="clsinput(this.id);" onblur="populainput(this.id,\'seu nome\');"  /></label><label><input name="'+ emailf +'" id="'+ emailf +'" type="text" value="seu e-mail" class="inputp" onclick="clsinput(this.id);" onblur="populainput(this.id,\'seu e-mail\');" /></label><br /><br /><img src="imagens/bt_enviar.png" alt="indicar" style="cursor:pointer; margin-top:5px;" onclick="enviarfotos('+ idimovel +',\''+ nomef +'\',\''+ emailf +'\',\''+ resposta +'\',\''+ container +'\');" />';
										window.setTimeout(function()
											{
												manipulaelemento(container,'o');
											}, 3000);
									}, 3000);
					}
				};	
				xmlhttp.send(null);
			}, 1000); /*  milisegundos */
};
function solicitarinformacoes(idimovel,nomef,telefonef,resposta,container)
{
		window.alert('Aguarde 1 segundo!');
		var nome = pega(nomef).value;
		var telefone = pega(telefonef).value;
		pega(resposta).innerHTML = '<br><br><br><br><img src=assets/ajax-loader.gif /><br><br>';
		window.setTimeout(function()
			{
				xmlhttp.open("GET", "scripts/processamaisinformacoes.asp?id=" + idimovel + "&nome=" + nome + "&telefone=" + telefone + "", true);
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState==4)
					{
						pega(resposta).innerHTML = xmlhttp.responseText;
						window.setTimeout(function()
								{
									manipulaelemento(container,'o');
								}, 3000);
					}
				};	
				xmlhttp.send(null);
			}, 1000); /*  milisegundos */
};
function processafavoritos(id,acao,elemento)
{
	if (acao == "adiciona")
	{
		if (confirm('Deseja realmente adicionar este imóvel à lista de favoritos?'))
		{
			xmlhttp.open("GET", "scripts/processafavoritos.asp?acao=" + acao + "&id=" + id + "", true);
			xmlhttp.onreadystatechange = function()
			{
				if (xmlhttp.readyState==4)
				{
					//window.alert(xmlhttp.responseText);
					if (xmlhttp.responseText=='adicionado')
					{
						window.alert('Imóvel adicionado à lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/anuncio_favoritoe.png" width="97" height="16" onclick="processafavoritos(\''+ id +'\',\'exclui\',\''+ elemento +'\');" />';
					}
				}
			};	
			xmlhttp.send(null);
		}
	}
	if (acao == "exclui")
	{
		if (confirm('Deseja realmente excluir este imóvel da lista de favoritos?'))
		{
			xmlhttp.open("GET", "scripts/processafavoritos.asp?acao=" + acao + "&id=" + id + "", true);
			xmlhttp.onreadystatechange = function()
			{
				if (xmlhttp.readyState==4)
				{
					//window.alert(xmlhttp.responseText);
					if (xmlhttp.responseText=='excluido')
					{
						window.alert('Imóvel excluído da lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/anuncio_favorito.png" width="97" height="16" onclick="processafavoritos(\''+ id +'\',\'adiciona\',\''+ elemento +'\');" />';

					}
				}
			};	
			xmlhttp.send(null);
		}
	}
};
function processafavoritosimovel(id,acao,elemento)
{
	if (acao == "adiciona")
	{
		if (confirm('Deseja realmente adicionar este imóvel à lista de favoritos?'))
		{
			xmlhttp.open("GET", "scripts/processafavoritos.asp?acao=" + acao + "&id=" + id + "", true);
			xmlhttp.onreadystatechange = function()
			{
				if (xmlhttp.readyState==4)
				{
					if (xmlhttp.responseText=='adicionado')
					{
						window.alert('Imóvel adicionado à lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/bt_delfavoritos.png" width="139" height="40" style="cursor:pointer" onclick="processafavoritosimovel(\''+ id +'\',\'exclui\',\''+ elemento +'\');" />';
					}
				}
			};	
			xmlhttp.send(null);
		}
	}
	if (acao == "exclui")
	{
		if (confirm('Deseja realmente excluir este imóvel da lista de favoritos?'))
		{
			xmlhttp.open("GET", "scripts/processafavoritos.asp?acao=" + acao + "&id=" + id + "", true);
			xmlhttp.onreadystatechange = function()
			{
				if (xmlhttp.readyState==4)
				{
					if (xmlhttp.responseText=='excluido')
					{
						window.alert('Imóvel excluído da lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/bt_addfavoritos.png" width="139" height="40" style="cursor:pointer" onclick="processafavoritosimovel(\''+ id +'\',\'adiciona\',\''+ elemento +'\');" />';

					}
				}
			};	
			xmlhttp.send(null);
		}
	}
};
function transferevalor(valor,alvo){
	pega(alvo).value=valor;
};
function transferevalorbusca(valor,alvo,aID,texto){
	var dd;
	pega(alvo).value=valor;
	if (valor>1)
		{
			dd=' ' + texto + 's';
		}
	else
		{
			dd=' ' + texto;
		}
	if (texto != 'nulo')
	{
		pega(aID).innerHTML=valor + dd;
	}
	else
	{
		pega(aID).innerHTML=valor;
	}
	

};
function enviamensagemcontato()
{
	if (pega('nomecontato').value == "" || pega('emailcontato').value == "" || pega('mensagemcontato').value == "")
	{
		window.alert('Favor informar ao menos seu nome, e-mail e a mensagem que deseja enviar!');
		pega('nomecontato').focus();
		return (false);
	}else xmlhttp.open("GET", "scripts/processacontato.asp?nomecontato=" + pega('nomecontato').value + "&emailcontato=" + pega('emailcontato').value + "&telefonecontato=" + pega('telefonecontato').value + "&mensagemcontato=" + pega('mensagemcontato').value + "", true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState==4)
		{
					if (xmlhttp.responseText=='enviado')
					{
						window.alert('Mensagem processada com sucesso!');
					}
		}
	};	
	xmlhttp.send(null);
};
function buscacodigo(codigo)
{
	if (codigo == "" || codigo == "código")
	{
		window.alert('Favor informar o código do imóvel que deseja encontrar!');
		pega('bcodigo').focus();
		return (false);
	}else xmlhttp.open("GET", "scripts/processabuscac.asp?codigo=" + codigo + "", true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState==4)
		{
			if (xmlhttp.responseText=='inexistente')
			{
				window.alert('Código Inexistente!');
				pega('bcodigo').focus();
				return (false);
			}else
			{
			window.alert('Imóvel encontrado, aguarde!');
			self.location.href='imovel.asp?id=' + xmlhttp.responseText + '';
			}
		}
	};	
	xmlhttp.send(null);
};
function sns(evento){var tecla=(window.event)?event.keyCode:evento.which; if((tecla > 47 && tecla < 58)) return true; else{if (tecla != 8) return false; else return true;}};
function mascara(o,f){
    v_obj=o;
    v_fun=f;
    setTimeout("execmascara()",1)
};
function execmascara(){
    v_obj.value=v_fun(v_obj.value)
};
function soNumeros(v){
    return v.replace(/\D/g,"")
};
function telep(v){
    v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
    v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
    return v
};
function checaemail(id)
{
	if ((pega(id).value).length > 0)
	{
		if (!/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(pega(id).value))
		{
			alert('E-mail incorreto.');
			pega(id).focus();
			return false;
		}

	}
};
function imprimirpagina() {
//	var oPrint, oJan;
//	oPrint = window.document.getElementById(id).innerHTML;
//	oJan = window.open(pg);
//	oJan.document.write(oPrint);
//	oJan.window.print();
//    oJan.document.close();
//    oJan.focus();
	window.print()
};
function loadFoto(id, foto)
{
document.getElementById('fotoimovel').innerHTML='<img src="upld/fotos/'+ id +'/grande/'+ foto +'" width="243" height="288" />'
};
function mostrapublicidade(qualquadrop)
{
	if (qualquadrop == 'pub1')
	{
		manipulaelemento('pub1', 'e');
		manipulaelemento('pub2', 'o');
		manipulaelemento('pub3', 'o');
		manipulaelemento('pub4', 'o');
		manipulaelemento('pub5', 'o');
		manipulaelemento('pub6', 'o');
		pega('menupu1').className = "limenupublicidadesob";
		pega('menupu2').className = "limenupublicidade";
		pega('menupu3').className = "limenupublicidade";
		pega('menupu4').className = "limenupublicidade";
		pega('menupu5').className = "limenupublicidade";
		pega('menupu6').className = "limenupublicidade";

		return;
	}
	if (qualquadrop == 'pub2')
	{
		manipulaelemento('pub1', 'o');
		manipulaelemento('pub2', 'e');
		manipulaelemento('pub3', 'o');
		manipulaelemento('pub4', 'o');
		manipulaelemento('pub5', 'o');
		manipulaelemento('pub6', 'o');
		pega('menupu1').className = "limenupublicidade";
		pega('menupu2').className = "limenupublicidadesob";
		pega('menupu3').className = "limenupublicidade";
		pega('menupu4').className = "limenupublicidade";
		pega('menupu5').className = "limenupublicidade";
		pega('menupu6').className = "limenupublicidade";
		return;
	}
	if (qualquadrop == 'pub3')
	{
		manipulaelemento('pub1', 'o');
		manipulaelemento('pub2', 'o');
		manipulaelemento('pub3', 'e');
		manipulaelemento('pub4', 'o');
		manipulaelemento('pub5', 'o');
		manipulaelemento('pub6', 'o');
		pega('menupu1').className = "limenupublicidade";
		pega('menupu2').className = "limenupublicidade";
		pega('menupu3').className = "limenupublicidadesob";
		pega('menupu4').className = "limenupublicidade";
		pega('menupu5').className = "limenupublicidade";
		pega('menupu6').className = "limenupublicidade";
		return;
	}
	if (qualquadrop == 'pub4')
	{
		manipulaelemento('pub1', 'o');
		manipulaelemento('pub2', 'o');
		manipulaelemento('pub3', 'o');
		manipulaelemento('pub4', 'e');
		manipulaelemento('pub5', 'o');
		manipulaelemento('pub6', 'o');
		pega('menupu1').className = "limenupublicidade";
		pega('menupu2').className = "limenupublicidade";
		pega('menupu3').className = "limenupublicidade";
		pega('menupu4').className = "limenupublicidadesob";
		pega('menupu5').className = "limenupublicidade";
		pega('menupu6').className = "limenupublicidade";
		return;
	}
	if (qualquadrop == 'pub5')
	{
		manipulaelemento('pub1', 'o');
		manipulaelemento('pub2', 'o');
		manipulaelemento('pub3', 'o');
		manipulaelemento('pub4', 'o');
		manipulaelemento('pub5', 'e');
		manipulaelemento('pub6', 'o');
		pega('menupu1').className = "limenupublicidade";
		pega('menupu2').className = "limenupublicidade";
		pega('menupu3').className = "limenupublicidade";
		pega('menupu4').className = "limenupublicidade";
		pega('menupu5').className = "limenupublicidadesob";
		pega('menupu6').className = "limenupublicidade";
		return;
	}
	if (qualquadrop == 'pub6')
	{
		manipulaelemento('pub1', 'o');
		manipulaelemento('pub2', 'o');
		manipulaelemento('pub3', 'o');
		manipulaelemento('pub4', 'o');
		manipulaelemento('pub5', 'o');
		manipulaelemento('pub6', 'e');
		pega('menupu1').className = "limenupublicidade";
		pega('menupu2').className = "limenupublicidade";
		pega('menupu3').className = "limenupublicidade";
		pega('menupu4').className = "limenupublicidade";
		pega('menupu5').className = "limenupublicidade";
		pega('menupu6').className = "limenupublicidadesob";
		return;
	}
};
function mostrapainelimoveis(qualquadrop)
{
	if (qualquadrop == 'painelimoveis1')
	{
		manipulaelemento('painelimoveis1', 'e');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis2')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'e');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis3')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'e');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis4')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'e');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis5')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'e');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis6')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'e');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis7')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'e');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis8')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'e');
		manipulaelemento('painelimoveis9', 'o');
		return;
	}
	if (qualquadrop == 'painelimoveis9')
	{
		manipulaelemento('painelimoveis1', 'o');
		manipulaelemento('painelimoveis2', 'o');
		manipulaelemento('painelimoveis3', 'o');
		manipulaelemento('painelimoveis4', 'o');
		manipulaelemento('painelimoveis5', 'o');
		manipulaelemento('painelimoveis6', 'o');
		manipulaelemento('painelimoveis7', 'o');
		manipulaelemento('painelimoveis8', 'o');
		manipulaelemento('painelimoveis9', 'e');
		return;
	}
};
function mudapublicidade(tintervalo,periodo) {
	var intervalo = window.setInterval(function()
	{
		stridqp='pub' + idqp +'';
		mostrapublicidade(stridqp);
		idqp++;
		if (idqp == 7){idqp=1}
	}, tintervalo*1000);
	window.setTimeout(function() {
	clearInterval(intervalo);
	}, periodo*1000);
};
function mudaaba(qualaba)
{
	// window.alert(qualaba); //
	if (qualaba == 'ai1d')
	{
		manipulaelemento('ai1h', 'e');
		manipulaelemento('ai1d', 'o');
		manipulaelemento('ai2h', 'o');
		manipulaelemento('ai2d', 'e');
		manipulaelemento('ai3h', 'o');
		manipulaelemento('ai3d', 'e');
		manipulaelemento('ai4h', 'o');
		manipulaelemento('ai4d', 'e');
//		manipulaelemento('ai5h', 'o');
//		manipulaelemento('ai5d', 'e');
//		manipulaelemento('ai6h', 'o');
//		manipulaelemento('ai6d', 'e');
		
		manipulaelemento('mi1', 'e');
		manipulaelemento('mi2', 'o');
		manipulaelemento('mi3', 'o');
		manipulaelemento('mi4', 'o');
		manipulaelemento('mi5', 'o');
		manipulaelemento('mi6', 'o');

		return;
	}
	if (qualaba == 'ai2d')
	{
		/* manipulaelemento('ai1h', 'o');*/
		/* manipulaelemento('ai1d', 'e');*/
		manipulaelemento('ai2h', 'e');
		manipulaelemento('ai2d', 'o');
		manipulaelemento('ai3h', 'o');
		manipulaelemento('ai3d', 'e');
		manipulaelemento('ai4h', 'o');
		manipulaelemento('ai4d', 'e');
//		manipulaelemento('ai5h', 'o');
//		manipulaelemento('ai5d', 'e');
//		manipulaelemento('ai6h', 'o');
//		manipulaelemento('ai6d', 'e');
		
		manipulaelemento('mi1', 'o');
		manipulaelemento('mi2', 'e');
		manipulaelemento('mi3', 'o');
		manipulaelemento('mi4', 'o');
		manipulaelemento('mi5', 'o');
		manipulaelemento('mi6', 'o');

		return;
	}
	if (qualaba == 'ai3d')
	{
		/* manipulaelemento('ai1h', 'o');*/
		/* manipulaelemento('ai1d', 'e');*/
		manipulaelemento('ai2h', 'o');
		manipulaelemento('ai2d', 'e');
		manipulaelemento('ai3h', 'e');
		manipulaelemento('ai3d', 'o');
		manipulaelemento('ai4h', 'o');
		manipulaelemento('ai4d', 'e');
//		manipulaelemento('ai5h', 'o');
//		manipulaelemento('ai5d', 'e');
//		manipulaelemento('ai6h', 'o');
//		manipulaelemento('ai6d', 'e');
		
		manipulaelemento('mi1', 'o');
		manipulaelemento('mi2', 'o');
		manipulaelemento('mi3', 'e');
		manipulaelemento('mi4', 'o');
		manipulaelemento('mi5', 'o');
		manipulaelemento('mi6', 'o');

		return;
	}
	if (qualaba == 'ai4d')
	{
		/* manipulaelemento('ai1h', 'o');*/
		/* manipulaelemento('ai1d', 'e');*/
		manipulaelemento('ai2h', 'o');
		manipulaelemento('ai2d', 'e');
		manipulaelemento('ai3h', 'o');
		manipulaelemento('ai3d', 'e');
		manipulaelemento('ai4h', 'e');
		manipulaelemento('ai4d', 'o');
//		manipulaelemento('ai5h', 'o');
//		manipulaelemento('ai5d', 'e');
//		manipulaelemento('ai6h', 'o');
//		manipulaelemento('ai6d', 'e');
		
		manipulaelemento('mi1', 'o');
		manipulaelemento('mi2', 'o');
		manipulaelemento('mi3', 'o');
		manipulaelemento('mi4', 'e');
		manipulaelemento('mi5', 'o');
		manipulaelemento('mi6', 'o');

		return;
	}
	if (qualaba == 'ai5d')
	{
		/* manipulaelemento('ai1h', 'o');*/
		/* manipulaelemento('ai1d', 'e');*/
		manipulaelemento('ai2h', 'o');
		manipulaelemento('ai2d', 'e');
		manipulaelemento('ai3h', 'o');
		manipulaelemento('ai3d', 'e');
		manipulaelemento('ai4h', 'o');
		manipulaelemento('ai4d', 'e');
		manipulaelemento('ai5h', 'e');
		manipulaelemento('ai5d', 'o');
		manipulaelemento('ai6h', 'o');
		manipulaelemento('ai6d', 'e');
		
		manipulaelemento('mi1', 'o');
		manipulaelemento('mi2', 'o');
		manipulaelemento('mi3', 'o');
		manipulaelemento('mi4', 'o');
		manipulaelemento('mi5', 'e');
		manipulaelemento('mi6', 'o');

		return;
	}
	if (qualaba == 'ai6d')
	{
		/* manipulaelemento('ai1h', 'o');*/
		/* manipulaelemento('ai1d', 'e');*/
		manipulaelemento('ai2h', 'o');
		manipulaelemento('ai2d', 'e');
		manipulaelemento('ai3h', 'o');
		manipulaelemento('ai3d', 'e');
		manipulaelemento('ai4h', 'o');
		manipulaelemento('ai4d', 'e');
		manipulaelemento('ai5h', 'o');
		manipulaelemento('ai5d', 'e');
		manipulaelemento('ai6h', 'e');
		manipulaelemento('ai6d', 'o');
		
		manipulaelemento('mi1', 'o');
		manipulaelemento('mi2', 'o');
		manipulaelemento('mi3', 'o');
		manipulaelemento('mi4', 'o');
		manipulaelemento('mi5', 'o');
		manipulaelemento('mi6', 'e');

		return;
	}

};
function mudaababusca(idstraba)
{
	// window.alert(idstraba); //
	if (idstraba == 'aqb1d')
	{
		manipulaelemento('aqb1h', 'e');
		manipulaelemento('aqb1d', 'o');
		manipulaelemento('aqb3h', 'o');
		manipulaelemento('aqb3d', 'e');
		manipulaelemento('mqb1', 'e');
		manipulaelemento('mqb3', 'o');
		
		return;
	}
	if (idstraba == 'aqb2d')
	{
		manipulaelemento('aqb1h', 'o');
		manipulaelemento('aqb1d', 'e');
		manipulaelemento('aqb2h', 'e');
		manipulaelemento('aqb2d', 'o');
		manipulaelemento('aqb3h', 'o');
		manipulaelemento('aqb3d', 'e');
		manipulaelemento('mqb1', 'o');
		manipulaelemento('mqb2', 'e');
		manipulaelemento('mqb3', 'o');
		
		return;
	}
	if (idstraba == 'aqb3d')
	{
		manipulaelemento('aqb1h', 'o');
		manipulaelemento('aqb1d', 'e');
		manipulaelemento('aqb3h', 'e');
		manipulaelemento('aqb3d', 'o');
		manipulaelemento('mqb1', 'o');
		manipulaelemento('mqb3', 'e');
		
		return;
	}
};
function mudabulleto(id){
	pega('canuncio'+id).style.display='none';
	pega('bullet'+id).innerHTML='<img src="imagens/bulletd.jpg" width="20" height="21" onclick="mudabullete(' + id + ');"  alt="exibir anúncio ' + id + '" title="exibir anúncio ' + id + '"/>';
};
function mudabullete(id){
	pega('canuncio'+id).style.display='block';
	pega('bullet'+id).innerHTML='<img src="imagens/bulleth.jpg" width="20" height="21" onclick="mudabulleto(' + id + ');" alt="ocultar anúncio ' + id + '" title="ocultar anúncio ' + id + '" />';
};
function inputfocus(inputid)
{
	var inputid=pega(inputid);
	inputid.style.background='#af1620';
	inputid.style.color='#e9e8e8';
};
function inputblur(inputid)
{
	var inputid=pega(inputid);
	inputid.style.background='#f4f4f4';
	inputid.style.color='#333';
};
function FormataReal(nvalor){
nvalor = nvalor.replace(".","");
nvalor = nvalor.replace(",",".");
return nvalor;
};
function FormataRealn(nvalor){
nvalor = nvalor.replace(".",",");
nvalor = nvalor.replace(",",".");
return nvalor;
};
function FormataValor(objeto,teclapres,tammax,decimais) 
{
	var tecla			= teclapres.keyCode;
	var tamanhoObjeto	= objeto.value.length;
	if ((tecla == 8) && (tamanhoObjeto == tammax))
	{
		tamanhoObjeto = tamanhoObjeto - 1 ;
	}
    if (( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) && ((tamanhoObjeto+1) <= tammax))
	{
		vr	= objeto.value;
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( ",", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		tam	= vr.length;
		if (tam < tammax && tecla != 8)
		{
			tam = vr.length + 1 ;
		}
		if ((tecla == 8) && (tam > 1))
		{
			tam = tam - 1 ;
			vr = objeto.value;
			vr = vr.replace( "/", "" );
			vr = vr.replace( "/", "" );
			vr = vr.replace( ",", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
		}
		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
		{
			if (decimais > 0)
			{
				if ( (tam <= decimais) )
				{ 
					objeto.value = ("0," + vr) ;
				}
				if( (tam == (decimais + 1)) && (tecla == 8))
				{
					objeto.value = vr.substr( 0, (tam - decimais)) + ',' + vr.substr( tam - (decimais), tam ) ;	
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) == "0"))
				{
					objeto.value = vr.substr( 1, (tam - (decimais+1))) + ',' + vr.substr( tam - (decimais), tam ) ;
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) != "0"))
				{
				    objeto.value = vr.substr( 0, tam - decimais ) + ',' + vr.substr( tam - decimais, tam ) ; 
				}
				if ( (tam >= (decimais + 4)) && (tam <= (decimais + 6)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 3) ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			 	if ( (tam >= (decimais + 7)) && (tam <= (decimais + 9)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 6) ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 10)) && (tam <= (decimais + 12)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 9) ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 13)) && (tam <= (decimais + 15)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 12) ) + '.' + vr.substr( tam - (decimais + 12), 3 ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			}
			else if(decimais == 0)
			{
				if ( tam <= 3 )
				{ 
			 		objeto.value = vr ;
				}
				if ( (tam >= 4) && (tam <= 6) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr(0, tam - 3) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 7) && (tam <= 9) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 6 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 10) && (tam <= 12) )
				{
			 		if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}

				if ( (tam >= 13) && (tam <= 15) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ) ;
				}			
			}
		}
	}
	else if((window.event.keyCode != 8) && (window.event.keyCode != 9) && (window.event.keyCode != 13) && (window.event.keyCode != 35) && (window.event.keyCode != 36) && (window.event.keyCode != 46))
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
}
function pausescroller(content, divId, divClass, delay)
{
	this.content=content;
	this.tickerid=divId; 
	this.delay=delay; 
	this.mouseoverBol=0; 
	this.hiddendivpointer=1;
	document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>');
	var scrollerinstance=this;
	if (window.addEventListener)
	{
		window.addEventListener("load", function()
		{
			scrollerinstance.initialize()
		}, false)
	}
	else if (window.attachEvent)
	{
		window.attachEvent("onload", function(){scrollerinstance.initialize()})
	}
	else if (document.getElementById)
	{
		setTimeout(function()
		{
			scrollerinstance.initialize()
		}, 500)
	}
};
pausescroller.prototype.initialize=function()
{
	this.tickerdiv=document.getElementById(this.tickerid);
	this.visiblediv=document.getElementById(this.tickerid+"1");
	this.hiddendiv=document.getElementById(this.tickerid+"2");
	this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv));
	this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px";
	this.getinline(this.visiblediv, this.hiddendiv);
	this.hiddendiv.style.visibility="visible";
	var scrollerinstance=this;
	document.getElementById(this.tickerid).onmouseover=function()
	{
		scrollerinstance.mouseoverBol=1
	};
	document.getElementById(this.tickerid).onmouseout=function()
	{
		scrollerinstance.mouseoverBol=0
	};
	if (window.attachEvent)
	{
		window.attachEvent("onunload", function()
		{
				scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null
		})
		setTimeout(function()
		{
			scrollerinstance.animateup()
		}, this.delay)
	}
};
pausescroller.prototype.animateup=function()
{
	var scrollerinstance=this;
	if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5))
	{
		this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px";
		this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px";
		setTimeout(function()
		{
			scrollerinstance.animateup()
		}, 50)
	}
	else
	{
		this.getinline(this.hiddendiv, this.visiblediv);
		this.swapdivs();
		setTimeout(function()
		{
			scrollerinstance.setmessage()
		}, this.delay)
	}
};
pausescroller.prototype.swapdivs=function()
{
	var tempcontainer=this.visiblediv;
	this.visiblediv=this.hiddendiv;
	this.hiddendiv=tempcontainer
};
pausescroller.prototype.getinline=function(div1, div2)
{
	div1.style.top=this.visibledivtop+"px";
	div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
};
pausescroller.prototype.setmessage=function()
{
	var scrollerinstance=this;
	if (this.mouseoverBol==1)
	setTimeout(function()
	{
		scrollerinstance.setmessage()
	}, 100)
	else
	{
	var i=this.hiddendivpointer;
	var ceiling=this.content.length;
	this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1;
	this.hiddendiv.innerHTML=this.content[this.hiddendivpointer];
	this.animateup()
	}
};
pausescroller.getCSSpadding=function(tickerobj)
{
	if (tickerobj.currentStyle)
	return tickerobj.currentStyle["paddingTop"];
	else if (window.getComputedStyle)
	return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top");
	else
	return 0
};
var navegador = navigator.userAgent.toLowerCase();
var xmlhttp2;
function objetoXML() {
    if (navegador.indexOf('msie') != -1) { //Internet Explorer
        var controle = (navegador.indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; 
        try {
            xmlhttp2 = new ActiveXObject(controle);
        } catch (e) { }
    } else {
        xmlhttp2 = new XMLHttpRequest(); //Inicia o objeto no Firefox, Safari, Mozilla
    }
};
function enviarForm(url, campos, destino) {
    var elemento = pega(destino);
    objetoXML();
	manipulaelemento('popmensagem','e');
    if (!xmlhttp2) {
		elemento.innerHTML = 'Impossível iniciar o objeto XMLHttpRequest.';
		window.setTimeout(function()
			{
				manipulaelemento('popmensagem','o');
			}, 3000);
        return;
    } else {
		elemento.innerHTML = 'Carregando...';
    }
    xmlhttp2.onreadystatechange = function () {
        //Se a requisição estiver completada
        if (xmlhttp2.readyState == 4 || xmlhttp2.readyState == 0) {
            //Se o status da requisição estiver OK
            if (xmlhttp2.status == 200) {
                elemento.innerHTML = xmlhttp2.responseText;
				window.setTimeout(function()
					{
						manipulaelemento('nomecontato','l');
					}, 1000);
				window.setTimeout(function()
					{
						manipulaelemento('emailcontato','l');
					}, 2000);
				window.setTimeout(function()
					{
						manipulaelemento('telefonecontato','l');
					}, 3000);
				window.setTimeout(function()
					{
						manipulaelemento('mensagemcontato','l');
					}, 4000);
				window.setTimeout(function()
					{
						manipulaelemento('popmensagem','o');
					}, 5000);
            } else {
                elemento.innerHMTL = 'Página não encontrada!';
				window.setTimeout(function()
					{
						manipulaelemento('popmensagem','o');
					}, 3000);
            }
        }
    }
    xmlhttp2.open('POST', url+'?'+campos, true);
    xmlhttp2.send(campos);
};
function enviarcontato(){
	setarCampos();enviarForm('scripts/processacontato.asp', campos, 'mensagem', 'popmensagem'); return false;
};
var pagetitle = document.title;
var scriptlocation = "/analisedetrafego/track.asp";

var pagedata = 'mtpt=' + escape(pagetitle) + '&mtr=' + escape(document.referrer) + '&mtt=2&mts=' + window.screen.width + 'x' + window.screen.height + '&mti=1&mtz=' + Math.random();
document.write ('<img height=1 width=1 ');
document.write ('src="' + scriptlocation + '?' + pagedata + '">');