/*-------------------------------------------------------
* 说明：基于jQuery编写
* 作者：Gavin
* 创建时间：2008-10-27
* 最后一次修改时间：2009-03-04 
-------------------------------------------------------*/
(function($){
	//插件定义
	$.fn.smoothShow = function(options){
		//扩展默认参数
		var opts = $.extend({}, $.fn.smoothShow.defaults, options);
		return this.each(function(){
			var $this = $(this);
			var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
			var $ul = $this.find("ul");
			var $li = $ul.find("li");
			var total = $li.size();
			var active = 0;
			var myInterval = null;
			
			function slideShow(){
				$li.filter(":eq("+ active +")").animate({
				   opacity: 'show'
				 }, o.speed).siblings().animate({
				  opacity: 'hide'
				 });
				active++;
				if(active >= total) active=0;
			};
			
			//悬停
			$this.hover(
				function(){
					clearInterval(myInterval);
				},
				function(){
					myInterval=setInterval(slideShow,o.delay);
				}
			);
			
			// run!
			slideShow();
			myInterval=setInterval(slideShow, o.delay);
			
		});
	};
	
	//默认参数
	$.fn.smoothShow.defaults = {
		delay		: 3000,		//间隔时间
		speed		: 500		//每次次滚动时间
	};
})(jQuery);