Fix syncing issues in the Javascript

I noticed that, when switching programs, the start/stop and reset buttons were
not behaving correctly. The reset button should disable, and the start/stop
button should read "start." It would be easy to fix, but instead I investigated
the syncing mechanism and discovered some issues.

I was only changing the values being synced if they were different, but this was
assuming that the variables were in sync with the buttons. I removed these
checks so that it simply set everything to the correct state in the synchronize
function, and then I added a sync call in the send function callback so that
every button click is followed by a sync. In theory the script maintains the
same state as the server, but I still think this is a good idea.

I tested it more thoroughly by refreshing the browser to ensure that the UI was
always restored to the correct state, and it appears to work perfectly now.