/* 
 * Copyright 2011 The Daily Neopets.
 * 
 * This is a script for creating collapsible divs.
 * 
 * Written by: AA
 * 
 * To use this script, give an element the class "collapse", and any sibling
 * element directly before it the class "expand". When the "expand" element is
 * clicked, the "collapse" element will collapse/expand.
 */

var expand_js = new Object();

/* 
 * Collapses or expands the collapsible <div> directly below the triggering
 * element.
 */
expand_js.doit = function() {
	// Find the next collapsible <div> after the trigger element, then toggle it
	$(this).next(".collapse").slideToggle("fast");
};

/*
 * Attaches the required event handlers for this script.
 */
expand_js.prep = function() {
	var targets = $(".expand");
	targets.click(expand_js.doit);
	// Collapse all by default
	targets.next(".collapse").hide();
};

$(expand_js.prep);

