Index: sandbox/jabberit_messenger/trophy_expresso/xsl/itensGroup.xsl
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/xsl/itensGroup.xsl	(revision 2491)
+++ sandbox/jabberit_messenger/trophy_expresso/xsl/itensGroup.xsl	(revision 2577)
@@ -10,4 +10,5 @@
 	<xsl:param name="presence" />
 	<xsl:param name="status"/>
+	<xsl:param name="statusColor" />
 	<xsl:param name="statusDisplay"/>
 	<xsl:param name="subscription" />
@@ -18,5 +19,5 @@
 				<xsl:value-of select="$nameContact"/>
 			</div>
-			<span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 8pt; font-style:italic; display:{$statusDisplay};"><xsl:value-of select="$status"/></span>
+			<span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 8pt; font-style:italic; display:{$statusDisplay}; color:{$statusColor};"><xsl:value-of select="$status"/></span>
 			
 	</xsl:template>
Index: sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl	(revision 2511)
+++ sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl	(revision 2577)
@@ -12,7 +12,7 @@
 				<div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll;"></div>
 				<div style="margin:2px;">
-					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:360px;"></textarea>
-					<div id="{$jidTo}__photo" style="position:relative;margin:-126px 0 0 3px;width:60px ;height:80px ;background-image:url('{$path_jabberit}templates/default/images/photo.png');" />
-					<div style="margin: 5px;">
+					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-right: 78px; height:130px; width:360px;"></textarea>
+					<div id="{$jidTo}__photo" style="position:relative;margin:-126px 0 0 290px;width:60px ;height:80px ;background-image:url('{$path_jabberit}templates/default/images/photo.png');" />
+					<div style="margin: 7px 5px 5px 295px;">
 						<input type="button" value="Send" onclick="TrophyIM.sendMessage('{$jidTo}')"/>
 					</div>
Index: sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js	(revision 2511)
+++ sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js	(revision 2577)
@@ -28,9 +28,15 @@
 			var jid 	= arguments[1];
 			var index	= arguments[2];
+			var coord	= null;
 		
 			if ( !e )
 				var e = window.event;
-			
-			( ( e.target ) ? e.target : e.srcElement ).parentNode.oncontextmenu = function(e)
+
+			var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft;
+			var _Y = e.clientY + document.body.scrollTop  - document.body.clientTop;
+				
+			coord = { X : _X, Y : _Y };
+			
+			window.document.oncontextmenu = function()
 			{
 				return false;
@@ -38,5 +44,7 @@
 	
 			if ( ( e.which && e.which > 1 ) || ( e.button && e.button > 1 ) )
-				optionsItensContact(jid, index);
+			{
+				optionsItensContact( jid, index, coord );
+			}
 			else
 			{
@@ -321,5 +329,7 @@
 			var jid 	= arguments[0];
 			var index	= arguments[1];
-			var element = document.getElementById('itenContact_' + jid + '_' + index );
+			var coord	= arguments[2];
+			var element = getElement('itenContact_' + jid + '_' + index );
+
 			
 			if( showhidden == null )
@@ -329,6 +339,6 @@
 			                	['Autorizar', 'loadIM.setAutorization(\''+jid+'\',\''+index+'\')'],
 			                	['Remover', 'loadIM.removeContact(\''+jid+'\',\''+index+'\')'],
-			                	['Renomear', 'Renomear : ' + jid],
-			                	['Trocar grupo', 'Trocar grupo : ' + jid],
+			                	['Renomear', 'loadIM.rename()'],
+			                	['Trocar grupo', 'loadIM.rename()'],
 						   ];
 
@@ -343,8 +353,10 @@
 			
 			var _optionsItens = document.createElement("div");
-				_optionsItens.setAttribute("style", "margin: -10px 0px 0px 20px;");
 				_optionsItens.className		= "x-menu";
-				_optionsItens.style.zIndex	= zIndex++;
+				_optionsItens.style.top		= coord.Y;
+				_optionsItens.style.left	= ( coord.X - element.offsetLeft );
+				_optionsItens.style.zIndex	= getZindex();
 				_optionsItens.innerHTML		= _itens;  
+				_optionsItens.onclick		= function(){ showhidden.hiddenObject(false); };
 				_optionsItens.onmouseout	= function(){ showhidden.hiddenObject(false); };	
 				_optionsItens.onmouseover	= function(){ showhidden.hiddenObject(true); };
@@ -352,5 +364,15 @@
 				showhidden.action('onmouseover', 'onmouseout', _optionsItens);
 				
-			element.appendChild(_optionsItens);
+			window.document.body.appendChild(_optionsItens);
+			
+			
+			setTimeout(function()
+			{
+				window.document.oncontextmenu = function()
+				{
+					return true;
+				};
+				
+			},500);
 		}
 	}
