Update to JQuery 1.9

This is basically a merge of PR #158 plus some fixes and the inclusion of jquery-migrate as a compatibility layer for older jQuery based scripts.