// JQuery JavaScript Document: Ingredients page controls

// show/hide selected/unselected posts
function showPost(title)
{	
	var selectedPost = getIndex(title);
	// cycle through each of the post and hide them all except selected
	$(".post").hide();
	$(".post:eq("+selectedPost+")").show();
	
}

// get index from title name
function getIndex(title) // default is 0 to return first post
{
	var index=0;
	for(var i=0; i<$(".post").length; i++){
		if($(".post:eq("+i+")").attr("id") == title) { index=i; $(".cat-nav li a:eq("+i+")").addClass("active"); break; }
	}
	//alert("NAME: "+title+" | INDEX: "+index);
	return index;
}
	