tempo = null;

window.onload = AlertaInformes;

function AlertaInformes() {
    if (document.getElementById("tit_informe_novo") != undefined) {
        if (document.getElementById("div_informes").style.display == "none") {
            timerIDInformes = setTimeout("PiscaInformes()", 1200);
        }
    }
}

function PiscaInformes() {
    if (document.getElementById("div_informes").style.display == "block") {
        document.getElementById("tit_informe_novo").style.display = "none";
        document.getElementById("tit_informe").style.display = "block";
    } else {
        if (document.getElementById("tit_informe_novo").style.display == "block") {
            document.getElementById("tit_informe_novo").style.display = "none";
            document.getElementById("tit_informe").style.display = "block";
        } else {
            document.getElementById("tit_informe_novo").style.display = "block";
            document.getElementById("tit_informe").style.display = "none";
        }
        AlertaInformes();
    }
}

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 MudaSerie(idPeriodo) {
    if (idPeriodo > 0) {
        ajax2 = ajaxInit();
        resultado = "";
        Endereco = location.pathname;
        Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
        Endereco = Endereco.split("/");
        if ((Endereco.length - 1) > 4) {
            Caminho = "../../../";
        } else if ((Endereco.length - 1) > 3) {
            Caminho = "../../";
        } else {
            Caminho = "../";
        }        
        if (ajax2) {
            ajax2.open("GET", "/ajax/retornaserie.asp?idPeriodo=" + idPeriodo + "&Rand=" + Math.ceil(Math.random() * 100000), true);
            ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
            ajax2.onreadystatechange = function() {
                if (ajax2.readyState == 4) {
                    if (ajax2.status == 200) {
                        resultado = ajax2.responseText;

                        if (resultado.length > 0) {
                            document.getElementById("Serie").disabled = false;
                            for (i = 1; i <= document.getElementById("Serie").options.length; i++) {
                                document.getElementById("Serie").options[i] = null;
                            }
                            splitSeries = resultado.split("|");
                            for (i = 0; i <= splitSeries.length - 1; i++) {
                                document.getElementById("Serie").options[i] = new Option(splitSeries[i].substring(splitSeries[i].indexOf(",") + 1, splitSeries[i].length), splitSeries[i].substring(0, splitSeries[i].indexOf(",")));

                            }
                        }
                    }
                }
            }
            ajax2.send(null);
        }
    } else {
        document.getElementById("Serie").disabled = true;
        for (i = 1; i <= document.getElementById("Serie").options.length; i++) {
            document.getElementById("Serie").options[i] = null;
        }
    }
}
function FaleConoscoDiv(Acao) {
    if (Acao == 'carrega'){
        document.getElementById("FaleConosco").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
    }
    if (Acao == 'sucesso') {
        alert("Mensagem enviada com sucesso!");
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Sucesso").style.display = "block";
    }
    if (Acao == 'erro') {
        alert("Erro ao enviar a mensagem!");
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Erro").style.display = "block";
    }
    if (Acao == 'mensagem') {
        document.getElementById("Sucesso").style.display = "none";
        document.getElementById("FaleConosco").style.display = "block";
        for (i = 0; i <= document.getElementById("frmFaleConosco").length; i++) {
            if (document.getElementById("frmFaleConosco")[i] != null) {
                document.getElementById("frmFaleConosco")[i].value = "";
            }
        }
        document.getElementById("Serie").disabled = true;
    }
    if (Acao == 'mensagem2') {
        document.getElementById("Erro").style.display = "none";
        document.getElementById("FaleConosco").style.display = "block";
        for (i = 0; i <= document.getElementById("frmFaleConosco").length; i++) {
            if (document.getElementById("frmFaleConosco")[i] != null) {
                document.getElementById("frmFaleConosco")[i].value = "";
            }
        }
        document.getElementById("Serie").disabled = true;
    }
}
function TrabalheConoscoDiv(Acao) {
    if (Acao == 'carrega') {
        document.getElementById("TrabalheConosco").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
    }
    if (Acao == 'sucesso') {
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Sucesso").style.display = "block";
    }
    if (Acao == 'erro') {
        document.getElementById("Sucesso").style.display = "none";
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Erro").style.display = "block";
    }
    if (Acao == 'mensagem') {
        document.getElementById("Sucesso").style.display = "none";
        document.getElementById("TrabalheConosco").style.display = "block";
        document.getElementById("frmTrabalheConosco").reset();
        for (i = 0; i <= document.getElementById("frmTrabalheConosco").length; i++) {
            if (document.getElementById("frmTrabalheConosco")[i] != null) {
                document.getElementById("frmTrabalheConosco")[i].value = "";
            }
        }
    }
    if (Acao == 'mensagem2') {
        document.getElementById("Erro").style.display = "none";
        document.getElementById("TrabalheConosco").style.display = "block";
    }
}
function MatriculaDiv(Acao) {
    if (Acao == 'carrega') {
        document.getElementById("FaleConosco").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
    }
    if (Acao == 'sucesso') {
        alert("Mensagem enviada com sucesso!");
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Sucesso").style.display = "block";
    }
    if (Acao == 'erro') {
        alert("Erro ao enviar a mensagem!");
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Erro").style.display = "block";
    }
    if (Acao == 'mensagem') {
        document.getElementById("Sucesso").style.display = "none";
        document.getElementById("FaleConosco").style.display = "block";
        document.getElementById("frmMatricula").reset();
    }
    if (Acao == 'mensagem2') {
        document.getElementById("Erro").style.display = "none";
        document.getElementById("FaleConosco").style.display = "block";
        document.getElementById("frmMatricula").reset();
    }
}