@@ -374,4 +396,15 @@
 	}
 	
+	function removeElement( )
+	{
+		if( arguments.length > 0 )
+		{
+			var _element = arguments[0] 
+			var _parent  = _element.parentNode;
+	
+			_parent.removeChild( _element );
+		}
+	}
+	
 	function removeGroup()
 	{
@@ -380,4 +413,9 @@
 		if( _parent.childNodes.length <= 2 )
 			_parent.parentNode.removeChild(_parent);
+	}
+	
+	function rename()
+	{
+		alert("Rename");
 	}
 	
@@ -416,5 +454,5 @@
 	function searchUser()
 	{
-		var _input	= document.getElementById('search_user_jabber');
+		var _input	= getElement('search_user_jabber');
 		
 		if( _input.value.length >= 3 )
@@ -428,5 +466,5 @@
     	var divItenContact = null;
     	
-    	if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo )))
+    	if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo )))
     	{	
     		var subscription = divItenContact.getAttribute('subscription');
@@ -435,10 +473,41 @@
     		{
     			case 'from':
+    				
+    				alert('SUBSCRIPTION FROM');
+    				//TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed');
+    				//TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe');
+    				break;
+
+    			case 'none' :
+    			
+    				TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe');
+    				TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed');
+    				
+    				break;
+
     			case 'not-in-roster':
-					TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe');
+	   				
+    				setTimeout(function()
+					{
+	    				var _add = "";
+	    			
+	    				if( ( _add = confirm("Deseja adicionar o usuario!")) )		
+	    				{
+	    					addUser.add( jidTo, indexTo );
+	    				}
+	    				
+					},100);
+    				
 					break;
+					
     			case 'to' :
-					TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed');
-    				break;
+    				
+    				TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed');
+					
+    			case 'subscribe' :
+    				
+    				TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe');
+    				
+					break;
     		}
     	}	
@@ -488,5 +557,5 @@
 	function setSelectEditable(element)
 	{
-		if( document.getElementById('selectBox0') == null )
+		if( getElement('selectBox0') == null )
 			selectEditable.create(element);
 	}
@@ -586,5 +655,7 @@
 	loadIM.prototype.setSelectEditable	= setSelectEditable;
 	loadIM.prototype.removeContact		= removeContact;
+	loadIM.prototype.removeElement		= removeElement;
 	loadIM.prototype.removeGroup		= removeGroup;
+	loadIM.prototype.rename				= rename;
 	loadIM.prototype.rosterDiv			= rosterDiv;
 	
