Autologin: Fix javascript logout code

Window onload event handler comes to late. Change
part of the code to use jQuery.

refs #6461