function TrabalheConosco() {
    if (document.getElementById("Unidade").value.length == 0) {
        document.getElementById("Unidade").focus();
        alert("Você deve obrigatoriamente informar uma Unidade!");
        return;
    }
    if (document.getElementById("Nome").value.length == 0) {
        document.getElementById("Nome").focus();
        alert("Você deve obrigatoriamente informar o seu Nome!");
        return;
    }
    if (document.getElementById("Email").value.length == 0) {
        document.getElementById("Email").focus();
        alert("Você deve obrigatoriamente informar o seu E-Mail!");
        return;
    }
    AchouArroba = document.getElementById("Email").value.indexOf("@");
    AchouPonto = document.getElementById("Email").value.indexOf(".");
    if (AchouArroba <= 0 || AchouPonto <= 0) {
        document.getElementById("Email").focus();
        alert("O Formato do seu E-Mail está inválido! Verifique!");
        return;
    }    
    if (document.getElementById("Area").value.length == 0) {
        document.getElementById("Area").focus();
        alert("Você deve obrigatoriamente informar uma Área!");
        return;
    }
    if (document.getElementById("Curriculo").value.length == 0) {
        document.getElementById("Curriculo").focus();
        alert("Você deve obrigatoriamente anexar o seu Currículo!");
        return;
    }
    document.getElementById("frmTrabalheConosco").submit();
    TrabalheConoscoDiv('carrega');
}
function MandaEmail() {
    var parametro="";
    if (document.getElementById("Categoria").value.length == 0) {
        document.getElementById("Categoria").focus();
        alert("Você deve obrigatoriamente informar um Setor!");
        return;
    }
    if (document.getElementById("Nome").value.length == 0) {
        document.getElementById("Nome").focus();
        alert("Você deve obrigatoriamente informar o seu Nome!");
        return;
    }
    if (document.getElementById("Email").value.length == 0) {
        document.getElementById("Email").focus();
        alert("Você deve obrigatoriamente informar o seu E-Mail!");
        return;
    }
    AchouArroba = document.getElementById("Email").value.indexOf("@");
    AchouPonto = document.getElementById("Email").value.indexOf(".");
    if (AchouArroba <= 0 || AchouPonto <= 0) {
        document.getElementById("Email").focus();
        alert("O Formato do seu E-Mail está inválido! Verifique!");
        return;
    }
    if (document.getElementById("CodFone").value.length == 0) {
        document.getElementById("CodFone").focus();
        alert("Você deve obrigatoriamente informar o seu DDD!");
        return;
    }
    if (document.getElementById("Fone").value.length == 0) {
        document.getElementById("Fone").focus();
        alert("Você deve obrigatoriamente informar o seu Telefone!");
        return;
    }
    if (document.getElementById("Assunto").value.length == 0) {
        document.getElementById("Assunto").focus();
        alert("Você deve obrigatoriamente informar um Assunto!");
        return;
    }
    if (document.getElementById("Mensagem").value.length == 0) {
        document.getElementById("Mensagem").focus();
        alert("Digite a Mensagem!");
        return;
    }
    for (i = 0; i <= document.getElementById("frmFaleConosco").length; i++) {
        if (document.getElementById("frmFaleConosco")[i] != null) {
            parametro = document.getElementById("frmFaleConosco")[i].name + "=" + document.getElementById("frmFaleConosco")[i].value + "&" + parametro;
        }
    }
    FaleConoscoDiv('carrega');
    parametro = parametro.substring(0, parametro.length-1);
    ajax2 = ajaxInit();
    resultado = "";
    Endereco = location.pathname;
    Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
    Endereco = Endereco.split("/");
    if ((Endereco.length - 1) > 4) {
        Caminho = "../../../";
    } else if ((Endereco.length - 1) > 3) {
        Caminho = "../../";
    } else {
        Caminho = "../";
    }
    if (ajax2) {
        ajax2.open("GET", "/ajax/EnviaEmail.asp?" + parametro + "&Rand=" + Math.ceil(Math.random() * 100000), true);
        ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
        ajax2.onreadystatechange = function() {
            if (ajax2.readyState == 4) {
                if (ajax2.status == 200) {
                    resultado = ajax2.responseText;
                    if (resultado == "1") {
                        FaleConoscoDiv('sucesso');
                    } else {
                        FaleConoscoDiv('erro');
                    }
                }
            }

        }
        ajax2.send(null);
    }
}
function MudaEscola(Tipo) {
    if (Tipo == "Sim") {
        document.getElementById("DivEscola").style.display = "block";
    } else {
        document.getElementById("DivEscola").style.display = "none";
    }
    
}
function MandaEmail2() {
    var parametro = "";
    if (document.getElementById("NomeAluno").value.length == 0) {
        document.getElementById("NomeAluno").focus();
        alert("Você deve obrigatoriamente informar o Nome do Aluno!");
        return;
    }
    if (document.getElementById("Nome").value.length == 0) {
        document.getElementById("Nome").focus();
        alert("Você deve obrigatoriamente informar o Nome do Responsável!");
        return;
    }
    if (document.getElementById("CodFone").value.length == 0) {
        document.getElementById("CodFone").focus();
        alert("Você deve obrigatoriamente informar o seu DDD!");
        return;
    }
    if (document.getElementById("Fone").value.length == 0) {
        document.getElementById("Fone").focus();
        alert("Você deve obrigatoriamente informar o seu Telefone!");
        return;
    }
    if (document.getElementById("Email").value.length == 0) {
        document.getElementById("Email").focus();
        alert("Você deve obrigatoriamente informar o seu E-Mail!");
        return;
    }
    AchouArroba = document.getElementById("Email").value.indexOf("@");
    AchouPonto = document.getElementById("Email").value.indexOf(".");
    if (AchouArroba <= 0 || AchouPonto <= 0) {
        document.getElementById("Email").focus();
        alert("O Formato do seu e-Mail está inválido! Verifique!");
        return;
    }
    if (document.getElementById("Frequenta").value.length == 0) {
        document.getElementById("Frequenta").focus();
        alert("Você deve obrigatoriamente informar se frequenta ou não uma Escola!");
        return;
    }
    if (document.getElementById("Frequenta").value == "Sim") {
        if (document.getElementById("EscolaFrequenta").value.length == 0) {
            document.getElementById("EscolaFrequenta").focus();
            alert("Você deve obrigatoriamente informar o Nome da Escola!");
            return;
        }
    }
    if (document.getElementById("InformacoesEscola").value.length == 0) {
        document.getElementById("InformacoesEscola").focus();
        alert("Você deve obrigatoriamente informar como conheceu a Escola Castanheiras!");
        return;
    }
    for (i = 0; i <= document.getElementById("frmMatricula").length; i++) {
        if (document.getElementById("frmMatricula")[i] != null) {
            parametro = document.getElementById("frmMatricula")[i].name + "=" + document.getElementById("frmMatricula")[i].value + "&" + parametro;
        }
    }
    MatriculaDiv('carrega');
    parametro = parametro.substring(0, parametro.length - 1);
    ajax2 = ajaxInit();
    resultado = "";
    Endereco = location.pathname;
    Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
    Endereco = Endereco.split("/");
    if ((Endereco.length - 1) > 4) {
        Caminho = "../../../";
    } else if ((Endereco.length - 1) > 3) {
        Caminho = "../../";
    } else {
        Caminho = "../../";
    }
    if (ajax2) {
        ajax2.open("GET", "/ajax/ajax_matricula.asp?" + parametro + "&Rand=" + Math.ceil(Math.random() * 100000), true);
        ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
        ajax2.onreadystatechange = function() {
            if (ajax2.readyState == 4) {
                if (ajax2.status == 200) {
                    resultado = ajax2.responseText;
                    if (resultado == "1") {
                        MatriculaDiv('sucesso');
                    } else {
                        MatriculaDiv('erro');
                    }
                } else {
                    alert(ajax2.status);
                }
            }

        }
        ajax2.send(null);
    }


}
function MostraDiv(idSerie) {
    var i;
    for (i=0; i<=document.getElementsByTagName("Div").length; i++) {
        if (document.getElementsByTagName("Div")[i] != null){
            if (document.getElementsByTagName("Div")[i].id.indexOf("Horario_") >= 0) {
                if (document.getElementsByTagName("Div")[i].id.indexOf(idSerie) >= 0) {
                    document.getElementsByTagName("Div")[i].style.display = "block";
                } else {
                    document.getElementsByTagName("Div")[i].style.display = "none";
                }
            }
        }    
    }

}
function EnviaCardapio(x, cor1, cor2, Tipo) {
    if ((tempo == null) && (x.length > 0)) {        
        tempo = 0;
        ajax2 = ajaxInit();
        resultado = "";
        Endereco = location.pathname;
        Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
        Endereco = Endereco.split("/");
        if ((Endereco.length - 1) > 4) {
            Caminho = "../../../";
        } else if ((Endereco.length - 1) > 3) {
            Caminho = "../../";
        } else {
            Caminho = "../";
        }
        if (x == "1") {
            NomeMes = "Janeiro";
        }
        if (x == "2") {
            NomeMes = "Fevereiro";
        }
        if (x == "3") {
            NomeMes = "Março";
        }
        if (x == "4") {
            NomeMes = "Abril";
        }
        if (x == "5") {
            NomeMes = "Maio";
        }
        if (x == "6") {
            NomeMes = "Junho";
        }
        if (x == "7") {
            NomeMes = "Julho";
        }
        if (x == "8") {
            NomeMes = "Agosto";
        }
        if (x == "9") {
            NomeMes = "Setembro";
        }
        if (x == "10") {
            NomeMes = "Outubro";
        }
        if (x == "11") {
            NomeMes = "Novembro";
        }
        if (x == "12") {
            NomeMes = "Dezembro";
        }
        document.getElementById("Cardapio").style.display = "none";
        document.getElementById("Nada").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
        document.getElementById("titulo_loading").innerHTML = NomeMes;
        ListaMateriais = document.getElementsByTagName("span");
        for (z = 0; z <= ListaMateriais.length - 1; z++) {
            if (ListaMateriais[z].id.indexOf("Mes_") >= 0) {
                ListaMateriais[z].style.color = '#32327b';
            }
        }
        document.getElementById("CardapioFoco").focus();
        document.getElementById("Mes_" + x).style.color = "#" + cor1;
        if (ajax2) {
            Tipo = "Integral";
            ajax2.open("GET", "/ajax/ajax_cardapio.asp?cor1=" + cor1 + "&cor2=" + cor2 + "&Tipo=" + Tipo + "&Mes=" + x + "&Rand=" + Math.ceil(Math.random() * 100000), true);
            ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
            ajax2.onreadystatechange = function() {
                if (ajax2.readyState == 4) {
                    if (ajax2.status == 200) {
                        resultado = ajax2.responseText;
                        if (resultado == "2") {
                            tempo = setTimeout("ExibeCardapio(2)", 1000);
                        } else {
                            tempo = setTimeout("ExibeCardapio(1)", 1000);
                        }
                    }
                }

            }
            ajax2.send(null);
        }
    }
}

