/*
 * This function toggles the display property of the content div to achieve the hide/show effect. It uses the DOM to find
 * the correct nodes/elements, so that it can be used in conjunction with IPB's Custom BBCode (where you can't generate an
 * unique ID for an element).
 */
function switchSpoiler(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 next siblings for the first sibling with the
	// right classname.
	// Start off with the first one.
	sibling = id.nextSibling;
	
	// Go through the siblings like a linked list.
	while(sibling != null) {
		// Check if we found it.
		if(sibling.className == "content") {
			// Found it. Lets 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 = sibling.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";
			
			// We're done! (There should only be one main div.)
			return;
		}
		else {
			// Go on with the next sibling.
			sibling = sibling.nextSibling;
		}
	}
}
