General JS helper functions and auto-checking as needed for online status.

Also, used them on the video download page.
Merge branch 'checkconnection' of https://github.com/ruimalheiro/ka-lite into checkconnection

Conflicts:
	kalite/static/js/khan-lite.js
Ordering tweak to put the globally run JS together in one place.
Some tweaks to catch things missed in the pull request.
Merge pull request #6 from jamalex/checkconnection

General JS helper functions and auto-checking as needed for online status.