Fixed and improved registration

When using jquery to load pages dynamically event handlers can't be
registered in window.onload as the elements are not present at that
stage.