jQuery.fn.center = function () {
    this.css("position","absolute");
	if ($(window).height() > this.height()) {
    	this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	} else {
		this.css("top", "0px");
	}
	if ($(window).width() > this.width()) {
    	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	} else {
		this.css("left", "0px");
	}
    return this;
}