//const MENU_SPEED = 150;


function initMenu() {
	$('#menu li').each(function() {
		var the_li = $(this);
		$(the_li).hover(function() {
			the_li.addClass('hovered');
			the_li.children('ul').each(function() {
			    $(this).stop(false,true);

				$(this).slideDown(150, 'easeInQuart');
			});
		},

		function(){
			
			if(the_li.children('ul').length < 1)
			{
				the_li.removeClass('hovered');
			}
			
			the_li.children('ul').each(function() {
			    $(this).stop(true,true);
				$(this).slideUp(150, 'easeOutQuart', function(){
					the_li.removeClass('hovered');
				});
			});
		}

		);
	});
}



function nextSlide() {
	
	var active = $('#slideshow div.active');
	
	var next = $(active).next().length? $(active).next() : $('#slideshow div.header:first');
	

	
	$(next).css({opacity : 0.0 });
	
	$(next).addClass('active');
	$(active).addClass('last-active');
	
	$(next).animate({opacity: 1.0}, 1200, function() {
		$(active).removeClass('active last-active');
	});
	
}



$(document).ready(function() {
	initMenu();
	setInterval("nextSlide()", 7500);
});





