(function($){	
    $.fn.accordion = function() {
        var obj = $(this);
        obj.find('ul:visible').css("display", "none");
        return this.each(function(){
            var obj = $(this);
            $('li a', obj).click(function(event){
                var elem = $(this).next();
                if(elem.is('ul')){
                    event.preventDefault();
                    obj.find('ul:visible').not(elem).not(elem.parents('ul:visible')).slideUp();
                    elem.slideToggle();
                }
            });
        });
    };
})(jQuery);
