Proto.UI.accordion=Class.create({
        initialize: function() 
        {
                      
        	this.options = Object.extend({
        	           container:false,
        	           titleClassName:'title-panel',
        	           contentClassName:'content',
        	           activeClassName:'shown',
        	           duration:0.2
                }, arguments[0] || { });
                
            this.options.container.childElements().each(function(el){
                el.select("."+this.options.titleClassName )[0].style.cursor='pointer';
                el.select("."+this.options.titleClassName )[0].observe("click",function(){
                    this.click(el, el.select("."+this.options.contentClassName)[0]);
                }.bind(this));
                el.select("."+this.options.contentClassName)[0].hide();
                            }.bind(this));
                            
                this.options.container.select("."+this.options.activeClassName)[0].show(); 
                
                                            
        },
        click:function(e,c)
        {
            if(c.visible()){return}
           
            this.options.container.select("."+this.options.contentClassName).each(function(el){

                if(el!=c && el.visible()){ 
                
            new Effect.Parallel([
                                  new Effect.BlindDown(c), 
                                  new Effect.BlindUp(el) 
                                ], { 
                                  duration: this.options.duration
                                    });
                    }
                }.bind(this));
          
                                                        

            
        }
});
document.observe("dom:loaded", function(){
$$('.accordion').each(function(e){
    new Proto.UI.accordion({ container:e });
});});