Remove unused variables
Fix some bad HTML
Fix inefficent jQuery usage

Some jQueries can be cached and reused. This commit does that.
Fix this/self usage warning

To clarify the intent of using 'this' inside the closure, it is first assigned to a variable.