﻿jQuery.fn.center = function() {
    return this.each(function() {
        var t = jQuery(this);

        t.css({
            position: 'absolute',
            left: '50%',
            top: '40%',
            zIndex: '99'
        }).css({
            marginLeft: '-' + (560 / 2) + 'px',
            marginTop: '-' + (560 / 2) + 'px'
        });
        t.css({
            marginTop: parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(),
            marginLeft: parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
        });

    });

};