;(function($) {
	$.fn.align = function(options) {
		return this.each(function() {
			var $settings = jQuery.extend(true, {}, $.fn.align.defaults, options);
			var $this = $(this);
			
			switch ($settings.direction) {
			case 'bottom':
				var offsetTop = 0;
				$this.prevAll(":not(.linked-image)").each(function() {					
					offsetTop += $(this).outerHeight();
				});

				$("p:first", $this).css("margin-top", "0px");
				$("p:last", $this).css("margin-bottom", "0px");
				
				$this.css("padding-top", Number($this.parent().height() - $this.outerHeight() - offsetTop )+"px");
				break;
			case 'right':
				$this.css("text-align", "right");
				break;
			case 'left':
				$this.css("text-align", "left");
				break;
			}
			
			
			return null;
		});
	};

	$.fn.align.defaults = {
		direction : 'bottom'
	};
})(jQuery);

