var SwiperSettings = {
  SwiperParam: function () {
    var indexBanner = new Swiper('.index-banner .swiper1', {
      loop: true,
      speed: 1000,
      autoplay: {
        delay: 5000,
      },
      effect: 'fade',
      pagination: {
        el: '.index-banner .swiper-pagination',
        clickable: 'true',
      },
      navigation: {
        nextEl: '.index-banner .swiper-button-next',
        prevEl: '.index-banner .swiper-button-prev',
      },
    })
    var indexProduction = new Swiper('.index-production .swiper2', {
      loop: true,
      slidesPerView: '1',
      spaceBetween: 30,
      navigation: {
        nextEl: '.index-production .swiper-button-next',
        prevEl: '.index-production .swiper-button-prev',
      },
      pagination: {
        el: '.index-production .swiper-pagination',
        clickable: 'true',
      },
      breakpoints: {
        641: {
          slidesPerView: '3',
        },
        541: {
          slidesPerView: '2',
        }
      }
    })
    var indexCustomer = new Swiper('.index-customer .swiper3', {
      slidesPerView: '3',
      navigation: {
        nextEl: '.index-customer .swiper-button-next',
        prevEl: '.index-customer .swiper-button-prev',
      },
      breakpoints: {
        992: {
          slidesPerView: '5',
          spaceBetween: 45,
        },
        541: {
          slidesPerView: '3',
          spaceBetween: 20,
        },
      }
    })
    var HistorySwiper = new Swiper('.history-main .history-list .swiper-history', {
      slidesPerView: '1',
      spaceBetween: 0,
      pagination: {
        el: '.history-main .swiper-pagination',
        clickable: 'true',
      },
      navigation: {
        nextEl: '.history-main .swiper-button-next',
        prevEl: '.history-main .swiper-button-prev',
      },
      breakpoints: {
        1281: {
          slidesPerView: '4',
          spaceBetween: 70,
        },
        1200: {
          slidesPerView: '4',
          spaceBetween: 50,
        },
        992: {
          slidesPerView: '3',
          spaceBetween: 50,
        },
        541: {
          slidesPerView: '2',
          spaceBetween: 30,
        }
      }
    })
    var ProductSwiper = new Swiper('.product-main .apply-list .swiper-product', {
      slidesPerView: '2',
      spaceBetween: 18,
      pagination: {
        el: '.product-main .swiper-pagination',
        clickable: 'true',
      },
      breakpoints: {
        1200: {
          slidesPerView: '4',
        },
        992: {
          slidesPerView: '3',
        }
      }
    })
    var PatentSwiper = new Swiper('.patent-list .swiper-patent', {
      slidesPerView: '2',
      spaceBetween: 30,
      navigation: {
        nextEl: '.patent-list .swiper-button-next',
        prevEl: '.patent-list .swiper-button-prev',
      },
      breakpoints: {
        1200: {
          slidesPerView: '4',
        },
        992: {
          slidesPerView: '3',
        },
        768: {
          slidesPerView: '2',
        }
      }
    })
  },
  init: function () {
    this.SwiperParam();
  }
}
var indexCustomer = {
  ListHeight: function () {
    function CustomerList() {
      var ParentWidth = $('.index-customer .customer-list .swiper-slide .item-ico').outerWidth();
      $('.index-customer .customer-list .swiper-slide .item-ico').height(ParentWidth)
      $('.index-customer .customer-list .swiper-slide .item-ico').css('line-height', ParentWidth + 'px');
    }
    CustomerList();
    $(window).on('resize', function () {
      CustomerList();
    })
  },
  init: function () {
    this.ListHeight();
  }
}
var map = {
  Map: function () {
    if ($('.map').length > 0) {
      var markerArr = [{
        title: "江苏福吉利亚建材有限公司",
        content: "地址：江苏省南通市如东县岔河镇兴河工业区<br />电话：0513-84319919<br />邮箱：sales@verginia.com.cn",
        point: "120.929479|32.366755",
        isOpen: 1,
        icon: {
          w: 23,
          h: 25,
          l: 0,
          t: 0,
          x: 9,
          lb: 12
        }
      }];
      initMap("map", 120.929479, 32.366755, 16, markerArr);

    }
  },
  init: function () {
    this.Map();
  }
}
$(function () {
  var s = $('.about-main .about-bottom .about-txt p');
  $('.about-main .about-bottom .about-txt').text('').append(s)
  if ($('div[class*=swiper]').length > 0) {
    SwiperSettings.init();
  }
  indexCustomer.init();
  map.init();
  if ($('.job-dropmenu').length > 0) {
    $('.job-main .job-list .job-item .job-box').on('click', function () {
      var son = $(this).find('.job-dropmenu');
      var h = son.height();
      $('.job-main .job-list .job-item .job-box .job-dropmenu').stop().slideUp();
      if (son.is(':visible')) {
        son.stop().slideUp();
        $(this).parents('.job-list').stop().animate({
          'margin-bottom': 0
        });
        $(this).find('.job-t .ico').stop().animate({
          'opacity': 0
        })
      } else {
        son.stop().slideDown();
        $(this).find('.job-t .ico').stop().animate({
          'opacity': 1
        })
        $(this).parents('.job-list').stop().animate({
          'margin-bottom': h
        });
      }
    })
  }
  if ($('div[class*=wow]').length > 0) {
    wow = new WOW({
      boxClass: 'wow', // default 盒子类名
      animateClass: 'animated', // default 为animate.css触发css动画的库
      offset: 0, // default 偏移量
      mobile: true, // default 是否支持手机
      live: true // default 检查新元素
    })
    new WOW().init();
  }
  $('.search-btn').on('click',function(e){
    if( $('#q').val() == ''){
      e.preventDefault()
    }
  })
})