
//   $('.menu li').hover(function() {
//                 $(this).find('em').stop().fadeIn();
//             },function(){
//                 $(this).find('em').stop().fadeOut();
//             });
            $('.menu li').hover(function() {
               $(this).find('p').stop().fadeToggle();
            });
            
            $(".s_btn").click(function() {
                $(".s_key").toggle(500);
            });

            function searchLink(el) {
                var href = $(el).attr("href");
                location.href = href ? href : "/search.php?key=" + $(el).html();
            }
        

            $(document).ready(function() {
                $(".fullSlide").mouseover(function() {
                    $(this).find("p").show();
                });
                $(".fullSlide").mouseout(function() {
                    $(this).find("p").hide();
                });
                 (function(){
                    var bannerWidth = $(".fullSlide .con").css("width");
                var bannerHeight = parseInt(bannerWidth)*660/1920;
                $(".fullSlide .con").css("height",bannerHeight);
                // console.log(bannerHeight)
                    })();
            });
        

                $(".ys dd li").hover(function() {
                    $(this).addClass("cur").siblings().removeClass("cur");
                })
            

                // jQuery(".case").slide({
                //     mainCell: ".case_con",
                //     effect: "fold",
                //     titCell: ".case_nav h3",
                //     autoPlay: false,
                //     titOnClassName: "on"
                // });
                jQuery(".slide").slide({
                    mainCell: ".case_list",
                    effect: "fold",
                    titCell: ".brand li",
                    autoPlay: false,
                    titOnClassName: "on"
                });
            

            jQuery(".power_con").slide({
                mainCell: ".power_con_list",
                effect: "fold",
                titCell: ".power_nav li",
                autoPlay: false,
                titOnClassName: "cur"
            });
            
            //窗口显示才加载
       var wrapTop = $(".gun").offset().top;
       var istrue = true;
       $(window).on("scroll",
           function() {
               var s = $(window).scrollTop();
               if (s > wrapTop - 500 && istrue) {
                   $(".timer").each(count);
                   function count(a) {
                       var b = $(this);
                       a = $.extend({},
                           a || {},
                           b.data("countToOptions") || {});
                       b.countTo(a)
                   };
                   istrue = false;
               };
           })
       //设置计数
       $.fn.countTo = function (options) {
           options = options || {};
           return $(this).each(function () {
               //当前元素的选项
               var settings = $.extend({}, $.fn.countTo.defaults, {
                   from:            $(this).data('from'),
                   to:              $(this).data('to'),
                   speed:           $(this).data('speed'),
                   refreshInterval: $(this).data('refresh-interval'),
                   decimals:        $(this).data('decimals')
               }, options);
               //更新值
               var loops = Math.ceil(settings.speed / settings.refreshInterval),
                   increment = (settings.to - settings.from) / loops;
               //更改应用和变量
               var self = this,
                   $self = $(this),
                   loopCount = 0,
                   value = settings.from,
                   data = $self.data('countTo') || {};
               $self.data('countTo', data);
               //如果有间断，找到并清除
               if (data.interval) {
                   clearInterval(data.interval);
               };
               data.interval = setInterval(updateTimer, settings.refreshInterval);
               //初始化起始值
               render(value);
               function updateTimer() {
                   value += increment;
                   loopCount++;
                   render(value);
                   if (typeof(settings.onUpdate) == 'function') {
                       settings.onUpdate.call(self, value);
                   }
                   if (loopCount >= loops) {
                       //移出间隔
                       $self.removeData('countTo');
                       clearInterval(data.interval);
                       value = settings.to;
                       if (typeof(settings.onComplete) == 'function') {
                           settings.onComplete.call(self, value);
                       }
                   }
               }
               function render(value) {
                   var formattedValue = settings.formatter.call(self, value, settings);
                   $self.html(formattedValue);
               }
           });
       };
       $.fn.countTo.defaults={
           from:0,               //数字开始的值
           to:0,                 //数字结束的值
           speed:1000,           //设置步长的时间
           refreshInterval:100,  //隔间值
           decimals:0,           //显示小位数
           formatter: formatter, //渲染之前格式化
           onUpdate:null,        //每次更新前的回调方法
           onComplete:null       //完成更新的回调方法
       };
       function formatter(value, settings){
           return value.toFixed(settings.decimals);
       }
       //自定义格式
       $('#count-number').data('countToOptions',{
           formmatter:function(value, options){
               return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
           }
       });
       //定时器
       $('.timer').each(count);
       function count(options){
           var $this=$(this);
           options=$.extend({}, options||{}, $this.data('countToOptions')||{});
           $this.countTo(options);
       }
        

            $('.open-video').on('click', function() {
                $('.video-box').fadeIn();
            });
            $('.close-video').on('click', function() {
                $('.video-box').fadeOut();
            });
            jQuery(".faq").slide({
                mainCell: ".faq_list",
                titCell: ".faq_nav li",
                autoPlay: true,
                effect: "fade"
            });
        

    if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) {
        new WOW().init();
    };


        $(function() {
            var time;
            //var winHeight = top.window.document.body.clientHeight || $(window.parent).height();
            $('.client-2').css({
                'marginTop': -($('.client-2').height() / 2)
            });
            $('#client-2 li').on({
                'mouseenter': function() {
                    var scope = this;
                    time = setTimeout(function() {
                        var divDom = $(scope).children('div');
                        var maxWidth = divDom.width();
                        $(scope).stop().animate({
                            left: 77-maxWidth}, 'normal', function() {
                            var pic = $(scope).find('.my-kefu-weixin-pic');
                            if (pic.length > 0) {
                                pic.show();
                            }
                        });
                    }, 100)
                },
                'mouseleave': function() {
                    var pic = $(this).find('.my-kefu-weixin-pic');
                    var divDom = $(this).children('div');
                    var maxWidth = divDom.width();
                    if (pic.length > 0) {
                        pic.hide();
                    }
                    clearTimeout(time);
                    var divDom = $(this).children('div');
                    $(this).stop().animate({
                        left: 0
                    }, "normal", function() {});
                }
            });
            //返回顶部
            $(window).scroll(function() {
                var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
                var eltop = $("#client-2").find(".my-kefu-ftop");
                if (scrollTop > 0) {
                    eltop.show();
                } else {
                    eltop.hide();
                }
            });
            $("#client-2").find(".my-kefu-ftop").click(function() {
                var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
                if (scrollTop > 0) {
                    $("html,body").animate({
                        scrollTop: 0
                    }, "slow");
                }
            });
        });
    
