Javascript code:
// If we receive a message and the chat window exists in the object container
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind) {
if (typeof oChatWnds[oChatWnd.Handle] === 'object') {
// check which message was received
switch (sMessage.toLowerCase()) {
case "hai":
oChatWnd.SendMessage('Hai');
break;
case "hello":
oChatWnd.SendMessage('Hello');
break;
default: // anything else
oChatWnd.SendMessage('Yo');
break;
}
// Remove the chat window from the object container
delete oChatWnds[oChatWnd.Handle];
}
}
Something like that?