/** 
 *	Accordion on link on sidebar
 *
 *	@author Andrea Gatti
 *	@version 0.1
 *
 *	Requirements:
 *		mootools
 *		morpher.js
 */

/** ------------------------------------------------------------------- */
/* Parameters:
 * 	togg = class of h3 elements toggler
 *  elem = class of div elements
 *  startel = int index of the opened elements
 */

function prepareAccordion($default){
	var accordion = new Fx.myAccordion('h3.atStart', 'div.atStart', {
		opacity: false,
		onActive: function(toggler, element){
			myMorph = new Fx.Morph(toggler, {duration: 200, wait: false});
			myMorph.start('sidebarel-on');
		},
 
		onBackground: function(toggler, element){
			myMorph = new Fx.Morph(toggler, {wait: false});
			myMorph.start('sidebarel-off');
		},
		display: $default /* Categories */
	}, $('sidebar'));
}

function contractSidebar() {
	elements = $ES("div.atStart");
	if (elements.length > 0) {
		for (i=0; i<elements.length; i++) {
			elements[i].effect('height').set(0);;
		}
	}
}

