function WindowInfo() {

}

WindowInfo.prototype.getScrollPos = function() {
    var scrollX = 0, scrollY = 0;
    if (typeof(document.body.scrollTop) != 'undefined' && typeof(document.body.scrollLeft) != 'undefined') {
        scrollX = document.body.scrollLeft;
        scrollY = document.body.scrollTop;
        if (document.body.scrollTop == 0 && document.documentElement && typeof(document.documentElement.scrollTop) != 'undefined') {
            scrollX += document.documentElement.scrollLeft;
            scrollY += document.documentElement.scrollTop;
        }	
    }
    else if (typeof(window.pageXOffset) != 'undefined' && typeof(window.pageYOffset) != 'undefined') {
        scrollX = window.pageXOffset;
        scrollY = window.pageYOffset;
    }
    return {x: scrollX, y: scrollY};
}


WindowInfo.prototype.getWindowSize = function() {
    var innerWidth = 0, innerHeight = 0;
    if (typeof(window.innerWidth) != 'undefined' && window.innerWidth) {
        innerWidth  = window.innerWidth;
        innerHeight = window.innerHeight;
    }
    else if (typeof(document.body.parentElement.clientWidth) != 'undefined' && document.body.parentElement.clientWidth) {
        innerWidth  = document.body.parentElement.clientWidth;
        innerHeight = document.body.parentElement.clientHeight;
    }
    else if (typeof(document.body.clientWidth) != 'undefined' && document.body.clientWidth) {
        innerWidth  = document.body.clientWidth;
        innerHeight = document.body.clientHeight;
    }
    return {width: innerWidth, height: innerHeight};
}

WindowInfo.prototype.getScreenCenter = function() {
    var scroll = this.getScrollPos();
    var windowSize = this.getWindowSize();

    return {x: Math.round(windowSize.width/2) + scroll.x, y: Math.round(windowSize.height/2) + scroll.y};
}


var windowInfo = new WindowInfo();