/* * As variáveis abaixo devem sempre estar declaradas no javascript do site em desenvolvimento, pois são esperadas pelos serviços Spaic */ // Série usada nos imóveis gcSpaSrImv = "2000103060"; // Série usada para inquilinos e proprietários gcSpaSrInqPro = "2010123072"; // Nome do container principal da página (aquele que contém todo o conteúdo) gcSpaIDCtnBase = "base"; // Nome do container onde os resultados das pesquisas serão exibidos gcSpaIDCtn = "cnt_dtq"; // Código executado ao clicar no botão pesquisar da pesquisa lateral gcSpaImvExPesqLat = "execPesq()"; // Código executado ao fechar a pesquisa lateral gcSpaImvFePesqLat = "fechaPesq()"; // Usuário e senha do proprietário gcSpaProUsu = ""; gcSpaProSen = ""; // Usuário e senha do inquilino gcSpaInqUsu = ""; gcSpaInqSen = ""; // Div com conteúdo dinâmico (exibe o conteúdo das opções selecionadas, exceto resultados de pesquisas) gcIDCtn = "conteudo"; // Div que contém a div com o resultado das pesquisas gcIDPesq = "res_pesq"; function carregaPagina() { doBanner(); doDestaques(); doPesqLat(); } function criaAjax() { var xmlhttp; try { xmlhttp = new XMLHttpRequest(); } catch (ie1) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (ie2) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false; } } } return xmlhttp; } function doBanner() { oAjax = criaAjax(); if (oAjax) { // Aqui podemos passar o parâmetro tc caso o cliente use só um dos tipos (Venda ou Locação) cURL = "spa_query.php?tp=1&sr=" + gcSpaSrImv; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oJsonDtq = eval("(" + oAjax.responseText + ")"); // Destaque aleatório nIndex = -1; nMaxTam = oJsonDtq.destaques.length; lAchei = false; while (nMaxTam > 0 && !lAchei) { nIndex = Math.floor(Math.random() * nMaxTam); lAchei = (nIndex < nMaxTam); } oBanner = document.getElementById("banner"); oBanner.style.background = 'url(http://www.spaicnet.com.br/clientes/servicosnet/imoveis/imagens.php?id=' + oJsonDtq.destaques[nIndex].codigo + '&tc=' + oJsonDtq.destaques[nIndex].tipc + '&num=0&lg=960&at=350&sr=' + gcSpaSrImv + '&fr=1)'; oBanner.style.backgroundPosition = "0% 70%"; oBanner.innerHTML = '
' + '


' + spaCorrigeEntidades(oJsonDtq.destaques[nIndex].tipo.toUpperCase() + ' - ' + oJsonDtq.destaques[nIndex].bairro.toUpperCase()) + '

' + '


' + spaCorrigeEntidades(oJsonDtq.destaques[nIndex].tipo.toUpperCase() + ' - ' + oJsonDtq.destaques[nIndex].bairro.toUpperCase()) + '

' + '

' + '



' + oJsonDtq.destaques[nIndex].descr + '
' + '' + (oJsonDtq.destaques[nIndex].tipc == "V" ? 'Venda' : 'Aluguel') + ': R$ ' + oJsonDtq.destaques[nIndex].preco + '

' + '

' + '



' + oJsonDtq.destaques[nIndex].descr + '
' + '' + (oJsonDtq.destaques[nIndex].tipc == "V" ? 'Venda' : 'Aluguel') + ': R$ ' + oJsonDtq.destaques[nIndex].preco + '

' + '








' + '+detalhes' + '
' + '
' + '
' + '
' + '' + spaCorrigeEntidades(oJsonDtq.destaques[nIndex].inf_adic.toUpperCase()) + '' + '
' + '
' + '
' + '
' + '
'; } } } } function doDestaques() { oConteudo = document.getElementById(gcIDCtn); oConteudo.innerHTML = '
' + '

Destaques - Aluguel

' + '
' + '
' + '' + '
' + '

' + '
' + '

Destaques - Venda

