﻿var toggling = false;

function ShowMenu(id)
{
    // Disabling menu animation for now 
    /*
    if (toggling)
    {
        return;
    }
    
    // Only animate if there is actually a submenu to display.
    if (document.getElementById(id).getElementsByTagName("ul").length == 0)
    {
        return;
    }
    
    toggling = true;
    var topMenus = document.getElementById("Nav").childNodes;

    for (var i = 0; i < topMenus.length; i++)
    {
        if (topMenus[i].nodeType != 1)
        {
            continue;
        }
    
        var menu = topMenus[i];
        
        if (menu.id == id)
        {
            ToggleSubMenus(menu, true);
        }
        else
        {
            ToggleSubMenus(menu, false);
        }
    }
    
    toggling = false;
    */
}

function ToggleSubMenus(menu, display)
{
    // Disabling menu animation for now
    /*
    var subMenus = menu.getElementsByTagName("div");
            
    for (var i = 0; i < subMenus.length; i++)
    {
        if (subMenus[i].parentNode != menu)
        {
            continue;
        }
        
        if (display)
        {
            if (subMenus[i].style.display == "none")
            {
                Animation(subMenus[i]).to("height", "auto").from("0px")
                    .to("opacity", 1).from(0).blind().show().duration(200).go();
            }
        }
        else
        {
            if (subMenus[i].style.display != "none")
            {
                Animation(subMenus[i]).to("height", "0px").to("opacity", 0).hide().duration(200).go(); 
            }
        }
    }
    */
}

/*$(function() {
    var currentFile = window.location.href.substring(window.location.href.lastIndexOf('/') + 1)
        .replace(window.location.hash, "").replace(window.location.search, "");
    var navElement = $("#Nav a[href=" + currentFile + "]");
    
    if (navElement.length > 0) {
        var backgroundImage = navElement.css("background-image");
        navElement.css("background-image", backgroundImage.replace(".gif", "-Hover.gif"));
    }
});*/