$(function() {

    function sort_li(arr,num){
        arr.filter(function(i){
            if((i+1)%num==0){
                $(this).addClass('no-mr');
            }
        });
    }
    function fl_li(arr,num){
        arr.filter(function(i){
            if((i+1)%num==0){
                $(this).css('float','right');
            }
        });
    }
    function hide_li(arr,num){
        arr.filter(function(i){
            if((i+1)>num){
                $(this).hide();
            }
        });
    }


var swiper = new Swiper('.factory-list .slideBox', {
                        slidesPerView:5,
                        speed: 900,
                        spaceBetween:25,
                        autoplay:true,
                        loop: false
                    });


var swiper2 = new Swiper('.honor-list .slideBox', {
                                navigation: {
                                    nextEl: '.honor-list .chevron.right',
                                    prevEl: '.honor-list .chevron.left',
                                },
                                slidesPerView: 1,
                                speed: 900,
                                spaceBetween:0,
                                autoplay:true,
                                loop: false
                            });



    // tab
    function tabs(tabTit, on, tabCon) {
        $(tabCon).each(function() {
            $(this).children().eq(0).show();
        });
        $(tabTit).each(function() {
            $(this).children().eq(0).addClass(on);
        });
        $(tabTit).children().click(function() {
            $(this).addClass(on).siblings().removeClass(on);
            var index = $(tabTit).children().index(this);
            $(tabCon).children().eq(index).show().siblings().hide();
        });
    }
    tabs(".prodet-details-tit", "on", ".prodet-details-information");



    var aLoadA = $('.i-solution .i-list a'),
        loadSrc = aLoadA.first().attr('href');
    aLoadA.first().addClass('active');
    $('.i-solution .i-img-all').load(loadSrc+' '+'.i-img .out',function(responsive,status){
        if(status=='success'){
            $('i-pro-load-img').hide();
            hide_li($('.i-solution .i-img-all .out'),20);
        }
    });
    aLoadA.click(function(e){
        e.preventDefault();
        var sUrl = $(this).attr('href');
        aLoadA.removeClass('active');
        $(this).addClass('active');
        $('.i-pro-load-img').show();
        $('.i-solution .i-img-all').hide();
        $('.i-solution .i-img-all').load(sUrl+' '+'.i-img .out',function(responsive,status){
            if(status=='success'){
                $('.i-pro-load-img').hide();
                $('.i-solution .i-img-all').show();
                hide_li($('.i-solution .i-img-all .out'),20);
            }
        });
    });



    var pUl = $('.i-faq .scroll-box ul'),
        pALi = pUl.find('li'),
        pLen = pALi.length,
        pI = 0,
        pW = pALi.first().outerHeight(true),
        pTimer = null;

    pTimer = setInterval(function(){
        pI++;
        if(pI>(pLen-3)){
            pI = 0;
        }
        pUl.stop(true, false).animate({
            'margin-top': -pW * pI
        }, 400);
    },3000);


});