(function($){

$(document).ready(function(){
	$('#header-menu .item>div:not(.item)>*').hover(
		function() {
			var $parent = $(this).parent();
			$parent.addClass('hover');
			$parent.removeClass('mouseout');
		},
		function() {
			var $parent = $(this).parent();
			$parent.addClass('mouseout');
			setTimeout(function(){
				if ($parent.hasClass('mouseout')) {
					$parent.removeClass('hover');
					$parent.removeClass('mouseout');
				}
			}, 100);
		}
	);
	
	var $imagesSlideshow = $('.images-slideshow>img');
	$imagesSlideshow.filter(':first').show();
	
	setInterval(function(){
		var $curImage = $imagesSlideshow.filter(':not(:hidden)');
		var $nextImage = $curImage.next('img');
		if (0 == $nextImage.length) {
			$nextImage = $imagesSlideshow.eq(0);
		}
		
		$nextImage.fadeIn(2500);
		$curImage.fadeOut(2500);
	}, 10000);
});

})(jQuery);