﻿// global.js
// @requires prototype.js

addEvent(window, 'load', function() {
    // if the viewport size is greater than the height of
    // containerHeight, remove the padding from
    // the bottom of the container i.e. #aspnetForm
    var wrapper = $("aspnetForm");
    var containerHeight = Element.getHeight(wrapper);
    var viewportHeight = getViewportSize()[1];
    
    if (containerHeight < viewportHeight) {
        wrapper.style.paddingBottom = "0";
    }
});


function getViewportSize() {
    var size = [0, 0];
    if (typeof window.innerWidth != 'undefined') {
        size = [
            window.innerWidth,
            window.innerHeight
            ];
    } else if (typeof document.documentElement != 'undefined' && 
            typeof document.documentElement.clientWidth != 'undefined' && 
            document.documentElement.clientWidth != 0) {
        
        size = [
            document.documentElement.clientWidth,
            document.documentElement.clientHeight
            ];
    } else {
        size = [
            document.getElementsByTagName('body')[0].clientWidth,
            document.getElementsByTagName('body')[0].clientHeight
            ];
    }
    return size;
}