function Switch($elem, $root, $count) 
{
	// Hide all elements
	for(i=0; i<$count; i++)
	{
		thecontainer = document.getElementById($root + i);
		thecontainer.style.display = 'none';
	}

	// Show the new element
	thecontainer = document.getElementById($elem);
	thecontainer.style.display = 'block';
}

function SwitchTerms($termNb, $sectionRoot, $nbTerms, $titleRoot, $titleUnselectedClass, $titleSelectedClass, $middleDivName, $origMiddleDivClassName, $targetMiddleDivClassName) 
{
	// Determine if the selected term is already being displayed
	mustHide = false;
	
	thecontainer = document.getElementById($sectionRoot + $termNb);
	if(thecontainer.style.display != 'none')
	{
		// If it is, we must hide it...
		mustHide = true;
	}	
	
	for(i=0; i<$nbTerms; i++)
	{
		// Hide all terms
		thecontainer = document.getElementById($sectionRoot + i);
		thecontainer.style.display   = 'none';
		
		// Unselected all titles
		thecontainer = document.getElementById($titleRoot + i);
		thecontainer.className = $titleUnselectedClass;
	}
	
	// If we must hide the current term...
	if(mustHide)
	{
		// Reset the height of the middle div
		thecontainer = document.getElementById($middleDivName);
		thecontainer.className = $origMiddleDivClassName;		
	}
	else
	{
		// Show the selected term
		thecontainer = document.getElementById($sectionRoot + $termNb);
		thecontainer.style.display = 'block';
		
		// Selected the selected title
		thecontainer = document.getElementById($titleRoot + $termNb);
		thecontainer.className = $titleSelectedClass;
		
		// Adjust the height of the middle div
		thecontainer = document.getElementById($middleDivName);
		thecontainer.className = $targetMiddleDivClassName;
	}
}