Fixed up javascript warnings and errors found by JSHint
Fixed syntax issues found by PHP CodeSniffer
Fixing syntax errors found by PHP CodeSniffe