Added an window.onload in order for the javascript to work properly