function EnviaCardapio2(x, cor1, cor2, Tipo) {
    if ((tempo == null) && (x.length > 0)) {
        tempo = 0;
        ajax2 = ajaxInit();
        resultado = "";
        Endereco = location.pathname;
        Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
        Endereco = Endereco.split("/");
        if ((Endereco.length - 1) > 4) {
            Caminho = "../../../../";
        } else if ((Endereco.length - 1) > 3) {
            Caminho = "../../../";
        } else {
            Caminho = "../";
        }
        if (x == "1") {
            NomeMes = "Janeiro";
        }
        if (x == "2") {
            NomeMes = "Fevereiro";
        }
        if (x == "3") {
            NomeMes = "Março";
        }
        if (x == "4") {
            NomeMes = "Abril";
        }
        if (x == "5") {
            NomeMes = "Maio";
        }
        if (x == "6") {
            NomeMes = "Junho";
        }
        if (x == "7") {
            NomeMes = "Julho";
        }
        if (x == "8") {
            NomeMes = "Agosto";
        }
        if (x == "9") {
            NomeMes = "Setembro";
        }
        if (x == "10") {
            NomeMes = "Outubro";
        }
        if (x == "11") {
            NomeMes = "Novembro";
        }
        if (x == "12") {
            NomeMes = "Dezembro";
        }
        document.getElementById("Cardapio").style.display = "none";
        document.getElementById("Nada").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
        document.getElementById("titulo_loading").innerHTML = NomeMes;
        ListaMateriais = document.getElementsByTagName("span");
        for (z = 0; z <= ListaMateriais.length - 1; z++) {
            if (ListaMateriais[z].id.indexOf("Mes_") >= 0) {
                ListaMateriais[z].style.color = '#32327b';
            }
        }
        document.getElementById("CardapioFoco").focus();
        document.getElementById("Mes_" + x).style.color = "#" + cor1;
        if (ajax2) {
            Tipo = "Manhã";
            ajax2.open("GET", "/ajax/ajax_cardapio.asp?cor1=" + cor1 + "&cor2=" + cor2 + "&Tipo=" + Tipo + "&Mes=" + x + "&Rand=" + Math.ceil(Math.random() * 100000), true);
            ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
            ajax2.onreadystatechange = function() {
                if (ajax2.readyState == 4) {
                    if (ajax2.status == 200) {
                        resultado = ajax2.responseText;
                        if (resultado == "2") {
                            tempo = setTimeout("ExibeCardapio(2)", 1000);
                        } else {
                            tempo = setTimeout("ExibeCardapio(1)", 1000);
                        }
                    }
                }

            }
            ajax2.send(null);
        }
    }
}

