JanelaInicio2 = -33;
JanelaInicio1 = 0;
timerID = null;
timerID2 = null;
timerID3 = null;
Foco = false;
resultado3 = "";

function ajaxInit() {
    var req;
    try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (ex) {
            try {
                req = new XMLHttpRequest();
            } catch (exc) {
                alert("Esse browser não tem recursos para uso do Ajax");
                req = null;
            }
        }
    }
    return req;
}

function SelecionaFoco(Objeto,Acao) {
   Foco = Acao;	   
   if (Acao == false) {
	  Objeto.className = "campo";
      if (JanelaInicio2 == 0) {
	     timerID3 = setTimeout("DesceJanela()",1000);
	  }
   } else {
	  Objeto.className = "campo2";	   
   }
}

function SelecionaFoco2(Objeto, Acao) {
    Foco = Acao;
    if (Acao == false) {
        Objeto.className = "campo3";
        if (JanelaInicio2 == 0) {
            timerID3 = setTimeout("DesceJanela()", 1000);
        }
    } else {
        Objeto.className = "campo4";
    }
}

function AlteraJanela(Objeto,Acao) {
   if (Acao == "over") {
      Objeto.style.cursor = "pointer";
	  clearTimeout(timerID);	  
	  clearTimeout(timerID2);
	  clearTimeout(timerID3);	  
      SobeJanela();
   } 
   if (Acao == "out") {   
      Objeto.style.cursor = "none";		
	  if (Foco == false) {
	     clearTimeout(timerID);	  
	     clearTimeout(timerID2);	  
	     clearTimeout(timerID3);		 
	     DesceJanela();
	  }
   }
}

function SobeJanela() {
   window.status = "";
   if (JanelaInicio2 < 0) {
	  JanelaInicio1++;
	  JanelaInicio2++;	  
      document.getElementById("janela_login_2").style.marginTop = JanelaInicio2 + "px";
      document.getElementById("janela_login_1").style.marginTop = JanelaInicio1 + "px";	  
      timerID = setTimeout("SobeJanela()",1);
   }
}

function DesceJanela() {
   window.status = "";	
   if ((JanelaInicio2 > -33) && (Foco == false)) {
	  JanelaInicio1--;
	  JanelaInicio2--;	  
      document.getElementById("janela_login_2").style.marginTop = JanelaInicio2 + "px";
      document.getElementById("janela_login_1").style.marginTop = JanelaInicio1 + "px";	  
      timerID2 = setTimeout("DesceJanela()",1);
   }

}

function EnviarContatoEmail() {
    if (document.getElementById("formContato_ok").innerHTML.indexOf("PARAB") > 0) {
        Idioma = "ptbr";
    } else {
        Idioma = "en";
    }
    if (document.frmContato.NomeContato.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha o seu Nome!");
        } else {
            alert("Fill your Name!");
        }
        document.frmContato.NomeContato.focus();
        return;
    }
    if (document.frmContato.EmailContato.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha o seu E-Mail!");
        } else {
            alert("Fill your E-Mail!");
        }
        document.frmContato.EmailContato.focus();
        return;
    }
    var AchouArroba, AchouPonto;
    AchouArroba = document.frmContato.EmailContato.value.indexOf("@");
    AchouPonto = document.frmContato.EmailContato.value.lastIndexOf(".");
    if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
        if (Idioma == "ptbr") {
            alert("O Formato do seu e-Mail está inválido! Verifique!");
        } else {
            alert("The format of your e-Mail is invalid! Check!");
        }
        document.frmContato.EmailContato.focus();
        return;
    }
    if (document.frmContato.TelefoneContato.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha o seu Telefone!");
        } else {
            alert("Fill your Phone!");
        }
        document.frmContato.TelefoneContato.focus();
        return;
    }
    if (document.frmContato.MensagemContato.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha a Mensagem!");
        } else {
            alert("Fill the Message!");
        }
        document.frmContato.MensagemContato.focus();
        return;
    }
    ajax3 = ajaxInit();
    resultado2 = "";
    if (ajax3) {
        ajax3.open("GET", "contato_email.aspx?Acao=ContatoEmail&Empreendimento=" + document.frmContato.Empreendimento.value + "&Nome=" + document.frmContato.NomeContato.value + "&Email=" + document.frmContato.EmailContato.value + "&Telefone=" + document.frmContato.TelefoneContato.value + "&Mensagem=" + document.frmContato.MensagemContato.value + "&Rand=" + Math.ceil(Math.random() * 100000), true);
        ajax3.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
        ajax3.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        ajax3.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
        ajax3.setRequestHeader("Pragma", "no-cache");
        document.getElementById("formContato").style.display = "none";
        document.getElementById("formContato_ok").style.display = "none";
        document.getElementById("formContato_loading").style.display = "block";
        document.getElementById("formContato_erro").style.display = "none";
        ajax3.onreadystatechange = function() {
            if (ajax3.readyState == 4) {
                if (ajax3.status == 200) {
                    resultado2 = ajax3.responseText;
                    timerID2 = setTimeout("ExibeResultado2(" + resultado2 + ")", 1000);
                }
            }
        }
        ajax3.send(null);
    }
}

