Index: trunk/jabberit_messenger/templates/default/setup.js
===================================================================
--- trunk/jabberit_messenger/templates/default/setup.js	(revision 551)
+++ trunk/jabberit_messenger/templates/default/setup.js	(revision 562)
@@ -43,10 +43,92 @@
 		
 						var Table = document.getElementById('tableHiddenJabberit');
-							Table.innerHTML = _xtools.parse( data, 'tableOrganizations.xsl', _params);
+							Table.parentNode.innerHTML = _xtools.parse( data, 'tableOrganizations.xsl', _params);
 					}
 				},
 				"conf=" + values);
 	}
-	
+
+	function addParticipantsExternals(pDocument)
+	{
+		var form = pDocument.forms[0];
+		var organization = "";
+		
+		for(var i = 0; i < form.elements.length; i++)
+		{
+			if( form.elements[i].type == 'text' )
+			{
+				var nameElement = form.elements[i].name;
+					nameElement = nameElement.substring(nameElement.indexOf('_') +1);
+				
+				if( form.elements[i].value != "" && ltrim(form.elements[i].value) != "" )
+				{
+						document.getElementById('label_' + nameElement).style.color = "black";
+						organization = form.elements[i].value;
+						form.elements[i].value = '';
+				}
+				else
+				{
+						document.getElementById('label_' + nameElement).style.color = "red";
+						alert(jabberitGetLang('Define Organization!'));
+						return false;
+				}
+			}
+		}
+		
+		_conn.go("$this.db_im.setOrganization",
+				function(data)
+				{
+					if ( data )
+					{
+						var _params = {
+							'lang1': jabberitGetLang('Organization'),
+							'lang2': jabberitGetLang('Delete')
+						};
+		
+						var Table = document.getElementById('tableExternalParticipantsJabberit');
+						Table.parentNode.innerHTML = _xtools.parse( data, 'tableExternalParticipants.xsl', _params);
+					}
+				},
+				"organization=" + organization);
+	}
+	
+	function setParticipantsExternal()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = arguments[0];
+			var form = arguments[1].forms[0];
+			var value = false;
+			
+			for(var i = 0; i < element.options.length; i++)
+			{
+				if( element.options[i].selected == true && element.options[i].value == 'true')
+					value = true;
+			}
+			
+			for(var i = 0; i < form.elements.length; i++)
+			{
+				switch(form.elements[i].type)
+				{
+					case 'text':
+					case 'button':
+						form.elements[i].disabled = false;			
+						if(!value)
+							form.elements[i].disabled = true;
+
+						break;
+				}
+			}
+			
+			_conn.go("$this.db_im.setUseParticipantsExternal",
+				function(data)
+				{
+					if(!data)
+						alert('Error !');
+				},
+				"value=" + value);
+		}
+	}
+
 	function getInputs(pDocument)
 	{
@@ -102,4 +184,27 @@
 	}
 
+	function ltrim(value)
+	{
+		var w_space = String.fromCharCode(32);
+		var strTemp = "";
+		var iTemp = 0;
+		
+		if(v_length < 1)
+			return "";
+	
+		var v_length = value ? value.length : 0;
+		
+		while(iTemp < v_length)
+		{
+			if(value && value.charAt(iTemp) != w_space)
+			{
+				strTemp = value.substring(iTemp,v_length);
+				break;
+			}
+			iTemp++;
+		}	
+		return strTemp;
+	}
+
 	function sendf()
 	{
@@ -107,17 +212,29 @@
 		var form = doc.forms[0];
 		var flag = false;
+		var nameForm = '';
 		
 		for( var i = 0; i < form.elements.length; i++ )
 		{
 			if( form.elements[i].type == 'hidden' )
+			{
 				flag = true;
+				if( form.elements[i].name == 'HiddenJabberitExternals')
+					nameForm = form.elements[i].name;
+			}
 		
 		}
 	
 		if( flag )
-			addLdapAttributes(doc);	
+		{
+			if(flag && nameForm == 'HiddenJabberitExternals')
+				addParticipantsExternals(doc);
+			else
+				addLdapAttributes(doc);
+		}	
 		else
+		{
 			if( doc )
 				return getInputs(doc);
+		}
 	}
 
@@ -138,7 +255,26 @@
 		}
 	}