Index: sandbox/jabberit_messenger/trophy_expresso/js/AddUser.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/AddUser.js	(revision 2511)
+++ sandbox/jabberit_messenger/trophy_expresso/js/AddUser.js	(revision 2577)
@@ -6,19 +6,58 @@
 		function addContact()
 		{
-			var jidFrom		= loadIM.getUserCurrent().jid;
-			var jidTo		= document.getElementById('user_jid_jabberIM').value;
-			var name		= document.getElementById('user_name_jabberIM').value;
-			var group		= document.getElementById('user_group_jabberIM').value;
+			if( arguments.length > 0 )
+			{
+				var jidFrom		= loadIM.getUserCurrent().jid;
+				var jidTo		= arguments[0];
+				var indexTo		= arguments[1];
+				var group 		= "";
+				var name		= jidTo.substring(0, jidTo.indexOf('@'));
+
+				TrophyIM.setAutorization( jidTo, loadIM.getUserCurrent().jid, 'subscribe');
+				
+				// Name
+				if(( name = prompt("Informe um nome para " + name + "!", name )))
+					if(( name = name.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+						name = "";
+
+				if( name == null || name == "")
+					name = "";
+				
+				// Group
+				if((group = prompt("Informe um grupo ou deixe em branco")))
+					if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+						group = "";
+
+				if( group == null || group == "")
+					group = "";
+				
+				// Remove Element html;
+				var _div	= getElement('itenContact_' + jidTo + '_' + indexTo);
+				var _span	= getElement('span_show_itenContact_' + jidTo + '_' + indexTo);
+
+				loadIM.removeElement( _div );
+				loadIM.removeElement( _span );
+			}
+			else
+			{	
+				var jidFrom		= loadIM.getUserCurrent().jid;
+				var jidTo		= document.getElementById('user_jid_jabberIM').value;
+				var name		= document.getElementById('user_name_jabberIM').value;
+				var group		= document.getElementById('user_group_jabberIM').value;
+				
+				_winBuild('add_user_info','remove');				
+			}
 			
 			if( jidFrom != jidTo )
-			{
 				TrophyIM.addContact( jidFrom, jidTo, name, group );
-				
-				_winBuild('add_user_info','remove');
-			}
 			else
 				alert("Mesmo Usuário !");
 		}
 		
+		function getElement( elementId )
+		{
+			return document.getElementById( elementId );
+		}
+
 		function search()
 		{
Index: sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2511)
+++ sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2577)
@@ -229,7 +229,4 @@
 			//Load other .js scripts needed
 			document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'strophejs/strophe.js'));
-			document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'strophejs/md5.js'));
-			document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'strophejs/sha1.js'));
-			document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'strophejs/b64.js'));
 			document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'js/json2.js')); //Keep this script last
 			//Wait a second to give scripts time to load
@@ -553,24 +550,9 @@
 				}
 
-				TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array);
+				if( getAttribute('ask') )
+					TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array);
+				else
+					TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array);
 			}
-			
-			/*
-			var groups = roster_items[i].getElementsByTagName('group');
-            
-			var group_array = new Array();
-            
-			for (var g = 0; g < groups.length; g++)
-			{
-				if( groups[g].firstChild != null )
-					group_array[group_array.length] = groups[g].firstChild.nodeValue;
-            }
-			
-			with ( roster_items[i] )
-			{
-				alert(getAttribute('jid') + "\n" + getAttribute('subscription') + "\n" + getAttribute('name'));
-				TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array);
-			}
-			*/
         }
 
@@ -713,10 +695,5 @@
 	addContact : function( jidFrom, jidTo, name, group )
 	{
-		// Set Presence
-    	var newPresence = $pres({from: jidFrom, to: jidTo, type: 'subscribe'}).tree();
-			
-		TrophyIM.connection.send(newPresence);
-    	
-    	// Add Contact
+		// Add Contact
     	var _id = TrophyIM.connection.getUniqueId('add'); 
 		var newContact = $iq({type: 'set', id: _id });
@@ -767,12 +744,20 @@
     		
     		divItenContact.parentNode.removeChild(divItenContact);
-    		
+
 	    	// Remove Contact
-			var _id	= TrophyIM.connection.getUniqueId('del'); 	
+			var _id	= TrophyIM.connection.getUniqueId(); 	
 	    	var delContact	= $iq({type: 'set', id: _id})
 	    		delContact	= delContact.c('query').attrs({xmlns : 'jabber:iq:roster'});
 	    		delContact	= delContact.c('item').attrs({jid: jidTo, subscription:'remove'}).tree();
-	    	
-	    	TrophyIM.connection.send(delContact);
+
+	    	TrophyIM.connection.send( delContact );	    		
+	    		
+	    	// Remove Contact	
+	    	var _id = TrophyIM.connection.getUniqueId();
+	    	var _delContact_ = $iq({type: 'set', id: _id})
+    			_delContact_ = _delContact_.c('query').attrs({xmlns : 'jabber:iq:private'});
+	    		_delContact_ = _delContact_.c('storage').attrs({xmlns : 'storage:metacontacts'}).tree();
+
+	    	TrophyIM.connection.send( _delContact_ );	
     	}
     },