function EnviarFuturosLancamentos() {
    if (document.getElementById("formulario_newsletter_ok").innerHTML.indexOf("PARAB") > 0) {
        Idioma = "ptbr";
    } else {
        Idioma = "en";
    }
    if (document.frmNewsletter.Nome.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha o seu Nome!");
        } else {
            alert("Fill your Name!");
        }
        document.frmNewsletter.Nome.focus();
        return;
    }
    if (document.frmNewsletter.Email.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha o seu E-Mail!");
        } else {
            alert("Fill your E-Mail!");
        }
        document.frmNewsletter.Email.focus();
        return;
    }
    var AchouArroba, AchouPonto;
    AchouArroba = document.frmNewsletter.Email.value.indexOf("@");
    AchouPonto = document.frmNewsletter.Email.value.lastIndexOf(".");
    if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
        if (Idioma == "ptbr") {
            alert("O Formato do seu e-Mail está inválido! Verifique!");
        } else {
            alert("The format of your e-Mail is invalid! Check!");
        }
        document.frmNewsletter.Email.focus();        
        return;
    }
    ajax2 = ajaxInit();
    resultado = "";
    if (ajax2) {
       ajax2.open("GET", "cadastrar_newsletter.aspx?Acao=CadastrarNewsletter&Nome=" + document.frmNewsletter.Nome.value + "&Email=" + document.frmNewsletter.Email.value + "&Rand=" + Math.ceil(Math.random() * 100000), true);
       ajax2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
       ajax2.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
       ajax2.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
       ajax2.setRequestHeader("Pragma", "no-cache");
       document.getElementById("formulario_newsletter").style.display = "none";
       document.getElementById("formulario_newsletter_ok").style.display = "none";
       document.getElementById("formulario_newsletter_loading").style.display = "block";
       document.getElementById("formulario_newsletter_erro2").style.display = "none";
       document.getElementById("formulario_newsletter_erro").style.display = "none";
       ajax2.onreadystatechange = function() {
           if (ajax2.readyState == 4) {
               if (ajax2.status == 200) {
                   resultado = ajax2.responseText;
                   timerID = setTimeout("ExibeResultado(" + resultado + ")", 1000);
               }
           }
       }
       ajax2.send(null);
    }
}

