/* script2022.js, created on 07-11-2022 11:38 */
 
 $(document).ready(function(){
   
   /*aplication page*/
  
  $('.application-btn').on('click',function(){
      if($(this).parent().parent().parent().hasClass('active')){
        $(this).parent().parent().parent().removeClass('active');
      }else{
        $('.application-innercontent').removeClass('active');
        $(this).parent().parent().parent().addClass('active');
      }  
  });
  
  $('.ev-process-img .items').on('click',function(){
    $('.ev-process-img .items .material-placeholder').removeClass('active');
    $(this).find('.material-placeholder').addClass('active');

    
  });
  
  $('.application-hoverimg .items').on('click',function(){
    $('.application-hoverimg .items .material-placeholder').removeClass('active');
    $(this).find('.material-placeholder').addClass('active');

    
  });
  
  $('#teamArticleView .material-placeholder').on('click',function(){
    $('#teamArticleView .material-placeholder').removeClass('active');
    $(this).addClass('active');

    
  });

      $(".materialboxed").on(
            "click", function () {
              $('.material-placeholder').removeClass('active');
            
        });
        
        $('#materialbox-overlay').on(
            "click", function (e) {
              e.stopPropagation();
              $('.material-placeholder').removeClass('active');
            
        });

    // side nav trigger
   /* $('.sidenav').sidenav({
      onCloseEnd : function () {
        $("body").addClass("sidenavhide");
      }
    });*/
    
    $('.sidenav-trigger').sideNav({
      closeOnClick: true,
      onCloseEnd : function () {
        $("body").addClass("sidenavhide");
      }
    });
   if($('.main-event .newscontenthtml').length){
    
        var _html = '';
        var count = 0;
       /*  $('#portalArticleListBlock-1059 .articleListWrapperMedium .card ').each(function(){
            var _img = $(this).find('.articleItemImage img').attr('src');
            var _a =  $(this).find('.articleItemImage a').attr('href');
            var _title =  $(this).find('.card-title a').text();
            var _p =  $(this).find('.card-reveal p').text();
            count++;
            if(count == 1){
              fadeType = 'right';
            }
             if(count == 2){
              fadeType = 'up';
            }
             if(count == 3){
              fadeType = 'left';
            }
            _htm = _htm + '<div class="col s12 l4">';
            _htm = _htm + '<div class="card z-depth-0" data-aos="fade-'+fadeType+'" data-aos-delay="100" data-aos-duration="1000" data-aos-offset="300">';
            _htm = _htm + '<div class="card-image">';
            _htm = _htm + '<img src="'+_img+'">';
            _htm = _htm + '</div>';
            _htm = _htm + '<div class="card-content">';
            _htm = _htm + '<h3 class="card-title"><a href="'+_a+'">'+_title+'</a></h3>';
            _htm = _htm + '<p>'+_p+'</p>';
            _htm = _htm + ' </div>';
            _htm = _htm + '</div>';
            _htm = _htm + '</div>';
            
            
        });
        
        $('.main-event .newscontenthtml').html(_htm);
         */
         $('#portalArticleListBlock-1059 .articleListWrapperMedium').addClass('owl-carousel owl-theme').removeClass('articleListWrapperMedium');
          $('#portalArticleListBlock-1059 .widgetContent').addClass('container')
          var _html  = '';
          $('#portalArticleListBlock-1059 .card').each(function(){
    
             
              
          var _captionImage = $(this).find('.articleItemImage img').attr('src');
          var _h2 =  $(this).find('.card-title a').text();
          var _h2Obj = _h2.split(':');
          var _h2FirstPart = _h2Obj[0];
              
         
          var _p = $(this).find('.card-reveal p').text();
          var _a = $(this).find('.articleItemImage a').attr('href');
          _html  = _html + '<div class="item">';
                _html  = _html + ' <div class="row">';
                _html  = _html + '  <div class="col s12 l5">';
                  _html  = _html + '  <div class="imgbox"><img src="'+_captionImage+'"></div>';
                _html  = _html + '  </div>';
                _html  = _html + '  <div class="col s12 l7"> ';
                _html  = _html + '    <div class="tablabel">Introduction</div>';
                 _html  = _html + '   <h2>'+_h2FirstPart+'</h2>';
                  _html  = _html + '<p>'+_p+'</p>';
                  _html  = _html + '  <p><a href="'+_a+'" class="btn-flat">Find out more</a></p>';
                _html  = _html + '  </div>';
                
               _html  = _html + ' </div>';
              _html  = _html + '</div>';
      
        
          
      }); 
      $('#portalArticleListBlock-1059 .owl-carousel.owl-theme').html(_html);
      $('#portalArticleListBlock-1059').show();
        
    } 
    
    if($('#wikiList-1054 .slider').length){
      $('#wikiList-1054 .slider').addClass('owl-carousel owl-theme').removeClass('slider');
      $('#wikiList-1054 .widgetContent').addClass('container')
      var _html  = '';
      $('#wikiList-1054 .slides li').each(function(){
          var _captionImage = $(this).find('.caption-image img').attr('src');
          var _h2 = $(this).find('.caption.caption-content h3').text();
          var _h2Obj = _h2.split(' ');
          var _h2FirstPart = _h2Obj[0];
          if(_h2Obj.length > 3){
               _h2FirstPart = _h2Obj[0] +' '+ _h2Obj[1];
          }   
          var _h2LastPart = $.trim(_h2.replace(_h2FirstPart,''));
          var _p = $(this).find('.caption.caption-content p').text();
          var _a = $(this).find('.caption.caption-content a').attr('href');
          _html  = _html + '<div class="item">';
                _html  = _html + ' <div class="row">';
                _html  = _html + '  <div class="col s12 l7"> ';
                _html  = _html + '    <div class="tablabel">Introduction</div>';
                 _html  = _html + '   <h2>'+_h2FirstPart+' <span>'+_h2LastPart+'</span></h2>';
                  _html  = _html + '<p>'+_p+'</p>';
                  _html  = _html + '  <p><a href="'+_a+'" class="btn-flat">Find out more</a></p>';
                _html  = _html + '  </div>';
                _html  = _html + '  <div class="col s12 l5">';
                  _html  = _html + '  <div class="imgbox"><img src="'+_captionImage+'"></div>';
                _html  = _html + '  </div>';
               _html  = _html + ' </div>';
              _html  = _html + '</div>';
      
        
          
      }); 
      $('#wikiList-1054 .owl-carousel.owl-theme').html(_html);
    }

    // owl carousel
    var owl = $('#wikiList-1054 .owl-carousel');
    owl.owlCarousel({
      loop:true,
      margin:10,
      nav:false,
      dots:true,
      thumbs: true,
      thumbImage: true,
      thumbContainerClass: 'owl-thumbs',
      thumbItemClass: 'owl-thumb-item',
      autoplay: true,
      autoplayTimeout:5000,
      animateOut: 'fadeOut',
      animateIn: 'fadeIn',
      smartSpeed: 1000,
      responsive:{
          0:{
              items:1
          },
          600:{
              items:1,
              dots:false,
              thumbs:false
          },
          1000:{
              items:1,
              dots:false,
              thumbs:false
          },
          1400:{
              items:1,
          }
      }
    })
    owl.on('#wikiList-1054 changed.owl.carousel', function(event) {
      $("#wikiList-1054.showcase-slider .widgetContent").addClass("firstclass")
      setTimeout(function(){
        $("#wikiList-1054.showcase-slider .widgetContent").removeClass("firstclass")
      },1000) 

    });
    
    
    // News owl carousel
    var owl = $('#portalArticleListBlock-1059 .owl-carousel');
    owl.owlCarousel({
      loop:true,
      margin:10,
      nav:false,
      dots:true,
      thumbs: true,
      thumbImage: true,
      thumbContainerClass: 'owl-thumbs',
      thumbItemClass: 'owl-thumb-item',
      autoplay: true,
      autoplayTimeout:5000,
      animateOut: 'fadeOut',
      animateIn: 'fadeIn',
      smartSpeed: 1000,
      responsive:{
          0:{
              items:1
          },
          600:{
              items:1,
              dots:false,
              thumbs:false
          },
          1000:{
              items:1,
              dots:false,
              thumbs:false
          },
          1400:{
              items:1,
          }
      }
    })
    owl.on('#portalArticleListBlock-1059 changed.owl.carousel', function(event) {
      $("#portalArticleListBlock-1059 .widgetContent").addClass("firstclass")
      setTimeout(function(){
        $("#portalArticleListBlock-1059 .widgetContent").removeClass("firstclass")
      },1000) 

    })
    // mobile sub menu
    $('.collapsible').collapsible();

    $('header .dropdown-button').dropdown({
        inDuration: 300,
        outDuration: 225,
        constrainWidth: false, // Does not change width of dropdown to that of the activator
        hover: true, // Activate on hover
        gutter: 0, // Spacing from edge
        belowOrigin: true, // Displays dropdown below the button
        alignment: 'right', // Displays dropdown with edge aligned to the left of button
        stopPropagation: false // Stops event propagation
      }
    );
    // megamenu trigeer
    $(".dropdown-trigger").dropdown({
     inDuration: 300,
      outDuration: 225,
      constrainWidth: false, // Does not change width of dropdown to that of the activator
      hover: true, // Activate on hover
      gutter: 0, // Spacing from edge
      belowOrigin: false, // Displays dropdown below the button
      alignment: 'left', // Displays dropdown with edge aligned to the left of button
      stopPropagation: false // Stops event propagation
    });

    // scroll down button
    $(".ball").click(function() {
        $('html, body').animate({
            scrollTop: $(".ball").offset().top
        }, 2000);
    });

    // animations
    AOS.init();

    // back to top
    $(window).scroll(function() {
        if ($(this).scrollTop() > 500) {
            $('#toTop').fadeIn();
        } else {
            $('#toTop').fadeOut();
        }
    });

    $("#toTop").click(function (e) {
        e.preventDefault();
        $("html, body").animate({scrollTop: 0}, 1000);
    });
    
    $('.slider-navigation-link').on('click',function(){
        var _slide = $(this).data('slide');
        $('.w-slider-mask').show();
        
        $('.slider-navigation-link').removeClass('active');
        $(this).addClass('active');
        
       $('.w-slide.fade').fadeOut('slow');
       // $('.w-slide.active').fadeOut('slow');
        $('.w-slide.fade').removeClass('fade');
        
        $('.w-slide.'+_slide).addClass('fade');
        $('.w-slide.'+_slide).fadeIn('slow');
        
        
        
    });
    
  });   