﻿// JavaScript Document
$(document).ready(function(){
	var index=0;
	
	
	
	$("#picTitle > li").hover(function(){
									   if(myTime){
										   clearInterval(myTime);
									   }
									   index=$("#picTitle > li").index(this);
									   myTime=setTimeout(function(){
																   autoShow(index);
																   index++;
																   if(index==4){
																	   index=0;
																   }
																   $("#picList").stop();
														},100);
									   
									   },function(){
										   clearInterval(myTime);
										   myTime=setInterval(function(){
																	   autoShow(index);
																	   index++;
																	   if(index==4){
																		   index=0;
																	   }
																},3000);
									   });
	
	
	
	$("#picList > div").hover(function(){
									   if(myTime){
										   clearInterval(myTime);
									   }
									   },function(){
										   clearInterval(myTime);
										   myTime=setInterval(function(){
																	   autoShow(index);
																	   index++;
																	   if(index==4){
																		   index=0;
																	   }
																	   },3000);
										   });
	
	
	
	var myTime=setInterval(function(){
								autoShow(index);
								index++;
								if(index==4){
									index=0;
								};
							},3000);
});
function autoShow(i){
	$("#picList > div").eq(i).animate({opacity:1},1000,"swing").css({"z-index":"1"}).siblings().animate({opacity:0},1000,"swing").css({"z-index":"-1"});
	$("#picTitle > li").eq(i).addClass("current").siblings().removeClass("current");
}
