Index: /sandbox/jabberit_messenger/trophy/xsl/contactsList.xsl
===================================================================
--- /sandbox/jabberit_messenger/trophy/xsl/contactsList.xsl	(revision 2312)
+++ /sandbox/jabberit_messenger/trophy/xsl/contactsList.xsl	(revision 2312)
@@ -0,0 +1,11 @@
+<?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:template match="contacts_list">
+		
+		<div id="trophyimroster" />
+		 
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /sandbox/jabberit_messenger/trophy/xsl/chatBox.xsl
===================================================================
--- /sandbox/jabberit_messenger/trophy/xsl/chatBox.xsl	(revision 2298)
+++ /sandbox/jabberit_messenger/trophy/xsl/chatBox.xsl	(revision 2312)
@@ -9,9 +9,10 @@
 		
 			<div>
-				<div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll"></div>
+				<div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll;"></div>
 				<div style="margin:2px;">
-					<div style="margin-top:0px; width:70px; height:93px; position:relative; float:right; background-image:url('images/photo.png');"></div>
-					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" rows="5" cols="38"></textarea>
-					<div style="margin-left:2px;">
+					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:285px;"></textarea>
+					<div style="position:relative;margin:-126px 0 0 3px; border:0px solid red;width:70px; height:93px; background-image:url('images/photo.png');"></div>
+					
+					<div style="margin: 3px 0 0 4px;">
 						<input type="button" value="Send" onclick="TrophyIM.sendMessage('{$jidTo}')"/>
 					</div>
Index: /sandbox/jabberit_messenger/trophy/js/loadIM.js
===================================================================
--- /sandbox/jabberit_messenger/trophy/js/loadIM.js	(revision 2293)
+++ /sandbox/jabberit_messenger/trophy/js/loadIM.js	(revision 2312)
@@ -5,6 +5,21 @@
 	var zIndex	= 9001;
 	
+	function configEvents(pObj, pEvent, pHandler)
+	{
+		if ( typeof pObj == 'object' )
+		{
+			if ( pEvent.substring(0, 2) == 'on' )
+				pEvent = pEvent.substring(2, pEvent.length);
+
+			if ( pObj.addEventListener )
+				pObj.addEventListener(pEvent, pHandler, false);
+			else if ( pObj.attachEvent )
+				pObj.attachEvent('on' + pEvent, pHandler);
+		}
+	}
+	
 	function TrophyIMChatArea()
 	{
+		/*
 		var winImChatArea = 
 		{
@@ -23,7 +38,8 @@
 		};
 		
-		//_winBuild( winImChatArea );
-		
-		//return '<div id="trophyimchat"><div id="trophyimchattabs"/></div>';
+		_winBuild( winImChatArea );
+		
+		return '<div id="trophyimchat"><div id="trophyimchattabs"/></div>';
+		*/
 	}
 	
@@ -83,5 +99,5 @@
 	{
 		setXTools();			
-		
+
 		var winRosterDiv = 
 		{
@@ -97,10 +113,8 @@
 			 title			: "Contatos - Expresso Messenger",
 			 closeAction	: "hidden",
-			 content		: '<div id="trophyimroster" />' + TrophyIMStatusDiv()	
+			 content		: _xtools.parse(_xtools.xml("contacts_list"),"contactsList.xsl")	
 		};
 		
 		_winBuild( winRosterDiv );
-		
-		//return '<div id="trophyimroster" />'; 
 	}
 	
