/************************************************** extra #bd padding *********************************/
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    }
    else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}


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;
}

function setFooter() {

    if (document.getElementById('hd') && document.getElementById('bd') && document.getElementById('global-chrome-content')) {
        document.getElementById('global-chrome-content').style.display = 'block';

        var windowHeight = getWindowHeight();
        var hdHeight = document.getElementById('hd').offsetHeight;
        var bdHeight = document.getElementById('bd').offsetHeight;
        var ftHeight = document.getElementById('global-chrome-content').offsetHeight;
        var diff = (windowHeight - (hdHeight + bdHeight)) - ftHeight;
        if (diff >= 0) {
            document.getElementById('bd').style.paddingBottom = (diff - 30) + 'px';
        }
    } //end:if
}
addLoadEvent(setFooter);
window.onresize = function() { setFooter(); }
/************************************************** end: extra #bd padding *********************************/