function EnviarFaleConosco() {
    Servicos = "";
    Projetos = "";
    Outros = "";
    if (document.getElementById("formulario_faleconosco_ok").innerHTML.indexOf("PARAB") > 0) {
        Idioma = "ptbr";
    } else {
        Idioma = "en";
    }
    
    if (document.frmFaleConosco.Assunto.value == "Suprimentos / Compras") {
        if (document.frmFaleConosco.RazaoSocial.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha a Razão Social!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.RazaoSocial.focus();
            return;
        }
        if (document.frmFaleConosco.NomeFantasia.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Nome Fantasia!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.NomeFantasia.focus();
            return;
        }
        if (document.frmFaleConosco.CNPJ.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Cnpj!");
            } else {
                alert("Fill the Cnpj!");
            }
            document.frmFaleConosco.CNPJ.focus();
            return;
        }
        if (document.frmFaleConosco.InscEstadual.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha a Inscrição Estadual!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.InscEstadual.focus();
            return;
        }
        if (document.frmFaleConosco.Logradouro.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Logradouro!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.Logradouro.focus();
            return;
        }
        if (document.frmFaleConosco.Numero.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Número!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.Numero.focus();
            return;
        }
        if (document.frmFaleConosco.Bairro.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Bairro!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.Bairro.focus();
            return;
        }
        if (document.frmFaleConosco.CEP.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o CEP!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.CEP.focus();
            return;
        }
        if (document.frmFaleConosco.Cidade.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Cidade!");
            } else {
                alert("Fill the City!");
            }
            document.frmFaleConosco.Cidade.focus();
            return;
        }
        if (document.frmFaleConosco.Tel.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Telefone!");
            } else {
                alert("Fill the Telephone!");
            }
            document.frmFaleConosco.Tel.focus();
            return;
        }
        if (document.frmFaleConosco.UF.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o UF!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.UF.focus();
            return;
        }
        if (document.frmFaleConosco.Pais.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o País!");
            } else {
                alert("Fill the Country!");
            }
            document.frmFaleConosco.Pais.focus();
            return;
        }
        if (document.frmFaleConosco.Contato.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Contato!");
            } else {
                alert("Fill the Contact!");
            }
            document.frmFaleConosco.Contato.focus();
            return;
        }
        var AchouArroba, AchouPonto;
        AchouArroba = document.frmFaleConosco.Email2.value.indexOf("@");
        AchouPonto = document.frmFaleConosco.Email2.value.lastIndexOf(".");
        if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
            if (Idioma == "ptbr") {
                alert("O Formato do seu e-Mail está inválido! Verifique!");
            } else {
                alert("The format of your e-Mail is invalid! Check!");
            }
            document.frmFaleConosco.Email2.focus();
            return;
        }
        if (document.frmFaleConosco.Site.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Site!");
            } else {
                alert("Fill the Site!");
            }
            document.frmFaleConosco.Site.focus();
            return;
        }
        if (document.frmFaleConosco.TipoEmpresa.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o Tipo Empresa!");
            } else {
                alert("Fill the !");
            }
            document.frmFaleConosco.TipoEmpresa.focus();
            return;
        }
        i = 0;
        for (i = 0; i < document.getElementsByName("Servicos").length; i++) {
            if (document.getElementsByName("Servicos")[i].checked == true) {
                Servicos = document.getElementsByName("Servicos")[i].value + ", " + Servicos;
            }
        }
        if (Servicos.length > 0) {
            Servicos = Servicos.substring(1, Servicos.length -1);
        }
        if (document.frmFaleConosco.Projetos.checked == true) {
            Projetos = "Sim";
        } else {
            Projetos = "Não";
        }
        if (document.frmFaleConosco.Outros.checked == true) {
            Outros = "Sim";
        } else {
            Outros = "Não";
        }
    } else {
        if (document.frmFaleConosco.Nome.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o seu Nome!");
            } else {
                alert("Fill your Name!");
            }
            document.frmFaleConosco.Nome.focus();
            return;
        }
        if (document.frmFaleConosco.Email.value.length == 0) {
            if (Idioma == "ptbr") {
                alert("Preencha o seu E-Mail!");
            } else {
                alert("Fill your E-Mail!");
            }
            document.frmFaleConosco.Email.focus();
            return;
        }
        var AchouArroba, AchouPonto;
        AchouArroba = document.frmFaleConosco.Email.value.indexOf("@");
        AchouPonto = document.frmFaleConosco.Email.value.lastIndexOf(".");
        if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
            if (Idioma == "ptbr") {
                alert("O Formato do seu e-Mail está inválido! Verifique!");
            } else {
                alert("The format of your e-Mail is invalid! Check!");
            }
            document.frmFaleConosco.Email.focus();
            return;
        }
    }
    if (document.frmFaleConosco.Mensagem.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Preencha a Mensagem!");
        } else {
            alert("Fill the Message!");
        }
        document.frmFaleConosco.Mensagem.focus();
        return;
    }
    ajax3 = ajaxInit();
    resultado3 = "";
    if (ajax3) {
        ajax3.open("GET", "enviar_faleconosco.aspx?Acao=EnviarFaleConosco&Assunto=" + document.frmFaleConosco.Assunto.value + "&Nome=" + document.frmFaleConosco.Nome.value + "&Email=" + document.frmFaleConosco.Email.value + "&Telefone=" + document.frmFaleConosco.Telefone.value + "&Edificio=" + document.frmFaleConosco.Edificio.value + "&Unidade=" + document.frmFaleConosco.Unidade.value + "&Mensagem=" + document.frmFaleConosco.Mensagem.value + "&RazaoSocial=" + document.frmFaleConosco.RazaoSocial.value + "&NomeFantasia=" + document.frmFaleConosco.NomeFantasia.value + "&CNPJ=" + document.frmFaleConosco.CNPJ.value + "&InscEstadual=" + document.frmFaleConosco.InscEstadual.value + "&Logradouro=" + document.frmFaleConosco.Logradouro.value + "&Numero=" + document.frmFaleConosco.Numero.value + "&Complemento=" + document.frmFaleConosco.Complemento.value + "&Bairro=" + document.frmFaleConosco.Bairro.value + "&Cep=" + document.frmFaleConosco.CEP.value + "&Cidade=" + document.frmFaleConosco.Cidade.value + "&Tel=" + document.frmFaleConosco.Tel.value + "&UF=" + document.frmFaleConosco.UF.value + "&Pais=" + document.frmFaleConosco.Pais.value + "&Contato=" + document.frmFaleConosco.Contato.value + "&Email2=" + document.frmFaleConosco.Email2.value + "&Site=" + document.frmFaleConosco.Site.value + "&TipoEmpresa=" + document.frmFaleConosco.TipoEmpresa.value + "&Servicos=" + Servicos + "&Empreiteiro=" + document.frmFaleConosco.Empreiteiro.value + "&Projetos=" + Projetos + "&Outros=" + Outros + "&Rand=" + Math.ceil(Math.random() * 100000), true);
        ajax3.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
        ajax3.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        ajax3.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
        ajax3.setRequestHeader("Pragma", "no-cache");
        document.getElementById("formulario_faleconosco").style.display = "none";
        document.getElementById("formulario_faleconosco_ok").style.display = "none";
        document.getElementById("formulario_faleconosco_loading").style.display = "block";
        document.getElementById("formulario_faleconosco_erro").style.display = "none";
        ajax3.onreadystatechange = function() {
            if (ajax3.readyState == 4) {
                if (ajax3.status == 200) {
                    resultado3 = ajax3.responseText;
                    timerID = setTimeout("ExibeResultado3()", 1000);
                }
            }
        }
        ajax3.send(null);
    }
}

