jQuery.fn.center = 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(document).ready(function($) {

	/* center elements on the page */
	$(window).resize(function() {
		$('.pagecenter').delay(10).center().show();
	});

	$('.pagecenter').center().show();
});
