// DWAccordeon 0.1
// $Id$
// by Leo Gerber, diewebdesigner.com
// using Prototype and Sriptaculous

document.observe("dom:loaded", function() {
  // for each toggleNest
  
	$$('.dwaccord-container').each(function(item){
		var thisSlide = item.down( '.dwaccord-content' );
		var thisToggle = item.down( '.dwaccord-toggle' );
		if (! thisToggle.hasClassName('act')) {
			thisSlide.hide();
		}
		Event.observe(thisToggle, 'click', function(){
			if (thisToggle.hasClassName('act')) {
				thisToggle.removeClassName('act');
				new Effect.SlideUp( thisSlide, { duration:1.5, scaleX:false } );
			} else {
				thisToggle.addClassName('act');
				new Effect.SlideDown( thisSlide, { duration:1.5, scaleX:false } );
			}
		});
	});
});
