jQuery(function ($) {
'use strict';

$(document).ready(function () {
$('.style-switch-button').click(function () {
$('.style-switch-wrapper').toggleClass('active');
});
$('a.close-styler').click(function () {
$('.style-switch-wrapper').removeClass('active');
});
});

$(window).on('scroll', function () {
if ($(window).scrollTop() > 100) {
$('.header').addClass('header-solid animated fadeInDown');
} else {
$('.header').removeClass('header-solid animated fadeInDown');
}
});
$(window).on('load', function () {
if ($(window).scrollTop() > 100) {
$('.header').addClass('header-solid animated fadeInDown');
} else {
$('.header').removeClass('header-solid animated fadeInDown');
}
});
$(window).on('scroll', function () {
if ($(window).scrollTop() > 200) {
$('.header2').addClass('header-bgnone animated fadeInDown');
} else {
$('.header2').removeClass('header-bgnone animated fadeInDown');
}
});
$('.flexSlideshow').flexslider({
slideshowSpeed: 5000,
animationSpeed: 600
});

$(document).ready(function () {
	$('#main-slide').owlCarousel({
	pause: true,
	interval: 100000
	});
	$('.counter').counterUp({
	delay: 10,
	time: 1000
	});
});
$('#testimonial-carousel').owlCarousel({
	items:1,
	nav: false,
	dots: false,
	loop:true,
	margin:10,
	autoplay:true,
	autoplayTimeout:9000,
	autoplaySpeed:3000,
	autoplayHoverPause:true,
	responsive : {
		0 : {
			items:1
		},
		480 : {
			items:1
		},
		768 : {
			items:1
		}
	}
});


$('#client-carousel').owlCarousel({
	
	items:5,
	nav: false,
	dots: false,
	loop:true,
	margin:10,
	autoplay:true,
	autoplayTimeout:6000,
	autoplaySpeed:3000,
	smartSpeed: 3000,
	autoplayHoverPause:true,
	responsive : {
		0 : {
			items:2
		},
		480 : {
			items:2
		},
		768 : {
			items:3
		},
		1200 : {
			items:5
		}
	}
	
});

var owl2 = $('#client-carousel');

$('#client-left-carousel').owlCarousel({
	
	items:2,
	nav: false,
	dots: false,
	loop:false,
	rewind:true,
	margin:10,
	autoplay:true,
	autoplayTimeout:5000,
	autoplaySpeed:3000,
	smartSpeed: 800,
	rewindSpeed : 500,
	autoplayHoverPause:true,
	responsive : {
		0 : {
			items:1
		},
		480 : {
			items:1
		},
		768 : {
			items:2
		},
		1200 : {
			items:2
		}
	}
	
});

var owl3 = $('#client-left-carousel');

$('.partner-left-btn').click(function () {
owl2.trigger('next.owl.carousel');
});
$('.partner-right-btn').click(function () {
owl2.trigger('prev.owl.carousel');
});


$('#app-gallery-carousel').owlCarousel({
navigation: false,
slideSpeed: 400,
pagination: true,
items: 4,
rewindNav: true,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [979, 3],
stopOnHover: true
});

/*$(window).load(function () {
$('.flexSlideshow').flexslider({
animation: 'fade',
controlNav: false,
directionNav: true,
slideshowSpeed: 8000
});
});
$(window).load(function () {
$('.flexportfolio').flexslider({
animation: 'fade',
controlNav: false,
directionNav: true,
slideshowSpeed: 8000
});
});*/
var resizeVideoBackground = function () {
$('.video-background').each(function (i, el) {
var $el = $(el),
$section = $el.parent(),
min_w = 300,
video_w = 16,
video_h = 9,
section_w = $section.outerWidth(),
section_h = $section.outerHeight(),
scale_w = section_w / video_w,
scale_h = section_h / video_h,
scale = scale_w > scale_h ? scale_w : scale_h,
new_video_w, new_video_h, offet_top, offet_left;
if (scale * video_w < min_w) {
scale = min_w / video_w;
}
new_video_w = scale * video_w;
new_video_h = scale * video_h;
offet_left = (new_video_w - section_w) / 2 * -1;
offet_top = (new_video_h - section_h) / 2 * -1;
$el.css('width', new_video_w);
$el.css('height', new_video_h);
$el.css('marginTop', offet_top);
$el.css('marginLeft', offet_left);
});
};
$(window).on('resize', function () {
resizeVideoBackground();
});
resizeVideoBackground();
$(window).scroll(function () {
if ($(this).scrollTop() > 50) {
$('#back-to-top').fadeIn();
} else {
$('#back-to-top').fadeOut();
}
});
// scroll body to 0px on click
$('#back-to-top').click(function () {
$('#back-to-top').tooltip('hide');
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
$('#back-to-top').tooltip('hide');





});
$(document).ready(function() {
    
	
var $lg = $("#lightgallery");

$lg.lightGallery({
	download:false,
	thumbnail:false,
	autoplayControls:true,
	autoplay:false,
	flipHorizontal:false,
	flipVertical:false,
	rotate:false,
	actualSize:false,
	closable:true,
	googlePlus:false,
	index:0,
	speed:1000,
	pause:5000
	//appendAutoplayControlsTo:'#slideshow',
	
});
 


$("#slideshow").on("click", () => {
   $("#lightgallery a:first-child > img").trigger("click");
   $(".lg-autoplay-button").trigger("click");
});


});
 $('.poshan-slider').owlCarousel({
     
    items:3,
	nav: true,
	dots: false,
	loop:false,
	margin:10,
	autoplay:false,
	autoplayTimeout:2000,
	autoplaySpeed:2000,
	smartSpeed: 1000,
	autoplayHoverPause:true,
	navText: ['<span class="fa fa-chevron-left fa-2x"></span>','<span class="fa fa-chevron-right fa-2x"></span>'],
	responsive : {
		0 : {
			items:1
		},
		480 : {
			items:1
		},
		768 : {
			items:3
		},
		1200 : {
			items:3
		}
	}
     
     
    /*loop:true,
	autoplay: true,
    autoplayTimeout: 5000,
    margin:20,
    autoHeight : true,
    navigation: true,
    slideSpeed: 400,
    pagination: false,
    items: 3,
    rewindNav: true,
    itemsDesktop: [1199, 3],
    itemsDesktopSmall: [991, 3],
    itemsTablet: [768,2], // 2 items between 600 and 480
    itemsMobile : [500,1] , // 1 item between 479 and 0
    stopOnHover: true,
	navigationText: ['<span class="fa fa-chevron-left fa-2x"></span>','<span class="fa fa-chevron-right fa-2x"></span>'],*/
    
});
$('.poshan-slider-new').owlCarousel({
    loop:true,
	autoplay: true,
    autoplayTimeout: 5000,
    margin:20,
    autoHeight : true,
    navigation: true,
    slideSpeed: 400,
    pagination: false,
    items: 1,
    rewindNav: true,
    itemsDesktop: [1199, 1],
    itemsDesktopSmall: [991, 1],
    itemsTablet: [768,1], // 2 items between 600 and 480
    itemsMobile : [500,1] , // 1 item between 479 and 0
    stopOnHover: true,
	navigationText: ['<span class="fa fa-chevron-left fa-2x"></span>','<span class="fa fa-chevron-right fa-2x"></span>'],
    
});

 if($(window).width() < 768) {
		//nav.removeClass('mobile');
		$('.navbar-toggler').click(function(){
		    $('.dropdown-toggle').each(function() {
			  $(this).removeClass('show');
			  $(this).next('.dropdown-menu').removeClass('show');
			});
			$('.sub-menu .drop-down').each(function(){
				$(this).next('.inside-menu').removeClass('show');
				$(this).removeClass('show');
			});
		});
		
		$('.dropdown-toggle').click(function(){
			
			$('.sub-menu .drop-down').each(function(){
				$(this).next('.inside-menu').removeClass('show');
				$(this).removeClass('show');
			});
			
			if($(this).hasClass('show')){
				$(this).next('.dropdown-menu').removeClass('show');
				$(this).removeClass('show');
			}else{
				$(this).next('.dropdown-menu').addClass('show');
				$(this).addClass('show');
			}
		});
		
		$('.sub-menu .drop-down').click(function(){
			if($(this).hasClass('show')){
				$(this).next('.inside-menu').removeClass('show');
				$(this).removeClass('show');
			}else{
				$(this).next('.inside-menu').addClass('show');
				$(this).addClass('show');
			}
		});

}

var wow = new WOW(
  {
    boxClass:     'wow',      // animated element css class (default is wow)
    animateClass: 'animated', // animation css class (default is animated)
    offset:       0,          // distance to the element when triggering the animation (default is 0)
    mobile:       true,       // trigger animations on mobile devices (default is true)
    live:         true,       // act on asynchronously loaded content (default is true)
    callback:     function(box) {
      // the callback is fired every time an animation is started
      // the argument that is passed in is the DOM node being animated
    },
    scrollContainer: null,    // optional scroll container selector, otherwise use window,
    resetAnimation: true,     // reset animation on end (default is true)
  }
);
wow.init();

$('.ttm-tabs').each(function() {
	$(this).children('.content-tab').children().hide();
	$(this).children('.content-tab').children().first().show();
	$(this).find('.tabs').children('li').on('click', function(e) {  
		var liActive = $(this).index(),
			contentActive = $(this).siblings().removeClass('active').parents('.ttm-tabs').children('.content-tab').children().eq(liActive);
		contentActive.addClass('active').fadeIn('slow');
		contentActive.siblings().removeClass('active');
		$(this).addClass('active').parents('.ttm-tabs').children('.content-tab').children().eq(liActive).siblings().hide();
		e.preventDefault();
	});
});
  /*  $(document).ready(function(){
$('.carousel[data-type="multi"] .item').each(function(){
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));
  
  for (var i=0;i<4;i++) {
    next=next.next();
    if (!next.length) {
        next = $(this).siblings(':first');
    }
    
    next.children(':first-child').clone().appendTo($(this));
  }
});
});*/
$(document).ready(function(){
function toggle_video_modal() {
      
      $(".js-trigger-video-modal").on("click", function(e){           
          e.preventDefault();        
          var id = $(this).attr('data-youtube-id');
          var autoplay = '?autoplay=1';
          var related_no = '&rel=0';
          var src = 'https://www.youtube.com/embed/'+id;
          $("#youtube").attr('src', src);
          $("body").addClass("show-video-modal noscroll");
      });

     
      function close_video_modal() {
        event.preventDefault();
        $("body").removeClass("show-video-modal noscroll");
        $("#youtube").attr('src', '');
        
      }
      $('body').on('click', '.close-video-modal, .video-modal .overlay', function(event) {
          close_video_modal();
          
      });
      $('body').keyup(function(e) {
          if (e.keyCode == 27) { 
            close_video_modal();
            
          }
      });
  }
  toggle_video_modal();

});
$(document).ready(function(){
   $('.nav-gallary').click(function(){
      // reset active class
      $('.nav-gallary').removeClass("active");
      // add active class to selected
      $(this).addClass("active");
      // return needed to make function work
      return false;
   });
   
   
   $(function() {
      // create an empty variable
      var selectedClass = "";
      // call function when item is clicked
      $(".nav-gallary").click(function(){
         // assigns class to selected item
         selectedClass = $(this).attr("data-rel");
         // fades out all portfolio items
         $(".gallary_1 li").fadeOut(300);
         // fades in selected category
         $(".gallary_1 li." + selectedClass).delay(300).fadeIn(300);
      });
   });
  
}); // document ready
$(document).ready(function() {
  $(".fancybox-thumb").fancybox({
    prevEffect  : 'none',
    nextEffect  : 'none',
    helpers : {
      title : {
        type: 'outside'
      },
      thumbs  : {
        width : 50,
        height  : 50
      }
    }
  });
});
	var revapi;

	jQuery(document).ready(function() {

		   revapi = jQuery('.tp-banner').revolution(
			{
				delay:9000,
				startwidth:1270,
				startheight:580,
				//hideThumbs:10,
				fullWidth:"on",
				forceFullWidth:"on",
				hideThumbs:300,
				thumbWidth:150,
				thumbHeight:50,
				thumbAmount:3,
				navigationType:"bullet",
				navigationStyle:"flat",
				navigationHAlign:"center",
				navigationVAlign:"bottom",
				navigationHOffset:10,
				navigationVOffset:10,
				navigation: {
					bullets: {
						enable: true,
						style: 'hermes',
						}
				}
				
			});

	});	//ready
		 $(".set > a").each(function(){
		  if ($(this).hasClass("active")) {
			  $(this).find("i").removeClass("fa-plus").addClass("fa-minus");
			  $(this).next(".accordion-content").slideDown(200);
		  }
	 });
		 
	$(document).ready(function() {
		
		
	  $(".set > a").on("click", function() {
		if ($(this).hasClass("active")) {
		  $(this).removeClass("active");
		  $(this)
			.siblings(".accordion-content")
			.slideUp(200);
		  $(".set > a i")
			.removeClass("fa-minus")
			.addClass("fa-plus");
		} else {
		  $(".set > a i")
			.removeClass("fa-minus")
			.addClass("fa-plus");
		  $(this)
			.find("i")
			.removeClass("fa-plus")
			.addClass("fa-minus");
		  $(".set > a").removeClass("active");
		  $(this).addClass("active");
		  $(".accordion-content").slideUp(200);
		  $(this)
			.siblings(".accordion-content")
			.slideDown(200);
		}
	  });
	});
	  /*  $(document).ready(function(){
$('.carousel[data-type="multi"] .item').each(function(){
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));
  
  for (var i=0;i<4;i++) {
    next=next.next();
    if (!next.length) {
        next = $(this).siblings(':first');
  	}
    
    next.children(':first-child').clone().appendTo($(this));
  }
});
});*/
$(document).ready(function(){
function toggle_video_modal() {
	    
	    $(".js-trigger-video-modal").on("click", function(e){           
	        e.preventDefault();        
          var id = $(this).attr('data-youtube-id');
          var autoplay = '?autoplay=1';
          var related_no = '&rel=0';
          var src = 'https://www.youtube.com/embed/'+id;
          $("#youtube").attr('src', src);
          $("body").addClass("show-video-modal noscroll");
      });

	   
      function close_video_modal() {
        event.preventDefault();
        $("body").removeClass("show-video-modal noscroll");
        $("#youtube").attr('src', '');
        
      }
	    $('body').on('click', '.close-video-modal, .video-modal .overlay', function(event) {
          close_video_modal();
	        
      });
      $('body').keyup(function(e) {
          if (e.keyCode == 27) { 
            close_video_modal();
            
          }
      });
	}
	toggle_video_modal();

});
jQuery(document).ready(function() {
var offset = 220;
var duration = 600;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.crunchify-top').fadeIn(duration);
} else {
jQuery('.crunchify-top').fadeOut(duration);
}
});
jQuery('.crunchify-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
});


$('.popup-youtube').magnificPopup({
	disableOn: 700,
	type: 'iframe',
	mainClass: 'mfp-fade',
	removalDelay: 160,
	preloader: false,
	fixedContentPos: false
});

/*function openCity(evt, cityName) {
document.getElementById("defaultOpen");
const gradient = document.querySelector(".gradient");
}
function onMouseMove(event) {
    gradient.style.backgroundImage = 'radial-gradient(at ' + event.clientX + 'px ' + event.clientY + 'px, rgba(159, 0, 191, 0.38) 0, rgba(77, 79, 167, 0.7) 70%)';
}
document.addEventListener("mousemove", onMouseMove);
*/

});

    // cache container
    var $container = $('.dt-sc-portfolio-container');

    // initialize isotope
    $container.isotope({
    // options...
    itemSelector: '.isotope-item'
    });

    // filter items when filter link is clicked
    $('.dt-sc-sorting-container a').on('click', function() {
    	var selector = $(this).data('filter');
		$container.isotope({
			filter: selector
		});
	});
