﻿var selectedID = -1;
var previousID = -1;
var nextID = -1;

function go(id)
{
    //calculate previous and next tab ids
    var previous = ((id == 0) ? -1 : id - 1);
    var next = ((id == 5) ? -1 : id + 1);
    
    //reset all
    for(var i = 0; i <= 5; i++)
    {
        if(i == previous)
        {
            $('#mn_' + i).attr('class', 'previous');
            previousID = i;
        }
        else if (i == next)
        {
            $('#mn_' + i).attr('class', 'next');
            nextID = i;
        }
        else if (i == id)
        {
            $('#mn_' + i).attr('class', 'selected');
            selectedID = i;
        }
        else
        {
            $('#mn_' + i).attr('class', 'out');
        }

        if (selectedID == 5)
        {
            nextID = -1;
        }
        if (selectedID == 0)
        {
            previousID = -1;
        }
    }
}


function rollover(id)
{
    if (id != selectedID)
    {
        var css = 'over';
        
        if (id == previousID)
        {
            css = 'previousOver';
        }
        else if (id == nextID)
        {
            css = 'nextOver';
        }
        else
        {
            css = 'over';
        }

        $('#mn_' + id).attr('class', css);
    }
}
function rollout(id)
{
    var css = 'out';
    if (previousID == id)
    {
        css = 'previous';
    }
    else if (nextID == id)
    {
        css = 'next';       
    }
    else if (selectedID == id)
    {
        css = 'selected';        
    }
    else
    {
        css = 'out';
    }
    
    $('#mn_' + id).attr('class', css);
}
