refactored display JavaScript
This will help support loading linked decks.