new WOW().init();

jQuery(document).ready(function($) {
	
	$(window).bind('load', function() {
		$('#loader').fadeOut(100);
	});

	$('.nav-toggle').on('touchstart click', function(e) {
		e.preventDefault();
		$( this ).toggleClass( 'active' );
	});

	$(function dw_hidenav() {
		var headerHeight = $('.navbar').height();
		$(window).on('scroll', { previousTop: 0 },
			function() {
			var currentTop = $(window).scrollTop();
			if (currentTop < this.previousTop) {
				if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
						$('.navbar').addClass('visible');
						$('.site-title a').removeClass('light');
					} else {
						$('.navbar').removeClass('visible fixed');
					}
			} 
			else {
				$('.navbar').removeClass('visible');
				if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
			}
			this.previousTop = currentTop;
			}  
		);
	});

	$('#gallery').carousel({
		interval: false,
		wrap: true,
	});
	
	$(document).bind('keyup', function(e) {
	    if(e.which === 39){
			$('#gallery').carousel('next');
	    }
	    else if(e.which === 37){
			$('#gallery').carousel('prev');
	    }
	});
	
	$('.prev').click(function() {
	  $('#gallery').carousel('prev');
	});

	$('.next').click(function() {
	  $('#gallery').carousel('next');
	});
			
});