// main slider
(function(){
  require(['jquery', 'mgs/owlcarousel'], function($){
    $(document).ready(function() {

      // slider main
      var sliderMain = $('.js-slider-main');
      if (sliderMain.length) {
        sliderMain.owlCarousel({
          items: 1,
          nav: true,
          loop: true
        });
      }

      // slider products
      var sliderProducts = $('.js-slider-products');
      if (sliderProducts.length) {
        sliderProducts.each(function(){
          var items = $(this).find('.product-items');
          items.addClass('owl-carousel');
          items.owlCarousel({
            items: 2,
            nav: true,
            navElement: 'button',
            margin: 20,
            responsive: {
              768 : {
                items: 4
              },
              1024 : {
                items: 5
              }
            }
          });
        });
      }

      // about
      $('.js-about-more').on('click', function(e){
        e.preventDefault();
        var _this = $(this),
            articleHeight = _this.data('height'),
            article = _this.prev();
        if (_this.hasClass('active')) {
          _this.removeClass('active');
          _this.text(_this.data('text-show'));
          article.height(articleHeight);
        } else {
          _this.addClass('active');
          _this.text(_this.data('text-hide'));
          article.height('auto');
        }
      });

    });
  });
}());