Index: trunk/jmessenger/xsl/itensGroup.xsl
===================================================================
--- trunk/jmessenger/xsl/itensGroup.xsl	(revision 2896)
+++ trunk/jmessenger/xsl/itensGroup.xsl	(revision 2971)
@@ -5,5 +5,4 @@
 	<xsl:param name="divDisplay" />
 	<xsl:param name="id" />
-	<xsl:param name="index" />
 	<xsl:param name="jid"/>
 	<xsl:param name="nameContact" />
@@ -14,8 +13,9 @@
 	<xsl:param name="statusColor" />
 	<xsl:param name="subscription" />
+	<xsl:param name="resource" />
 	
 	<xsl:template match="itens_group">
 
-			<div id="{$id}" subscription="{$subscription}" onmousedown="loadscript.actionButton(event,'{$jid}','{$index}');" style="background: url('{$path_jabberit}templates/default/images/{$presence}.gif') no-repeat center left; padding-left: 20px; margin:2px 0px 0px 10px; cursor:pointer; font-weight:normal; display:{$divDisplay};">
+			<div id="{$id}" subscription="{$subscription}" resource="{$resource}" onmousedown="loadscript.actionButton(event,'{$jid}' );" style="background: url('{$path_jabberit}templates/default/images/{$presence}.gif') no-repeat center left; padding-left: 20px; margin:2px 0px 0px 10px; cursor:pointer; font-weight:normal; display:{$divDisplay};">
 				<xsl:value-of select="$nameContact"/>
 			</div>
Index: trunk/jmessenger/xsl/notificationNewUsers.xsl
===================================================================
--- trunk/jmessenger/xsl/notificationNewUsers.xsl	(revision 2969)
+++ trunk/jmessenger/xsl/notificationNewUsers.xsl	(revision 2971)
@@ -19,8 +19,21 @@
 					<xsl:for-each select="user">
 						<xsl:sort select="jid"/>
-						<tr>
-							<td align="left" style="width: 60%;"><xsl:value-of select="jid" /></td>
-							<td align="center" style="width: 20%;"><a style="cursor:pointer;" onclick="alert('{jid}' + '{index}');"><xsl:value-of select="$lang_3"/></a></td>
-							<td align="center" style="width: 20%;"><a style="cursor:pointer;" onclick="alert('{jid}' + '{index}');"><xsl:value-of select="$lang_4"/></a></td>
+						<tr id="itenContactNotification_{jid}" subscription="{status}">
+							<td align="left" style="width: 60%;">
+								<xsl:value-of select="jid" />
+							</td>
+							
+							<td align="center" style="width: 20%;">
+								<div style="cursor:pointer; color:green;" onclick="loadscript.setAutorization('{jid}');">
+									<xsl:value-of select="$lang_3"/>
+								</div>
+							</td>
+							
+							<td align="center" style="width: 20%;">
+								<div style="cursor:pointer; color:red;" onclick="alert('{jid}');">
+									<xsl:value-of select="$lang_4"/>
+								</div>
+							</td>
+							
 						</tr>
 					</xsl:for-each>
Index: trunk/jmessenger/js/AddUser.js
===================================================================
--- trunk/jmessenger/js/AddUser.js	(revision 2961)
+++ trunk/jmessenger/js/AddUser.js	(revision 2971)
@@ -10,5 +10,4 @@
 				var jidFrom		= loadscript.getUserCurrent().jid;
 				var jidTo		= arguments[0];
-				var indexTo		= arguments[1];
 				var group 		= "";
 				var name		= jidTo.substring(0, jidTo.indexOf('@'));
@@ -30,8 +29,12 @@
 					group = "";
 				
-				// Remove Element html;
-				loadscript.removeElement( getElement('itenContact_' + jidTo + '_' + indexTo) );
-				loadscript.removeElement( getElement('span_show_itenContact_' + jidTo + '_' + indexTo) );
-				TrophyIM.rosterObj.removeContact(jidTo);
+				// Remove Element
+				if( getElement('itenContact_' + jidTo ) )
+				{
+					loadscript.removeElement( getElement('itenContact_' + jidTo ) );
+					loadscript.removeElement( getElement('span_show_itenContact_' + jidTo ) );
+				}
+
+				TrophyIM.rosterObj.removeContact( jidTo );
 			}
 			else
