Event.observe(
    window,
    'load',
    function(){
        $$('.expand').each(
            function(e){
                var expandables=new Array();
                e.descendants().each(
                    function (child) {
                        if (child.hasClassName('expandable')) {
                            expandables.push(child);
                        }
                    }
                );
                e.descendants().each(
                    function (child) {
                        expandables.each(
                            function (expandable) {
                                expandable.hide();
                            }
                        );
                        if (child.hasClassName('expander')) {
                            Event.observe(
                                child,
                                'click',
                                function () {
                                    expandables.each(
                                        function (expandable) {
                                            var effectConfig={
                                                duration: 0.5,
                                                queue: {
                                                    position: 'end',
                                                    scope: 'expanderscope',
                                                    limit: 1
                                                }
                                            };
                                            if (expandable.visible()) {
                                                expandable.blindUp(effectConfig);
                                            } else {
                                                expandable.blindDown(effectConfig);
                                            }
                                        }
                                    );
                                }
                            );
                        }
                    }
                );
            }
        );
    }
);
