﻿


$(function(){
	function ShowjQueryFlash(i) {
	$(".wrap_images a").eq(i).animate({opacity: 1},1000).css({"z-index": "1"}).siblings().animate({opacity: 0},1000).css({"z-index": "0"});
	$(".tab_images li").eq(i).addClass("checked").siblings().removeClass("checked");
	}		   
	var index = 0;
	//自动播放
	var MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==4){index=0;}
	} , 3000);	
	
	//滑入 停止动画，滑出开始动画.
	 $('.wrap_images').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
				MyTime = setInterval(function(){
				ShowjQueryFlash(index);
				index++;
				if(index==4){index=0;}
			  } , 3000);
	 });	

	//滑动导航改变内容
	$(".tab_images li").hover(function(){
		if(MyTime){
			clearInterval(MyTime);
		}
		index  =  $(".tab_images li").index(this);
		MyTime = setTimeout(function(){
		ShowjQueryFlash(index);
		$('.wrap_images a').stop();
		} , 400);

	}, function(){
		clearInterval(MyTime);
		MyTime = setInterval(function(){
		ShowjQueryFlash(index);
		index++;
		if(index==4){index=0;}
		} , 3000);
	});

});


var startmarquee=function(targetId,lh,speed,delay){var t;var p=false;var o=document.getElementById(targetId);o.style.overflow="hidden";var html=o.innerHTML;o.innerHTML+=html;o.innerHTML+=html;o.onmouseover=function(){p=true};o.onmouseout=function(){p=false};o.scrollTop=0;function start(){try{t=setInterval(scrolling,speed);if(!p)o.scrollTop=parseInt(o.scrollTop)+1;}catch(e){clearInterval(t);}}
function scrolling(){if(typeof o=="undefined"){return;}
if(o.scrollTop%lh!=0){o.scrollTop+=1;if(o.scrollTop>=o.scrollHeight/3)o.scrollTop=0;}else{clearInterval(t);setTimeout(start,delay);}}
setTimeout(start,delay);}
