
$(function () {
    
    (function(){
      $('.slideGroup .parHd ul li').mouseover(function(){
        $('.slideGroup .parHd ul li').removeClass('on')
        $(this).addClass('on')
        var index=$(this).index()
        $('.sect1_swiper').removeClass('show1').eq(index).addClass('show1')
      });
    })();
    var swiper10 = new Swiper('.flinkswiper-container', {
      slidesPerView:6,
      spaceBetween: 10,
      navigation: {
        nextEl: '.swiper-button-next1',
        prevEl: '.swiper-button-prev1',
      },
      breakpoints: {
        768: {
          slidesPerView: 2,
          spaceBetween: 0,
        }
      }
    });
    var swiper1 = new Swiper('.sect1_swiper', {
      slidesPerView: 4,
     
      spaceBetween: 30,
 
      navigation: {
        nextEl: '.swiper-button-next1',
        prevEl: '.swiper-button-prev1',
      },
      breakpoints: {
        768: {
          slidesPerView: 2,
         
          spaceBetween: 0,
   
       
        }
      }
    });
    // var swiper2 = new Swiper('.sect1_swiper2', {
    //   slidesPerView: 4,
    //   slidesPerColumn: 1,
    //   spaceBetween: 30,
    //   slidesPerGroup : 4,
    //   navigation: {
    //     nextEl: '.swiper-button-next1',
    //     prevEl: '.swiper-button-prev1',
    //   },
    //   breakpoints: {
    //     768: {
    //       slidesPerView: 2,
    //       slidesPerColumn: 2,
    //       spaceBetween: 0,
    //       slidesPerGroup : 4,
    //       pagination: {
    //         el: '.sect1_swiper2 .swiper-pagination',
    //         clickable: true,
    //       },
    //     }
    //   }
    // });
    // var swiper3 = new Swiper('.sect1_swiper3', {
    //   slidesPerView: 4,
    //   slidesPerColumn: 1,
    //   spaceBetween: 30,
    //   slidesPerGroup : 4,
    //   navigation: {
    //     nextEl: '.swiper-button-next1',
    //     prevEl: '.swiper-button-prev1',
    //   },
    //   breakpoints: {
    //     768: {
    //       slidesPerView: 2,
    //       slidesPerColumn: 2,
    //       spaceBetween: 0,
    //       slidesPerGroup : 4,
    //       pagination: {
    //         el: '.sect1_swiper3 .swiper-pagination',
    //         clickable: true,
    //       },
    //     }
    //   }
    // });
    // var swiper4 = new Swiper('.sect1_swiper4', {
    //   slidesPerView: 4,
    //   slidesPerColumn: 1,
    //   spaceBetween: 30,
    //   slidesPerGroup : 4,
      
    //   navigation: {
    //     nextEl: '.swiper-button-next1',
    //     prevEl: '.swiper-button-prev1',
    //   },
    //   breakpoints: {
    //     768: {
    //       slidesPerView: 2,
    //       slidesPerColumn: 2,
    //       spaceBetween: 0,
    //       slidesPerGroup : 4,
    //       pagination: {
    //         el: '.sect1_swiper4 .swiper-pagination',
    //         clickable: true,
    //       },
    //     }
    //   }
    // });

    $(".backtop").click(function() {
      $("body,html").animate({scrollTop:0}, 400);
      return false;
    }); 
    function windowWidth(){

      if($(window).width()<991){
          $('.section1').css('marginTop',0)
      } else{
        if($('#myCarousel .carousel-inner img').complete){
              var iHbanner=$('#myCarousel .carousel-inner img').height()
              $('.carousel-inner').height(iHbanner)
              console.log(iHbanner)
               $('.section1').css('marginTop',iHbanner)
        } else{
              var iHbanner=$('#myCarousel .carousel-inner img').height()
            $('.carousel-inner').height(iHbanner)
            console.log(iHbanner)
             $('.section1').css('marginTop',iHbanner)
        }
          
             
      }
      // if($(window).width()>768){
      //   jQuery(".slideGroup .slideBox").slide({ mainCell:"ul",vis:4,prevCell:".sPrev",nextCell:".sNext",effect:"leftLoop"});
      //   jQuery(".slideGroup").slide({titCell:".parHd li",mainCell:".parBd"});
      // } else{
      //   jQuery(".slideGroup").slide({titCell:".parHd li",mainCell:".parBd"});
      
      // }
     
    }
    windowWidth();
    $(window).resize(function () {
      windowWidth();
    });

    
    
    $(window).scroll(function() {
      var isH=$(document).scrollTop()
      if(isH<176){
        $('#myCarousel').css('marginTop',176-isH)
      } else{
        $('#myCarousel').css('marginTop',0)
      }
      
    });
    TouchSlide({ slideCell:"#leftTabBox" });

    //手机banner滚动
    var mySwiper8 = new Swiper('.swiper-banner',{
      pagination: {
        el: '#molbanner .swiper-pagination',
        clickable: true,
      },
      loop:true,
      autoplay:1000,
   });

     
   


    $("#header .nav_box .yiji").hover(function () {
        $(this).find(".libox").stop(true, false).slideDown();
    },function () {
        $(this).find(".libox").slideUp();
    });
    TouchSlide({ slideCell:"#leftTabBox" });
    

 
    $(".classfiy").click(function(){
    if($(".navs").is(":hidden")){
      $(".navs").slideDown();
      $(this).find('em').removeClass('active').addClass('inactive')
      return false;
    }else{
      $(".navs").slideUp();
      $(this).find('em').removeClass('inactive').addClass('active')
      return false;
    } 
  });
    (function(){
      $('.mtree>li>a').click(function(){
        $(this).parent('li').children('ul').toggle(100);
        $(this).parent('li').siblings('li').children('ul').slideUp();
        $(this).toggleClass('act_firstli');
        $(this).parent('li').siblings('li').children('a').removeClass('act_firstli')
      })
      $('.mtree>li>ul>li>a').click(function(){
        $(this).parent('li').children('ul').toggle(100);
        $(this).parent('li').siblings('li').children('ul').slideUp();
        $(this).toggleClass('act_secondli');
        $(this).parent('li').siblings('li').children('a').removeClass('act_secondli')
      })
  })();
    
    



 

$('.carousel').carousel({
    interval: 5000
});





 (function(){
      $('.nynav>ul>li>a').click(function(){
        $(this).parent('li').children('ul').toggle(100);
        $(this).parent('li').siblings('li').find('ul').slideUp();
        $(this).parent('li').addClass('current');
        $(this).parent('li').siblings('li').removeClass('current')

      })
      $('.nynav>ul>li>ul>li>a').click(function(){
        $(this).parent('li').find('ul').toggle(100);
        $(this).parent('li').siblings('li').find('ul').slideUp();
        $(this).parent('li').addClass('act_secondli');
        $(this).parent('li').siblings('li').removeClass('act_secondli')

          var inavw=$(this).outerWidth()
          console.log(inavw)
          $(this).parent('li').find('ul').find('li').width(inavw);
      })
  })();


  


  $(".kz").each(function(){   
    var maxwidth=parseInt($(this).attr("data-limit"));
    if($(this).text().length>maxwidth){   
      $(this).text($(this).text().substring(0,maxwidth));    
      $(this).html($(this).html()+'...');   
    }    
  });


  $('.block').smoove({offset:'50%'});
   $("#header .nav_box .yiji").hover(function (index) {
        $(this).find(".libox").stop(true, false).slideDown();
    },function () {
        $(this).find(".libox").slideUp();
    });
    

   //隐藏导航跟wrap的切换
    $(".mol_navbutton,.navbtn,.navbtn1").click(function(){
      $(".class").removeClass("page-prev").addClass("page-in");
      $(".wrap").removeClass("page-active").addClass("page-next page-in")
      $(".opacity2").show()
      // pageSlideOver();
    })
     function xs(oDiv){
        oDiv.on('click touchstart',function(){
            $(".class").addClass("page-prev page-out")
            $(".wrap").removeClass("page-next").addClass(" page-out")
            $(".opacity2").hide()
            $(".newsclass").removeClass("show")
            // pageSlideOver();
            return false;
        });
     }
     xs($(".opacity2"))
     xs($(".close1"))

    // 二级导航下拉
      $(".ericon").click(function(){
          $(this).toggleClass("xz").parents().siblings().find(".ericon").removeClass("xz");
          $(this).parents().siblings().find(".menu_body").hide(300);
          $(this).siblings(".menu_body").slideToggle()
          $(this).siblings("a").toggleClass("active")
          $(this).parents("li").siblings("li").find('.ce').removeClass("active")
              
      })
    // 三级下拉
      $(".menu_body li a.er").click(function(){
          $(this).parents().siblings().find(".thr_body").hide(300);
          $(".menu_body li a.er").removeClass('active1')
          $(this).toggleClass("active1")
          $(this).siblings(".thr_body").slideToggle()
              
      })
    
    // 内页导航
    $(window).scroll(function () {
        var sT = $(window).scrollTop();
        if (sT >300) {
            $(".head_ny").addClass("head_on");
        } else {
            $(".head_ny").removeClass("head_on");
        }

    });
    // 鼠标滚动渐入
    if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){
        new WOW().init();
    };
    
    
});
!function(a, b, c) {
  a.fn.smoove = function(b) {
    return a.fn.smoove.init(this, a.extend({}, a.fn.smoove.defaults, b)), this
  }, a.fn.smoove.items = [], a.fn.smoove.loaded = !1, a.fn.smoove.defaults = {
    offset: 150,
    opacity: 0,
    transition: "all 1s ease, opacity 1.5s ease",
    transformStyle: "preserve-3d",
    transformOrigin: !1,
    perspective: 1e3
  }, a.fn.smoove.init = function(d, e) {
    function f(a, b, c) {
      function d(a) {
        return a.charAt(0).toUpperCase() + a.slice(1)
      }
      for (var e = ["webkit", "moz", "ms", "o"], f = {}, g = 0; g < e.length; g++) c && (b = b.replace(c, "-" + e[g] + "-" + c)), f[d(e[g]) + d(a)] = b;
      return f[a] = b, f
    }
    function g(c) {
      for (var d = 0; d < a.fn.smoove.items.length; d++) {
        var e = a.fn.smoove.items[d],
          g = e.params,
          h = a(b).height(),
          i = !c || "down" === c && "1" === e.css("opacity") ? 0 : g.offset,
          j = a(b).scrollTop() + h - e.data("top");
        if ("string" == typeof i && i.indexOf("%") && (i = parseInt(i) / 750 * h), i > j) {
          g.opacity !== !1 && e.css({
            opacity: g.opacity
          });
          for (var k = [], l = ["move", "move3D", "moveX", "moveY", "moveZ", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "scale", "scale3d", "scaleX", "scaleY", "skew", "skewX", "skewY"], m = 0; m < l.length; m++)"undefined" != typeof g[l[m]] && (k[l[m]] = g[l[m]]);
          var n = "";
          for (var o in k) n += o.replace("move", "translate") + "(" + k[o] + ") ";
          n && (e.css(f("transform", n)), e.parent().css(f("perspective", g.perspective)), g.transformOrigin && e.css(f("transformOrigin", g.transformOrigin)))
        } else e.css("opacity", 1).css(f("transform", ""))
      }
    }
    if (d.each(function() {
      var b = a(this),
        c = b.params = a.extend({}, e, b.data());
      b.params.opacity = b.params.opacity / 100, b.data("top", b.offset().top), c.transition = f("transition", c.transition, "transform"), b.css(c.transition), a.fn.smoove.items.push(b)
    }), !a.fn.smoove.loaded) {
      a.fn.smoove.loaded = !0;
      var h, i = !1,
        j = 0,
        k = a(b).height(),
        l = a(b).width(),
        m = a(c).height();
      a("body").width() === a(b).width() && a("body").css("overflow-x", "hidden"), a(b).resize(function() {
        clearTimeout(h), h = setTimeout(function() {
          var d = a(b).height(),
            e = a(b).width(),
            h = k > d ? h = "up" : "down",
            i = a.fn.smoove.items;
          if (k = d, l !== e) {
            for (var j = 0; j < i.length; j++) i[j].css(f("transform", "")).css(f("transition", ""));
            var n = setInterval(function() {
              var d = a(c).height();
              if (d === m) {
                b.clearInterval(n);
                for (var e = 0; e < i.length; e++) i[e].data("top", i[e].offset().top), i[e].css(i[e].params.transition);
                g(h)
              }
              m = d
            }, 500)
          } else g(h);
          l = e
        }, 500)
      }), a(b).on("load", function() {
        g(), a(b).scroll(function() {
          i = !0
        }), setInterval(function() {
          if (i) {
            i = !1;
            var c = a(b).scrollTop(),
              d = j > c ? d = "up" : "down";
            j = c, g(d)
          }
        }, 250)
      })
    }
  }
}(jQuery, window, document);