﻿var abaLink = null;
var abaConteudo = null;
var abaIndice = null;
var abaTotal = null;

function carregaAbas(obj, conteudo, total)
{
    escolheAba(obj, conteudo);
    
    abaIndice = 1;
    abaTotal = total;
    
    if (abaTotal > 6)
    {
        for (i = 7; i <= total; i++)
            getObj('aba' + i).style.display = 'none';
    }
    
    getObj('lnkAntAba').style.visibility = 'hidden';
}

function proxAba()
{
    if ((abaIndice+6) <= abaTotal)
    {
        getObj('aba' + abaIndice).style.display = 'none';
        getObj('aba' + (abaIndice+6)).style.display = 'block';
        abaIndice++;
        getObj('lnkAntAba').style.visibility = 'visible';
    }
    
    if ((abaIndice+5) == abaTotal)
        getObj('lnkProxAba').style.visibility = 'hidden';
}

function antAba()
{
    if (abaIndice > 1)
    {
        getObj('aba' + (abaIndice+5)).style.display = 'none';
        getObj('aba' + (abaIndice-1)).style.display = 'block';
        abaIndice--;
        getObj('lnkProxAba').style.visibility = 'visible';
    }
    if (abaIndice == 1)
        getObj('lnkAntAba').style.visibility = 'hidden';
}

function escolheAba(obj, conteudo)
{
    if (abaLink)
        setClassName(abaLink, '');

    if (abaConteudo)
        abaConteudo.style.display = 'none';

    abaLink = obj
    abaConteudo = getObj(conteudo);
    
    setClassName(abaLink, 'over');
    abaConteudo.style.display = 'block';
}

function overAba(obj)
{
    if (obj != abaLink)
        setClassName(obj, 'over');
}

function outAba(obj)
{
    if (obj != abaLink)
        setClassName(obj, 'out');
}