Logic Fixed

Lots of changes to the simple javascript logic of the page, basically
enabling or disabling buttons based on what's active