javascript cleanup

Quick pass over our .js to cleanup some whitespace issues found. Added missing semicolons and parenthesis to make code more clear. Applied some slight optimizations and possible redirect fixes.