changed ready function to window.onload