// Fixup menu

$(document).ready(function() {
	$("#header ul li:has(a):not(#header ul li ul li)").mouseover(function() {
		$("#header ul li.active").addClass("active-disabled").removeClass("active");
		$("#header ul li.next").addClass("next-disabled").removeClass("next");
		$(this).next("li").addClass("next");
	}).mouseout(function() {
		$("#header ul li.next").removeClass("next");
		$("#header ul li.active-disabled").addClass("active").removeClass("active-disabled");
		$("#header ul li.next-disabled").addClass("next").removeClass("next-disabled");
	});
	
	/* Dropdown menus */
	
	$("#header li:not(#header ul li ul li)").mouseover(function() {
		$(this).addClass("hover");
	}).mouseout(function() {
		$(this).removeClass("hover");
	});
	
	/* Making them keyboard accessible (based off of http://carroll.org.uk/sandbox/suckerfish/bones2.html */
	
	$("#header a").each(function() {
		$(this).focus(function() {
			$(this).parent().addClass("hover");
			$(this).parents("li").addClass("hover");
		});
		
		$(this).blur(function() {
			$(this).parent().removeClass("hover");
			$(this).parents("li").removeClass("hover");
		});
	});
});