update container page js to use a small state machine

better and worse at the same time as using three buttons and hiding the ones I
don't need. But, good practice, right?