﻿function AddLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

function AdjustColumnsHeight() {
    // get a reference to the DIVS that make up the columns
    //content will be the tallest as it fills to contain the content columns but has a minumum height as well
    var vContent = new Array('main_content');
    var vSideBar = new Array('content_side_bar');
    for (i = 0; i < vContent.length; i++) {
        var contentId = vContent[i];
        var sidebarId = vSideBar[i];
        var content = window.document.getElementById(contentId);
        var sidebar = window.document.getElementById(sidebarId);
        // calculate the max height
        var content_height = content.offsetHeight;
        var sidebar_height = sidebar.offsetHeight + 1;
        var maxHeight = Math.max(sidebar_height, content_height);
        // set the height of DIVS to the max height
        content.style.height = maxHeight + 'px';
        sidebar.style.height = maxHeight + 'px';
    }
}

