/*Globals*/
function Globals(){}
Globals.getPageScroll = function () {
    var yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {
        yScroll = document.body.scrollTop;
    }
    var xScroll;
    if (self.pageXOffset) {
        xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollLeft) {
        xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {
        xScroll = document.body.scrollLeft;
    }
    return new Array(xScroll, yScroll);
}
Globals.getCacheBuster = function(){
    var f = Math.random();
    return "cb=" + encodeURIComponent(f);
}
Globals.getPageSize = function () {
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) {
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else {
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight) {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    }
    if (!window.webkit)
    {
        /*modified by PM to prioritise clientWidth*/
        if (document.documentElement && document.documentElement.clientHeight) {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        }  
        /*modified by PM to prioritise body element over documentElement element*/
        if (document.body) {
            bodywindowWidth = document.body.clientWidth;
            bodywindowHeight = document.body.clientHeight;
            if (bodywindowWidth < windowWidth)
                windowWidth = bodywindowWidth;
            if (bodywindowHeight < windowHeight)
                windowHeight = bodywindowHeight;
        }
    }
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }
    if (xScroll < windowWidth) {
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }
    return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
}
Globals.cancelEvent = function (e) {
    if (e.stopPropagation) {
        e.stopPropagation();
    } else {
        e.cancelBubble = true;
    }
}