Added comments, cleaned HTML & JS

Old code did not use orthodox HTML style to pass parameters to JS; they
are now encoded in hidden form fields