(function($){
    $(function() {
      	// Add slideDown animation to Bootstrap dropdown when expanding.
		$('.dropdown').on('show.bs.dropdown', function() {
			if($(window).width() > 768)
				$(this).find('.dropdown-menu').first().stop(true, true).slideDown();
			else
				$(this).find('.dropdown-menu').first().stop(true, true).show();
		});

		// Add slideUp animation to Bootstrap dropdown when collapsing.
		$('.dropdown').on('hide.bs.dropdown', function() {
			if($(window).width() > 768)
				$(this).find('.dropdown-menu').first().stop(true, true).slideUp();
			else
				$(this).find('.dropdown-menu').first().stop(true, true).hide();
		});

    	/** Slick Scrollers and Sliders initiatlisaton **/
    	$('.ms-scroller-row').slick({
			dots: false,
			infinite: true,
			speed: 200,
			slidesToShow: 4,
			arrows: true,
			nextArrow: '<span class="ms-slideshow-arrow slick-next"><i class="fa fa-chevron-right" aria-hidden="true"><span class="sr-only">Next</span></i></span>',
			prevArrow: '<span class="ms-slideshow-arrow slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"><span class="sr-only">Previous</span></i></span>',
			swipeToSlide: true,
			responsive: [
			  {
			    breakpoint: 992,
			    settings: {
			      slidesToShow: 3,
			      slidesToScroll: 1
			    }
			  },
			  {
			    breakpoint: 768,
			    settings: {
			      slidesToShow: 2,
			      slidesToScroll: 1
			    }
			  }
			],
		});
		$('#ms-custom-slider-auto').slick({
			dots: true,
			infinite: true,
			autoplay: true,
			autoplaySpeed: 3000,
			slidesToShow: 1,
			arrows: false,
			pauseOnHover: false
		});

		$('.ms-system-animation').slick({
			infinite: true,
			autoplay: true,
			autoplaySpeed: 2000,
			pauseOnHover: false,
			pauseOnFocus: false,
			dots: false,
			speed: 500,
			arrows: false,
			fade: true,
			cssEase: 'linear'
		});


    });	// End of run when DOM ready function



    // Scroll to element with ID that matches that of the anchors href provided
    function scrollTo(anchor) {
    	var section = anchor.attr("href");
    	$("html, body").animate({
	        scrollTop: $(section).offset().top
	    });
    }


})(jQuery);





Number.prototype.mod = function(n) {
	return ((this%n)+n)%n;
}