refactor javascript

remove deprecated jq()
add delegated event handlers
improve event handling
cleanup JS
Update CHANGES.rst
Merge pull request #2 from petschki/master

JS cleanup in template