// JavaScript Document
jQuery(function($){
	var index = 0;
	$('<div id="flow" class="flow1"></div>').appendTo("#myjQuery");

	//滑动导航改变内容	
	$("#myjQueryNav li").hover(function(){
		if(MyTime){
			clearInterval(MyTime);
		}
		index  =  $("#myjQueryNav li").index(this);
		MyTime = setTimeout(function(){
		ShowjQueryFlash(index);
		$('#myjQueryContent').stop();
		} , 100);

	}, function(){
		clearInterval(MyTime);
		MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==imgnum){index=0;}
		} , 6000);
	});
	//滑入 停止动画，滑出开始动画.
	 $('#myjQueryContent').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
				MyTime = setInterval(function(){
				ShowjQueryFlash(index);
				index++;
				if(index==imgnum){index=0;}
			  } , 6000);
	 });
	//自动播放
	var MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==imgnum){index=0;}
	} , 6000);
});
function ShowjQueryFlash(i) {
$("#myjQueryContent div").eq(i).animate({opacity: 1},1500).css({"z-index": "1"}).siblings().animate({opacity: 0},1500).css({"z-index": "0"});
$("#flow").animate({ left: i*20+520+"px"}, 700); //滑块滑动
var n= i+1;
$("#flow").attr("class","flow"+n);
$("#myjQueryNav li").eq(i).addClass("current").siblings().removeClass("current");
}
