$(function () {
    $(function () {
        $('.start_hidden').hide();
        $('.collapse_toggle').each(function(n, el){
            el = $(el);
            if (el.hasClass('collapsed')) {
                el.data('');
            }
        });
    });

    $('.collapser .collapse_toggle').click(function(e){
        var defaultTargetClasses = '.collapse_target';
        var el = $(e.currentTarget).first();
        var collapsed = el.data('collapsed');
        var targets = el.data('collapse-target-classes');

        if (targets != null) {
            targets = targets.split(',');
            // Dot prefix, allows for multiple classes comma delimited
            targets = targets.map(function(el) { 
                return '.'+el; 
            });
        } else {
            targets = defaultTargetClasses;
        }
        var container = el.first().closest('.collapser');
        var targetElements = container.find(targets.join(', '));

        if (collapsed) {
            el.addClass('expanded').removeClass('collapsed');
            targetElements.slideDown();
            el.data('collapsed', false);
        } else {
            el.addClass('collapsed').removeClass('expanded');
            targetElements.slideUp();
            el.data('collapsed', true);
        }
    });

/*
    $(function () {
        $('.bubble .label').hide();
        $('.bubble').hover(
            function (a) {
                a = $(a.currentTarget);
                a.css('flex', '6');
                a.find('.label').show()
            },
            function (a) {
                a = $(a.currentTarget);
                a.css('flex', 'initial');
                a.find('.label').hide()
            }
        );
    });
    */
});