function MudaMateria(idEspecialidade, cor1, cor2, Titulo) {
    if ((tempo == null) && (idEspecialidade.length > 0)) {
        tempo = 0;
        ajax2 = ajaxInit();
        resultado = "";
        Endereco = location.pathname;
        Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
        Endereco = Endereco.split("/");
        if ((Endereco.length - 1) > 4) {
            Caminho = "../../../";
        } else if ((Endereco.length - 1) > 3) {
            Caminho = "../../";
        } else {
            Caminho = "../";
        }
        document.getElementById("Materia").style.display = "none";
        document.getElementById("Nada").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
        document.getElementById("titulo_loading").innerHTML = Titulo;
        ListaMateriais = document.getElementsByTagName("span");
        for (z = 0; z <= ListaMateriais.length - 1; z++) {
            if (ListaMateriais[z].id.indexOf("Materia_") >= 0) {
                ListaMateriais[z].style.color = '#32327b';
            }
        }
        document.getElementById("MateriaFoco").focus();
        document.getElementById("Materia_" + idEspecialidade).style.color = "#" + cor1;
        if (ajax2) {
            ajax2.open("GET", "/ajax/ajax_materias.asp?idEspecialidade=" + idEspecialidade + "&Rand=" + Math.ceil(Math.random() * 100000), true);
            ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
            ajax2.onreadystatechange = function() {
                if (ajax2.readyState == 4) {                    
                    if (ajax2.status == 200) {
                        resultado = ajax2.responseText;
                        if (resultado == "2") {
                            tempo = setTimeout("ExibeEspecialidade(2)", 1000);
                        } else {
                            tempo = setTimeout("ExibeEspecialidade(1)", 1000);

                        }
                    }
                }

            }
            ajax2.send(null);
        }
    }
}

