A better method of doing this is to specify JS event handlers via a separate file in drupal_add_js() using Drupal.behaviors. I don't know of go-to documentation for this off of the top of my head, but do some searching and look at examples in other core modules.

Carl Wiedemann
Website design and development consulting
carl.wiedemann@gmail.com | skype: c4rlww