$(document).ready(function(){
	
// Search

	$("#s").hover(function(){
		if($(this).val()=="Search this site") {
			$(this).focus()
			.val("");
		}
	},function(){
		if($(this).val()=="") {
			$(this).val("Search this site");
		}
		$(this).blur();
	});

// event menu actions

	// has childern?
	$("#column_left ul li:has(ul)")
	// if so insert arrow background image
		.css("background","url(http://slowfoodnation.org/wp-content/themes/slowfoodnation/images/global/arrow.png) no-repeat top right")
	// and hide childern
		.find("> ul").hide();
	
	// open decendant menus if active
	$(".current_page_item")
		.find("> ul")
		.show();
	$(".current_page_item")
		.parents("ul")
		.show();
	
	// add down arrow on open menus
	$("#column_left ul li.current_page_ancestor,#column_left ul li.current_page_item:has(ul)").css("background","url(http://slowfoodnation.org/wp-content/themes/slowfoodnation/images/global/arrow_down.gif) no-repeat top right");
	
	$("#column_left ul li ul li.current_page_item").css("background","none");
	
	// menu hover actions
	
	var t;
	
	$("#column_left ul li:has(ul)").bind("mouseenter", function() {
		clearTimeout(t);
		$(this)
			.addClass("open_child_menu")
			.css("background","url(http://slowfoodnation.org/wp-content/themes/slowfoodnation/images/global/arrow_down.gif) no-repeat top right")
			.find("> ul")
			.slideDown("medium");
	});
	
	$("#column_left ul:first").bind("mouseleave", function() {
		t = setTimeout(function() { 
		$("#column_left ul li.open_child_menu")
			.removeClass("open_child_menu")
			.css("background","url(http://slowfoodnation.org/wp-content/themes/slowfoodnation/images/global/arrow.gif) no-repeat top right")
			.find("> ul").slideUp("fast");
		}, 1000);
	});

	
	$("#column_left ul li.current_page_item").unbind();
	$("#column_left ul li.current_page_ancestor").unbind();
	$("#column_left ul li ul li").unbind();
	

	
});