﻿//
//**********************************************************************************************//
//								Livraria Javascript - módulo site								//
//											versão 1.0											//
//																								//
//	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: 07/12/2009									//
//								atualizado por: Eduardo Almeida									//
//**********************************************************************************************//
//
function pega(elemento)
{
	return document.getElementById(elemento);
};
var xmlhttp = inciaAjax();
function inciaAjax()
{
	if (window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	} else if (window.ActiveXObject)
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
};
function reloadpagina()
{
	document.location='default.asp';
};
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:90px; /><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 abrepopup(bloco)
{
	pega(bloco).style.display='block';
//	switch(bloco)
//	{
//		case 'popupmaisinfo':
//			pega(bloco).innerHTML = '<iframe src="Scripts/cases.asp?sessao=maisinformacoes" width="100%" height="100%" frameborder="0"></iframe>';
//			break;
//		case 'popupindicaimovel':
//			pega(bloco).innerHTML = '<iframe src="Scripts/cases.asp?sessao=indicarimovel" width="100%" height="100%" frameborder="0"></iframe>';
//			break;
//		case 'popupenviafotos':
//			pega(bloco).innerHTML = '<iframe src="Scripts/cases.asp?sessao=enviarfotos" width="100%" height="100%" frameborder="0"></iframe>';
//			break;
//	}
};
function fechapopup(bloco)
{
	pega(bloco).style.display='none';
};
function indicaimovel(id)
{
		window.alert('Aguarde um segundo!');
		var nomede = pega('nomede').value;
		var emailde = pega('emailde').value;
		var nomepara = pega('nomepara').value;
		var emailpara = pega('emailpara').value;
		pega('mindicaimovel').innerHTML = '<br><br><img src=assets/ajax-loader.gif style=margin-left:90px; /><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)
					{
						window.alert('Fotos enviadas com sucesso para o e-mail ' + email + '!');
						pega('mindicaimovel').innerHTML = 'Fotos enviadas com sucesso para o e-mail ' + email + '!';
					}
				};	
				xmlhttp.send(null);
			}, 1000); /*  milisegundos */
};
function enviarfotos(idimovel)
{
		window.alert('Aguarde enquanto enviamos as fotos!');
		var nome = pega('nomef').value;
		var email = pega('emailf').value;
		pega('menviarfotos').innerHTML = '<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)
					{
						window.alert('Fotos enviadas com sucesso para o e-mail ' + email + '!');
						pega('menviarfotos').innerHTML = 'Fotos enviadas com sucesso para o e-mail ' + email + '!';
					}
				};	
				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)
				{
					if (xmlhttp.responseText=='adicionado')
					{
						window.alert('Imóvel adicionado à lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/pfavoritos.jpg" alt="" width="21" height="21" 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)
				{
					if (xmlhttp.responseText=='excluido')
					{
						window.alert('Imóvel excluído da lista de favoritos!');
						pega(elemento).innerHTML='<img src="imagens/pfavoritos.jpg" alt="" width="21" height="21" 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 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 == "")
	{
		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 printDiv(id, pg) {
	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();
};
function loadFoto(id, foto)
{
document.getElementById('fotoinicial').innerHTML='<a href="upld/fotos/'+ id +'/grande/'+ foto +'" class="highslide" onclick="return hs.expand(this)"><img src="upld/fotos/'+ id +'/grande/'+ foto +'" width="283" height="212" vspace="1" class="dfoto" style="background:#FFF;padding:4px;"></a>'
};
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;
	}
};
var idqp=1;
var stridqp='';
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 manipulaelemento(objetotela, acao)
{
	var objetotela = pega(objetotela);
	if (acao == "o"){objetotela.style.display = "none";}
	if (acao == "e"){objetotela.style.display = "block";}
	if (acao == "l"){objetotela.value = "";} 
};
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
};