' + '
' + '
' + '' + '
' + '
'; } function doPesqLat() { oAjax = criaAjax(); if (oAjax) { // Aqui podemos passar o parâmetro tc caso o cliente use só um dos tipos (Venda ou Locação) cURL = "spa_query.php?tp=2<=1&sr=" + gcSpaSrImv + "&depup=1"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById("pesquisaCorpo"); oDiv.innerHTML = oAjax.responseText; } } } } function execPesq() { oConteudo = document.getElementById(gcIDCtn); oConteudo.style.display = "none"; oResPesq = document.getElementById(gcIDPesq); oResPesq.style.display = "block"; oTopo = document.getElementById("topoFolhaPsq"); oTopo.innerHTML = '

Pesquisa de Imóveis

'; } function fechaPesq() { document.getElementById(gcIDCtn).style.display = "block"; document.getElementById(gcIDPesq).style.display = "none"; } function doNav(nOpc) { oBanner = document.getElementById("banner"); if (nOpc > 2) { oBanner.style.display = "none"; } else { oBanner.style.display = "block"; } // Fechar o menu de serviços após clicar nele document.getElementById("menuServ").style.display = "none"; // Sempre reexibir a div "conteudo" e esconder a div dos resultados de pesquisas document.getElementById(gcIDCtn).style.display = "block"; document.getElementById(gcIDPesq).style.display = "none"; if (nOpc == 1) { doDestLoc(); } else if (nOpc == 2) { doDestVen(); } else if (nOpc == 3) { doCadImov(); } else if (nOpc == 4) { doQuemSomos(); } else if (nOpc == 5) { doLocalizacao(); } else if (nOpc == 6) { doFale(); } else if (nOpc == 7) { doPesqAv(); } else if (nOpc == 8) { doProprietarios(); } else if (nOpc == 9) { doInquilinos(); } } function doDestLoc() { oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp=1&sr=" + gcSpaSrImv + "&cdsc=100"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oJson = eval("(" + oAjax.responseText + ")"); cDtq = '
' + '

Destaques - Aluguel

' + '
' + '
'; nItD = 0; for (nI = 0; nI < oJson.destaques.length; nI++) { if (oJson.destaques[nI].tipc != "L") { continue; } nItD ++; /* cDtq += '' + '
' + '' + '' + '' + '' + '' + '' + '' + '
' + '' + '' + '

' + spaCorrigeEntidades(oJson.destaques[nI].tipo.toUpperCase() + ' - ' + oJson.destaques[nI].bairro.toUpperCase()) + '

' + oJson.destaques[nI].descr + '
' + 'Aluguel: R$ ' + oJson.destaques[nI].preco + '
' + '
' + '
' + '
'; */ cDtq += '' + '
' + '
' + '' + '
' + '
' + '

' + spaCorrigeEntidades(oJson.destaques[nI].tipo.toUpperCase() + ' - ' + oJson.destaques[nI].bairro.toUpperCase()) + '

' + oJson.destaques[nI].descr + '
' + 'Aluguel: R$ ' + oJson.destaques[nI].preco + '
' + '
' + '
' + '
'; } cDtq += '
' + '
'; oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = cDtq; } } } } function doDestVen() { oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp=1&sr=" + gcSpaSrImv + "&cdsc=100"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oJson = eval("(" + oAjax.responseText + ")"); cDtq = '
' + '

Destaques - Venda

' + '
' + '
'; nItD = 0; for (nI = 0; nI < oJson.destaques.length; nI++) { if (oJson.destaques[nI].tipc != "V") { continue; } nItD ++; /* cDtq += '' + '
' + '' + '' + '' + '' + '' + '' + '' + '
' + '' + '' + '

' + spaCorrigeEntidades(oJson.destaques[nI].tipo.toUpperCase() + ' - ' + oJson.destaques[nI].bairro.toUpperCase()) + '

' + oJson.destaques[nI].descr + '
' + 'Aluguel: R$ ' + oJson.destaques[nI].preco + '
' + '
' + '
' + '
'; */ cDtq += '' + '
' + '
' + '' + '
' + '
' + '

' + spaCorrigeEntidades(oJson.destaques[nI].tipo.toUpperCase() + ' - ' + oJson.destaques[nI].bairro.toUpperCase()) + '

