// JavaScript Document

/* ----
 * Description:
 * 	Javascript relating to the multiple stories on the wide page
 * Programmers:
 * 	mc
 *	mb
 * 	cp
 * History:
 * 	0.0.1 2008February12 Initial version
 * ---- */

// Pre: Receives anchor element that was clicked, name of container of stories, and story to show
// Post: Hides all other stories and sets the anchor clicked's parent to the selected class
function show_story(anchor, container, story)
{	
	var parent_item = anchor.parentNode;
	var parent_list = parent_item.parentNode;
	
	if (parent_item && parent_list.childNodes.length)
	{
		var current = 0;
		for (current = 0; current < parent_list.childNodes.length; ++current)
		{
			parent_list.childNodes[current].className = "";
		} // each child
		parent_item.className = "selected";	
		
		container = document.getElementById(container);
		var stories = container.getElementsByTagName('div'); // All Story objects	
		//stories = all;
		if (container && stories.length)
		{
			for (current = 0; current < stories.length; ++current)
			{
				if (stories[current].getAttribute("id") == story)
				{
					stories[current].className = "sho";
					stories[current].parentNode.className = "sho";
				} // found target
				else
				{
					stories[current].className = "nosho";
				}
			} // each story
		} // story_container exists
	} // parents exist
} // show_story