/*
 * This function toggles the display property of the divs to achieve the hide/show effect. It uses the DOM to find the
 * correct nodes/elements, so that you don't have to generate an unique ID in the PHP.
 */
function switchVisibility(id) {
	// Internet Explorer and Mozilla handle Nodes differently: IE doesn't seem to care about text nodes, and Mozilla does.
	// So we can't directly access the node. To circumvent this problem we could just check if the Mozilla node is null,
	// but that's not very pretty. Instead, we go general: search through the child Nodes of the parent Node for the Nodes
	// with the right classnames.
	// Grab the child Nodes.
	childeren = id.parentNode.childNodes;
	
	// Go through the childeren.
	for(index = 0; index < childeren.length; index++) {
		// Grab the current child Node.
		child = childeren.item(index);
		
		// Check if we found the title that is displayed when the content is hidden.
		if(child.className == "titleWhenHidden") {
			// Grab the style. Note that this assumes no one uses Netscape to use this, but it doesn't implement the DOM
			// anyways so it doesn't work regardless.
			titleWhenHidden = child.style;
			
			// Hide or show the title div.
			// If it is hidden, show it.
			if(titleWhenHidden.display == "none")  titleWhenHidden.display = "block";
			// If it is shown, hide it.
			else  titleWhenHidden.display = "none";
		}
		// Check if we found the title that is displayed when the content is shown.
		else if(child.className == "titleWhenShown") {
			// Grab the style. Note that this assumes no one uses Netscape to use this, but it doesn't implement the DOM
			// anyways so it doesn't work regardless.
			titleWhenShown = child.style;
			
			// Hide or show the title div.
			// If it is shown, hide it.
			if(titleWhenShown.display == "block")  titleWhenShown.display = "none";
			// If it is hidden, show it.
			else  titleWhenShown.display = "block";
		}
		// Check if we found the content.
		else if(child.className == "content") {
			// Grab the style. Note that this assumes no one uses Netscape to use this, but it doesn't implement the DOM
			// anyways so it doesn't work regardless.
			content = child.style;
			
			// Hide or show the content div.
			// If it is shown, hide it.
			if(content.display == "block")  content.display = "none";
			// If it is hidden, show it.
			else  content.display = "block";
		}
	}
}