Cookie, I believe 134jimbodude wants to check for a specific contact instead of all of them. The code I posted above should do that. Instead of looping through them, when you know the email it is better to just find that one exactly.
EDIT: you already updated your post
Also, saralk's code will not work. the ChatWnd variable is undefined and the message will not be sent...(just add "var ChatWnd = " before the OpenChat part and it'll work again)