/**
 * JQuery Plugin to ....
 */
(function($) {

	
	
	$.fn.showmorelist = function(options) {
	       var config = jQuery.extend({
	            // Default options:
	            'maxEntries': 7,
	            'showMoreLabel': 'Show More',
	            'showLessLabel': 'Show less'
	        }).extend(options);
	       if ($('li',$(this)).size() > config.maxEntries) {
		       var entryNumber = 1;
		       $('li',$(this)).each(function() {
		    	   if (entryNumber > config.maxEntries) {
		    		 $(this).hide();   
		    	   }
		    	   entryNumber++;
		       });
		       $('.showMoreList a.more',$(this)).live('click',function() {
		    	   var list = $(this).closest('ul');
		    	   if ($('.dotDotDot:visible',list).size() > 0) {
		    		   $('li',list).show();
		    		   $(this).html(config.showLessLabel);
		    		   $('.dotDotDot:visible',list).hide();
			    	   $(this).removeClass(",more");
			    	   $(this).addClass("less");
		    		   return false;
		    	   }
		    	   $('li:gt(10)',list).hide();
		    	   $(this).closest('li').show();
		    	   $(this).html(config.showMoreLabel);
		    	   $(this).removeClass("less");
		    	   $(this).addClass("more");
		    	   $('.dotDotDot',list).show();
		    	   return false;
		       });
		       $(this).append('<li class="dotDotDot">...</li>');
		       $(this).append('<li class=\"showMore\"><a href=\"#\" class=\"more\"><span>'+config.showMoreLabel+'</span></a></li>');
		       
	       }	
	};
	
})(jQuery);
