Index: trunk/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl
===================================================================
--- trunk/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl	(revision 3099)
+++ trunk/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl	(revision 3099)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:output method="html" omit-xml-declaration="yes"/>
+	
+	<xsl:param name="lang_nameChatRoom" />
+	<xsl:param name="lang_nickName" />	
+	
+	<xsl:template match="create_chat_room">
+		
+		<div style="margin:5px;">
+			
+			<div style="margin-top:10px;">
+				<label><xsl:value-of select="$lang_nickName"/> : </label>
+				<span style="position:absolute; left: 85px;">
+					<input id="nickName_chatRoom_jabberit" type="text" size="35" maxlength="35"/>
+				</span>
+			</div>
+			
+			<div style="margin-top:10px;">
+				<label><xsl:value-of select="$lang_nameChatRoom"/> : </label>
+				<span style="position:absolute; left: 85px;">
+					<input id="name_ChatRoom_jabberit" type="text" size="35" maxlength="35"/>
+				</span>
+			</div>
+		</div>
+		
+		<div id="buttons_createChatRoom" style="float:left; margin:20px 0px 0px 10px;" />		
+		
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: trunk/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3097)
+++ trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3099)
@@ -14,5 +14,7 @@
 var TROPHYIM_VERSION 		= "0.3";
 
-var TROPHYIM_RESOURCE		= "/JABBERITWEB"; 
+var TROPHYIM_RESOURCE		= "/JABBERITWEB";
+
+var TROPHYIM_CHATROOM		= "conference.im.pr.gov.br";
 
 //Uncomment to make session reattachment work
@@ -645,5 +647,5 @@
         var priority	= msg.getElementsByTagName('priority').length ? parseInt(Strophe.getText(msg.getElementsByTagName('priority')[0])) : 0;
 
-    	if( msg.getAttribute('from').toString().indexOf('conference') < 0 )
+    	if( msg.getAttribute('from').toString().indexOf( TROPHYIM_CHATROOM ) < 0 )
     	{	
         	TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status );
@@ -691,5 +693,5 @@
                 		_UserChatRoom.appendChild( document.createTextNode(nickName) );
                 
-                	var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid'));		
+                	var nodeUser = document.getElementById(nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );		
                 		
                 	if( nodeUser == null && xquery[i].firstChild.getAttribute('jid') )
@@ -702,6 +704,5 @@
                 		else
                 		{
-                			TrophyIM.makeChatRoom( nameChatRoom, "TESTE_MEU" );
-                			
+                			TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom );
                 			nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
                 			nameChatRoom.appendChild( _UserChatRoom );
@@ -712,6 +713,12 @@
                 		if( type == 'unavailable' )
                 		{
-                			var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to'));
-                				nodeUser.parentNode.removeChild( nodeUser );
+                			var nodeUser = "";
+                			
+                			if( xquery[i].firstChild.getAttribute('jid') != null )
+                				nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );
+                			else
+                				nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to') );
+                			
+                			nodeUser.parentNode.removeChild( nodeUser );
                 		}
                 		else if( show )
@@ -1244,5 +1251,20 @@
     },
 
