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) {
        var footerElement = document.getElementById('footer');
        footerElement.style.height = '35px';
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            var contentHeight = document.getElementById('pagebody').offsetHeight;
            var footerHeight  = footerElement.style.height;
            footerHeight = parseInt(footerHeight.replace('px',""));
/*            alert(windowHeight);
            alert(footerHeight);
            alert(contentHeight);*/
            if (windowHeight > (footerHeight + contentHeight + 50)) {
                //alert(true);
                footerElement.style.top = windowHeight - footerHeight - contentHeight - 50 + 'px';
            }
        }
    }
}
function setBodyContent() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        var headerHeight = document.getElementById('header').offsetHeight;
        
   
        var windowHeight = getWindowHeight();
        var contentHeight = windowHeight-850;
        if (windowHeight > 0) {
            var bodyElement = document.getElementById('main_body');
            if (windowHeight <=750) {
                document.getElementById('pagebody').style.height = '850px';
                document.getElementById('mia').style.height = '750px';
            } else {
                bodyElement.style.top = contentHeight+'px';
            }
        }
    }
    
}

window.onload = function() {
    //setBodyContent();
    setFooter();
}
window.onresize = function() {
    //setBodyContent();
    setFooter();
}
