﻿jQuery.fn.centerOnScreen = function () {
    this.css("position", "absolute");
    this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
    return this;
}
jQuery.fn.centerOnElement = function (element) {
    this.css("position", "absolute");
    this.css("top", ($(element).height() - this.height()) / 2 + $(element).offset().top + "px");
    this.css("left", ($(element).width() - this.width()) / 2 + $(element).offset().left + "px");
    return this;
}
