Read the article on setTimeout versus window.onload.