Implement proper tab toggling

This handles
- button appearance after you switch tabs
- reloading the page keeps the same tab focused
- browser back/forward buttons undo tab/repeat switches
- browser back/forward buttons don't change browser history

Inspired by:
http://stackoverflow.com/questions/9685968/best-way-to-make-twitter-bootstrap-tabs-persistent