window.onload;
$(window).resize(wah);

function wah() {

}

$(window).scroll(function(event) {
    // if ($(window).scrollTop() > 0) {
    //     $('.head-box').addClass('active');
    // } else {
    //     $('.head-box').removeClass('active');
    // }
    if ($(window).scrollTop() > 400) {
        $('.gotop').fadeIn();
    } else {
        $('.gotop').fadeOut();
    }
})

$(window).on("load", function() {
    setTimeout(function() {
        $('.loading').fadeOut();
    }, 4000)
})

$(function() {

    $('.nav_btn').click(function() {
        if ($('.nav_btn').attr('class') == 'nav_btn cur') {
            $('.nav_btn').removeClass('cur');
            $('.nav').removeClass('active');
            $('body').css('overflow', 'inherit');
        } else {
            $('.nav_btn').addClass('cur');
            $('.nav').addClass('active');
            $('body').css('overflow', 'hidden');
        }
    });
    
    $('.home-box1 .center-block li').hover(function(){
        if($(this).attr('class') != 'active'){
            $('.home-box1 .center-block li').removeClass('active').eq($(this).index()).addClass('active')
        }
    })
    
    $('.about-box2 .top-box .fr span').removeClass('active').eq(0).addClass('active')
    $('.about-box2 .lower-box').hide().eq(0).show();
    $('.about-box2 .top-box .fr span').click(function(){
        if($(this).attr('class') != 'active'){
            $('.about-box2 .top-box .fr span').removeClass('active').eq($(this).index()).addClass('active')
            $('.about-box2 .lower-box').hide().eq($(this).index()).show();
        }
    })
    $('.about-box2 .lower-box').each(function(){
        var that = $(this)
        that.find('.pull-right ul li').removeClass('active').eq(0).addClass('active')
        that.find('.pull-left ul li').hide().eq(0).show();
        that.find('.pull-right ul li').click(function(){
            if($(this).attr('class') != 'active'){
                that.find('.pull-right ul li').removeClass('active').eq($(this).index()).addClass('active')
                that.find('.pull-left ul li').hide().eq($(this).index()).show();
            }
        })
    })
    


    $('.ewm_tc').click(function() {
        $(this).fadeOut();
    })

    if ($(window).width() <= 768) {
        $('.home-box1 .center-block li').addClass('active')
    } else {

    }


    $(".gotop").click(function() {
        var anh = $("body").offset().top;
        $("html,body").stop().animate({
            scrollTop: anh
        }, 1000);
        scrollAnh = 0;
        scrollNum = 0;
    });
    
    
});