(function($) {
    $.fn.vCenter = function(options) {
        var pos = {
            sTop: function() {
                return window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
            },
            wHeight: function() {
                return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight;
            }
        };

        return this.each(function(index) {
            if (index == 0) {
                var $this = $(this);
                var elHeight = $this.height();
                var elTop = pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2);
                $this.css({
                    position: 'absolute',
                    marginTop: '0',
                    top: elTop
                });
            }
        });
    };
    $.fn.hCenter = function(options) {
        var windowWidth;
        if (typeof (window.innerWidth) == 'number')
            windowWidth = window.innerWidth;
        else if (document.documentElement && document.documentElement.clientWidth)
            windowWidth = document.documentElement.clientWidth;
        else if (document.body && document.body.clientWidth)
            windowWidth = document.body.clientWidth;
        else
            windowWidth = 800;

        return this.each(function(index) {
            if (index == 0) {
                var $this = $(this);
                var elWidth = $this.width();
                $this.css({
                    position: 'absolute',
                    left: windowWidth / 2 - elWidth / 2
                });
            }
        });
    };
    $.fn.hvCenter = function(options) {
        $(this).vCenter($(this));
        $(this).hCenter($(this));
    }
    $.fn.fullScreen = function(options) {
        var windowWidth;
        if (typeof (window.innerWidth) == 'number')
            windowWidth = window.innerWidth;
        else if (document.documentElement && document.documentElement.clientWidth)
            windowWidth = document.documentElement.clientWidth;
        else if (document.body && document.body.clientWidth)
            windowWidth = document.body.clientWidth;
        else
            windowWidth = 800;
        var windowHeight = window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight

        $(this).css({
            position: 'absolute',
            top: 0,
            left: 0,
            width: windowWidth,
            height: windowHeight
        });
    }
})(jQuery);
