jQuery(window).scroll(function(){
    if(jQuery('body').hasClass('home')){
        if(jQuery(window).scrollTop()>=jQuery(window).height()-jQuery('.header.menu-section').height()){
          jQuery('.header.menu-section').addClass('scrolled');
        }else{
          jQuery('.header.menu-section').removeClass('scrolled');
        }
    }else{
        if(jQuery(window).scrollTop()<=jQuery('.top-header').height()){
          jQuery('.header.menu-section').removeClass('scrolled');
        }else{
          jQuery('.header.menu-section').addClass('scrolled'); 
        }
    }
});
jQuery('document').ready(function($){$('#loginHolder .form').find('input, textarea').on('keyup blur focus', function (e) {
  
  var $this = $(this),
      label = $this.prev('label');

	  if (e.type === 'keyup') {
			if ($this.val() === '') {
          label.removeClass('active highlight');
        } else {
          label.addClass('active highlight');
        }
    } else if (e.type === 'blur') {
    	if( $this.val() === '' ) {
    		label.removeClass('active highlight'); 
			} else {
		    label.removeClass('highlight');   
			}   
    } else if (e.type === 'focus') {
      
      if( $this.val() === '' ) {
    		label.removeClass('highlight'); 
			} 
      else if( $this.val() !== '' ) {
		    label.addClass('highlight');
			}
    }

});

$('#loginHolder .tab a').on('click', function (e) {
  
  e.preventDefault();
  
  $(this).parent().addClass('active');
  $(this).parent().siblings().removeClass('active');
  
  target = $(this).attr('href');

  $('#loginHolder .tab-content > div').not(target).hide();
  
  $(target).fadeIn(600);
  
});
$('.slider-viewmore.ed-bttn').eq(0).attr('href',window.location.origin+'/solutions-services/business-intelligence-visual-analytics/');
$('.slider-viewmore.ed-bttn').eq(1).attr('href',window.location.origin+'/solutions-services/advanced-analytics/');
$('.slider-viewmore.ed-bttn').eq(2).attr('href',window.location.origin+'/industries/');
$('.slider-viewmore.ed-bttn').eq(3).attr('href',window.location.origin+'/solutions-services/big-data-analytics/');
$('.slider-viewmore.ed-bttn').eq(4).attr('href',window.location.origin+'/innovation/nex-analytics/');
$('.slider-viewmore.ed-bttn').eq(5).attr('href',window.location.origin+'/solutions-services/hire-a-consultant/');
    $('.loginPopper').mouseenter(function(){ $(this).css('right','0px'); });
    $('.loginPopper').mouseleave(function(){ $(this).css('right','-82px'); });
//    $('.testimonial-desc section-desc').txt('As the number of mobile users continues to outspace the number of desktop users, it should go without saying that designers, now more than ever, have to design with a mobile-first mentality.');
    $('#fireQuery').click(function(){ $('#queryOverlay').fadeIn(300); $('#dismissQuery').click(function(){ $('#queryOverlay').fadeOut(300); }); });
    $('#fireLogin').click(function(){ $('#loginOverlay').fadeIn(300); $('#dismissLogin').click(function(){ $('#loginOverlay').fadeOut(300); }); });
    $('.fpage-title').children('a').attr('href','#').click(function(e){ e.preventDefault(); });
    $('.fpost-title').children('a').attr('href','#').click(function(e){ e.preventDefault(); });
    if($('body').hasClass('home')){
        var pretext=$('.fpage-desc .desc-short').html(); $('.fpage-desc .desc-short').html(pretext.slice(0,-8)+'.. <a href="'+window.location.origin+'/about-newamps/corporate-profile/"><i class="fa fa-arrow-circle-right"></i></a></p>');
    }
//    $('.fpage-desc').click(function(){
//        $('.fpage-title').css('visibility','hidden');
//        var desc=$(this); desc.children('.desc-short').hide(); desc.children('.desc-long').show();
//        desc.css({width:'590px',zIndex:'100',position:'absolute'});
//        setTimeout(function(){ desc.css({marginTop:'-260px',height:'443px'}); 
//        desc.append('<i class="fa fa-minus-circle dismissDesc" style="font-size: 25px;bottom: 5px;right: 5px;position: absolute;"></i>');
//            $('.dismissDesc').click(function(e){ e.stopPropagation(); $(this).fadeOut(300,function(){ $(this).remove(); });
//                desc.removeAttr('style').css({zIndex:'1000',position:'absolute'});
//                setTimeout(function(){ desc.removeAttr('style'); desc.children('.desc-long').hide(); desc.children('.desc-short').show(); },800); $('.fpage-title').css('visibility','visible');
//            });
//        }, 1000);
//    });

    $('.header.menu-section').show();

    // header search option
    
    $('.search-icon .fa-search').click(function(){

        $('.ed-search ').addClass('search-active');

    });

    $('.search-icon .ed-search .search-close .fa-close ').on('click', function(){

      $('.ed-search').removeClass('search-active');

    });   



    //back to top button

    $('#back-to-top').css('right',-100);

    $(window).scroll(function(){

      if($(this).scrollTop() > 300){

        $('#back-to-top').css('right',0);

      }else{

        $('#back-to-top').css('right',-100);

      }

    });



    $("#back-to-top").click(function(){

      $('html,body').animate({scrollTop:0},600);

    });



    // homepage client slider

	$('.client-slider').owlCarousel({

		navigation: true,

		pagination: false,

		slideSpeed: 500,

		paginationNumbers: false,	

		items:3,	

        addClassActive: true,

        center:true,				

		loops: true,

        responsiveClass:true,         

        itemsDesktop : [1000,3], //3 items between 1000px and 901px

        itemsDesktopSmall : [900,3], // betweem 900px and 601px

        itemsTablet: [600,2],

	});

        $('.testimonial-post').click(function(){
            window.location.href=window.location.origin+'/testimonials/';
        });

	$('.testimonial-slider').owlCarousel({

        stagePadding: 50,

        loops: true,

        autoPlay: false,

        navigation: true,

        pagination: false,

        slideSpeed: 500,

        paginationNumbers: false,   

        items:3,

        responsiveClass:true,         

        itemsDesktop : [1000,3], //3 items between 1000px and 901px

        itemsDesktopSmall : [900,2], // betweem 900px and 601px

        itemsTablet: [600,1],

        afterAction: function(eq){

            //remove class active

            this

            .$owlItems

            .removeClass('active')



            //add class active

            this

            .$owlItems //owl internal $ object containing items

            .eq(this.currentItem+1)

            .addClass('active')    

        

      },     

    }); 



	$('.photo-slider').owlCarousel({

        stagePadding: 50,

        loops: true,

        autoPlay: false,

        navigation: true,

        pagination: false,

        slideSpeed: 500,

        paginationNumbers: false,   

        items:3,

        responsiveClass:true,         

        itemsDesktop : [1000,3], //3 items between 1000px and 901px

        itemsDesktopSmall : [900,2], // betweem 900px and 601px

        itemsTablet: [600,1],

        afterAction: function(eq){
            
            $('.owl-prev').html('<i class="fa fa-chevron-left fa-3x"></i>');
            $('.owl-next').html('<i class="fa fa-chevron-right fa-3x"></i>');

            //remove class active

            this

            .$owlItems

            .removeClass('active')



            //add class active

            this

            .$owlItems //owl internal $ object containing items

            .eq(this.currentItem+1)

            .addClass('active')    

        

      },     

    }); 

    $('button.menu-toggle').click(function(){

        $('body').toggleClass('menu-on');

    });



    //isotope data filter

    

    $('.portfolio-wrap .ed-sortable-grid').imagesLoaded( function() {

            var $grid = $('.ed-sortable-grid').isotope({

            itemSelector: '.element-item'

        });

           



        // bind filter button click



        $('.filters-button-group').on('click', 'li', function () {

            var filterValue = $(this).attr('data-filter');

            $grid.isotope({filter: filterValue});

        });



        // change is-checked class on buttons

        $('.button-group').each(function (i, buttonGroup) {

            var $buttonGroup = $(buttonGroup);

            $buttonGroup.on('click', 'li', function () {

                $buttonGroup.find('.is-checked').removeClass('is-checked');

                $(this).addClass('is-checked');

            });

        });



    });



// counter section

$('.counter').counterUp({

  delay: 10,

  time: 1000

});



// classyloader function

    $('.skill-loader').each(function () {

        var that = $(this);

        var percent = that.attr("data-percentage");

        that.waypoint({

            handler: function (direction) {

                that.ClassyLoader({

                    width: 120,

                    height: 120,

                    percentage: percent,

                    diameter: 70,

                    lineWidth: 10,

                    fontFamily: 'lato',

                    fontSize: '20px',

                    speed: 30,

                    diameter: 50,

                    lineColor: 'rgba(255, 255, 255, 1)',

                    remainingLineColor: 'rgba(255, 255, 255, 0.5)',

                    fontColor: 'rgba(255, 255, 255, 1)', 

                    start: 'top'                   

                });

            },

            offset: '95%'

        });

    });

});

