(function($) {

	"use strict";
	
	var carousel = function() {
		$('.carouselprty').slick({
			slidesToShow: 1,
			slidesToScroll: 1,
			arrows: true,
			fade: true,
			adaptiveHeight: true,
			lazyLoad: 'ondemand',
			asNavFor: '.slider-nav'
		});
		
		$('.slider-nav').slick({
			slidesToShow: 4,
			slidesToScroll: 1,
			asNavFor: '.carouselprty',
			dots: false,
			centerMode: true,
			focusOnSelect: true,
			responsive: [
				{
					breakpoint: 1024,
					settings: {
						slidesToShow: 4,
						slidesToScroll: 1,
						infinite: true,
						dots: true
					}
				},
				{
					breakpoint: 600,
					settings: {
						slidesToShow: 3,
						slidesToScroll: 1
					}
				},
				{
					breakpoint: 480,
					settings: {
						slidesToShow: 3,
						slidesToScroll: 1
					}
				}
			]
		});
		
		$('.banner-slide').slick({
			slidesToShow: 1,
			slidesToScroll: 1,
			arrows: false,
			dots: true,
			fade: true,
			centerMode: true,
			focusOnSelect: true,
			adaptiveHeight: true,
			autoplay:true,
  			autoplaySpeed:5000,
			//lazyLoad: 'ondemand',
			//asNavFor: '.slider-nav'
		});
		
		
		
	};
	carousel();
	
	$('.litebox').liteBox();
	
	
	$(document).ready(function() {
		$(".expendContentMore").click(function(){
			if($('.hcontent').hasClass("textless")) {
				$('.hcontent').removeClass("textless");
				$('.hcontent').addClass("textmore");
				$('.expendContentMore').html('Less <i class="fa fa-chevron-circle-up"></i>');
			} else {
				$('.hcontent').removeClass("textmore");
				$('.hcontent').addClass("textless");
				$('.expendContentMore').html('More <i class="fa fa-chevron-circle-down"></i>');
			}
			return false;
		});
	});
	
	
	$(document).ready(function(){
		$(function(){
			$("#mobile_menu li ul").hide();
			$(".fa-plus").on('touchstart click', function() {
				$("#mobile_menu li ul").hide();
				if($("+ul", this).css("display")=="none"){
					$("+ul", this).show();
				}
			});
		});
	});
    
	var $win = $(window);
	$win.scroll(function () {
		if ($win.scrollTop() == 0)
			$('#floatNavArrow').show();
		else 
		if ($win.scrollTop() + $win.height() + 400 >= $(document).height()) {
			$('#floatNavArrow').hide();
		}
		else {
			$('#floatNavArrow').show();
		}
	});
	
	
	
	$(function() {      
		var isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;
	
		if (isMobile) {
			
			$( ".btnFrame" ).insertAfter( $( ".txtFrame" ) );
			
			$( ".prty_items" ).insertAfter( $( ".summaryFrame" ) );
			
			var owl = function() {
				$(".carouselTabs").owlCarousel({
					autoplay: true,
					lazyLoad: true,
					loop: true,
					margin: 10,
					responsiveClass: true,
					autoHeight: true,
					autoplayTimeout: 7000,
					smartSpeed: 800,
					nav: true,
					navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'],
					responsive: {
						0: {items: 1 },
						600: {items: 2 },
						1024: {items: 1 },
						1366: {items: 1 } 
					} 
				});
				
				$(".carouselNews").owlCarousel({
					autoplay: true,
					lazyLoad: true,
					loop: true,
					margin: 10,
					responsiveClass: true,
					autoHeight: true,
					autoplayTimeout: 7000,
					smartSpeed: 800,
					nav: true,
					navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'],
					responsive: {
						0: {items: 1 },
						600: {items: 2 },
						1024: {items: 1 },
						1366: {items: 1 } 
					} 
				});
				
				
				$(".carouselTeam").owlCarousel({
					autoplay: true,
					lazyLoad: true,
					loop: true,
					margin: 0,
					responsiveClass: true,
					autoHeight: true,
					autoplayTimeout: 7000,
					smartSpeed: 800,
					nav: true,
					dots:false,
					navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'],
					responsive: {
						0: {items: 3 },
						600: {items: 3 },
						1024: {items: 6 },
						1366: {items: 6 } 
					} 
				});
				
				
			};
			owl();
			
			
		}
	 });
	
	
	
	$(document).ready(function ($) {
			var owlSlider = function() {
				$("#testimonial-slider").owlCarousel({
					autoplay: true,
					lazyLoad: true,
					loop: false,
					margin: 0,
					responsiveClass: true,
					autoHeight: true,
					autoplayTimeout: 4000,
					smartSpeed: 800,
					dots: false,
					nav: false,
					//navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'],
					responsive: {
						0: {items: 1 },
						600: {items: 1 },
						1024: {items: 1 },
						1366: {items: 1 } 
					} 
				});
			};
			owlSlider();

	 });
	
	
	
	$(document).ready( function($) {
		 // remove the empty p tags
		$('#banner_caption p').each(function() {
			var $this = $(this);
			if($this.html().replace(/\s|&nbsp;/g, '').length == 0)
			$this.remove();
		});
	});
	
	
	$(function(){
		$(".menu-icon").click(function(){
			if( $('.logo').hasClass('inacivezindex') ) {
				$(".logo").removeClass("inacivezindex");
			} else {
				$(".logo").addClass("inacivezindex");
			}
		});
	});
	
	/*
	$(document).ready(function(){
		if(window.matchMedia("(max-width: 767px)").matches){
			// The viewport is less than 768 pixels wide
			alert("This is a mobile device.");
		} else{
			// The viewport is at least 768 pixels wide
			alert("This is a tablet or desktop.");
		}
	});
	*/
	
	
	

})(jQuery);