function ExibeEspecialidade(z) {
    if (z == 2) {
        document.getElementById("Materia").style.display = "none";
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Nada").style.display = "block";
    } else {
        document.getElementById("Materia").style.display = "block";
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Materia").innerHTML = resultado;
    }
    tempo = null;
}

function ExibeCardapio(z) {
    if (z == 2) {
        document.getElementById("Cardapio").style.display = "none";
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Nada").style.display = "block";
    } else {
        document.getElementById("Cardapio").style.display = "block";
        document.getElementById("Carregando").style.display = "none";
        document.getElementById("Cardapio").innerHTML = resultado;
    }
    tempo = null;
}


function MostraHorario(idSerie, cor1, cor2, Titulo) {
    if ((tempo == null) && (idSerie.length > 0)) {
        ajax2 = ajaxInit();
        tempo = 0;
        resultado = "";
        Endereco = location.pathname;
        Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
        Endereco = Endereco.split("/");
        if ((Endereco.length - 1) >= 4) {
            Caminho = "../../../";
        } else if ((Endereco.length - 1) >= 3) {
            Caminho = "../../";
        } else {
            Caminho = "../";
        }
        document.getElementById("HorarioExibe").style.display = "none";
        document.getElementById("Carregando").style.display = "block";
        document.getElementById("Series").focus();
        document.getElementById("titulo_loading").innerHTML = Titulo;
        ListaSeries = document.getElementsByTagName("span");
        for (z = 0; z <= ListaSeries.length-1; z++) {
            if (ListaSeries[z].id.indexOf("Serie_") >= 0) {
                ListaSeries[z].style.color = '#32327b';
            }
        }
        document.getElementById("Serie_" + idSerie).style.color = "#" + cor1;
        if (ajax2) {
            ajax2.open("GET", "/ajax/ajax_horario.asp?idSerie=" + idSerie + "&cor1=" + cor1 + "&cor2=" + cor2 + "&Rand=" + Math.ceil(Math.random() * 100000), true);
            ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
            ajax2.onreadystatechange = function() {
                if (ajax2.readyState == 4) {
                    if (ajax2.status == 200) {
                        resultado = ajax2.responseText;
                        tempo = setTimeout("ExibeHorario(\"" + resultado + "\")", 1000);
                    }
                }

            }
            ajax2.send(null);
        }
    }
}

