(function($){
$.fn.myPlayer=function(options){
	var defaults={
		speed:500,
		time:2500,
		picCell:'ul li',
		listCell:'ol li',
		currentClass:'current'
		}
	var opt = $.extend(defaults, options); 
	this.each(function(){
		var obj=$(this);			   
		var amount=0;
		var $tag=obj.find(opt.picCell);
		var $list=obj.find(opt.listCell);
		var len=$tag.length;
		var tagWidth=$tag.outerWidth();
		var tagHeight=$tag.outerHeight();
		var boxWidth=len*tagWidth;
		var boxHeight=len*tagHeight;
		var timer=setInterval(starPlay,opt.time);
		var dir=opt.direction;
		
		
		$list.eq(0).addClass(opt.currentClass);
		$list.bind('click mouseenter',function(){
			i=$list.index(this);
			$(this).addClass(opt.currentClass).siblings(opt.listCell).removeClass(opt.currentClass);	
			$tag.css('float','left').parent().css({'width':boxWidth,'position':'absolute'}).stop(true,true).animate({left:-i*tagWidth},opt.speed);
			amount=i;
		})	
		obj.hover(
			function(){clearInterval(timer);},
			function(){timer=setInterval(starPlay,opt.time);
		})
		function starPlay(){		
			amount++;
			if(amount > len-1){amount = 0;}
			$list.eq(amount).trigger('click');
		}	

		})
	}        
})(jQuery);