@@ -123,5 +137,5 @@
 	{
         var statusDiv = '<div id="trophyimstatus">' +
-        					'<span>Status:</span>' +
+        					'<span>Status::::</span>' +
         					'<span id="trophyimstatuslist">Select box</span>' +
         					'<br/>' + 
@@ -129,4 +143,10 @@
         						'<input type="button" value="disconnect" onclick="TrophyIM.logout()"/>' +
         					'</form>' +
+        						'<input type="button" value="DND" onclick="TrophyIM.setTest(\'dnd\')">'+
+        						'<input type="button" value="AWAY" onclick="TrophyIM.setTest(\'away\')">'+
+        						'<input type="button" value="XA" onclick="TrophyIM.setTest(\'xa\')">'+
+        						'<input type="button" value="INVISIBLE" onclick="TrophyIM.setTest(\'invisible\')">'+
+        						'<input type="button" value="UNAVAILABLE" onclick="TrophyIM.setTest(\'unavailable\')">'+
+        						'<input type="button" value="AVAILABLE" onclick="TrophyIM.setTest(\'available\')">'+
         				'</div>';
 		
@@ -216,5 +236,4 @@
 	function loadIM()
 	{
-
 		var files =	[
 		           	 'js/xtools.js',
@@ -222,5 +241,5 @@
 		           	 'js/makeW.js',
 		           	 'css/trophyim.css',
-		           	 'css/window_azul.css'
+		           	 //'css/window_azul.css'
 		           	 //'css/window_cataratas.css'
 		           	 //'css/window_celepar.css'
@@ -229,9 +248,8 @@
 		           	 //'css/window_escritorio.css'
 		           	 //'css/window_metropole.css'
-		           	 //'css/window_rochas.css'
+		           	 'css/window_rochas.css'
 		            ];
 		
 		loadScripts(files);
-		
 	}
 	
@@ -239,4 +257,5 @@
 	loadIM.prototype.getZIndex			= getZindex;
 	loadIM.prototype.parse				= parse;
+	loadIM.prototype.configEvents		= configEvents;
 	
 	loadIM.prototype.HTMLSnippets		= new HTMLSnippets;
Index: /sandbox/jabberit_messenger/trophy/js/trophyim.js
===================================================================
--- /sandbox/jabberit_messenger/trophy/js/trophyim.js	(revision 2298)
+++ /sandbox/jabberit_messenger/trophy/js/trophyim.js	(revision 2312)
@@ -499,15 +499,10 @@
         }
         TrophyIM.rosterObj = new TrophyIMRoster();
-        TrophyIM.connection.addHandler(TrophyIM.onVersion, Strophe.NS.VERSION,
-        'iq', null, null, null);
-        TrophyIM.connection.addHandler(TrophyIM.onRoster, Strophe.NS.ROSTER,
-        'iq', null, null, null);
-        TrophyIM.connection.addHandler(TrophyIM.onPresence, null, 'presence',
-        null, null, null);
-        TrophyIM.connection.addHandler(TrophyIM.onMessage, null, 'message',
-        null, null,  null);
+        TrophyIM.connection.addHandler(TrophyIM.onVersion, Strophe.NS.VERSION, 'iq', null, null, null);
+        TrophyIM.connection.addHandler(TrophyIM.onRoster, Strophe.NS.ROSTER, 'iq', null, null, null);
+        TrophyIM.connection.addHandler(TrophyIM.onPresence, null, 'presence', null, null, null);
+        TrophyIM.connection.addHandler(TrophyIM.onMessage, null, 'message', null, null,  null);
         //Get roster then announce presence.
-        TrophyIM.connection.send($iq({type: 'get', xmlns: Strophe.NS.CLIENT}).c(
-        'query', {xmlns: Strophe.NS.ROSTER}).tree());
+        TrophyIM.connection.send($iq({type: 'get', xmlns: Strophe.NS.CLIENT}).c('query', {xmlns: Strophe.NS.ROSTER}).tree());
         TrophyIM.connection.send($pres().tree());
         TrophyIM.renderChats();
@@ -577,16 +572,15 @@
      *  Presence handler
      */
