$(document).ready(function(){
	
		// remove link background images since we're re-doing the hover interaction below 
		// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
		// we also want to only remove the image on non-selected navi items, so this is a bit more complicated
		$(".navi").children("li").each(function() {
			var current = "navi current-" + ($(this).attr("class"));
			var parentClass = $(".navi").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each navi item
		attachnaviEvents(".navi", "navi-home");
		attachnaviEvents(".navi", "navi-news");
		attachnaviEvents(".navi", "navi-bio");
		attachnaviEvents(".navi", "navi-disco");
	

		function attachnaviEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				$(this).append('<div class="navi-' + myClass + '"></div>');
				$("div.navi-" + myClass).css({display:"none"}).fadeIn(250);
			}).mouseout(function() {
				$("div.navi-" + myClass).fadeOut(250, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.navi-" + myClass).attr("class", "navi-" + myClass + "-click");
			}).mouseup(function() {
				$("div.navi-" + myClass + "-click").attr("class", "navi-" + myClass);
			});
		}



	});
