Rewrite the `wait` function so that it gives useful failure messages in IE 6-7.