/*

	slideShow - shoproi index.html jQuery Content slide Plugin
	Author: ajie
	
*/
/*
<div class="slide">
			
	<a target="blank"  href="/themes/default/zt/20100519/">
		<img src="/themes/default/images/ind/del_04.jpg" style="display:block" />
	</a>
	<a target="blank"  href="/themes/default/zt/20100519/">
		<img src="/themes/default/images/ind/del_03.jpg" />
	</a>
	<a target="blank"  href="/themes/default/zt/20100519/">
		<img src="/themes/default/images/ind/del_07.jpg" />
	</a>

	<ul class="slidebar">
		
		<li class="act">sssss<i></i></li>
		<li>sss<i></i></li>
		<li>ss<i></i></li>
		
	</ul>

</div>

$('.slide').slideShow();
*/
(function($){
	$.fn.slideShow = function() {	
		var id = this;
		var slideTime = 6000;
		var currtCss = 'act';
		
		var $active = 0, play,$id = $(id),$img = $id.find('.img img'),$numb = $id.find('li');
		function showItem() {
			$numb.eq($active).addClass(currtCss);		
			$numb.eq($active).siblings().removeClass(currtCss);				
			$cur = $img.eq($active);			
			$cur.fadeIn();
			$img.not($cur).hide();			
		};
		function rotateSwitch() {
			play = setInterval(function(){
				
				if ( $active == $numb.length) { 
						$active = 0; 
					}	

				showItem();
				
				$active++;
				
				
			},slideTime);
		};
		
		rotateSwitch();
		
		$numb.hover(function(){

			if(play) clearInterval(play);
			
			$active = $(this).index();
			
			showItem();
			
		},function(){
			
			rotateSwitch();
			
		});

	}
	
	$(function(){ $(".slide").slideShow(); }); 
})(jQuery);

