﻿function jsCols() {
    // The height of the right column automatically expands the main column and expanded panel without JS in FF/IE7
    // Need JS solution for IE6.

    mainHeight = $("#mainContent").height();
    totalMainHeight = mainHeight + 145; // Add "margin-top: 145px" to give full height

    rightHeight = $("#rightPanel .content").height();
    defaultRightHeight = rightHeight; // Used to restore the original right panel height if rightHeight changes.
    totalRightHeight = rightHeight + 50; // Add "padding-top: 40px" and "padding-bottom: 10px" to give full height

    expandedHeight = $("#expandedPanel").height();

    // Do this on page load:
    // If #mainContent is taller than #rightPanel, expand #rightPanel (and #expandedPanel)
    if (totalMainHeight > totalRightHeight) {
        $("#rightPanel .content").height(mainHeight + 95); // (mainContent + vertical margin) - (rightPanel + vertical padding) =  145 - 50 = 95
        rightHeight = $("#rightPanel .content").height();
        totalRightHeight = rightHeight + 50;
    }
}

function SizeRightPanel() {
    expandedHeight = $("#expandedPanel").height();
    // Increase height of #rightPanel to accommodate #expandedPanel
    if (expandedHeight > totalRightHeight) {
        $("#rightPanel .content").height(expandedHeight - 50);
    }
}