$(function()
{
    $('.dynamic .timeline-text a').click(function()
    {
        var app  = '';
        var url  = $(this).prop('href');
        var skip = false;

        if($(this).data('toggle') == 'modal') skip = true;
        if($(this).hasClass('deleter'))       skip = true;
        if($(this).hasClass('reloadDeleter')) skip = true;
        if($(this).hasClass('switcher'))      skip = true;

        if(url.indexOf('/crm/')   != -1) app = 'crm';
        if(url.indexOf('/oa/')    != -1) app = 'oa';
        if(url.indexOf('/proj/')  != -1) app = 'proj';
        if(url.indexOf('/doc/')   != -1) app = 'doc';
        if(url.indexOf('/cash/')  != -1) app = 'cash';
        if(url.indexOf('/team/')  != -1) app = 'team';
        if(url.indexOf('/hr/')    != -1) app = 'hr';
        if(url.indexOf('/psi/')   != -1) app = 'psi';
        if(url.indexOf('/flow/')  != -1) app = 'flow';
        if(url.indexOf('/ameba/') != -1) app = 'ameba';

        if(!skip && app != '')
        {
            $.openEntry(app, url);
            return false;
        }
    });
})
