﻿jQuery.fn.center = function() {
    this.css("position", "absolute");
    //this.animate({ "left": "+=50px" }, "slow");
    this.animate({ "top": (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px" }, "slow");
    this.animate({ "left": (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px" }, "slow");
    //this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
    //this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
    return this;
}
