
var tbN = 4;

var sTo;

var cN = 1;
var cNo = 1;
var iNB = new Array();
var iNBh = new Array();
var iP = new Array();
var iPP = new Array();



var iNBto = -1;
var cNto = -1;

for(n = 1; n < 5; n++)
{
    iP[n] = 0;
    iPP[n] = 0;
}

iP[1] = 12;
iPP[1] = 12;

function navbar(n)
{
    if(cN != n)
    {
        if(cN)
        {
            iPP[cN] = 0;
        }
        
        for(i = 1; i <= tbN; i++)
        {
            o = document.getElementById('tb'+i);
            o.style.zIndex = (i == cN ? 50 : 10);
            o.style.opacity = 1;
            o.style.mozOpacity = 1;
            o.style.filter = 'alpha(opacity=100)';
        }
        
        o = document.getElementById('tb'+n);
        o.style.opacity = 0.1;
        o.style.mozOpacity = 0.1;
        o.style.filter = 'alpha(opacity=10)';
        o.style.zIndex = 100;
        o.style.visibility = 'visible';
        cNo = 0.1;

        cN = n;
        iPP[n] = 12;

        if(iNBto == -1)
            iNBto = setTimeout('navbar_animate();', 50);
        if(cNto != -1)
        {
            clearTimeout(cNto);
            cNto = -1;
        }
    }
}

function navbarout(n)
{
    if(cNto == -1)
        cNto = setTimeout('navbar_auto();', 8000);
}

function navbar_auto()
{
    n = cN + 1;
    if(n > tbN)
        n = 1;
    
    navbar(n);
    
    cNto = setTimeout('navbar_auto();', 8000);    
}

function navbar_start()
{
    cNto = setTimeout('navbar_auto();', 8000);    
}

function navbar_animate()
{
    iNBto = setTimeout('navbar_animate();', 50);

    needTO = false;
    
    if(cNo < 1)
    {
        needTO = true;
        cNo += 0.1;
        if(cNo > 1)
            cNo = 1;
        
        o = document.getElementById('tb'+cN);
        o.style.opacity = cNo;
        o.style.mozOpacity = cNo;
        o.style.filter = 'alpha(opacity='+(cNo*100)+')';
    }
    
    if(!needTO)
    {
        clearTimeout(iNBto);
        iNBto = -1;
    }
}



function navbar_auto_start()
{
    sTo = setTimeout('navbar_auto();', 5000);
}

function navbar_lock(n)
{
    clearTimeout(sTo);
    for(i = 1; i <= tbN; i++)
    {
        o = document.getElementById('tb'+i);
        o.style.visibility = (i == n ? 'visible' : 'hidden');
    }
}
