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;
 	