function ExibeHorario(resultado) {
    document.getElementById("Carregando").style.display = "none";
    document.getElementById("HorarioExibe").style.display = "block";
    document.getElementById("HorarioExibe").innerHTML = resultado;
    tempo = null;
}

function ExibeEquipe(resultado) {
    document.getElementById("Carregando").style.display = "none";
    document.getElementById("tabela_equipe").style.display = "block";
    document.getElementById("tabela_equipe").innerHTML = resultado;
    tempo = null;
}

function SelecionaCategoria(idCategoria, cor1, cor2, Titulo) {
    if (idCategoria > 0) {
        if (tempo == null) {
            ajax2 = ajaxInit();
            tempo = 0;
            resultado = "";
            Endereco = location.pathname;
            Endereco = Endereco.replace("/$sitepreview/escolacastanheiras.com.br", "")
            Endereco = Endereco.split("/");
            if ((Endereco.length - 1) >= 4) {
                Caminho = "../../../";
            } else if ((Endereco.length - 1) >= 3) {
                Caminho = "../../";
            } else {
                Caminho = "../";
            }
            document.getElementById("tabela_equipe").style.display = "none";
            document.getElementById("Carregando").style.display = "block";
            document.getElementById("Equipes").focus();
            document.getElementById("titulo_loading").innerHTML = Titulo;
            ListaCategorias = document.getElementsByTagName("span");
            for (z = 0; z <= ListaCategorias.length - 1; z++) {
                if (ListaCategorias[z].id.indexOf("Categoria_") >= 0) {
                    ListaCategorias[z].style.color = '#32327b';
                }
            }
            document.getElementById("Categoria_" + idCategoria).style.color = "#" + cor1;
            if (ajax2) {
                ajax2.open("GET", "/ajax/ajax_equipe.asp?idCategoria=" + idCategoria + "&cor1=" + cor1 + "&cor2=" + cor2 + "&Rand=" + Math.ceil(Math.random() * 100000), true);
                ajax2.setRequestHeader("Content-type", "charset=iso-8859-1");
                ajax2.onreadystatechange = function() {
                    if (ajax2.readyState == 4) {
                        if (ajax2.status == 200) {
                            resultado = ajax2.responseText;
                            tempo = setTimeout("ExibeEquipe(\"" + resultado + "\")", 1000);
                        }
                    }

                }
                ajax2.send(null);
            }
        }

    }
}

function MudaCor(Objeto, Cor, Borda) {
    Objeto.style.borderStyle = Borda;
    Objeto.style.backgroundColor = Cor;
}

function VerificaPesquisa() {
    if (document.frmGoogle.q.value.length == 0) {
        alert("Digite a palavra que você deseja pesquisar!");
        document.frmGoogle.q.focus();
    } else {
        document.frmGoogle.submit();
    }
}

function VerificaPesquisaSubmit() {
    if (document.frmGoogle.q.value.length == 0) {
        alert("Digite a palavra que você deseja pesquisar!");
        document.frmGoogle.q.focus();
        return false;
    } else {
        return true;
    }
}

function CarregaInformes() {
   if ((document.getElementById("div_informes").style.display.length == 0) || (document.getElementById("div_informes").style.display == "none")) {
       document.getElementById("div_informes_block").style.display = "block";
       document.getElementById("div_informes").style.display = "block";
   } else {
       document.getElementById("div_informes_block").style.display = "none";
       document.getElementById("div_informes").style.display = "none";
       AlertaInformes();
   }
}