Tidied up javascript spacing and comparison operators

You might want to consider jslinting the code too. (If you accept jslint's style guide).