/*
* jQuery centR 0.1 by Pierre Bertet (pierrebertet.net), based on an original idea by Raphaël Bastide (raphaelbastide.com)
* Licensed under the MIT LICENSE ( http://www.opensource.org/licenses/mit-license.php )
*/
(function($){
	$.fn.centR = function(){
		return this.each(function(){
			var $this = $(this);
			var $thisWidth = $this.outerWidth();
			var $parent = $this.parent();
			var $parentWidth = $parent.outerWidth();
			
			if ($thisWidth > $parentWidth) {
				$this.css({
					position: "relative",
					left: ( $parentWidth/2
			                  - $thisWidth/2
			                  - $parent.css("borderLeftWidth").slice(0,-2)
			                  - $parent.css("paddingLeft").slice(0,-2)
			                ) + "px"
				});
			}
		});
	};
})(jQuery);
