
function friendlist_action(uid, targetdiv, action)
{
    if (action == 'delete' && !confirm("Czy na pewno chcesz usunąć użytkownika z listy znajomych?")) return;
	$(targetdiv).down("span.friendgadget").setStyle({visibility: 'hidden'});
	var e = $(targetdiv).down("div.friendmsg");
	if (e) e.remove();
	$(targetdiv).insert({'bottom': new Element('div', {'class': 'friendmsg'})
		.insert(busyimg)});
	new Ajax.Updater(targetdiv, '/ajax_friends', {
		method: 'post',
		parameters: {
			targetdiv: targetdiv,
			uid: uid,
			action: action
		},
		onSuccess: function(x) {
			var fl = $(targetdiv).up("ul.friendlist");
			if (!fl) return;
			if (action == 'cancel' || action == 'delete' || action == 'decline') 
				$(targetdiv).up("li").addClassName('deleted');
			else
				$(targetdiv).up("li").removeClassName('deleted');
		}
	});
}


