var CollapseBox = Class.create({ initialize: function() { }, toggle: function(id){ var target = $(id); var area = target.hasClassName('colapsebox-content'); if (this.tween) this.tween.cancel(); this.tween = Effect.toggle(id+"-content", 'blind', { duration: 0.5, scaleContent: false, afterFinish:this.change }); }, change: function(e){ var id = (e.element.id); id = id.split("-content").join(""); Element.toggleClassName(id, 'closed'); } }); var collapsebox = new CollapseBox();