First off, consider the security ramifications behind this sort of action. You're blindly depending on the security of this remote server- if it gets...
Your focus event is not firing. However, your unfocus is. I'm not quite sure of the reason why, but you could probably save yourself some trouble by...