$(function(){
  $('#navSlide_txt span').css({opacity: 0.7});
  var switchInt = setInterval('navAutoSwitch()',3000);
  $('#navSlide_txt span').mouseover(function(){
        clearInterval(switchInt);
      navImageSwitch($(this).index());
  });
  $('#navSlide_txt span,#navSlide_pic div').mouseout(function(){
      switchInt = setInterval('navAutoSwitch()',3000);
  });
  $('#navSlide_pic div').mouseover(function(){
      clearInterval(switchInt);
  });
});
function navAutoSwitch(){
    var slidesList = $('#navSlide_pic div');
    var currentKey = $('#navSlide_pic div.current').index();
    if(currentKey<0||currentKey>= slidesList.length)
        currentKey = 0;
    var nextKey = currentKey + 1;
    if(nextKey>=slidesList.length)
        nextKey = 0;
    navImageSwitch(nextKey);
}
function navImageSwitch(toPosition){
    var current = $("#navSlide_pic div.current");
    var toElement = $("#navSlide_pic div:eq("+toPosition+')');
    var currentKey = current.index();
    if(currentKey == toPosition)
        return;
       //实现图片顺滑轮换的关键，将即将失去顶层的图片先移到顶层下端，然后再对新的顶层图片执行jQuery动画
    current.addClass('prev');
    toElement.css({opacity: 0.0}).removeClass('prev').addClass("current").animate({opacity: 1.0}, 1000, function() {
        current.removeClass("current prev");
    });
    $('#navSlide_txt span:not('+toPosition+')').removeClass('current').addClass('normal');
    $('#navSlide_txt span:eq('+toPosition+')').removeClass('normal').addClass('current');
}

