Fixed some JSHint problems

e.g. tabs to spaces, white space around if, for, while and opening function braces, added 0 to .5 etc. for clarity and added braces around some single line if, else for body to improve readability and make it less likely to make mistakes if changing that code in future.

The diff doesn't look very good as I replaced tabs with 4 spaces. However a "git diff -w" works fairly well.

Thanks for the applet!