(function($){
    var $document = $(document);

    $document.off('builder.cliparts.reload');
    $document.on('builder.cliparts.reload', function() {
        var $selected_category_id = $('.category_selector .selector_items .item[parent_id="0"].selected').attr('category_id');
        $.coreUtilites.ajaxRequest(
            {
                action: 'get_category_cliparts',
                category_id: $selected_category_id
            },
            function(data){
                if (data.status == 'success') {
                    $document.trigger('builder.clipart.draw', [data.message]);
                } else {
                    console.log('Error: cliparts no downloading');
                }
            }
        );
    })

})(SWjQuery);