(function($){
	$.fn.more = function (options) {
		$.fn.more.initialize(options);
		$.fn.more.self = this;
		this.click(function(event){
			if ($.fn.more.status == 'more') {
				$.fn.more.show();
			} else {
				$.fn.more.hide();
			}
			event.preventDefault();
			event.stopPropagation();
		});
	};

	$.fn.more.show = function () {
		$('.' + this.options.moreParagraphClass).each(function(){
			$this = $(this);
			if ($this.context.nodeName.toLowerCase() != 'a') {
				$this.show();
				if ($this.context.nodeName.toLowerCase() == 'li') {
					$this.css('display', 'list-item');
					$this.css('list-style-position', 'inside');
				}
			}
		});
		$.fn.more.status = 'less';
		$.fn.more.self.text(this.options.moreLessLinkLabel);
	}

	$.fn.more.hide = function () {
		$('.' + this.options.moreParagraphClass).each(function(){
			$this = $(this);
			if ($this.context.nodeName.toLowerCase() != 'a') {
				$this.hide();
			}
		});
		$.fn.more.self.text(this.options.moreLinkLabel);
		$.fn.more.status = 'more';
	}

	$.fn.more.initialize = function (options) {
		options = options || {};
		$.extend(this.options, options);		
	}

	$.fn.more.options = {
		moreLinkLabel: 'More ...', 
		moreLessLinkLabel: 'Less ...', 
		moreParagraphClass: 'more'
	};

	$.fn.more.status = 'more';

	$.fn.more.self = null;
})(jQuery);