+	
+	function removeParticipantsExternal()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = document.getElementById(arguments[0]);
+			var participantsExternal = arguments[0];
+			
+			_conn.go("$this.db_im.removeParticipantsExternal",
+					function(data)
+					{
+						if( data )
+							element.parentNode.removeChild(element);
+					},
+					"participants=" + participantsExternal);
+		}
+	}
 
 	function constructScript(){}
 
+	constructScript.prototype.setPartExternal = setParticipantsExternal;
+	constructScript.prototype.removePartExternal = removeParticipantsExternal;
 	constructScript.prototype.removeOrg = removeOrgLdapAttributes;
 	constructScript.prototype.sendf = sendf;
Index: trunk/jabberit_messenger/xsl/tableOrganizations.xsl
===================================================================
--- trunk/jabberit_messenger/xsl/tableOrganizations.xsl	(revision 519)
+++ trunk/jabberit_messenger/xsl/tableOrganizations.xsl	(revision 562)
@@ -8,17 +8,18 @@
 	
 	<xsl:template match="/">
-		
-		<tr style="width:60%">
-			<td align="left" class="row_on"><xsl:value-of select="$lang1" /></td>
-			<td align="left" class="row_on"><xsl:value-of select="$lang2" /></td>
-			<td align="left" class="row_on"><xsl:value-of select="$lang3" /></td>					
-		</tr>
-		<xsl:for-each select="return/ou	">
-			<tr id="{.}" style="width:40%" class="row_off">
-				<td><xsl:value-of select="." /></td>
-				<td><xsl:value-of select="@attr" /></td>
-				<td><a href="javascript:constructScript.removeOrg('{.}');"><xsl:value-of select="$lang3" /></a></td>
+		<table id="tableHiddenJabberit" cellspacing="2" style="width:100%">
+			<tr style="width:60%">
+				<td align="left" class="row_on"><xsl:value-of select="$lang1" /></td>
+				<td align="left" class="row_on"><xsl:value-of select="$lang2" /></td>
+				<td align="left" class="row_on"><xsl:value-of select="$lang3" /></td>					
 			</tr>
-		</xsl:for-each>
+			<xsl:for-each select="return/ou	">
+				<tr id="{.}" style="width:40%" class="row_off">
+					<td><xsl:value-of select="." /></td>
+					<td><xsl:value-of select="@attr" /></td>
+					<td><a href="javascript:constructScript.removeOrg('{.}');"><xsl:value-of select="$lang3" /></a></td>
+				</tr>
+			</xsl:for-each>
+		</table>
 		
 	</xsl:template>
Index: trunk/jabberit_messenger/xsl/add_user.xsl
===================================================================
--- trunk/jabberit_messenger/xsl/add_user.xsl	(revision 551)
+++ trunk/jabberit_messenger/xsl/add_user.xsl	(revision 562)
@@ -16,11 +16,12 @@
 		<div>
 			<div class="search_user">
-				<span style="width:130px;"><xsl:value-of select="$lang1" /> .:</span>
-				<input type="text" size="30" onclick="this.select();" onkeypress="javascript:loadscript.keyPress(event, this);" style="margin: 0 10 0 10px;"/>
-				<input type="button" class="search_user_button" value="{$lang2}" onclick="javascript:loadscript.search(this);" />
-				<br/>
-				<div id="external_Participants_Jabberit" style="display:none;">
+				<span style="width:130px;"><xsl:value-of select="$lang1" /> .: </span>
+				<input type="text" size="30" onclick="this.select();" onkeypress="javascript:loadscript.keyPress(event, this);" style="margin: 0 10 0 0px;"/>
+				<input type="image" src='../jabberit_messenger/templates/default/images/users.png' value="{$lang2}" onclick="javascript:loadscript.search(this);" />
+				<div id="external_Participants_Jabberit" style="display:none;margin:3 0 0 0px;border-bottom:1px dashed #000;">
 					<input type="checkbox" name="checkbox_external_Participants_Jabberit" style="margin:10 5 0 0px;" onclick="javascript:loadscript.cLabel(this);"/>
-					<xsl:value-of select="$lang8" />
+					<xsl:value-of select="$lang8" /> - <span onclick="javascript:loadscript.openWinParExt(this);" style="cursor:pointer;">
+					<img src='../jabberit_messenger/templates/default/images/view.png' alt='Ver Organizações' title='Ver Organizações' />
+					</span>
 				</div> 
 			</div>
