/**
* @description   | Device to Dynamically Iterate through all subject guides, hiding all but the one that the user seeks.
* @author        | Chris Anderson (Xavier University Web Services, Student Web Developer)
* @date          | Created By Chris Anderson on 06-18-09.
*//***********************************************************************************************************************/

function hideOthers(key)
{
	
	//alert("Key is " + key);
	
	//grab all tags with the class name 'subject' and group them in an array.
	//var subjectDivs = document.getElementsByClassName("subject");//Of course, why would IE support such a useful method? Guess we will have to make our own.
	
	var subjectDivs = document.getElementsByTagName("div");
	
	//Make sure we find at least one.
	var foundOne = false;
	
/*	var allDivs = document.getElementsByTagName("div");
	
	var subjectDivs;
	
	for(var j = 0; j<allDivs.length; j++)
	{
		if( allDivs[i].class == "subject")
		{
			subjectDivs.appendChild(allDivs[i]);
		}
	}*/
	
	//if we have no key, just hide all of them.
	if(key == null)
	{
		key= "Default";
	}
	
	//alert("Key is now " + key);
	
	//alert("Length of subjectDivs is " + subjectDivs.length);
	
	//else, we do this
	//iterate through array. reveal our subject, hide others.
	for(var i = 0; i <subjectDivs.length; i++)
	{
		
		//alert("subjectDivs[i].className is " + subjectDivs[i].className);
		
		if(subjectDivs[i].className == "subject")
		{
			
			
			
			if(subjectDivs[i].id == key)
			{
				subjectDivs[i].style.display = "inline";
				foundOne = true;
			}
			else
			{
				subjectDivs[i].style.display = "none";
			}
		}

	}
	
	if (!foundOne)
	{
		hideOthers();
	}
	
}