$(document).ready(function()
{
    $(document).on('hide.zui.modal', '#ajaxModal.reload-after-hide', function()
    {
        location.href = location.href;
    });

    $('a.mode-toggle').click(function()
    {
        $('a.mode-toggle').removeClass('active');
        $(this).addClass('active');

        $('#cardMode, #listMode').hide();
        $('#' + $(this).data('mode') + 'Mode').show();

        $.cookie('depositorViewType', $(this).data('mode'), {path: "/"});
    })

    var type = $.cookie('depositorViewType');
    if(typeof(type) == 'undefined' || type == '') type = 'card';
    $('#menuActions a[data-mode=' + type +']').click();
});
