Index: sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl	(revision 2721)
+++ sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl	(revision 2725)
@@ -11,5 +11,5 @@
 			<div>
 				<div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll;"></div>
-				<div id="{$jidTo}__chatState" style="height:15px; width:370px;"></div>
+				<div id="{$jidTo}__chatState" style="height:15px; width:365px;"></div>
 				<div style="margin:2px;">
 					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:360px;"></textarea>
Index: sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2724)
+++ sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2725)
@@ -612,4 +612,5 @@
         return true;
     },
+    
     /** Function: onMessage
      *
@@ -647,10 +648,15 @@
 		var jid_lower	= barejid.toLowerCase();
 		var contact		= "";
-		var state = '';
-
-		var chatBox	= document.getElementById(jid_lower + "__chatState");
-
-		contact			= barejid.toLowerCase();
-		contact 		= contact.substring(0, contact.indexOf('@'));
+		var state		= "";
+
+		var chatBox	= null;
+		
+		if( document.getElementById(jid_lower + "__chatState") != null )
+		{
+			chatBox	= document.getElementById(jid_lower + "__chatState");
+		}
+				
+		contact	= barejid.toLowerCase();
+		contact	= contact.substring(0, contact.indexOf('@'));
             
 		if( TrophyIM.rosterObj.roster[barejid] )
@@ -663,10 +669,10 @@
 
 		// Message with body are "content message", this mean state active
-		if (elems.length > 0)
+		if ( elems.length > 0 )
 		{
 			state = contact + ' está ativo.';
 
-			if (type == 'chat' || type == 'normal') {
-			
+			if (type == 'chat' || type == 'normal')
+			{
 				var _message = document.createElement("div");
 				_message.innerHTML = Strophe.getText(elems[0]);
@@ -679,5 +685,5 @@
 				_message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, "");
 
-				if (_message.hasChildNodes() )
+				if ( _message.hasChildNodes() )
 				{
 					var message = 
@@ -688,5 +694,5 @@
 					
 					TrophyIM.makeChat(from); //Make sure we have a chat window
-					TrophyIM.addMessage(message, jid_lower);
+					TrophyIM.addMessage( message, jid_lower );
 				}
 			}
@@ -695,7 +701,11 @@
 		else
 		{
-			state = contact + TrophyIM.getChatState(msg);			
-		}
-		chatBox.innerHTML = "<font style='font-weight:bold; color:grey;'>" + state + "</font>";	
+			if( chatBox != null )
+				state = contact + TrophyIM.getChatState(msg);			
+		}
+		
+		if( chatBox != null )
+			chatBox.innerHTML = '<font style="font-weight:bold; color:grey; margin-left: 5px; float:right;">' + state + '</font>';	
+		
 		return true;
 	},
@@ -711,17 +721,27 @@
 		var	state =  msg.getElementsByTagName('inactive');
          	
-		if ( state.length > 0 ) {
+		if ( state.length > 0 )
+		{
         	return' está inativo...';
-		} else {
+		}
+		else
+		{
          	state = msg.getElementsByTagName('gone');
-            if ( state.length > 0 ){
+            if ( state.length > 0 )
+            {
             	return ' saiu da conversa.';
-			} else {
+			}
+            else
+            {
             	state = msg.getElementsByTagName('composing'); 
-            	if ( state.length > 0 ){
+            	if ( state.length > 0 )
+            	{
                		return ' está compondo...';
-				} else {
+				}
+            	else
+            	{
                		state =  msg.getElementsByTagName('paused');
-                	if ( state.length > 0 ){
+                	if ( state.length > 0 )
+                	{
                   		return ' está parado...';
 					}
@@ -729,4 +749,5 @@
 			}
 		}
+		
 		return '';
 	},
