window.onerror = TrataErro;

function TrataErro() {
    return true;
}

StatusRolagem = false;

function ZeraStatus(Objeto) {
   Objeto.style.cursor = "default";
   StatusRolagem = false;
}

function Rolagem(Valor) {
   document.getElementById("box").scrollTop = document.getElementById("box").scrollTop + Valor;
   if (StatusRolagem) {
      timerID = setTimeout("Rolagem(" + Valor + ")",5);   
   }
}

function Cima(Objeto) {
   Objeto.style.cursor = "pointer";
   StatusRolagem = true;
   timerID = setTimeout("Rolagem(-5)",5);
}

function Baixo(Objeto) {
   Objeto.style.cursor = "pointer";
   StatusRolagem = true;
   timerID = setTimeout("Rolagem(5)",5);
}


//Mostra/Esconde o item que tiver o id na var. 'nomeItem'

function toggle(nomeItem) {

if ( document.getElementById ) {

//alert('1');

if (document.getElementById(nomeItem) != null)

if (document.getElementById(nomeItem).style.display == '')

document.getElementById(nomeItem).style.display = 'none';

else

document.getElementById(nomeItem).style.display = '';

} else if ( document.all ) {

//alert('2');

if (document.all[nomeItem] != null)

if (document.all[nomeItem].style.display == '')

document.all[nomeItem].style.display = 'none';

else

document.all[nomeItem].style.display = '';

}

}

function AtendimentoOnline() {
    JanelaAtendimento = window.open("atendimento.asp", "JanelaAtendimento", "width=500,height=458,top=10,left=10");
    JanelaAtendimento.focus();
}

function VerificaEndereco(Acao, Objeto) {
    if (Acao == "focus") {
        if (Objeto.value == "Av. Eng. Luiz Carlos Berrini, 1250 – São Paulo, SP") {
            Objeto.value = "";
        }
    } else {
        if (Objeto.value.length == 0) {
            Objeto.value = "Av. Eng. Luiz Carlos Berrini, 1250 – São Paulo, SP";
        }
    }
}

function TracarRota() {
    if (document.frmRota.EnderecoProcurar.value.length == 0) {
        alert("Erro:\n\nDigite o Endereço de Origem para traçar a rota!");
        document.frmRota.EnderecoProcurar.focus();
        return;
    }
    //document.getElementById("form_rota").style.display = "none";
    //document.getElementById("botao_rota").style.display = "none";
    document.getElementById("voltar1").style.display = "block";
    document.getElementById("voltar2").style.display = "block";
    document.getElementById("map").innerHTML = "<div id=\"loading\" style=\"color: #444444; margin-top: 100px; font-size: 16px; text-align: center;\"><img src=\"images/loading4.gif\" width=\"56\" height=\"21\" alt=\"\" border=\"0\" style=\"margin: 5px;\" /><br /><b>aguarde,<br />carregando o mapa ...</b></div><div id=\"direcoes_0\" style=\"margin-top: 3px; display: none; height: 261px; width: 175px; border: 0px dashed #888888; float: left; margin-left: 5px; background-color: #ffffff; overflow-y: auto; overflow-x: hidden; font-family: Arial; font-size: 12px;\"><div id=\"direcoes\" style=\"display: table;\"></div></div><div id=\"map2\" style=\"display: block; height: 261px; width: 218px; margin-top: 3px; border: 0px dashed #888888; float: left; margin-left: 5px;\"></div>";
    document.getElementById("map").style.backgroundColor = "#cabfa9";
    initialize(document.frmRota.EnderecoProcurar.value);
}

function ExibeErroRota() {
    document.getElementById("map").innerHTML = "<div style=\"margin-top: 70px; color: #444444; font-size: 16px; text-align: center;\"><img src=\"images/alert.png\" width=\"32\" height=\"32\" alt=\"\" border=\"0\" style=\"margin: 5px;\" /><br /><b>ERRO:</b><br /><br />Não foi possível encontrar o endereço que você digitou!<br /><br />Por favor, informe outro endereço, detalhando o máximo possível desta vez (Endereço, Cidade e Estado).</div>";
}

function VoltarMapa() {
    //document.getElementById("form_rota").style.display = "block";
    //document.getElementById("botao_rota").style.display = "block";
    document.getElementById("voltar1").style.display = "none";
    document.getElementById("voltar2").style.display = "none";
    document.getElementById("map").innerHTML = "<div style=\"color: #444444; margin-top: 100px; font-size: 16px; text-align: center;\"><img src=\"images/loading4.gif\" width=\"56\" height=\"21\" alt=\"\" border=\"0\" style=\"margin: 5px;\" /><br /><b>aguarde,<br />carregando o mapa ...</b></div>";
    document.getElementById("map").style.backgroundColor = "#cabfa9";
    loadMap();
}