-    // TESTE SALAS
+    /** Function createChatRooms
+     * 
+     * 
+     */
+    
+    createChatRooms : function()
+    {
+    	var nickName	 = document.getElementById('nickName_chatRoom_jabberit').value;
+    	var nameChatRoom = document.getElementById('name_ChatRoom_jabberit').value; 
+    	
+    	var _from		= Base64.decode( loadscript.getUserCurrent().jid ) + TROPHYIM_RESOURCE; 
+		var _to			= escape( nameChatRoom ) + "@" + TROPHYIM_CHATROOM + "/" + nickName ;
+		var new_room	= $pres( {from: _from, to: _to } ).c( "x", { xmlns: Strophe.NS.MUC } );
+
+		TrophyIM.connection.send( new_room.tree() );
+    },
     
     /** Function : joinRoom
@@ -1265,5 +1287,5 @@
     leaveChatRoom : function( roomName )
     {
-    	var room_nick	= roomName + "/USUARIO_DE_TESTE"; 
+    	var room_nick	= roomName;
     	
         var presenceid	= TrophyIM.connection.getUniqueId();
Index: trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3097)
+++ trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3099)
@@ -1255,15 +1255,42 @@
 	}
 
-	// TESTE ROOMS
 	function createChatRooms()
 	{
-		var _from		= "alexandrecorreia@im.pr.gov.br" + TROPHYIM_RESOURCE; 
-		var _to			= "teste_alexandre@conference.im.pr.gov.br" + "/alexandrecorreia" ;
-		var new_room	= $pres( {from: _from, to: _to } ).c( "x", { xmlns: Strophe.NS.MUC } );
-		
-        TrophyIM.connection.send( new_room.tree() );
-	}
-	
-	loadIM.prototype.createChatRooms = createChatRooms;
+ 		var paramCreateChatRoom = 
+		{
+			'lang_nameChatRoom'	: "Nome da Sala",
+			'lang_nickName'		: "Apelido"
+		};
+		
+		var winCreateChatRooms =
+		{	
+			 id_window		: "window_create_chat_rooms",
+			 width			: 360,
+			 height			: 160,
+			 top			: 100,
+			 left			: 410,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: loadscript.getZIndex(),
+			 title			: "Expresso Messenger - Criar Sala de Bate Papo",
+			 closeAction	: "remove",
+			 content		: Xtools.parse( Xtools.xml("create_chat_room"), "createChatRoom.xsl", paramCreateChatRoom )
+		};
+		
+		_winBuild( winCreateChatRooms );
+
+		var _pButtons =
+		{
+			'lang1' 		: 'Ingressar',
+			'lang2'			: 'Fechar',
+			'onclickClose'	: '_winBuild("window_create_chat_rooms","remove");',
+			'onclickSubmit'	: 'TrophyIM.createChatRooms(); _winBuild("window_create_chat_rooms","remove");'
+		}; 
+
+		// Add Buttons
+		document.getElementById('buttons_createChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+		
+	}
 	
 	function listRooms( element )
@@ -1404,9 +1431,4 @@
 	}
 	
-	loadIM.prototype.getListRooms	= getListRooms;
-	loadIM.prototype.listRooms		= listRooms;
-
-	
-	
 	function joinRoom( jidRoom, nameRoom )
 	{
@@ -1417,5 +1439,5 @@
 	        if ( nick ) 
 	        {
-	            room_nick += "/" + Strophe.escapeNode(nick); 
+	            room_nick += "/" + nick; 
 	        }
 	        
@@ -1433,20 +1455,23 @@
 		    
 		    var _prompt = prompt("Deseja informar um Apelido ?", nickName );
-		    	_prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");
 		    
-		    var room_nick = test_append_nick( jidRoom, nickName );	
-		    	
-		    if( _prompt && _prompt != "" )
-		    {
-		    	var room_nick = test_append_nick( jidRoom, _prompt );
+		    if( _prompt )
+		    { 	
+			   	_prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");
+			    
+			    var room_nick = test_append_nick( jidRoom, nickName );	
+			    	
+			    if( _prompt && _prompt != "" )
+			    {
+			    	var room_nick = test_append_nick( jidRoom, _prompt );
+			    }
+			    
+			    TrophyIM.makeChatRoom( jidRoom , nameRoom );
+			    
+			    TrophyIM.joinChatRoom( room_nick);
 		    }
-		    
-		    TrophyIM.makeChatRoom( jidRoom , nameRoom );
-		    TrophyIM.joinChatRoom( room_nick );
 	    }
 	}
 	
-	loadIM.prototype.joinRoom	= joinRoom;
-	
 	function loadIM()
 	{
@@ -1454,14 +1479,4 @@
 		{
 			var files = [
-			             		/*path_jabberit + 'js/connector.js',
-			            	 	path_jabberit + 'js/xtools.js',
-			            	 	path_jabberit + 'js/lang/i18n_pt_Br.js',
-			            	 	path_jabberit +	'js/dragdrop.js',
-			            	 	path_jabberit + 'js/makeW.js',
-			            	 	path_jabberit + 'js/show_hidden.js',
-			            	 	path_jabberit + 'js/trophyim.js',
-			            	 	path_jabberit + 'js/AddUser.js',			            	 	
-			            	 	path_jabberit + 'js/json2.js',
-			            	 	path_jabberit + 'js/SelectEditable.js',*/
 			            	 	path_jabberit + 'templates/default/css/button.css',
 			            	 	path_jabberit + 'templates/default/css/common.css',
@@ -1519,5 +1534,5 @@
 		}
 	}
-	
+
 	loadIM.prototype.adIcon				= addIcon;
 	loadIM.prototype.actionButton		= actionButton;
@@ -1526,10 +1541,12 @@
 	loadIM.prototype.clrAllContacts		= clrAllContacts;
 	loadIM.prototype.configEvents		= configEvents;
+	loadIM.prototype.createChatRooms	= createChatRooms;
 	loadIM.prototype.disabledNotificationNewUsers	= disabledNotificationNewUsers;
 	loadIM.prototype.enabledNotificationNewUsers	= enabledNotificationNewUsers;	
-	loadIM.prototype.getStatusUserIM	= getStatusUserIM;
+	loadIM.prototype.getListRooms		= getListRooms;	
 	loadIM.prototype.getIsIE			= getIsIE;
 	loadIM.prototype.getPhotoUser		= getPhotoUser;
 	loadIM.prototype.getSmiles			= getSmiles;
+	loadIM.prototype.getStatusUserIM	= getStatusUserIM;
 	loadIM.prototype.getStatusMessage	= getStatusMessage;
 	loadIM.prototype.getShowContactsOffline	= getShowContactsOffline;
@@ -1538,5 +1555,7 @@
 	loadIM.prototype.groupsHidden		= groupsHidden;
 	loadIM.prototype.groupsVisible		= groupsVisible;
+	loadIM.prototype.joinRoom			= joinRoom;	
 	loadIM.prototype.keyPressSearch		= keyPressSearch;	
+	loadIM.prototype.listRooms			= listRooms;
 	loadIM.prototype.loginPage			= loginPage;
 	loadIM.prototype.notification		= notificationNewMessage;
@@ -1560,7 +1579,5 @@
 	loadIM.prototype.windowPOPUP		= windowPOPUP;
 	
-	
 	window.LoadIM = loadIM;
-	
 	
 	// Necessário para não ocasionar problema no ExpressoMail
