WIP of bug 1076706, and card_manager.js is still a mess