function ExibeResultado(resultado) {
    if (resultado == "1") {
        document.getElementById("formulario_newsletter").style.display = "none";
        document.getElementById("formulario_newsletter_loading").style.display = "none";
        document.getElementById("formulario_newsletter_ok").style.display = "block";
        document.getElementById("formulario_newsletter_erro").style.display = "none";
        document.getElementById("formulario_newsletter_erro2").style.display = "none";        
    } else if (resultado == "2") {
        document.getElementById("formulario_newsletter").style.display = "none";
        document.getElementById("formulario_newsletter_loading").style.display = "none";
        document.getElementById("formulario_newsletter_ok").style.display = "none";
        document.getElementById("formulario_newsletter_erro").style.display = "none";
        document.getElementById("formulario_newsletter_erro2").style.display = "block";
    } else {
        document.getElementById("formulario_newsletter").style.display = "none";
        document.getElementById("formulario_newsletter_loading").style.display = "none";
        document.getElementById("formulario_newsletter_ok").style.display = "none";
        document.getElementById("formulario_newsletter_erro").style.display = "block";
        document.getElementById("formulario_newsletter_erro2").style.display = "none";
    }
}

function ExibeResultado2(resultado2) {
    if (resultado2 == "1") {
        document.getElementById("formContato").style.display = "none";
        document.getElementById("formContato_loading").style.display = "none";
        document.getElementById("formContato_ok").style.display = "block";
        document.getElementById("formContato_erro").style.display = "none";
    } else if (resultado2 == "2") {
        document.getElementById("formContato").style.display = "none";
        document.getElementById("formContato_loading").style.display = "none";
        document.getElementById("formContato_ok").style.display = "none";
        document.getElementById("formContato_erro").style.display = "none";
    } else {
        document.getElementById("formContato").style.display = "none";
        document.getElementById("formContato_loading").style.display = "none";
        document.getElementById("formContato_ok").style.display = "none";
        document.getElementById("formContato_erro").style.display = "block";
    }
}

