function disableMenu()
{
	$.each($('ul.menu li a'), function(){
		$(this).removeClass("menu-select");
	});
}
function initMenus() 
{
	
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
		var cookie = $.cookie(this.id);
		if(cookie == null && String(cookie).length < 1)
			$('#' + this.id + '.expandfirst ul:first').show();
		else {
			$('#' + this.id + ' .' + cookie).next().show();
			$('#' + this.id + ' .' + cookie).addClass("menu-select");

		}
	});
	$('ul.menu li a').mouseover(function(){
		var checkElement = $(this).next();
	
		var parent = this.parentNode.parentNode.id;
		if((checkElement.is('ul')) && (checkElement.is(':visible'))){
			
			if($('#' + parent).hasClass('collapsible'))
			{
				$('#' + parent + ' ul:visible').slideUp('slow');
				
				if((String(parent).length > 0) && (String(this.className).length > 0))
					$.cookie(parent,null);
			}
			return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))){
			$('#' + parent + ' ul:visible').slideUp('slow');
			disableMenu();
			if((String(parent).length > 0) && (String(this.className).length > 0))
				$.cookie(parent, this.className,{ expires: 7, path: '/', domain: 'culture.silverhand.fr', secure: false });
			checkElement.slideDown('slow');
			$(this).addClass("menu-select");

			return false;
		}
	});
}
jQuery().ready(function()
{
	initMenus();
});

