var s = document.getElementsByTagName('script');
var a = s[s.length-1].getAttribute('data');
$(function(){

/* soChange plugins */
		$('#change_2 .a_bigImg img').soChange({
			botPrev:'#change_2 .a_last',//按钮，上一个
			botNext:'#change_2 .a_next'//按钮，下一个
		});

/* focus */
	var index = 0;
	$('<div id="flow"></div>').appendTo("#myjQuery");

	//滑动导航改变内容	
	$("#myjQueryNav li").hover(function(){
		if(MyTime){
			clearInterval(MyTime);
		}
		index  =  $("#myjQueryNav li").index(this);
		MyTime = setTimeout(function(){
		ShowjQueryFlash(index);
		$('#myjQueryContent').stop();
		} , 400);

	}, function(){
		clearInterval(MyTime);
		MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==4){index=0;}
		} , 3000);
	});
	//滑入 停止动画，滑出开始动画.
	 $('#myjQueryContent').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
				MyTime = setInterval(function(){
				ShowjQueryFlash(index);
				index++;
				if(index==4){index=0;}
			  } , 3000);
	 });
	//自动播放
	var MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==4){index=0;}
	} , 3000);

/* switchable[all] plugins */
		$("#trigger4").switchable("#panel4 > ul > li", {
			triggerType: "click",
			effect: "scroll",
			steps: 1,
			visible: a
		}).autoplay().carousel().mousewheel();
		
		var api4 = $("#trigger4").switchable();
		$("#next4").click(function(){
			api4.next();
		});
		$("#prev4").click(function(){
			api4.prev();
		});

	$('a.kf').colorbox({width:"706px", height:"540px", iframe:true, overlayClose:false, opacity:0.6});

});

function ShowjQueryFlash(i) {
	$("#myjQueryContent div").eq(i).animate({opacity: 1},1000).css({"z-index": "1"}).siblings().animate({opacity: 0},1000).css({"z-index": "0"});
	$("#flow").animate({ left: i*111+5 +"px"}, 300 ); //滑块滑动
	$("#myjQueryNav li").eq(i).addClass("current").siblings().removeClass("current");
}
