Probably better like this:
code:
var objChatWnd = {};
var sCommand = '/somecommand';
var iDelayInMinutes = 2;
function OnEvent_ChatWndCreated(oChatWnd){
objChatWnd[oChatWnd.Handle] = {};
objChatWnd[oChatWnd.Handle].oChatWnd = oChatWnd;
oChatWnd.SendMessage = sCommand;
MsgPlus.AddTimer(oChatWnd.Handle, iDelayInMinutes*60000);
}
function OnEvent_ChatWndDestroyed(oChatWnd) {
delete objChatWnd[oChatWnd.Handle];
MsgPlus.CancelTimer(oChatWnd.Handle);
}
function OnEvent_Timer(iHandle) {
objChatWnd[iHandle].oChatWnd.SendMessage(sCommand);
MsgPlus.AddTimer(iHandle, iDelayInMinutes*60000);
}