$(document).ready(function() {
  /*
   * 常用工具
   */
  //返回顶部
  $('body').on('click', '.gotop', function() { $('html,body').stop(1).animate({ scrollTop: '0' }, 300); return false });

  $(window).on('scroll', function() {
    main();
  })

  function main() {
    var top = $(window).scrollTop();
    if (top > 50) {
      $('.right_bar').fadeIn();
      $('.itop').addClass("itopfixed");

    } else if (top <= 50) {
      $('.right_bar').fadeOut();
      $('.itop').removeClass("itopfixed");
    }

    if (top > 800) {
      $('.nyfzlcleftimg').addClass("nyfzlcfixed");
      $('.nyfzlctime').addClass("nyfzlcfixed");
    }

    if (top <= 800) {
      $('.nyfzlcleftimg').removeClass("nyfzlcfixed");
      $('.nyfzlctime').removeClass("nyfzlcfixed");
    }
    if (top > 1500) {
      $('.nyfzlcleftimg').removeClass("nyfzlcfixed");
      $('.nyfzlctime').removeClass("nyfzlcfixed");
      $('.nyfzlcleftimg').addClass("nyfzlcfixedb");
      $('.nyfzlctime').addClass("nyfzlcfixedb");
    }

    if (top <= 1500) {
      $('.nyfzlcleftimg').removeClass("nyfzlcfixedb");
      $('.nyfzlctime').removeClass("nyfzlcfixedb");
    }

    if (top <= 1100) {
      $('.nyfzlcleftimg1').addClass('on').siblings().removeClass('on');
      $('.nyfzlctime1').addClass('on').siblings().removeClass('on');
    } else if (top > 1100 & top <= 1400) {
      $('.nyfzlcleftimg2').addClass("on").siblings().removeClass('on');
      $('.nyfzlctime2').addClass('on').siblings().removeClass('on');
    } else if (top > 1400) {
      $('.nyfzlcleftimg3').addClass("on").siblings().removeClass('on');
      $('.nyfzlctime3').addClass('on').siblings().removeClass('on');
    }

  }

  $('.right_bar li').eq(0).hover(function() {
    $(this).stop().animate({ left: -100 }, 300);
  }, function() {
    $(this).stop().animate({ left: 0 }, 300);
  });

  $('.right_bar li').eq(1).hover(function() {
    $(this).stop().animate({ left: -165 }, 300);
  }, function() {
    $(this).stop().animate({ left: 0 }, 300);
  });

  $('.right_bar li').eq(2).hover(function() {
    $(this).stop().find('.rtbar_shwxgzh').show();
  }, function() {
    $(this).stop().find('.rtbar_shwxgzh').hide();
  });
  $('.right_bar li').eq(3).hover(function() {
    $(this).stop().find('.rtbar_shwxdy').show();
  }, function() {
    $(this).stop().find('.rtbar_shwxdy').hide();
  });
  $('.right_bar li').eq(4).hover(function() {
    $(this).stop().find('.rtbar_shwxsph').show();
  }, function() {
    $(this).stop().find('.rtbar_shwxsph').hide();
  });


})