(function($){
  our_team = function(){
    if( !this instanceof our_team ){
      return new our_team;
    }
  };

  our_team.fn = our_team.prototype = {
    init : function(){
      this_our_team = this;
      this_our_team.register_events();
    },

    register_events: function(){
      $(".devops_tech_list").on("click", function(e){
        //e.preventDefault();
        

        $active_filter = $(this).attr('id');

        //console.log( $active_filter );
        var id = $(this).attr("id");        
        $(".devops_tech_list").removeClass("our_team_add active");
        $(this).addClass("our_team_add active");
        
        this_our_team.load_from_ajax( $active_filter );

      });
    },

    load_from_ajax : function( filter ){

      var active_id = $(".devops_tech_list.active").attr('id');
      if( this_our_team.check_if_cxists(active_id) ){

        $.ajax({
          url: customObj.ajaxurl,
          type: 'POST',
          data: { action : 'load_more_team_elastic', 'json_filters' : filter },
          beforeSend: function(){
            $(".div_tab").fadeOut(300);
            $('.all_team_conatiner').append('<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>');
          },
          success: function(res){
            
            $(".all_team_conatiner").append(res);
            
          },
          complete: function(){
            $('.all_team_conatiner .fa-spinner').remove();
            $("#"+active_id+"_section").fadeIn(300);
          }
        });
      }
        
    },

    check_if_cxists: function(filter){
      //console.log( $("#"+filter+'_section').length );
      if( $("#"+filter+'_section').length == 0 ){
        return true;
      } else {
        $(".div_tab").fadeOut(300);
        $("#"+filter+"_section").fadeIn(300);
        return false;
      }
    }
  };

  window.our_team = our_team;
})(jQuery);


jQuery(document).ready(function($) {

  our_team.fn.init();
    var owl = $(".devpos-carousel1");
    owl.owlCarousel({
        nav: false,
        dots: true,
        items: 5,
        loop:false,
       //autoplay: true,
        autoplayHoverPause: true,
          itemsDesktop : [1499,4],
          itemsDesktopSmall : [1199,3],
          itemsTablet : [899,2],
          itemsMobile : [599,1],
    
          navigation : false,
         // navigationText : ['<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-left fa-stack-1x fa-inverse"></i></span>','<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-right fa-stack-1x fa-inverse"></i></span>'],
          responsive:{
            0:{
                items:2,
                margin:15
            },
            991:{
              items:4,
            },
            600:{
                items:2
            },
            1000:{
                items:5
            }
        }
    });

    var owl = $(".blockchain-carousel1");
    owl.owlCarousel({
        nav: false,
        dots: true,
        items: 5,
        loop:false,
       //autoplay: true,
        autoplayHoverPause: true,
          itemsDesktop : [1499,4],
          itemsDesktopSmall : [1199,3],
          itemsTablet : [899,2],
          itemsMobile : [599,1],
    
          navigation : false,
         // navigationText : ['<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-left fa-stack-1x fa-inverse"></i></span>','<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-right fa-stack-1x fa-inverse"></i></span>'],
          responsive:{
            0:{
                items:2,
                margin:15
            },
            991:{
              items:4,
            },
            600:{
                items:2
            },
            1000:{
                items:5
            }
        }
    });


    var owl = $(".blockchain-trend-carousel");
    owl.owlCarousel({
        nav: true,
    items: 3,
    loop:true,
   // autoplay: true,
    autoplayHoverPause: true,
      itemsDesktop : [1499,4],
      itemsDesktopSmall : [1199,3],
      itemsTablet : [899,2],
      itemsMobile : [599,1],

      navigation : true,
      navigationText : ['<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-left fa-stack-1x fa-inverse"></i></span>','<span class="fa-stack"><i class="fa fa-circle fa-stack-1x"></i><i class="fa fa-chevron-circle-right fa-stack-1x fa-inverse"></i></span>'],
      responsive:{
        0:{
            items:1,
            margin:15,
            nav:false,
            dots:true,
        },
        991:{
          items:4,
        },
        600:{
            items:2,
            nav:false,
            dots:true,
        },
        1000:{
            items:3
        }
    }
    });

    // Tab javascript

  $(".div_tab:nth-child(1)").show();
  //$(".devops_tech_list:nth-child(1)").css("color","#3080c2");


});

// Js for separet links in our team page

          jQuery(window).on('load',function(){ 
            if(window.location.hash) {
              var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
              jQuery("#"+hash+" a").click();
             
            } 
          });

          $(document).on('mouseenter', ".iffyTip", function () {
            var $this = $(this);
            var $title = $(this).find("span");
                $this.tooltip({
                    title: $title.text(),
                    placement: "bottom"
                });
                $this.tooltip('show');
          });


