Index: trunk/jabberit_messenger/jmessenger/xsl/chatRoom.xsl
===================================================================
--- trunk/jabberit_messenger/jmessenger/xsl/chatRoom.xsl	(revision 3086)
+++ trunk/jabberit_messenger/jmessenger/xsl/chatRoom.xsl	(revision 3091)
@@ -5,4 +5,6 @@
 	<xsl:param name="idChatRoom" />
 	<xsl:param name="jidTo" />
+	<xsl:param name="lang_Send" />
+	<xsl:param name="lang_Leave_ChatRoom" />
 	<xsl:param name="path_jabberit" />
 
@@ -15,6 +17,9 @@
 					<textarea id="{$jidTo}__sendRoomChat" style="height:80px; width:325px;"></textarea>
 					<div style="margin: 5px;">
-						<input type="button" value="Send"/>
+						<input type="button" value="{$lang_Send}" style="margin-right: 5px;"/>
+						<input type="button" value="{$lang_Leave_ChatRoom}"/>
 					</div>
+					
+					
 				</div>
 			</div>			
Index: trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 3013)
+++ trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 3091)
@@ -12,5 +12,7 @@
 	COMPOSING : ' está digitando...',
 	GONE : ' saiu da conversa.',
+	LEAVE_CHATROOM : 'Sair da Sala',
 	PAUSED : ' está parado.',
+	SEND : 'Enviar',
 	STATUS_ANAVAILABLE : 'Desconectado',
 	STATUS_AVAILABLE : 'Disponível',
Index: trunk/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3086)
+++ trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3091)
@@ -902,5 +902,5 @@
     	var barejid		= Strophe.getBareJidFromJid(fulljid);
     	var titleWindow	= "";
-		
+
     	var paramsChatBox =
     	{
@@ -941,5 +941,5 @@
 		var _chatStateOnOff	= _content.getElementsByTagName( 'input' ).item( 1 );
 
-        function _send_message( )
+        var _send_message = function( )
         {
         	if ( ! TrophyIM.sendMessage( barejid, _textarea.value ) )
@@ -954,5 +954,5 @@
         	_textarea.value = '';
         	_textarea.focus( );
-        }
+        };
 		
 		var composingTimer_ = 0;
@@ -960,5 +960,5 @@
    		var timeCounter;
 
-   		function setComposing()
+   		var setComposing = function( )
    		{
    			var checkComposing = function()
@@ -981,5 +981,5 @@
          	}
          	isComposing_ = 1;
-      	}
+      	};
 
         loadscript.configEvents( _send, 'onclick', _send_message );
@@ -1038,9 +1038,10 @@
     	var titleWindow	= "ChatRoom - " + arguments[1];
     	
-    	
     	var paramsChatRoom =
     	{
     			'idChatRoom' 	: jidChatRoom + "__roomChat",
     			'jidTo'			: jidChatRoom,
+    			'lang_Send'		: i18n.SEND,
+    			'lang_Leave_ChatRoom' : i18n.LEAVE_CHATROOM,
 				'path_jabberit' : path_jabberit
     	};
@@ -1061,4 +1062,33 @@
     	
         var _messages		= _content.firstChild.firstChild;
+        var _textarea		= _content.getElementsByTagName( 'textarea' ).item( 0 );
+        var _send			= _content.getElementsByTagName( 'input' ).item( 0 );
+        var _leaveChatRoom	= _content.getElementsByTagName( 'input' ).item( 1 );
+        
+        var _send_message = function( )
+        {
+        	if ( ! TrophyIM.sendMessageChatRoom( jidChatRoom, _textarea.value ) )
+        		return false;
+        	
+        	_textarea.value = '';
+        	
+        	_textarea.focus( );
+        };
+        
+        loadscript.configEvents( _send, 'onclick', _send_message );
+        loadscript.configEvents( _leaveChatRoom, 'onclick', function( )
+        {
+        	TrophyIM.leaveChatRoom( jidChatRoom );
+        	
+        	//alert( jidChatRoom );
+        });
+        
+		loadscript.configEvents( _textarea, 'onkeyup', function( e )
+		{
+			if ( e.keyCode == 13 )
+			{
+				_send_message( );
+			}
+		});        
         
     	var winChatRoom = 
@@ -1201,9 +1231,22 @@
      */
     
-    joinRoom : function( roomName )
+    joinChatRoom : function( roomName )
     {
-    	var msg = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC});
+    	var presence = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC});
     	
-		TrophyIM.connection.send(msg);
+		TrophyIM.connection.send( presence );
+    },
+    
+    /** Function : Leave Chat Room
+     * 
+     * 
+     */
+    
+    leaveChatRoom : function( roomName)
+    {
+    	var room_nick = roomName;        
+        var presenceid = TrophyIM.connection.getUniqueId();
+        //var presence = $pres( {type: "unavailable", id: presenceid, to: room_nick} ).c("x",{ xmlns: Strophe.NS.MUC } );
+        //TrophyIM.connection.send( presence );
     },
     
@@ -1774,5 +1817,6 @@
     sendMessage : function()
     {
-		if (arguments.length > 0) {
+		if (arguments.length > 0)
+		{
 			var jidTo = arguments[0];
 			var message_input = arguments[1];
@@ -1803,5 +1847,27 @@
 		return false;
     },
-	
+
+	/** Function: sendMessage
+    *
+    *  Send message to ChatRoom
+    */
+    
+    sendMessageChatRoom : function( room )
+    {
+    	if( arguments.length > 0 ) 
+    	{
+	    	var room_nick	= arguments[0];
+	    	var message		= arguments[1];
+	        var msgid		= TrophyIM.connection.getUniqueId();
+	        var msg			= $msg({to: room_nick, type: "groupchat", id: msgid}).c("body",{xmlns: Strophe.NS.CLIENT}).t(message);
+	        
+	        msg.up();//.c("x", {xmlns: "jabber:x:event"}).c("composing");
+	        
+	        TrophyIM.connection.send(msg);
+	        
+	        return true;
+    	}
+    },
+    
 	/** Function: sendContentMessage
      *
Index: trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3086)
+++ trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3091)
@@ -1417,5 +1417,5 @@
 	    TrophyIM.makeChatRoom( jidRoom , nameRoom );
 	    
-	    TrophyIM.joinRoom( room_nick );
+	    TrophyIM.joinChatRoom( room_nick );
 	}
 	