@@ -920,7 +905,10 @@
 								presence = objContact.presence[resource].show;
 
+							if( objContact.contact.subscription != "both") 
+								presence = 'subscription';
+							
 							if( objContact.presence[resource].status )
 							{
-								status 			= " ( " + objContact.presence[resource].status + " ) ";
+								status = " ( " + objContact.presence[resource].status + " ) ";
 								statusDisplay	= "block";
 							}
@@ -930,13 +918,57 @@
 					var paramsContact =
 					{
-						'nameContact' 	: nameContact,
-						'jid'		  	: objContact.contact.jid,	
-						'id'		  	: 'itenContact_' + objContact.contact.jid + '_' + index ,
-						'index'			: index,
-						'path_jabberit'	: path_jabberit,
-						'presence'	  	: presence,
-						'status'	  	: status,
-						'statusDisplay'	: statusDisplay,
-						'subscription'	: objContact.contact.subscription
+						nameContact 	: nameContact,
+						jid		  		: objContact.contact.jid,	
+						id		  		: 'itenContact_' + objContact.contact.jid + '_' + index ,
+						index			: index,
+						path_jabberit	: path_jabberit,
+						presence	  	: presence,
+						status	  		: status,
+						statusColor		: "black",
+						statusDisplay	: statusDisplay,
+						subscription	: objContact.contact.subscription
+					}
+					
+
+					
+					// Authorization	
+					if( objContact.contact.subscription != "both" )
+					{
+						
+						switch(objContact.contact.subscription)
+						{
+							case "none" :
+								
+								paramsContact.status		= " (( PEDIR AUTORIZAÇAO ! )) ";
+								paramsContact.statusColor	= "red";
+								break;
+	
+							case "to" :
+								
+								paramsContact.status 		= " (( CONTATO PEDE AUTORIZAÇÃO ! )) ";
+								paramsContact.statusColor	= "orange";
+								break;
+	
+							case "from" :
+								
+								paramsContact.status 		= " (( AUTORIZAR ? )) ";
+								paramsContact.statusColor	= "green";
+								break;
+								
+							case "subscribe" : 
+								
+								paramsContact.status		= " (( AUTORIZAÇÃO ENVIADA ! )) ";
+								paramsContact.statusColor	= "red";	
+								break;
+
+							case "not-in-roster" :
+								
+								paramsContact.status		= " (( QUERO ADICIONÁ-LO(A) ! POSSO ? )) ";
+								paramsContact.statusColor	= "orange";	
+								break;
+								
+							default:
+								paramsContact.status = " ( " + objContact.contact.subscription + " ) ";
+						}
 					}
 					
