/**
 * @author gmacri
 */
$(document).ready(function(){
	
	var timeout;
	var activeEl;
	
	var rollOver = function() {
		clearTimeout(timeout);
		if (activeEl) {
			activeEl.children('ul').hide();
		}
		
		$(this).children('ul').show();
		activeEl = $(this);
	};
	
	var rollOut = function() {
		timeout = setTimeout(
			function() {
				console.log('Closing');
				activeEl.children('ul').hide();
			},
			500
		);
	};

	$(".navigation > li").hover(
			function() {
				clearTimeout(timeout);
				if (activeEl) {
					activeEl.children('ul').hide();
				}
				$(this).children('ul').show();
				activeEl = $(this);
			},
			function() {
				timeout = setTimeout(
					function() {
						activeEl.children('ul').hide();
					},
					500
				);
			}
	);
	
	
	

});
