Thread moved to ClientSide Technologies forum.
What do you mean by the "IM box" ? Is this "box" a new window (e.g. opened by Javascript)? You might need to describe the layout/design a bit more.
If, for example, this IM box was a named window opened by your main/parent page, you could use the Javascript method windowName.focus() which will (should) bring that window into focus.