function ExibeResultado3() {
    if (resultado3 == "1") {
        document.getElementById("formulario_faleconosco").style.display = "none";
        document.getElementById("formulario_faleconosco_loading").style.display = "none";
        document.getElementById("formulario_faleconosco_ok").style.display = "block";
        document.getElementById("formulario_faleconosco_erro").style.display = "none";
    } else if (resultado3 == "2") {
        document.getElementById("formulario_faleconosco").style.display = "none";
        document.getElementById("formulario_faleconosco_loading").style.display = "none";
        document.getElementById("formulario_faleconosco_ok").style.display = "none";
        document.getElementById("formulario_faleconosco_erro").style.display = "none";
    } else {
        document.getElementById("formulario_faleconosco").style.display = "none";
        document.getElementById("formulario_faleconosco_loading").style.display = "none";
        document.getElementById("formulario_faleconosco_ok").style.display = "none";
        document.getElementById("formulario_faleconosco_erro").style.display = "block";
    }
}

function ExibeResultado13(resultado13) {
    if (resultado13 == "1") {
        document.getElementById("indicacao").style.display = "none";
        document.getElementById("indicacao_loading").style.display = "none";
        document.getElementById("indicacao_ok").style.display = "block";
        document.getElementById("indicacao_erro").style.display = "none";
        document.getElementById("NomeAmigo").innerHTML = document.frmIndique.NomeAmigoIndicacao.value + " (" + document.frmIndique.EmailAmigoIndicacao.value + ")"
    } else if (resultado13 == "2") {
        document.getElementById("indicacao").style.display = "none";
        document.getElementById("indicacao_loading").style.display = "none";
        document.getElementById("indicacao_ok").style.display = "none";
        document.getElementById("indicacao_erro").style.display = "none";
    } else {
        document.getElementById("indicacao").style.display = "none";
        document.getElementById("indicacao_loading").style.display = "none";
        document.getElementById("indicacao_ok").style.display = "none";
        document.getElementById("indicacao_erro").style.display = "block";
    }
}

function NovoCadastroNewsletter(Opcao) {
    if (Opcao) {
        document.frmNewsletter.Nome.value = "";
        document.frmNewsletter.Email.value = "";
    }
    document.getElementById("formulario_newsletter").style.display = "block";
    document.getElementById("formulario_newsletter_loading").style.display = "none";
    document.getElementById("formulario_newsletter_ok").style.display = "none";
    document.getElementById("formulario_newsletter_erro").style.display = "none";
    document.getElementById("formulario_newsletter_erro2").style.display = "none";
}

function NovoFaleConosco(Opcao) {
    if (Opcao) {
        document.frmContato.NomeContato.value = "";
        document.frmContato.EmailContato.value = "";
        document.frmContato.TelefoneContato.value = "";
        document.frmContato.MensagemContato.value = "";
    }
    document.getElementById("formContato").style.display = "block";
    document.getElementById("formContato_loading").style.display = "none";
    document.getElementById("formContato_ok").style.display = "none";
    document.getElementById("formContato_erro").style.display = "none";
}

function NovaIndicacao(Opcao) {
    if (Opcao) {
        document.frmIndique.NomeIndicacao.value = "";
        document.frmIndique.EmailIndicacao.value = "";
        document.frmIndique.NomeAmigoIndicacao.value = "";
        document.frmIndique.EmailAmigoIndicacao.value = "";
    }
    document.getElementById("indicacao").style.display = "block";
    document.getElementById("indicacao_loading").style.display = "none";
    document.getElementById("indicacao_ok").style.display = "none";
    document.getElementById("indicacao_erro").style.display = "none";
}

