function bookmark(node_pk, update, options)
{
    var caller    = new AjaxCaller();
    caller.script = '/common/ajax/bookmarks.php';
    
    caller.callback = function(result)
    {
        if (-1 == result)
        {
            //show_dialog('login');
            u_login();
        }
        else if (0 == result)
        {
            alert('Unable to bookmark this item!');
        }
        else if (1 == result)
        {
            notify('Bookmarked', 'This item has been added to your briefcase.');
        }
        else if (result > 1)
        {
            update_widget(result);
        }
    }
    
    caller.call('bookmark', node_pk, update ? true : false, options);
    
    return;
}


function email(node_pk, el, title)
{
    if ('string' == typeof(node_pk))
    {
        var type = 'URL';
    }
    else
    {
        var type = 'article';
    }
    show_email_form(node_pk, type, title);
}


function unbookmark(node_pk)
{
    var caller    = new AjaxCaller();
    caller.script = '/common/ajax/bookmarks.php';
    
    if (arguments.length > 1)
    {
        var widget = arguments[1];
        
        while (widget.className != "component")
        {
            widget = widget.parentNode;
        }
        
        var widget_id = widget.id;
        
        caller.callback = function(result)
        {
            if (result)
            {
                update_widget(widget_id, null);
            }
            else
            {
                alert('Unable to remove this bookmark!');
            }
        }
    }
    
    caller.call('unbookmark', node_pk);
    
    return;
}
