﻿
/*$(document).ready(function() {
  $(".imgpay").each(function() {
	  var index=0	
	  pay(index)
	  var len=$("img", this).length;
	  var divheight=$("img", this).eq(0).height();
	  $(this).css("height", divheight);
	  $('.imgpay').hover(function(){
     	  if(MyTime){
     	  clearInterval(MyTime);
     	  }
	  },function(){
     	  MyTime = setInterval(function(){
     	  index++;
     	  if(index==len){index=0;}
		  pay(index)
     	  } , 3000);
	  });
 
	  //自动开始
	  var MyTime = setInterval(function(){
  	      index++;
   	      if(index==len){index=0;}
		  pay(index)
   	      } , 3000);

	  function pay(i){
		$(".imgpay").css("background", "none");
	    $(".imgpay").find("img").eq(i).stop(true,false).css("opacity",0.2).animate({opacity: 1},"show").show()
		//document.getElementById("pic").filters[0].Apply();document.getElementById("pic").filters[0].Play(duration=2);
		.siblings().fadeOut("show");
	  };
   });
});*/

$(document).ready(function() {
  $(".imgpay").each(function() {
	  var index=0
	  var len=$("a", this).length;
	  /*var divheight=$("a", this).eq(0).height();
	  $(this).css("height", divheight);
      for(var j=0; j<len; j++) {
      $("#seo").append("<tt id="+j+" class=v1>"+(j+1)+"</tt>");};
      $("#seo").find("tt").mouseover(function(){
          index = $(this).attr('id');
		  //index =   $("#seo tt").index(this);
          pay(index);
      });*/ 
	  pay(index);
	  $('.imgpay').hover(function(){
     	  if(MyTime){
     	  clearInterval(MyTime);
     	  }
	  },function(){
     	  MyTime = setInterval(function(){
     	  index++;
     	  if(index==len){index=0;};	  
		  pay(index);
     	  } , 4000);
	  });
 
	  //自动开始
	  var MyTime = setInterval(function(){
  	      index++;
   	      if(index==len){index=0;};		
		  pay(index);
   	      } , 4000);

	  function pay(i){
		$(".imgpay").css("background", "none");
		$("#seo").find("tt").eq(i).addClass("v2")
		.siblings().removeClass("v2");
	    $(".imgpay").find("a").eq(i).stop(true,false).css("opacity",0.4).animate({opacity: 1},600).show()
		.siblings().fadeOut("show");
	  };
   });
});
