(function($){  
	$.fn.extend({
		centerY: function() {
			return this.each(function() {
				var obj = $(this);
				obj.css("position","absolute");
				obj.css("top", ( $(window).height() - obj.height() ) / 2+$(window).scrollTop() + "px");
			});
		},
		centerX: function() {
			return this.each(function() {
				var obj = $(this);
				obj.css("position","absolute");
				obj.css("left", ( $(window).width() - obj.width() ) / 2+$(window).scrollLeft() + "px");
			});
		},
		center: function() {
			return this.each(function() {
				var obj = $(this);
				obj.centerY();
				obj.centerX();
			});
		}
	});
})(jQuery); 
