Switched form document ready to window loaded before firing js