function displaySubMenu (iPMenuIndex)
{
    // local variables
    var objSubMenuItem;

    // hide all sub menues
    hideSubMenues();

    // try to get first sub menu item of selected menu
    try
    {
        objSubMenuItem = document.getElementById ("m" + ((iPMenuIndex <= 9) ? "0" + iPMenuIndex : iPMenuIndex)).firstChild;
    } 
    catch (e)
    {
        // no sub menue items, so nothing to display
        return;
    }     

    // display all sub menu items of selected menu
    while (objSubMenuItem != null)
    {
        if (objSubMenuItem.nodeName == "DIV")
            objSubMenuItem.style.display = "block";

        objSubMenuItem = objSubMenuItem.nextSibling;
    }
}


function hideSubMenues()
{
    // local variables
    var objMenuItem;
    var objSubMenuItem;

    // try to get first menu item
    try
    {
        objMenuItem = document.getElementById ("menu").firstChild;
    }
    catch (e)
    {
        // no menu item, so nothing to hide
        return;
    }

    // hide all sub menues one by one
    while (objMenuItem != null)
    {
        try 
        {
            objSubMenuItem = objMenuItem.firstChild;
        }
        catch (e)
        {
            // no sub menue items, so nothing to hide
            continue;
        }

        // hide all sub menu items of current menu
        while (objSubMenuItem != null)
        {
            if (objSubMenuItem.nodeName == "DIV")
                objSubMenuItem.style.display = "none";

            objSubMenuItem = objSubMenuItem.nextSibling;
        }

        objMenuItem = objMenuItem.nextSibling;
    }
}


function changeFirstPage()
{
    switch (top.location.search.length)
    {
        case 3:
        case 5:
            parent.frames[2].location.href = "../content/page" + top.location.search.substring (1, 3) + "/page" + top.location.search.replace ('?', '') + ".html";
            break;

        case 7:
            parent.frames[2].location.href = "../content/page" + top.location.search.substring (1, 3) + "/page" + top.location.search.substring (1, 5) + "/page" + top.location.search.replace ('?', '') + ".html";
            break;

        default:
            break;
    }
}


function reloadFullPage (strPFirstPage)
{
    switch (strPFirstPage.length)
    {
        case 0:
            try {
                if (parent.frames[1].name != "navigation")
                    top.location = window.location.href = "../index.html";
            } catch (e) {
                top.location = window.location.href = "../index.html";
            }
            break;
        case 2:
        case 4:
            try {
                if (parent.frames[1].name != "navigation")
                    top.location = window.location.href = "../../index.html?" + strPFirstPage;
            } catch (e) {
                top.location = window.location.href = "../../index.html?" + strPFirstPage;
            }
            break;
        case 6:
            try {
                if (parent.frames[1].name != "navigation")
                    top.location = window.location.href = "../../../index.html?" + strPFirstPage;
            } catch (e) {
                top.location = window.location.href = "../../../index.html?" + strPFirstPage;
            }
            break;
        default:
            break;
    }
}

