Refactored JavaScript

    * put code into closure to avoid potential intermixing with other scripts
    * stored reused jQuery calls into variables to speed things up
Merge pull request #1 from k0pernikus/refactorJs

    Refactored JavaScript