$(function () {
    var $ajaxTabs = $('a[data-toggle="tab"][data-load="ajax"]');
    $(document)
        .on('shown.bs.tab', $ajaxTabs, function (e) {
            var target = $(e.target);
            $(target.attr('href')).load(target.data('url'), function () {

                target.trigger('load.bs.tab');
            });
        })
        .on('load.bs.tab', $ajaxTabs, function () {
            if(typeof Pagination !== 'undefined') {
                Pagination.onChange.dispatch();
            }
        });
    //FIX ME
    if(typeof $.unparam === 'undefined') {
        $.unparam = function (value) {
            var
                params = {},
                parts = value.split('&'),
                pair, i, l;

            for (i = 0, l = parts.length; i < l; i++) {
                pair = parts[i].split('=', 2);
                params[decodeURIComponent(pair[0])] = (pair.length == 2 ?
                    decodeURIComponent(pair[1].replace(/\+/g, ' ')) : true);
            }

            return params;
        };
    }
});