Try a longer timeout period.
Note than an alert() suspends program execution but setTimeout() does not - it just delays the execution of the function.
Look into your code with that in mind.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 01-16-2013 at 04:21 PM..