@@ -961,7 +993,9 @@
 				else
 				{
+
 					// Presence e Status
 					var presence 		= "unavailable";
 					var status	 		= "";
+					var statusColor		= "black";
 					var statusDisplay	= "none";
 					
@@ -973,7 +1007,10 @@
 								presence = objContact.presence[resource].show;
 
+							if( objContact.contact.subscription != "both")
+								presence = 'subscription';
+							
 							if( objContact.presence[resource].status )
 							{
-								status 			= " ( " + objContact.presence[resource].status + " ) ";
+								status = " ( " + objContact.presence[resource].status + " ) ";
 								statusDisplay	= "block";
 							}
@@ -984,4 +1021,46 @@
 						is_open = is_open.indexOf("arrow_down.gif");
 					
+					// Authorization	
+					if( objContact.contact.subscription != "both" )
+					{
+						switch(objContact.contact.subscription)
+						{
+							case "none" :
+								
+								status 		= " (( PEDIR AUTORIZAÇAO ! )) ";
+								statusColor	= "red";
+								break;
+	
+							case "to" :
+								
+								status 		= " (( CONTATO PEDE AUTORIZAÇÃO ! )) ";
+								statusColor	= "orange";
+								break;
+	
+							case "from" :
+								
+								status 		= " (( AUTORIZAR ? )) ";
+								statusColor = "green";
+								break;
+								
+							case "subscribe" : 
+								
+								status		= " (( AUTORIZAÇÃO ENVIADA ! )) ";
+								statusColor	= "red";	
+								break;
+
+							case "not-in-roster" :
+								
+								status		= " (( QUERO ADICIONÁ-LO(A) ! POSSO ? )) ";
+								statusColor	= "orange";	
+								break;
+								
+							default:
+								status = " ( " + objContact.contact.subscription + " ) ";
+						}
+
+						statusDisplay = "block";
+					}
+					
 					with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ) )
 					{
@@ -989,4 +1068,5 @@
 						{
 							style.display	= statusDisplay;
+							style.color		= statusColor;
 							innerHTML		= status;
 						}
@@ -1186,5 +1266,5 @@
 	 	if( subscription !== "remove" )
         {
-	    	var contact		= { jid:jid, subscription:subscription, name:name, groups:groups }
+	 		var contact		= { jid:jid, subscription:subscription, name:name, groups:groups }
 	        var jid_lower	= jid.toLowerCase();
 	
@@ -1295,28 +1375,30 @@
 	 this.removeContact = function(jid)
 	 {
-		var groups = this.roster[ jid ].contact.groups;
+		if( this.roster[ jid ] )
+		{ 
+			var groups = this.roster[ jid ].contact.groups;
+			
+			if( groups )
+			{
+				for ( var i = 0; i < groups.length; i++ )
+				{
+					delete this.groups[ groups[ i ] ][ jid ];
+				}
+	
+				for ( var i = 0; i < groups.length; i++ )
+				{
+					var contacts = 0;
+					for ( var contact in this.groups[ groups[ i ] ] )
+						contacts++;
 		
-		if( groups )
-		{
-			
-			for ( var i = 0; i < groups.length; i++ )
-			{
-				delete this.groups[ groups[ i ] ][ jid ];
+					if ( ! contacts )
+						delete this.groups[ groups[ i ] ];
+				}
 			}
-
-			for ( var i = 0; i < groups.length; i++ )
-			{
-				var contacts = 0;
-				for ( var contact in this.groups[ groups[ i ] ] )
-					contacts++;
-	
-				if ( ! contacts )
-					delete this.groups[ groups[ i ] ];
-			}
+	
+			// Delete Object roster
+			if( this.roster[jid] )
+				delete this.roster[jid];
 		}
-
-		// Delete Object roster
-		if( this.roster[jid] )
-			delete this.roster[jid];		
 	 }
 	 
@@ -1334,7 +1416,7 @@
 	this.setPresence = function(fulljid, priority, show, status)
 	{
-		var barejid = Strophe.getBareJidFromJid(fulljid);
-        var resource = Strophe.getResourceFromJid(fulljid);
-        var jid_lower = barejid.toLowerCase();
+		var barejid		= Strophe.getBareJidFromJid(fulljid);
+        var resource	= Strophe.getResourceFromJid(fulljid);
+        var jid_lower	= barejid.toLowerCase();
         
 		if( show != 'unavailable')
