Fixed JavaScript Syntax.

* Changed double quotes to single
* Added braces to conditionals
* Removed unused variables