Fix javascript syntax errors

Fixes Javascript syntax errors (was written like ruby or coffee script)
Makes code easier to read/follow

![screen shot 2014-09-18 at 8 58 36 pm](https://cloud.githubusercontent.com/assets/6556190/4330535/5031f3c2-3fb1-11e4-8257-e94262cd9237.png)
![screen shot 2014-09-18 at 8 58 46 pm](https://cloud.githubusercontent.com/assets/6556190/4330536/50354ffe-3fb1-11e4-89ab-46325e0bf92f.png)