-    onPresence : function(msg) {
-        Strophe.debug("Presence handler");
-        var type = msg.getAttribute('type') ? msg.getAttribute('type') :
-        'available';
-        var show = msg.getElementsByTagName('show').length ? Strophe.getText(
-        msg.getElementsByTagName('show')[0]) : type;
-        var status = msg.getElementsByTagName('status').length ? Strophe.getText(
-        msg.getElementsByTagName('status')[0]) : '';
-        var priority = msg.getElementsByTagName('priority').length ? parseInt(
-        Strophe.getText(msg.getElementsByTagName('priority')[0])) : 0;
-        TrophyIM.rosterObj.setPresence(msg.getAttribute('from'), priority,
-        show, status);
+    onPresence : function(msg)
+	{
+		//alert('Function onPresence');
+		
+		Strophe.debug("Presence handler");
+        var type = msg.getAttribute('type') ? msg.getAttribute('type') : 'available';
+        var show = msg.getElementsByTagName('show').length ? Strophe.getText(msg.getElementsByTagName('show')[0]) : type;
+        var status = msg.getElementsByTagName('status').length ? Strophe.getText(msg.getElementsByTagName('status')[0]) : '';
+        var priority = msg.getElementsByTagName('priority').length ? parseInt(Strophe.getText(msg.getElementsByTagName('priority')[0])) : 0;
+		TrophyIM.rosterObj.setPresence(msg.getAttribute('from'), priority, show, status);
+		
         return true;
     },
@@ -678,5 +672,5 @@
    			 id_window		: "window_chat_area_" + barjid,
 			 width			: 387,
-			 height			: 355,
+			 height			: 365,
 			 top			: 100,
 			 left			: 400,
@@ -691,4 +685,17 @@
     	
     	_winBuild(winChatBox)
+		
+		loadIM.configEvents(
+			document.getElementById( barjid + '__sendBox'),
+			'onkeyup', function(e)
+			{
+				if( e.keyCode == 13 )
+				{
+					TrophyIM.sendMessage( barjid );
+					document.getElementById( barjid + '__sendBox').value = '';
+					return false;
+				}
+			}
+		);
 		
     	/*
@@ -762,6 +769,9 @@
      *    (String) tab_div - tab div element to alter class on
      */
-    setTabPresence : function(jid, tab_div) {
-        var presence = TrophyIM.rosterObj.getPresence(jid);
+    setTabPresence : function(jid, tab_div)
+	{
+        alert('function setTabPresence');
+		
+		var presence = TrophyIM.rosterObj.getPresence(jid);
         tab_div.className = tab_div.className.replace(" trophyimchattab_av", "");
         tab_div.className = tab_div.className.replace(" trophyimchattab_aw", "");
@@ -1060,5 +1070,15 @@
         tab_item.parentNode.parentNode.removeChild(tab_item.parentNode);
     },
-    /** Function: sendMessage
+    
+	setPresence : function()
+	{
+		if( arguments.length > 0 )
+		{
+			//alert('Args 0 : ' + arguments[0]);
+			TrophyIM.connection.send($pres( ).c('show').t(arguments[0]));
+		}
+	},
+	
+	/** Function: sendMessage
      *
      *  Send message from chat input to user
@@ -1071,18 +1091,16 @@
     	{
     		var jidTo = arguments[0];
-    		var message_input = document.getElementById(jidTo + "__sendBox");
+    		var message_input = document.getElementById(jidTo + "__sendBox").value;
             
-    		if( message_input.value.replace(/^\s+|\s+$/g,"") != "" )
+    		if( ( message_input = message_input.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "" )
     		{
 	    		// Send Message
-	    		TrophyIM.connection.send($msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input.value).tree());
+	    		TrophyIM.connection.send($msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input).tree());
 	    		
 	    		var message = 
 	    		{
 	    				contact : "<font style='font-weight:bold; color:red;'>" + "Eu" + "</font>",
-	    				msg : message_input.value
+	    				msg : message_input
 	    		}
-	    		
-	    		message_input.value = '';
 	    		
 	    		// Add Message in chatBox;
@@ -1194,27 +1212,37 @@
      *    (String) status: status attribute from presence
      */
-    this.setPresence = function(fulljid, priority, show, status) {
-        var barejid = Strophe.getBareJidFromJid(fulljid);
+    this.setPresence = function(fulljid, priority, show, status)
+	{
+		var barejid = Strophe.getBareJidFromJid(fulljid);
         var resource = Strophe.getResourceFromJid(fulljid);
         var jid_lower = barejid.toLowerCase();
-        if(show != 'unavailable') {
-            if (!this.roster[jid_lower]) {
+        
+		if( show != 'unavailable')
+		{
+            if (!this.roster[jid_lower])
+			{
                 this.addContact(barejid, 'not-in-roster');
             }
-            var presence = {
+            var presence =
+			{
                 resource:resource, priority:priority, show:show, status:status
             }
-            if (!this.roster[jid_lower]['presence']) {
+            
+			if (!this.roster[jid_lower]['presence'])
+			{
                 this.roster[jid_lower]['presence'] = {}
             }
             this.roster[jid_lower]['presence'][resource] = presence
-        } else if (this.roster[jid_lower] && this.roster[jid_lower]['presence']
-        && this.roster[jid_lower]['presence'][resource]) {
+        }
+		else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource])
+		{
             delete this.roster[jid_lower]['presence'][resource];
         }
-        this.addChange(jid_lower);
-        if (TrophyIM.activeChats['divs'][jid_lower]) {
-            TrophyIM.setTabPresence(jid_lower, 
-            TrophyIM.activeChats['divs'][jid_lower]['tab']);
+        
+		this.addChange(jid_lower);
+        
+		if (TrophyIM.activeChats['divs'][jid_lower])
+		{
+            TrophyIM.setTabPresence(jid_lower, TrophyIM.activeChats['divs'][jid_lower]['tab']);
         }
     }
