﻿

function expande(obj) {
    document.getElementById("exp-banner").style.clip = "rect(0px 940px 400px 0px)";
}

function retrai() {
    document.getElementById("exp-banner").style.clip = "rect(0px 940px 115px 0px)";
}



//user: etani
//onclick, onmouseover
var isOpen = false;

function abrirDiv(isMouseOver) {
    var obj = document.getElementById("exp-banner");

    if (!isMouseOver)
        isOpen = !isOpen;

    if (isOpen)
        obj.style.clip = "rect(0px 940px 400px 0px)";
}

//user: etani
//onmouseout
function fecharDiv() {
    document.getElementById("exp-banner").style.clip = "rect(0px 940px 115px 0px)";
}




//current = "aba Associe-se"
function too_abaAssocie(element, sender_id) {
    var divs = document.getElementById('abas');
    var div_length = 10;

    if (divs != null)
        div_length = divs.getElementsByTagName('div').length;

    for (i = 0; i < div_length; i++) {
        var divname = 'Aba' + i;
        var sender = document.getElementById(sender_id);
        var anchor = document.getElementById('AbaResp' + i);
        var AbaStyle = document.getElementById(divname).style;
        var classnome = " ativo_resp" + i;

        if (sender.id == anchor.id) {
            if (sender.className.indexOf(classnome) == -1)
                sender.className += classnome;
        }
        else if (sender.id != anchor.id) {
            if (anchor.className.indexOf(classnome) > 0) {
                anchor.className = anchor.className.replace(classnome, "");
            }
        }

        AbaStyle.display = element == divname ? 'block' : 'none';
    }
}

function BuscarGoogle(textbox) {
    $(".gsc-input").val(textbox);
    $(".gsc-search-button").click();
}

var isEncontrado = false;
var index = 0;
function EncontrarTermo(id) {
    var timer = window.setInterval(function() {
        functionBuscar(id);
        window.clearTimeout(timer);

        if (index == 3) {
            $("#divResultado").css("display", "block");
            if (isEncontrado) {
                $("#labelTexto").html("Resultado(s) encontrado(s) para o termo:");
            }
            else {
                $("#labelTexto").html("Não foi possivel encontrar resultados para o termo:");
            }
        }
    }, 3000);
}

function functionBuscar(id) {
    var content1 = $("#" + id).html();

    if (!isEncontrado && content1.indexOf("Nenhum resultado") == -1)
        isEncontrado = true;

    index++;
}
