ah, this should work
the code wasn't using a global variable.
code:
var idpartita;
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage == "take"){
idpartita = ChatWnd;
return "";
}
if(sMessage == "send"){
idpartita.SendMessage("hello");
return "";
}
}