﻿var status = new Array;

function InitialLoad()
{
    for(var x = 2; x < 9; x++)
    {
        var row = document.getElementById("menu"+x+"content");
        row.style.display="none";
    }
}

function OpenMenu(which)
{
    var x = 0;
    while (x < 8)
    {
        var y=x+1;
        if(y != 1)
        {
            var closeMenu;
            var closeMenuColor;
            
            closeMenu = document.getElementById("menu"+y+"content");
            closeMenu.style.display="none";
            closeMenu.style.background="#2a2a2a";
           

            closeMenuColor = document.getElementById("menu"+y);
            closeMenuColor.style.background="#2a2a2a";
            closeMenuColor.style.color="#e1e1e1";            
        
            if (y != which && status[which] != "open")
            {
                status[y] = "closed";
            } 
        } 
        x++;
    }
    
    var menu;
    menu = document.getElementById("menu"+which);
    var menuContent;
    menuContent = document.getElementById("menu"+which+"content");

    if (status[which] == "open")
    {
        menu.style.color="#e1e1e1";
        menu.style.background="#2a2a2a";
        menuContent.style.display="none";
        status[which] = "closed";
    }
    else
    {        
        menu.style.background="#e1e1e1";
        menu.style.color="#2a2a2a";
        menuContent.style.display="";
        status[which] = "open";
    }
}

function Hover(which, hoverSwitch)
{
    var cell = document.getElementById("menu"+which);
    
    if (hoverSwitch == "on")
    {
        if (status[which] == "closed" || status[which] == null)
        {
            cell.style.background = "#555555";
        }
        else
        {
            cell.style.background = "#AAAAAA";
        }
    }
    else if (hoverSwitch == "off")
    {
        if (status[which] == "closed" || status[which] == null)
        {
            cell.style.background = "#2a2a2a";
        }
        else
        {
            cell.style.background = "#e1e1e1";
        }
    }
}

