diff --git a/js/supervisorchat.js b/js/supervisorchat.js
index 1946e886..b1d25960 100644
--- a/js/supervisorchat.js
+++ b/js/supervisorchat.js
@@ -33,11 +33,26 @@ function OnMessageStanza(stanza)
//alert(sFrom + ':' + sType + ':' + sBody + ':' + sBareJid);
// do something, e.g. show sBody with jQuer
- //make sure the chat tab is in focus when an incoming messages appears
//display message as new row in message table if it is from the supervisor
if (sBareJid == SUPERVISOR_XMPP)
{
+ //make sure the chat tab is in focus when an incoming messages appears
+
+ //find the index of div-supervisorchat (children of tab-main)
+ var tm = parent.document.getElementById('tab-main')
+ var i = 0;
+
+ for (i=0;i