//
// Gets the window height in pixels
//
function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body && document.body.clientHeight) {
        windowHeight = document.body.clientHeight;
    }
    return windowHeight;
}

//
// Gets the window width in pixels
//
function getWindowWidth() {
    var windowWidth = 0;
    if (typeof(window.innerWidth) == 'number') {
        windowWidth = window.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth) {
        windowWidth = document.documentElement.clientWidth;
    } else if (document.body && document.body.clientWidth) {
        windowWidth = document.body.clientWidth;
    }
    return windowWidth;
}

//
// Resizes the root-level panes
//
function resizePanes() {
    var windowHeight = getWindowHeight();

    var wrapper = document.getElementById("wrapper");
    if (window.outerHeight < windowHeight)
    {
        wrapper.style.height = windowHeight + "px";
    }
    else
    {
        wrapper.style.height = (window.outerHeight - 100) + "px";
    }

    window.onresize = resizePanes;
}