function NovoFaleConosco2(Opcao) {
    if (Opcao) {
        document.frmFaleConosco.Nome.value = "";
        document.frmFaleConosco.Email.value = "";
        document.frmFaleConosco.Assunto.selectedIndex = 0;
        document.frmFaleConosco.Mensagem.value = "";
        document.frmFaleConosco.Telefone.value = "";
        document.frmFaleConosco.Edificio.selectedIndex = 0;
        document.frmFaleConosco.Unidade.value = "";
        AlterarAssunto(document.frmFaleConosco.Assunto);
    }
    document.getElementById("formulario_faleconosco").style.display = "block";
    document.getElementById("formulario_faleconosco_loading").style.display = "none";
    document.getElementById("formulario_faleconosco_ok").style.display = "none";
    document.getElementById("formulario_faleconosco_erro").style.display = "none";
}

function ProcurarMapa(NomeMapa, Latitude, Longitude) {
    //document.getElementById("fundoPreto").style.display = "block";
    var winl = (screen.width - 700) / 2;
    var wint = (screen.height - 400) / 2;
    JanelaMap = window.open("mapa.aspx?NomeMapa=" + NomeMapa + "&Latitude=" + Latitude + "&Longitude=" + Longitude + "&Endereco=" + document.frmMapa.ComoChegar.value, "JanelaMap", "width=700,height=400,left=" + winl + ",top=" + wint);
    JanelaMap.focus();
}

function Indicar(idEmpreendimento) {
    //document.getElementById("fundoPreto").style.display = "block";
    if (idEmpreendimento.length == 0) {
        URL = "indicar.aspx";
    } else {
        URL = "indicar.aspx?idEmpreendimento=" + idEmpreendimento;
    }
    //document.getElementById("fundoPreto").style.display = "block";
    var winl = (screen.width - 700) / 2;
    var wint = (screen.height - 400) / 2;
    JanelaIndicacao = window.open(URL, "JanelaIndicacao", "width=700,height=400,left=" + winl + ",top=" + wint);
    JanelaIndicacao.focus();    
}

RolagemInicial = -179;
RolagemInicialSombra = -167;

function FecharJanela() {
    window.scroll(0, 9999);
    document.getElementById("boxAviso").style.display = "none";
    document.getElementById("boxAvisoSombra").style.display = "none";
    document.getElementById("fundoPreto").style.display = "none";
    document.getElementById("URL_Endereco").src = "about:blank";
}
function AlinharTela() {
    var Rolagem = 0;
    if (typeof (window.pageYOffset) == "number") {
        Rolagem = window.pageYOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        Rolagem = document.body.scrollTop;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        Rolagem = document.documentElement.scrollTop;
    }
    if (document.getElementById("fundoPreto") != null) {
        if (document.getElementById("fundoPreto").style.display == "block") {
            document.getElementById("boxAviso").style.marginTop = RolagemInicial + Rolagem + "px";
            document.getElementById("boxAvisoSombra").style.marginTop = RolagemInicialSombra + Rolagem + "px";
        }
    }
}

function SelecionaIMG(Objeto, Acao) {
    if (Acao == "1") {
        Objeto.style.borderColor = "#115d38";
        Objeto.style.cursor = "pointer";
    } else {
    Objeto.style.borderColor = "#f3f3f5";
    Objeto.style.cursor = "default";
    }
}

