// JavaScript Document

//This function will switch the specified id from collapsed to uncollapsed (and vice-versa)
function toggleHidden(identifier)
{
	//Verification if the element is collapsed
if(document.getElementById(identifier).style.display=='none')
	//if so, display it as a block element
	document.getElementById(identifier).style.display='block'
else
	//otherwise, hide it
	document.getElementById(identifier).style.display='none'
};


//This function is used to toggle the specified ids declared within an element with the id 'collapsibles'
//this element contains the name of the ids within it's own element tag
//Ex: <div id='collapsibles' style="display:none">
//		<p>hiddenField01</p>
//		<p>hiddenField02</p>
//		....
//	  </div>
function toggleAll()
{
	var getIds = document.getElementById('collapsibles')
		getIds.normalize()
	var counter = 0;
	//The loop iterates through the hidden field to get the specified ids
	//and toggle them individually
	while(getIds.childNodes[counter] != null)
	{
	
	//Use proper syntax depending on browser
	if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{
		toggleHidden(getIds.childNodes[counter].childNodes[0].nodeValue)
	}
	else
	{
		toggleHidden(getIds.childNodes[counter+1].textContent)	
	}
	
	++counter
	++counter
	
	
	//Elimination of error message, simply display if not compatible	
		
	}
};


//This function is used to detect whether or not there are fields to be collapsed,
//implimented to verify if a call to toggleAll() is necessary
//(due to replication of the javascript call within the onLoad event of body using menu_* to import collapsible.js) 
function hasCollapsibles()
{
	if(document.getElementById('collapsibles'))
	{
		return true
	}
	else
	{
		//alert('this has no collapsibles')
		return false
	}
};
