
function hideMenu() {
    setMenuVisibility("hidden");
}    

function showMenu() {
    setMenuVisibility("visible");
}

function setMenuVisibility(visibility) {
    var menu = document.getElementById("menu-container");
    if (menu) {
        menu.style.visibility = visibility;
    }
    var px = document.getElementById("px-container");
    if (px) {
        var menuWidth = getMenuWidth();
        px.style.left = menuWidth + "px";
        px.style.width = document.body.clientWidth-menuWidth;
        // in IE versions below 8.0, generate a dynamic expression for px iframe width;
        // other browsers will calculate the width automatically
        if (px.style.getExpression) {
            var IE8below,idx = navigator.userAgent.indexOf("MSIE")>-1;
            // in IE8 getExpression("width") throws "Not implemented"
            IE8below = (idx>-1) ? Number(navigator.userAgent.substr(idx+5,3)) < 8  : false;
            if (IE8below && px.style.getExpression("width")) {
                px.style.setExpression("width", "document.body.clientWidth - " + menuWidth);
            }    
        }
    }
}

function getMenuWidth() {
    var menu = document.getElementById("menu-container");
    if (menu && menu.style.visibility != "hidden") {
        return menu.offsetWidth;
    } else {
        return 0;
    }
}

function currentWidth() {
    var w = document.body.clientWidth;
    if (w > 1000) w = 1000;
    return w;
}

function currentBlkWidth() {
    return currentWidth() - 50;
}

function hideLogo() {
    setLogoVisibility("hidden");
}    

function showLogo() {
    setLogoVisibility("visible");
}

function setLogoVisibility(visibility) {
    var logo = document.getElementById("logo-container");
    if (logo) {
        logo.style.visibility = visibility;
        var logoHeight = getLogoHeight();
        var px = document.getElementById("px-container");
        if (px) {
            px.style.top = logoHeight + "px";
            px.style.height = document.body.clientHeight - logoHeight;
            // in IE versions below 8.0, generate a dynamic expression for px iframe width;
            // other browsers will calculate the width automatically
            if (px.style.getExpression) {
                var IE8below,idx = navigator.userAgent.indexOf("MSIE")>-1;
                // in IE8 getExpression("width") throws "Not implemented"
                IE8below = (idx>-1) ? Number(navigator.userAgent.substr(idx+5,3)) < 8  : false;
                if (IE8below && px.style.getExpression("height")) {
                    px.style.setExpression("height", "document.body.clientHeight - " + logoHeight);
                }    
            }
        }
        var menu = document.getElementById("menu-container");
        if (menu) {
            menu.style.top = logoHeight + "px";
            menu.style.height = document.body.clientHeight - logoHeight;
        }
    }
}

function getLogoHeight() {
    var logo = document.getElementById("logo-container");
    if (logo && logo.style.visibility != "hidden") {
        return logo.offsetHeight;
    } else {
        return 0;
    }
}

