Fix: Added onload

The code was executed befor the DOM tree was fully loaded. I have added
jQuery and non-jquery "document readystate" awareness to both paths
(with or without jQuery).