Index: trunk/jmessenger/js/trophyim.js
===================================================================
--- trunk/jmessenger/js/trophyim.js	(revision 2966)
+++ trunk/jmessenger/js/trophyim.js	(revision 2971)
@@ -345,12 +345,15 @@
     log : function(level, msg)
     {
-        if (TrophyIM.logging_div && level >= TROPHYIM_LOGLEVEL) {
-            while(TrophyIM.logging_div.childNodes.length > TROPHYIM_LOG_LINES) {
-                TrophyIM.logging_div.removeChild(
-                TrophyIM.logging_div.firstChild);
+        if (TrophyIM.logging_div && level >= TROPHYIM_LOGLEVEL)
+        {
+            while(TrophyIM.logging_div.childNodes.length > TROPHYIM_LOG_LINES)
+            {
+                TrophyIM.logging_div.removeChild( TrophyIM.logging_div.firstChild );
             }
+            
             var msg_div = document.createElement('div');
             msg_div.className = 'trophyimlogitem';
             msg_div.appendChild(document.createTextNode(msg));
+            
             TrophyIM.logging_div.appendChild(msg_div);
             TrophyIM.logging_div.scrollTop = TrophyIM.logging_div.scrollHeight;
@@ -589,5 +592,5 @@
 						group_array[group_array.length] = groups[g].firstChild.nodeValue;
 				}
-
+				
 				if( getAttribute('ask') )
 					TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array);
@@ -966,5 +969,5 @@
      */
     
-    renameContact : function( jid, index )
+    renameContact : function( jid )
     {
     	// Name
@@ -984,5 +987,5 @@
     	TrophyIM.addContact( jidTo, name, group );
     	
-    	document.getElementById('itenContact_' + jid + '_' + index).innerHTML = name;
+    	document.getElementById('itenContact_' + jid ).innerHTML = name;
     },
     
@@ -992,5 +995,5 @@
      */
 
-    renameGroup : function( jid, index)
+    renameGroup : function( jid )
     {
     	var group		= TrophyIM.rosterObj.roster[jid].contact.groups[0];
@@ -1035,12 +1038,12 @@
      */
     
-    removeContact : function(jidTo, indexTo)
+    removeContact : function( jidTo )
     {
     	var divItenContact	 = null;
     	var spanShow		 = null;
     	
-    	if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo )))
+    	if( ( divItenContact = document.getElementById('itenContact_' + jidTo )))
     	{	
-    		spanShow = document.getElementById('span_show_itenContact_' + jidTo + '_' + indexTo )
+    		spanShow = document.getElementById('span_show_itenContact_' + jidTo )
     		
     		spanShow.parentNode.removeChild(spanShow);
@@ -1185,5 +1188,4 @@
 				var group		= arguments[1];
 				var element		= arguments[2];
-				var index		= arguments[3];
 				var showOffline	= loadscript.getShowContactsOffline();
 				
@@ -1193,4 +1195,6 @@
 				var statusColor		= "black";
 				var statusDisplay	= "none";
+				
+				var _resource	= "";
 				
 				// Set Presence 
@@ -1237,7 +1241,7 @@
 								statusColor	= "orange";
 								
-								if ( TrophyIM.controll.notificationNewUsers == 0 ) 
+								if ( TrophyIM.controll.notificationNewUsers == 0 )
 								{
-									loadscript.teste_new();
+									loadscript.enabledNotificationNewUsers();
 									TrophyIM.controll.notificationNewUsers++;
 								}
@@ -1262,7 +1266,7 @@
 								statusColor	= "orange";	
 								
-								if ( TrophyIM.controll.notificationNewUsers == 0 ) 
+								if ( TrophyIM.controll.notificationNewUsers == 0 )
 								{
-									loadscript.teste_new();
+									loadscript.enabledNotificationNewUsers();
 									TrophyIM.controll.notificationNewUsers++;
 								}
@@ -1278,5 +1282,5 @@
 				};
 
-				var itensJid	= document.getElementById( "itenContact_" + objContact.contact.jid + "_" + index );
+				var itensJid	= document.getElementById( "itenContact_" + objContact.contact.jid );
 
 				if( itensJid == null )
@@ -1299,6 +1303,5 @@
 					{
 						divDisplay		: "block", 
-						id		  		: 'itenContact_' + objContact.contact.jid + '_' + index ,
-						index			: ((index == 0 ) ? "0" : index),
+						id		  		: 'itenContact_' + objContact.contact.jid ,
 						jid		  		: objContact.contact.jid,
 						nameContact 	: nameContact,
@@ -1308,5 +1311,6 @@
 						status	  		: status,
 						statusColor		: "black",
-						subscription	: objContact.contact.subscription
+						subscription	: objContact.contact.subscription,
+						resource		: _resource
 					}
 					
@@ -1343,5 +1347,8 @@
 					_subscription( objContact );
 					
-					with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ) )
+					// Set subscription
+					itensJid.setAttribute('subscription', objContact.contact.subscription );
+					
+					with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) )
 					{
 						if( presence == "unavailable" && !showOffline )
@@ -1361,5 +1368,7 @@
 					
 					if( presence == "unavailable" && !showOffline )
+					{
 						itensJid.style.display = "none";
+					}
 					else
 					{
@@ -1376,10 +1385,10 @@
 				if( !objContact.presence && !showOffline )
 				{
-					with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ))
+					with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ))
 					{
 						style.display 	= "none";
 					}
 
-					with ( document.getElementById('itenContact_' + objContact.contact.jid + '_' + index ) )
+					with ( document.getElementById('itenContact_' + objContact.contact.jid ) )
 					{
 						style.display	= "none";
@@ -1401,15 +1410,15 @@
 						for( var j = 0; j < groups.length; j++ )
 						{
-							addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j );
+							addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element );
 						}
 					}
 					else
 					{
-						addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );
+						addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element );
 					}
 				}
 				else
 				{
-					addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );
+					addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element );
 				}
 			}
@@ -1843,7 +1852,11 @@
                 this.addContact(barejid, 'not-in-roster');
             }
+            
             var presence =
 			{
-                resource:resource, priority:priority, show:show, status:status
+                resource	: resource,
+                priority	: priority,
+                show		: show,
+                status		: status
             }
             
@@ -1852,4 +1865,5 @@
                 this.roster[jid_lower]['presence'] = {};
             }
+            
             this.roster[jid_lower]['presence'][resource] = presence;
         }
