$(function () {
    new WOW({
        mobile: false
    }).init();

    $('.hform').find('form').submit(function () {
        var val = $(this).find('input').val();
        if (!val) {
            alert('请输入关键字');
            return false
        }
    });

    $('.menu-btn').on('click', function () {
        $('.header').find('.nav').toggle();
    });

    if ($(window).width() > 991) {
        $('.dropdown').hover(function () {
            $(this).addClass('open');
        }, function () {
            $(this).removeClass('open');
        });
    } else {
        $('.dropdown').find('.arr').on('click', function () {
            $(this).parent().toggleClass('open');
        });
    }

    $('.lanmu').find('.arr').on('click', function () {
        $(this).parent().toggleClass('open');
    });

    // 右侧滑动返回顶部
    $('.kf .kf-side').click(function(){
        //$('.kf').animate({ right: '-208' }, "slow");
        var rt = $('.kf').css("right");
        //alert(rt);
        var num = parseInt(rt);
        //alert(num);
        if(num < 0){
            $('.kf').animate({ right: '20px' }, "slow");
            $('.kf .kf-side span.arrow').addClass('on');
        }else{
            $('.kf').animate({ right: '-208px' }, "slow");
            $('.kf .kf-side span.arrow').removeClass('on');
        }
    });
    $('.kt-top span.close').click(function(){
        $('.kf').animate({ right: '-208px' }, "slow");
    });

    $('.kf .backTop').click(function() {
        $("html,body").stop().animate({ scrollTop: '0' }, 500);
    });
});

function tabsSwiper(menu, con, allowTouchMove) {
    var swiper = new Swiper(con, {
        speed: 500,
        spaceBetween: 10,
        autoHeight: true,
        allowTouchMove: !allowTouchMove,
        on: {
            slideChangeTransitionStart: function () {
                $(menu).find('li').eq(this.activeIndex).addClass('active').siblings().removeClass('active');
            }
        }
    });
    $(menu).on('click', 'li', function (e) {
        $(this).addClass('active').siblings().removeClass('active');
        swiper.slideTo($(this).index());
    });
}

///浏览器版本检测
function IETester(userAgent) {
    var UA = userAgent || navigator.userAgent;
    if (/msie/i.test(UA)) {
        return UA.match(/msie (\d+\.\d+)/i)[1];
    } else if (~UA.toLowerCase().indexOf('trident') && ~UA.indexOf('rv')) {
        return UA.match(/rv:(\d+\.\d+)/)[1];
    }
    return false;
}
//console.log(IETester()); //不传参数返回当前IE版本，如果不是IE内核浏览器，返回false
if (IETester() == 9.0) {
    $(".hearder .right").css({
        "position": "absolute",
        "z-index": "-1"
    });
} else if (IETester() == 8.0 || IETester() == 7.0 || IETester() == 6.0 || IETester() == 5.0) {
   document.write("<div style='text-align:center; font-size:26px; padding:20px;'>您的浏览器版本过低或该浏览器不支持，请升级或更换浏览器！</div>");
    if (confirm("您的浏览器版本过低或该浏览器不支持，可能导致网站不能正常运行，建议使用以下浏览器：Google Chrome（推荐）、火狐浏览器（Firefox）、IE10、IE11、360安全浏览器（极速模式）、360极速浏览器、搜狗高速浏览器（高速模式）、遨游浏览器、Apple Safari！")) {
        //location.href = "https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads";
		alert("您将退出网页！");
        window.close();
    } else {
        alert("您将退出网页！");
        window.close();
        //return false;
    }
}
IETester('Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko'); //传userAgent字符串，用来判断其他IE浏览器的版本,该示例返回11.0
