controls.js class Tab

Refactor repetitive code for tab switching into instances of class Tab.
Replace "this" with object name in all one-off objects to allow callbacks.