﻿/**
 * ...
 * @author ser
 */
(function($) {
    $.fn.accordion = function(settings) {
        var wrap_obj = this;

        wrap_obj.find('.description').hide();
        $(this).find('a.link').click(
            function() {
                if ($(this).closest('li').children('.description').css('display') == 'block') {
                    $(this).closest('li').children('.description').slideUp();
                    $(this).removeClass('active');
                } else {
                    closeAll();
                    $(this).closest('li').children('.description').slideDown();
                    $(this).addClass('active');
                }
                return false;
            }
        )
        function closeAll() {
            wrap_obj.find('.description').slideUp();
            wrap_obj.find('a.link').removeClass('active');
        }
    }
})(jQuery);