function EnviarIndicar() {
    if (document.getElementById("indicacao_ok").innerHTML.indexOf("PARAB") > 0) {
        Idioma = "ptbr";
    } else {
        Idioma = "en";
    }

    if (document.frmIndique.NomeIndicacao.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Digite o seu Nome!");
        } else {
            alert("Fill your Name!");
        }
        document.frmIndique.NomeIndicacao.focus();
        return;
    }
    if (document.frmIndique.EmailIndicacao.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Digite o seu E-Mail!");
        } else {
            alert("Fill your E-Mail!");
        }    
        document.frmIndique.EmailIndicacao.focus();
        return;
    }
    AchouArroba = document.frmIndique.EmailIndicacao.value.indexOf("@");
    AchouPonto = document.frmIndique.EmailIndicacao.value.lastIndexOf(".");
    if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
        if (Idioma == "ptbr") {
            alert("O Formato do seu e-Mail está inválido! Verifique!");
        } else {
            alert("The format of your e-Mail is invalid! Check!");
        }        
        document.frmIndique.EmailIndicacao.focus();
        return;
    }    
    if (document.frmIndique.NomeAmigoIndicacao.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Digite o Nome do seu Amigo!");
        } else {
            alert("Fill your Friends's Name!");
        }        
        document.frmIndique.NomeAmigoIndicacao.focus();
        return;
    }
    if (document.frmIndique.EmailAmigoIndicacao.value.length == 0) {
        if (Idioma == "ptbr") {
            alert("Digite o E-Mail do seu Amigo!");
        } else {
            alert("Fill your Friends's E-Mail!");
        }
        document.frmIndique.EmailAmigoIndicacao.focus();
        return;
    }
    AchouArroba = document.frmIndique.EmailAmigoIndicacao.value.indexOf("@");
    AchouPonto = document.frmIndique.EmailAmigoIndicacao.value.lastIndexOf(".");
    if ((AchouArroba > AchouPonto) || (AchouArroba <= 0 || AchouPonto <= 0)) {
        if (Idioma == "ptbr") {
            alert("O Formato do E-Mail do seu Amigo está inválido! Verifique!");
        } else {
            alert("The format of your Friend's E-Mail is invalid! Check!");
        }
        document.frmIndique.EmailAmigoIndicacao.focus();
        return;
    }
    ajax13 = ajaxInit();
    resultado13 = "";
    if (ajax13) {
        ajax13.open("GET", "enviar_indicacao.aspx?Acao=EnviarIndicacao&NomeIndicacao=" + document.frmIndique.NomeIndicacao.value + "&EmailIndicacao=" + document.frmIndique.EmailIndicacao.value + "&NomeAmigoIndicacao=" + document.frmIndique.NomeAmigoIndicacao.value + "&EmailAmigoIndicacao=" + document.frmIndique.EmailAmigoIndicacao.value + "&EmpreendimentoIndicacao=" + document.frmIndique.EmpreendimentoIndicacao.value + "&Rand=" + Math.ceil(Math.random() * 100000), true);
        ajax13.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
        ajax13.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        ajax13.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
        ajax13.setRequestHeader("Pragma", "no-cache");
        document.getElementById("indicacao").style.display = "none";
        document.getElementById("indicacao_ok").style.display = "none";
        document.getElementById("indicacao_loading").style.display = "block";
        document.getElementById("indicacao_erro").style.display = "none";
        ajax13.onreadystatechange = function() {
            if (ajax13.readyState == 4) {
                if (ajax13.status == 200) {
                    resultado13 = ajax13.responseText;
                    timerID13 = setTimeout("ExibeResultado13(" + resultado13 + ")", 1000);
                }
            }
        }
        ajax13.send(null);
    }

}

function ProximoBanner(xSelecionado) {
    var Banners = new Array(4);
    Banners[0] = "banner-premium-office-tower-as2-05.swf";
    Banners[1] = "banner-winner-03.swf";
    Banners[2] = "vertville_final3.swf";
    Banners[3] = "beach-garden-01.swf";
    //Banners[4] = "banner-premium-office-tower-as2-04.swf";
    
    xAtual = 0;
    Flash = document.getElementById("flash").innerHTML;
    for (x = 0; x < Banners.length; x++) {
        if (Flash.indexOf(Banners[x]) >= 0) {
            xAtual = x;
        }
        document.getElementById("botao" + (x + 1)).className = "botao_off";
    }
    if (xSelecionado != undefined) {
        xAtual = xSelecionado-1;
    }
    x = xAtual + 1;
    if (x >= Banners.length) {
        x = 0;
    }
    document.getElementById("botao" + (x+1)).className = "botao_on";
    document.getElementById("flash").innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='899' height='255' id='banner_central' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='false' /><param name='menu' value='false' /><param name='movie' value='flash/" + Banners[x] + "' /><param name='quality' value='high' /><embed src='flash/" + Banners[x] + "' quality='high' width='899' height='255' name='banner_central' align='middle' menu='false' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}

