function WindowHandler() {
    this.Width = 0;
    this.Height = 0;
    this.ScrollX = 0;
    this.ScrollY = 0;
    this.MouseX = 0;
    this.MouseY = 0;
    this.Init = function () {
        this.GetWindowSize();
        this.GetScrollXY();
        var WindowHandler = this;
        AttachEvent(document, "mousemove", function (e) { WindowHandler.GetMouseXY(WindowHandler, e) }, true);
        AttachEvent(window, "resize", function (e) { WindowHandler.GetWindowSize(WindowHandler, e); WindowHandler.Resize(); }, true);
        AttachEvent(window, "scroll", function (e) { WindowHandler.GetScrollXY(WindowHandler, e) }, true);
    }

    this.Resize = function () {

    }
    this.GetWindowSize = function () {
        var e = null;
        var WindowHandler;
        if (arguments[0] != null)
            WindowHandler = arguments[0];
        else
            WindowHandler = this;
        if (arguments[1] != null)
            e = arguments[1];
        if (typeof (window.innerWidth) == 'number') {
            //Non-IE
            WindowHandler.Width = window.innerWidth;
            WindowHandler.Height = window.innerHeight;
        } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            //IE 6+ in 'standards compliant mode'
            WindowHandler.Width = document.documentElement.clientWidth;
            WindowHandler.Height = document.documentElement.clientHeight;
        } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            //IE 4 compatible
            WindowHandler.Width = document.body.clientWidth;
            WindowHandler.Height = document.body.clientHeight;
        } else {
            AttachEvent(document, "load", function (e) { WindowHandler.GetWindowSize(this, e); }, true);
        }
        /*if ((this.Width < 1) || (this.Height < 1)) {
        alert("Window Resolution failed!");
        return null;
        }*/
        var ret = new Array(2);
        ret[0] = WindowHandler.Width;
        ret[1] = WindowHandler.Height;
        return ret;
    }

    this.GetScrollXY = function () {
        var e = null;
        if (arguments[0] != null)
            WindowHandler = arguments[0];
        else
            WindowHandler = this;
        if (arguments[1] != null)
            e = arguments[1];
        if (typeof (window.pageYOffset) == 'number') {
            //Netscape compliant
            WindowHandler.ScrollY = window.pageYOffset;
            WindowHandler.ScrollX = window.pageXOffset;
        } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            //DOM compliant
            WindowHandler.ScrollY = document.body.scrollTop;
            WindowHandler.ScrollX = document.body.scrollLeft;
        } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            //IE6 standards compliant mode
            WindowHandler.ScrollY = document.documentElement.scrollTop;
            WindowHandler.ScrollX = document.documentElement.scrollLeft;
        }
        var ret = new Array(2);
        ret[0] = WindowHandler.ScrollX;
        ret[1] = WindowHandler.ScrollY;
        return ret;
    }
    this.GetMouseXY = function () {
        var e = null;
        if (arguments[0] != null)
            WindowHandler = arguments[0];
        else
            WindowHandler = this;
        if (arguments[1] != null)
            e = arguments[1];
                                    
        var IE = document.all ? true : false
        var tempX, tempY;
        //alert(event.clientX + document.body.scrollLeft);
        if (IE) {
            try
            {
                if(document.body.scrollLeft == null || document.body.scrollLeft == undefined)                                        
                    tempX = event.clientX;
                else
                    tempX = event.clientX + document.body.scrollLeft;
                if(document.body.scrollTop == null || document.body.scrollTop == undefined)                                        
                    tempY = event.clientY;
                else
                    tempY = event.clientY + document.body.scrollTop;
            }
            catch(ex)
            {
                if(document.body != null && document.body.scrollLeft != null){
                    tempX = e.clientX + document.body.scrollLeft;
                    tempY = e.clientY + document.body.scrollTop; 
                }else{
                    tempX = e.pageX;
                    tempY = e.pageY; 
                }
            }
        } else {
            tempX = e.pageX
            tempY = e.pageY
        }
        if (tempX < 0) { tempX = 0 }
        if (tempY < 0) { tempY = 0 }
        WindowHandler.MouseX = tempX;
        WindowHandler.MouseY = tempY;
        var ret = new Array(2);
        ret[0] = WindowHandler.MouseX;
        ret[1] = WindowHandler.MouseY;
        return ret;
    }
    this.Init();
}


var Window = new WindowHandler();
