Update to Manifest v2

see http://developer.chrome.com/extensions/tut_migration_to_manifest_v2.html
- Move inline javascript to external JS files to comply with new Chrome Content Security Policy
- Switch to event listeners instead of onX attributes (same reason)