Javascript implementation of a card deck