jQuery(document).ready(function(){
    $(".dropdown").hover(
      function() { $('.dropdown-menu', this).stop().fadeIn("fast");
        },
      function() { $('.dropdown-menu', this).stop().fadeOut("fast");
    });
  });
$('.clientcountbg ul li').hover(function() {
    $('.clientcountbg ul li').removeClass('active');
    $(this).addClass('active');
});

$(document).ready(function(e) {
  $('.tab-button').click(function(){
    
  $('.tab-button').removeClass('on');
  $('.tab-caption').slideUp('normal');
  if($(this).next().is(':hidden')==true){
  $(this).addClass('on');
  
  $(this).next().slideDown('normal'); 
    }
  });
  $('.tab-caption').hide();
  $('.tab-caption:first').show();
  $('.tab-button:first').addClass('on');
  
});
$('#video').click(function(){
   document.getElementById('video').play();
});

var arrowIcons = [
        '<span class="fa fa-angle-left"></span>',
        '<span class="fa fa-angle-right"></span>'
    ];



    $.each($(".owl-slider"), function (i, n) {

        var $n = $(n);

        $n.owlCarousel({
            autoplay: $n.data("autoplay"),
            autoplayTimeout: 6000,
            autoplayHoverPause: true,
            items: 1,
            loop: true,
            // spacing
            margin: 10,
            stagePadding: 0,
            // navigation
            nav: true,
            dots: false,
            navText: arrowIcons,
            // animation effects
            smartSpeed: 950,
            onTranslated: startAnimation,
            onTranslate: resetAnimation,
            animateIn: 'fadeIn',
            animateOut: 'fadeOut'
        });

        resetAnimation(); // reset effects all on initalization
        startAnimation(); // start animation on first slide

        function startAnimation(event) {
            // find active slide
            var activeItem = $(n).find('.owl-item.active'),
                timeDelay = 100;

            $.each(activeItem.find('.animated'), function (j, m) {
                // catch active slide
                var item = $(m);
                item.css('animation-delay', timeDelay + 'ms');
                timeDelay = timeDelay + 180;
                // add animation
                item.removeClass('fadeOut');
                item.addClass(item.data('start'));
            });
        }

        function resetAnimation(event) {
            // catch all slides
            var items = $(n).find('.owl-item');
                // for each add animation end
                $.each(items.find('.animated'), function (j, m) {
                    var item = $(m);
                    item.removeClass(item.data('start'));
                    item.addClass('fadeOut');
                });
        }
        
        
    });
var arrowcollectionIcons = [
        '<span class="fa fa-long-arrow-left"></span>',
        '<span class="fa fa-long-arrow-right"></span>'
    ];
 $.each($(".project-slider"), function (i, n) {
        $(n).owlCarousel({
            items: 3,
            loop: true,
            center: false,
            autoplay: true,
            // spacing
            stagePadding: 0,
            // navigation
            nav: false,
            dots: true,
            navText: arrowcollectionIcons,
            margin:30,
            // animation effects
            smartSpeed: 950,
            responsive: {
                0: {
                    items: 1,
                    nav: false
                },
                1000: {
                    items: 3,
                    nav: true,
                    loop: true
                },
                1200: {
                    items: 3,
                    nav: true,
                    loop: true
                },
                
            }
        });

    });
$.each($(".clientslider"), function (i, n) {
        $(n).owlCarousel({
            items: 3,
            loop: true,
            center: false,
            autoplay: true,
            // spacing
            stagePadding: 0,
            // navigation
            nav: false,
            dots: true,
            margin:30,
            // animation effects
            smartSpeed: 950,
            responsive: {
                0: {
                    items: 2,
                    nav: false
                },
                1000: {
                    items: 4,
                    nav: true,
                    loop: true
                },
                1200: {
                    items: 7,
                    loop: true
                },
                
            }
        });

    });
$('input[type="file"]').each(function(){
  // Refs
  var $file = $(this),
      $label = $file.next('label'),
      $labelText = $label.find('span'),
      labelDefault = $labelText.text();
  
  // When a new file is selected
  $file.on('change', function(event){
    var fileName = $file.val().split( '\\' ).pop(),
        tmppath = URL.createObjectURL(event.target.files[0]);
    //Check successfully selection
        if( fileName ){
      $label
        .addClass('file-ok')
        .css('background-image', 'url(' + tmppath + ')');
            $labelText.text(fileName);
    }else{
      $label.removeClass('file-ok');
            $labelText.text(labelDefault);
    }
  });
  
// End loop of file input elements  
});