' + oJson.destaques[nI].descr + '
' + 'Venda: R$ ' + oJson.destaques[nI].preco + '
' + '
' + '
' + '
'; } cDtq += '
' + '
'; oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = cDtq; } } } } function exibeDetImv(cTipC, nCod) { spaImvExibeDetalhe(nCod, null, cTipC, gcSpaSrImv, true); } function doCadImov() { oAjax = criaAjax(); if (oAjax) { cURL = "cadastre.php"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = oAjax.responseText; document.getElementById("nome").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("nome").focus(); } } } } } function trocaTipoCadastro(){ var subtipo_0= new Array("-"); var subtipo_1=new Array("Assobradada","Casa","Chalé","Edicula","Mansão","Puxadinho","Sobrado"); // var subtipo_2=new Array("Apartamento","Cobertura","Duplex","Flat","Loft","Kitnet"); var subtipo_3=new Array("Área","Lote","Terreno"); var subtipo_4=new Array("Casa de Campo","Chácara","Fazenda","Haras","Sítio","Vivenda"); var subtipo_5=new Array("Armazém","Bar","Box","Clínica","Consultório","Escola","Escritório","Hospital","Hotel","Indústria","Lanchonete","Lava Rápido","Loja","Mercado","Motel","Padaria","Posto de Gasolina","Pousada","Quiosque","Restaurante") var subtipo_6=new Array("Andar Inteiro","Conjunto Comercial","Depósito","Galpão","Loja","Meio Andar","Prédio","Sala","Salão"); //tomo el valor del select del pais elegido var tipo tipo = document.frmcadastro.tipo.selectedIndex; //miro a ver si el pais está definido if (document.frmcadastro.tipo[tipo].value != 0) { //document.frminserir.tipo.remove(0); mis_provincias=eval("subtipo_" + tipo) //calculo el numero de provincias num_provincias = mis_provincias.length //marco el número de provincias en el select document.frmcadastro.subtipo.length = num_provincias //para cada provincia del array, la introduzco en el select for(i=0;i */ } function envioCadImov() { oNome = document.getElementById("nome"); oDDDFone = document.getElementById("ddd"); oNumFone = document.getElementById("telefone"); oEMail = document.getElementById("email"); oTipNegocio = document.getElementById("tipo_negocio"); oUso = document.getElementById("uso"); oTipo = document.getElementById("tipo"); oSubTipo = document.getElementById("subtipo"); oObs = document.getElementById("caixa"); /* * Expressões regulares para validação dos campos */ oERNome = /\D{3,}/; oEREMail = /.+@{1}.+\.+.+/; oERDDDFone = /\d{2,}/; oERNumFone = /\d{2,4}-{0,1}\d{4}.*/; if (!oNome.value.match(oERNome)) { window.alert("Informe seu nome por favor."); oNome.select(); oNome.focus(); return; } if (oDDDFone.value.length > 0) { if (!oDDDFone.value.match(oERDDDFone)) { window.alert("O DDD deve conter apenas dígitos (pelo menos 2)."); oDDDFone.select(); oDDDFone.focus(); return; } } if (oNumFone.value.length > 0) { if (!oNumFone.value.match(oERNumFone)) { window.alert("O número do telefone informado não é válido."); oNumFone.select(); oNumFone.focus(); return; } } if (oEMail.value.length > 0) { if (!oEMail.value.match(oEREMail)) { window.alert("O e-mail informado não é válido."); oEMail.select(); oEMail.focus(); return; } } if (oEMail.value.length == 0 && oNumFone.value.length == 0) { window.alert("Preencha pelo menos uma forma de contato (e-mail ou telefone)."); return; } if (oTipNegocio.value.length == 0) { window.alert("Informe o tipo de negócio por favor."); oAssunto.select(); oAssunto.focus(); return; } oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp_ali=-2&tp=ev-cad&fl=ali&sr=" + gcSpaSrImv + "&nome=" + escape(oNome.value) + "&ddd=" + escape(oDDDFone.value) + "&tel=" + escape(oNumFone.value) + "&email=" + escape(oEMail.value) + "&tpneg=" + escape(oTipNegocio.value) + "&uso=" + escape(oUso.value) + "&tipo=" + escape(oTipo.value) + "&subtip=" + escape(oSubTipo.value) + "&obs=" + escape(oObs.value); oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4 && oAjax.status == 200) { if (oAjax.responseText.indexOf("*OK*") != -1) { window.alert("Pedido de cadastramento enviado com sucesso. Obrigado."); document.getElementById("frmcadastro").reset(); } } } } function doQuemSomos() { oAjax = criaAjax(); if (oAjax) { cURL = "quemsomos.php"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = oAjax.responseText; } } } } function doLocalizacao() { oAjax = criaAjax(); if (oAjax) { cURL = "localizacao.php"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = oAjax.responseText; } } } } function doFale() { oAjax = criaAjax(); if (oAjax) { cURL = "contato.php"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = oAjax.responseText; document.getElementById("nome").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("nome").focus(); } } } } } function envioFale() { oNome = document.getElementById("nome"); oDDDFone = document.getElementById("ddd"); oNumFone = document.getElementById("telefone"); oEMail = document.getElementById("email"); oDepart = document.getElementById("departamento"); oAssunto = document.getElementById("assunto"); oMensagem = document.getElementById("caixa"); /* * Expressões regulares para validação dos campos */ oERNome = /\D{3,}/; oEREMail = /.+@{1}.+\.+.+/; oERDDDFone = /\d{2,}/; oERNumFone = /\d{2,4}-{0,1}\d{4}.*/; if (!oNome.value.match(oERNome)) { window.alert("Informe seu nome por favor."); oNome.select(); oNome.focus(); return; } if (oDDDFone.value.length > 0) { if (!oDDDFone.value.match(oERDDDFone)) { window.alert("O DDD deve conter apenas dígitos (pelo menos 2)."); oDDDFone.select(); oDDDFone.focus(); return; } } if (oNumFone.value.length > 0) { if (!oNumFone.value.match(oERNumFone)) { window.alert("O número do telefone informado não é válido."); oNumFone.select(); oNumFone.focus(); return; } } if (oEMail.value.length > 0) { if (!oEMail.value.match(oEREMail)) { window.alert("O e-mail informado não é válido."); oEMail.select(); oEMail.focus(); return; } } if (oEMail.value.length == 0 && oNumFone.value.length == 0) { window.alert("Preencha pelo menos uma forma de contato (e-mail ou telefone)."); return; } if (oAssunto.value.length == 0) { window.alert("Informe o assunto por favor."); oAssunto.select(); oAssunto.focus(); return; } oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp_ali=-1&tp=ev-con&fl=ali&sr=" + gcSpaSrImv + "&nome=" + escape(oNome.value) + "&ddd=" + escape(oDDDFone.value) + "&tel=" + escape(oNumFone.value) + "&email=" + escape(oEMail.value) + "&depart=" + escape(oDepart.value) + "&assunto=" + escape(oAssunto.value) + "&mensagem=" + escape(oMensagem.value); oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4 && oAjax.status == 200) { if (oAjax.responseText.indexOf("*OK*") != -1) { window.alert("Mensagem enviada com sucesso. Obrigado."); document.getElementById("frmcontato").reset(); } } } } function doPesqAv() { oAjax = criaAjax(); if (oAjax) { // Aqui podemos passar o parâmetro tc caso o cliente use só um dos tipos (Venda ou Locação) cURL = "spa_query.php?tp=2&atpa=1&sr=" + gcSpaSrImv + "&depup=1"; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oConteudo = document.getElementById(gcIDCtn); oConteudo.style.display = "none"; oResPesq = document.getElementById(gcIDPesq); oResPesq.style.display = "block"; oTopo = document.getElementById("topoFolhaPsq"); oTopo.innerHTML = '

Pesquisa Avançada

'; oDiv = document.getElementById(gcSpaIDCtn); oDiv.innerHTML = oAjax.responseText; } } } } function doProprietarios() { oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp=7&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { cHTML = '
' + '

Proprietários

' + '
' + '
' + oAjax.responseText + '
' + '
'; oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = cHTML; //oAjax.responseText; document.getElementById("spa-pro-usuario").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("spa-pro-usuario").focus(); } } } } } function doInquilinos() { oAjax = criaAjax(); if (oAjax) { cURL = "spa_query.php?tp=11&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); // false = síncrona oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { cHTML = '
' + '

Inquilinos

' + '
' + '
' + oAjax.responseText + '
' + '
'; oDiv = document.getElementById(gcIDCtn); oDiv.innerHTML = cHTML; //oAjax.responseText; document.getElementById("spa-inq-usuario").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("spa-inq-usuario").focus(); } } } } } function menuOver() { document.getElementById("menuServ").style.display = "block"; } function menuOut() { document.getElementById("menuServ").style.display = "none"; }