I think the problem is related to alert().
When the alert box is closed, the focus is given to the control which was last focused by the user. This is my observation. Remove alert from the code at http://jsfiddle.net/GQyHp/1/ which is created by patrick and you'll see it will work.
So, not using built-in alert, instead using a fancy box for example may be a solution.
Zafer
2010-09-04 22:50:55