fixed some javascript problems

It looks like we made some changes to the
javascript, but didn't completely
apply all of them, so that applying the
flats just didn't work
send flat information when pressing secondPass button