Cleaned and generalized code

For matching IDs according to WP encoding; fixed jQuery use of val()
Merge pull request #16 from jehope/msnJSMods9Dec2013-3

Cleaned and generalized code