Fixed minor issues with code.

- don't repeat jQuery selectors. These can be set to a variable and reused for better performance.
- Don't mix ID selectors with class selectors. example: $("#something .things"); needs to be changed to $("#something").find(".things"); jQuery can't optimize ID look ups if there are other selectors in the query.
- Functions should have consistent return types. A lot of functions have "return xxx;" but not all branches returned a value. If a function doesn't need to return a value, then don't return any just use "return;"