function BotaoHome(Objeto, Acao) {
    if (Acao == "over") {
       Objeto.style.cursor = "pointer";
    } else {
       Objeto.style.cursor = "default";
    }
}

function AlterarAssunto(Objeto) {
    document.getElementById("DIVFormGeral").style.display = "block";
    document.getElementById("DivSuprimentosCompras").style.display = "none";
    if (Objeto.value == "Assistência Técnica") {
        document.getElementById("DIVEdificio").style.display = "block";
    }
    if (Objeto.value == "Comercial") {
        document.getElementById("DIVEdificio").style.display = "none";
    }
    if (Objeto.value == "Diretoria") {
        document.getElementById("DIVEdificio").style.display = "none";
    }
    if (Objeto.value == "Financeiro / Cobrança") {
        document.getElementById("DIVEdificio").style.display = "block";
    }
    if (Objeto.value == "Suprimentos / Compras") {
        document.getElementById("DIVFormGeral").style.display = "none";
        document.getElementById("DIVEdificio").style.display = "none";
        document.getElementById("DivSuprimentosCompras").style.display = "block";
    }
    if (Objeto.value == "Engenharia") {
        document.getElementById("DIVEdificio").style.display = "block";
    }
    if (Objeto.value == "Relacionamento c/ Cliente") {
        document.getElementById("DIVEdificio").style.display = "block";
    }
}

function MapaGeral() {
    //document.getElementById("fundoPreto").style.display = "block";
    var winl = (screen.width - 700) / 2;
    var wint = (screen.height - 400) / 2;  
    JanelaMapGeral = window.open("mapageral.aspx", "JanelaMapGeral", "width=700,height=400,left=" + winl + ",top=" + wint);
    JanelaMapGeral.focus();
}

function Animacao() {
    if (document.getElementById("formulario_newsletter_ok").innerHTML.indexOf("PARAB") > 0) {
        Idioma = "ptbr";
    } else {
        Idioma = "en";
    }
    Texto = document.getElementById("botao4").innerHTML;
    if (Texto == "Ideatto") {
        if (Idioma == "ptbr") {
            document.getElementById("botao4").innerHTML = "<font color='red'>Veja Apartamento</font>";
        } else {
            document.getElementById("botao4").innerHTML = "<font color='red'>See Apartment</font>";
        }
    } else {
    document.getElementById("botao4").innerHTML = "Ideatto";
    }
    timerID = setTimeout("Animacao()", 2200);
}

function MesesObras(Valor) {
    StatusMesesObras = Valor;
    MesesObrasCorrer();
}

function CancelarMesesObras() {
    StatusMesesObras = 0;
}

function VerificaMesesObras() {
    if (StatusMesesObras != 0) {
        MesesObrasCorrer();
    } else {
        clearTimeout(timerMesesObras);
    }
}

function MesesObrasCorrer() {
    document.getElementById("meses_set_icones").scrollLeft = document.getElementById("meses_set_icones").scrollLeft + StatusMesesObras;
    timerMesesObras = setTimeout("VerificaMesesObras()", 1);
}



function FotosObras(Valor) {
    StatusFotosObras = Valor;
    FotosObrasCorrer();
}

function CancelarFotosObras() {
    StatusFotosObras = 0;
}

function VerificaFotosObras() {
    if (StatusFotosObras != 0) {
        FotosObrasCorrer();
    } else {
        clearTimeout(timerFotosObras);
    }
}

function FotosObrasCorrer() {
    document.getElementById("imagens_fotos").scrollTop = document.getElementById("imagens_fotos").scrollTop + StatusFotosObras;
    timerFotosObras = setTimeout("VerificaFotosObras()", 1);
}

function AcompanheObra(idEmpreendimento) {
    if (idEmpreendimento.length > 0) {
        alert("ERRO:\n\nDados Inválidos!");
    } else {
        var winl = (screen.width - 910) / 2;
        var wint = (screen.height - 600) / 2;
        JanelaObras = window.open("acompanhe_obra.aspx?idEmpreendimento=" + idEmpreendimento, "JanelaObras", "width=910,height=600,scrollbars=yes,top=" + wint + ",left=" + winl);
        JanelaObras.focus();
    }
}
