// vertical positioning in the viewport

(function($) {
    $.fn.Centre = 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;
            },
            wWidth: function() {
                return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body.clientWidth;
            }
        };
        return this.each(function(index) {
            if (index == 0) {
                var $this = $(this);
                var elHeight = $this.height();
                var elWidth = $this.width();
                var elTop = pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2);
                var elLeft = (pos.wWidth() / 2) - (elWidth / 2) - 10;
                $this.css({
                    position: 'absolute',
                    marginTop: '0',
                    top: elTop,
                    left: elLeft
                });


            }
        });
    };

})(jQuery);


