Index: /branches/2.2.0.1/jabberit_messenger/setup/phpgw_pt-br.lang
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/setup/phpgw_pt-br.lang	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/setup/phpgw_pt-br.lang	(revision 4453)
@@ -0,0 +1,113 @@
+Access Permissions	common	pt-br	Permissões de Acesso
+Add	jabberit_messenger	pt-br	Adicionar
+Add Contact	jabberit_messenger	pt-br	Adicionar Contato
+Add organizations and servers jabber	jabberit_messenger	pt-br	Adicionar organizações e servidores jabber
+Auditing	common	pt-br	Auditoria
+Applications List	jabberit_messenger	pt-br	Lista de Módulos
+Attention	jabberit_messenger	pt-br	Atenção
+ATTENTION	jabberit_messenger	pt-br	ATENÇÃO
+Attribute	jabberit_messenger	pt-br	Atributo
+Away	jabberit_messenger	pt-br	Ausente
+Cancel	jabberit_messenger	pt-br	Cancelar
+Change Status	jabberit_messenger	pt-br	Status
+Choice attribute	common	pt-br	Escolha o Atributo
+Choice Contact	jabberit_messenger	pt-br	Escolha Contato
+Close	jabberit_messenger	pt-br	Fechar
+Close this menu	jabberit_messenger	pt-br	Fechar Menu
+Configuration of authentication attribute by Organization (OU)	common	pt-br	Configurar o atributo de autenticação por Organização (OU)
+Content	common	pt-br	Conteúdo
+Connection	jabberit_messenger	pt-br	Conexão
+Date and Hour	common	pt-br	Data e Hora
+Delete	jabberit_messenger	pt-br	Excluir
+Dnd	jabberit_messenger	pt-br	Não Perturbe
+Enable Auto Login IM	jabberit_messenger	pt-br	Conectar Automaticamente IM 
+Enable the Expresso Messenger inside of the modules	common	pt-br	Habilitar o Expresso Messenger dentro dos módulos
+Enable the Expresso Messenger module	jabberit_messenger	pt-br	Habilitar o módulo Expresso Messenger 
+Enter a GROUP	jabberit_messenger	pt-br	Informe um GRUPO
+Enter a NAME	jabberit_messenger	pt-br	Informe um NOME
+Enter a value greater than or equal to 1!	jabberit_messenger	pt-br	Informe um valor igual ou maior que 1!
+Error saving your preferences!	jabberit_messenger	pt-br	Erro salvando suas preferências! 
+External Participants	common	pt-br	Participantes Externos
+External Participants	jabberit_messenger	pt-br	Participantes Externos
+First Message	common	pt-br	Primeira Mensagem
+Free organization for group	common	pt-br	Liberar organização por grupo
+Free For Chat	jabberit_messenger	pt-br	Livre Bate-Papo
+From 	common	pt-br	De
+Group	jabberit_messenger	pt-br	Grupo
+Groups Added	common	pt-br	Grupos Adicionados
+Groups Ldap	common	pt-br	Grupos Ldap
+Help	jabberit_messenger	pt-br	Ajuda
+Information	jabberit_messenger	pt-br	Informações Adicionais
+Invisible	jabberit_messenger	pt-br	Invisível
+jabberit_messenger	common	pt-br	Expresso Messenger
+Last Message	common	pt-br	Última Mensagem
+Liberar Organizações para grupos restritos	common	pt-br	Liberar Organizações para grupos restritos
+List of Contacts	jabberit_messenger	pt-br	Lista de Contatos
+Loading...	jabberit_messenger	pt-br	Carregando...
+Log Messaging (Bandersnatch)	common	pt-br	Log de Mensagens (Bandersnatch)
+Map organization for realm jabber	common	pt-br	Mapear organização por domínio jabber
+Minutes	jabberit_messenger	pt-br	Minutos
+My Settings	jabberit_messenger	pt-br	Minhas Configurações
+Modules Enabled	jabberit_messenger	pt-br	Módulos Habilitados
+Modules List	jabberit_messenger	pt-br	Lista de Módulos
+More than 50 results. Please, try to refine your search.	jabberit_messenger	pt-br	Mais que 50 resultados foram encontrados. Tente refinar sua pesquisa.
+Name	jabberit_messenger	pt-br	Nome
+Name of Contacts	jabberit_messenger	pt-br	Nome do Contato
+New	jabberit_messenger	pt-br	Novo
+Nickname	jabberit_messenger	pt-br	Apelido
+No	jabberit_messenger	pt-br	Não
+Not Auth	jabberit_messenger	pt-br	Não Autorizado
+Normal	jabberit_messenger	pt-br	Normal
+None result was found.	jabberit_messenger	pt-br	Nenhum resultado foi encontrado.
+Others Expressos	jabberit_messenger	pt-br	Outros Expressos
+Organization Unit	jabberit_messenger	pt-br	Selecione uma Organização
+Organization	jabberit_messenger	pt-br	Organização
+Organizations	common	pt-br	Organizações
+online	jabberit_messenger	pt-br	Online
+offline	jabberit_messenger	pt-br	Offline
+Open IM	jabberit_messenger	pt-br	Abrir IM
+Open as Pop-Up Window	jabberit_messenger	pt-br	Abrir janela como Pop-up
+Options	jabberit_messenger	pt-br	Opções
+Organizations and jabber servers	common	pt-br	Organizações e servidores jabber
+Photo	jabberit_messenger	pt-br	Foto
+Problems in its register \n	jabberit_messenger	pt-br	Problemas em seu registro
+Preferences	jabberit_messenger	pt-br	Preferências
+Preferences saved with success!	jabberit_messenger	pt-br	Preferências salvas com sucesso!
+Quick Contacts	jabberit_messenger	pt-br	Contatos Rápidos
+Re-connect Expresso Messenger ?	jabberit_messenger	pt-br	Reconectar Expresso Messenger ?
+Registration of Organizations and Servers Jabber	jabberit_messenger	pt-br	Cadastro de Organizações e Servidores Jabber
+Remove	jabberit_messenger	pt-br	Remover
+Restrict group	common	pt-br	Restringir grupo
+save	jabberit_messenger	pt-br	Salvar
+says	jabberit_messenger	pt-br	diz
+Select Organization	common	pt-br	Selecione Organização
+Select the modules where the Expresso Messenger will be loaded.	jabberit_messenger	pt-br	Selecione os módulos onde o Expresso Messenger será carregado.
+Select the LDAP attribute for Jabber authentication	jabberit_messenger	pt-br	Informe o atributo LDAP para autenticação do Servidor Jabber
+Search result	jabberit_messenger	pt-br	Resultado da busca
+Search users	jabberit_messenger	pt-br	Procurar usuários
+Server Ldap	common	pt-br	Servidor Ldap
+Servers Jabber	jabberit_messenger	pt-br	Servidores Jabber
+Set status to away after	jabberit_messenger	pt-br	Definir status de ausente depois de
+Settings	common	pt-br	Configurações
+Show friends Offline	jabberit_messenger	pt-br	Exibir amigos Offline
+Site configuration jabber	common	pt-br	Configurações do servidor jabber
+Successfully effected register!	jabberit_messenger	pt-br	Registro efetuado com sucesso!
+Status	jabberit_messenger	pt-br	Status
+Status of the Transference	jabberit_messenger	pt-br	Status da Transferência
+The module is not loaded	jabberit_messenger	pt-br	O módulo não está carregado
+This user is part of a small group!	jabberit_messenger	pt-br	Este usuário faz parte de um grupo restrito!
+to see preferences	jabberit_messenger	pt-br	Ver Preferências
+To define user information	jabberit_messenger	pt-br	Definir informações do usuário
+Update	jabberit_messenger	pt-br	Atualizar
+Users OffLine	jabberit_messenger	pt-br	Usuários OffLine
+Username	jabberit_messenger	pt-br	Username
+unavailable	jabberit_messenger	pt-br	Desconectado
+Vcard	jabberit_messenger	pt-br	Vcard
+Xa	jabberit_messenger	pt-br	Ausente
+Yes	jabberit_messenger	pt-br	Sim
+Your Preferences	jabberit_messenger	pt-br	Suas Preferências
+Your search argument must be longer than 4 characters.	jabbertit_messenger	pt-br	Seus argumentos para a pesquisa precisam ter mais que 4 dígitos.
+your status	jabberit_messenger	pt-br	Seu status
+Wait a moment !!	pt-br	jabberit_messenger	Aguarde um momento !!
+waiting	jabberit_messenger	pt-br	Aguardando
+Window	jabberit_messenger	pt-br	Janelaa
Index: /branches/2.2.0.1/jabberit_messenger/setup/setup.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/setup/setup.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/setup/setup.inc.php	(revision 4453)
@@ -0,0 +1,31 @@
+<?php
+	/******************************************************\
+	 * Im - Instant Messenger										*
+	 * Alexandre Correia												*
+	 * Rodrigo Souza													*
+	\******************************************************/
+	
+	$setup_info['jabberit_messenger']['name']      	= 'jabberit_messenger';
+	$setup_info['jabberit_messenger']['title']     	= 'Expresso Messenger';
+	$setup_info['jabberit_messenger']['version']   	= '2.2.1';
+	$setup_info['jabberit_messenger']['app_order'] 	= 9;
+	$setup_info['jabberit_messenger']['enable']    	= 1;
+	
+	/* Conf Table */
+	
+	$setup_info['jabberit_messenger']['author'] 		  = 'http://jeti-im.org/';
+	$setup_info['jabberit_messenger']['maintainer']	 	  = 'Alexandre Correia <br/> Rodrigo Souza';
+	$setup_info['jabberit_messenger']['maintainer_email'] = 'Os mesmos';
+
+	$setup_info['jabberit_messenger']['license']  	 = 'GPL';
+	$setup_info['jabberit_messenger']['description'] = 'Módulo de Mensagens Instantâneas com o Serviço Jabber';
+
+	/* The hooks this app includes, needed for hooks registration */
+	$setup_info['jabberit_messenger']['hooks'][] = 'admin';
+		
+	/* Dependencies for this app to work */
+	$setup_info['jabberit_messenger']['depends'][] = array(
+		'appname' => 'phpgwapi',
+		'versions' => Array('2.2')
+	);
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/contactsList.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/contactsList.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/contactsList.xsl	(revision 4453)
@@ -0,0 +1,54 @@
+<?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:param name="idUser"/>
+	<xsl:param name="full_name" />
+	<xsl:param name="help_expresso" />
+	<xsl:param name="path_jabberit" />
+	<xsl:param name="zIndex_" />
+	
+	<xsl:template match="contacts_list">
+		
+		<fieldset style="margin:2px; border:1px dotted #000000; height: 103px;">
+			<div id="{$idUser}__photo" style="position: absolute; left: 5px; top: 5px; width:60px; height:80px; background-image:url('{$path_jabberit}templates/default/images/photo.png');"/>
+
+			<div style="position: absolute; left: 80px; top: 8px;"> <xsl:value-of select="$full_name"/> </div>
+
+			<div style="position: absolute; top: 25px; left: 80px;">
+				<button style="width:35px;" alt="Adicionar Contatos" title="Adicionar Contatos" onclick="loadscript.addContact();">
+					<img src="{$path_jabberit}templates/default/images/users.png"/>
+				</button>
+				
+				<img style="height:15px; margin-left:10px;cursor:pointer;" alt="Minhas Preferências" title="Minhas Preferências" src="{$path_jabberit}templates/default/images/preferences.png" onclick="loadscript.preferences();"/>
+				
+				<img style="height:16px; margin-left:10px;cursor:pointer;" alt="Help" title="Help" src="{$path_jabberit}templates/default/images/help.png" onclick="javascript:openWindow(480,510,'{$help_expresso}');" />
+				
+			</div>
+			
+			<div id="notification_new_users_jabber" style="display:none; position:absolute; top: 25px; left: 165px;">
+				<img style="margin-left:15px;cursor:pointer;" alt="Novos Contatos" title="Novos Contatos" src="{$path_jabberit}templates/default/images/alert_2.png" onclick="loadscript.windowNotificationNewUsers();" />
+			</div>
+
+			<div style="position: absolute; left: 80px; top: 53px; cursor: pointer;" onclick="loadscript.setPresence(this);">
+				<div id="statusJabberImg" style="background: url('{$path_jabberit}templates/default/images/available.gif'); margin-left: 13px;width:15px; height:15px;"></div>
+				<div id="statusJabberText" style="margin-top: -13px; margin-left: 30px;"> Disponível </div>
+				<div style="background-image: url('{$path_jabberit}templates/default/images/arrow_down.gif'); margin-top: -13px; margin-left: 0px; width:15px; height:15px;"/>
+			</div>
+			
+			<div id="JabberIMRosterLoadingGif" style="position:absolute; left:136px; top:118px; display:block;">
+					<img src='{$path_jabberit}templates/default/images/loading.gif' style="width:20px; height:20px;"/>
+					<span style="color:red;"> Carregando...!!</span>
+			</div>
+			
+			<div id="JabberIMStatusMessage" style="position:absolute; left:5px; top:90px; display:block; font:7pt !important;">
+				<label style="cursor:pointer;" onclick="loadscript.setMessageStatus(this);">( Digite aqui sua mensagem de Status )</label>
+			</div>
+
+		</fieldset>
+				
+		<div id="JabberIMRoster" style="margin-top:2px; overflow-y:auto; height: 255px; z-index:{$zIndex_};"></div>
+		 
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listLdapContacts.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listLdapContacts.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listLdapContacts.xsl	(revision 4453)
@@ -0,0 +1,45 @@
+<?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:param name="lang_addContact" />
+	<xsl:param name="lang_empty" />
+	<xsl:param name="lang_error" />
+	<xsl:param name="lang_many_results" />
+	
+	<xsl:template match="/">
+
+		<xsl:if test="error">
+			<label style="color:red;"><xsl:value-of select="$lang_error" /></label>
+		</xsl:if>
+		
+		<xsl:if test="empty">
+			<label style="color:red;"><xsl:value-of select="$lang_empty" /></label>
+		</xsl:if>
+		
+		<xsl:if test="manyresults">
+			<label style="color:red;"><xsl:value-of select="$lang_many_results" /></label>
+		</xsl:if>
+
+		<xsl:if test="uids">
+			<xsl:apply-templates select="uids/*" mode="uids" />
+		</xsl:if>
+		
+	</xsl:template>
+
+	<xsl:template match="*" mode="uids">
+		<xsl:for-each select="data">
+			<xsl:sort select="cn"/>
+			<span value="{mail};{uid}" jid="{jid}" name="{cn}" ou="{ou}" photo="{photo}">
+				<span id="{mail};{uid}" style="display:none;"><xsl:value-of select="cn" /></span>
+				<b><xsl:value-of select="name(..)"/></b>
+				<br/><xsl:value-of select="cn" />
+				<br/>
+				<br/>
+				<label id="__label__{mail};{uid}" style="color:blue;cursor:pointer;"><xsl:value-of select="$lang_addContact" /></label>
+				<br/>
+			</span>
+		</xsl:for-each>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatRoom.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatRoom.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatRoom.xsl	(revision 4453)
@@ -0,0 +1,29 @@
+<?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:param name="idChatRoom" />
+	<xsl:param name="jidTo" />
+	<xsl:param name="lang_Send" />
+	<xsl:param name="lang_Leave_ChatRoom" />
+	<xsl:param name="path_jabberit" />
+
+	<xsl:template match="chat_room">
+	
+			<div>
+				<div id="{$idChatRoom}" style="height:300px; width:328px; overflow-y:scroll;"></div>
+				<div id="{$idChatRoom}__participants" style="float:right; position: absolute; top:0px; left:330px; width:150px; height:380px; overflow-y: auto;"></div>
+				<div style="margin:2px;">
+					<textarea id="{$jidTo}__sendRoomChat" style="height:80px; width:325px;"></textarea>
+					<div style="margin: 5px;">
+						<input type="button" value="{$lang_Send}" style="margin-right: 5px;"/>
+						<input type="button" value="{$lang_Leave_ChatRoom}"/>
+					</div>
+					
+					
+				</div>
+			</div>			
+		 
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/groups.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/groups.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/groups.xsl	(revision 4453)
@@ -0,0 +1,18 @@
+<?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:param name="nameGroup" />
+	<xsl:param name="path_jabberit" />
+	
+	<xsl:template match="group">
+
+			<div style="margin-bottom: 3px;">
+				<span  onclick="loadscript.groupsHidden(this);" style="background: url('{$path_jabberit}/templates/default/images/arrow_down.gif') no-repeat center left; font-weight:bold; padding-left: 16px; cursor: pointer;">
+					<xsl:value-of select="$nameGroup"/>
+				</span>
+			</div>
+			
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/notificationNewUsers.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/notificationNewUsers.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/notificationNewUsers.xsl	(revision 4453)
@@ -0,0 +1,47 @@
+<?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:param name="lang_1" />
+	<xsl:param name="lang_2" />
+	<xsl:param name="lang_3" />
+	<xsl:param name="lang_4" />
+		
+	<xsl:template match="notification_new_users">
+		
+		<fieldset style="margin:3px; padding:5px;border:1px solid #cecece;">
+
+			<legend><xsl:value-of select="$lang_1"/></legend>
+			<label><xsl:value-of select="$lang_2"/></label>
+			
+			<div style="border:1px solid #cecece; margin-top: 10px; height:210px; overflow-y:auto;">
+				<table style="width: 100%;">
+					<xsl:for-each select="user">
+						<xsl:sort select="jid"/>
+						<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="loadscript.removeContact('{jid}');">
+									<xsl:value-of select="$lang_4"/>
+								</div>
+							</td>
+							
+						</tr>
+					</xsl:for-each>
+				</table>
+			</div>
+		
+		</fieldset>
+		
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensStatus.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensStatus.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensStatus.xsl	(revision 4453)
@@ -0,0 +1,20 @@
+<?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:param name="image_src" />
+
+	<xsl:template match="/">
+		<dl>
+			<xsl:apply-templates select="." mode="option" />
+		</dl>
+		
+	</xsl:template>
+
+	<xsl:template match="option" mode="option">
+		<dt style="cursor:pointer; padding:2px 2px 2px 15px; background: url('{$image_src}') no-repeat;" >
+			<xsl:value-of select="item" />
+		</dt>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/addUser.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/addUser.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/addUser.xsl	(revision 4453)
@@ -0,0 +1,56 @@
+<?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:param name="lang_group" />
+	<xsl:param name="lang_load" />
+	<xsl:param name="lang_name_contact" />
+	<xsl:param name="lang_result" />
+	<xsl:param name="path" />
+	<xsl:param name="group" />
+	<xsl:param name="jid" />
+	<xsl:param name="name" />
+	<xsl:param name="selectBoxOptions" />
+
+	<xsl:template match="userinfo">
+
+		<div style="margin:2px">
+			<div style="margin:5px 0px 5px 5px;">
+				<span><xsl:value-of select="$lang_name_contact" /> .: </span> 
+				<input id="search_user_jabber" type="text" size="30" onclick="this.select();" onkeypress="loadscript.keyPressSearch(event, this);" />
+				<button style="position:relative; top:5px; left:10px;" onclick="loadscript.searchUser()"><img src="{$path}templates/default/images/users.png"/></button>
+			</div>
+
+			<div class="add_organization_members" style="margin:7px 0px 5px 5px;">
+				<span style="width:auto;"><xsl:value-of select="$lang_result"/> .: </span>
+				<br style="clear:both"/>
+				<div id="list_users_ldap_im"></div>
+			</div>
+		</div>
+
+		<span id="im_status_add" style="color:#f00;"></span>
+		<span id="span_searching_im" style="background-color:#cc4444;color:white;display:none;position:absolute;right:5px;top:26px;padding:2px;">
+			<xsl:value-of select="$lang_load" /> ...
+		</span>
+		
+	</xsl:template>
+	
+	<xsl:template match="adduser">
+
+		<div id="photo_user_ldap_jabber" style="margin: 5px; position:relative ;float:left;" />
+		<div class="add_member_info" style="margin-bottom:40px !important;">
+			<form>
+				<span> <xsl:value-of select="$lang_name_contact"/> : </span>
+				<input id="user_name_jabberIM" type="text" size="25" maxlength="50" value="{$name}" onclick="this.select();" />
+				<br/><br/>
+				<span><xsl:value-of select="$lang_group"/> : </span>
+				<input id="user_group_jabberIM" type="text" size="25" maxlength="50" value="{$group}" selectboxoptions="{$selectBoxOptions}" onclick="this.select();" />
+				<input id="user_jid_jabberIM" type="hidden" value="{$jid}" />
+			</form>
+		</div>
+		
+		<div id="buttons_adduser" style="float:left;margin-left: 50px;" />
+		
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatBox.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatBox.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/chatBox.xsl	(revision 4453)
@@ -0,0 +1,32 @@
+<?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:param name="enabledPopUp" />	
+	<xsl:param name="idChatBox" />
+	<xsl:param name="jidTo" />
+	<xsl:param name="path_jabberit" />
+
+	<xsl:template match="chat_box">
+	
+			<div>
+				<div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll;"></div>
+				<div id="{$jidTo}__chatState" style="height:15px; width:365px;"></div>
+				<div style="margin:2px;">
+					<textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:360px;"></textarea>
+					<div style="position:relative;margin:-126px 0 0 10px; border-right:1px dotted #000 !important; width:67px; height:120px;">
+						<div id="{$jidTo}__photo" style="width:60px ;height:80px ;background-image:url('{$path_jabberit}templates/default/images/photo.png');" />
+						<div style="margin: 7px 5px 5px 10px;">
+							<input type="button" value="Send"/>
+						</div>
+						<div id="{$jidTo}__popUp" onclick="loadscript.windowPOPUP('{$jidTo}', true );" style="display:{$enabledPopUp}; cursor:pointer;padding-left:16px; font-size:10px ;height:14px; width:50px; background:url('{$path_jabberit}templates/default/images/icon_up.png') no-repeat;">
+							PopUp
+						</div>
+					</div>
+				</div>
+				<input id="{$jidTo}__chatStateOnOff" type="hidden" name="chatStateOnOff" value="off"/>
+			</div>			
+		 
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/newUser.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/newUser.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/newUser.xsl	(revision 4453)
@@ -0,0 +1,29 @@
+<?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:param name = "jidFrom" />
+	<xsl:param name = "jidTo" />
+	<xsl:param name = "name_contact" />
+	<xsl:param name = "selectBoxOptions" />
+	
+	<xsl:template match="new_user">
+		
+		<div style="margin:5px;">
+			<label>Nome do Grupo .: </label>
+			<input id="name_group_new_user_jabberit" type="text" size="30" maxlength="50" selectboxoptions="{$selectBoxOptions}" onclick="this.select();" />
+			<br/>
+			<br/>
+			<br/>
+			<label>Nome do Usuário .: </label>
+			<input type="text" id="name_new_user_jabberit" size="30" maxlength="50" value="{$name_contact}" />
+		</div>
+		<br/>
+		<br/>
+		<div id="buttons_newuser" style="margin-left:20px;" />		
+		<input type="hidden" id="jidFrom_new_user_jabberit" value="{$jidFrom}" />
+		<input type="hidden" id="jidTo_new_user_jabberit" value="{$jidTo}" />
+		
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listRooms.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listRooms.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/listRooms.xsl	(revision 4453)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:output method="html" omit-xml-declaration="yes"/>
+
+	<xsl:param name="path_jabberit" />
+
+	<xsl:template match="listRooms">
+		
+		<div style="margin:5px; height:200px; overflow-y: auto">
+			
+			<xsl:for-each select="room">
+				<xsl:sort select="@nameRoom"/>
+				<div onclick="loadscript.joinRoom('{jidRoom}','{@nameRoom}');" style="cursor:pointer;padding :5px 0px 5px 45px; background:url({$path_jabberit}templates/default/images/conference.png) no-repeat center left; border-bottom:1px dashed #cecece; margin:6px 1px;">
+					Nome da Sala : <xsl:value-of select="@nameRoom"/> <br/>
+					<xsl:choose>
+						<xsl:when test="description != ''">
+							DescriÃ§Ã£o : <xsl:value-of select="description"/> <br/>
+						</xsl:when>
+						<xsl:otherwise>
+							DescriÃ§Ã£o : &lt; Sem DescriÃ§Ã£o &gt; <br/>
+						</xsl:otherwise>
+					</xsl:choose>					
+					Ocupantes : <xsl:value-of select="occupants"/> <br/>
+					<xsl:choose>
+						<xsl:when test="password = 'true'">
+							Password : <span style="color:red; font-weight: bold;"><blink>Com Senha</blink></span><br/>
+						</xsl:when>
+						<xsl:otherwise>
+							Password : Sem Senha <br/>
+						</xsl:otherwise>
+					</xsl:choose>					
+				</div>
+			</xsl:for-each>
+			
+		</div>
+		
+		<div id="buttons_addChatRoom" style="float:left; margin:10px 0px 0px 10px;" />
+		
+	</xsl:template>
+
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/buttons.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/buttons.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/buttons.xsl	(revision 4453)
@@ -0,0 +1,67 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="onclickClose" />
+	<xsl:param name="onclickSubmit" />
+	
+	<xsl:template match="buttons_main">
+		<table cellspacing="2">
+			<tr>
+				<td>
+					<table cellspacing="0" class="x-btn  x-btn-noicon" style="width: 75px;">
+						<tbody class="x-btn-small x-btn-icon-small-left">
+						<tr>
+							<td class="x-btn-tl"><i> </i></td>
+							<td class="x-btn-tc"></td>
+							<td class="x-btn-tr"><i> </i></td>
+						</tr>
+						<tr>
+							<td class="x-btn-ml"><i> </i></td>
+							<td class="x-btn-mc" onclick="{$onclickSubmit};">
+								<em unselectable="on">
+									<button type="button" class="x-btn-text"><xsl:value-of select="$lang1"/></button>
+								</em>
+							</td>
+							<td class="x-btn-mr"><i> </i></td>
+						</tr>
+						<tr>
+							<td class="x-btn-bl"><i> </i></td>
+							<td class="x-btn-bc"></td>
+							<td class="x-btn-br"><i> </i></td>
+						</tr>
+						</tbody>
+					</table>
+				</td>
+				<td>
+					<table cellspacing="0" class="x-btn  x-btn-noicon" style="width: 75px;">
+						<tbody class="x-btn-small x-btn-icon-small-left">
+							<tr>
+								<td class="x-btn-tl"><i> </i></td>
+								<td class="x-btn-tc"></td>
+								<td class="x-btn-tr"><i> </i></td>
+							</tr>
+							<tr>
+								<td class="x-btn-ml"><i> </i></td>
+								<td class="x-btn-mc"  onclick="{$onclickClose};">
+									<em unselectable="on">
+										<button type="button" class="x-btn-text"><xsl:value-of select="$lang2"/></button>
+									</em>
+								</td>
+								<td class="x-btn-mr"><i> </i></td>
+							</tr>
+							<tr>
+								<td class="x-btn-bl"><i> </i></td>
+								<td class="x-btn-bc"></td>
+								<td class="x-btn-br"><i> </i></td>
+							</tr>
+						</tbody>
+					</table>
+				</td>
+			</tr>
+		</table>
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensGroup.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensGroup.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/itensGroup.xsl	(revision 4453)
@@ -0,0 +1,26 @@
+<?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:param name="divDisplay" />
+	<xsl:param name="id" />
+	<xsl:param name="jid"/>
+	<xsl:param name="nameContact" />
+	<xsl:param name="path_jabberit" />
+	<xsl:param name="presence" />
+	<xsl:param name="spanDisplay"/>
+	<xsl:param name="status"/>
+	<xsl:param name="statusColor" />
+	<xsl:param name="subscription" />
+	<xsl:param name="resource" />
+	
+	<xsl:template match="itens_group">
+
+			<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>
+			<span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 10px; font-style:italic; display:{$spanDisplay}; color:{$statusColor};"><xsl:value-of select="$status"/></span>
+			
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/createChatRoom.xsl	(revision 4453)
@@ -0,0 +1,31 @@
+<?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:param name="lang_nameChatRoom" />
+	<xsl:param name="lang_nickName" />	
+	
+	<xsl:template match="create_chat_room">
+		
+		<div style="margin:5px;">
+			
+			<div style="margin-top:10px;">
+				<label><xsl:value-of select="$lang_nickName"/> : </label>
+				<span style="position:absolute; left: 85px;">
+					<input id="nickName_chatRoom_jabberit" type="text" size="35" maxlength="35"/>
+				</span>
+			</div>
+			
+			<div style="margin-top:10px;">
+				<label><xsl:value-of select="$lang_nameChatRoom"/> : </label>
+				<span style="position:absolute; left: 85px;">
+					<input id="name_ChatRoom_jabberit" type="text" size="35" maxlength="35"/>
+				</span>
+			</div>
+		</div>
+		
+		<div id="buttons_createChatRoom" style="float:left; margin:20px 0px 0px 10px;" />		
+		
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/preferences.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/preferences.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/preferences.xsl	(revision 4453)
@@ -0,0 +1,56 @@
+<?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:param name="path" />
+	<xsl:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="lang3" />
+	<xsl:param name="lang4" />	
+	<xsl:param name="lang5" />	
+	<xsl:param name="lang8" />
+	<xsl:param name="lang9" />
+	<xsl:param name="lang10" />
+	<xsl:param name="lang11" />
+	<xsl:param name="lang12" />
+	<xsl:param name="lang13" />
+	<xsl:param name="lang14" />
+	<xsl:param name="langYes" />
+	<xsl:param name="langNo" />		
+	
+	<xsl:template match="preferences">
+		<fieldset style="margin:3px; padding:5px;border:1px solid #cecece;">
+			<legend><xsl:value-of select="$lang1"/></legend>
+			<fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang2"/></legend>	
+				<br/>
+				<label><xsl:value-of select="$lang3"/> .: </label>
+				<select id="openWindowJabberit">
+					<option value="true"><xsl:value-of select="$langYes"/></option>
+					<option value="false"><xsl:value-of select="$langNo"/></option>					
+				</select>
+			</fieldset>
+			
+			<fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang10"/></legend>			
+				<br/>
+				<label><xsl:value-of select="$lang11"/><input id="flagAwayIM" type="text" size="2" maxlength="2" style="margin-left:4px; margin-right:4px;" onclick="this.select();" /><xsl:value-of select="$lang12"/></label>
+			</fieldset>
+			
+			<fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang13"/></legend>			
+				<br/>
+				<label><xsl:value-of select="$lang14"/> .: </label>
+				<select id="showContactsOfflineJabberit">
+					<option value="true"><xsl:value-of select="$langYes"/></option>
+					<option value="false"><xsl:value-of select="$langNo"/></option>					
+				</select>
+			</fieldset>
+			
+		</fieldset>
+
+		<div id="buttons_preferences_jabberit" style="margin:5px;padding:5px;cellpadding:5px;"/>
+		
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/loginPage.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/loginPage.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/loginPage.xsl	(revision 4453)
@@ -0,0 +1,37 @@
+<?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:param name="username" />	
+	<xsl:param name="password" />
+	
+	<xsl:template match="login_page">
+		
+		<center>
+			<div id="trophyimlogin">
+				<form name="cred">
+					<table style="border:0px">
+						<tr>
+							<td align="right">Usuário:</td>
+							<td><input type="text" id="trophyimjid" value="{$username}" /></td>
+						</tr>
+						<tr>
+							<td align="right">Password:</td>
+							<td><input type="password" id="trophyimpass" value="{$password}" /></td>
+						</tr>
+					</table>
+					<br/>
+					<table>
+						<tr>
+							<td colspan="2" align="center">
+								<input type="button" id="trophyimconnect" value="connect" onclick="TrophyIM.login()"/>
+							</td>
+						</tr>
+					</table>
+				</form>
+			</div>
+		</center>
+		 
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/window.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/window.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/xsl/window.xsl	(revision 4453)
@@ -0,0 +1,64 @@
+<?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:param name = "id_window" />
+	<xsl:param name = "left" />	
+	<xsl:param name = "height" />
+	<xsl:param name = "onclick" />
+	<xsl:param name = "title" />
+	<xsl:param name = "top" />
+	<xsl:param name = "width" />
+	<xsl:param name = "zindex" />
+	
+	<xsl:template match="window_main">
+			
+			<!-- Principal -->
+			<div id="{$id_window}__main" style="z-index: {($zindex)+1}; width: {$width}px;" class="x-window">
+				<div class="x-window-tl">
+					<div class="x-window-tr">
+						<div class="x-window-tc">
+							<div id="{$id_window}__draggable" style="-moz-user-select: none; width: {($width)-31}px;" class="x-window-header x-unselectable x-window-draggable">
+								<xsl:value-of select="$title"/>
+							</div>
+							<div class="x-tool x-tool-close" onclick="{$onclick}"></div>
+						</div>
+					</div>
+				</div>
+				<div class="x-window-bwrap">
+					<div class="x-window-ml">
+						<div class="x-window-mr">
+							<div class="x-window-mc">
+								<div style="width: {($width)-14}px; height: {($height)-32}px;" class="x-window-body">
+									<div style="width: {($width)-14}px;" class="x-tab-panel x-tab-panel-noborder">
+										
+										<!-- Conteudo -->
+										<div class="x-tab-panel-bwrap">
+											<div style="width: {($width)-14}px; height: {$height}px;" class="x-tab-panel-body x-tab-panel-body-noborder x-tab-panel-body-top">
+												<div style="width: {($width)-14}px;" class="x-panel x-panel-noborder">
+													<div class="x-panel-bwrap">
+														<div style="width: {($width)-14}px; height: {($height)-34}px;" class="x-panel-body x-panel-body-noheader x-panel-body-noborder">
+															<div id="{$id_window}__content">
+															</div>
+														</div>
+													</div>
+												</div>
+											</div>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+					
+					<div class="x-window-bl x-panel-nofooter">
+						<div class="x-window-br">
+							<div class="x-window-bc"></div>
+						</div>
+					</div>
+				</div>
+			</div>
+			
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/controller.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/controller.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/controller.php	(revision 4453)
@@ -0,0 +1,37 @@
+<?php
+
+if(!isset($GLOBALS['phpgw_info']))
+{
+        $GLOBALS['phpgw_info']['flags'] = array(
+                'currentapp' => 'jabberit_messenger',
+        );
+}
+
+require_once '../../header.session.inc.php';
+
+$request_method = '_' . $_SERVER['REQUEST_METHOD'];
+switch ( $request_method )
+{
+	case '_GET' :
+		$params = $_GET;
+	break;
+	case '_POST' :
+		$params = $_POST;
+	break;
+	case '_HEAD' :
+	case '_PUT' :
+	default :
+		echo "controller - request method not avaible";
+		return false;
+}
+
+if( file_exists(dirname(__FILE__) . "/inc/Controller.class.php") )
+{
+	require_once dirname(__FILE__) . '/inc/Controller.class.php';
+
+	$controller = new Controller();
+	printf("%s", $controller->exec($$request_method, dirname(__FILE__)));
+	exit(0);
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 4453)
@@ -0,0 +1,111 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']);
+
+for( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'] != "jabberit_messenger"; $i++ )
+{
+	$apps = unserialize($GLOBALS['phpgw_info']['server']['apps_jabberit']);
+	$flag = false;
+
+	if( is_array($apps) )
+	{
+		foreach($apps as $tmp)
+		{
+			$app_enabled = substr($tmp,0,strpos($tmp,";"));
+			if( $GLOBALS['phpgw_info']['flags']['currentapp'] == $app_enabled )
+				$flag = true;
+		}	
+	}
+	
+	if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'jabberit_messenger' && ( $flag || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'jabberit_messenger' ))
+	{
+
+		$ldapManager = CreateObject('contactcenter.bo_ldap_manager');
+		$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager'] = $ldapManager->srcs[1];
+		
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		$help_expresso      = $webserver_url .'help';
+                $webserver_expresso = $webserver_url . "phpgwapi/";
+		$webserver_url      = $webserver_url . 'jabberit_messenger/jmessenger/'; 
+		
+		require_once PHPGW_SERVER_ROOT . '/jabberit_messenger/jmessenger/inc/jabberit_sessions.inc.php';
+		
+		$_SESSION['phpgw_info']['jabberit_messenger']['webserver_url'] = $webserver_url;
+		
+		// Temas Expresso
+		$theme = "window_" . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . ".css";
+		
+		if( !file_exists('../jabberit_messenger/jmessenger/templates/default/css/'.$theme) )
+			$theme = "window_default.css";
+
+		
+		//Bloqueio das Salas de Bate-Papo por Organização
+		$account_dn = $GLOBALS['phpgw_info']['user']['account_dn'];
+		$ou			= explode("dc=", $account_dn);
+		$ou			= explode("ou=",$ou[0]);
+		$ou			= array_pop($ou);
+		$ou			= strtoupper(substr($ou,0,strlen($ou)-1));
+		
+		$OUS_BLOQ 		= array();
+		$Im_ChatRoom	= "false";
+		
+		foreach( $OUS_BLOQ as $lock )
+		{
+			if ( strtoupper($lock) === strtoupper($ou) )
+			{
+				$Im_ChatRoom = "true";
+			}		
+		}
+			
+		// User
+		$fullName	= $_SESSION['phpgw_info']['jabberit_messenger']['fullname'];
+
+		$js  = "var path_jabberit	= '".$webserver_url."';";
+		$js .= "var theme_jabberit	= '".$theme."';";
+		$js .= "var help_expresso	= '".$help_expresso."';";
+		$js .= "var im_chatroom		= '".$Im_ChatRoom."';";
+
+		// Preferences User
+		require_once PHPGW_SERVER_ROOT . '/jabberit_messenger/jmessenger/inc/class.DataBaseIM.inc.php';
+		
+		$_DbIM			= new DataBaseIM();
+		$preferences	= $_DbIM->getPreferences();
+                
+                
+		echo "<script type='text/javascript'>".$js."</script>";
+		echo "<script type='text/javascript' src='".$webserver_url .        "js/strophe.mini.js'></script>";
+		echo "<script type='text/javascript' src='".$webserver_expresso .   "js/browser/browserDetect.js'></script>";
+		echo "<script type='text/javascript' src='".$webserver_url .        "js/jscode/loadIM.mini.js'></script>";
+                echo "<script type='text/javascript' src='".$webserver_url .        "js/connector.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_expresso .   "js/x_tools/xtools.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/lang/i18n_pt_Br.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/dragdrop.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/makeW.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/show_hidden.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/trophyim_constants.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/trophyim.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/AddUser.mini.js'></script>";			            	 	
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/json2.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url .        "js/SelectEditable.mini.js'></script>";
+		echo "<script type='text/javascript'> var loadscript = new LoadIM('".$fullName."','".$preferences."','".$webserver_expresso."'); </script>";
+		
+		break;
+	}
+	
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/controller.xml
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/controller.xml	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/controller.xml	(revision 4453)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<controller>
+	<controller-security>
+		<string-access>act</string-access>
+		<string-delimiter>.</string-delimiter>
+	</controller-security>
+	<controller-contentes>
+		<item param="c" section="css" />
+		<item param="j" section="js" />
+		<item param="p" section="php" />
+		<item param="xm" section="xml" />
+		<item param="xs" section="xsl" />
+	</controller-contentes>
+	<controller-sections>
+		<css></css>
+		<js path="/js" suffix=".js">
+			<item ref="connector" js="connector" />
+		</js>
+		<php path="/inc" suffix=".class.php">
+			<item ref="cc" alias="getListContacts" class="ContactsIm" method="getListContacts" prefix="class." suffix=".inc.php"/>
+			<item ref="ff" alias="data_0" class="CommonFunctions" method="getUserCurrentUserJabber" prefix="class." suffix=".inc.php"/>
+			<item ref="ff" alias="data_1" class="CommonFunctions" method="getUserCurrentPassword" prefix="class." suffix=".inc.php"/>
+			<item ref="pf" alias="setPreferences" class="preferencesJMessenger" method="setPreferences" prefix="" suffix=".php"/>
+		</php>
+		<xml></xml>
+		<xsl></xsl>
+	</controller-sections>
+</controller>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.CommonFunctions.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.CommonFunctions.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.CommonFunctions.inc.php	(revision 4453)
@@ -0,0 +1,42 @@
+<?php
+
+class CommonFunctions
+{
+	private $userJabber;
+	private $password;
+	
+	function __construct()
+	{
+		$this->userJabber	= $_SESSION['phpgw_info']['jabberit_messenger']['user_jabber']."@".$_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'];
+		$this->password		= $_SESSION['phpgw_info']['jabberit_messenger']['passwd'];
+	}
+
+	function getUserCurrentUserJabber()
+	{
+		return "YWxleG5K87W".base64_encode($this->userJabber);
+		//return $this->gerador().base64_encode($this->userJabber);
+	}	
+
+	function getUserCurrentPassword()
+	{
+		return "TWxGeG55K7W".base64_encode($this->password);
+		//return $this->gerador().base64_encode($this->password);
+	}	
+	
+	private function gerador()
+	{
+		$char = "ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789abcdefghiklmnopqrstuvwxyz";
+		$key = "";
+		
+		for( $i = 0 ; $i < 61; $i++ )
+		{
+			$key   .= substr($char, $i, mt_rand(1,61));	
+		}
+		
+		$key = strlen($key).$key;
+		
+		return $key;
+	}
+	
+}
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/WebService.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/WebService.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/WebService.php	(revision 4453)
@@ -0,0 +1,92 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class WebService
+{
+	function __construct()
+	{
+		require_once("../../../header.session.inc.php");		
+	}
+
+	public final function getPhoto($pUid)
+	{
+		require_once("class.LdapIM.inc.php");
+		
+		$ldap = new LdapIM();
+
+		$uid = $pUid;
+		if( strpos($pUid, "/") )
+			$uid = substr($pUid, 0, strpos($pUid, "/"));
+		
+		$photo = $ldap->getPhotoUser($uid );
+	
+		if( $photo )
+			$photo = imagecreatefromstring($photo);
+		else
+			$photo = imagecreatefrompng("../../templates/default/images/photo.png");
+
+		header("Content-Type: image/jpeg");
+		$width = imagesx($photo);
+		$height = imagesy($photo);
+		$twidth = 60;
+		$theight = 80;
+		$small_photo = imagecreatetruecolor ($twidth, $theight);
+		imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
+		imagejpeg($small_photo,'',100);
+
+		return;
+	}
+	
+	public final function getPhotoSession($pUid, $pOu)
+	{
+		$uid = $pUid;
+		if( strpos($pUid, "@") )
+			$uid = substr($pUid, 0, strpos($pUid, "@"));
+		
+		if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]) )
+		{
+			$photo = imagecreatefromstring($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]);
+
+			header("Content-Type: image/jpeg");
+			$width = imagesx($photo);
+			$height = imagesy($photo);
+			$twidth = 60;
+			$theight = 80;
+			$small_photo = imagecreatetruecolor ($twidth, $theight);
+			imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
+			imagejpeg($small_photo,'',100);
+
+			unset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]);
+
+			return;	
+		}
+	}
+}
+
+// Photo in Session
+if(trim($_REQUEST['photo_session']) != "")
+{
+	$obj	= new WebService();
+	$ou		= $_REQUEST['ou'];
+	$jid	= $_REQUEST['photo_session'];
+	
+	$obj->getPhotoSession($jid, $ou);
+}
+
+// Photo Ldap 
+if(trim($_REQUEST['photo_ldap']))
+{
+	$obj	= new WebService();
+	$jid	= $_REQUEST['photo_ldap'];
+	$obj->getPhoto($jid);
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.ContactsIm.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.ContactsIm.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.ContactsIm.inc.php	(revision 4453)
@@ -0,0 +1,395 @@
+<?php
+
+require_once "class.DataBaseIM.inc.php";
+require_once "class.LdapIM.inc.php";
+
+class ContactsIm
+{
+	private $db;
+	private $dn_User;
+	private $hostsJabberLdap;	
+	private $ldap;
+	private $ou_User;
+	private $serverJabber;
+	private $serverLdap;
+	private $attribute;
+		
+	function __construct()
+	{
+		$this->ldap	= new LdapIM();
+		$this->db	= new DataBaseIM();
+
+		// (DN) User
+		$this->dn_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn'];
+
+		// (OU) User
+		$this->ou_User = $this->dn_User;
+		$this->ou_User = substr($this->ou_User, strpos($this->ou_User, "ou=") );
+		$this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc=")));
+		
+		// Server Name Jabber
+		$this->serverJabber = $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'];
+	
+		// Server Name Ldap
+		$this->serverLdap	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		
+		// Hosts Jabber / Ldap
+		$this->hostsJabberLdap = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);	
+		
+		if ( file_exists('attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
+		else
+			$this->attribute = "uid";
+		
+	}
+
+	public final function getListContacts($param)
+	{
+		$order		= array();
+		$ou_User	= substr($this->ou_User, (strpos($this->ou_User,"=")+1));
+		$return		= "<empty></empty>";
+		$users		= $this->getUsersIm($param['name']);
+		
+		if( count($users) == 0  )
+			return "<empty></empty>";
+		
+		if( $users === "manyresults" )
+		{
+			if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo']) )
+				unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']);
+			
+			return "<manyresults></manyresults>";
+		}
+				
+		// Hosts Jabber
+		$hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);
+		
+		if( is_array($users) )
+		{	
+			for($i = 0; $i < count($users); $i++)				
+			{
+				if( is_array($hostsJabber) )
+				{
+					foreach($hostsJabber as $itens)
+					{
+						if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false )
+						{
+							$users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName'];
+						}
+						
+						if( array_key_exists('ouAll', $users[$i]) && trim($itens['org']) === "*" )
+						{
+							$users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName'];
+						}
+					}
+				}
+
+				if( strpos($users[$i]['jid'],"@") === false )
+				{
+					$users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber;
+				}
+			}
+
+			foreach($users as $tmp)
+			{
+				if ( !array_key_exists($tmp['ou'], $order) )
+					$order[$tmp['ou']] = array();
+
+				$order[$tmp['ou']][] = '<data><ou>'.$tmp['ou'].'</ou><cn>'.$tmp['cn'].'</cn><mail>'.$tmp['mail'].'</mail><uid>'.$tmp['uid'].'</uid><jid>'.$tmp['jid'].'</jid><photo>'.$tmp['photo'].'</photo></data>';
+			}
+			
+			ksort($order);
+				
+			$return	= '<uids>';
+			foreach ( $order as $key => $val )
+				$return .= '<'.$key.'>'.implode('',$val).'</'.$key.'>';
+			$return .= '</uids>';
+		}
+		
+		return $return;
+	}
+
+	private final function getUsersIm($pName)
+	{   
+		$array_uids		= array();
+		$countUids		= 0;
+        $members		= array();
+        $result			= array();
+        $uidType		= $this->attribute;
+		$serversLdap	= unserialize( trim($_SESSION['phpgw_info']['jabberit_messenger']['groups_search']) );
+
+		if( $serversLdap )
+		{
+			// Usa Grupos Ldap
+			$filters = array( );
+			
+			foreach( $serversLdap as $servers => $groups )
+			{
+				$filter = '';
+				foreach( unserialize($groups) as $group )
+					$filter .= '(gidnumber' . strstr( $group, ':' ) . ')';
+
+				$filters[ $servers ] = str_replace( ':', '=', $filter );
+			}
+			
+			foreach( $serversLdap as $key => $tmp )
+			{
+				if( $key === $this->serverLdap )
+				{
+					$result[$key] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*");
+					$countUids += count($result[$key]);
+				}
+				else
+				{
+					if( !$this->groupsLocked() )
+					{
+						$result[$key] =  $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $key );
+						$countUids += count($result[$key]);
+					}
+				}
+			}
+			
+			if( $countUids >  $this->ldap->getMaxResults() )
+			{
+				return "manyresults";
+			}
+			
+			$_RESULT = $this->ldap->getMembers($result, $filters);
+			
+			foreach( $_RESULT as $key => $value )
+				$array_uids = array_merge($array_uids, $_RESULT[$key]);
+ 
+		}
+		else
+		{
+	        // Ldap Root
+	        $result[] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*");
+	       
+			// Ldap Catalog			
+			if( count($this->hostsJabberLdap) )
+			{
+				foreach( $this->hostsJabberLdap as $conf )
+				{
+					$result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $conf['serverLdap'] );
+				}
+			}
+
+	       	foreach( $result as $value )
+	       	{
+				$array_uids = array_merge($array_uids, $value );
+	       	}
+			
+			if( count($array_uids) >  $this->ldap->getMaxResults() )
+			{
+				return "manyresults";
+			}
+		}
+
+		if( $this->groupsLocked() )
+		{
+            $orgs[] 			= substr($this->ou_User, ( strpos($this->ou_User, "ou=") + 3 ) );
+            $orgsGroupsLocked	= explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked']); 
+            
+			foreach( $orgsGroupsLocked as $tmp )
+			{
+				if( $tmp != "")
+					$orgs[] = $tmp;
+			}
+
+            $orgs = array_unique($orgs);
+
+			$_restrict = array();
+			
+			for( $i = 0 ; $i < count($orgs) ; $i++ )
+			{
+				for( $j = 0 ; $j < count($array_uids) ; $j++ )
+				{
+					if( trim($array_uids[$j]['ou']) === trim($orgs[$i]) )
+					{
+						$_restrict[] = $array_uids[$j];
+					}	
+				}	
+			}
+			
+			return $_restrict;
+		}
+		else
+		{	
+			return $array_uids;
+		}	
+	}
+	
+	private final function groupsLocked()
+	{
+		$memberShip = array();
+		$groupsLocked =  explode(";",$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']);
+		
+		foreach($_SESSION['phpgw_info']['jabberit_messenger']['membership'] as $tmp)
+			$memberShip[] = $tmp['account_name'];
+		
+		foreach($groupsLocked as $tmp)
+		{
+			$groups = explode(":", $tmp);
+			
+			if( array_search($groups[1], $memberShip) !== False )
+			{	
+				$_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked'] = $groups[2]; 
+				return true;
+			}
+		}
+		
+		return false;
+	}
+	
+	private final function strallpos($haystack, $needle, $offset = 0)
+	{
+	    $result = array();
+	    for($i = $offset; $i< strlen($haystack); $i++ )
+	    {
+	        $pos = strpos($haystack,$needle,$i);
+	        if($pos !== FALSE)
+	        {
+	            $offset =  $pos;
+	            if($offset >= $i)
+	                $result[] = $i = $offset;
+	        }
+	    }
+    	
+    	return $result;
+	} 
+
+	public final function verifyAddNewContact($pUid)
+	{
+		$groupsLocked	= explode(";",$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']);
+		$gidNumbers		= array();
+		$uid			= $pUid['uid'];
+		$uid_User		= substr($this->dn_User, 0, strpos($this->dn_User, ","));
+		$uid_User		= substr($uid_User, 4);
+		
+		foreach($groupsLocked as $tmp)
+		{
+			$groups = explode(":", $tmp);
+			$gidNumbers[] = $groups[1];
+		}
+
+		$filter_gid = implode(")(gidnumber=",$gidNumbers);
+	    $filter_gid = "(gidnumber=". $filter_gid. ")";
+	
+		$result = $this->ldap->getGroupsMemberUid( $filter_gid, "localhost" );
+
+		if( $result && is_array($result) )
+		{
+			array_shift($result);
+			$i = 0;
+			
+			foreach($result as $value)
+			{
+				$Groups[$i]['dn'] = $value['dn'];
+				$Groups[$i]['gidnumber'] = $value['gidnumber'][0];
+				if(array_key_exists('memberuid',$value))
+				{
+					array_shift($value['memberuid']);
+					$Groups[$i++]['memberuid'] = $value['memberuid'];
+				}
+			}
+
+			$search = array();
+			$search_Gid = array();
+
+			// Verifica Uid em Grupo Bloqueado
+			foreach($Groups as $value)
+			{			
+				if( array_search( $uid , $value['memberuid'] ) !== false )
+				{
+					$ou = substr($value['dn'],strpos($value['dn'], "ou="));
+					if( array_search($uid_User, $value['memberuid']) === false )
+					{
+						$search[] = strtoupper(substr($ou, 0, strpos($ou, ",dc=")));
+						$search_Gid[] = $value['gidnumber'];
+					}
+				}
+			}
+		}
+		
+	
+		if( $this->groupsLocked() )
+		{
+			if( count($search) > 0 )
+			{
+				// Verifica permissões do grupo
+				foreach($groupsLocked as $value)
+				{							
+					$tpGroups = explode(":",$value);
+					if( $tpGroups[1] == $search_Gid[0] )
+					{
+						$ousTp = explode(",",$tpGroups[2]);
+						$ou_User = strtoupper(trim($this->dn_User));
+						
+						$posAll = $this->strallpos($ou_User, "OU=" );
+						$orgs = array();
+				
+						for( $i = 0 ; $i < count($posAll); $i++ )
+						{
+							$pos = strpos($ou_User, ",");
+							$tmpString = substr($ou_User, $posAll[$i] + 3);
+							$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+						}
+				
+						$ou_User = implode("/", array_reverse($orgs));
+
+						if( array_search( $ou_User, $ousTp) !== false )
+							return "true";
+					}
+				}
+				return "false";
+			}
+			else
+				return "true";
+		} 
+		else
+		{		
+			// Se Bloqueado verifica o Grupo	
+			if( count($search) > 0 )
+			{
+				if( array_search($this->ou_User, $search) === false )
+				{
+					// Verifica permissões do grupo
+					foreach($groupsLocked as $value)
+					{							
+						$tpGroups = explode(":",$value);
+						
+						if( $tpGroups[1] == $search_Gid[0] )
+						{
+							$ousTp = explode(",",$tpGroups[2]);
+							$ou_User = strtoupper(trim($this->dn_User));
+					
+							$posAll = $this->strallpos($ou_User, "OU=" );
+							$orgs = array();
+					
+							for( $i = 0 ; $i < count($posAll); $i++ )
+							{
+								$pos = strpos($ou_User, ",");
+								$tmpString = substr($ou_User, $posAll[$i] + 3);
+								$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+							}
+					
+							$ou_User = implode("/", array_reverse($orgs));
+							
+							if( array_search( $ou_User, $ousTp) !== false )
+								return "true";
+						}
+					}
+					return "false";
+				}
+				return "true";
+			}					
+			return "true";
+		}
+	}
+
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_sessions.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_sessions.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/jabberit_sessions.inc.php	(revision 4453)
@@ -0,0 +1,76 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+		$attributeLdap = PHPGW_SERVER_ROOT . '/jmessenger/inc/attributeLdap.php';
+
+		//User
+		$_SESSION['phpgw_info']['jabberit_messenger']['user_jabber'] = $GLOBALS['phpgw_info']['user']['account_lid'];
+		if ( file_exists($attributeLdap) )	
+		{
+			require_once($attributeLdap);
+			if( trim($attributeTypeName) == 'description' )
+			{
+				$description = explode("@", $GLOBALS['phpgw_info']['user']['email']);
+        		$_SESSION['phpgw_info']['jabberit_messenger']['user_jabber'] = $description[0];
+			}
+		}
+
+		$_SESSION['phpgw_info']['jabberit_messenger']['user_id']		= $GLOBALS['phpgw_info']['user']['account_id'];		
+        $_SESSION['phpgw_info']['jabberit_messenger']['passwd']			= $GLOBALS['phpgw_info']['user']['passwd'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['mail']			= $GLOBALS['phpgw_info']['user']['email'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['fullname']		= $GLOBALS['phpgw_info']['user']['fullname'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['account_dn']		= $GLOBALS['phpgw_info']['user']['account_dn'];
+
+		// User Lang 
+		$_SESSION['phpgw_info']['jabberit_messenger']['applet_lang']	= $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+
+		//Members Group
+		$_SESSION['phpgw_info']['jabberit_messenger']['membership']		= $GLOBALS['phpgw']->accounts->membership();
+
+		//Groups Locked
+		$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']	= $GLOBALS['phpgw_info']['server']['groups_locked_jabberit'];
+
+		//Groups Search Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['groups_search']	= $GLOBALS['phpgw_info']['server']['groups_search_jabberit'];
+
+		//Server http or https 
+		$_SESSION['phpgw_info']['jabberit_messenger']['use_https']		= $GLOBALS['phpgw_info']['server']['use_https'];
+
+		//Organization Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['account_dn']		= $GLOBALS['phpgw_info']['user']['account_dn'];
+
+		//Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit']   = $GLOBALS['phpgw_info']['server']['server_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit']  = $GLOBALS['phpgw_info']['server']['context_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit']     = $GLOBALS['phpgw_info']['server']['user_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['password_ldap_jabberit'];
+        
+        //DB
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name']	 = $GLOBALS['phpgw_info']['server']['db_name'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host']	 = $GLOBALS['phpgw_info']['server']['db_host'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port']	 = $GLOBALS['phpgw_info']['server']['db_port'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user']	 = $GLOBALS['phpgw_info']['server']['db_user'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass']	 = $GLOBALS['phpgw_info']['server']['db_pass'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'] 	 = $GLOBALS['phpgw_info']['server']['db_type'];
+
+		//Jabberd
+        $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']					= $GLOBALS['phpgw_info']['server']['name_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['ip_server_jabberit']				= $GLOBALS['phpgw_info']['server']['ip_server_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['port_1_jabberit']				= $GLOBALS['phpgw_info']['server']['port_1_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['port_2_jabberit']				= $GLOBALS['phpgw_info']['server']['port_2_jabberit'];        
+        $_SESSION['phpgw_info']['jabberit_messenger']['resource_jabberit']				= $GLOBALS['phpgw_info']['server']['resource_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['group_chat_jabberit']			= $GLOBALS['phpgw_info']['server']['group_chat_server_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['name_company']					= $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit']			= $GLOBALS['phpgw_info']['server']['use_attribute_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']			= $GLOBALS['phpgw_info']['server']['map_org_realm_jabberit'];
+		
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferences.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferences.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferences.php	(revision 4453)
@@ -0,0 +1,36 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+											'currentapp' => 'jabberit_messenger',
+											'noheader'   => True, 
+											'nonavbar'   => True
+											);
+	if( is_dir('../phpgwapi/inc') )
+		require_once("../header.inc.php");
+	else
+		require_once("../../header.inc.php");			
+
+	function setPreferences($pArgs)
+	{
+		if( $GLOBALS['phpgw_info']['user']['preferences']['jabberit_messenger']['preferences'] )
+			$GLOBALS['phpgw']->preferences->change('jabberit_messenger','preferences',$pArgs);
+		else
+			$GLOBALS['phpgw']->preferences->add('jabberit_messenger','preferences',$pArgs);
+
+		if ( $GLOBALS['phpgw']->preferences->save_repository() )
+			return "true";
+		else
+			return "false";
+	}	
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php	(revision 4453)
@@ -0,0 +1,554 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+if( is_dir('../../phpgwapi/inc') )
+	define('PHPGW_API_INC','../../phpgwapi/inc');
+else
+	define('PHPGW_API_INC','../../../phpgwapi/inc');
+
+require_once( PHPGW_API_INC . '/class.common.inc.php');
+
+class LdapIM
+{
+	private $attribute;
+	private $common;
+	private $hostsJabber;
+	private $ldap;
+	private $ldap_context;
+	private $ldap_user;
+	private $ldap_host;
+	private $ldap_org;
+	private $ldap_pass;
+	private $max_result;
+	
+	public final function __construct()
+	{
+		$this->ldap_host 	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		$this->ldap_context	= $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];
+		$this->ldap_user	= $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];
+		$this->ldap_pass	= $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];
+
+		// Hosts Jabber
+		$this->hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);
+		
+		// Result Ldap
+		$this->max_result = 15;
+		
+		if ( file_exists('inc/attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
+		else
+			$this->attribute = "uid";
+	}
+
+	public final function __destruct()
+	{
+		if( $this->ldap )
+			@ldap_close($this->ldap);
+	}	
+
+	private final function ldapConn()
+	{
+		$this->common = new common();		
+		
+		$GLOBALS['phpgw_info']['server']['ldap_version3'] = true;
+		
+		if( $this->ldap_user && $this->ldap_pass )
+			$this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_user . "," . $this->ldap_context , $this->ldap_pass, false );
+		else
+			$this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_context , "", false );
+	}
+	
+	private final function ldapRoot()
+	{
+		$this->ldap_host 	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		$this->ldap_context	= $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];
+		$this->ldap_user	= $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];
+		$this->ldap_pass	= $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];
+
+		$this->ldapConn();
+	}
+
+	private final function ldapCatalog()
+	{
+		$version3 = true;
+		$refer	= true;
+
+		if(!function_exists('ldap_connect'))
+			return false;
+		
+		if(!$conn = ldap_connect($this->ldap_host))
+			return false;
+
+		if( $version3 )
+			if( !ldap_set_option($conn,LDAP_OPT_PROTOCOL_VERSION,3) )
+				$version3 = false;
+
+		ldap_set_option($conn, LDAP_OPT_REFERRALS, $refer);
+
+		// Bind as Admin
+		if($this->ldap_user && $this->ldap_pass && !ldap_bind($conn, $this->ldap_user . "," .$this->ldap_context, $this->ldap_pass))
+			return false;
+		
+		// Bind as Anonymous
+		if(!$this->ldap_user && !$this->ldap_pass && !@ldap_bind($conn))
+			return false;
+
+		return $conn;
+	}
+	
+	private function getLdapHost()
+	{
+		return	$_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+	}
+
+	public final function getGroupsLdap($pData)
+	{
+		$result_groups = "";
+		
+		if( $pData['serverLdap'] == $this->ldap_host || $pData['serverLdap'] == 'localhost' )
+		{
+			$this->ldapRoot();
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+			
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $pData['serverLdap'] == $confHosts[$i]['serverLdap'] )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+				
+					$this->ldap = $this->ldapCatalog();
+				}
+			}
+		}		
+
+		if( $this->ldap )	
+		{
+			if( !$pData['search'] && $pData['ou'] != "-1" )
+			{
+				$filter = "(&(phpgwAccountType=g)(objectClass=posixGroup))";
+				$justthese = array("cn","gidNumber");
+				$search = ldap_list( $this->ldap, $pData['ou'] , $filter, $justthese );
+				$entry = ldap_get_entries( $this->ldap, $search );
+			}
+			
+			if( $pData['search'] )
+			{
+				$filter = "(&(phpgwAccountType=g)(&(objectClass=posixGroup)(cn=".$pData['search']."*)))";
+				$justthese = array("cn","gidNumber");
+				$search = ldap_search( $this->ldap, $this->ldap_context , $filter, $justthese );
+				$entry = ldap_get_entries( $this->ldap, $search );
+			}
+			
+			if( $entry && $entry['count'] > 0 )
+			{					
+				array_shift($entry);
+
+				foreach($entry as $tmp)
+					$groups[] = $tmp['cn'][0]."/".$tmp['gidnumber'][0];
+				
+				natsort($groups);
+				
+				$result_groups = "<ldap>";
+				foreach($groups as $gtmp)
+				{
+					$tmp = explode("/",$gtmp);	
+					$result_groups .= "<org><cn>".$tmp[0]."</cn><gid>".$tmp[1]."</gid></org>";
+				}
+				$result_groups .= "</ldap>";
+			}
+		}
+
+		return $result_groups;
+	}
+
+	public final function getMaxResults()
+	{
+		return $this->max_result;
+	}
+
+	public final function getMembers( $pMembers, $pServers )
+	{
+		$members = $pMembers;
+		
+		foreach( $pServers as $servers => $groups )
+		{
+			if( $servers == $this->getLdapHost() || $servers == 'localhost')
+			{
+				$this->ldapRoot();
+				
+				$count = count($members[$servers]);
+				
+				for( $i = 0; $i < $count; $i++ )
+				{
+					if ( ! $this->getMemberUid($groups, $members[$servers][$i]['uid'] ) )
+						unset( $members[$servers][$i] );
+				}
+
+				if( $this->ldap )
+					@ldap_close($this->ldap);
+			}
+			else
+			{
+				$confHosts	= $this->hostsJabber;
+			
+				for($i = 0; $i < count($confHosts); $i++ )
+				{
+					if( $this->ldap )
+						@ldap_close($this->ldap);
+						
+					if( trim($servers) === trim($confHosts[$i]['serverLdap']) )
+					{
+						$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+						$this->ldap_context = $confHosts[$i]['contextLdap'];
+						$this->ldap_user	= $confHosts[$i]['user'];
+						$this->ldap_org		= $confHosts[$i]['org'];
+						$this->ldap_pass	= $confHosts[$i]['password'];
+						$this->ldap 		= $this->ldapCatalog();
+
+						$count = count($members[$servers]);
+						
+						for( $i = 0; $i < $count; $i++ )
+						{
+							if ( ! $this->getMemberUid($groups, $members[$servers][$i]['uid'] ) )
+								unset( $members[$servers][$i] );
+						}
+		
+						if( $this->ldap )
+							@ldap_close($this->ldap);
+					}
+				}
+			}
+		}
+		
+		return $members;
+	}
+
+	private function getMemberUid( $pGidNumber, $pMemberUid )
+	{
+		$filter		= "(&(phpgwAccountType=g)(|{$pGidNumber})(memberuid={$pMemberUid}))";
+		$justthese	= array("memberuid");
+	
+		if( $this->ldap )
+		{
+			$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese );
+			$result = ldap_get_entries($this->ldap,$search);
+			if( $result["count"] )
+				return true;
+		}
+
+		return false;
+	}
+
+	public final function getGroupsMemberUid( $pGroup, $pLdap )
+	{
+		if( $pLdap == $this->ldap_host || $pLdap == 'localhost' )
+		{
+			$this->ldapRoot();
+			
+			if( $this->ldap )
+			{
+				$filter = "(&(objectclass=posixgroup)(|".$pGroup."))";
+				if( strpos($pGroup, "gidnumber") === false )
+					$filter = "(&(objectclass=posixgroup)(cn=".$pGroup."))";
+					
+				$justthese = array("dn","memberuid","gidnumber");
+				$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese);
+				$result = ldap_get_entries($this->ldap,$search);
+			}
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+		
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $this->ldap )
+					@ldap_close($this->ldap);
+					
+				if( trim($pLdap) === trim($confHosts[$i]['serverLdap']) )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+					$this->ldap = $this->ldapCatalog();
+					
+					if( $this->ldap )
+					{
+						$filter = "(&(objectclass=posixgroup)(cn=".$pGroup."))";
+						$justthese = array("dn","memberuid","gidnumber");
+						$search = ldap_search($this->ldap,$this->ldap_context,$filter, $justthese);
+						$result = ldap_get_entries($this->ldap,$search);
+					}
+					
+				}
+			}
+		}
+
+		if( $result['count'] > 0 )
+			return $result;
+
+		return false;
+	}
+
+	public final function getOrganizationsLdap($pLdap_host)
+	{
+
+		if( $pLdap_host == $this->ldap_host || $pLdap_host == 'localhost' )
+		{
+			$this->ldapRoot();
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+			
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $pLdap_host == $confHosts[$i]['serverLdap'] )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+				
+					$this->ldap = $this->ldapCatalog();
+				}
+			}
+		}
+		
+		if( $this->ldap )
+		{
+			$filter = "(objectClass=organizationalUnit)";
+			$justthese = array("dn");
+			$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese);
+			$info = ldap_get_entries($this->ldap, $search);
+		
+			for ($i=0; $i<$info["count"]; $i++)
+			{
+				$a_sectors[] = $info[$i]['dn'];
+			}	
+		}
+
+		// Retiro o count do array info e inverto o array para ordenação.
+		foreach ($a_sectors as $context)
+		{
+			$array_dn = ldap_explode_dn ( $context, 1 );
+			$array_dn_reverse  = array_reverse ( $array_dn, true );
+			array_pop ( $array_dn_reverse );
+			$inverted_dn[$context] = implode ( "#", $array_dn_reverse );
+		}
+		
+		// Ordenação
+		natcasesort($inverted_dn);
+
+		foreach ( $inverted_dn as $dn=>$invert_ufn )
+		{
+            $display = '';
+
+            $array_dn_reverse = explode ( "#", $invert_ufn );
+            $array_dn  = array_reverse ( $array_dn_reverse, true );
+
+            $level = count( $array_dn ) - (int)(count(explode(",", $this->ldap_context)) + 1);
+
+            if ($level == 0)
+                    $display .= '+';
+            else 
+            {
+				for( $i = 0; $i < $level; $i++)
+					$display .= '---';
+            }
+
+            reset ( $array_dn );
+            $display .= ' ' . (current ( $array_dn ) );
+			
+			$dn = trim(strtolower($dn));
+			$options[$dn] = $display;
+    	}
+
+	    return $options;
+
+	}
+
+	public final function getPhotoUser( $_uid )
+	{
+		$uid 	= substr($_uid, 0, strpos($_uid, "@"));
+		$host	= substr($_uid, (strpos($_uid, "@") + 1));
+		
+		if( count($this->hostsJabber) )
+		{
+			$confHosts	= $this->hostsJabber;	
+
+			for( $i = 0; $i < count($confHosts); $i++ )
+			{
+				if( trim($host) === trim($confHosts[$i]['jabberName']) )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+					$this->ldap 		= $this->ldapCatalog();
+				}
+			}
+			
+			if( !$this->ldap )
+				$this->ldapRoot();								
+		}
+		else
+		{
+			$this->ldapRoot();
+		}
+
+		if( $this->ldap )
+		{
+			$filter     = "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid."))";
+			$justthese	= array($this->attribute, "uidNumber", "phpgwAccontVisible", "dn", "jpegPhoto");
+			$search		= ldap_search( $this->ldap, $this->ldap_context, $filter, $justthese, 0, $this->max_result + 1);
+			$entry		= ldap_get_entries( $this->ldap, $search );
+			
+			for( $i = 0 ; $i < $entry['count']; $i++ )
+			{
+				if( $entry[$i]['jpegphoto'][0] && $entry[$i]['phpgwaccountvisible'][0] != '-1' )
+				{
+					$filterPhoto	= "(objectclass=*)";
+					$photoLdap		= ldap_read($this->ldap, $entry[$i]['dn'], $filterPhoto, array("jpegPhoto"));
+					$firstEntry 	= ldap_first_entry($this->ldap, $photoLdap);
+					$photo			= ldap_get_values_len($this->ldap, $firstEntry, "jpegPhoto");
+
+					if( $this->ldap )
+						ldap_close($this->ldap);
+
+					return $photo[0];		
+				}
+			}
+		}
+
+		return false;
+	}
+
+	public final function getUsersLdapCatalog( $search, $pLdap = false, $uid = false )
+	{
+		$confHosts	= $this->hostsJabber;
+		$result = array();
+		$return	= array();
+		$conn	= "";		
+
+		for( $i = 0; $i < count($confHosts); $i++ )
+		{
+			if( $pLdap && $pLdap == $confHosts[$i]['serverLdap'] )
+			{
+				$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+				$this->ldap_context = $confHosts[$i]['contextLdap'];
+				$this->ldap_user	= $confHosts[$i]['user'];
+				$this->ldap_org		= $confHosts[$i]['org'];
+				$this->ldap_pass	= $confHosts[$i]['password'];
+				$this->ldap 		= $this->ldapCatalog();
+
+				if( $this->ldap )
+				{
+					$filter 	= ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))";
+					$justthese	= array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" );								
+					$searchRoot	= ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context;
+					$search1	= @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
+					$entry1		= @ldap_get_entries( $this->ldap, $search1 );
+					$result 	= $this->resultArray( $entry1, $this->ldap, $this->ldap_org );
+	
+					if( count($return) > 0 )
+			          	$return = array_merge($return, $result);
+					else
+						$return = $result;
+				}
+				
+				if( $this->ldap )
+					ldap_close($this->ldap);
+			}
+		}
+		
+		return $return;
+	}
+
+	public final function getUsersLdapRoot( $search, $uidnumber = false, $ous = false )
+	{
+		
+		$result = array();
+		$this->ldapRoot();
+
+		if( $this->ldap )
+		{
+			$searchRoot	= ( $ous ) ? $ous.",".$this->ldap_context : $this->ldap_context ;
+			$filter		= ($uidnumber) ? "(&(phpgwaccounttype=u)(|".$uidnumber.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))";
+			$justthese	= array( $this->attribute, "uidNumber", "cn", "mail", "phpgwAccountVisible", "dn", "jpegPhoto" );								
+			$search		= @ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
+			$entry		= @ldap_get_entries( $this->ldap, $search );
+			$result		= $this->resultArray( $entry, $this->ldap );
+		}		
+
+		return $result;
+	}
+	
+	private final function resultArray($pArray, $pConn, $pOrg = false)
+	{
+		$entry	= $pArray;
+		$result	= array();
+		$j		= 0;
+		
+		for( $i = 0 ; $i < $entry['count']; $i++ )
+		{
+			if ( $entry[$i]['phpgwaccountvisible'][0] != '-1' )
+			{
+				$result[$j]['uidnumber']	= $entry[$i]['uidnumber'][0];			
+				$result[$j]['mail']			= $entry[$i]['mail'][0];
+				$result[$j]['uid']			= $entry[$i][$this->attribute][0];
+				$result[$j]['jid']			= $entry[$i][$this->attribute][0];
+				
+				$ou = explode("dc=", $entry[$i]['dn']);
+				$ou = explode("ou=",$ou[0]);
+				$ou = array_pop($ou);
+				$result[$j]['ou']	= strtoupper(substr($ou,0,strlen($ou)-1));
+				
+				if( $pOrg === "*" )
+					$result[$j]['ouAll'] = "*";
+										
+				if( $entry[$i]['jpegphoto'][0] )
+				{
+					$result[$j]['photo'] = "1";
+					$filterPhoto = "(objectclass=*)";
+					$photoLdap = ldap_read($pConn, $entry[$i]['dn'], $filterPhoto, array("jpegPhoto"));
+					$firstEntry = ldap_first_entry($pConn, $photoLdap);
+					$photo = ldap_get_values_len($pConn, $firstEntry, "jpegPhoto");
+					$_SESSION['phpgw_info']['jabberit_messenger']['photo'][trim($result[$j]['ou'])][trim($result[$j]['uid'])] = $photo[0];
+				}
+				else
+					$result[$j]['photo'] = "0";
+
+				$result[$j++]['cn']	= $entry[$i]['cn'][0];
+			}
+		
+			$organization = $this->attr_org;
+		}
+		
+		return $result;
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/attributeLdap.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/attributeLdap.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/attributeLdap.php	(revision 4453)
@@ -0,0 +1,15 @@
+<?php
+ 
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+  
+	$attributeTypeName = "uid";
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferencesJMessenger.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferencesJMessenger.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/preferencesJMessenger.php	(revision 4453)
@@ -0,0 +1,33 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class preferencesJMessenger
+{
+	public function setPreferences($pArgs)
+	{
+		require_once "preferences.php";
+		
+		$preferences = $pArgs['preferences1'];
+		
+		if(isset($pArgs['preferences2']))
+			$preferences .= ";". $pArgs['preferences2'];
+		
+		if(isset($pArgs['preferences3']))
+			$preferences .= ";". $pArgs['preferences3'];
+
+		if(isset($pArgs['preferences4']))
+			$preferences .= ";". $pArgs['preferences4'];
+
+		return setPreferences($preferences);
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.DataBaseIM.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.DataBaseIM.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/class.DataBaseIM.inc.php	(revision 4453)
@@ -0,0 +1,720 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+define('PHPGW_INCLUDE_ROOT','../../');	
+define('PHPGW_API_INC','../../phpgwapi/inc');
+require_once(PHPGW_API_INC . '/class.db.inc.php');
+//require_once "class.fileDefine.inc.php";
+	
+class DataBaseIM
+{	
+	private $db;
+	private $db_name;
+	private $db_host;
+	private $db_port;
+	private $db_user;
+	private $db_pass;
+	private $db_type;
+	private $user_id;
+	private $fileD;
+	
+	public final function __construct()
+	{
+		//$this->fileD = new fileDefine();
+		$this->db_name = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name'];
+		$this->db_host = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host'];
+		$this->db_port = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port'];
+		$this->db_user = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user'];
+		$this->db_pass = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass'];
+		$this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'];
+		$this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id'];		
+		$this->connectDB();
+	}
+
+	private final function connectDB()
+	{
+		$this->db = new db();
+		$this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name;
+		$this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host;
+		$this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port;
+		$this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user;
+		$this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass;
+		$this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type;
+		
+		$this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);		
+	}	
+
+	public final function editHostJabber($pItem)
+	{
+		$hostsJabber = unserialize($this->getHostsJabber());
+		$findHosts	= explode(":", $pItem['item']);
+		$return = "";	
+		
+		for( $i = 0 ; $i < count($hostsJabber); $i++ )
+			if( $hostsJabber[$i]['org'] == $findHosts[0] && $hostsJabber[$i]['jabberName'] == $findHosts[1] )
+			{
+				$return = "org:" . $hostsJabber[$i]['org'] . ";" .
+						  "jabberName:" . $hostsJabber[$i]['jabberName'] . ";" .						  	 
+						  "serverLdap:" . $hostsJabber[$i]['serverLdap'] . ";" .
+						  "contextLdap:" . $hostsJabber[$i]['contextLdap'] . ";" .
+						  "user:" . $hostsJabber[$i]['user'] . ";" .
+						  "password:" . $hostsJabber[$i]['password'] ;						  						  						  						  
+			}
+
+		return trim($return);
+	}
+	
+	public final function getApplicationsEnabled()
+	{
+		
+		$this->db->query("SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'");
+		if($this->db->num_rows())
+		{
+			$tmp = "";
+			while($this->db->next_record())
+			{
+				$tmp[]= $this->db->row();
+			}
+			return $tmp[0]['config_value'];
+		}
+		return false;
+	}
+	
+	public final function getApplicationsList()
+	{
+		$this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled = '1' order by app_name");
+		if($this->db->num_rows())
+		{
+			while ($this->db->next_record())
+			{
+				$app = $this->db->f('app_name');
+				$title = @$GLOBALS['phpgw_info']['apps'][$app]['title'];
+				if (empty($title))
+				{
+					$title = lang($app) == $app.'*' ? $app : lang($app);
+				}
+				$apps[$app] = array(
+					'title'  => $title,
+					'name'   => $app,
+					'status' => $this->db->f('app_enabled')
+				);
+			}
+		}
+		return $apps;
+	}
+
+	public final function get_accounts_acl()
+	{
+		$query  = "SELECT acl_account FROM phpgw_acl WHERE acl_location IN (SELECT CAST(acl_account AS varchar) FROM phpgw_acl WHERE acl_appname = 'jabberit_messenger') ";
+		$query .= "UNION SELECT acl_account FROM phpgw_acl WHERE acl_appname = 'jabberit_messenger'";
+		
+		if( $this->db->query($query) )	
+		{
+			$users = array();
+			$new_users = array();
+			while($this->db->next_record())
+				$users[] = $this->db->row();
+
+			if(is_array($users))
+				foreach($users as $tmp)
+					$new_users[] = $tmp['acl_account'];
+			
+			return $new_users;
+		}
+		
+		return false;
+	}
+	
+	public final function getGroupsBlocked()
+	{
+		$return = "";
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+				
+				if( count($result) > 0 )
+					$return = $result[0]['config_value'];
+			}
+		}
+		
+		return $return;
+	}
+	
+	public final function getGroupsSearch()
+	{
+		$return = "";
+	
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+			
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+
+			if( count($result) > 0 )
+				$return = $result[0]['config_value'];
+		}
+		
+		return $return;
+	}
+	
+	public final function getHostsJabber()
+	{
+		$return = "";
+	
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+			
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+
+			if( count($result) > 0 )
+				$return = $result[0]['config_value'];
+		}
+		
+		return $return;
+	}
+	
+	public final function getPreferences()
+	{
+		$result = array();
+		$query = "SELECT * FROM phpgw_preferences WHERE preference_owner = '".$this->user_id."' AND preference_app = 'jabberit_messenger'";
+		
+ 		if ( $this->db->query($query) )
+		{	
+			while($this->db->next_record())
+				$result[] = $this->db->row();
+	
+			if( count($result) > 0 )
+			{
+				$_return = unserialize($result[0]['preference_value']);
+				
+				if( is_array($_return) )
+					return $_return['preferences'];
+				else
+					return $_return;
+			}
+		}
+
+		return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5";
+	}
+
+	public final function setApplications($pApplications)
+	{
+		$apps = serialize($pApplications);
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'";
+				
+			$this->db->query($query);
+					
+			if(!$this->db->next_record())
+			{
+				$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','apps_jabberit','".$apps."')";
+				$this->db->query($query);
+				return true;
+			}
+			else
+			{
+				$query = "UPDATE phpgw_config SET config_value = '".$apps."' WHERE config_app = 'phpgwapi' AND config_name = 'apps_jabberit'";
+				$this->db->query($query);
+				return true;
+			}
+		}
+		return false;	
+	}
+	
+	public final function setAttributesLdap($pAttributes)
+	{
+		$values = $pAttributes['conf'];
+		$attributesOrg = "";		
+
+		if( $this->db )
+		{
+			$query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
+
+			if ( $this->db->query($query) )
+			{	
+				while($this->db->next_record())
+					$result[] = $this->db->row();
+		
+				if(count($result) > 0)
+					$attributesOrg = $result[0]['config_value'];
+			}
+
+			if( trim($attributesOrg) == "" )
+			{
+				$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')";
+				$this->db->query($query);
+				
+				$attr = explode(";", $values);
+				$values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>";
+				return $values;
+			}
+			else
+			{
+				$org = explode(",", $attributesOrg);
+				$newValue = explode(";", $values);
+				
+				foreach( $org as $tmp )
+				{
+					$attr = explode(";",$tmp);
+					if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) )
+						return false;
+				}
+
+				$values = $values . "," . $attributesOrg;
+				$query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
+				$this->db->query($query);
+
+				$return = explode(",",$values);
+				natcasesort($return);
+
+				$values = "<return>";
+				
+				foreach($return as $tmp)
+				{
+					$attr = explode(";", $tmp);
+					$values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>";
+				}
+					
+				$values .= "</return>";
+				
+				return $values;				
+			}
+		}
+		return false; 
+	}
+
+	public final function setAddGroupsSearch($pData)
+	{
+		if( $pData)
+		{
+			if( $this->db )
+			{
+				$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND  config_name = 'groups_search_jabberit';";
+				
+				if( $this->db->query($query) )
+				{
+					while( $this->db->next_record())
+						$result[] = $this->db->row();				
+				}
+				
+				if( count($result) == 0 )
+				{
+					$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_search_jabberit','".serialize($pData)."');";
+					$this->db->query($query);
+					return true;
+				}
+				else
+				{
+					$keyLdap = array_keys($pData);
+					$resultQuery = unserialize($result[0]['config_value']);					
+					
+					if( is_array(unserialize($pData[$keyLdap[0]])) )
+						$resultQuery[$keyLdap[0]] = $pData[$keyLdap[0]];
+					else
+						unset($resultQuery[$keyLdap[0]]);
+
+					if( count($resultQuery))
+						$query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+					else
+						$query = "DELETE FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+						
+					$this->db->query($query);
+					return true;
+				}
+			}			
+		}
+	}
+
+	public final function setGroupsLocked($pGroups)
+	{
+		$groups = "";
+		
+		if( is_array($pGroups) )
+		{
+			foreach($pGroups as $tmp)		
+				if(trim($tmp) != "")
+					$groups .= $tmp . ";";
+		
+			$groups = substr($groups, 0, strlen($groups) - 1 );		
+		}
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				if( count($result) == 0 )
+				{
+					$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_locked_jabberit','".$groups."');";
+					$this->db->query($query);
+					return true;
+				}
+				else
+				{
+					$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+					$this->db->query($query);
+					return true;
+				}
+			}
+		}
+		
+		return false;
+	}
+	
+	public final function setHostJabber($pParam)
+	{
+		$confHostsJabber =  array();
+
+		foreach($pParam as $key => $itens)
+			$confHostsJabber[$key] = ( $key === 'org' ) ? strtoupper($itens) : $itens;
+
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+			
+			if( $this->db->query($query) )
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+			
+			if( count($result) == 0 )
+			{
+				$return = "<return><confServer ou='".strtoupper($confHostsJabber['org'])."' serverName='".$confHostsJabber['jabberName']."'>".strtoupper($confHostsJabber['org']).":".$confHostsJabber['jabberName']."</confServer></return>";				
+				$hostsJabber[0] = $confHostsJabber;
+				
+				$this->fileD->ldapExternal($hostsJabber);
+				 
+				$query = "INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES('phpgwapi','map_org_realm_jabberit','".serialize($hostsJabber)."')";
+				$this->db->query($query);				
+			}
+			else
+			{
+				$resultQuery = unserialize($result[0]['config_value']);	
+				$foundOrg = false;
+				
+				foreach($resultQuery as $key => $itens)
+				{
+					$foundString = array_search($confHostsJabber['org'], $itens);
+					if( $foundString )
+					{
+						$foundOrg = $foundString;
+						$ky = $key;
+					}
+				}	
+
+				if( ! $foundOrg )
+					$resultQuery[] = $confHostsJabber;	
+				else
+					$resultQuery[$ky] = $confHostsJabber;
+
+				$return = "<return>";
+				
+				foreach( $resultQuery as $itens )
+					$return .= "<confServer ou='".$itens['org']."' serverName='".$itens['jabberName']."'>".$itens['org'].":".$itens['jabberName']."</confServer>";
+				
+				$return .= "</return>";
+				
+				$this->fileD->ldapExternal($resultQuery);
+				
+				$query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_name = 'map_org_realm_jabberit';";
+				$this->db->query($query);
+			}
+			return $return;
+		}	
+		return false;
+	}
+	
+	public final function setOuGroupsLocked($pGroup)
+	{
+		
+		function strallpos($haystack, $needle, $offset = 0)
+		{
+		    $result = array();
+		    for($i = $offset; $i< strlen($haystack); $i++ )
+		    {
+		        $pos = strpos($haystack,$needle,$i);
+		        if($pos !== FALSE)
+		        {
+		            $offset =  $pos;
+		            if($offset >= $i)
+		                $result[] = $i = $offset;
+		        }
+		    }
+	    	
+	    	return $result;
+		} 
+
+		$group = $pGroup['group'];
+		$gidnumber = $pGroup['gidnumber'];
+		$organization = strtoupper(trim($pGroup['ou']));
+
+		$posAll = strallpos($organization, "OU=" );
+		$orgs = array();
+
+		for( $i = 0 ; $i < count($posAll); $i++ )
+		{
+			$pos = strpos($organization, ",");
+			$tmpString = substr($organization, $posAll[$i] + 3);
+			$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+		}
+
+		$organization = implode("/", array_reverse($orgs));
+
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				$groupsLocked = explode(";",$result[0]['config_value']);
+					
+				foreach( $groupsLocked as $tmp )
+				{
+					$aux = explode(":", $tmp);
+					if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
+					{
+						if( $aux[2] )
+						{
+							$ou_groups = explode(",",$aux[2]);
+							natcasesort($ou_groups);
+							$key = array_search($organization, $ou_groups);
+							
+							if( $key === false )
+								array_push($ou_groups, $organization);
+							
+							$groups .= $group.":".$gidnumber.":";
+							
+							$return = "<return>";						
+							
+							foreach($ou_groups as $tmp)
+							{
+								$return .= "<ou attr='".$tmp."'>".$tmp."</ou>";
+								$groups .= $tmp .",";	
+							}
+							
+							$return .= "</return>";
+							
+							$groups  = substr($groups,0,strlen($groups)-1);
+							$groups .= ";";
+						}
+						else
+						{
+							$groups .= $group.":".$gidnumber.":".$organization.";";
+							$return = "<return><ou attr='".$organization."'>".$organization."</ou></return>";
+						}
+					}
+					else
+						$groups .= $tmp . ";" ;
+				}
+
+				$groups = substr($groups,0,strlen($groups)-1);
+
+				$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+				$this->db->query($query);
+				
+				return $return;
+			}
+		}
+		
+		return false;
+	}
+	
+	public final function removeAttributesLdap($pOrg)
+	{
+		$organization = $pOrg['org'];
+		
+		if( $this->db )
+		{
+			$query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
+				
+			if ( $this->db->query($query) )
+			{	
+				while( $this->db->next_record() )
+					$result[] = $this->db->row();
+		
+				if( count($result) > 0 )
+					$attributesOrg = $result[0]['config_value'];
+			}
+
+			$attributesOrg = explode(",", $attributesOrg);
+			$newValue = ""; 
+			foreach($attributesOrg as $tmp)
+			{
+				$attr = explode(";",$tmp);
+				 
+				if( strtolower(trim($attr[0])) != strtolower(trim($organization)))
+				{
+					$newValue .= $attr[0] . ";" . $attr[1] . ",";
+				}
+			}
+			
+			$newValue = substr($newValue, 0,(strlen($newValue) -1 ));
+			
+			if( trim($newValue) != "")
+				$query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
+			else
+				$query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'";
+				
+			if( $this->db->query($query))
+				return true;
+			else
+				return false;
+		}
+		return false;	
+	}
+
+	public final function removeHostsJabber($pItem)
+	{
+		$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+
+		if( $this->db )
+		{
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();
+					
+				if( count($result) > 0 )
+				{
+					$confHostsOrgs = unserialize($result[0]['config_value']);
+					$hosts = explode(":", $pItem['item']);
+					$key = "";
+
+					if( count($confHostsOrgs) > 0 )
+					{
+						for( $i = 0; $i < count($confHostsOrgs); $i++)
+							if( $confHostsOrgs[$i]['org'] == $hosts[0] && $confHostsOrgs[$i]['jabberName'] == $hosts[1])
+								$key = $i;	
+
+						array_splice($confHostsOrgs, $key, 1);
+				
+						if(count($confHostsOrgs) > 0)
+						{					
+							$this->fileD->ldapExternal($confHostsOrgs);
+							$query = "UPDATE phpgw_config SET config_value = '".serialize($confHostsOrgs)."' WHERE config_name = 'map_org_realm_jabberit';";
+						}
+						else
+						{
+							$this->fileD->ldapExternal("");
+							$query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
+						}
+					}
+					else
+					{	
+						$this->fileD->ldapExternal("");						
+						$query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
+					}
+
+					if( $this->db->query($query) )
+						return "true";
+				}		
+			}			
+		}
+		return "false";
+	}
+
+	public final function removeOuGroupsLocked($pGroup)
+	{
+		$group = $pGroup['group'];
+		$gidnumber = $pGroup['gidnumber'];
+		$organization = strtoupper($pGroup['ou']);
+		$return = false;
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				$groupsLocked = explode(";",$result[0]['config_value']);
+				
+				foreach( $groupsLocked as $tmp )
+				{
+					$aux = explode(":",$tmp);
+					
+					if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
+					{
+						$ous = explode(",", $aux[2]);
+						$key = array_search($organization, $ous);
+
+						if( $key !== false )
+							unset($ous[$key]);
+
+						$groups .= $group.":".$gidnumber.":";
+						
+						foreach($ous as $ouTmp)
+							$groups .= $ouTmp .",";	
+						
+						$groups  = substr($groups,0,strlen($groups)-1);
+						$groups .= ";";
+					}
+					else
+						$groups .= $tmp . ";" ;									
+				}
+					
+				$groups  = substr($groups,0,strlen($groups)-1);
+			
+				$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+
+				if( $this->db->query($query))
+					$return = true;
+			}
+		}	
+		
+		return $return;
+	}
+
+}
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/Controller.class.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/Controller.class.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/inc/Controller.class.php	(revision 4453)
@@ -0,0 +1,204 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class Controller
+{
+	const __CONTROLLER_SECURITY__				= 'controller-security';
+	const __CONTROLLER_CONTENTES__				= 'controller-contentes';
+	const __CONTROLLER_SECTIONS__				= 'controller-sections';
+
+	const __STRING_ACCESS__						= 'string-access';
+	const __STRING_DELIMITER__					= 'string-delimiter';
+
+	const __CONTROLLER_CONTENTES_ITEM__			= 'item';
+	const __CONTROLLER_CONTENTES_ITEM_PARAM__	= 'param';
+	const __CONTROLLER_CONTENTES_ITEM_SECTION__	= 'section';
+
+	const __CONTROLLER_SECTIONS_ITEM__			= 'item';
+
+	private $fatalError							= false;
+	private $_PATH								= "";
+
+	public function __construct()
+	{
+		try
+		{
+			$controler_xml = dirname(__FILE__) . '/controller.xml';
+			
+			if ( !file_exists($controler_xml) )
+				throw new Exception(__CLASS__ . ' [ ERROR ] :: the configuration file does not exist');
+
+			$this->dom = new DOMDocument;
+			$this->dom->preserveWhiteSpace = FALSE;
+			$this->dom->load($controler_xml);
+
+			unset($controler_xml);
+
+			$this->controller_security = $this->dom->getElementsByTagName(self::__CONTROLLER_SECURITY__);
+			if ( $this->controller_security->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #0 ] :: the tag "' . self::__CONTROLLER_SECURITY__ . '" does not exist');
+			if ( $this->controller_security->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #1 ] :: exists more of a tag "' . self::__CONTROLLER_SECURITY__ . '"');
+
+			$this->controller_contentes = $this->dom->getElementsByTagName(self::__CONTROLLER_CONTENTES__);
+			if ( $this->controller_contentes->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #2 ] :: the tag "' . self::__CONTROLLER_CONTENTES__ . '" does not exist');
+			if ( $this->controller_contentes->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #3 ] :: exists more of a tag "' . self::__CONTROLLER_CONTENTES__ . '"');
+			$this->controller_contentes = $this->controller_contentes->item(0);
+
+			$this->controller_sections = $this->dom->getElementsByTagName("controller-sections");
+			if ( $this->controller_sections->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #4 ] :: the tag "' . self::__CONTROLLER_SECTIONS__ . '" does not exist');
+			if ( $this->controller_sections->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #5 ] :: exists more of a tag "' . self::__CONTROLLER_SECTIONS__ . '"');
+			$this->controller_sections = $this->controller_sections->item(0);
+
+			$this->string_access = $this->controller_security->item(0)->getElementsByTagName(self::__STRING_ACCESS__);
+			if ( $this->string_access->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #6 ] :: the tag "' . self::__STRING_ACCESS__ . '" does not exist');
+			if ( $this->string_access->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #7 ] :: exists more of a tag "' . self::__STRING_ACCESS__ . '"');
+			$this->string_access = $this->string_access->item(0)->nodeValue;
+
+			$this->string_delimiter = $this->controller_security->item(0)->getElementsByTagName(self::__STRING_DELIMITER__);
+			( $this->string_delimiter->length === (int)0 )
+				and die(__CLASS__ . ' [ ERROR #8 ] :: the tag "' . self::__STRING_DELIMITER__ . '" does not exist');
+			if ( $this->string_delimiter->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #9 ] :: exists more of a tag "' . self::__STRING_DELIMITER__ . '"');
+			$this->string_delimiter = $this->string_delimiter->item(0)->nodeValue;
+		}
+		catch(Exception $e)
+		{
+			$this->fatalError = true;
+			return $e->getMessage();
+		}
+	}
+
+	public function __call($name, $arguments)
+	{
+		if ( !$this->fatalError )
+			switch ( $name )
+			{
+				case 'exec' :
+					return $this->_exec($arguments[0], $arguments[1]);
+				break;
+				default : return "Method not avaible";
+			}
+	}
+
+	public function __toString()
+	{
+		return __CLASS__;
+	}
+
+	private final function _exec(array &$pRequest, $pPath)
+	{
+		( $pRequest[$this->string_access] )
+			or die(__CLASS__ . ' [ ERROR #10 ] :: bad string action argument');
+
+		list($section_name, $ref, $alias) = explode($this->string_delimiter, $pRequest[$this->string_access]);
+		unset($pRequest[$this->string_access]);
+
+		$contents_itens = $this->controller_contentes->getElementsByTagName(self::__CONTROLLER_CONTENTES_ITEM__);
+
+		for ( $i = 0; $i < $contents_itens->length && $contents_itens->item($i)->getAttribute(self::__CONTROLLER_CONTENTES_ITEM_PARAM__) != $section_name; $i++ );
+		( !($i < $contents_itens->length) )
+			and die(__CLASS__ . ' [ ERROR #11 ] :: invalid section "' . $section_name . '"');
+
+		$section_name = $contents_itens->item($i)->getAttribute(self::__CONTROLLER_CONTENTES_ITEM_SECTION__);
+
+		$section = $this->controller_sections->getElementsByTagName($section_name);
+		( $section->length === (int)0 )
+			and die(__CLASS__ . ' [ ERROR #12 ] :: the tag "' . $section_name . '" does not exist');
+		( $section->length === (int)1 )
+			or die(__CLASS__ . ' [ ERROR #13 ] :: exists more of a tag "' . $section_name . '"');
+		$section = $section->item(0);
+
+		$section_itens = $section->getElementsByTagName(self::__CONTROLLER_SECTIONS_ITEM__);
+
+		if ( empty($alias) && $alias !== '0' )
+			for ( $i = 0; $i < $section_itens->length && $section_itens->item($i)->getAttribute('ref') != $ref; $i++ );
+		else
+			for ( $i = 0; $i < $section_itens->length && ( $section_itens->item($i)->getAttribute('ref') != $ref || $section_itens->item($i)->getAttribute('alias') !== $alias); $i++ );
+
+		( !($i < $section_itens->length) )
+			and die(__CLASS__ . ' [ ERROR #14 ] :: invalid reference "' . $ref . '"');
+
+		if( $section_itens->item($i)->getAttribute('path') )
+			$path = $section_itens->item($i)->getAttribute('path');
+		else if	( $section->getAttribute('path') )
+			$path = $pPath . $section->getAttribute('path');
+			
+		if( !$path ) die(__CLASS__ . ' [ ERROR #15 ] :: bad path argument');
+
+		$prefix = $section_itens->item($i)->getAttribute('prefix')
+			or $prefix = $section->getAttribute('prefix');
+
+		$suffix = $section_itens->item($i)->getAttribute('suffix')
+			or $suffix = $section->getAttribute('suffix')
+			or die(__CLASS__ . ' [ ERROR #16 ] :: bad suffix argument');
+
+		return $this->$section_name(array("pSectionItem" => $section_itens->item($i), "pPath" => $path, "pPrefix" => $prefix, "pSuffix" => $suffix, "pRequest" => $pRequest));
+	}
+
+	private final function php()
+	{
+		$params = func_get_args();
+		extract($params[0]);
+
+		$class = $pSectionItem->getAttribute('class')
+			and $method = $pSectionItem->getAttribute('method')
+			or die(__CLASS__ . ' [ ERROR #17 ] :: bad class or method argument');
+
+		$file = "{$pPath}/{$pPrefix}{$class}{$pSuffix}";
+
+		file_exists($file)
+			or die(__CLASS__ . ' [ ERROR #18 ] :: the file that has the class was not opened');
+
+		require_once $file;
+
+		$obj = new ReflectionClass($class);
+
+		if ( $pRequest['classConstructor'] )
+		{
+			$obj = $obj->newInstance($pRequest['classConstructor']);
+			unset($pRequest['classConstructor']);
+		}
+		else
+			$obj = $obj->newInstance();
+
+		$method = new ReflectionMethod($class, $method);
+		$result = $method->invoke($obj, $pRequest);
+
+		return $result;
+	}
+
+	private final function js()
+	{
+		$params = func_get_args();
+		extract($params[0]);
+
+		$js = $pSectionItem->getAttribute('js')
+			or die(__CLASS__ . ' [ ERROR #18 ] :: bad js argument');
+
+		$file = "{$pPath}/{$pPrefix}{$js}{$pSuffix}";
+
+		file_exists($file)
+			or die(__CLASS__ . ' [ ERROR #19 ] :: the file that has the class was not opened');
+
+		$debug = $pSectionItem->parentNode->getAttribute('debug');
+		
+		return file_get_contents($file);
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.mini.js	(revision 4453)
@@ -0,0 +1,43 @@
+
+(function()
+{var arrowImage=path_jabberit+'templates/default/images/select_arrow.gif';var arrowImageOver=path_jabberit+'templates/default/images/select_arrow_over.gif';var arrowImageDown=path_jabberit+'templates/default/images/select_arrow_down.gif';var activeOption;var selectBoxIds=0;var currentlyOpenedOptionBox=false;var editableSelect_activeArrow=false;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 createEditableSelect()
+{var dest="";var _left="";var _top="";if(arguments.length>0)
+{dest=arguments[0];_top=arguments[1];_left=arguments[2];}
+else
+{return false;}
+dest.className='selectBoxInput';var div=document.createElement('DIV');div.id='selectBox'+selectBoxIds;div.style.top=_top+"px";div.style.left=_left+"px";div.style.width=dest.offsetWidth;div.style.position='absolute';var parent=dest.parentNode;parent.insertBefore(div,dest);div.appendChild(dest);div.className='selectBox';var img=document.createElement('IMG');img.src=arrowImage;img.className='selectBoxArrow';img.onclick=selectBox_showOptions;img.id='arrowSelectBox'+selectBoxIds;div.appendChild(img);var optionDiv=document.createElement('DIV');optionDiv.id='selectBoxOptions'+selectBoxIds;optionDiv.className='selectBoxOptionContainer';optionDiv.style.width=div.offsetWidth-2+'px';div.appendChild(optionDiv);if(dest.getAttribute('selectBoxOptions'))
+{var options=dest.getAttribute('selectBoxOptions').split(';');var optionsTotalHeight=0;var optionArray=new Array();for(var no=0;no<options.length;no++)
+{var anOption=document.createElement('DIV');anOption.innerHTML=options[no];anOption.className='selectBoxAnOption';anOption.onclick=selectOptionValue;anOption.style.width=optionDiv.style.width.replace('px','')-2+'px';anOption.onmouseover=highlightSelectBoxOption;optionDiv.appendChild(anOption);optionsTotalHeight=optionsTotalHeight+anOption.offsetHeight;optionArray.push(anOption);}
+if(optionsTotalHeight>optionDiv.offsetHeight)
+{for(var no=0;no<optionArray.length;no++)
+{optionArray[no].style.width=optionDiv.style.width.replace('px','')-22+'px';}}
+optionDiv.style.display='none';optionDiv.style.visibility='visible';optionDiv.style.zIndex=loadscript.getZIndex();}
+configEvents(dest,'onkeydown',function(e)
+{switch(e.keyCode)
+{case 13:case 27:dest.value=dest.value;dest.focus();dest.select();break;}});configEvents(dest,'onclick',function(e)
+{dest.value=dest.value;dest.focus();dest.select();document.getElementById('selectBoxOptions0').style.display='none';document.getElementById('arrowSelectBox0').src=arrowImageOver;});}
+function highlightSelectBoxOption()
+{if(this.style.backgroundColor=='#316AC5')
+{this.style.backgroundColor='';this.style.color='';}
+else
+{this.style.backgroundColor='#316AC5';this.style.color='#FFF';}
+if(activeOption)
+{activeOption.style.backgroundColor='';activeOption.style.color='';}
+activeOption=this;}
+function selectOptionValue()
+{var parentNode=this.parentNode.parentNode;var textInput=parentNode.getElementsByTagName('INPUT')[0];textInput.value=this.innerHTML;this.parentNode.style.display='none';document.getElementById('arrowSelectBox'+parentNode.id.replace(/[^\d]/g,'')).src=arrowImageOver;}
+function selectBox_showOptions()
+{if(editableSelect_activeArrow&&editableSelect_activeArrow!=this)
+editableSelect_activeArrow.src=arrowImage;editableSelect_activeArrow=this;var numId=this.id.replace(/[^\d]/g,'');var optionDiv=document.getElementById('selectBoxOptions'+numId);if(optionDiv.style.display=='block')
+{optionDiv.style.display='none';this.src=arrowImageOver;}
+else
+{optionDiv.style.display='block';this.src=arrowImageDown;if(currentlyOpenedOptionBox&&currentlyOpenedOptionBox!=optionDiv)
+currentlyOpenedOptionBox.style.display='none';currentlyOpenedOptionBox=optionDiv;}}
+function SelectEditable(){}
+SelectEditable.prototype.create=createEditableSelect;window.SelectEditable=SelectEditable;})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.js	(revision 4453)
@@ -0,0 +1,136 @@
+(function()
+{
+	var _xtools		= null;
+	var dragDrop	= null;
+	var path		= path_jabberit;
+	
+	var _dialogs = [ ];
+	
+	function build(pObj)
+	{
+		var _window = getElement( pObj.id_window + '__parent');
+		_xtools = new xtools(path);		
+		
+		if( _window == null )
+		{
+			pObj.width		= ( ( pObj.width > 160 ) ? pObj.width : 160 );
+			pObj.height		= ( ( pObj.height > 80 ) ? pObj.height : 80 );
+			pObj.onclick	= "_winBuild('" + pObj.id_window + "', '" + pObj.closeAction + "')";
+			
+			_window = document.createElement("div");
+			_window.id	= pObj.id_window + "__parent";
+			_window.setAttribute("onselectstart" , "return false");
+			_window.style.width		= pObj.width + "px";
+			_window.style.height	= pObj.height + "px";
+			_window.style.top		= pObj.top + "px";
+			_window.style.left		= pObj.left + "px";
+			_window.style.position	= "absolute";
+			_window.style.zIndex	= pObj.zindex;
+			_window.innerHTML		= _xtools.parse( _xtools.xml('window_main'), 'window.xsl', pObj );
+
+			if( pObj.closeAction == "hidden" )
+				_window.setAttribute("leftOld", pObj.left + "px" );
+			
+			if( pObj.leftOld )
+				_window.setAttribute("leftOld", pObj.leftOld + "px" );
+			
+			window.document.body.insertBefore( _window, document.body.lastChild );
+			
+			if ( pObj.content.constructor == String )
+				getElement(pObj.id_window + '__content').innerHTML = pObj.content;
+			else
+				getElement(pObj.id_window + '__content').appendChild( pObj.content );
+			
+			_dialogs[ pObj.id_window ] = getElement(pObj.id_window + '__content').firstChild;
+			
+			if( pObj.draggable )
+			{
+				dragDrop = new _drag_drop();
+				dragDrop.set( pObj.id_window );
+			}
+		}
+		else
+		{
+	    	if ( pObj.barejid && loadscript.windowPOPUP( pObj.barejid ) )
+	    		return false;
+
+	    	load(pObj.id_window, "display");
+		}
+	}
+
+	function getElement(pElement)
+	{
+		return document.getElementById(pElement);
+	}
+	
+	function load( pId, pVisible )
+	{
+		var _window = document.getElementById( pId + '__parent')
+		
+		if( _window != null )
+		{
+			if ( pVisible == "display" )
+			{
+				if( _window.style.left == "-1500px" )
+					_window.style.left = _window.getAttribute("leftOld");
+			}
+			
+			if ( pVisible == "hidden")
+			{
+				_window.setAttribute("leftOld" , _window.style.left );
+				_window.style.left = "-1500px";
+			}
+			
+			if( pVisible == "remove" )
+			{
+				document.body.removeChild( _window );
+			}
+		}
+	}
+	
+	function _window()
+	{
+		if( arguments.length > 0 )
+		{
+			var pId = null;
+			if( arguments.length == 1 )
+			{
+				var obj = arguments[0];
+				pId = obj.id_window
+				build(obj);
+			}
+			
+			if( arguments.length == 2 )
+			{
+				load( ( pId = arguments[0] ), arguments[1]);
+			}	
+		}
+
+		return ( new function( )
+		{
+			this.content = function( )
+			{
+				if ( arguments.length )
+					getElement( pId + '__content').appendChild( _dialogs[ pId ] );
+
+				return _dialogs[ obj.id_window ];
+			};
+		} );
+	}
+
+	window.bWindow	= _window;
+
+})();
+
+function _winBuild()
+{
+	if( arguments.length > 0 )
+	{	
+		if( arguments.length == 1 )
+			return bWindow( arguments[0] );
+		
+		if( arguments.length == 2 )
+			return bWindow( arguments[0], arguments[1]);	
+	}
+	return false;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 4453)
@@ -0,0 +1,463 @@
+DOMObjects={xmlParse:function(xmlString){var xmlObj=this.xmlRender(xmlString);if(xmlObj){try{if(this.processor==undefined){this.processor=new XSLTProcessor();this.processor.importStylesheet(this.xmlRender('<xsl:stylesheet version="1.0"\
+                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\
+                    <xsl:output method="html" indent="yes"/><xsl:template\
+                    match="@*|node()"><xsl:copy><xsl:copy-of\
+                    select="@*|node()"/></xsl:copy></xsl:template>\
+                    </xsl:stylesheet>'));}
+var htmlObj=this.processor.transformToDocument(xmlObj).documentElement;if(htmlObj.tagName.toLowerCase()=='html'){htmlObj=htmlObj.firstChild.firstChild;}
+return document.importNode(htmlObj,true);}catch(e){try{var htmlObj=document.importNode(xmlObj.documentElement,true);if(htmlObj.tagName.toLowerCase()=="div"){var div_wrapper=document.createElement('div');div_wrapper.appendChild(htmlObj);if(div_wrapper.innerHTML){div_wrapper.innerHTML=div_wrapper.innerHTML;}
+htmlObj=div_wrapper.firstChild;}
+return htmlObj;}catch(e){alert("TrophyIM Error: Cannot add html to page "+e.message);}}}},xmlRender:function(xmlString){try{var renderObj=new ActiveXObject("Microsoft.XMLDOM");renderObj.async="false";if(xmlString){renderObj.loadXML(xmlString);}}catch(e){try{if(this.parser==undefined){this.parser=new DOMParser();}
+var renderObj=this.parser.parseFromString(xmlString,"application/xml");}catch(e){alert("TrophyIM Error: Cannot create new html for page");}}
+return renderObj;},getHTML:function(page)
+{return this.xmlParse(HTMLSnippets[page]);},getScript:function(script)
+{var newscript=document.createElement('script');newscript.setAttribute('src',script);newscript.setAttribute('type','text/javascript');return newscript;}};TrophyIM={controll:{notificationNewUsers:0},autoConnection:{connect:true},activeChatRoom:{name:[]},chatHistory:{},constants:{stale_roster:false},posWindow:{left:400,top:100},statusConn:{connected:false},_timeOut:{renderRoster:null},removeResult:{idResult:[]},setCookie:function(name,value)
+{var expire=new Date();expire.setDate(expire.getDate()+365);document.cookie=name+"="+value+"; expires="+expire.toGMTString();},delCookie:function(name)
+{var expire=new Date();expire.setDate(expire.getDate()-365);document.cookie=name+"= ; expires="+expire.toGMTString();delete TrophyIM.cookies[name];},getCookies:function()
+{var cObj={};var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++)
+{while(cookies[i].charAt(0)==' ')
+{cookies[i]=cookies[i].substring(1,cookies[i].length);}
+if(cookies[i].substr(0,8)=="trophyim")
+{var nvpair=cookies[i].split("=",2);cObj[nvpair[0]]=nvpair[1];TrophyIM.setCookie(nvpair[0],nvpair[1]);}}
+return cObj;},load:function()
+{if(loadscript.getUserCurrent()==null)
+{loadscript.setUserCurrent();}
+if(!TrophyIM.statusConn.connected)
+{TrophyIM.cookies=TrophyIM.getCookies();setTimeout("TrophyIM.showLogin()",550);}
+else
+{loadscript.rosterDiv();}},storeData:function()
+{if(TrophyIM.connection&&TrophyIM.connection.connected)
+{TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+
+TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);TrophyIM.rosterObj.save();}},showLogin:function()
+{if(typeof(JSON)!=undefined&&typeof(Strophe)!=undefined)
+{TrophyIM.JSONStore=new TrophyIMJSONStore();if(TrophyIM.JSONStore.store_working&&TrophyIM.cookies['trophyim_bosh_xid'])
+{var xids=TrophyIM.cookies['trophyim_bosh_xid'].split("|");TrophyIM.delCookie('trophyim_bosh_xid');TrophyIM.constants.stale_roster=true;TrophyIM.connection=new Strophe.Connection(TROPHYIM_BOSH_SERVICE);TrophyIM.connection.rawInput=TrophyIM.rawInput;TrophyIM.connection.rawOutput=TrophyIM.rawOutput;Strophe.info('Attempting Strophe attach.');TrophyIM.connection.attach(xids[0],xids[1],xids[2],TrophyIM.onConnect);TrophyIM.onConnect(Strophe.Status.CONNECTED);}
+else
+{loadscript.rosterDiv();var _getUserCurrent=null;_getUserCurrent=loadscript.getUserCurrent();if(_getUserCurrent==null)
+{setTimeout("TrophyIM.showLogin()",500);}
+else
+{TrophyIM.login(Base64.decode(_getUserCurrent.jid),Base64.decode(_getUserCurrent.password));}}}
+else
+{setTimeout("TrophyIM.showLogin()",500);}},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);}
+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;}},rawInput:function(data)
+{Strophe.debug("RECV: "+data);},rawOutput:function(data)
+{Strophe.debug("SEND: "+data);},login:function()
+{if(TrophyIM.JSONStore.store_working)
+{TrophyIM.JSONStore.delData(['groups','roster','active_chat','chat_history']);}
+TrophyIM.connection=new Strophe.Connection(TROPHYIM_BOSH_SERVICE);TrophyIM.connection.rawInput=TrophyIM.rawInput;TrophyIM.connection.rawOutput=TrophyIM.rawOutput;if(arguments.length>0)
+{var barejid=arguments[0];var password=arguments[1];TrophyIM.connection.connect(barejid+TROPHYIM_RESOURCE,password,TrophyIM.onConnect);}
+else
+{var barejid=document.getElementById('trophyimjid').value
+var fulljid=barejid+TROPHYIM_RESOURCE;var password=document.getElementById('trophyimpass').value;var button=document.getElementById('trophyimconnect');loadscript.setUserCurrent(barejid,password);if(button.value=='connect')
+{button.value='disconnect';TrophyIM.login(barejid,password);_winBuild('window_login_page','remove');}}
+TrophyIM.setCookie('trophyimjid',barejid);},logout:function()
+{TrophyIM.autoConnection.connect=false;TrophyIM.delCookie('trophyim_bosh_xid');delete TrophyIM['cookies']['trophyim_bosh_xid'];TrophyIM.connection.disconnect();},onConnect:function(status)
+{var loading_gif=document.getElementById("JabberIMRosterLoadingGif");if(status==Strophe.Status.CONNECTING)
+{loading_gif.style.display="block";Strophe.info('Strophe is connecting.');}
+if(status==Strophe.Status.CONNFAIL)
+{TrophyIM.delCookie('trophyim_bosh_xid');TrophyIM.statusConn.connected=false;loading_gif.style.display="block";}
+if(status==Strophe.Status.DISCONNECTING)
+{TrophyIM.statusConn.connected=false;}
+if(status==Strophe.Status.DISCONNECTED)
+{if(TrophyIM.autoConnection.connect)
+{loading_gif.style.display="block";TrophyIM.delCookie('trophyim_bosh_xid');TrophyIM.statusConn.connected=false;setTimeout(function()
+{TrophyIM.showLogin();},10000);loadscript.clrAllContacts();loadscript.setStatusJabber(i18n.STATUS_ANAVAILABLE,"unavailable");delete TrophyIM.rosterObj.roster;delete TrophyIM.rosterObj.groups;}}
+if(status==Strophe.Status.CONNECTED)
+{loadscript.setStatusJabber(i18n.STATUS_AVAILABLE,'available');TrophyIM.statusConn.connected=true;TrophyIM.showClient();}},showClient:function()
+{TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+
+TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);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.send($iq({type:'get',xmlns:Strophe.NS.CLIENT}).c('query',{xmlns:Strophe.NS.ROSTER}).tree());TrophyIM.connection.send($pres().tree());setTimeout(TrophyIM.renderRoster,1000);},clearClient:function()
+{if(TrophyIM.logging_div)
+{var logging_div=TrophyIM.client_div.removeChild(document.getElementById('trophyimlog'));}
+else
+{var logging_div=null;}
+while(TrophyIM.client_div.childNodes.length>0)
+{TrophyIM.client_div.removeChild(TrophyIM.client_div.firstChild);}
+return logging_div;},onVersion:function(msg)
+{Strophe.debug("Version handler");if(msg.getAttribute('type')=='get')
+{var from=msg.getAttribute('from');var to=msg.getAttribute('to');var id=msg.getAttribute('id');var reply=$iq({type:'result',to:from,from:to,id:id}).c('query',{name:"TrophyIM",version:TROPHYIM_VERSION,os:"Javascript-capable browser"});TrophyIM.connection.send(reply.tree());}
+return true;},onRoster:function(msg)
+{var roster_items=msg.firstChild.getElementsByTagName('item');for(var i=0;i<roster_items.length;i++)
+{with(roster_items[i])
+{var groups=getElementsByTagName('group');var group_array=[];for(var g=0;g<groups.length;g++)
+{if(groups[g].hasChildNodes())
+group_array[group_array.length]=groups[g].firstChild.nodeValue;}
+if(getAttribute('ask')&&getAttribute('ask').toString()==="subscribe")
+{if(getAttribute('subscription').toString()==="none")
+{TrophyIM.rosterObj.addContact(getAttribute('jid'),getAttribute('ask'),getAttribute('name'),group_array);}
+if(getAttribute('subscription').toString()==="remove")
+{TrophyIM.rosterObj.removeContact(getAttribute('jid').toString());}}
+else
+{if((getAttribute('ask')==null&&getAttribute('subscription').toString()==="remove")||getAttribute('subscription').toString()==="remove")
+{TrophyIM.rosterObj.removeContact(getAttribute('jid').toString());}
+else
+{TrophyIM.rosterObj.addContact(getAttribute('jid'),getAttribute('subscription'),getAttribute('name'),group_array);}}}}
+if(msg.getAttribute('type')=='set')
+{var _iq=$iq({type:'reply',id:msg.getAttribute('id'),to:msg.getAttribute('from')});TrophyIM.connection.send(_iq.tree());}
+return true;},onPresence:function(msg)
+{TrophyIM.onPresenceChatRoom(msg);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;if(msg.getAttribute('from').toString().indexOf(TROPHYIM_CHATROOM)<0)
+{var _from=Strophe.getBareJidFromJid(msg.getAttribute('from'));var _flag=true;if(TrophyIM.removeResult.idResult.length>0)
+{for(var i=0;i<TrophyIM.removeResult.idResult.length;i++)
+{if(TrophyIM.removeResult.idResult[i]==_from)
+{_flag=false;TrophyIM.removeResult.idResult.splice(i,1);i--;if(show.toLowerCase()==='subscribe')
+_flag=true;}}}
+if(_flag)
+TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
+return true;},onPresenceChatRoom:function(msg)
+{var xquery=msg.getElementsByTagName("x");var _error=msg.getElementsByTagName("error");if(_error.length>0)
+{for(var i=0;i<_error.length;i++)
+{if(_error[i].getElementsByTagName("text"))
+{var _errorMsg=Strophe.getText(_error[i].getElementsByTagName("text")[0]);if(_errorMsg=="Room creation is denied by service policy")
+{alert(i18n.ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY);}
+else
+{alert(" Informe ao seu Administrador ERRO : \n"+_errorMsg);}}}}
+else
+{if(xquery.length>0)
+{for(var i=0;i<xquery.length;i++)
+{var xmlns=xquery[i].getAttribute("xmlns");if(xmlns.indexOf("http://jabber.org/protocol/muc#user")==0)
+{var _from=xquery[i].parentNode.getAttribute('from');var _to=xquery[i].parentNode.getAttribute('to');var nameChatRoom=Strophe.getBareJidFromJid(_from);var nickName=Strophe.getResourceFromJid(_from);var type=(xquery[i].parentNode.getAttribute('type')!=null)?xquery[i].parentNode.getAttribute('type'):'available';var show=(xquery[i].parentNode.firstChild.nodeName=="show")?xquery[i].parentNode.firstChild.firstChild.nodeValue:type;var _idElement=nameChatRoom+"_UserChatRoom__"+nickName;var _UserChatRoom=document.createElement("div");_UserChatRoom.id=_idElement;_UserChatRoom.style.paddingLeft='18px';_UserChatRoom.style.margin='3px 0px 0px 2px';_UserChatRoom.style.background='url("'+path_jabberit+'templates/default/images/'+show+'.gif") no-repeat center left';_UserChatRoom.appendChild(document.createTextNode(nickName));var nodeUser=document.getElementById(_idElement);if(nodeUser==null)
+{if(document.getElementById(nameChatRoom+'__roomChat__participants')!=null)
+{nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}
+else
+{if(type!='unavailable')
+{TrophyIM.makeChatRoom(nameChatRoom,nameChatRoom.substring(0,nameChatRoom.indexOf('@')));nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}}}
+else
+{if(type=='unavailable')
+{nodeUser.parentNode.removeChild(nodeUser);}
+else if(show)
+{nodeUser.style.backgroundImage='url("'+path_jabberit+'templates/default/images/'+show+'.gif")';}}}}}}},onMessage:function(msg)
+{var checkTime=function(i)
+{if(i<10)i="0"+i;return i;};var messageDate=function(_date)
+{var _dt=_date.substr(0,_date.indexOf('T')).split('-');var _hr=_date.substr(_date.indexOf('T')+1,_date.length-_date.indexOf('T')-2).split(':');(_date=new Date).setTime(Date.UTC(_dt[0],_dt[1]-1,_dt[2],_hr[0],_hr[1],_hr[2]));return(_date.toLocaleDateString().replace(/-/g,'/')+' '+_date.toLocaleTimeString());};var data=new Date();var dtNow=checkTime(data.getHours())+":"+checkTime(data.getMinutes())+":"+checkTime(data.getSeconds());var from=msg.getAttribute('from');var type=msg.getAttribute('type');var elems=msg.getElementsByTagName('body');var delay=(msg.getElementsByTagName('delay'))?msg.getElementsByTagName('delay'):null;var stamp=(delay[0]!=null)?"<font style='color:red;'>"+messageDate(delay[0].getAttribute('stamp'))+"</font>":dtNow;var barejid=Strophe.getBareJidFromJid(from);var jidChatRoom=Strophe.getResourceFromJid(from);var jid_lower=barejid.toLowerCase();var contact="";var state="";var chatBox=document.getElementById(jid_lower+"__chatState");var chatStateOnOff=null;var active=msg.getElementsByTagName('active');contact=barejid.toLowerCase();contact=contact.substring(0,contact.indexOf('@'));if(TrophyIM.rosterObj.roster[barejid])
+{if(TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'])
+{contact=TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'];}}
+if(elems.length>0)
+{state="";chatStateOnOff=document.getElementById(jid_lower+"__chatStateOnOff");if(active.length>0&chatStateOnOff!=null)
+{chatStateOnOff.value='on';}
+var _message=document.createElement("div");var _text=Strophe.getText(elems[0]);_text=_text.replace(/onblur/gi,"EVENT_DENY");_text=_text.replace(/onchange/gi,"EVENT_DENY");_text=_text.replace(/onclick/gi,"EVENT_DENY");_text=_text.replace(/ondblclick/gi,"EVENT_DENY");_text=_text.replace(/onerror/gi,"EVENT_DENY");_text=_text.replace(/onfocus/gi,"EVENT_DENY");_text=_text.replace(/onkeydown/gi,"EVENT_DENY");_text=_text.replace(/onkeypress/gi,"EVENT_DENY");_text=_text.replace(/onkeyup/gi,"EVENT_DENY");_text=_text.replace(/onmousedown/gi,"EVENT_DENY");_text=_text.replace(/onmousemove/gi,"EVENT_DENY");_text=_text.replace(/onmouseout/gi,"EVENT_DENY");_text=_text.replace(/onmouseover/gi,"EVENT_DENY");_text=_text.replace(/onmouseup/gi,"EVENT_DENY");_text=_text.replace(/onresize/gi,"EVENT_DENY");_text=_text.replace(/onselect/gi,"EVENT_DENY");_text=_text.replace(/onunload/gi,"EVENT_DENY");_text=_text.replace(/style/gi,"EVENT_DENY");_text=_text.replace(/img /gi,"IMG_DENY ");_text=_text.replace(/script /gi,"SCRIPT_DENY ");_text=_text.replace(/div /gi,"DIV_DENY ");_text=_text.replace(/span /gi,"SPAN_DENY ");_text=_text.replace(/iframe /gi,"IFRAME_DENY ");_message.innerHTML=_text;var scripts=_message.getElementsByTagName('script_deny');for(var i=0;i<scripts.length;i++){_message.removeChild(scripts[i--]);}
+var _imgSrc=_message.getElementsByTagName('img_deny');for(var i=0;i<_imgSrc.length;i++){_imgSrc[i].parentNode.removeChild(_imgSrc[i--]);}
+var _Div=_message.getElementsByTagName('div_deny');for(var i=0;i<_Div.length;i++){_Div[i].parentNode.removeChild(_Div[i--]);}
+var _Span=_message.getElementsByTagName('span_deny');for(var i=0;i<_Span.length;i++){_Span[i].parentNode.removeChild(_Span[i--]);}
+var _Iframe=_message.getElementsByTagName('iframe_deny');for(var i=0;i<_Iframe.length;i++){_Iframe[i].parentNode.removeChild(_Iframe[i--]);}
+var _aHref=_message.getElementsByTagName('a');for(var i=0;i<_aHref.length;i++){_aHref[i].parentNode.removeChild(_aHref[i--]);}
+_message.innerHTML=_message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g,"");_message.innerHTML=loadscript.getSmiles(_message.innerHTML);if(type=='chat'||type=='normal')
+{if(_message.hasChildNodes())
+{var message={contact:"["+stamp+"] <font style='font-weight:bold; color:black;'>"+contact+"</font>",msg:"</br>"+_message.innerHTML};TrophyIM.addMessage(TrophyIM.makeChat(from),jid_lower,message);}}
+else if(type=='groupchat')
+{if(_message.hasChildNodes())
+{var message={contact:"["+stamp+"] <font style='font-weight:bold; color:black;'>"+jidChatRoom+"</font>",msg:"</br>"+_message.innerHTML};TrophyIM.addMessage(TrophyIM.makeChatRoom(barejid),jid_lower,message);}}}
+else
+{if(chatBox!=null)
+state=TrophyIM.getChatState(msg);}
+var clearChatState=function()
+{chatBox.innerHTML='';}
+if(chatBox!=null)
+{var clearChatStateTimer;chatBox.innerHTML="<font style='font-weight:bold; color:grey; float:right;'>"+state+"</font>";var _composing=msg.getElementsByTagName('composing');if(_composing.length==0)
+clearChatStateTimer=setTimeout(clearChatState,2000);else
+clearTimeout(clearChatStateTimer);}
+return true;},getChatState:function(msg)
+{var state=msg.getElementsByTagName('inactive');if(state.length>0)
+{return i18n.INACTIVE;}
+else
+{state=msg.getElementsByTagName('gone');if(state.length>0)
+{return i18n.GONE;}
+else
+{state=msg.getElementsByTagName('composing');if(state.length>0)
+{return i18n.COMPOSING;}
+else
+{state=msg.getElementsByTagName('paused');if(state.length>0)
+{return i18n.PAUSED;}}}}
+return'';},makeChat:function(fulljid)
+{var barejid=Strophe.getBareJidFromJid(fulljid);var titleWindow="";var paramsChatBox={'enabledPopUp':((loadscript.getIsIE())?"none":"block"),'idChatBox':barejid+"__chatBox",'jidTo':barejid,'path_jabberit':path_jabberit};titleWindow=barejid.toLowerCase();titleWindow=titleWindow.substring(0,titleWindow.indexOf('@'));if(TrophyIM.rosterObj.roster[barejid])
+{if(TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'])
+{titleWindow=TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'];}}
+TrophyIM.posWindow.top=TrophyIM.posWindow.top+10;if(TrophyIM.posWindow.top>200)
+TrophyIM.posWindow.top=100;TrophyIM.posWindow.left=TrophyIM.posWindow.left+5;if(TrophyIM.posWindow.left>455)
+TrophyIM.posWindow.left=400;var _content=document.createElement('div');_content.innerHTML=loadscript.parse("chat_box","chatBox.xsl",paramsChatBox);_content=_content.firstChild;var _messages=_content.firstChild.firstChild;var _textarea=_content.getElementsByTagName('textarea').item(0);var _send=_content.getElementsByTagName('input').item(0);var _chatStateOnOff=_content.getElementsByTagName('input').item(1);var _send_message=function()
+{if(!TrophyIM.sendMessage(barejid,_textarea.value))
+return false;TrophyIM.addMessage(_messages,barejid,{contact:"<font style='font-weight:bold; color:red;'>"+i18n.ME+"</font>",msg:"<br/>"+_textarea.value});_textarea.value='';_textarea.focus();};var composingTimer_=0;var isComposing_=0;var timeCounter;var setComposing=function()
+{var checkComposing=function()
+{if(!isComposing_){composingTimer_=0;clearInterval(timeCounter);TrophyIM.sendContentMessage(barejid,'paused');}else{TrophyIM.sendContentMessage(barejid,'composing');}
+isComposing_=0;}
+if(!composingTimer_){composingTimer_=1;timeCounter=setInterval(checkComposing,4000);}
+isComposing_=1;};loadscript.configEvents(_send,'onclick',_send_message);loadscript.configEvents(_textarea,'onkeyup',function(e)
+{if(e.keyCode==13){_send_message();composingTimer_=0;clearInterval(timeCounter);}else{if(_chatStateOnOff.value=='on')
+setComposing();}});var winChatBox={id_window:"window_chat_area_"+barejid,barejid:barejid,width:387,height:375,top:TrophyIM.posWindow.top,left:TrophyIM.posWindow.left,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:titleWindow,closeAction:"hidden",content:_content}
+_win=_winBuild(winChatBox);loadscript.notification(barejid);loadscript.getPhotoUser(barejid);_textarea.focus();return(_messages=_win.content().firstChild);},makeChatRoom:function()
+{var jidChatRoom=arguments[0];var titleWindow="ChatRoom - "+unescape(arguments[1]);var paramsChatRoom={'idChatRoom':jidChatRoom+"__roomChat",'jidTo':jidChatRoom,'lang_Send':i18n.SEND,'lang_Leave_ChatRoom':i18n.LEAVE_CHATROOM,'path_jabberit':path_jabberit};TrophyIM.posWindow.top=TrophyIM.posWindow.top+10;if(TrophyIM.posWindow.top>200)
+TrophyIM.posWindow.top=100;TrophyIM.posWindow.left=TrophyIM.posWindow.left+5;if(TrophyIM.posWindow.left>455)
+TrophyIM.posWindow.left=400;var _content=document.createElement('div');_content.innerHTML=loadscript.parse("chat_room","chatRoom.xsl",paramsChatRoom);_content=_content.firstChild;var _messages=_content.firstChild.firstChild;var _textarea=_content.getElementsByTagName('textarea').item(0);var _send=_content.getElementsByTagName('input').item(0);var _leaveChatRoom=_content.getElementsByTagName('input').item(1);var _send_message=function()
+{if(!TrophyIM.sendMessageChatRoom(jidChatRoom,_textarea.value))
+return false;_textarea.value='';_textarea.focus();};loadscript.configEvents(_send,'onclick',_send_message);loadscript.configEvents(_leaveChatRoom,'onclick',function()
+{TrophyIM.leaveChatRoom(jidChatRoom);if(TrophyIM.activeChatRoom.name.length>0)
+{for(var i=0;i<TrophyIM.activeChatRoom.name.length;i++)
+{if(TrophyIM.activeChatRoom.name[i].indexOf(jidChatRoom)>=0)
+{TrophyIM.activeChatRoom.name[i]="";}}}
+setTimeout(function()
+{_winBuild("window_chat_room_"+jidChatRoom,"remove");},650);});loadscript.configEvents(_textarea,'onkeyup',function(e)
+{if(e.keyCode==13)
+{_send_message();}});var winChatRoom={id_window:"window_chat_room_"+arguments[0],barejid:jidChatRoom,width:500,height:450,top:TrophyIM.posWindow.top,left:TrophyIM.posWindow.left,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:titleWindow,closeAction:"hidden",content:_content}
+_win=_winBuild(winChatRoom);return(_messages=_win.content().firstChild);},addContact:function(jidTo,name,group)
+{var _flag=true;if(TrophyIM.removeResult.idResult.length>0)
+{for(var i=0;i<TrophyIM.removeResult.idResult.length;i++)
+{if(TrophyIM.removeResult.idResult[i]==jidTo)
+{_flag=false;TrophyIM.removeResult.idResult.splice(i,1);i--;}}}
+if(_flag)
+{var _id=TrophyIM.connection.getUniqueId('add');var newContact=$iq({type:'set',id:_id});newContact=newContact.c('query').attrs({xmlns:'jabber:iq:roster'});newContact=newContact.c('item').attrs({jid:jidTo,name:name});newContact=newContact.c('group').t(group).tree();TrophyIM.connection.send(newContact);}},addMessage:function(chatBox,jid,msg)
+{msg.msg=loadscript.getSmiles(msg.msg);var messageDiv=document.createElement("div");messageDiv.style.margin="3px 0px 1em 3px";messageDiv.innerHTML=msg.contact+" : "+msg.msg;chatBox.appendChild(messageDiv);chatBox.scrollTop=chatBox.scrollHeight;},renameContact:function(jid)
+{var name=TrophyIM.rosterObj.roster[jid].contact.name;if((name=prompt(i18n.ASK_NEW_NAME_QUESTION+name+"!",name)))
+if((name=name.replace(/^\s+|\s+$|^\n|\n$/g,""))=="")
+name="";if(name==null||name=="")
+name="";var jidTo=jid
+var name=(name)?name:TrophyIM.rosterObj.roster[jid].contact.name;var group=TrophyIM.rosterObj.roster[jid].contact.groups[0];TrophyIM.addContact(jidTo,name,group);document.getElementById('itenContact_'+jid).innerHTML=name;},renameGroup:function(jid)
+{var group=TrophyIM.rosterObj.roster[jid].contact.groups[0];var presence=TrophyIM.rosterObj.roster[jid].presence;if((group=prompt(i18n.ASK_NEW_GROUP_QUESTION,group)))
+if((group=group.replace(/^\s+|\s+$|^\n|\n$/g,""))=="")
+group="";if(group==null||group=="")
+group="";var jidTo=TrophyIM.rosterObj.roster[jid].contact.jid;var name=TrophyIM.rosterObj.roster[jid].contact.name;var group=(group)?group:TrophyIM.rosterObj.roster[jid].contact.groups[0];TrophyIM.rosterObj.removeContact(jid);TrophyIM.addContact(jidTo,name,group);document.getElementById("JabberIMRoster").innerHTML="";TrophyIM.renderRoster();setTimeout(function()
+{for(var i in presence)
+{if(presence[i].constructor==Function)
+continue;TrophyIM.rosterObj.setPresence(jid,presence[i].priority,presence[i].show,presence[i].status);}},500);},createChatRooms:function()
+{var nickName=document.getElementById('nickName_chatRoom_jabberit').value;var nameChatRoom=document.getElementById('name_ChatRoom_jabberit').value;var _from=Base64.decode(loadscript.getUserCurrent().jid)+TROPHYIM_RESOURCE;var _to=escape(nameChatRoom)+"@"+TROPHYIM_CHATROOM+"/"+nickName;var new_room=$pres({from:_from,to:_to}).c("x",{xmlns:Strophe.NS.MUC});TrophyIM.activeChatRoom.name[TrophyIM.activeChatRoom.name.length]=_to;TrophyIM.connection.send(new_room.tree());},joinChatRoom:function(roomName)
+{var presence=$pres({from:TrophyIM.connection.jid,to:roomName}).c("x",{xmlns:Strophe.NS.MUC});TrophyIM.connection.send(presence);},leaveChatRoom:function(roomName)
+{var room_nick=roomName;var presenceid=TrophyIM.connection.getUniqueId();var presence=$pres({type:"unavailable",id:presenceid,from:TrophyIM.connection.jid,to:room_nick}).c("x",{xmlns:Strophe.NS.MUC});TrophyIM.connection.send(presence);},getListRooms:function()
+{if(TrophyIM.statusConn.connected)
+{var _error_return=function(element)
+{alert("ERRO : Tente novamente !");};var iq=$iq({to:TROPHYIM_CHATROOM,type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS});TrophyIM.connection.sendIQ(iq,loadscript.listRooms,_error_return,500);}
+else
+{alert("ERRO : Sem conexão com o servidor "+TROPHYIM_CHATROOM);}},removeContact:function(jidTo)
+{var divItenContact=null;if((divItenContact=document.getElementById('itenContact_'+jidTo)))
+{var _id=TrophyIM.connection.getUniqueId();TrophyIM.removeResult.idResult[TrophyIM.removeResult.idResult.length]=jidTo;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);loadscript.removeElement(document.getElementById('itenContactNotification_'+jidTo));var spanShow=document.getElementById('span_show_itenContact_'+jidTo)
+spanShow.parentNode.removeChild(spanShow);loadscript.removeGroup(divItenContact.parentNode);divItenContact.parentNode.removeChild(divItenContact);}},renderRoster:function()
+{var roster_div=document.getElementById('JabberIMRoster');if(roster_div)
+{var users=new Array();var loading_gif=document.getElementById("JabberIMRosterLoadingGif");if(loading_gif.style.display=="block")
+loading_gif.style.display="none";for(var user in TrophyIM.rosterObj.roster)
+{if(TrophyIM.rosterObj.roster[user].constructor==Function)
+continue;users[users.length]=TrophyIM.rosterObj.roster[user].contact.jid;}
+users.sort();var groups=new Array();var flagGeral=false;for(var group in TrophyIM.rosterObj.groups)
+{if(TrophyIM.rosterObj.groups[group].constructor==Function)
+continue;if(group)
+groups[groups.length]=group;if(group=="Geral")
+flagGeral=true;}
+if(!flagGeral&&users.length>0)
+groups[groups.length]="Geral";groups.sort();for(var i=0;i<groups.length;i++)
+{TrophyIM.renderGroups(groups[i],roster_div);}
+TrophyIM.renderItensGroup(users,roster_div);}
+TrophyIM._timeOut.renderRoster=setTimeout("TrophyIM.renderRoster()",1000);},renderGroups:function(nameGroup,element)
+{var _addGroup=function()
+{var _nameGroup=nameGroup;var _element=element;var paramsGroup={'nameGroup':_nameGroup,'path_jabberit':path_jabberit}
+_element.innerHTML+=loadscript.parse("group","groups.xsl",paramsGroup);}
+if(!element.hasChildNodes())
+{_addGroup();}
+else
+{var _NodeChild=element.firstChild;var flagAdd=false;while(_NodeChild)
+{if(_NodeChild.childNodes[0].nodeName.toLowerCase()==="span")
+{if(_NodeChild.childNodes[0].childNodes[0].nodeValue===nameGroup)
+{flagAdd=true;}}
+_NodeChild=_NodeChild.nextSibling;}
+if(!flagAdd)
+{_addGroup();}}},renderItensGroup:function(users,element)
+{var addItem=function()
+{if(arguments.length>0)
+{var objContact=arguments[0];var group=arguments[1];var element=arguments[2];var showOffline=loadscript.getShowContactsOffline();var presence="unavailable";var status="";var statusColor="black";var statusDisplay="none";var _resource="";var _presence=function(objContact)
+{if(objContact.presence)
+{for(var resource in objContact.presence)
+{if(objContact.presence[resource].constructor==Function)
+continue;if(objContact.presence[resource].show!='invisible')
+presence=objContact.presence[resource].show;if(objContact.contact.subscription!="both")
+presence='subscription';if(objContact.presence[resource].status)
+{status=" ( "+objContact.presence[resource].status+" ) ";statusDisplay="block";}}}};var _subscription=function(objContact)
+{if(objContact.contact.subscription!="both")
+{switch(objContact.contact.subscription)
+{case"none":status=" (( "+i18n.ASK_FOR_AUTH+" )) ";statusColor="red";break;case"to":status=" (( "+i18n.CONTACT_ASK_FOR_AUTH+" )) ";statusColor="orange";break;case"from":status=" (( "+i18n.AUTHORIZED+" )) ";statusColor="green";break;case"subscribe":status=" (( "+i18n.AUTH_SENT+" )) ";statusColor="red";break;case"not-in-roster":status=" (( "+i18n.ASK_FOR_AUTH_QUESTION+" )) ";statusColor="orange";break;default:break;}
+statusDisplay="block";}};if(objContact.contact.subscription!="remove")
+{var itensJid=document.getElementById("itenContact_"+objContact.contact.jid);if(itensJid==null)
+{var nameContact="";if(objContact.contact.name)
+nameContact=objContact.contact.name;else
+{nameContact=objContact.contact.jid;nameContact=nameContact.substring(0,nameContact.indexOf('@'));}
+_presence(objContact);var paramsContact={divDisplay:"block",id:'itenContact_'+objContact.contact.jid,jid:objContact.contact.jid,nameContact:nameContact,path_jabberit:path_jabberit,presence:presence,spanDisplay:statusDisplay,status:status,statusColor:"black",subscription:objContact.contact.subscription,resource:_resource}
+_subscription(objContact);if(group!="")
+{var _NodeChild=element.firstChild;while(_NodeChild)
+{if(_NodeChild.childNodes[0].nodeName.toLowerCase()==="span")
+{if(_NodeChild.childNodes[0].childNodes[0].nodeValue===group)
+{_NodeChild.innerHTML+=loadscript.parse("itens_group","itensGroup.xsl",paramsContact);}}
+_NodeChild=_NodeChild.nextSibling;}}}
+else
+{_presence(objContact);var is_open=itensJid.parentNode.childNodes[0].style.backgroundImage;is_open=is_open.indexOf("arrow_down.gif");_subscription(objContact);itensJid.setAttribute('subscription',objContact.contact.subscription);with(document.getElementById('span_show_'+'itenContact_'+objContact.contact.jid))
+{if(presence=="unavailable"&&!showOffline)
+{style.display="none";}
+else
+{if(is_open>0)
+{style.display=statusDisplay;style.color=statusColor;innerHTML=status;}}}
+if(presence=="unavailable"&&!showOffline)
+{itensJid.style.display="none";}
+else
+{if(is_open>0)
+{itensJid.style.display="block";}}
+itensJid.style.background="url('"+path_jabberit+"templates/default/images/"+presence+".gif') no-repeat center left";}
+if(!objContact.presence&&!showOffline)
+{if(objContact.contact.subscription!="remove")
+{with(document.getElementById('span_show_'+'itenContact_'+objContact.contact.jid))
+{style.display="none";}
+with(document.getElementById('itenContact_'+objContact.contact.jid))
+{style.display="none";}}}}}};var flag=false;for(var i=0;i<users.length;i++)
+{if(TrophyIM.rosterObj.roster[users[i]].contact.jid!=Base64.decode(loadscript.getUserCurrent().jid))
+{var _subscription=TrophyIM.rosterObj.roster[users[i]].contact.subscription;if(_subscription==="to")
+{flag=true;}
+if(_subscription==="not-in-roster")
+{flag=true;}
+if(TrophyIM.rosterObj.roster[users[i]].contact.groups)
+{var groups=TrophyIM.rosterObj.roster[users[i]].contact.groups;if(groups.length>0)
+{for(var j=0;j<groups.length;j++)
+{addItem(TrophyIM.rosterObj.roster[users[i]],groups[j],element);}}
+else
+{addItem(TrophyIM.rosterObj.roster[users[i]],"Geral",element);}}
+else
+{addItem(TrophyIM.rosterObj.roster[users[i]],"Geral",element);}}}
+if(flag)
+{if(TrophyIM.controll.notificationNewUsers==0)
+{loadscript.enabledNotificationNewUsers();TrophyIM.controll.notificationNewUsers++;}}
+else
+{loadscript.disabledNotificationNewUsers();TrophyIM.controll.notificationNewUsers=0;}},rosterClick:function(fulljid)
+{TrophyIM.makeChat(fulljid);},setAutorization:function(jidTo,jidFrom,_typeSubscription)
+{var _id=TrophyIM.connection.getUniqueId();TrophyIM.connection.send($pres().attrs({from:jidFrom,to:jidTo,type:_typeSubscription,id:_id}).tree());},setPresence:function(_type)
+{var presence_chatRoom="";if(_type!='status')
+{if(_type=="unavailable"&&TrophyIM.statusConn.connected)
+{var loading_gif=document.getElementById("JabberIMRosterLoadingGif");if(TrophyIM._timeOut.renderRoster!=null)
+clearTimeout(TrophyIM._timeOut.renderRoster);if(TrophyIM.statusConn.connected)
+TrophyIM.connection.send($pres({type:_type}).tree());for(var i=0;i<TrophyIM.connection._requests.length;i++)
+{if(TrophyIM.connection._requests[i])
+TrophyIM.connection._removeRequest(TrophyIM.connection._requests[i]);}
+TrophyIM.logout();loadscript.clrAllContacts();delete TrophyIM.rosterObj.roster;delete TrophyIM.rosterObj.groups;setTimeout(function()
+{if(loading_gif.style.display=="block")
+loading_gif.style.display="none";},1000);}
+else
+{if(!TrophyIM.autoConnection.connect)
+{TrophyIM.autoConnection.connect=true;TrophyIM.load();}
+else
+{if(TrophyIM.statusConn.connected)
+{if(loadscript.getStatusMessage()!="")
+{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_type));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(loadscript.getStatusMessage()));TrophyIM.connection.send(_presence.tree());presence_chatRoom=_type;}
+else
+{TrophyIM.connection.send($pres().c('show').t(_type).tree());presence_chatRoom=_type;}}}}}
+else
+{var _show="available";var _status="";if(arguments.length<2)
+{if(loadscript.getStatusMessage()!="")
+_status=prompt(i18n.TYPE_YOUR_MSG,loadscript.getStatusMessage());else
+_status=prompt(i18n.TYPE_YOUR_MSG);var _divStatus=document.getElementById("JabberIMStatusMessage");if((_status=_status.replace(/^\s+|\s+$|^\n|\n$/g,""))!="")
+_divStatus.firstChild.innerHTML="( "+_status+" )";}
+else
+{_status=arguments[1];}
+for(var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence)
+{if(TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].constructor==Function)
+continue;if(TROPHYIM_RESOURCE===("/"+resource))
+_show=TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show;}
+if(TrophyIM.statusConn.connected)
+{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_show));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(_status));TrophyIM.connection.send(_presence.tree());presence_chatRoom=_show;}}
+if(TrophyIM.activeChatRoom.name.length>0)
+{for(i=0;i<TrophyIM.activeChatRoom.name.length;i++)
+{if(TrophyIM.activeChatRoom.name[i]!="")
+TrophyIM.connection.send($pres({to:TrophyIM.activeChatRoom.name[i]}).c('show').t(presence_chatRoom));}}},sendMessage:function()
+{if(arguments.length>0)
+{var jidTo=arguments[0];var message_input=arguments[1];message_input=message_input.replace(/^\s+|\s+$|^\n|\n$/g,"");if(message_input!=""){var newMessage=$msg({to:jidTo,from:TrophyIM.connection.jid,type:'chat'});newMessage=newMessage.c('body').t(message_input);newMessage.up();newMessage=newMessage.c('active').attrs({xmlns:'http://jabber.org/protocol/chatstates'});TrophyIM.connection.send(newMessage.tree());return true;}}
+return false;},sendMessageChatRoom:function()
+{if(arguments.length>0)
+{var room_nick=arguments[0];var message=arguments[1];var msgid=TrophyIM.connection.getUniqueId();var msg=$msg({to:room_nick,type:"groupchat",id:msgid}).c("body",{xmlns:Strophe.NS.CLIENT}).t(message);msg.up();TrophyIM.connection.send(msg);return true;}},sendContentMessage:function()
+{if(arguments.length>0)
+{var jidTo=arguments[0];var state=arguments[1];var newMessage=$msg({to:jidTo,from:TrophyIM.connection.jid,type:'chat'});newMessage=newMessage.c(state).attrs({xmlns:'http://jabber.org/protocol/chatstates'});TrophyIM.connection.send(newMessage.tree());}}};function TrophyIMRoster()
+{if(TrophyIM.JSONStore.store_working)
+{var data=TrophyIM.JSONStore.getData(['roster','groups']);this.roster=(data['roster']!=null)?data['roster']:{};this.groups=(data['groups']!=null)?data['groups']:{};}
+else
+{this.roster={};this.groups={};}
+this.changes=new Array();if(TrophyIM.constants.stale_roster)
+{for(var jid in this.roster)
+{this.changes[this.changes.length]=jid;}}
+this.addChange=function(jid)
+{for(var c=0;c<this.changes.length;c++)
+{if(this.changes[c]==jid)
+{return;}}
+this.changes[this.changes.length]=jid;this.changes.sort();}
+this.addContact=function(jid,subscription,name,groups)
+{if(subscription==="remove")
+{this.removeContact(jid);}
+else
+{var contact={jid:jid,subscription:subscription,name:name,groups:groups}
+var jid_lower=jid.toLowerCase();if(this.roster[jid_lower])
+{this.roster[jid_lower]['contact']=contact;}
+else
+{this.roster[jid_lower]={contact:contact};}
+groups=groups?groups:[''];for(var g=0;g<groups.length;g++)
+{if(!this.groups[groups[g]])
+{this.groups[groups[g]]={};}
+this.groups[groups[g]][jid_lower]=jid_lower;}}}
+this.getContact=function(jid)
+{if(this.roster[jid.toLowerCase()])
+{return this.roster[jid.toLowerCase()]['contact'];}}
+this.getPresence=function(fulljid)
+{var jid=Strophe.getBareJidFromJid(fulljid);var current=null;if(this.roster[jid.toLowerCase()]&&this.roster[jid.toLowerCase()]['presence'])
+{for(var resource in this.roster[jid.toLowerCase()]['presence'])
+{if(this.roster[jid.toLowerCase()]['presence'][resource].constructor==Function)
+continue;var presence=this.roster[jid.toLowerCase()]['presence'][resource];if(current==null)
+{current=presence}
+else
+{if(presence['priority']>current['priority']&&((presence['show']=="chat"
+||presence['show']=="available")||(current['show']!="chat"||current['show']!="available")))
+{current=presence}}}}
+return current;}
+this.groupHasChanges=function(group)
+{for(var c=0;c<this.changes.length;c++)
+{if(this.groups[group][this.changes[c]])
+{return true;}}
+return false;}
+this.removeContact=function(jid)
+{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]])
+{if(this.groups[groups[i]][contact].constructor==Function)
+continue;contacts++;}
+if(!contacts)
+delete this.groups[groups[i]];}}
+if(this.roster[jid])
+delete this.roster[jid];}}
+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'||show!=='error')
+{if(!this.roster[jid_lower])
+{this.addContact(barejid,'not-in-roster');}
+var presence={resource:resource,priority:priority,show:show,status:status}
+if(!this.roster[jid_lower]['presence'])
+{this.roster[jid_lower]['presence']={};}
+this.roster[jid_lower]['presence'][resource]=presence;}}
+this.save=function()
+{if(TrophyIM.JSONStore.store_working)
+{TrophyIM.JSONStore.setData({roster:this.roster,groups:this.groups,active_chat:TrophyIM.activeChats['current'],chat_history:TrophyIM.chatHistory});}}}
+function TrophyIMJSONStore(){this.store_working=false;this._newXHR=function(handler){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType("text/xml");}}else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
+return xhr;}
+this.getData=function(vars){if(typeof(TROPHYIM_JSON_STORE)!=undefined){Strophe.debug("Retrieving JSONStore data");var xhr=this._newXHR();var getdata="get="+vars.join(",");try{xhr.open("POST",TROPHYIM_JSON_STORE,false);}catch(e){Strophe.error("JSONStore open failed.");return false;}
+xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Content-length',getdata.length);xhr.send(getdata);if(xhr.readyState==4&&xhr.status==200){try{var dataObj=JSON.parse(xhr.responseText);return this.emptyFix(dataObj);}catch(e){Strophe.error("Could not parse JSONStore response"+
+xhr.responseText);return false;}}else{Strophe.error("JSONStore open failed. Status: "+xhr.status);return false;}}}
+this.emptyFix=function(obj){if(typeof(obj)=="object"){for(var i in obj){if(obj[i].constructor==Function)
+continue;if(i=='_empty_'){obj[""]=this.emptyFix(obj['_empty_']);delete obj['_empty_'];}else{obj[i]=this.emptyFix(obj[i]);}}}
+return obj}
+this.delData=function(vars){if(typeof(TROPHYIM_JSON_STORE)!=undefined){Strophe.debug("Retrieving JSONStore data");var xhr=this._newXHR();var deldata="del="+vars.join(",");try{xhr.open("POST",TROPHYIM_JSON_STORE,false);}catch(e){Strophe.error("JSONStore open failed.");return false;}
+xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Content-length',deldata.length);xhr.send(deldata);if(xhr.readyState==4&&xhr.status==200){try{var dataObj=JSON.parse(xhr.responseText);return dataObj;}catch(e){Strophe.error("Could not parse JSONStore response");return false;}}else{Strophe.error("JSONStore open failed. Status: "+xhr.status);return false;}}}
+this.setData=function(vars)
+{if(typeof(TROPHYIM_JSON_STORE)!=undefined)
+{var senddata="set="+JSON.stringify(vars);var xhr=this._newXHR();try
+{xhr.open("POST",TROPHYIM_JSON_STORE,false);}
+catch(e)
+{Strophe.error("JSONStore open failed.");return false;}
+xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Content-length',senddata.length);xhr.send(senddata);if(xhr.readyState==4&&xhr.status==200&&xhr.responseText=="OK"){return true;}else{Strophe.error("JSONStore open failed. Status: "+xhr.status);return false;}}}
+var testData=true;if(this.setData({testData:testData})){var testResult=this.getData(['testData']);if(testResult&&testResult['testData']==true){this.store_working=true;}}}
+if(document.ELEMENT_NODE==null){document.ELEMENT_NODE=1;document.ATTRIBUTE_NODE=2;document.TEXT_NODE=3;document.CDATA_SECTION_NODE=4;document.ENTITY_REFERENCE_NODE=5;document.ENTITY_NODE=6;document.PROCESSING_INSTRUCTION_NODE=7;document.COMMENT_NODE=8;document.DOCUMENT_NODE=9;document.DOCUMENT_TYPE_NODE=10;document.DOCUMENT_FRAGMENT_NODE=11;document.NOTATION_NODE=12;}
+if(!document.importNode){document.importNode=function(node,allChildren){switch(node.nodeType){case document.ELEMENT_NODE:var newNode=document.createElement(node.nodeName);if(node.attributes&&node.attributes.length>0){for(var i=0;i<node.attributes.length;i++){newNode.setAttribute(node.attributes[i].nodeName,node.getAttribute(node.attributes[i].nodeName));}}
+if(allChildren&&node.childNodes&&node.childNodes.length>0){for(var i=0;i<node.childNodes.length;i++){newNode.appendChild(document.importNode(node.childNodes[i],allChildren));}}
+return newNode;break;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(node.nodeValue);break;}};}
+var oldonunload=window.onunload;window.onunload=function()
+{if(oldonunload)
+{oldonunload();}
+TrophyIM.setPresence('unavailable');}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 4453)
@@ -0,0 +1,44 @@
+
+/**
+* @author [SERPRO] emmanuel.ferro@gmail.com
+* 
+* Contém as mensagens traduzíveis.
+*/
+
+i18n =
+{
+	ADD : 'Adicionar',
+	ADD_CONTACT : 'Adicionar Contatos',
+	ADD_CONTACTS : 'Adicionar Contatos',
+	ASK_NEW_NAME_QUESTION : 'Informe um novo nome para ',
+	ASK_NEW_GROUP_QUESTION : 'Informe um novo grupo ou deixe em branco',
+	ASK_FOR_AUTH : 'PEDIR AUTORIZAÇÃO !',
+	AUTHORIZED : 'AUTORIZADO !',
+	AUTH_SENT : 'AUTORIZAÇÃO ENVIADA !',
+	ASK_FOR_AUTH_QUESTION : 'QUERO ADICIONÁ-LO(A) ! POSSO ?',
+	CLOSE : 'Fechar',
+	COMPOSING : ' está digitando...',
+	CONTACT_ASK_FOR_AUTH : 'CONTATO PEDE AUTORIZAÇÃO !',
+	GONE : ' saiu da conversa.',
+	GROUP : 'Grupo',
+	INACTIVE : ' está inativo.',
+	LEAVE_CHATROOM : 'Sair da Sala',
+	LOAD : 'Carregando',
+	MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH : 'Muitos Resultados ! Por favor tente refinar sua busca !',
+	ME : 'Eu',
+	NAME_CONTACT : 'Nome do Contato',
+	NEW_USER : 'Novo Usuário',
+	NONE_RESULT_WAS_FOUND : 'Nenhum resultado encontrado !',
+	PAUSED : ' está parado.',
+        ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY : 'Não é permitido a criação de salas',
+	SEND : 'Enviar',
+	SEARCH_RESULT : 'Resulta da busca',
+	SEARCH_USERS : 'Procurar contatos',
+	STATUS_ANAVAILABLE : 'Desconectado',
+	STATUS_AVAILABLE : 'Disponível',
+	STATUS_ANAVAILABLE : 'Desconectado',
+	TRY_AGAIN: 'Tente Novamente!',
+	TYPE_YOUR_MESSAGE_HERE_STATUS : 'Digite aqui sua mensagem de Status',
+	TYPE_YOUR_MSG : 'Digite sua mensagem !!!',
+	YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS : 'Sua busca precisa ter mais que 3 dígitos'
+};
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_es.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_es.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_es.js	(revision 4453)
@@ -0,0 +1,43 @@
+
+/**
+* @author [SERPRO] emmanuel.ferro@gmail.com
+* 
+* Contém as mensagens traduzíveis.
+*/
+
+i18n =
+{
+	ADD : 'Agregar',
+	ADD_CONTACT : 'Agregar Contactos',
+	ADD_CONTACTS : 'Agregar Contactos',
+	ASK_NEW_NAME_QUESTION : 'Informe un nuevo nombre para ',
+	ASK_NEW_GROUP_QUESTION : 'Informe un nuevo grupo o deje en blanco',
+	ASK_FOR_AUTH : 'PEDIR AUTORIZACION !',
+	AUTHORIZED : 'AUTORIZADO !',
+	AUTH_SENT : 'AUTORIZACION ENVIADA !',
+	ASK_FOR_AUTH_QUESTION : 'QUEIRO AGREGARLO(A) ! PUEDO ?',
+	CLOSE : 'Cerrar',
+	COMPOSING : ' está escribiendo...',
+	CONTACT_ASK_FOR_AUTH : 'CONTACTO PIDE AUTORIZACION !',
+	GONE : ' salio de la conversación.',
+	GROUP : 'Grupo',
+	INACTIVE : ' está inactivo.',
+	LEAVE_CHATROOM : 'Salir  de la Sala',
+	LOAD : 'Cargando',
+	MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH : 'Muchos Resultados ! Por favor intente refinar su busqueda !',
+	ME : 'Yo',
+	NAME_CONTACT : 'Nombre do Contacto',
+	NEW_USER : 'Nuevo Usuario',
+	NONE_RESULT_WAS_FOUND : 'Ningun resultado encontrado !',
+	PAUSED : ' está parado.',
+	SEND : 'Enviar',
+	SEARCH_RESULT : 'Resultado  de la busqueda',
+	SEARCH_USERS : 'Buscar Contactos',
+	STATUS_ANAVAILABLE : 'Desconectado',
+	STATUS_AVAILABLE : 'Disponible',
+	STATUS_ANAVAILABLE : 'Desconectado',
+	TRY_AGAIN: 'Intente Nuevamente!',
+	TYPE_YOUR_MESSAGE_HERE_STATUS : 'Escriba aqui su Status',
+	TYPE_YOUR_MSG : 'Escriba su mensaje !!!',
+	YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS : 'Su  busqueda requiere tener mas que 3 dígitos'
+
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 4453)
@@ -0,0 +1,1 @@
+i18n={ADD:'Adicionar',ADD_CONTACT:'Adicionar Contatos',ADD_CONTACTS:'Adicionar Contatos',ASK_NEW_NAME_QUESTION:'Informe um novo nome para ',ASK_NEW_GROUP_QUESTION:'Informe um novo grupo ou deixe em branco',ASK_FOR_AUTH:'PEDIR AUTORIZAÇÃO !',AUTHORIZED:'AUTORIZADO !',AUTH_SENT:'AUTORIZAÇÃO ENVIADA !',ASK_FOR_AUTH_QUESTION:'QUERO ADICIONÁ-LO(A) ! POSSO ?',CLOSE:'Fechar',COMPOSING:' está digitando...',CONTACT_ASK_FOR_AUTH:'CONTATO PEDE AUTORIZAÇÃO !',GONE:' saiu da conversa.',GROUP:'Grupo',INACTIVE:' está inativo.',LEAVE_CHATROOM:'Sair da Sala',LOAD:'Carregando',MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH:'Muitos Resultados ! Por favor tente refinar sua busca !',ME:'Eu',NAME_CONTACT:'Nome do Contato',NEW_USER:'Novo Usuário',NONE_RESULT_WAS_FOUND:'Nenhum resultado encontrado !',PAUSED:' está parado.',ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY:'Não é permitido a criação de salas',SEND:'Enviar',SEARCH_RESULT:'Resulta da busca',SEARCH_USERS:'Procurar contatos',STATUS_ANAVAILABLE:'Desconectado',STATUS_AVAILABLE:'Disponível',STATUS_ANAVAILABLE:'Desconectado',TRY_AGAIN:'Tente Novamente!',TYPE_YOUR_MESSAGE_HERE_STATUS:'Digite aqui sua mensagem de Status',TYPE_YOUR_MSG:'Digite sua mensagem !!!',YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS:'Sua busca precisa ter mais que 3 dígitos'};
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim_constants.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim_constants.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim_constants.js	(revision 4453)
@@ -0,0 +1,11 @@
+var TROPHYIM_BOSH_SERVICE	= "/proxy/ejabberd";  //Change to suit
+
+var TROPHYIM_LOG_LINES		= 200;
+
+var TROPHYIM_LOGLEVEL		= 0; //0=debug, 1=info, 2=warn, 3=error, 4=fatal 
+
+var TROPHYIM_VERSION 		= "0.3";
+
+var TROPHYIM_RESOURCE		= "/JABBERITWEB";
+
+var TROPHYIM_CHATROOM		= "conference.im.pr.gov.br";
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/SelectEditable.js	(revision 4453)
@@ -0,0 +1,196 @@
+(function()
+{
+	//Load Images
+	var arrowImage		 = path_jabberit + 'templates/default/images/select_arrow.gif';				// Regular arrow
+	var arrowImageOver	 = path_jabberit + 'templates/default/images/select_arrow_over.gif';		// Mouse over
+	var arrowImageDown	 = path_jabberit + 'templates/default/images/select_arrow_down.gif';		// Mouse down
+
+	var activeOption;
+	var selectBoxIds = 0;
+	var currentlyOpenedOptionBox = false;
+	var editableSelect_activeArrow = false;
+	
+	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 createEditableSelect()
+	{
+		var dest 	= "";
+		var _left	= "";
+		var _top	= "";
+		
+		if( arguments.length > 0 )
+		{
+			dest 	= arguments[0];
+			_top	= arguments[1];
+			_left	= arguments[2];			
+		}
+		else
+		{
+			return false;
+		}
+
+		dest.className='selectBoxInput';
+		
+		var div = document.createElement('DIV');
+		div.id	= 'selectBox' + selectBoxIds;
+		div.style.top		= _top + "px";
+		div.style.left		= _left + "px";
+		div.style.width		= dest.offsetWidth;
+		div.style.position	= 'absolute';
+		
+		var parent = dest.parentNode;
+		parent.insertBefore(div,dest);
+
+		div.appendChild(dest);	
+		div.className='selectBox';
+		
+		var img = document.createElement('IMG');
+		img.src = arrowImage;
+		img.className = 'selectBoxArrow';
+		
+		img.onclick = selectBox_showOptions;
+		img.id = 'arrowSelectBox' + selectBoxIds;
+
+		div.appendChild(img);
+		
+		var optionDiv = document.createElement('DIV');
+			optionDiv.id = 'selectBoxOptions' + selectBoxIds;
+			optionDiv.className='selectBoxOptionContainer';
+			optionDiv.style.width = div.offsetWidth-2 + 'px';
+		
+		div.appendChild(optionDiv);
+		
+		if(dest.getAttribute('selectBoxOptions'))
+		{
+			var options = dest.getAttribute('selectBoxOptions').split(';');
+			var optionsTotalHeight = 0;
+			var optionArray = new Array();
+			for(var no = 0 ; no < options.length ; no++)
+			{
+				var anOption = document.createElement('DIV');
+					anOption.innerHTML = options[no];
+					anOption.className='selectBoxAnOption';
+					anOption.onclick = selectOptionValue;
+					anOption.style.width = optionDiv.style.width.replace('px','') - 2 + 'px'; 
+					anOption.onmouseover = highlightSelectBoxOption;
+					
+				
+				optionDiv.appendChild(anOption);	
+				optionsTotalHeight = optionsTotalHeight + anOption.offsetHeight;
+				optionArray.push(anOption);
+			}
+		
+			if(optionsTotalHeight > optionDiv.offsetHeight)
+			{				
+				for(var no = 0; no < optionArray.length ; no++)
+				{
+					optionArray[no].style.width = optionDiv.style.width.replace('px','') - 22 + 'px';
+				} 	
+			}		
+			
+			optionDiv.style.display		= 'none';
+			optionDiv.style.visibility	= 'visible';
+			optionDiv.style.zIndex 		= loadscript.getZIndex();
+		}
+
+		configEvents(dest,
+					'onkeydown',
+					function(e)
+					{
+						switch(e.keyCode)
+						{
+							case 13:
+							case 27:							
+								dest.value = dest.value;
+						        dest.focus();
+        						dest.select();
+    							break;
+						}
+					});
+					
+		configEvents(dest,
+					 'onclick',
+					 function(e)
+					 {	
+						dest.value = dest.value;
+						dest.focus();
+        				dest.select();
+						document.getElementById('selectBoxOptions0').style.display='none';
+						document.getElementById('arrowSelectBox0').src = arrowImageOver;														
+					 });		
+	}
+
+	function highlightSelectBoxOption()
+	{
+		if( this.style.backgroundColor == '#316AC5' )
+		{
+			this.style.backgroundColor = '';
+			this.style.color = '';
+		}
+		else
+		{
+			this.style.backgroundColor = '#316AC5';
+			this.style.color = '#FFF';			
+		}	
+		
+		if( activeOption )
+		{
+			activeOption.style.backgroundColor='';
+			activeOption.style.color='';			
+		}
+		activeOption = this;
+	}
+
+	function selectOptionValue()
+	{
+		var parentNode = this.parentNode.parentNode;
+		var textInput = parentNode.getElementsByTagName('INPUT')[0];
+		textInput.value = this.innerHTML;
+		this.parentNode.style.display='none';
+		document.getElementById('arrowSelectBox' + parentNode.id.replace(/[^\d]/g,'')).src = arrowImageOver;
+	}
+
+	function selectBox_showOptions()
+	{
+		if( editableSelect_activeArrow && editableSelect_activeArrow!=this )
+			editableSelect_activeArrow.src = arrowImage;
+
+		editableSelect_activeArrow = this;
+		
+		var numId = this.id.replace(/[^\d]/g,'');
+		var optionDiv = document.getElementById('selectBoxOptions' + numId);
+		if(optionDiv.style.display=='block')
+		{
+			optionDiv.style.display='none';
+			this.src = arrowImageOver;	
+		}
+		else
+		{			
+			optionDiv.style.display='block';
+			this.src = arrowImageDown;	
+			
+			if( currentlyOpenedOptionBox && currentlyOpenedOptionBox!=optionDiv)
+				currentlyOpenedOptionBox.style.display='none';	
+			
+			currentlyOpenedOptionBox= optionDiv;			
+		}
+	}
+
+	function SelectEditable(){}
+	
+	SelectEditable.prototype.create = createEditableSelect;
+	window.SelectEditable			= SelectEditable;
+		
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/trophyim.js	(revision 4453)
@@ -0,0 +1,2639 @@
+/** Object: DOMObjects
+ *  This class contains builders for all the DOM objects needed by TrophyIM
+ */
+DOMObjects = {
+    /** Function: xmlParse
+     *  Cross-browser alternative to using innerHTML
+     *  Parses given string, returns valid DOM HTML object
+     *
+     *  Parameters:
+     *    (String) xml - the xml string to parse
+     */
+    xmlParse : function(xmlString) {
+        var xmlObj = this.xmlRender(xmlString);
+        if(xmlObj) {
+            try { //Firefox, Gecko, etc
+                if (this.processor == undefined) {
+                    this.processor = new XSLTProcessor();
+                    this.processor.importStylesheet(this.xmlRender(
+                    '<xsl:stylesheet version="1.0"\
+                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\
+                    <xsl:output method="html" indent="yes"/><xsl:template\
+                    match="@*|node()"><xsl:copy><xsl:copy-of\
+                    select="@*|node()"/></xsl:copy></xsl:template>\
+                    </xsl:stylesheet>'));
+                }
+                var htmlObj =
+                this.processor.transformToDocument(xmlObj).documentElement;
+                //Safari has a quirk where it wraps dom elements in <html><body>
+                if (htmlObj.tagName.toLowerCase() == 'html') {
+                    htmlObj = htmlObj.firstChild.firstChild;
+                }
+                return document.importNode(htmlObj, true);
+            } catch(e) {
+                try { //IE is so very very special
+                    var htmlObj = document.importNode(xmlObj.documentElement, true);
+                    if (htmlObj.tagName.toLowerCase() == "div") {
+                        var div_wrapper = document.createElement('div');
+                        div_wrapper.appendChild(htmlObj);
+                        if(div_wrapper.innerHTML) {
+                            div_wrapper.innerHTML = div_wrapper.innerHTML;
+                        }
+                        htmlObj = div_wrapper.firstChild;
+                    }
+                    return htmlObj;
+                } catch(e) {
+                    alert("TrophyIM Error: Cannot add html to page " + e.message);
+                }
+            }
+        }
+    },
+    /** Function: xmlRender
+     *  Uses browser-specific methods to turn given string into xml object
+     *
+     *  Parameters:
+     *    (String) xml - the xml string to parse
+     */
+    xmlRender : function(xmlString) {
+        try {//IE
+            var renderObj = new ActiveXObject("Microsoft.XMLDOM");
+            renderObj.async="false";
+            if(xmlString) {
+                renderObj.loadXML(xmlString);
+            }
+        } catch (e) {
+            try { //Firefox, Gecko, etc
+                if (this.parser == undefined) {
+                    this.parser = new DOMParser();
+                }
+                var renderObj = this.parser.parseFromString(xmlString,
+                "application/xml");
+            } catch(e) {
+                alert("TrophyIM Error: Cannot create new html for page");
+            }
+        }
+
+        return renderObj;
+    },
+    /** Function: getHTML
+     *  Returns named HTML snippet as DOM object
+     *
+     *  Parameters:
+     *    (String) name - name of HTML snippet to retrieve (see HTMLSnippets
+     *    object)
+     */
+    getHTML : function(page)
+	{
+        return this.xmlParse(HTMLSnippets[page]);
+    },
+	
+    /** Function: getScript
+     *  Returns script object with src to given script
+     *
+     *  Parameters:
+     *    (String) script - name of script to put in src attribute of script
+     *    element
+     */
+    getScript : function(script)
+	{
+        var newscript = document.createElement('script');
+        newscript.setAttribute('src', script);
+        newscript.setAttribute('type', 'text/javascript');
+        return newscript;
+    }
+};
+
+/** Object: TrophyIM
+ *
+ *  This is the actual TrophyIM application.  It searches for the
+ *  'trophyimclient' element and inserts itself into that.
+ */
+TrophyIM = {
+		
+
+	controll : {notificationNewUsers : 0},	
+    
+	/** AutoConnection
+	* 
+	*/	
+		
+	autoConnection : {connect : true},
+
+	/** Active Chat Room
+	 * 
+	 */
+	
+	activeChatRoom : {name : []},
+	
+	/** Object: chatHistory
+    *
+    *  Stores chat history (last 10 message) and current presence of active
+    *  chat tabs.  Indexed by jid.
+    */
+	
+	chatHistory : {},
+	
+	/** Constants:
+    *
+    *    (Boolean) stale_roster - roster is stale and needs to be rewritten.
+    */
+	
+	constants : {stale_roster: false},
+	
+	/** PosWindow
+	 * 
+	 */	
+	posWindow : {left : 400, top : 100},	
+		
+	/** StatusConnection
+	 * 
+	 */
+
+	statusConn : {connected : false},
+	
+	/** TimeOut Render Roster
+	 * 
+	 * 
+	 */
+	
+	_timeOut : {renderRoster : null},
+	
+	
+	/** Remove Contact ( type = set )
+	 * 
+	 * 
+	 */
+	
+	removeResult : {idResult : []},
+	
+     /** Function: setCookie
+     *
+     *  Sets cookie name/value pair.  Date and path are auto-selected.
+     *
+     *  Parameters:
+     *    (String) name - the name of the cookie variable
+     *    (String) value - the value of the cookie variable
+     */
+    
+	setCookie : function(name, value)
+	{
+        var expire = new Date();
+        expire.setDate(expire.getDate() + 365);
+        document.cookie = name + "=" + value + "; expires=" + expire.toGMTString();
+    },
+    
+	/** Function: delCookie
+     *
+     *  Deletes cookie
+     *
+     *  Parameters:
+     *    (String) name) - the name of the cookie to delete
+     */
+    
+	delCookie : function(name)
+	{
+        var expire = new Date();
+        expire.setDate(expire.getDate() - 365);
+        document.cookie = name + "= ; expires=" + expire.toGMTString();
+        delete TrophyIM.cookies[name];
+    },
+    
+	/** Function: getCookies
+     *
+     *  Retrieves all trophyim cookies into an indexed object.  Inteneded to be
+     *  called once, at which time the app refers to the returned object instead
+     *  of re-parsing the cookie string every time.
+     *
+     *  Each cookie is also re-applied so as to refresh the expiry date.
+     */
+    
+	getCookies : function()
+	{
+        var cObj = {};
+        var cookies = document.cookie.split(';');
+        
+        for(var i = 0 ; i < cookies.length; i++ )
+        {
+        	while ( cookies[i].charAt(0) == ' ')
+            { 
+                cookies[i] = cookies[i].substring(1,cookies[i].length);
+            }
+        	
+            if (cookies[i].substr(0, 8) == "trophyim")
+            {
+                var nvpair = cookies[i].split("=", 2);
+                cObj[nvpair[0]] = nvpair[1];
+                TrophyIM.setCookie(nvpair[0], nvpair[1]);
+            }
+        }
+        
+        return cObj;
+    },
+	
+    /** Function: load
+     *
+     *  This function searches for the trophyimclient div and loads the client
+     *  into it.
+     */
+
+	load : function()
+	{
+    	if( loadscript.getUserCurrent() == null )
+        {
+        	loadscript.setUserCurrent();	 
+        }	 
+
+    	if ( !TrophyIM.statusConn.connected )
+		{
+			TrophyIM.cookies = TrophyIM.getCookies();
+
+			//Wait a second to give scripts time to load
+			setTimeout( "TrophyIM.showLogin()", 550 );
+		}
+		else
+		{
+			loadscript.rosterDiv();
+		}
+   },
+
+   /** Function: storeData
+     *
+     *  Store all our data in the JSONStore, if it is active
+     */
+     
+   storeData : function()
+   {
+        if ( TrophyIM.connection && TrophyIM.connection.connected )
+		{
+            TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" +
+            TrophyIM.connection.sid + "|" +  TrophyIM.connection.rid);
+            TrophyIM.rosterObj.save();
+        }
+    },
+    
+    /**  Function: showlogin
+     *
+     *   This function clears out the IM box and either redisplays the login
+     *   page, or re-attaches to Strophe, preserving the logging div if it
+     *   exists, or creating a new one of we are re-attaching.
+     */
+     
+    showLogin : function()
+	{
+        /**
+         * 
+         * JSON is the last script to load, so we wait on it
+		 * Added Strophe check too because of bug where it's sometimes missing
+		 * 
+		 */
+
+		if ( typeof(JSON) != undefined && typeof(Strophe) != undefined )
+        {
+        	TrophyIM.JSONStore = new TrophyIMJSONStore();
+        	
+			if ( TrophyIM.JSONStore.store_working && TrophyIM.cookies['trophyim_bosh_xid'] )
+            {
+            	var xids = TrophyIM.cookies['trophyim_bosh_xid'].split("|");
+                TrophyIM.delCookie('trophyim_bosh_xid');
+                TrophyIM.constants.stale_roster = true;
+    			
+				TrophyIM.connection				= new Strophe.Connection(TROPHYIM_BOSH_SERVICE);
+                TrophyIM.connection.rawInput	= TrophyIM.rawInput;
+                TrophyIM.connection.rawOutput	= TrophyIM.rawOutput;
+                //Strophe.log = TrophyIM.log;
+                Strophe.info('Attempting Strophe attach.');
+                TrophyIM.connection.attach(xids[0], xids[1], xids[2], TrophyIM.onConnect);
+                TrophyIM.onConnect(Strophe.Status.CONNECTED);
+            }
+            else
+            {
+            	// List Contact
+				loadscript.rosterDiv();
+
+				// Get User Current;
+				var _getUserCurrent = null;
+					_getUserCurrent = loadscript.getUserCurrent();
+				
+				if( _getUserCurrent == null )
+				{	
+					setTimeout( "TrophyIM.showLogin()", 500 );
+				}
+				else
+				{
+					TrophyIM.login( Base64.decode( _getUserCurrent.jid ), Base64.decode( _getUserCurrent.password ));
+				}
+            }
+        }
+        else
+        {
+        	setTimeout("TrophyIM.showLogin()", 500);
+        }
+    },
+    
+	/** Function: log
+     *
+     *  This function logs the given message in the trophyimlog div
+     *
+     *  Parameter: (String) msg - the message to log
+     */
+    
+    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 );
+            }
+            
+            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;
+        }
+    },
+	
+    /** Function: rawInput
+     *
+     *  This logs the packets actually recieved by strophe at the debug level
+     */
+    rawInput : function (data)
+	{
+        Strophe.debug("RECV: " + data);
+    },
+	
+    /** Function: rawInput
+     *
+     *  This logs the packets actually recieved by strophe at the debug level
+     */
+    rawOutput : function (data)
+	{
+        Strophe.debug("SEND: " + data);
+    },
+	
+    /** Function: login
+     *
+     *  This function logs into server using information given on login page.
+     *  Since the login page is where the logging checkbox is, it makes or
+     *  removes the logging div and cookie accordingly.
+     *
+     */
+    login : function()
+	{
+		if ( TrophyIM.JSONStore.store_working )
+		{ 
+		   //In case they never logged out
+            TrophyIM.JSONStore.delData(['groups','roster', 'active_chat', 'chat_history']);
+        }
+
+		TrophyIM.connection				= new Strophe.Connection(TROPHYIM_BOSH_SERVICE);
+        TrophyIM.connection.rawInput	= TrophyIM.rawInput;
+        TrophyIM.connection.rawOutput	= TrophyIM.rawOutput;
+        //Strophe.log 					= TrophyIM.log;
+        
+		if ( arguments.length > 0 )
+		{
+			var barejid = arguments[0];
+			var password = arguments[1];
+			
+			TrophyIM.connection.connect( barejid + TROPHYIM_RESOURCE, password, TrophyIM.onConnect );
+		}
+		else
+		{
+			
+			var barejid		= document.getElementById('trophyimjid').value
+			var fulljid		= barejid + TROPHYIM_RESOURCE;
+			var password	= document.getElementById('trophyimpass').value;
+			var button		= document.getElementById('trophyimconnect');
+			
+			loadscript.setUserCurrent( barejid, password);
+			
+			if ( button.value == 'connect' )
+			{
+				button.value = 'disconnect';
+				//TrophyIM.connection.connect( fulljid , password, TrophyIM.onConnect );
+				
+				TrophyIM.login( barejid, password );
+				_winBuild('window_login_page', 'remove');
+			}
+		}
+
+		TrophyIM.setCookie('trophyimjid', barejid);
+    },
+	
+    /** Function: logout
+     *
+     *  Logs into fresh session through Strophe, purging any old data.
+     */
+    logout : function()
+	{
+    	TrophyIM.autoConnection.connect = false;
+    	
+    	TrophyIM.delCookie('trophyim_bosh_xid');
+        
+        delete TrophyIM['cookies']['trophyim_bosh_xid'];
+        
+        TrophyIM.connection.disconnect();
+    },
+	
+    /** Function onConnect
+     *
+     *  Callback given to Strophe upon connection to BOSH proxy.
+     */
+    onConnect : function(status)
+	{
+    	var loading_gif = document.getElementById("JabberIMRosterLoadingGif");
+		
+    	if( status == Strophe.Status.CONNECTING )
+		{
+    		loading_gif.style.display = "block";
+    		Strophe.info('Strophe is connecting.');
+        }
+		
+		if( status == Strophe.Status.CONNFAIL )
+		{
+			TrophyIM.delCookie('trophyim_bosh_xid');
+            TrophyIM.statusConn.connected = false;
+            loading_gif.style.display = "block";
+        }
+		
+		if( status == Strophe.Status.DISCONNECTING )
+		{
+			TrophyIM.statusConn.connected = false;
+        }
+		
+		if( status == Strophe.Status.DISCONNECTED )
+		{
+			if( TrophyIM.autoConnection.connect )
+			{
+				loading_gif.style.display = "block";
+				
+				TrophyIM.delCookie('trophyim_bosh_xid');
+	            
+	            TrophyIM.statusConn.connected = false;
+	            
+				setTimeout(function()
+				{
+		            TrophyIM.showLogin();
+		            
+				},10000);
+				
+	            loadscript.clrAllContacts();	
+	            
+	            loadscript.setStatusJabber(i18n.STATUS_ANAVAILABLE,"unavailable");
+	            
+	            delete TrophyIM.rosterObj.roster;
+	            delete TrophyIM.rosterObj.groups;
+			}
+        }
+		
+		if( status == Strophe.Status.CONNECTED )
+		{
+			loadscript.setStatusJabber(i18n.STATUS_AVAILABLE,'available');
+			TrophyIM.statusConn.connected = true;
+            TrophyIM.showClient();
+        }
+    },
+
+    /** Function: showClient
+     *
+     *  This clears out the main div and puts in the main client.  It also
+     *  registers all the handlers for Strophe to call in the client.
+     */
+    showClient : function()
+	{
+        TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" +
+        TrophyIM.connection.sid + "|" +  TrophyIM.connection.rid);
+		
+        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);
+        
+		//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($pres().tree());
+		setTimeout( TrophyIM.renderRoster, 1000);
+    },
+	
+    /** Function: clearClient
+     *
+     *  Clears out client div, preserving and returning existing logging_div if
+     *  one exists
+     */
+     
+    clearClient : function()
+    {
+        if(TrophyIM.logging_div)
+        {
+            var logging_div = TrophyIM.client_div.removeChild(document.getElementById('trophyimlog'));
+        }
+        else
+        {
+            var logging_div = null;
+        }
+        
+        while(TrophyIM.client_div.childNodes.length > 0)
+        {
+            TrophyIM.client_div.removeChild(TrophyIM.client_div.firstChild);
+        }
+        
+        return logging_div;
+    },
+    
+    /** Function: onVersion
+     *
+     *  jabber:iq:version query handler
+     */
+     
+    onVersion : function(msg)
+    {
+        Strophe.debug("Version handler");
+        if (msg.getAttribute('type') == 'get')
+        {
+            var from = msg.getAttribute('from');
+            var to = msg.getAttribute('to');
+            var id = msg.getAttribute('id');
+            var reply = $iq({type: 'result', to: from, from: to, id: id}).c('query',
+            {name: "TrophyIM", version: TROPHYIM_VERSION, os:
+            "Javascript-capable browser"});
+            TrophyIM.connection.send(reply.tree());
+        }
+        return true;
+    },
+    
+    /** Function: onRoster
+     *
+     *  Roster iq handler
+     */
+    
+    onRoster : function(msg)
+	{
+    	var roster_items = msg.firstChild.getElementsByTagName('item');
+		
+		for (var i = 0; i < roster_items.length; i++)
+		{
+			with(roster_items[i])
+			{
+				var groups 		= getElementsByTagName('group');	
+				var group_array	= [];
+				
+				for( var g = 0 ; g < groups.length; g++ )
+				{
+					if( groups[g].hasChildNodes() )
+						group_array[group_array.length] = groups[g].firstChild.nodeValue;
+				}
+
+				if( getAttribute('ask') && getAttribute('ask').toString() === "subscribe" ) 
+				{
+					if( getAttribute('subscription').toString() === "none" )
+					{
+						TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array );
+					}
+					
+					if( getAttribute('subscription').toString() === "remove" )
+					{
+						TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() );
+					}
+				}
+				else
+				{
+					if( ( getAttribute('ask') == null && getAttribute('subscription').toString() === "remove" ) || getAttribute('subscription').toString() === "remove" )
+					{
+						TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() );
+					}
+					else
+					{
+						TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array );
+					}
+				}
+			}
+        }
+
+		if ( msg.getAttribute('type') == 'set' )
+		{
+			var _iq = $iq({type: 'reply', id: msg.getAttribute('id'), to: msg.getAttribute('from')});
+			TrophyIM.connection.send( _iq.tree());
+        }
+
+		return true;
+    },
+    
+    /** Function: onPresence
+     *
+     *  Presence Handler
+     */
+    
+    onPresence : function(msg)
+	{
+    	// Get Presences ChatRoom
+    	TrophyIM.onPresenceChatRoom( msg );
+
+    	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;
+
+    	if( msg.getAttribute('from').toString().indexOf( TROPHYIM_CHATROOM ) < 0 )
+    	{	
+			var _from = Strophe.getBareJidFromJid( msg.getAttribute('from') );
+			var _flag = true;
+
+    		if( TrophyIM.removeResult.idResult.length > 0 )
+    		{
+    			for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ )
+    			{
+    				if( TrophyIM.removeResult.idResult[i] == _from )
+    				{
+    					_flag = false;
+    					
+    					TrophyIM.removeResult.idResult.splice(i,1);
+    					
+    					i--;
+    					
+    					if( show.toLowerCase() === 'subscribe' )
+    						_flag = true;
+    				}
+    			}
+    		}
+    		
+    		if( _flag )
+    			TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status );
+        }
+
+    	return true;
+    },
+
+    /** Function : onPresenceChatRoom
+     * 
+     * Presence ChatRoom Handler
+     */
+    
+    onPresenceChatRoom : function(msg)
+    {
+        var xquery      = msg.getElementsByTagName("x");
+        var _error      = msg.getElementsByTagName("error");
+       
+       
+        if( _error.length > 0 )
+        {    
+            /* Room creation is denied by service policy;
+             *
+             *  <error code='403' type='auth'>
+             *      <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
+             *      <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Room creation is denied by service policy</text>
+             *  </error>       
+             */
+            
+            for ( var i = 0; i < _error.length; i++ )
+            {
+                if ( _error[i].getElementsByTagName("text") )
+                {    
+                    var _errorMsg = Strophe.getText( _error[i].getElementsByTagName("text")[0] );
+                    
+                    if( _errorMsg == "Room creation is denied by service policy" )
+                    {
+                        alert( i18n.ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY );
+                    }
+                    else
+                    {
+                        alert( " Informe ao seu Administrador ERRO : \n" + _errorMsg );
+                    }    
+                        
+                }
+            }
+        }
+        else
+        {
+            if ( xquery.length > 0 )
+            {
+                for ( var i = 0; i < xquery.length; i++ )
+                {
+                    var xmlns = xquery[i].getAttribute("xmlns");
+
+                    if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 )
+                    {
+                            var _from	= xquery[i].parentNode.getAttribute('from');
+                            var _to		= xquery[i].parentNode.getAttribute('to');
+
+                            // Get NameChatRoom
+                            var nameChatRoom	= Strophe.getBareJidFromJid( _from );
+
+                            // Get nickName
+                            var nickName		= Strophe.getResourceFromJid( _from );
+
+                            // Get Type/Show
+                            var type	= ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ;
+                            var show	= ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type;
+
+                            var _idElement = nameChatRoom + "_UserChatRoom__" + nickName;
+
+                            var _UserChatRoom					= document.createElement("div");
+                                    _UserChatRoom.id				= _idElement;
+                                    _UserChatRoom.style.paddingLeft = '18px';
+                                    _UserChatRoom.style.margin 		= '3px 0px 0px 2px';
+                                    _UserChatRoom.style.background	= 'url("'+path_jabberit+'templates/default/images/' + show + '.gif") no-repeat center left';
+                                    _UserChatRoom.appendChild( document.createTextNode( nickName ) );
+
+                            var nodeUser = document.getElementById( _idElement );	
+
+                            if( nodeUser == null )
+                            {
+                                    if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null )
+                                    {
+                                            nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
+                                            nameChatRoom.appendChild( _UserChatRoom );
+                                    }
+                                    else
+                                    {
+                                            if( type != 'unavailable' )
+                                            {
+                                                    TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@')));
+                                                    nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
+                                                    nameChatRoom.appendChild( _UserChatRoom );
+                                            }
+                                    }
+                            }
+                            else
+                            {
+                                    if( type == 'unavailable' )
+                                    {
+                                            nodeUser.parentNode.removeChild( nodeUser );
+                                    }
+                                    else if( show )
+                                    {
+                                            nodeUser.style.backgroundImage =  'url("'+path_jabberit+'templates/default/images/' + show + '.gif")';
+                                    }
+                            }
+                    }
+                }
+            }
+        }
+    },    
+    
+    /** Function: onMessage
+     *
+     *  Message handler
+     */
+    
+    onMessage : function(msg)
+    {
+    	var checkTime = function(i)
+    	{
+    		if ( i < 10 ) i= "0" + i;
+    		
+    		return i;
+    	};
+    	
+		var messageDate = function( _date )
+		{
+			var _dt = _date.substr( 0, _date.indexOf( 'T' ) ).split( '-' );
+			var _hr = _date.substr( _date.indexOf( 'T' ) + 1, _date.length - _date.indexOf( 'T' ) - 2 ).split( ':' );
+			
+			( _date = new Date ).setTime( Date.UTC( _dt[0], _dt[1] - 1, _dt[2], _hr[0], _hr[1], _hr[2] ) );
+
+			return ( _date.toLocaleDateString( ).replace( /-/g, '/' ) + ' ' + _date.toLocaleTimeString( ) );
+		};
+
+    	var data	= new Date();
+    	var dtNow	= checkTime(data.getHours()) + ":" + checkTime(data.getMinutes()) + ":" + checkTime(data.getSeconds());
+    	
+        var from	= msg.getAttribute('from');
+        var type	= msg.getAttribute('type');
+        var elems	= msg.getElementsByTagName('body');
+        var delay	= ( msg.getElementsByTagName('delay') ) ? msg.getElementsByTagName('delay') : null;
+        var stamp	= ( delay[0] != null ) ? "<font style='color:red;'>" + messageDate(delay[0].getAttribute('stamp')) + "</font>" :  dtNow;
+
+		var barejid		= Strophe.getBareJidFromJid(from);
+		var jidChatRoom	= Strophe.getResourceFromJid(from);
+		var jid_lower	= barejid.toLowerCase();
+		var contact		= "";
+		var state		= "";
+
+		var chatBox	= document.getElementById(jid_lower + "__chatState");
+		var chatStateOnOff = null;
+		var active	= msg.getElementsByTagName('active');
+		
+		contact	= barejid.toLowerCase();
+		contact	= contact.substring(0, contact.indexOf('@'));
+            
+		if( TrophyIM.rosterObj.roster[barejid] )
+		{
+			if( TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'] )
+			{
+				contact = TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'];
+			}
+		}
+
+		// Message with body are "content message", this means state active
+		if ( elems.length > 0 )
+		{
+			state = "";
+			
+			// Set notify chat state capability on when sender notify it themself
+			chatStateOnOff = document.getElementById(jid_lower + "__chatStateOnOff");
+			
+			if (active.length > 0 & chatStateOnOff != null )
+		 	{
+				chatStateOnOff.value = 'on';
+			}
+
+			// Get Message
+			var _message	= document.createElement("div");
+			var _text		= Strophe.getText( elems[0] );
+			
+			// Events Javascript
+			_text = _text.replace(/onblur/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onchange/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onclick/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/ondblclick/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onerror/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onfocus/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onkeydown/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onkeypress/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onkeyup/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onmousedown/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onmousemove/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onmouseout/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onmouseover/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onmouseup/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onresize/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onselect/gi,"EVENT_DENY");
+			
+			_text = _text.replace(/onunload/gi,"EVENT_DENY");
+			
+			// Events CSS
+			_text = _text.replace(/style/gi,"EVENT_DENY");
+
+			// Tags HTML
+			_text = _text.replace(/img /gi,"IMG_DENY ");
+			
+			_text = _text.replace(/script /gi,"SCRIPT_DENY ");
+			
+			_text = _text.replace(/div /gi,"DIV_DENY ");
+			
+			_text = _text.replace(/span /gi,"SPAN_DENY ");
+			
+			_text = _text.replace(/iframe /gi,"IFRAME_DENY ");
+			
+			_message.innerHTML = _text;
+			
+			////////// BEGIN XSS //////////////////////////////////////////////////
+			// Delete Tags <SCRIPT>
+			var scripts = _message.getElementsByTagName('script_deny');
+			for (var i = 0; i < scripts.length; i++){_message.removeChild(scripts[i--]);}
+			////////////////////////////////////////////////////
+			
+			// Delete Tags <IMG>
+			var _imgSrc = _message.getElementsByTagName('img_deny');
+			for (var i = 0; i < _imgSrc.length; i++){_imgSrc[i].parentNode.removeChild( _imgSrc[i--] );}
+			////////////////////////////////////////////////////
+			
+			// Delete Tags <DIV>
+			var _Div = _message.getElementsByTagName('div_deny');
+			for (var i = 0; i < _Div.length; i++){_Div[i].parentNode.removeChild( _Div[i--] );}
+			////////////////////////////////////////////////////
+			
+			// Delete Tags <SPAN>
+			var _Span = _message.getElementsByTagName('span_deny');
+			for (var i = 0; i < _Span.length; i++){_Span[i].parentNode.removeChild( _Span[i--] );}
+			////////////////////////////////////////////////////
+
+			// Delete Tags <IFRAME>
+			var _Iframe = _message.getElementsByTagName('iframe_deny');
+			for (var i = 0; i < _Iframe.length; i++){_Iframe[i].parentNode.removeChild( _Iframe[i--] );}
+
+			// Delete Tags <A HREF>
+			var _aHref = _message.getElementsByTagName('a');
+			for (var i = 0; i < _aHref.length; i++){_aHref[i].parentNode.removeChild( _aHref[i--] );}
+			
+			_message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, "");
+			////////// END XSS //////////////////////////////////////////////////
+			
+			// Get Smiles
+			_message.innerHTML = loadscript.getSmiles( _message.innerHTML );
+
+			if (type == 'chat' || type == 'normal')
+			{
+				if ( _message.hasChildNodes() )
+				{
+					var message = 
+					{
+		            	contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + contact + "</font>",
+		            	msg		: "</br>" + _message.innerHTML
+	    	        };
+					
+					TrophyIM.addMessage( TrophyIM.makeChat( from ), jid_lower, message );
+				}
+			}
+			else if( type == 'groupchat')
+			{
+				if ( _message.hasChildNodes() )
+				{
+					var message = 
+					{
+                                                contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + jidChatRoom + "</font>",
+                                                msg     : "</br>" + _message.innerHTML
+                                        };
+
+                                        TrophyIM.addMessage( TrophyIM.makeChatRoom( barejid ), jid_lower, message );
+				}
+			}
+		}
+		// Message without body are "content message", this mean state is not active
+		else
+		{
+			if( chatBox != null )
+				state = TrophyIM.getChatState(msg);			
+		}
+		
+		// Clean chat status message some time later 		
+		var clearChatState = function()
+		{
+			chatBox.innerHTML='';
+		}
+		
+		if (chatBox != null)
+		{
+			var clearChatStateTimer; 
+			
+			chatBox.innerHTML = "<font style='font-weight:bold; color:grey; float:right;'>" + state + "</font>"; 
+			
+			var _composing =  msg.getElementsByTagName('composing'); 
+			
+			if ( _composing.length == 0 )
+				
+				clearChatStateTimer = setTimeout(clearChatState, 2000); 
+			else 
+				clearTimeout(clearChatStateTimer);			
+		}
+
+		return true;
+	},
+
+	/** Function: getChatState
+	 *
+	 *  Parameters:
+	 *    (string) msg - the message to get chat state
+	 *    (string) jid - the jid of chat box to update the chat state to.
+  	 */
+	getChatState : function(msg)
+	{
+		var	state =  msg.getElementsByTagName('inactive');
+         	
+		if ( state.length > 0 )
+		{
+        	return i18n.INACTIVE;
+		}
+		else
+		{
+         	state = msg.getElementsByTagName('gone');
+            if ( state.length > 0 )
+            {
+            	return i18n.GONE;
+			}
+            else
+            {
+            	state = msg.getElementsByTagName('composing'); 
+            	if ( state.length > 0 )
+            	{
+               		return i18n.COMPOSING;
+				}
+            	else
+            	{
+               		state =  msg.getElementsByTagName('paused');
+                	if ( state.length > 0 )
+                	{
+                  		return i18n.PAUSED;
+					}
+				}
+			}
+		}
+		
+		return '';
+	},
+
+	/** Function: makeChat
+     *
+     *  Make sure chat window to given fulljid exists, switching chat context to
+     *  given resource. 
+     */
+     
+    makeChat : function(fulljid)
+    {
+    	var barejid		= Strophe.getBareJidFromJid(fulljid);
+    	var titleWindow	= "";
+
+    	var paramsChatBox =
+    	{
+    			'enabledPopUp'	: ( ( loadscript.getIsIE() ) ? "none" : "block" ),
+    			'idChatBox' 	: barejid + "__chatBox",
+    			'jidTo'			: barejid,
+				'path_jabberit' : path_jabberit
+    	};
+
+    	titleWindow = barejid.toLowerCase();
+   		titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));
+
+        if( TrophyIM.rosterObj.roster[barejid] )
+        {
+            if( TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'] )
+            {
+            	titleWindow = TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'];
+            }
+        }
+
+        // Position Top
+        TrophyIM.posWindow.top	= TrophyIM.posWindow.top + 10; 
+        if( TrophyIM.posWindow.top > 200 )
+        	TrophyIM.posWindow.top	= 100;
+        
+        // Position Left
+        TrophyIM.posWindow.left	= TrophyIM.posWindow.left + 5;
+        if( TrophyIM.posWindow.left > 455 )
+        	TrophyIM.posWindow.left	= 400;
+        
+        var _content = document.createElement( 'div' );
+        _content.innerHTML = loadscript.parse( "chat_box", "chatBox.xsl", paramsChatBox);
+        _content = _content.firstChild;
+        
+        var _messages		= _content.firstChild.firstChild;
+        var _textarea		= _content.getElementsByTagName( 'textarea' ).item( 0 );
+        var _send			= _content.getElementsByTagName( 'input' ).item( 0 );
+		var _chatStateOnOff	= _content.getElementsByTagName( 'input' ).item( 1 );
+
+        var _send_message = function( )
+        {
+        	if ( ! TrophyIM.sendMessage( barejid, _textarea.value ) )
+        		return false;
+
+        	// Add Message in chatBox;
+    		TrophyIM.addMessage( _messages, barejid, {
+    			contact : "<font style='font-weight:bold; color:red;'>" + i18n.ME + "</font>",
+    			msg : "<br/>" + _textarea.value
+    		} );
+
+        	_textarea.value = '';
+        	_textarea.focus( );
+        };
+		
+		var composingTimer_ = 0;
+   		var isComposing_ = 0;
+   		var timeCounter;
+
+   		var setComposing = function( )
+   		{
+   			var checkComposing = function()
+   			{
+            	if (!isComposing_) {
+               		// User stopped composing
+               		composingTimer_ = 0;
+               		clearInterval(timeCounter);
+               		TrophyIM.sendContentMessage(barejid, 'paused');
+            	} else {
+               		TrophyIM.sendContentMessage(barejid, 'composing');
+            	}
+            	isComposing_ = 0; // Reset composing
+         	}
+
+         	if (!composingTimer_) {
+            	/* User (re)starts composing */
+            	composingTimer_ = 1;
+            	timeCounter = setInterval(checkComposing,4000);
+         	}
+         	isComposing_ = 1;
+      	};
+
+        loadscript.configEvents( _send, 'onclick', _send_message );
+		loadscript.configEvents( _textarea, 'onkeyup', function( e )
+		{
+			if ( e.keyCode == 13 ){
+				_send_message( );
+				// User stopped composing
+               	composingTimer_ = 0;
+               	clearInterval(timeCounter);
+			}else{
+				if (_chatStateOnOff.value == 'on')
+					setComposing();
+			}
+		} );        
+
+    	var winChatBox = 
+    	{
+   			 id_window		: "window_chat_area_" + barejid,
+   			 barejid		: barejid,
+			 width			: 387,
+			 height			: 375,
+			 top			: TrophyIM.posWindow.top,
+			 left			: TrophyIM.posWindow.left,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: loadscript.getZIndex(),
+			 title			: titleWindow,
+			 closeAction	: "hidden",
+			 content		: _content	
+    	}
+    	
+   		_win = _winBuild(winChatBox);
+
+    	// Notification New Message
+    	loadscript.notification(barejid);
+    	
+    	// Photo User;
+   		loadscript.getPhotoUser(barejid);
+   		
+   		_textarea.focus( );
+   		
+   		return ( _messages = _win.content( ).firstChild );
+    },
+
+	/** Function: makeChatRoom
+    *
+    *
+    *
+    */
+    
+    makeChatRoom : function()
+    {
+    	var jidChatRoom = arguments[0];
+    	var titleWindow	= "ChatRoom - " + unescape(arguments[1]);
+    	
+    	var paramsChatRoom =
+    	{
+    			'idChatRoom' 	: jidChatRoom + "__roomChat",
+    			'jidTo'			: jidChatRoom,
+    			'lang_Send'		: i18n.SEND,
+    			'lang_Leave_ChatRoom' : i18n.LEAVE_CHATROOM,
+				'path_jabberit' : path_jabberit
+    	};
+
+    	// Position Top
+        TrophyIM.posWindow.top	= TrophyIM.posWindow.top + 10; 
+        if( TrophyIM.posWindow.top > 200 )
+        	TrophyIM.posWindow.top	= 100;
+        
+        // Position Left
+        TrophyIM.posWindow.left	= TrophyIM.posWindow.left + 5;
+        if( TrophyIM.posWindow.left > 455 )
+        	TrophyIM.posWindow.left	= 400;
+
+        var _content = document.createElement( 'div' );
+        _content.innerHTML = loadscript.parse( "chat_room", "chatRoom.xsl", paramsChatRoom );
+        _content = _content.firstChild;
+    	
+        var _messages		= _content.firstChild.firstChild;
+        var _textarea		= _content.getElementsByTagName( 'textarea' ).item( 0 );
+        var _send			= _content.getElementsByTagName( 'input' ).item( 0 );
+        var _leaveChatRoom	= _content.getElementsByTagName( 'input' ).item( 1 );
+        
+        var _send_message = function( )
+        {
+        	if ( ! TrophyIM.sendMessageChatRoom( jidChatRoom, _textarea.value ) )
+        		return false;
+        	
+        	_textarea.value = '';
+        	
+        	_textarea.focus( );
+        };
+        
+        loadscript.configEvents( _send, 'onclick', _send_message );
+        loadscript.configEvents( _leaveChatRoom, 'onclick', function( )
+        {
+        	TrophyIM.leaveChatRoom( jidChatRoom );
+        	
+        	if( TrophyIM.activeChatRoom.name.length > 0 )
+        	{
+        		for( var i = 0;  i < TrophyIM.activeChatRoom.name.length ; i++ )
+        		{
+        			if( TrophyIM.activeChatRoom.name[i].indexOf( jidChatRoom ) >= 0 )
+        			{
+        				TrophyIM.activeChatRoom.name[i] = "";
+        			}
+        		}
+        	}
+        	
+        	setTimeout( function()
+        	{
+        		_winBuild("window_chat_room_" + jidChatRoom, "remove");
+        		
+        	}, 650 );
+        	
+        });
+        
+		loadscript.configEvents( _textarea, 'onkeyup', function( e )
+		{
+			if ( e.keyCode == 13 )
+			{
+				_send_message( );
+			}
+		});        
+        
+    	var winChatRoom = 
+    	{
+   			 id_window		: "window_chat_room_" + arguments[0],
+   			 barejid		: jidChatRoom,
+			 width			: 500,
+			 height			: 450,
+			 top			: TrophyIM.posWindow.top,
+			 left			: TrophyIM.posWindow.left,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: loadscript.getZIndex(),
+			 title			: titleWindow,
+			 closeAction	: "hidden",
+			 content		: _content 	
+    	}
+    	
+    	_win = _winBuild(winChatRoom);
+    	
+    	return ( _messages = _win.content( ).firstChild );
+    	
+    },
+    
+	/** Function addContacts
+	 * 
+	 *  Parameters:
+	 *		(string) jidFrom 	 
+	 *  	(string) jidTo 
+	 * 		(string) name
+	 * 		(string) group	 
+	 */
+	
+	addContact : function( jidTo, name, group )
+	{
+		var _flag = true;
+
+		if( TrophyIM.removeResult.idResult.length > 0 )
+		{
+			for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ )
+			{
+				if( TrophyIM.removeResult.idResult[i] == jidTo )
+				{
+					_flag = false;
+					
+					TrophyIM.removeResult.idResult.splice(i,1);
+					
+					i--;
+				}
+			}
+		}
+		
+		if( _flag )
+		{	
+	    	// Add Contact
+	    	var _id = TrophyIM.connection.getUniqueId('add'); 
+			var newContact = $iq({type: 'set', id: _id});
+				newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'});
+				newContact = newContact.c('item').attrs({jid: jidTo, name:name});
+				newContact = newContact.c('group').t(group).tree();
+	
+			TrophyIM.connection.send(newContact);
+		}
+	},
+
+    /** Function: add
+     *
+     *  Parameters:
+     *    (string) msg - the message to add
+     *    (string) jid - the jid of chat box to add the message to.
+     */
+	
+    addMessage : function( chatBox, jid, msg )
+    {
+     	// Get Smiles
+    	msg.msg = loadscript.getSmiles( msg.msg );
+ 
+    	var messageDiv	= document.createElement("div");
+		messageDiv.style.margin = "3px 0px 1em 3px";
+    	messageDiv.innerHTML	= msg.contact + " : " + msg.msg ;
+    		
+    	chatBox.appendChild(messageDiv);
+    	chatBox.scrollTop = chatBox.scrollHeight;
+    },
+	
+    /** Function : renameContact
+     * 
+     * 
+     */
+    
+    renameContact : function( jid )
+    {
+    	// Name
+    	var name		= TrophyIM.rosterObj.roster[jid].contact.name;
+
+		if(( name = prompt(i18n.ASK_NEW_NAME_QUESTION + name + "!", name )))
+			if(( name = name.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+				name = "";
+
+		if( name == null || name == "")
+			name = "";
+		
+    	var jidTo = jid
+    	var name  = ( name ) ? name : TrophyIM.rosterObj.roster[jid].contact.name;
+    	var group = TrophyIM.rosterObj.roster[jid].contact.groups[0];
+    	
+    	TrophyIM.addContact( jidTo, name, group );
+    	
+    	document.getElementById('itenContact_' + jid ).innerHTML = name;
+    },
+    
+    /** Function : renameGroup
+     * 
+     * 
+     */
+
+    renameGroup : function( jid )
+    {
+    	var group		= TrophyIM.rosterObj.roster[jid].contact.groups[0];
+    	var presence	= TrophyIM.rosterObj.roster[jid].presence;
+    	
+        // Group
+        if(( group = prompt( i18n.ASK_NEW_GROUP_QUESTION, group )))
+                if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+                        group = "";
+
+        if( group == null || group == "")
+                group = "";
+
+    	var jidTo = TrophyIM.rosterObj.roster[jid].contact.jid;
+    	var name  = TrophyIM.rosterObj.roster[jid].contact.name;
+		var group = ( group ) ? group : TrophyIM.rosterObj.roster[jid].contact.groups[0];
+
+		TrophyIM.rosterObj.removeContact( jid );
+		
+		TrophyIM.addContact( jidTo, name, group );
+    	
+		document.getElementById("JabberIMRoster").innerHTML = "";
+		
+    	TrophyIM.renderRoster();
+    	
+    	setTimeout(function()
+    	{
+    		for( var i in presence )
+    		{
+    			if ( presence[ i ].constructor == Function )
+    				continue;
+    				
+    			TrophyIM.rosterObj.setPresence( jid, presence[i].priority, presence[i].show, presence[i].status);
+    		}
+    	},500);
+    },
+
+    /** Function createChatRooms
+     * 
+     * 
+     */
+    
+    createChatRooms : function()
+    {
+    	var nickName	 = document.getElementById('nickName_chatRoom_jabberit').value;
+    	var nameChatRoom = document.getElementById('name_ChatRoom_jabberit').value; 
+    	
+    	var _from	= Base64.decode( loadscript.getUserCurrent().jid ) + TROPHYIM_RESOURCE; 
+        var _to		= escape( nameChatRoom ) + "@" + TROPHYIM_CHATROOM + "/" + nickName ;
+        var new_room	= $pres( {from: _from, to: _to} ).c( "x", {xmlns: Strophe.NS.MUC} );
+
+	TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = _to; 
+		
+	TrophyIM.connection.send( new_room.tree() );
+    },
+    
+    /** Function : joinRoom
+     * 
+     * 
+     */
+    
+    joinChatRoom : function( roomName )
+    {
+    	var presence = $pres( {from: TrophyIM.connection.jid, to: roomName} ).c("x",{xmlns: Strophe.NS.MUC});
+        
+	TrophyIM.connection.send( presence );
+    },
+    
+    /** Function : Leave Chat Room
+     * 
+     * 
+     */
+    
+    leaveChatRoom : function( roomName )
+    {
+    	var room_nick	= roomName;
+    	
+        var presenceid	= TrophyIM.connection.getUniqueId();
+        
+        var presence	= $pres( {type: "unavailable", id: presenceid, from: TrophyIM.connection.jid, to: room_nick} ).c("x",{xmlns: Strophe.NS.MUC});
+        
+        TrophyIM.connection.send( presence );        
+    },
+    
+    /** Function : getlistRooms
+     * 
+     * 
+     */
+    
+    getListRooms : function()
+    {
+    	if( TrophyIM.statusConn.connected )
+    	{
+	    	var _error_return = function(element)
+	    	{
+	    		alert("ERRO : Tente novamente !");
+	    	};
+	    	
+	   	var iq = $iq({to: TROPHYIM_CHATROOM, type: "get"}).c("query",{xmlns: Strophe.NS.DISCO_ITEMS});    		
+	    		
+	    	TrophyIM.connection.sendIQ( iq, loadscript.listRooms, _error_return, 500 );
+    	}
+    	else
+    	{
+    		alert( "ERRO : Sem conexão com o servidor " + TROPHYIM_CHATROOM );
+    	}
+    },
+    
+    /** Function: removeContact
+     * 
+     *  Parameters:
+     *  	(string) jidTo
+     */
+    
+    removeContact : function( jidTo )
+    {
+    	var divItenContact	 = null;
+
+    	if( ( divItenContact = document.getElementById('itenContact_' + jidTo )))
+    	{	
+        	// Remove Contact
+    		var _id	= TrophyIM.connection.getUniqueId(); 	
+    		
+    		// Controller Result
+    		TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo;
+
+    		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 );
+        	
+   			loadscript.removeElement( document.getElementById('itenContactNotification_' + jidTo ) );
+    		
+    		var spanShow = document.getElementById('span_show_itenContact_' + jidTo )
+    			spanShow.parentNode.removeChild(spanShow);
+    		
+    		loadscript.removeGroup( divItenContact.parentNode );
+    		
+    		divItenContact.parentNode.removeChild(divItenContact);
+    	}
+    },
+    
+    /** Function: renderRoster
+     *
+     *  Renders roster, looking only for jids flagged by setPresence as having
+     *  changed.
+     */
+    
+	renderRoster : function()
+	{
+		var roster_div = document.getElementById('JabberIMRoster');
+		
+		if( roster_div )
+		{
+			var users = new Array();
+			
+			var loading_gif = document.getElementById("JabberIMRosterLoadingGif");
+			
+			if( loading_gif.style.display == "block" )
+				loading_gif.style.display = "none";
+				
+			for( var user in TrophyIM.rosterObj.roster )
+			{
+				if ( TrophyIM.rosterObj.roster[ user ].constructor == Function )
+					continue;
+
+				users[users.length] = TrophyIM.rosterObj.roster[user].contact.jid;
+			}
+
+			users.sort();
+			
+			var groups 		= new Array();
+			var flagGeral	= false;
+			
+			for (var group in TrophyIM.rosterObj.groups)
+			{
+				if ( TrophyIM.rosterObj.groups[ group ].constructor == Function )
+					continue;
+				
+				if( group )
+					groups[groups.length] = group;
+				
+				if( group == "Geral" )
+					flagGeral = true;
+            }
+            
+			if( !flagGeral && users.length > 0 )
+				groups[groups.length] = "Geral";
+				
+			groups.sort();
+			
+			for ( var i = 0; i < groups.length; i++ )
+			{
+				TrophyIM.renderGroups( groups[i] , roster_div );	
+			}
+			
+			TrophyIM.renderItensGroup( users, roster_div );
+		}
+			
+		TrophyIM._timeOut.renderRoster = setTimeout("TrophyIM.renderRoster()", 1000 );		
+	},
+	
+    /** Function: renderGroups
+     *
+     *
+     */
+	
+	renderGroups: function( nameGroup, element )
+	{
+		var _addGroup = function()
+		{
+			var _nameGroup	= nameGroup;
+			var _element	= element;
+
+			var paramsGroup = 
+			{
+				'nameGroup' 	: _nameGroup,
+				'path_jabberit' : path_jabberit
+			}
+			
+			_element.innerHTML += loadscript.parse("group","groups.xsl", paramsGroup);
+		}
+
+		if( !element.hasChildNodes() )
+		{
+			_addGroup();
+		}
+		else
+		{
+			var _NodeChild	= element.firstChild;
+			var flagAdd		= false;
+			
+			while( _NodeChild )
+			{
+				if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span" )
+				{
+					if( _NodeChild.childNodes[0].childNodes[0].nodeValue === nameGroup )
+					{
+						flagAdd = true;
+					}
+				}
+				
+				_NodeChild = _NodeChild.nextSibling;
+			}
+
+			if( !flagAdd )
+			{
+				_addGroup();
+			}
+		}
+	},
+
+    /** Function: renderItensGroup
+     *
+     *
+     */
+
+	renderItensGroup : function( users, element )
+	{
+		var addItem = function()
+		{
+			if( arguments.length > 0 )
+			{
+				// Get Arguments
+				var objContact	= arguments[0];
+				var group		= arguments[1];
+				var element		= arguments[2];
+				var showOffline	= loadscript.getShowContactsOffline();
+				
+				// Presence e Status
+				var presence 		= "unavailable";
+				var status	 		= "";
+				var statusColor		= "black";
+				var statusDisplay	= "none";
+				
+				var _resource	= "";
+				
+				// Set Presence 
+				var _presence = function(objContact)
+				{
+					if (objContact.presence)
+					{
+						for (var resource in objContact.presence)
+						{
+							if ( objContact.presence[resource].constructor == Function )
+								continue;
+
+							if( objContact.presence[resource].show != 'invisible' )
+								presence = objContact.presence[resource].show;
+
+							if( objContact.contact.subscription != "both") 
+								presence = 'subscription';
+							
+							if( objContact.presence[resource].status )
+							{
+								status = " ( " + objContact.presence[resource].status + " ) ";
+								statusDisplay	= "block";
+							}
+						}
+					}
+				};
+				
+				// Set Subscription
+				var _subscription = function( objContact )
+				{
+					if( objContact.contact.subscription != "both" )
+					{
+						switch( objContact.contact.subscription )
+						{
+							case "none" :
+								
+								status 		= " (( " + i18n.ASK_FOR_AUTH  + " )) ";
+								statusColor	= "red";
+								break;
+	
+							case "to" :
+								
+								status 		= " (( " + i18n.CONTACT_ASK_FOR_AUTH  + " )) ";
+								statusColor	= "orange";
+								break;
+	
+							case "from" :
+								
+								status 		= " (( " + i18n.AUTHORIZED + " )) ";
+								statusColor = "green";
+								break;
+								
+							case "subscribe" :
+								
+								status		= " (( " + i18n.AUTH_SENT  + " )) ";
+								statusColor	= "red";	
+								break;
+
+							case "not-in-roster" :
+								
+								status		= " (( " + i18n.ASK_FOR_AUTH_QUESTION  + " )) ";
+								statusColor	= "orange";	
+								break;
+								
+							default :
+								
+								break;
+						}
+
+						statusDisplay = "block";
+					}
+				};
+
+				if( objContact.contact.subscription != "remove")
+				{
+					var itensJid	= document.getElementById( "itenContact_" + objContact.contact.jid );
+					
+					if( itensJid == null )
+					{
+						// Name
+						var nameContact = "";					
+						
+						if ( objContact.contact.name ) 
+							nameContact = objContact.contact.name;
+						else
+						{
+							nameContact = objContact.contact.jid;
+							nameContact = nameContact.substring(0, nameContact.indexOf('@'));
+						}
+						
+						// Get Presence
+						_presence(objContact);
+						
+						var paramsContact =
+						{
+							divDisplay		: "block", 
+							id		  		: 'itenContact_' + objContact.contact.jid ,
+							jid		  		: objContact.contact.jid,
+							nameContact 	: nameContact,
+							path_jabberit	: path_jabberit,
+							presence	  	: presence,
+							spanDisplay		: statusDisplay,
+							status	  		: status,
+							statusColor		: "black",
+							subscription	: objContact.contact.subscription,
+							resource		: _resource
+						}
+						
+						// Get Authorization
+						_subscription( objContact );
+						
+						if( group != "")
+						{
+							var _NodeChild		= element.firstChild;
+							
+							while( _NodeChild )
+							{
+								if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span" )
+								{
+									if( _NodeChild.childNodes[0].childNodes[0].nodeValue === group )
+									{
+										_NodeChild.innerHTML += loadscript.parse("itens_group", "itensGroup.xsl", paramsContact);
+									}
+								}
+	
+								_NodeChild = _NodeChild.nextSibling;
+							}
+						}	
+					}
+					else
+					{
+						// Get Presence
+						_presence(objContact);
+	
+						var is_open = itensJid.parentNode.childNodes[0].style.backgroundImage;	
+							is_open = is_open.indexOf("arrow_down.gif");
+	
+						// Get Authorization
+						_subscription( objContact );
+						
+						// Set subscription
+						itensJid.setAttribute('subscription', objContact.contact.subscription );
+						
+						with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) )
+						{
+							if( presence == "unavailable" && !showOffline )
+							{
+								style.display = "none";
+							}
+							else
+							{
+								if( is_open > 0 )
+								{
+									style.display	= statusDisplay;
+									style.color		= statusColor;
+									innerHTML		= status;
+								}
+							}
+						}
+						
+						if( presence == "unavailable" && !showOffline )
+						{
+							itensJid.style.display = "none";
+						}
+						else
+						{
+							if( is_open > 0 )
+							{
+								itensJid.style.display = "block";
+							}
+						}
+						
+						itensJid.style.background	= "url('"+path_jabberit+"templates/default/images/" + presence + ".gif') no-repeat center left";
+					}
+	
+					// Contact OffLine
+					if( !objContact.presence && !showOffline )
+					{
+						if( objContact.contact.subscription != "remove" )
+						{
+							with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ))
+							{
+								style.display 	= "none";
+							}
+		
+							with ( document.getElementById('itenContact_' + objContact.contact.jid ) )
+							{
+								style.display	= "none";
+							}
+						}
+					}
+				}
+			}
+		};
+		
+		var flag = false;
+		
+		for( var i = 0 ; i < users.length; i++ )
+		{
+			if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) )
+			{
+				var _subscription = TrophyIM.rosterObj.roster[users[i]].contact.subscription;
+				
+				if( _subscription === "to" )
+				{
+					flag = true;
+				}
+				
+				if(  _subscription === "not-in-roster")
+				{
+					flag = true;
+				}
+				
+				if( TrophyIM.rosterObj.roster[users[i]].contact.groups )
+				{
+					var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups;
+					
+					if( groups.length > 0 )
+					{
+						for( var j = 0; j < groups.length; j++ )
+						{
+							addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element );
+						}
+					}
+					else
+					{
+						addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element );
+					}
+				}
+				else
+				{
+					addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element );
+				}
+			}
+		}
+		
+		if( flag )
+		{
+			if ( TrophyIM.controll.notificationNewUsers == 0 )
+			{
+				loadscript.enabledNotificationNewUsers();
+				TrophyIM.controll.notificationNewUsers++;
+			}
+		}
+		else
+		{
+			loadscript.disabledNotificationNewUsers();
+			TrophyIM.controll.notificationNewUsers = 0;
+		}
+	},
+
+    /** Function: rosterClick
+     *
+     *  Handles actions when a roster item is clicked
+     */
+    
+	rosterClick : function(fulljid)
+	{
+        TrophyIM.makeChat(fulljid);
+    },
+
+	/** Function SetAutorization
+	 * 
+	 */
+
+	setAutorization : function( jidTo, jidFrom, _typeSubscription )
+	{
+    	var _id	= TrophyIM.connection.getUniqueId();
+    	
+    	TrophyIM.connection.send($pres( ).attrs({from: jidFrom, to: jidTo, type: _typeSubscription, id: _id}).tree());
+	},
+
+	/** Function: setPresence
+     *
+     */
+
+	setPresence : function( _type )
+	{
+		var presence_chatRoom = "";
+		
+		if( _type != 'status')
+		{
+			if( _type == "unavailable" &&  TrophyIM.statusConn.connected )
+			{
+				var loading_gif = document.getElementById("JabberIMRosterLoadingGif");
+				
+				if( TrophyIM._timeOut.renderRoster != null )
+					clearTimeout(TrophyIM._timeOut.renderRoster);
+				
+				if( TrophyIM.statusConn.connected )
+					TrophyIM.connection.send($pres({type : _type}).tree());
+				
+				for( var i = 0; i < TrophyIM.connection._requests.length; i++ )
+		    	{
+		    		if( TrophyIM.connection._requests[i] )
+		    			TrophyIM.connection._removeRequest(TrophyIM.connection._requests[i]);
+		    	}
+				
+				TrophyIM.logout();
+				
+		    	loadscript.clrAllContacts();
+		    	
+		    	delete TrophyIM.rosterObj.roster;
+		    	delete TrophyIM.rosterObj.groups;
+		    	
+		    	setTimeout(function()
+		    	{
+					if( loading_gif.style.display == "block" )
+						loading_gif.style.display = "none";
+		    	}, 1000);
+			}
+			else
+			{
+				if( !TrophyIM.autoConnection.connect )
+				{
+					TrophyIM.autoConnection.connect = true;
+					TrophyIM.load();
+				}
+				else
+				{
+					if( TrophyIM.statusConn.connected )
+					{
+						if( loadscript.getStatusMessage() != "" )
+						{
+							var _presence = $pres( );
+							_presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _type ) );
+							_presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( loadscript.getStatusMessage() ));
+							
+							TrophyIM.connection.send( _presence.tree() );
+							
+							presence_chatRoom = _type;
+						}
+						else
+						{
+							TrophyIM.connection.send($pres( ).c('show').t(_type).tree());
+							
+							presence_chatRoom = _type;
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			var _show	= "available";
+			var _status	= "";
+			
+			if( arguments.length < 2 )
+			{
+				if( loadscript.getStatusMessage() != "" )
+					_status = prompt(i18n.TYPE_YOUR_MSG, loadscript.getStatusMessage());
+				else
+					_status = prompt(i18n.TYPE_YOUR_MSG);
+				
+				var _divStatus = document.getElementById("JabberIMStatusMessage");
+				
+				if( ( _status = _status.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "")
+					_divStatus.firstChild.innerHTML	= "( " + _status + " )";
+			} 
+			else
+			{
+				_status = arguments[1];
+			}
+
+			for( var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence )
+			{
+    			if ( TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[ resource ].constructor == Function )
+    				continue;
+    			
+				if ( TROPHYIM_RESOURCE === ("/" + resource) )
+					_show = TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show;
+			}
+
+			if ( TrophyIM.statusConn.connected )
+			{
+				var _presence = $pres( );
+				_presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) );
+				_presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) );
+				
+				TrophyIM.connection.send( _presence.tree() );
+				
+				presence_chatRoom = _show;
+			}
+		}
+		
+		// Send Presence Chat Room
+		if( TrophyIM.activeChatRoom.name.length > 0 )
+		{
+			for( i = 0; i < TrophyIM.activeChatRoom.name.length; i++ )
+			{
+				if( TrophyIM.activeChatRoom.name[i] != "" )
+					TrophyIM.connection.send($pres( {to : TrophyIM.activeChatRoom.name[i]} ).c('show').t( presence_chatRoom ) );
+			}
+		}
+
+	},
+	
+	/** Function: sendMessage
+     *
+     *  Send message from chat input to user
+     */
+     
+    sendMessage : function()
+    {
+		if (arguments.length > 0)
+		{
+			var jidTo = arguments[0];
+			var message_input = arguments[1];
+			
+			
+			message_input = message_input.replace(/^\s+|\s+$|^\n|\n$/g, "");
+			
+			if (message_input != "") {
+			
+				// Send Message
+				var newMessage = $msg({
+					to: jidTo,
+					from: TrophyIM.connection.jid,
+					type: 'chat'
+				});
+				newMessage = newMessage.c('body').t(message_input);
+				newMessage.up();
+				newMessage = newMessage.c('active').attrs({
+					xmlns: 'http://jabber.org/protocol/chatstates'
+				});
+				// Send Message
+				TrophyIM.connection.send(newMessage.tree());
+				
+				return true;
+			}
+		}
+		
+		return false;
+    },
+
+	/** Function: sendMessage
+    *
+    *  Send message to ChatRoom
+    */
+    
+    sendMessageChatRoom : function( )
+    {
+    	if( arguments.length > 0 ) 
+    	{
+    		var room_nick	= arguments[0];
+	    	var message		= arguments[1];
+	        var msgid		= TrophyIM.connection.getUniqueId();
+	        var msg			= $msg({to: room_nick, type: "groupchat", id: msgid}).c("body",{xmlns: Strophe.NS.CLIENT}).t(message);
+	        
+	        msg.up();//.c("x", {xmlns: "jabber:x:event"}).c("composing");
+	        
+	        TrophyIM.connection.send(msg);
+	        
+	        return true;
+    	}
+    },
+    
+	/** Function: sendContentMessage
+     *
+     *  Send a content message from chat input to user
+     */
+	sendContentMessage : function()
+    {
+      if( arguments.length > 0 )
+      {
+         var jidTo = arguments[0];
+         var state = arguments[1];
+
+         var newMessage = $msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'});
+         newMessage = newMessage.c(state).attrs({xmlns : 'http://jabber.org/protocol/chatstates'});
+         // Send content message
+         TrophyIM.connection.send(newMessage.tree());
+      }
+    }
+};
+
+/** Class: TrophyIMRoster
+ *
+ *
+ *  This object stores the roster and presence info for the TrophyIMClient
+ *
+ *  roster[jid_lower]['contact']
+ *  roster[jid_lower]['presence'][resource]
+ */
+function TrophyIMRoster()
+{
+    /** Constants: internal arrays
+     *    (Object) roster - the actual roster/presence information
+     *    (Object) groups - list of current groups in the roster
+     *    (Array) changes - array of jids with presence changes
+     */
+    if (TrophyIM.JSONStore.store_working)
+	{
+        var data = TrophyIM.JSONStore.getData(['roster', 'groups']);
+        this.roster = (data['roster'] != null) ? data['roster'] : {};
+        this.groups = (data['groups'] != null) ? data['groups'] : {};
+    }
+	else
+	{
+        this.roster = {};
+        this.groups = {};
+    }
+    this.changes = new Array();
+    
+	if (TrophyIM.constants.stale_roster)
+	{
+        for (var jid in this.roster)
+		{
+			this.changes[this.changes.length] = jid;
+        }
+    }
+
+	/** Function: addChange
+	 *
+	 *  Adds given jid to this.changes, keeping this.changes sorted and
+	 *  preventing duplicates.
+	 *
+	 *  Parameters
+	 *    (String) jid : jid to add to this.changes
+	 */
+	 
+	this.addChange = function(jid)
+	{
+		for (var c = 0; c < this.changes.length; c++)
+		{
+			if (this.changes[c] == jid)
+			{
+				return;
+			}
+		}
+		
+		this.changes[this.changes.length] = jid;
+		
+		this.changes.sort();
+	}
+	
+    /** Function: addContact
+     *
+     *  Adds given contact to roster
+     *
+     *  Parameters:
+     *    (String) jid - bare jid
+     *    (String) subscription - subscription attribute for contact
+     *    (String) name - name attribute for contact
+     *    (Array)  groups - array of groups contact is member of
+     */
+    
+	this.addContact = function(jid, subscription, name, groups )
+	{
+		if( subscription === "remove" )
+        {
+			this.removeContact(jid);
+        }
+     	else
+    	{
+   			var contact		= {jid:jid, subscription:subscription, name:name, groups:groups}
+	        var jid_lower	= jid.toLowerCase();
+	
+			if ( this.roster[jid_lower] )
+			{
+	            this.roster[jid_lower]['contact'] = contact;
+	        }
+			else
+			{
+	            this.roster[jid_lower] = {contact:contact};
+	        }
+
+			groups = groups ? groups : [''];
+	        
+			for ( var g = 0; g < groups.length; g++ )
+			{
+				if ( !this.groups[groups[g]] )
+				{
+	                this.groups[groups[g]] = {};
+	            }
+	            
+				this.groups[groups[g]][jid_lower] = jid_lower;
+	        }
+    	}
+    }
+    
+    /** Function: getContact
+     *
+     *  Returns contact entry for given jid
+     *
+     *  Parameter: (String) jid - jid to return
+     */
+     
+    this.getContact = function(jid)
+	{
+        if (this.roster[jid.toLowerCase()])
+		{
+            return this.roster[jid.toLowerCase()]['contact'];
+        }
+    }
+
+   /** Function: getPresence
+	*
+	*  Returns best presence for given jid as Array(resource, priority, show,
+	*  status)
+	*
+	*  Parameter: (String) fulljid - jid to return best presence for
+	*/
+	 
+	this.getPresence = function(fulljid)
+	{
+		var jid = Strophe.getBareJidFromJid(fulljid);
+		var current = null;
+		    
+		if (this.roster[jid.toLowerCase()] && this.roster[jid.toLowerCase()]['presence'])
+		{
+			for (var resource in this.roster[jid.toLowerCase()]['presence'])
+			{
+    			if ( this.roster[jid.toLowerCase()]['presence'][ resource ].constructor == Function )
+    				continue;
+    			
+				var presence = this.roster[jid.toLowerCase()]['presence'][resource];
+				if (current == null)
+				{
+					current = presence
+				}
+				else
+				{
+					if(presence['priority'] > current['priority'] && ((presence['show'] == "chat"
+					|| presence['show'] == "available") || (current['show'] != "chat" ||
+					current['show'] != "available")))
+					{
+						current = presence
+					}
+				}
+			}
+		}
+		return current;
+	}
+
+	/** Function: groupHasChanges
+	 *
+	 *  Returns true if current group has members in this.changes
+	 *
+	 *  Parameters:
+	 *    (String) group - name of group to check
+	 */
+	 
+	this.groupHasChanges = function(group)
+	{
+		for (var c = 0; c < this.changes.length; c++)
+		{
+			if (this.groups[group][this.changes[c]])
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/** Function removeContact
+	 *
+	 * Parameters
+	 *	 (String) jid		
+	 */
+	 
+	 this.removeContact = function(jid)
+	 {
+		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 ] ] )
+					{
+		    			if ( this.groups[ groups[ i ] ][ contact ].constructor == Function )
+		    				continue;
+		    			
+						contacts++;
+					}
+		
+					if ( ! contacts )
+						delete this.groups[ groups[ i ] ];
+				}
+			}
+	
+			// Delete Object roster
+			if( this.roster[jid] )
+				delete this.roster[jid];
+		}
+	 }
+	 
+    /** Function: setPresence
+     *
+     *  Sets presence
+     *
+     *  Parameters:
+     *    (String) fulljid: full jid with presence
+     *    (Integer) priority: priority attribute from presence
+     *    (String) show: show attribute from presence
+     *    (String) status: status attribute from presence
+     */
+    
+	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' || show !== 'error' )
+		{
+        	if (!this.roster[jid_lower])
+			{
+                this.addContact( barejid, 'not-in-roster' );
+            }
+            
+            var presence =
+			{
+                resource	: resource,
+                priority	: priority,
+                show		: show,
+                status		: status
+            }
+            
+			if (!this.roster[jid_lower]['presence'])
+			{
+                this.roster[jid_lower]['presence'] = {};
+            }
+            
+            this.roster[jid_lower]['presence'][resource] = presence;	
+		}
+    }
+
+	/** Fuction: save
+	 *
+	 *  Saves roster data to JSON store
+	 */
+	
+	this.save = function()
+	{
+		if (TrophyIM.JSONStore.store_working)
+		{
+			TrophyIM.JSONStore.setData({roster:this.roster,
+			groups:this.groups, active_chat:TrophyIM.activeChats['current'],
+			chat_history:TrophyIM.chatHistory});
+		}
+	}
+
+}
+/** Class: TrophyIMJSONStore
+ *
+ *
+ *  This object is the mechanism by which TrophyIM stores and retrieves its
+ *  variables from the url provided by TROPHYIM_JSON_STORE
+ *
+ */
+function TrophyIMJSONStore() {
+    this.store_working = false;
+    /** Function _newXHR
+     *
+     *  Set up new cross-browser xmlhttprequest object
+     *
+     *  Parameters:
+     *    (function) handler = what to set onreadystatechange to
+     */
+     this._newXHR = function (handler) {
+        var xhr = null;
+        if (window.XMLHttpRequest) {
+            xhr = new XMLHttpRequest();
+            if (xhr.overrideMimeType) {
+            xhr.overrideMimeType("text/xml");
+            }
+        } else if (window.ActiveXObject) {
+            xhr = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+        return xhr;
+    }
+    /** Function getData
+     *  Gets data from JSONStore
+     *
+     *  Parameters:
+     *    (Array) vars = Variables to get from JSON store
+     *
+     *  Returns:
+     *    Object with variables indexed by names given in parameter 'vars'
+     */
+    this.getData = function(vars) {
+        if (typeof(TROPHYIM_JSON_STORE) != undefined) {
+            Strophe.debug("Retrieving JSONStore data");
+            var xhr = this._newXHR();
+            var getdata = "get=" + vars.join(",");
+            try {
+                xhr.open("POST", TROPHYIM_JSON_STORE, false);
+            } catch (e) {
+                Strophe.error("JSONStore open failed.");
+                return false;
+            }
+            xhr.setRequestHeader('Content-type',
+            'application/x-www-form-urlencoded');
+            xhr.setRequestHeader('Content-length', getdata.length);
+            xhr.send(getdata);
+            if (xhr.readyState == 4 && xhr.status == 200) {
+                try {
+                    var dataObj = JSON.parse(xhr.responseText);
+                    return this.emptyFix(dataObj);
+                } catch(e) {
+                    Strophe.error("Could not parse JSONStore response" +
+                    xhr.responseText);
+                    return false;
+                }
+            } else {
+                Strophe.error("JSONStore open failed. Status: " + xhr.status);
+                return false;
+            }
+        }
+    }
+    /** Function emptyFix
+     *    Fix for bugs in external JSON implementations such as
+     *    http://bugs.php.net/bug.php?id=41504.
+     *    A.K.A. Don't use PHP, people.
+     */
+    this.emptyFix = function(obj) {
+        if (typeof(obj) == "object") {
+            for (var i in obj) {
+    			if ( obj[i].constructor == Function )
+    				continue;
+    			
+                if (i == '_empty_') {
+                    obj[""] = this.emptyFix(obj['_empty_']);
+                    delete obj['_empty_'];
+                } else {
+                    obj[i] = this.emptyFix(obj[i]);
+                }
+            }
+        }
+        return obj
+    }
+    /** Function delData
+     *    Deletes data from JSONStore
+     * 
+     *  Parameters:
+     *    (Array) vars  = Variables to delete from JSON store
+     *
+     *  Returns:
+     *    Status of delete attempt.
+     */
+    this.delData = function(vars) {
+        if (typeof(TROPHYIM_JSON_STORE) != undefined) {
+            Strophe.debug("Retrieving JSONStore data");
+            var xhr = this._newXHR();
+            var deldata = "del=" + vars.join(",");
+            try {
+                xhr.open("POST", TROPHYIM_JSON_STORE, false);
+            } catch (e) {
+                Strophe.error("JSONStore open failed.");
+                return false;
+            }
+            xhr.setRequestHeader('Content-type',
+            'application/x-www-form-urlencoded');
+            xhr.setRequestHeader('Content-length', deldata.length);
+            xhr.send(deldata);
+            if (xhr.readyState == 4 && xhr.status == 200) {
+                try {
+                    var dataObj = JSON.parse(xhr.responseText);
+                    return dataObj;
+                } catch(e) {
+                    Strophe.error("Could not parse JSONStore response");
+                    return false;
+                }
+            } else {
+                Strophe.error("JSONStore open failed. Status: " + xhr.status);
+                return false;
+            }
+        }
+    }
+    /** Function setData
+     *    Stores data in JSONStore, overwriting values if they exist
+     *
+     *  Parameters:
+     *    (Object) vars : Object containing named vars to store ({name: value,
+     *    othername: othervalue})
+     *
+     *  Returns:
+     *    Status of storage attempt
+     */
+    this.setData = function(vars)
+    {
+    	if ( typeof(TROPHYIM_JSON_STORE) != undefined )
+        {
+            var senddata = "set=" + JSON.stringify(vars);
+            var xhr = this._newXHR();
+            try
+            {
+                xhr.open("POST", TROPHYIM_JSON_STORE, false);
+            }
+            catch (e)
+            {
+                Strophe.error("JSONStore open failed.");
+                return false;
+            }
+            xhr.setRequestHeader('Content-type',
+            'application/x-www-form-urlencoded');
+            xhr.setRequestHeader('Content-length', senddata.length);
+            xhr.send(senddata);
+            if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText ==
+            "OK") {
+                return true;
+            } else {
+                Strophe.error("JSONStore open failed. Status: " + xhr.status);
+                return false;
+            }
+        }
+    }
+    
+    var testData = true;
+    
+    if (this.setData({testData:testData})) {
+        var testResult = this.getData(['testData']);
+        if (testResult && testResult['testData'] == true) {
+            this.store_working = true;
+        }
+    }
+}
+/** Constants: Node types
+ *
+ * Implementations of constants that IE doesn't have, but we need.
+ */
+if (document.ELEMENT_NODE == null) {
+    document.ELEMENT_NODE = 1;
+    document.ATTRIBUTE_NODE = 2;
+    document.TEXT_NODE = 3;
+    document.CDATA_SECTION_NODE = 4;
+    document.ENTITY_REFERENCE_NODE = 5;
+    document.ENTITY_NODE = 6;
+    document.PROCESSING_INSTRUCTION_NODE = 7;
+    document.COMMENT_NODE = 8;
+    document.DOCUMENT_NODE = 9;
+    document.DOCUMENT_TYPE_NODE = 10;
+    document.DOCUMENT_FRAGMENT_NODE = 11;
+    document.NOTATION_NODE = 12;
+}
+
+/** Function: importNode
+ *
+ *  document.importNode implementation for IE, which doesn't have importNode
+ *
+ *  Parameters:
+ *    (Object) node - dom object
+ *    (Boolean) allChildren - import node's children too
+ */
+if (!document.importNode) {
+    document.importNode = function(node, allChildren) {
+        switch (node.nodeType) {
+            case document.ELEMENT_NODE:
+                var newNode = document.createElement(node.nodeName);
+                if (node.attributes && node.attributes.length > 0) {
+                    for(var i = 0; i < node.attributes.length; i++) {
+                        newNode.setAttribute(node.attributes[i].nodeName,
+                        node.getAttribute(node.attributes[i].nodeName));
+                    }
+                }
+                if (allChildren && node.childNodes &&
+                node.childNodes.length > 0) {
+                    for (var i = 0; i < node.childNodes.length; i++) {
+                        newNode.appendChild(document.importNode(
+                        node.childNodes[i], allChildren));
+                    }
+                }
+                return newNode;
+                break;
+            case document.TEXT_NODE:
+            case document.CDATA_SECTION_NODE:
+            case document.COMMENT_NODE:
+                return document.createTextNode(node.nodeValue);
+                break;
+        }
+    };
+}
+
+/**
+ *
+ * Bootstrap self into window.onload and window.onunload
+ */
+
+var oldonunload = window.onunload;
+
+window.onunload = function()
+{
+	if( oldonunload )
+	{
+        oldonunload();
+    }
+	
+	TrophyIM.setPresence('unavailable');
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.mini.js	(revision 4453)
@@ -0,0 +1,254 @@
+
+var Base64=(function(){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var obj={encode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
+output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
+if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return output;}};return obj;})();var MD5=(function(){var hexcase=0;var b64pad="";var chrsz=8;var safe_add=function(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);};var bit_rol=function(num,cnt){return(num<<cnt)|(num>>>(32-cnt));};var str2binl=function(str){var bin=[];var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
+{bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);}
+return bin;};var binl2str=function(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
+{str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);}
+return str;};var binl2hex=function(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
+{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
+return str;};var binl2b64=function(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";var triplet,j;for(var i=0;i<binarray.length*4;i+=3)
+{triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(j=0;j<4;j++)
+{if(i*8+j*6>binarray.length*32){str+=b64pad;}
+else{str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}}
+return str;};var md5_cmn=function(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);};var md5_ff=function(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);};var md5_gg=function(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);};var md5_hh=function(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);};var md5_ii=function(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);};var core_md5=function(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var olda,oldb,oldc,oldd;for(var i=0;i<x.length;i+=16)
+{olda=a;oldb=b;oldc=c;oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
+return[a,b,c,d];};var core_hmac_md5=function(key,data){var bkey=str2binl(key);if(bkey.length>16){bkey=core_md5(bkey,key.length*chrsz);}
+var ipad=new Array(16),opad=new Array(16);for(var i=0;i<16;i++)
+{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
+var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);};var obj={hexdigest:function(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));},b64digest:function(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));},hash:function(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));},hmac_hexdigest:function(key,data){return binl2hex(core_hmac_md5(key,data));},hmac_b64digest:function(key,data){return binl2b64(core_hmac_md5(key,data));},hmac_hash:function(key,data){return binl2str(core_hmac_md5(key,data));},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72";}};return obj;})();if(!Function.prototype.bind){Function.prototype.bind=function(obj)
+{var func=this;return function(){return func.apply(obj,arguments);};};}
+if(!Function.prototype.prependArg){Function.prototype.prependArg=function(arg)
+{var func=this;return function(){var newargs=[arg];for(var i=0;i<arguments.length;i++){newargs.push(arguments[i]);}
+return func.apply(this,newargs);};};}
+(function(callback){var Strophe;function $build(name,attrs){return new Strophe.Builder(name,attrs);}
+function $msg(attrs){return new Strophe.Builder("message",attrs);}
+function $iq(attrs){return new Strophe.Builder("iq",attrs);}
+function $pres(attrs){return new Strophe.Builder("presence",attrs);}
+Strophe={VERSION:"1.0.1",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",MUC_USER:"http://jabber.org/protocol/muc#user",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(name,value)
+{Strophe.NS[name]=value;},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(elem,elemName,func)
+{var i,childNode;for(i=0;i<elem.childNodes.length;i++){childNode=elem.childNodes[i];if(childNode.nodeType==Strophe.ElementType.NORMAL&&(!elemName||this.isTagEqual(childNode,elemName))){func(childNode);}}},isTagEqual:function(el,name)
+{return el.tagName.toLowerCase()==name.toLowerCase();},_xmlGenerator:null,_makeGenerator:function(){var doc;if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.appendChild(doc.createElement('strophe'));}else{doc=document.implementation.createDocument('jabber:client','strophe',null);}
+return doc;},xmlElement:function(name)
+{if(!name){return null;}
+var node=null;if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
+node=Strophe._xmlGenerator.createElement(name);var a,i,k;for(a=1;a<arguments.length;a++){if(!arguments[a]){continue;}
+if(typeof(arguments[a])=="string"||typeof(arguments[a])=="number"){node.appendChild(Strophe.xmlTextNode(arguments[a]));}else if(typeof(arguments[a])=="object"&&typeof(arguments[a].sort)=="function"){for(i=0;i<arguments[a].length;i++){if(typeof(arguments[a][i])=="object"&&typeof(arguments[a][i].sort)=="function"){node.setAttribute(arguments[a][i][0],arguments[a][i][1]);}}}else if(typeof(arguments[a])=="object"){for(k in arguments[a]){if(arguments[a].hasOwnProperty(k)){node.setAttribute(k,arguments[a][k]);}}}}
+return node;},xmlescape:function(text)
+{text=text.replace(/\&/g,"&amp;");text=text.replace(/</g,"&lt;");text=text.replace(/>/g,"&gt;");return text;},xmlTextNode:function(text)
+{text=Strophe.xmlescape(text);if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
+return Strophe._xmlGenerator.createTextNode(text);},getText:function(elem)
+{if(!elem){return null;}
+var str="";if(elem.childNodes.length===0&&elem.nodeType==Strophe.ElementType.TEXT){str+=elem.nodeValue;}
+for(var i=0;i<elem.childNodes.length;i++){if(elem.childNodes[i].nodeType==Strophe.ElementType.TEXT){str+=elem.childNodes[i].nodeValue;}}
+return str;},copyElement:function(elem)
+{var i,el;if(elem.nodeType==Strophe.ElementType.NORMAL){el=Strophe.xmlElement(elem.tagName);for(i=0;i<elem.attributes.length;i++){el.setAttribute(elem.attributes[i].nodeName.toLowerCase(),elem.attributes[i].value);}
+for(i=0;i<elem.childNodes.length;i++){el.appendChild(Strophe.copyElement(elem.childNodes[i]));}}else if(elem.nodeType==Strophe.ElementType.TEXT){el=Strophe.xmlTextNode(elem.nodeValue);}
+return el;},escapeNode:function(node)
+{return node.replace(/^\s+|\s+$/g,'').replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40");},unescapeNode:function(node)
+{return node.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\");},getNodeFromJid:function(jid)
+{if(jid.indexOf("@")<0){return null;}
+return jid.split("@")[0];},getDomainFromJid:function(jid)
+{var bare=Strophe.getBareJidFromJid(jid);if(bare.indexOf("@")<0){return bare;}else{var parts=bare.split("@");parts.splice(0,1);return parts.join('@');}},getResourceFromJid:function(jid)
+{var s=jid.split("/");if(s.length<2){return null;}
+s.splice(0,1);return s.join('/');},getBareJidFromJid:function(jid)
+{return jid.split("/")[0];},log:function(level,msg)
+{return;},debug:function(msg)
+{this.log(this.LogLevel.DEBUG,msg);},info:function(msg)
+{this.log(this.LogLevel.INFO,msg);},warn:function(msg)
+{this.log(this.LogLevel.WARN,msg);},error:function(msg)
+{this.log(this.LogLevel.ERROR,msg);},fatal:function(msg)
+{this.log(this.LogLevel.FATAL,msg);},serialize:function(elem)
+{var result;if(!elem){return null;}
+if(typeof(elem.tree)==="function"){elem=elem.tree();}
+var nodeName=elem.nodeName;var i,child;if(elem.getAttribute("_realname")){nodeName=elem.getAttribute("_realname");}
+result="<"+nodeName;for(i=0;i<elem.attributes.length;i++){if(elem.attributes[i].nodeName!="_realname"){result+=" "+elem.attributes[i].nodeName.toLowerCase()+"='"+elem.attributes[i].value.replace("&","&amp;").replace("'","&apos;").replace("<","&lt;")+"'";}}
+if(elem.childNodes.length>0){result+=">";for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeType==Strophe.ElementType.NORMAL){result+=Strophe.serialize(child);}else if(child.nodeType==Strophe.ElementType.TEXT){result+=child.nodeValue;}}
+result+="</"+nodeName+">";}else{result+="/>";}
+return result;},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(name,ptype)
+{Strophe._connectionPlugins[name]=ptype;}};Strophe.Builder=function(name,attrs)
+{if(name=="presence"||name=="message"||name=="iq"){if(attrs&&!attrs.xmlns){attrs.xmlns=Strophe.NS.CLIENT;}else if(!attrs){attrs={xmlns:Strophe.NS.CLIENT};}}
+this.nodeTree=Strophe.xmlElement(name,attrs);this.node=this.nodeTree;};Strophe.Builder.prototype={tree:function()
+{return this.nodeTree;},toString:function()
+{return Strophe.serialize(this.nodeTree);},up:function()
+{this.node=this.node.parentNode;return this;},attrs:function(moreattrs)
+{for(var k in moreattrs){if(moreattrs.hasOwnProperty(k)){this.node.setAttribute(k,moreattrs[k]);}}
+return this;},c:function(name,attrs)
+{var child=Strophe.xmlElement(name,attrs);this.node.appendChild(child);this.node=child;return this;},cnode:function(elem)
+{this.node.appendChild(elem);this.node=elem;return this;},t:function(text)
+{var child=Strophe.xmlTextNode(text);this.node.appendChild(child);return this;}};Strophe.Handler=function(handler,ns,name,type,id,from,options)
+{this.handler=handler;this.ns=ns;this.name=name;this.type=type;this.id=id;this.options=options||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false;}
+if(this.options.matchBare){this.from=Strophe.getBareJidFromJid(from);}else{this.from=from;}
+this.user=true;};Strophe.Handler.prototype={isMatch:function(elem)
+{var nsMatch;var from=null;if(this.options.matchBare){from=Strophe.getBareJidFromJid(elem.getAttribute('from'));}else{from=elem.getAttribute('from');}
+nsMatch=false;if(!this.ns){nsMatch=true;}else{var self=this;Strophe.forEachChild(elem,null,function(elem){if(elem.getAttribute("xmlns")==self.ns){nsMatch=true;}});nsMatch=nsMatch||elem.getAttribute("xmlns")==this.ns;}
+if(nsMatch&&(!this.name||Strophe.isTagEqual(elem,this.name))&&(!this.type||elem.getAttribute("type")===this.type)&&(!this.id||elem.getAttribute("id")===this.id)&&(!this.from||from===this.from)){return true;}
+return false;},run:function(elem)
+{var result=null;try{result=this.handler(elem);}catch(e){if(e.sourceURL){Strophe.fatal("error: "+this.handler+" "+e.sourceURL+":"+
+e.line+" - "+e.name+": "+e.message);}else if(e.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",e,e.message);}
+Strophe.fatal("error: "+this.handler+" "+
+e.fileName+":"+e.lineNumber+" - "+
+e.name+": "+e.message);}else{Strophe.fatal("error: "+this.handler);}
+throw e;}
+return result;},toString:function()
+{return"{Handler: "+this.handler+"("+this.name+","+
+this.id+","+this.ns+")}";}};Strophe.TimedHandler=function(period,handler)
+{this.period=period;this.handler=handler;this.lastCalled=new Date().getTime();this.user=true;};Strophe.TimedHandler.prototype={run:function()
+{this.lastCalled=new Date().getTime();return this.handler();},reset:function()
+{this.lastCalled=new Date().getTime();},toString:function()
+{return"{TimedHandler: "+this.handler+"("+this.period+")}";}};Strophe.Request=function(elem,func,rid,sends)
+{this.id=++Strophe._requestId;this.xmlData=elem;this.data=Strophe.serialize(elem);this.origFunc=func;this.func=func;this.rid=rid;this.date=NaN;this.sends=sends||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0;}
+var now=new Date();return(now-this.date)/1000;};this.timeDead=function(){if(!this.dead){return 0;}
+var now=new Date();return(now-this.dead)/1000;};this.xhr=this._newXHR();};Strophe.Request.prototype={getResponse:function()
+{var node=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){node=this.xhr.responseXML.documentElement;if(node.tagName=="parsererror"){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
+Strophe.serialize(this.xhr.responseXML));throw"parsererror";}}else if(this.xhr.responseText){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
+Strophe.serialize(this.xhr.responseXML));}
+return node;},_newXHR:function()
+{var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType("text/xml");}}else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
+xhr.onreadystatechange=this.func.prependArg(this);return xhr;}};Strophe.Connection=function(service)
+{this.service=service;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k];var F=function(){};F.prototype=ptype;this[k]=new F();this[k].init(this);}}};Strophe.Connection.prototype={reset:function()
+{this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000);},pause:function()
+{this.paused=true;},resume:function()
+{this.paused=false;},getUniqueId:function(suffix)
+{if(typeof(suffix)=="string"||typeof(suffix)=="number"){return++this._uniqueId+":"+suffix;}else{return++this._uniqueId+"";}},connect:function(jid,pass,callback,wait,hold)
+{this.jid=jid;this.pass=pass;this.connect_callback=callback;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=wait||this.wait;this.hold=hold||this.hold;this.domain=Strophe.getDomainFromJid(this.jid);var body=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":Strophe.NS.BOSH});this._changeConnectStatus(Strophe.Status.CONNECTING,null);this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();},attach:function(jid,sid,rid,callback,wait,hold,wind)
+{this.jid=jid;this.sid=sid;this.rid=rid;this.connect_callback=callback;this.domain=Strophe.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=wait||this.wait;this.hold=hold||this.hold;this.window=wind||this.window;this._changeConnectStatus(Strophe.Status.ATTACHED,null);},xmlInput:function(elem)
+{return;},xmlOutput:function(elem)
+{return;},rawInput:function(data)
+{return;},rawOutput:function(data)
+{return;},send:function(elem)
+{if(elem===null){return;}
+if(typeof(elem.sort)==="function"){for(var i=0;i<elem.length;i++){this._queueData(elem[i]);}}else if(typeof(elem.tree)==="function"){this._queueData(elem.tree());}else{this._queueData(elem);}
+this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},flush:function()
+{clearTimeout(this._idleTimeout);this._onIdle();},sendIQ:function(elem,callback,errback,timeout){var timeoutHandler=null;var that=this;if(typeof(elem.tree)==="function"){elem=elem.tree();}
+var id=elem.getAttribute('id');if(!id){id=this.getUniqueId("sendIQ");elem.setAttribute("id",id);}
+var handler=this.addHandler(function(stanza){if(timeoutHandler){that.deleteTimedHandler(timeoutHandler);}
+var iqtype=stanza.getAttribute('type');if(iqtype==='result'){if(callback){callback(stanza);}}else if(iqtype==='error'){if(errback){errback(stanza);}}else{throw{name:"StropheError",message:"Got bad IQ type of "+iqtype};}},null,'iq',null,id);if(timeout){timeoutHandler=this.addTimedHandler(timeout,function(){that.deleteHandler(handler);if(errback){errback(null);}
+return false;});}
+this.send(elem);return id;},_queueData:function(element){if(element===null||!element.tagName||!element.childNodes){throw{name:"StropheError",message:"Cannot queue non-DOMElement."};}
+this._data.push(element);},_sendRestart:function()
+{this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},addTimedHandler:function(period,handler)
+{var thand=new Strophe.TimedHandler(period,handler);this.addTimeds.push(thand);return thand;},deleteTimedHandler:function(handRef)
+{this.removeTimeds.push(handRef);},addHandler:function(handler,ns,name,type,id,from,options)
+{var hand=new Strophe.Handler(handler,ns,name,type,id,from,options);this.addHandlers.push(hand);return hand;},deleteHandler:function(handRef)
+{this.removeHandlers.push(handRef);},disconnect:function(reason)
+{this._changeConnectStatus(Strophe.Status.DISCONNECTING,reason);Strophe.info("Disconnect was called because: "+reason);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(3000,this._onDisconnectTimeout.bind(this));this._sendTerminate();}},_changeConnectStatus:function(status,condition)
+{for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var plugin=this[k];if(plugin.statusChanged){try{plugin.statusChanged(status,condition);}catch(err){Strophe.error(""+k+" plugin caused an exception "+"changing status: "+err);}}}}
+if(this.connect_callback){try{this.connect_callback(status,condition);}catch(e){Strophe.error("User connection callback caused an "+"exception: "+e);}}},_buildBody:function()
+{var bodyWrap=$build('body',{rid:this.rid++,xmlns:Strophe.NS.HTTPBIND});if(this.sid!==null){bodyWrap.attrs({sid:this.sid});}
+return bodyWrap;},_removeRequest:function(req)
+{Strophe.debug("removing request");var i;for(i=this._requests.length-1;i>=0;i--){if(req==this._requests[i]){this._requests.splice(i,1);}}
+req.xhr.onreadystatechange=function(){};this._throttledRequestHandler();},_restartRequest:function(i)
+{var req=this._requests[i];if(req.dead===null){req.dead=new Date();}
+this._processRequest(i);},_processRequest:function(i)
+{var req=this._requests[i];var reqStatus=-1;try{if(req.xhr.readyState==4){reqStatus=req.xhr.status;}}catch(e){Strophe.error("caught an error in _requests["+i+"], reqStatus: "+reqStatus);}
+if(typeof(reqStatus)=="undefined"){reqStatus=-1;}
+var time_elapsed=req.age();var primaryTimeout=(!isNaN(time_elapsed)&&time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait));var secondaryTimeout=(req.dead!==null&&req.timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait));var requestCompletedWithServerError=(req.xhr.readyState==4&&(reqStatus<1||reqStatus>=500));if(primaryTimeout||secondaryTimeout||requestCompletedWithServerError){if(secondaryTimeout){Strophe.error("Request "+
+this._requests[i].id+" timed out (secondary), restarting");}
+req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};this._requests[i]=new Strophe.Request(req.xmlData,req.origFunc,req.rid,req.sends);req=this._requests[i];}
+if(req.xhr.readyState===0){Strophe.debug("request id "+req.id+"."+req.sends+" posting");req.date=new Date();try{req.xhr.open("POST",this.service,true);}catch(e2){Strophe.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(Strophe.Status.CONNFAIL,"bad-service");}
+this.disconnect();return;}
+var sendFunc=function(){req.xhr.send(req.data);};if(req.sends>1){var backoff=Math.pow(req.sends,3)*1000;setTimeout(sendFunc,backoff);}else{sendFunc();}
+req.sends++;this.xmlOutput(req.xmlData);this.rawOutput(req.data);}else{Strophe.debug("_processRequest: "+
+(i===0?"first":"second")+" request has readyState of "+
+req.xhr.readyState);}},_throttledRequestHandler:function()
+{if(!this._requests){Strophe.debug("_throttledRequestHandler called with "+"undefined requests");}else{Strophe.debug("_throttledRequestHandler called with "+
+this._requests.length+" requests");}
+if(!this._requests||this._requests.length===0){return;}
+if(this._requests.length>0){this._processRequest(0);}
+if(this._requests.length>1&&Math.abs(this._requests[0].rid-
+this._requests[1].rid)<this.window-1){this._processRequest(1);}},_onRequestStateChange:function(func,req)
+{Strophe.debug("request id "+req.id+"."+req.sends+" state changed to "+
+req.xhr.readyState);if(req.abort){req.abort=false;return;}
+var reqStatus;if(req.xhr.readyState==4){reqStatus=0;try{reqStatus=req.xhr.status;}catch(e){}
+if(typeof(reqStatus)=="undefined"){reqStatus=0;}
+if(this.disconnecting){if(reqStatus>=400){this._hitError(reqStatus);return;}}
+var reqIs0=(this._requests[0]==req);var reqIs1=(this._requests[1]==req);if((reqStatus>0&&reqStatus<500)||req.sends>5){this._removeRequest(req);Strophe.debug("request id "+
+req.id+" should now be removed");}
+if(reqStatus==200){if(reqIs1||(reqIs0&&this._requests.length>0&&this._requests[0].age()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0);}
+Strophe.debug("request id "+
+req.id+"."+
+req.sends+" got 200");func(req);this.errors=0;}else{Strophe.error("request id "+
+req.id+"."+
+req.sends+" error "+reqStatus+" happened");if(reqStatus===0||(reqStatus>=400&&reqStatus<600)||reqStatus>=12000){this._hitError(reqStatus);if(reqStatus>=400&&reqStatus<500){this._changeConnectStatus(Strophe.Status.DISCONNECTING,null);this._doDisconnect();}}}
+if(!((reqStatus>0&&reqStatus<10000)||req.sends>5)){this._throttledRequestHandler();}}},_hitError:function(reqStatus)
+{this.errors++;Strophe.warn("request errored, status: "+reqStatus+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout();}},_doDisconnect:function()
+{Strophe.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(Strophe.Status.DISCONNECTED,null);this.connected=false;}
+this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];},_dataRecv:function(req)
+{var arrayIndexOf=function(pArray,pInd)
+{var len=pArray.length;for(var i=0;i<len;i++)
+{if(pArray[i]==pInd)
+return i;}
+return-1;};try{var elem=req.getResponse();}catch(e){if(e!="parsererror"){throw e;}
+this.disconnect("strophe-parsererror");}
+if(elem===null){return;}
+this.xmlInput(elem);this.rawInput(Strophe.serialize(elem));var i,hand;while(this.removeHandlers.length>0)
+{hand=this.removeHandlers.pop();i=arrayIndexOf(this.handlers,hand);if(i>=0)
+{this.handlers.splice(i,1);}}
+while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop());}
+if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return;}
+var typ=elem.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=elem.getAttribute("condition");conflict=elem.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
+this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
+this.disconnect();return;}
+var self=this;Strophe.forEachChild(elem,null,function(child){var i,newList;newList=self.handlers;self.handlers=[];for(i=0;i<newList.length;i++){var hand=newList[i];if(hand.isMatch(child)&&(self.authenticated||!hand.user)){if(hand.run(child)){self.handlers.push(hand);}}else{self.handlers.push(hand);}}});},_sendTerminate:function()
+{Strophe.info("_sendTerminate was called");var body=this._buildBody().attrs({type:"terminate"});if(this.authenticated){body.c('presence',{xmlns:Strophe.NS.CLIENT,type:'unavailable'});}
+this.disconnecting=true;var req=new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid"));this._requests.push(req);this._throttledRequestHandler();},_connect_cb:function(req)
+{Strophe.info("_connect_cb was called");this.connected=true;var bodyWrap=req.getResponse();if(!bodyWrap){return;}
+this.xmlInput(bodyWrap);this.rawInput(Strophe.serialize(bodyWrap));var typ=bodyWrap.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=bodyWrap.getAttribute("condition");conflict=bodyWrap.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
+this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
+return;}
+if(!this.sid){this.sid=bodyWrap.getAttribute("sid");}
+if(!this.stream_id){this.stream_id=bodyWrap.getAttribute("authid");}
+var wind=bodyWrap.getAttribute('requests');if(wind){this.window=parseInt(wind,10);}
+var hold=bodyWrap.getAttribute('hold');if(hold){this.hold=parseInt(hold,10);}
+var wait=bodyWrap.getAttribute('wait');if(wait){this.wait=parseInt(wait,10);}
+var do_sasl_plain=false;var do_sasl_digest_md5=false;var do_sasl_anonymous=false;var mechanisms=bodyWrap.getElementsByTagName("mechanism");var i,mech,auth_str,hashed_auth_str;if(mechanisms.length>0){for(i=0;i<mechanisms.length;i++){mech=Strophe.getText(mechanisms[i]);if(mech=='DIGEST-MD5'){do_sasl_digest_md5=true;}else if(mech=='PLAIN'){do_sasl_plain=true;}else if(mech=='ANONYMOUS'){do_sasl_anonymous=true;}}}else{var body=this._buildBody();this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();return;}
+if(Strophe.getNodeFromJid(this.jid)===null&&do_sasl_anonymous){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"ANONYMOUS"}).tree());}else if(Strophe.getNodeFromJid(this.jid)===null){this._changeConnectStatus(Strophe.Status.CONNFAIL,'x-strophe-bad-non-anon-jid');this.disconnect();}else if(do_sasl_digest_md5){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"DIGEST-MD5"}).tree());}else if(do_sasl_plain){auth_str=Strophe.getBareJidFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+Strophe.getNodeFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+this.pass;this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);hashed_auth_str=Base64.encode(auth_str);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"PLAIN"}).t(hashed_auth_str).tree());}else{this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send($iq({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).tree());}},_sasl_challenge1_cb:function(elem)
+{var attribMatch=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var challenge=Base64.decode(Strophe.getText(elem));var cnonce=MD5.hexdigest(Math.random()*1234567890);var realm="";var host=null;var nonce="";var qop="";var matches;this.deleteHandler(this._sasl_failure_handler);while(challenge.match(attribMatch)){matches=challenge.match(attribMatch);challenge=challenge.replace(matches[0],"");matches[2]=matches[2].replace(/^"(.+)"$/,"$1");switch(matches[1]){case"realm":realm=matches[2];break;case"nonce":nonce=matches[2];break;case"qop":qop=matches[2];break;case"host":host=matches[2];break;}}
+var digest_uri="xmpp/"+this.domain;if(host!==null){digest_uri=digest_uri+"/"+host;}
+var A1=MD5.hash(Strophe.getNodeFromJid(this.jid)+":"+realm+":"+this.pass)+":"+nonce+":"+cnonce;var A2='AUTHENTICATE:'+digest_uri;var responseText="";responseText+='username='+
+this._quote(Strophe.getNodeFromJid(this.jid))+',';responseText+='realm='+this._quote(realm)+',';responseText+='nonce='+this._quote(nonce)+',';responseText+='cnonce='+this._quote(cnonce)+',';responseText+='nc="00000001",';responseText+='qop="auth",';responseText+='digest-uri='+this._quote(digest_uri)+',';responseText+='response='+this._quote(MD5.hexdigest(MD5.hexdigest(A1)+":"+
+nonce+":00000001:"+
+cnonce+":auth:"+
+MD5.hexdigest(A2)))+',';responseText+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).t(Base64.encode(responseText)).tree());return false;},_quote:function(str)
+{return'"'+str.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';},_sasl_challenge2_cb:function(elem)
+{this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).tree());return false;},_auth1_cb:function(elem)
+{var iq=$iq({type:"set",id:"_auth_2"}).c('query',{xmlns:Strophe.NS.AUTH}).c('username',{}).t(Strophe.getNodeFromJid(this.jid)).up().c('password').t(this.pass);if(!Strophe.getResourceFromJid(this.jid)){this.jid=Strophe.getBareJidFromJid(this.jid)+'/strophe';}
+iq.up().c('resource',{}).t(Strophe.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(iq.tree());return false;},_sasl_success_cb:function(elem)
+{Strophe.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
+this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false;},_sasl_auth1_cb:function(elem)
+{var i,child;for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeName=='bind'){this.do_bind=true;}
+if(child.nodeName=='session'){this.do_session=true;}}
+if(!this.do_bind){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var resource=Strophe.getResourceFromJid(this.jid);if(resource){this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).c('resource',{}).t(resource).tree());}else{this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).tree());}}
+return false;},_sasl_bind_cb:function(elem)
+{if(elem.getAttribute("type")=="error"){Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
+var bind=elem.getElementsByTagName("bind");var jidNode;if(bind.length>0){jidNode=bind[0].getElementsByTagName("jid");if(jidNode.length>0){this.jid=Strophe.getText(jidNode[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send($iq({type:"set",id:"_session_auth_2"}).c('session',{xmlns:Strophe.NS.SESSION}).tree());}else{this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}}}else{Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}},_sasl_session_cb:function(elem)
+{if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){Strophe.info("Session creation failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
+return false;},_sasl_failure_cb:function(elem)
+{if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null;}
+if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
+this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;},_auth2_cb:function(elem)
+{if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);this.disconnect();}
+return false;},_addSysTimedHandler:function(period,handler)
+{var thand=new Strophe.TimedHandler(period,handler);thand.user=false;this.addTimeds.push(thand);return thand;},_addSysHandler:function(handler,ns,name,type,id)
+{var hand=new Strophe.Handler(handler,ns,name,type,id);hand.user=false;this.addHandlers.push(hand);return hand;},_onDisconnectTimeout:function()
+{Strophe.info("_onDisconnectTimeout was called");var req;while(this._requests.length>0){req=this._requests.pop();req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};}
+this._doDisconnect();return false;},_onIdle:function()
+{var arrayIndexOf=function(pArray,pInd)
+{var len=pArray.length;for(var i=0;i<len;i++)
+{if(pArray[i]==pInd)
+return i;}
+return-1;};var i,thand,since,newList;while(this.removeTimeds.length>0)
+{thand=this.removeTimeds.pop();i=arrayIndexOf(this.timedHandlers,thand);if(i>=0)
+{this.timedHandlers.splice(i,1);}}
+while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop());}
+var now=new Date().getTime();newList=[];for(i=0;i<this.timedHandlers.length;i++){thand=this.timedHandlers[i];if(this.authenticated||!thand.user){since=thand.lastCalled+thand.period;if(since-now<=0){if(thand.run()){newList.push(thand);}}else{newList.push(thand);}}}
+this.timedHandlers=newList;var body,time_elapsed;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){Strophe.info("no requests during idle cycle, sending "+"blank request");this._data.push(null);}
+if(this._requests.length<2&&this._data.length>0&&!this.paused){body=this._buildBody();for(i=0;i<this._data.length;i++){if(this._data[i]!==null){if(this._data[i]==="restart"){body.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":Strophe.NS.BOSH});}else{body.cnode(this._data[i]).up();}}}
+delete this._data;this._data=[];this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid")));this._processRequest(this._requests.length-1);}
+if(this._requests.length>0){time_elapsed=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler();}}
+if(time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait)){Strophe.warn("Request "+
+this._requests[0].id+" timed out, over "+Math.floor(Strophe.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler();}}
+clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);}};if(callback){callback(Strophe,$build,$msg,$iq,$pres);}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4];});
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.mini.js	(revision 4453)
@@ -0,0 +1,56 @@
+
+(function()
+{var Xtools=null;var conn=null;function addContact()
+{if(arguments.length>0)
+{var jidFrom=Base64.decode(loadscript.getUserCurrent().jid);var jidTo=arguments[0];var group="";var name=jidTo.substring(0,jidTo.indexOf('@'));var _groups="";if(TrophyIM.rosterObj)
+{for(var group in TrophyIM.rosterObj.groups)
+{_groups+=group+";";}
+_groups=_groups.substring(0,(_groups.length-1));}
+var _paramNewUser={'name_contact':name,'jidFrom':jidFrom,'jidTo':jidTo,'selectBoxOptions':_groups};var winNewUser={id_window:"new_user_jabberit",width:320,height:165,top:100,left:350,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:'Expresso Messenger - '+i18n.NEW_USER,closeAction:"remove",content:Xtools.parse(Xtools.xml('new_user'),'newUser.xsl',_paramNewUser)};_winBuild(winNewUser);loadscript.setSelectEditable(document.getElementById('name_group_new_user_jabberit'),5,99);var _pButtons={'lang1':i18n.ADD,'lang2':i18n.CLOSE,'onclickClose':'_winBuild("new_user_jabberit","remove");','onclickSubmit':'loadscript.addNewUser();'};document.getElementById('buttons_newuser').innerHTML=Xtools.parse(Xtools.xml('buttons_main'),'buttons.xsl',_pButtons);}
+else
+{var jidFrom=Base64.decode(loadscript.getUserCurrent().jid);var jidTo=getElement('user_jid_jabberIM').value;var name=getElement('user_name_jabberIM').value;var group=getElement('user_group_jabberIM').value;_winBuild('add_user_info','remove');if(jidFrom!=jidTo)
+{TrophyIM.setAutorization(jidTo,jidFrom,'subscribe');TrophyIM.addContact(jidTo,name,group);}}}
+function addNewUser()
+{var name=getElement('name_new_user_jabberit').value;var group=getElement('name_group_new_user_jabberit').value;var jidFrom=getElement('jidFrom_new_user_jabberit').value;var jidTo=getElement('jidTo_new_user_jabberit').value;if((name=name.replace(/^\s+|\s+$|^\n|\n$/g,""))=="")
+name="";if(name==null||name=="")
+name="";if((group=group.replace(/^\s+|\s+$|^\n|\n$/g,""))=="")
+group="";if(group==null||group=="")
+group="";if(jidFrom!=jidTo)
+{TrophyIM.rosterObj.removeContact(jidTo);loadscript.removeElement(getElement('itenContact_'+jidTo));loadscript.removeElement(getElement('span_show_itenContact_'+jidTo));loadscript.removeElement(getElement('itenContactNotification_'+jidTo));TrophyIM.addContact(jidTo,name,group);TrophyIM.setAutorization(jidTo,jidFrom,'subscribe');_winBuild("new_user_jabberit","remove");}}
+function getElement(elementId)
+{return document.getElementById(elementId);}
+function search()
+{var _input=document.getElementById('search_user_jabber');var _span=document.getElementById('span_searching_im');var _div=document.getElementById('list_users_ldap_im');_span.style.display="block";if(_input.value.substring((_input.value.length-1),_input.value.length)==="*")
+_input.value=_input.value.substring(0,(_input.value.length-1));if(_input.value.substring(0,1)==="*")
+_input.value=_input.value.substring(1,_input.value.length);conn.go('p.cc.getListContacts',function(data)
+{var _paramsVar={'lang_addContact':i18n.ADD_CONTACTS,'lang_empty':i18n.NONE_RESULT_WAS_FOUND,'lang_error':i18n.TRY_AGAIN,'lang_many_results':i18n.MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH};_div.innerHTML=Xtools.parse(data,'listLdapContacts.xsl',_paramsVar);var _newUser=_div.firstChild;while(_newUser)
+{if(_newUser.getAttribute('photo')==='1')
+{var jid=_newUser.getAttribute('jid');var ou=_newUser.getAttribute('ou');var _img_path=path_jabberit+'inc/WebService.php?'+Date.parse(new Date);_img_path+='&photo_session='+jid+'&ou='+ou;_newUser.style.backgroundImage='url('+_img_path+')';}
+loadscript.configEvents(_newUser,'onclick',showContact);_newUser=_newUser.nextSibling;}
+_input.focus();_input.value="";_span.style.display="none";},'name='+_input.value);}
+function showContact(Element)
+{var element=(Element.target)?Element.target:Element.srcElement;var infoUser=null;var img=document.createElement('img');var _groups="";if(TrophyIM.rosterObj)
+{for(var group in TrophyIM.rosterObj.groups)
+{_groups+=group+";";}
+_groups=_groups.substring(0,(_groups.length-1));}
+if(element.getAttribute('value'))
+{var infoUser={'email':element.getAttribute('value').substring(0,element.getAttribute('value').indexOf(';')),'jid':element.getAttribute('jid'),'lang_group':"Grupo",'lang_name_contact':"Contato",'group':element.getAttribute('ou'),'name':element.getAttribute('name').substring(0,element.getAttribute('name').indexOf(' ')),'ou':element.getAttribute('ou'),'selectBoxOptions':_groups,'uid':element.getAttribute('value').substring(element.getAttribute('value').indexOf(';')+1)};}
+else if(element.parentNode.getAttribute('value'))
+{var infoUser={'email':element.parentNode.getAttribute('value').substring(0,element.parentNode.getAttribute('value').indexOf(';')),'jid':element.parentNode.getAttribute('jid'),'lang_group':"Grupo",'lang_name_contact':"Contato",'group':element.parentNode.getAttribute('ou'),'name':element.parentNode.getAttribute('name').substring(0,element.parentNode.getAttribute('name').indexOf(' ')),'ou':element.parentNode.getAttribute('ou'),'selectBoxOptions':_groups,'uid':element.parentNode.getAttribute('value').substring(element.parentNode.getAttribute('value').indexOf(';')+1)};}
+var winAddUser={id_window:"add_user_info",width:370,height:200,top:85,left:220,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:'Expresso Messenger - '+i18n.ADD_CONTACT,closeAction:"remove",content:Xtools.parse(Xtools.xml('adduser'),'addUser.xsl',infoUser)};_winBuild(winAddUser);var _pButtons={'lang1':i18n.ADD,'lang2':i18n.CLOSE,'onclickClose':'_winBuild("'+winAddUser.id_window+'","remove");','onclickSubmit':'loadscript.addContact(this);'};document.getElementById('buttons_adduser').innerHTML=Xtools.parse(Xtools.xml('buttons_main'),'buttons.xsl',_pButtons);loadscript.setSelectEditable(document.getElementById('user_group_jabberIM'),35,155);var _img=null;if(element.style.backgroundImage)
+_img=element.cloneNode(false);if(element.parentNode.style.backgroundImage)
+_img=element.parentNode.cloneNode(false);if(_img!=null)
+{_img.style.width='60px';_img.style.height='80px';_img.style.display='block';_img.style.backgroundRepeat='no-repeat';}
+else
+{_img=document.createElement("img");_img.style.width='60px';_img.style.height='80px';_img.style.display='block';_img.src=path_jabberit+"templates/default/images/photo.png";}
+with(document.getElementById('photo_user_ldap_jabber'))
+{if(hasChildNodes())
+while(hasChildNodes())
+{removeNode(firstChild);}
+appendChild(_img);}}
+function showForm()
+{var _paramsWindAddUser={'lang_group':i18n.GROUP,'lang_load':i18n.LOAD,'lang_name_contact':i18n.NAME_CONTACT,'lang_result':i18n.SEARCH_RESULT,'path':path_jabberit};var windAddUser={id_window:"add_user_im",width:440,height:350,top:80,left:200,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:'Expresso Messenger - '+i18n.SEARCH_USERS,closeAction:"remove",content:Xtools.parse(Xtools.xml('userinfo'),'addUser.xsl',_paramsWindAddUser)};_winBuild(windAddUser);}
+function loadAddUser()
+{if(arguments.length>0)
+{Xtools=arguments[0];conn=arguments[1];}}
+loadAddUser.prototype.add=addContact;loadAddUser.prototype.newUser=addNewUser;loadAddUser.prototype.search=search;loadAddUser.prototype.show=showForm;window.addUserIM=loadAddUser;})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/strophe.js	(revision 4453)
@@ -0,0 +1,3581 @@
+// This code was written by Tyler Akins and has been placed in the
+// public domain.  It would be nice if you left this header intact.
+// Base64 code from Tyler Akins -- http://rumkin.com
+
+var Base64 = (function () {
+    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+    var obj = {
+        /**
+         * Encodes a string in base64
+         * @param {String} input The string to encode in base64.
+         */
+        encode: function (input) {
+            var output = "";
+            var chr1, chr2, chr3;
+            var enc1, enc2, enc3, enc4;
+            var i = 0;
+        
+            do {
+                chr1 = input.charCodeAt(i++);
+                chr2 = input.charCodeAt(i++);
+                chr3 = input.charCodeAt(i++);
+                
+                enc1 = chr1 >> 2;
+                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+                enc4 = chr3 & 63;
+
+                if (isNaN(chr2)) {
+                    enc3 = enc4 = 64;
+                } else if (isNaN(chr3)) {
+                    enc4 = 64;
+                }
+                
+                output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
+                    keyStr.charAt(enc3) + keyStr.charAt(enc4);
+            } while (i < input.length);
+            
+            return output;
+        },
+        
+        /**
+         * Decodes a base64 string.
+         * @param {String} input The string to decode.
+         */
+        decode: function (input) {
+            var output = "";
+            var chr1, chr2, chr3;
+            var enc1, enc2, enc3, enc4;
+            var i = 0;
+            
+            // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
+            input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+            
+            do {
+                enc1 = keyStr.indexOf(input.charAt(i++));
+                enc2 = keyStr.indexOf(input.charAt(i++));
+                enc3 = keyStr.indexOf(input.charAt(i++));
+                enc4 = keyStr.indexOf(input.charAt(i++));
+                
+                chr1 = (enc1 << 2) | (enc2 >> 4);
+                chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+                chr3 = ((enc3 & 3) << 6) | enc4;
+                
+                output = output + String.fromCharCode(chr1);
+                
+                if (enc3 != 64) {
+                    output = output + String.fromCharCode(chr2);
+                }
+                if (enc4 != 64) {
+                    output = output + String.fromCharCode(chr3);
+                }
+            } while (i < input.length);
+            
+            return output;
+        }
+    };
+
+    return obj;
+})();
+/*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+var MD5 = (function () {
+    /*
+     * Configurable variables. You may need to tweak these to be compatible with
+     * the server-side, but the defaults work in most cases.
+     */
+    var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase */
+    var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance */
+    var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode */
+
+    /*
+     * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+     * to work around bugs in some JS interpreters.
+     */
+    var safe_add = function (x, y) {
+        var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+        var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+        return (msw << 16) | (lsw & 0xFFFF);
+    };
+
+    /*
+     * Bitwise rotate a 32-bit number to the left.
+     */
+    var bit_rol = function (num, cnt) {
+        return (num << cnt) | (num >>> (32 - cnt));
+    };
+
+    /*
+     * Convert a string to an array of little-endian words
+     * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
+     */
+    var str2binl = function (str) {
+        var bin = [];
+        var mask = (1 << chrsz) - 1;
+        for(var i = 0; i < str.length * chrsz; i += chrsz)
+        {
+            bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+        }
+        return bin;
+    };
+
+    /*
+     * Convert an array of little-endian words to a string
+     */
+    var binl2str = function (bin) {
+        var str = "";
+        var mask = (1 << chrsz) - 1;
+        for(var i = 0; i < bin.length * 32; i += chrsz)
+        {
+            str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
+        }
+        return str;
+    };
+
+    /*
+     * Convert an array of little-endian words to a hex string.
+     */
+    var binl2hex = function (binarray) {
+        var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+        var str = "";
+        for(var i = 0; i < binarray.length * 4; i++)
+        {
+            str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
+                hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
+        }
+        return str;
+    };
+
+    /*
+     * Convert an array of little-endian words to a base-64 string
+     */
+    var binl2b64 = function (binarray) {
+        var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+        var str = "";
+        var triplet, j;
+        for(var i = 0; i < binarray.length * 4; i += 3)
+        {
+            triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16) |
+                (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) |
+                ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
+            for(j = 0; j < 4; j++)
+            {
+                if(i * 8 + j * 6 > binarray.length * 32) { str += b64pad; }
+                else { str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); }
+            }
+        }
+        return str;
+    };
+
+    /*
+     * These functions implement the four basic operations the algorithm uses.
+     */
+    var md5_cmn = function (q, a, b, x, s, t) {
+        return safe_add(bit_rol(safe_add(safe_add(a, q),safe_add(x, t)), s),b);
+    };
+
+    var md5_ff = function (a, b, c, d, x, s, t) {
+        return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+    };
+
+    var md5_gg = function (a, b, c, d, x, s, t) {
+        return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+    };
+
+    var md5_hh = function (a, b, c, d, x, s, t) {
+        return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+    };
+
+    var md5_ii = function (a, b, c, d, x, s, t) {
+        return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+    };
+    
+    /*
+     * Calculate the MD5 of an array of little-endian words, and a bit length
+     */
+    var core_md5 = function (x, len) {
+        /* append padding */
+        x[len >> 5] |= 0x80 << ((len) % 32);
+        x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+        var a =  1732584193;
+        var b = -271733879;
+        var c = -1732584194;
+        var d =  271733878;
+
+        var olda, oldb, oldc, oldd;
+        for (var i = 0; i < x.length; i += 16)
+        {
+            olda = a;
+            oldb = b;
+            oldc = c;
+            oldd = d;
+            
+            a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
+            d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
+            c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
+            b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
+            a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
+            d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
+            c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+            b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
+            a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
+            d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
+            c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
+            b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
+            a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
+            d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
+            c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
+            b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
+            
+            a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
+            d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
+            c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
+            b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
+            a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
+            d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
+            c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
+            b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
+            a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
+            d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
+            c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
+            b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
+            a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
+            d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
+            c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
+            b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
+            
+            a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
+            d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
+            c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
+            b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
+            a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
+            d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
+            c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
+            b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
+            a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
+            d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
+            c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
+            b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
+            a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
+            d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
+            c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
+            b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
+            
+            a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
+            d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
+            c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
+            b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
+            a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
+            d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
+            c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
+            b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
+            a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
+            d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
+            c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
+            b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
+            a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
+            d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
+            c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
+            b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
+            
+            a = safe_add(a, olda);
+            b = safe_add(b, oldb);
+            c = safe_add(c, oldc);
+            d = safe_add(d, oldd);
+        }
+        return [a, b, c, d];
+    };
+
+
+    /*
+     * Calculate the HMAC-MD5, of a key and some data
+     */
+    var core_hmac_md5 = function (key, data) {
+        var bkey = str2binl(key);
+        if(bkey.length > 16) { bkey = core_md5(bkey, key.length * chrsz); }
+        
+        var ipad = new Array(16), opad = new Array(16);
+        for(var i = 0; i < 16; i++)
+        {
+            ipad[i] = bkey[i] ^ 0x36363636;
+            opad[i] = bkey[i] ^ 0x5C5C5C5C;
+        }
+        
+        var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
+        return core_md5(opad.concat(hash), 512 + 128);
+    };
+
+    var obj = {
+        /*
+         * These are the functions you'll usually want to call.
+         * They take string arguments and return either hex or base-64 encoded
+         * strings.
+         */
+        hexdigest: function (s) {
+            return binl2hex(core_md5(str2binl(s), s.length * chrsz));
+        },
+
+        b64digest: function (s) {
+            return binl2b64(core_md5(str2binl(s), s.length * chrsz));
+        },
+
+        hash: function (s) {
+            return binl2str(core_md5(str2binl(s), s.length * chrsz));
+        },
+
+        hmac_hexdigest: function (key, data) {
+            return binl2hex(core_hmac_md5(key, data));
+        },
+
+        hmac_b64digest: function (key, data) {
+            return binl2b64(core_hmac_md5(key, data));
+        },
+
+        hmac_hash: function (key, data) {
+            return binl2str(core_hmac_md5(key, data));
+        },
+
+        /*
+         * Perform a simple self-test to see if the VM is working
+         */
+        test: function () {
+            return MD5.hexdigest("abc") === "900150983cd24fb0d6963f7d28e17f72";
+        }
+    };
+
+    return obj;
+})();
+
+/*
+    This program is distributed under the terms of the MIT license.
+    Please see the LICENSE file for details.
+
+    Copyright 2006-2008, OGG, LLC
+*/
+
+/* jslint configuration: */
+/*global document, window, setTimeout, clearTimeout, console,
+    XMLHttpRequest, ActiveXObject,
+    Base64, MD5,
+    Strophe, $build, $msg, $iq, $pres */
+
+/** File: strophe.js
+ *  A JavaScript library for XMPP BOSH.
+ *
+ *  This is the JavaScript version of the Strophe library.  Since JavaScript
+ *  has no facilities for persistent TCP connections, this library uses
+ *  Bidirectional-streams Over Synchronous HTTP (BOSH) to emulate
+ *  a persistent, stateful, two-way connection to an XMPP server.  More
+ *  information on BOSH can be found in XEP 124.
+ */
+
+/** PrivateFunction: Function.prototype.bind
+ *  Bind a function to an instance.
+ *
+ *  This Function object extension method creates a bound method similar
+ *  to those in Python.  This means that the 'this' object will point
+ *  to the instance you want.  See
+ *  <a href='http://benjamin.smedbergs.us/blog/2007-01-03/bound-functions-and-function-imports-in-javascript/'>Bound Functions and Function Imports in JavaScript</a>
+ *  for a complete explanation.
+ *
+ *  This extension already exists in some browsers (namely, Firefox 3), but
+ *  we provide it to support those that don't.
+ *
+ *  Parameters:
+ *    (Object) obj - The object that will become 'this' in the bound function.
+ *
+ *  Returns:
+ *    The bound function.
+ */
+if (!Function.prototype.bind) {
+    Function.prototype.bind = function (obj)
+    {
+        var func = this;
+        return function () { return func.apply(obj, arguments); };
+    };
+}
+
+/** PrivateFunction: Function.prototype.prependArg
+ *  Prepend an argument to a function.
+ *
+ *  This Function object extension method returns a Function that will
+ *  invoke the original function with an argument prepended.  This is useful
+ *  when some object has a callback that needs to get that same object as
+ *  an argument.  The following fragment illustrates a simple case of this
+ *  > var obj = new Foo(this.someMethod);</code></blockquote>
+ *
+ *  Foo's constructor can now use func.prependArg(this) to ensure the
+ *  passed in callback function gets the instance of Foo as an argument.
+ *  Doing this without prependArg would mean not setting the callback
+ *  from the constructor.
+ *
+ *  This is used inside Strophe for passing the Strophe.Request object to
+ *  the onreadystatechange handler of XMLHttpRequests.
+ *
+ *  Parameters:
+ *    arg - The argument to pass as the first parameter to the function.
+ *
+ *  Returns:
+ *    A new Function which calls the original with the prepended argument.
+ */
+if (!Function.prototype.prependArg) {
+    Function.prototype.prependArg = function (arg)
+    {
+        var func = this;
+
+        return function () {
+            var newargs = [arg];
+            for (var i = 0; i < arguments.length; i++) {
+                newargs.push(arguments[i]);
+            }
+            return func.apply(this, newargs);
+        };
+    };
+}
+
+/** PrivateFunction: Array.prototype.indexOf
+ *  Return the index of an object in an array.
+ *
+ *  This function is not supplied by some JavaScript implementations, so
+ *  we provide it if it is missing.  This code is from:
+ *  http://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf
+ *
+ *  Parameters:
+ *    (Object) elt - The object to look for.
+ *    (Integer) from - The index from which to start looking. (optional).
+ *
+ *  Returns:
+ *    The index of elt in the array or -1 if not found.
+ */
+
+/*
+if (!Array.prototype.indexOf)
+{
+    Array.prototype.indexOf = function( elt )
+    {
+        var len = this.length;
+
+        var from = Number(arguments[1]) || 0;
+        from = (from < 0) ? Math.ceil(from) : Math.floor(from);
+        if (from < 0) {
+            from += len;
+        }
+
+        for (; from < len; from++) {
+            if (from in this && this[from] === elt) {
+                return from;
+            }
+        }
+
+        return -1;
+    };
+}
+*/
+
+/* All of the Strophe globals are defined in this special function below so
+ * that references to the globals become closures.  This will ensure that
+ * on page reload, these references will still be available to callbacks
+ * that are still executing.
+ */
+
+(function (callback) {
+var Strophe;
+
+/** Function: $build
+ *  Create a Strophe.Builder.
+ *  This is an alias for 'new Strophe.Builder(name, attrs)'.
+ *
+ *  Parameters:
+ *    (String) name - The root element name.
+ *    (Object) attrs - The attributes for the root element in object notation.
+ *
+ *  Returns:
+ *    A new Strophe.Builder object.
+ */
+function $build(name, attrs) { return new Strophe.Builder(name, attrs); }
+/** Function: $msg
+ *  Create a Strophe.Builder with a <message/> element as the root.
+ *
+ *  Parmaeters:
+ *    (Object) attrs - The <message/> element attributes in object notation.
+ *
+ *  Returns:
+ *    A new Strophe.Builder object.
+ */
+function $msg(attrs) { return new Strophe.Builder("message", attrs); }
+/** Function: $iq
+ *  Create a Strophe.Builder with an <iq/> element as the root.
+ *
+ *  Parameters:
+ *    (Object) attrs - The <iq/> element attributes in object notation.
+ *
+ *  Returns:
+ *    A new Strophe.Builder object.
+ */
+function $iq(attrs) { return new Strophe.Builder("iq", attrs); }
+/** Function: $pres
+ *  Create a Strophe.Builder with a <presence/> element as the root.
+ *
+ *  Parameters:
+ *    (Object) attrs - The <presence/> element attributes in object notation.
+ *
+ *  Returns:
+ *    A new Strophe.Builder object.
+ */
+function $pres(attrs) { return new Strophe.Builder("presence", attrs); }
+
+/** Class: Strophe
+ *  An object container for all Strophe library functions.
+ *
+ *  This class is just a container for all the objects and constants
+ *  used in the library.  It is not meant to be instantiated, but to
+ *  provide a namespace for library objects, constants, and functions.
+ */
+Strophe = {
+    /** Constant: VERSION
+     *  The version of the Strophe library. Unreleased builds will have
+     *  a version of head-HASH where HASH is a partial revision.
+     */
+    VERSION: "1.0.1",
+
+    /** Constants: XMPP Namespace Constants
+     *  Common namespace constants from the XMPP RFCs and XEPs.
+     *
+     *  NS.HTTPBIND - HTTP BIND namespace from XEP 124.
+     *  NS.BOSH - BOSH namespace from XEP 206.
+     *  NS.CLIENT - Main XMPP client namespace.
+     *  NS.AUTH - Legacy authentication namespace.
+     *  NS.ROSTER - Roster operations namespace.
+     *  NS.PROFILE - Profile namespace.
+     *  NS.DISCO_INFO - Service discovery info namespace from XEP 30.
+     *  NS.DISCO_ITEMS - Service discovery items namespace from XEP 30.
+     *  NS.MUC - Multi-User Chat namespace from XEP 45.
+     *  NS.SASL - XMPP SASL namespace from RFC 3920.
+     *  NS.STREAM - XMPP Streams namespace from RFC 3920.
+     *  NS.BIND - XMPP Binding namespace from RFC 3920.
+     *  NS.SESSION - XMPP Session namespace from RFC 3920.
+     */
+    NS: {
+        HTTPBIND: "http://jabber.org/protocol/httpbind",
+        BOSH: "urn:xmpp:xbosh",
+        CLIENT: "jabber:client",
+        AUTH: "jabber:iq:auth",
+        ROSTER: "jabber:iq:roster",
+        PROFILE: "jabber:iq:profile",
+        DISCO_INFO: "http://jabber.org/protocol/disco#info",
+        DISCO_ITEMS: "http://jabber.org/protocol/disco#items",
+        MUC: "http://jabber.org/protocol/muc",
+        MUC_USER: "http://jabber.org/protocol/muc#user",
+        SASL: "urn:ietf:params:xml:ns:xmpp-sasl",
+        STREAM: "http://etherx.jabber.org/streams",
+        BIND: "urn:ietf:params:xml:ns:xmpp-bind",
+        SESSION: "urn:ietf:params:xml:ns:xmpp-session",
+        VERSION: "jabber:iq:version",
+        STANZAS: "urn:ietf:params:xml:ns:xmpp-stanzas"
+    },
+
+    /** Function: addNamespace 
+     *  This function is used to extend the current namespaces in
+     *	Strophe.NS.  It takes a key and a value with the key being the
+     *	name of the new namespace, with its actual value.
+     *	For example:
+     *	Strophe.addNamespace('PUBSUB', "http://jabber.org/protocol/pubsub");
+     *
+     *  Parameters:
+     *    (String) name - The name under which the namespace will be
+     *      referenced under Strophe.NS
+     *    (String) value - The actual namespace.	
+     */
+    addNamespace: function (name, value)
+    {
+	Strophe.NS[name] = value;
+    },
+
+    /** Constants: Connection Status Constants
+     *  Connection status constants for use by the connection handler
+     *  callback.
+     *
+     *  Status.ERROR - An error has occurred
+     *  Status.CONNECTING - The connection is currently being made
+     *  Status.CONNFAIL - The connection attempt failed
+     *  Status.AUTHENTICATING - The connection is authenticating
+     *  Status.AUTHFAIL - The authentication attempt failed
+     *  Status.CONNECTED - The connection has succeeded
+     *  Status.DISCONNECTED - The connection has been terminated
+     *  Status.DISCONNECTING - The connection is currently being terminated
+     *  Status.ATTACHED - The connection has been attached
+     */
+    Status: {
+        ERROR: 0,
+        CONNECTING: 1,
+        CONNFAIL: 2,
+        AUTHENTICATING: 3,
+        AUTHFAIL: 4,
+        CONNECTED: 5,
+        DISCONNECTED: 6,
+        DISCONNECTING: 7,
+        ATTACHED: 8
+    },
+
+    /** Constants: Log Level Constants
+     *  Logging level indicators.
+     *
+     *  LogLevel.DEBUG - Debug output
+     *  LogLevel.INFO - Informational output
+     *  LogLevel.WARN - Warnings
+     *  LogLevel.ERROR - Errors
+     *  LogLevel.FATAL - Fatal errors
+     */
+    LogLevel: {
+        DEBUG: 0,
+        INFO: 1,
+        WARN: 2,
+        ERROR: 3,
+        FATAL: 4
+    },
+
+    /** PrivateConstants: DOM Element Type Constants
+     *  DOM element types.
+     *
+     *  ElementType.NORMAL - Normal element.
+     *  ElementType.TEXT - Text data element.
+     */
+    ElementType: {
+        NORMAL: 1,
+        TEXT: 3
+    },
+
+    /** PrivateConstants: Timeout Values
+     *  Timeout values for error states.  These values are in seconds.
+     *  These should not be changed unless you know exactly what you are
+     *  doing.
+     *
+     *  TIMEOUT - Timeout multiplier. A waiting request will be considered
+     *      failed after Math.floor(TIMEOUT * wait) seconds have elapsed.
+     *      This defaults to 1.1, and with default wait, 66 seconds.
+     *  SECONDARY_TIMEOUT - Secondary timeout multiplier. In cases where
+     *      Strophe can detect early failure, it will consider the request
+     *      failed if it doesn't return after
+     *      Math.floor(SECONDARY_TIMEOUT * wait) seconds have elapsed.
+     *      This defaults to 0.1, and with default wait, 6 seconds.
+     */
+    TIMEOUT: 1.1,
+    SECONDARY_TIMEOUT: 0.1,
+
+    /** Function: forEachChild
+     *  Map a function over some or all child elements of a given element.
+     *
+     *  This is a small convenience function for mapping a function over
+     *  some or all of the children of an element.  If elemName is null, all
+     *  children will be passed to the function, otherwise only children
+     *  whose tag names match elemName will be passed.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The element to operate on.
+     *    (String) elemName - The child element tag name filter.
+     *    (Function) func - The function to apply to each child.  This
+     *      function should take a single argument, a DOM element.
+     */
+    forEachChild: function (elem, elemName, func)
+    {
+        var i, childNode;
+
+        for (i = 0; i < elem.childNodes.length; i++) {
+            childNode = elem.childNodes[i];
+            if (childNode.nodeType == Strophe.ElementType.NORMAL &&
+                (!elemName || this.isTagEqual(childNode, elemName))) {
+                func(childNode);
+            }
+        }
+    },
+
+    /** Function: isTagEqual
+     *  Compare an element's tag name with a string.
+     *
+     *  This function is case insensitive.
+     *
+     *  Parameters:
+     *    (XMLElement) el - A DOM element.
+     *    (String) name - The element name.
+     *
+     *  Returns:
+     *    true if the element's tag name matches _el_, and false
+     *    otherwise.
+     */
+    isTagEqual: function (el, name)
+    {
+        return el.tagName.toLowerCase() == name.toLowerCase();
+    },
+
+    /** PrivateVariable: _xmlGenerator
+     *  _Private_ variable that caches a DOM document to
+     *  generate elements.
+     */
+    _xmlGenerator: null,
+
+    /** PrivateFunction: _makeGenerator
+     *  _Private_ function that creates a dummy XML DOM document to serve as
+     *  an element and text node generator.
+     */
+    _makeGenerator: function () {
+        var doc;
+
+        if (window.ActiveXObject) {
+            doc = new ActiveXObject("Microsoft.XMLDOM");
+            doc.appendChild(doc.createElement('strophe'));
+        } else {
+            doc = document.implementation
+                .createDocument('jabber:client', 'strophe', null);
+        }
+
+        return doc;
+    },
+
+    /** Function: xmlElement
+     *  Create an XML DOM element.
+     *
+     *  This function creates an XML DOM element correctly across all
+     *  implementations. Specifically the Microsoft implementation of
+     *  document.createElement makes DOM elements with 43+ default attributes
+     *  unless elements are created with the ActiveX object Microsoft.XMLDOM.
+     *
+     *  Most DOMs force element names to lowercase, so we use the
+     *  _realname attribute on the created element to store the case
+     *  sensitive name.  This is required to generate proper XML for
+     *  things like vCard avatars (XEP 153).  This attribute is stripped
+     *  out before being sent over the wire or serialized, but you may
+     *  notice it during debugging.
+     *
+     *  Parameters:
+     *    (String) name - The name for the element.
+     *    (Array) attrs - An optional array of key/value pairs to use as
+     *      element attributes in the following format [['key1', 'value1'],
+     *      ['key2', 'value2']]
+     *    (String) text - The text child data for the element.
+     *
+     *  Returns:
+     *    A new XML DOM element.
+     */
+    xmlElement: function (name)
+    {
+        if (!name) { return null; }
+
+        var node = null;
+        if (!Strophe._xmlGenerator) {
+            Strophe._xmlGenerator = Strophe._makeGenerator();
+        }
+        node = Strophe._xmlGenerator.createElement(name);
+
+        // FIXME: this should throw errors if args are the wrong type or
+        // there are more than two optional args
+        var a, i, k;
+        for (a = 1; a < arguments.length; a++) {
+            if (!arguments[a]) { continue; }
+            if (typeof(arguments[a]) == "string" ||
+                typeof(arguments[a]) == "number") {
+                node.appendChild(Strophe.xmlTextNode(arguments[a]));
+            } else if (typeof(arguments[a]) == "object" &&
+                       typeof(arguments[a].sort) == "function") {
+                for (i = 0; i < arguments[a].length; i++) {
+                    if (typeof(arguments[a][i]) == "object" &&
+                        typeof(arguments[a][i].sort) == "function") {
+                        node.setAttribute(arguments[a][i][0],
+                                          arguments[a][i][1]);
+                    }
+                }
+            } else if (typeof(arguments[a]) == "object") {
+                for (k in arguments[a]) {
+                    if (arguments[a].hasOwnProperty(k)) {
+                        node.setAttribute(k, arguments[a][k]);
+                    }
+                } 
+            }
+        }
+
+        return node;
+    },
+
+    /*  Function: xmlescape
+     *  Excapes invalid xml characters.
+     *
+     *  Parameters:
+     *     (String) text - text to escape.
+     *
+     *	Returns:
+     *      Escaped text.
+     */
+    xmlescape: function(text) 
+    {
+	text = text.replace(/\&/g, "&amp;");
+        text = text.replace(/</g,  "&lt;");
+        text = text.replace(/>/g,  "&gt;");
+        return text;    
+    },
+
+    /** Function: xmlTextNode
+     *  Creates an XML DOM text node.
+     *
+     *  Provides a cross implementation version of document.createTextNode.
+     *
+     *  Parameters:
+     *    (String) text - The content of the text node.
+     *
+     *  Returns:
+     *    A new XML DOM text node.
+     */
+    xmlTextNode: function (text)
+    {
+	//ensure text is escaped
+	text = Strophe.xmlescape(text);
+
+        if (!Strophe._xmlGenerator) {
+            Strophe._xmlGenerator = Strophe._makeGenerator();
+        }
+        return Strophe._xmlGenerator.createTextNode(text);
+    },
+
+    /** Function: getText
+     *  Get the concatenation of all text children of an element.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - A DOM element.
+     *
+     *  Returns:
+     *    A String with the concatenated text of all text element children.
+     */
+    getText: function (elem)
+    {
+        if (!elem) { return null; }
+
+        var str = "";
+        if (elem.childNodes.length === 0 && elem.nodeType ==
+            Strophe.ElementType.TEXT) {
+            str += elem.nodeValue;
+        }
+
+        for (var i = 0; i < elem.childNodes.length; i++) {
+            if (elem.childNodes[i].nodeType == Strophe.ElementType.TEXT) {
+                str += elem.childNodes[i].nodeValue;
+            }
+        }
+
+        return str;
+    },
+
+    /** Function: copyElement
+     *  Copy an XML DOM element.
+     *
+     *  This function copies a DOM element and all its descendants and returns
+     *  the new copy.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - A DOM element.
+     *
+     *  Returns:
+     *    A new, copied DOM element tree.
+     */
+    copyElement: function (elem)
+    {
+        var i, el;
+        if (elem.nodeType == Strophe.ElementType.NORMAL) {
+            el = Strophe.xmlElement(elem.tagName);
+
+            for (i = 0; i < elem.attributes.length; i++) {
+                el.setAttribute(elem.attributes[i].nodeName.toLowerCase(),
+                                elem.attributes[i].value);
+            }
+
+            for (i = 0; i < elem.childNodes.length; i++) {
+                el.appendChild(Strophe.copyElement(elem.childNodes[i]));
+            }
+        } else if (elem.nodeType == Strophe.ElementType.TEXT) {
+            el = Strophe.xmlTextNode(elem.nodeValue);
+        }
+
+        return el;
+    },
+
+    /** Function: escapeNode
+     *  Escape the node part (also called local part) of a JID.
+     *
+     *  Parameters:
+     *    (String) node - A node (or local part).
+     *
+     *  Returns:
+     *    An escaped node (or local part).
+     */
+    escapeNode: function (node)
+    {
+        return node.replace(/^\s+|\s+$/g, '')
+            .replace(/\\/g,  "\\5c")
+            .replace(/ /g,   "\\20")
+            .replace(/\"/g,  "\\22")
+            .replace(/\&/g,  "\\26")
+            .replace(/\'/g,  "\\27")
+            .replace(/\//g,  "\\2f")
+            .replace(/:/g,   "\\3a")
+            .replace(/</g,   "\\3c")
+            .replace(/>/g,   "\\3e")
+            .replace(/@/g,   "\\40");
+    },
+
+    /** Function: unescapeNode
+     *  Unescape a node part (also called local part) of a JID.
+     *
+     *  Parameters:
+     *    (String) node - A node (or local part).
+     *
+     *  Returns:
+     *    An unescaped node (or local part).
+     */
+    unescapeNode: function (node)
+    {
+        return node.replace(/\\20/g, " ")
+            .replace(/\\22/g, '"')
+            .replace(/\\26/g, "&")
+            .replace(/\\27/g, "'")
+            .replace(/\\2f/g, "/")
+            .replace(/\\3a/g, ":")
+            .replace(/\\3c/g, "<")
+            .replace(/\\3e/g, ">")
+            .replace(/\\40/g, "@")
+            .replace(/\\5c/g, "\\");
+    },
+
+    /** Function: getNodeFromJid
+     *  Get the node portion of a JID String.
+     *
+     *  Parameters:
+     *    (String) jid - A JID.
+     *
+     *  Returns:
+     *    A String containing the node.
+     */
+    getNodeFromJid: function (jid)
+    {
+        if (jid.indexOf("@") < 0) { return null; }
+        return jid.split("@")[0];
+    },
+
+    /** Function: getDomainFromJid
+     *  Get the domain portion of a JID String.
+     *
+     *  Parameters:
+     *    (String) jid - A JID.
+     *
+     *  Returns:
+     *    A String containing the domain.
+     */
+    getDomainFromJid: function (jid)
+    {
+        var bare = Strophe.getBareJidFromJid(jid);
+        if (bare.indexOf("@") < 0) {
+            return bare;
+        } else {
+            var parts = bare.split("@");
+            parts.splice(0, 1);
+            return parts.join('@');
+        }
+    },
+
+    /** Function: getResourceFromJid
+     *  Get the resource portion of a JID String.
+     *
+     *  Parameters:
+     *    (String) jid - A JID.
+     *
+     *  Returns:
+     *    A String containing the resource.
+     */
+    getResourceFromJid: function (jid)
+    {
+        var s = jid.split("/");
+        if (s.length < 2) { return null; }
+        s.splice(0, 1);
+        return s.join('/');
+    },
+
+    /** Function: getBareJidFromJid
+     *  Get the bare JID from a JID String.
+     *
+     *  Parameters:
+     *    (String) jid - A JID.
+     *
+     *  Returns:
+     *    A String containing the bare JID.
+     */
+    getBareJidFromJid: function (jid)
+    {
+        return jid.split("/")[0];
+    },
+
+    /** Function: log
+     *  User overrideable logging function.
+     *
+     *  This function is called whenever the Strophe library calls any
+     *  of the logging functions.  The default implementation of this
+     *  function does nothing.  If client code wishes to handle the logging
+     *  messages, it should override this with
+     *  > Strophe.log = function (level, msg) {
+     *  >   (user code here)
+     *  > };
+     *
+     *  Please note that data sent and received over the wire is logged
+     *  via Strophe.Connection.rawInput() and Strophe.Connection.rawOutput().
+     *
+     *  The different levels and their meanings are
+     *
+     *    DEBUG - Messages useful for debugging purposes.
+     *    INFO - Informational messages.  This is mostly information like
+     *      'disconnect was called' or 'SASL auth succeeded'.
+     *    WARN - Warnings about potential problems.  This is mostly used
+     *      to report transient connection errors like request timeouts.
+     *    ERROR - Some error occurred.
+     *    FATAL - A non-recoverable fatal error occurred.
+     *
+     *  Parameters:
+     *    (Integer) level - The log level of the log message.  This will
+     *      be one of the values in Strophe.LogLevel.
+     *    (String) msg - The log message.
+     */
+    log: function (level, msg)
+    {
+        return;
+    },
+
+    /** Function: debug
+     *  Log a message at the Strophe.LogLevel.DEBUG level.
+     *
+     *  Parameters:
+     *    (String) msg - The log message.
+     */
+    debug: function(msg)
+    {
+        this.log(this.LogLevel.DEBUG, msg);
+    },
+
+    /** Function: info
+     *  Log a message at the Strophe.LogLevel.INFO level.
+     *
+     *  Parameters:
+     *    (String) msg - The log message.
+     */
+    info: function (msg)
+    {
+        this.log(this.LogLevel.INFO, msg);
+    },
+
+    /** Function: warn
+     *  Log a message at the Strophe.LogLevel.WARN level.
+     *
+     *  Parameters:
+     *    (String) msg - The log message.
+     */
+    warn: function (msg)
+    {
+        this.log(this.LogLevel.WARN, msg);
+    },
+
+    /** Function: error
+     *  Log a message at the Strophe.LogLevel.ERROR level.
+     *
+     *  Parameters:
+     *    (String) msg - The log message.
+     */
+    error: function (msg)
+    {
+        this.log(this.LogLevel.ERROR, msg);
+    },
+
+    /** Function: fatal
+     *  Log a message at the Strophe.LogLevel.FATAL level.
+     *
+     *  Parameters:
+     *    (String) msg - The log message.
+     */
+    fatal: function (msg)
+    {
+        this.log(this.LogLevel.FATAL, msg);
+    },
+
+    /** Function: serialize
+     *  Render a DOM element and all descendants to a String.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - A DOM element.
+     *
+     *  Returns:
+     *    The serialized element tree as a String.
+     */
+    serialize: function (elem)
+    {
+        var result;
+
+        if (!elem) { return null; }
+
+        if (typeof(elem.tree) === "function") {
+            elem = elem.tree();
+        }
+
+        var nodeName = elem.nodeName;
+        var i, child;
+
+        if (elem.getAttribute("_realname")) {
+            nodeName = elem.getAttribute("_realname");
+        }
+
+        result = "<" + nodeName;
+        for (i = 0; i < elem.attributes.length; i++) {
+               if(elem.attributes[i].nodeName != "_realname") {
+                 result += " " + elem.attributes[i].nodeName.toLowerCase() +
+                "='" + elem.attributes[i].value
+                    .replace("&", "&amp;")
+                       .replace("'", "&apos;")
+                       .replace("<", "&lt;") + "'";
+               }
+        }
+
+        if (elem.childNodes.length > 0) {
+            result += ">";
+            for (i = 0; i < elem.childNodes.length; i++) {
+                child = elem.childNodes[i];
+                if (child.nodeType == Strophe.ElementType.NORMAL) {
+                    // normal element, so recurse
+                    result += Strophe.serialize(child);
+                } else if (child.nodeType == Strophe.ElementType.TEXT) {
+                    // text element
+                    result += child.nodeValue;
+                }
+            }
+            result += "</" + nodeName + ">";
+        } else {
+            result += "/>";
+        }
+
+        return result;
+    },
+
+    /** PrivateVariable: _requestId
+     *  _Private_ variable that keeps track of the request ids for
+     *  connections.
+     */
+    _requestId: 0,
+
+    /** PrivateVariable: Strophe.connectionPlugins
+     *  _Private_ variable Used to store plugin names that need
+     *  initialization on Strophe.Connection construction.
+     */
+    _connectionPlugins: {},
+
+    /** Function: addConnectionPlugin
+     *  Extends the Strophe.Connection object with the given plugin.
+     *
+     *  Paramaters:
+     *    (String) name - The name of the extension.
+     *    (Object) ptype - The plugin's prototype.
+     */
+    addConnectionPlugin: function (name, ptype)
+    {
+        Strophe._connectionPlugins[name] = ptype;
+    }
+};
+
+/** Class: Strophe.Builder
+ *  XML DOM builder.
+ *
+ *  This object provides an interface similar to JQuery but for building
+ *  DOM element easily and rapidly.  All the functions except for toString()
+ *  and tree() return the object, so calls can be chained.  Here's an
+ *  example using the $iq() builder helper.
+ *  > $iq({to: 'you': from: 'me': type: 'get', id: '1'})
+ *  >     .c('query', {xmlns: 'strophe:example'})
+ *  >     .c('example')
+ *  >     .toString()
+ *  The above generates this XML fragment
+ *  > <iq to='you' from='me' type='get' id='1'>
+ *  >   <query xmlns='strophe:example'>
+ *  >     <example/>
+ *  >   </query>
+ *  > </iq>
+ *  The corresponding DOM manipulations to get a similar fragment would be
+ *  a lot more tedious and probably involve several helper variables.
+ *
+ *  Since adding children makes new operations operate on the child, up()
+ *  is provided to traverse up the tree.  To add two children, do
+ *  > builder.c('child1', ...).up().c('child2', ...)
+ *  The next operation on the Builder will be relative to the second child.
+ */
+
+/** Constructor: Strophe.Builder
+ *  Create a Strophe.Builder object.
+ *
+ *  The attributes should be passed in object notation.  For example
+ *  > var b = new Builder('message', {to: 'you', from: 'me'});
+ *  or
+ *  > var b = new Builder('messsage', {'xml:lang': 'en'});
+ *
+ *  Parameters:
+ *    (String) name - The name of the root element.
+ *    (Object) attrs - The attributes for the root element in object notation.
+ *
+ *  Returns:
+ *    A new Strophe.Builder.
+ */
+Strophe.Builder = function (name, attrs)
+{
+    // Set correct namespace for jabber:client elements
+    if (name == "presence" || name == "message" || name == "iq") {
+        if (attrs && !attrs.xmlns) {
+            attrs.xmlns = Strophe.NS.CLIENT;
+        } else if (!attrs) {
+            attrs = {xmlns: Strophe.NS.CLIENT};
+        }
+    }
+
+    // Holds the tree being built.
+    this.nodeTree = Strophe.xmlElement(name, attrs);
+
+    // Points to the current operation node.
+    this.node = this.nodeTree;
+};
+
+Strophe.Builder.prototype = {
+    /** Function: tree
+     *  Return the DOM tree.
+     *
+     *  This function returns the current DOM tree as an element object.  This
+     *  is suitable for passing to functions like Strophe.Connection.send().
+     *
+     *  Returns:
+     *    The DOM tree as a element object.
+     */
+    tree: function ()
+    {
+        return this.nodeTree;
+    },
+
+    /** Function: toString
+     *  Serialize the DOM tree to a String.
+     *
+     *  This function returns a string serialization of the current DOM
+     *  tree.  It is often used internally to pass data to a
+     *  Strophe.Request object.
+     *
+     *  Returns:
+     *    The serialized DOM tree in a String.
+     */
+    toString: function ()
+    {
+        return Strophe.serialize(this.nodeTree);
+    },
+
+    /** Function: up
+     *  Make the current parent element the new current element.
+     *
+     *  This function is often used after c() to traverse back up the tree.
+     *  For example, to add two children to the same element
+     *  > builder.c('child1', {}).up().c('child2', {});
+     *
+     *  Returns:
+     *    The Stophe.Builder object.
+     */
+    up: function ()
+    {
+        this.node = this.node.parentNode;
+        return this;
+    },
+
+    /** Function: attrs
+     *  Add or modify attributes of the current element.
+     *
+     *  The attributes should be passed in object notation.  This function
+     *  does not move the current element pointer.
+     *
+     *  Parameters:
+     *    (Object) moreattrs - The attributes to add/modify in object notation.
+     *
+     *  Returns:
+     *    The Strophe.Builder object.
+     */
+    attrs: function (moreattrs)
+    {
+        for (var k in moreattrs) {
+            if (moreattrs.hasOwnProperty(k)) {
+                this.node.setAttribute(k, moreattrs[k]);
+            }
+        }
+        return this;
+    },
+
+    /** Function: c
+     *  Add a child to the current element and make it the new current
+     *  element.
+     *
+     *  This function moves the current element pointer to the child.  If you
+     *  need to add another child, it is necessary to use up() to go back
+     *  to the parent in the tree.
+     *
+     *  Parameters:
+     *    (String) name - The name of the child.
+     *    (Object) attrs - The attributes of the child in object notation.
+     *
+     *  Returns:
+     *    The Strophe.Builder object.
+     */
+    c: function (name, attrs)
+    {
+        var child = Strophe.xmlElement(name, attrs);
+        this.node.appendChild(child);
+        this.node = child;
+        return this;
+    },
+
+    /** Function: cnode
+     *  Add a child to the current element and make it the new current
+     *  element.
+     *
+     *  This function is the same as c() except that instead of using a
+     *  name and an attributes object to create the child it uses an
+     *  existing DOM element object.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - A DOM element.
+     *
+     *  Returns:
+     *    The Strophe.Builder object.
+     */
+    cnode: function (elem)
+    {
+        this.node.appendChild(elem);
+        this.node = elem;
+        return this;
+    },
+
+    /** Function: t
+     *  Add a child text element.
+     *
+     *  This *does not* make the child the new current element since there
+     *  are no children of text elements.
+     *
+     *  Parameters:
+     *    (String) text - The text data to append to the current element.
+     *
+     *  Returns:
+     *    The Strophe.Builder object.
+     */
+    t: function (text)
+    {
+        var child = Strophe.xmlTextNode(text);
+        this.node.appendChild(child);
+        return this;
+    }
+};
+
+
+/** PrivateClass: Strophe.Handler
+ *  _Private_ helper class for managing stanza handlers.
+ *
+ *  A Strophe.Handler encapsulates a user provided callback function to be
+ *  executed when matching stanzas are received by the connection.
+ *  Handlers can be either one-off or persistant depending on their
+ *  return value. Returning true will cause a Handler to remain active, and
+ *  returning false will remove the Handler.
+ *
+ *  Users will not use Strophe.Handler objects directly, but instead they
+ *  will use Strophe.Connection.addHandler() and
+ *  Strophe.Connection.deleteHandler().
+ */
+
+/** PrivateConstructor: Strophe.Handler
+ *  Create and initialize a new Strophe.Handler.
+ *
+ *  Parameters:
+ *    (Function) handler - A function to be executed when the handler is run.
+ *    (String) ns - The namespace to match.
+ *    (String) name - The element name to match.
+ *    (String) type - The element type to match.
+ *    (String) id - The element id attribute to match.
+ *    (String) from - The element from attribute to match.
+ *    (Object) options - Handler options
+ *
+ *  Returns:
+ *    A new Strophe.Handler object.
+ */
+Strophe.Handler = function (handler, ns, name, type, id, from, options)
+{
+    this.handler = handler;
+    this.ns = ns;
+    this.name = name;
+    this.type = type;
+    this.id = id;
+    this.options = options || {matchbare: false};
+    
+    // default matchBare to false if undefined
+    if (!this.options.matchBare) {
+        this.options.matchBare = false;
+    }
+
+    if (this.options.matchBare) {
+        this.from = Strophe.getBareJidFromJid(from);
+    } else {
+        this.from = from;
+    }
+
+    // whether the handler is a user handler or a system handler
+    this.user = true;
+};
+
+Strophe.Handler.prototype = {
+    /** PrivateFunction: isMatch
+     *  Tests if a stanza matches the Strophe.Handler.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The XML element to test.
+     *
+     *  Returns:
+     *    true if the stanza matches and false otherwise.
+     */
+    isMatch: function (elem)
+    {
+        var nsMatch;
+        var from = null;
+        
+        if (this.options.matchBare) {
+            from = Strophe.getBareJidFromJid(elem.getAttribute('from'));
+        } else {
+            from = elem.getAttribute('from');
+        }
+
+        nsMatch = false;
+        if (!this.ns) {
+            nsMatch = true;
+        } else {
+            var self = this;
+            Strophe.forEachChild(elem, null, function (elem) {
+                if (elem.getAttribute("xmlns") == self.ns) {
+                    nsMatch = true;
+                }
+            });
+
+            nsMatch = nsMatch || elem.getAttribute("xmlns") == this.ns;
+        }
+
+        if (nsMatch &&
+            (!this.name || Strophe.isTagEqual(elem, this.name)) &&
+            (!this.type || elem.getAttribute("type") === this.type) &&
+            (!this.id || elem.getAttribute("id") === this.id) &&
+            (!this.from || from === this.from)) {
+                return true;
+        }
+
+        return false;
+    },
+
+    /** PrivateFunction: run
+     *  Run the callback on a matching stanza.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The DOM element that triggered the
+     *      Strophe.Handler.
+     *
+     *  Returns:
+     *    A boolean indicating if the handler should remain active.
+     */
+    run: function (elem)
+    {
+        var result = null;
+        try {
+            result = this.handler(elem);
+        } catch (e) {
+            if (e.sourceURL) {
+                Strophe.fatal("error: " + this.handler +
+                              " " + e.sourceURL + ":" +
+                              e.line + " - " + e.name + ": " + e.message);
+            } else if (e.fileName) {
+                if (typeof(console) != "undefined") {
+                    console.trace();
+                    console.error(this.handler, " - error - ", e, e.message);
+                }
+                Strophe.fatal("error: " + this.handler + " " +
+                              e.fileName + ":" + e.lineNumber + " - " +
+                              e.name + ": " + e.message);
+            } else {
+                Strophe.fatal("error: " + this.handler);
+            }
+
+            throw e;
+        }
+
+        return result;
+    },
+
+    /** PrivateFunction: toString
+     *  Get a String representation of the Strophe.Handler object.
+     *
+     *  Returns:
+     *    A String.
+     */
+    toString: function ()
+    {
+        return "{Handler: " + this.handler + "(" + this.name + "," +
+            this.id + "," + this.ns + ")}";
+    }
+};
+
+/** PrivateClass: Strophe.TimedHandler
+ *  _Private_ helper class for managing timed handlers.
+ *
+ *  A Strophe.TimedHandler encapsulates a user provided callback that
+ *  should be called after a certain period of time or at regular
+ *  intervals.  The return value of the callback determines whether the
+ *  Strophe.TimedHandler will continue to fire.
+ *
+ *  Users will not use Strophe.TimedHandler objects directly, but instead
+ *  they will use Strophe.Connection.addTimedHandler() and
+ *  Strophe.Connection.deleteTimedHandler().
+ */
+
+/** PrivateConstructor: Strophe.TimedHandler
+ *  Create and initialize a new Strophe.TimedHandler object.
+ *
+ *  Parameters:
+ *    (Integer) period - The number of milliseconds to wait before the
+ *      handler is called.
+ *    (Function) handler - The callback to run when the handler fires.  This
+ *      function should take no arguments.
+ *
+ *  Returns:
+ *    A new Strophe.TimedHandler object.
+ */
+Strophe.TimedHandler = function (period, handler)
+{
+    this.period = period;
+    this.handler = handler;
+
+    this.lastCalled = new Date().getTime();
+    this.user = true;
+};
+
+Strophe.TimedHandler.prototype = {
+    /** PrivateFunction: run
+     *  Run the callback for the Strophe.TimedHandler.
+     *
+     *  Returns:
+     *    true if the Strophe.TimedHandler should be called again, and false
+     *      otherwise.
+     */
+    run: function ()
+    {
+        this.lastCalled = new Date().getTime();
+        return this.handler();
+    },
+
+    /** PrivateFunction: reset
+     *  Reset the last called time for the Strophe.TimedHandler.
+     */
+    reset: function ()
+    {
+        this.lastCalled = new Date().getTime();
+    },
+
+    /** PrivateFunction: toString
+     *  Get a string representation of the Strophe.TimedHandler object.
+     *
+     *  Returns:
+     *    The string representation.
+     */
+    toString: function ()
+    {
+        return "{TimedHandler: " + this.handler + "(" + this.period +")}";
+    }
+};
+
+/** PrivateClass: Strophe.Request
+ *  _Private_ helper class that provides a cross implementation abstraction
+ *  for a BOSH related XMLHttpRequest.
+ *
+ *  The Strophe.Request class is used internally to encapsulate BOSH request
+ *  information.  It is not meant to be used from user's code.
+ */
+
+/** PrivateConstructor: Strophe.Request
+ *  Create and initialize a new Strophe.Request object.
+ *
+ *  Parameters:
+ *    (XMLElement) elem - The XML data to be sent in the request.
+ *    (Function) func - The function that will be called when the
+ *      XMLHttpRequest readyState changes.
+ *    (Integer) rid - The BOSH rid attribute associated with this request.
+ *    (Integer) sends - The number of times this same request has been
+ *      sent.
+ */
+Strophe.Request = function (elem, func, rid, sends)
+{
+    this.id = ++Strophe._requestId;
+    this.xmlData = elem;
+    this.data = Strophe.serialize(elem);
+    // save original function in case we need to make a new request
+    // from this one.
+    this.origFunc = func;
+    this.func = func;
+    this.rid = rid;
+    this.date = NaN;
+    this.sends = sends || 0;
+    this.abort = false;
+    this.dead = null;
+    this.age = function () {
+        if (!this.date) { return 0; }
+        var now = new Date();
+        return (now - this.date) / 1000;
+    };
+    this.timeDead = function () {
+        if (!this.dead) { return 0; }
+        var now = new Date();
+        return (now - this.dead) / 1000;
+    };
+    this.xhr = this._newXHR();
+};
+
+Strophe.Request.prototype = {
+    /** PrivateFunction: getResponse
+     *  Get a response from the underlying XMLHttpRequest.
+     *
+     *  This function attempts to get a response from the request and checks
+     *  for errors.
+     *
+     *  Throws:
+     *    "parsererror" - A parser error occured.
+     *
+     *  Returns:
+     *    The DOM element tree of the response.
+     */
+    getResponse: function ()
+    {
+        var node = null;
+        if (this.xhr.responseXML && this.xhr.responseXML.documentElement) {
+            node = this.xhr.responseXML.documentElement;
+            if (node.tagName == "parsererror") {
+                Strophe.error("invalid response received");
+                Strophe.error("responseText: " + this.xhr.responseText);
+                Strophe.error("responseXML: " +
+                              Strophe.serialize(this.xhr.responseXML));
+                throw "parsererror";
+            }
+        } else if (this.xhr.responseText) {
+            Strophe.error("invalid response received");
+            Strophe.error("responseText: " + this.xhr.responseText);
+            Strophe.error("responseXML: " +
+                          Strophe.serialize(this.xhr.responseXML));
+        }
+
+        return node;
+    },
+
+    /** PrivateFunction: _newXHR
+     *  _Private_ helper function to create XMLHttpRequests.
+     *
+     *  This function creates XMLHttpRequests across all implementations.
+     *
+     *  Returns:
+     *    A new XMLHttpRequest.
+     */
+    _newXHR: function ()
+    {
+        var xhr = null;
+        if (window.XMLHttpRequest) {
+            xhr = new XMLHttpRequest();
+            if (xhr.overrideMimeType) {
+                xhr.overrideMimeType("text/xml");
+            }
+        } else if (window.ActiveXObject) {
+            xhr = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+
+        xhr.onreadystatechange = this.func.prependArg(this);
+
+        return xhr;
+    }
+};
+
+/** Class: Strophe.Connection
+ *  XMPP Connection manager.
+ *
+ *  Thie class is the main part of Strophe.  It manages a BOSH connection
+ *  to an XMPP server and dispatches events to the user callbacks as
+ *  data arrives.  It supports SASL PLAIN, SASL DIGEST-MD5, and legacy
+ *  authentication.
+ *
+ *  After creating a Strophe.Connection object, the user will typically
+ *  call connect() with a user supplied callback to handle connection level
+ *  events like authentication failure, disconnection, or connection
+ *  complete.
+ *
+ *  The user will also have several event handlers defined by using
+ *  addHandler() and addTimedHandler().  These will allow the user code to
+ *  respond to interesting stanzas or do something periodically with the
+ *  connection.  These handlers will be active once authentication is
+ *  finished.
+ *
+ *  To send data to the connection, use send().
+ */
+
+/** Constructor: Strophe.Connection
+ *  Create and initialize a Strophe.Connection object.
+ *
+ *  Parameters:
+ *    (String) service - The BOSH service URL.
+ *
+ *  Returns:
+ *    A new Strophe.Connection object.
+ */
+Strophe.Connection = function (service)
+{
+    /* The path to the httpbind service. */
+    this.service = service;
+    /* The connected JID. */
+    this.jid = "";
+    /* request id for body tags */
+    this.rid = Math.floor(Math.random() * 4294967295);
+    /* The current session ID. */
+    this.sid = null;
+    this.streamId = null;
+
+    // SASL
+    this.do_session = false;
+    this.do_bind = false;
+
+    // handler lists
+    this.timedHandlers = [];
+    this.handlers = [];
+    this.removeTimeds = [];
+    this.removeHandlers = [];
+    this.addTimeds = [];
+    this.addHandlers = [];
+
+    this._idleTimeout = null;
+    this._disconnectTimeout = null;
+
+    this.authenticated = false;
+    this.disconnecting = false;
+    this.connected = false;
+
+    this.errors = 0;
+
+    this.paused = false;
+
+    // default BOSH values
+    this.hold = 1;
+    this.wait = 60;
+    this.window = 5;
+
+    this._data = [];
+    this._requests = [];
+    this._uniqueId = Math.round(Math.random() * 10000);
+
+    this._sasl_success_handler = null;
+    this._sasl_failure_handler = null;
+    this._sasl_challenge_handler = null;
+
+    // setup onIdle callback every 1/10th of a second
+    this._idleTimeout = setTimeout(this._onIdle.bind(this), 100);
+
+    // initialize plugins
+    for (var k in Strophe._connectionPlugins) {
+        if (Strophe._connectionPlugins.hasOwnProperty(k)) {
+	    var ptype = Strophe._connectionPlugins[k];
+            // jslint complaints about the below line, but this is fine
+            var F = function () {};
+            F.prototype = ptype;
+            this[k] = new F();
+	    this[k].init(this);
+        }
+    }
+};
+
+Strophe.Connection.prototype = {
+    /** Function: reset
+     *  Reset the connection.
+     *
+     *  This function should be called after a connection is disconnected
+     *  before that connection is reused.
+     */
+    reset: function ()
+    {
+        this.rid = Math.floor(Math.random() * 4294967295);
+
+        this.sid = null;
+        this.streamId = null;
+
+        // SASL
+        this.do_session = false;
+        this.do_bind = false;
+
+        // handler lists
+        this.timedHandlers = [];
+        this.handlers = [];
+        this.removeTimeds = [];
+        this.removeHandlers = [];
+        this.addTimeds = [];
+        this.addHandlers = [];
+
+        this.authenticated = false;
+        this.disconnecting = false;
+        this.connected = false;
+
+        this.errors = 0;
+
+        this._requests = [];
+        this._uniqueId = Math.round(Math.random()*10000);
+    },
+
+    /** Function: pause
+     *  Pause the request manager.
+     *
+     *  This will prevent Strophe from sending any more requests to the
+     *  server.  This is very useful for temporarily pausing while a lot
+     *  of send() calls are happening quickly.  This causes Strophe to
+     *  send the data in a single request, saving many request trips.
+     */
+    pause: function ()
+    {
+        this.paused = true;
+    },
+
+    /** Function: resume
+     *  Resume the request manager.
+     *
+     *  This resumes after pause() has been called.
+     */
+    resume: function ()
+    {
+        this.paused = false;
+    },
+
+    /** Function: getUniqueId
+     *  Generate a unique ID for use in <iq/> elements.
+     *
+     *  All <iq/> stanzas are required to have unique id attributes.  This
+     *  function makes creating these easy.  Each connection instance has
+     *  a counter which starts from zero, and the value of this counter
+     *  plus a colon followed by the suffix becomes the unique id. If no
+     *  suffix is supplied, the counter is used as the unique id.
+     *
+     *  Suffixes are used to make debugging easier when reading the stream
+     *  data, and their use is recommended.  The counter resets to 0 for
+     *  every new connection for the same reason.  For connections to the
+     *  same server that authenticate the same way, all the ids should be
+     *  the same, which makes it easy to see changes.  This is useful for
+     *  automated testing as well.
+     *
+     *  Parameters:
+     *    (String) suffix - A optional suffix to append to the id.
+     *
+     *  Returns:
+     *    A unique string to be used for the id attribute.
+     */
+    getUniqueId: function (suffix)
+    {
+        if (typeof(suffix) == "string" || typeof(suffix) == "number") {
+            return ++this._uniqueId + ":" + suffix;
+        } else {
+            return ++this._uniqueId + "";
+        }
+    },
+
+    /** Function: connect
+     *  Starts the connection process.
+     *
+     *  As the connection process proceeds, the user supplied callback will
+     *  be triggered multiple times with status updates.  The callback
+     *  should take two arguments - the status code and the error condition.
+     *
+     *  The status code will be one of the values in the Strophe.Status
+     *  constants.  The error condition will be one of the conditions
+     *  defined in RFC 3920 or the condition 'strophe-parsererror'.
+     *
+     *  Please see XEP 124 for a more detailed explanation of the optional
+     *  parameters below.
+     *
+     *  Parameters:
+     *    (String) jid - The user's JID.  This may be a bare JID,
+     *      or a full JID.  If a node is not supplied, SASL ANONYMOUS
+     *      authentication will be attempted.
+     *    (String) pass - The user's password.
+     *    (Function) callback The connect callback function.
+     *    (Integer) wait - The optional HTTPBIND wait value.  This is the
+     *      time the server will wait before returning an empty result for
+     *      a request.  The default setting of 60 seconds is recommended.
+     *      Other settings will require tweaks to the Strophe.TIMEOUT value.
+     *    (Integer) hold - The optional HTTPBIND hold value.  This is the
+     *      number of connections the server will hold at one time.  This
+     *      should almost always be set to 1 (the default).
+     */
+    connect: function (jid, pass, callback, wait, hold)
+    {
+        this.jid = jid;
+        this.pass = pass;
+        this.connect_callback = callback;
+        this.disconnecting = false;
+        this.connected = false;
+        this.authenticated = false;
+        this.errors = 0;
+
+        this.wait = wait || this.wait;
+        this.hold = hold || this.hold;
+
+        // parse jid for domain and resource
+        this.domain = Strophe.getDomainFromJid(this.jid);
+
+        // build the body tag
+        var body = this._buildBody().attrs({
+            to: this.domain,
+            "xml:lang": "en",
+            wait: this.wait,
+            hold: this.hold,
+            content: "text/xml; charset=utf-8",
+            ver: "1.6",
+            "xmpp:version": "1.0",
+            "xmlns:xmpp": Strophe.NS.BOSH
+        });
+
+        this._changeConnectStatus(Strophe.Status.CONNECTING, null);
+
+        this._requests.push(
+            new Strophe.Request(body.tree(),
+                                this._onRequestStateChange.bind(this)
+                                    .prependArg(this._connect_cb.bind(this)),
+                                body.tree().getAttribute("rid")));
+        this._throttledRequestHandler();
+    },
+
+    /** Function: attach
+     *  Attach to an already created and authenticated BOSH session.
+     *
+     *  This function is provided to allow Strophe to attach to BOSH
+     *  sessions which have been created externally, perhaps by a Web
+     *  application.  This is often used to support auto-login type features
+     *  without putting user credentials into the page.
+     *
+     *  Parameters:
+     *    (String) jid - The full JID that is bound by the session.
+     *    (String) sid - The SID of the BOSH session.
+     *    (String) rid - The current RID of the BOSH session.  This RID
+     *      will be used by the next request.
+     *    (Function) callback The connect callback function.
+     *    (Integer) wait - The optional HTTPBIND wait value.  This is the
+     *      time the server will wait before returning an empty result for
+     *      a request.  The default setting of 60 seconds is recommended.
+     *      Other settings will require tweaks to the Strophe.TIMEOUT value.
+     *    (Integer) hold - The optional HTTPBIND hold value.  This is the
+     *      number of connections the server will hold at one time.  This
+     *      should almost always be set to 1 (the default).
+     *    (Integer) wind - The optional HTTBIND window value.  This is the
+     *      allowed range of request ids that are valid.  The default is 5.
+     */
+    attach: function (jid, sid, rid, callback, wait, hold, wind)
+    {
+        this.jid = jid;
+        this.sid = sid;
+        this.rid = rid;
+        this.connect_callback = callback;
+
+        this.domain = Strophe.getDomainFromJid(this.jid);
+
+        this.authenticated = true;
+        this.connected = true;
+
+        this.wait = wait || this.wait;
+        this.hold = hold || this.hold;
+        this.window = wind || this.window;
+
+        this._changeConnectStatus(Strophe.Status.ATTACHED, null);
+    },
+
+    /** Function: xmlInput
+     *  User overrideable function that receives XML data coming into the
+     *  connection.
+     *
+     *  The default function does nothing.  User code can override this with
+     *  > Strophe.Connection.xmlInput = function (elem) {
+     *  >   (user code)
+     *  > };
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The XML data received by the connection.
+     */
+    xmlInput: function (elem)
+    {
+        return;
+    },
+
+    /** Function: xmlOutput
+     *  User overrideable function that receives XML data sent to the
+     *  connection.
+     *
+     *  The default function does nothing.  User code can override this with
+     *  > Strophe.Connection.xmlOutput = function (elem) {
+     *  >   (user code)
+     *  > };
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The XMLdata sent by the connection.
+     */
+    xmlOutput: function (elem)
+    {
+        return;
+    },
+
+    /** Function: rawInput
+     *  User overrideable function that receives raw data coming into the
+     *  connection.
+     *
+     *  The default function does nothing.  User code can override this with
+     *  > Strophe.Connection.rawInput = function (data) {
+     *  >   (user code)
+     *  > };
+     *
+     *  Parameters:
+     *    (String) data - The data received by the connection.
+     */
+    rawInput: function (data)
+    {
+        return;
+    },
+
+    /** Function: rawOutput
+     *  User overrideable function that receives raw data sent to the
+     *  connection.
+     *
+     *  The default function does nothing.  User code can override this with
+     *  > Strophe.Connection.rawOutput = function (data) {
+     *  >   (user code)
+     *  > };
+     *
+     *  Parameters:
+     *    (String) data - The data sent by the connection.
+     */
+    rawOutput: function (data)
+    {
+        return;
+    },
+
+    /** Function: send
+     *  Send a stanza.
+     *
+     *  This function is called to push data onto the send queue to
+     *  go out over the wire.  Whenever a request is sent to the BOSH
+     *  server, all pending data is sent and the queue is flushed.
+     *
+     *  Parameters:
+     *    (XMLElement |
+     *     [XMLElement] |
+     *     Strophe.Builder) elem - The stanza to send.
+     */
+    send: function (elem)
+    {
+        if (elem === null) { return ; }
+        if (typeof(elem.sort) === "function") {
+            for (var i = 0; i < elem.length; i++) {
+                this._queueData(elem[i]);
+            }
+        } else if (typeof(elem.tree) === "function") {
+            this._queueData(elem.tree());
+        } else {
+            this._queueData(elem);
+        }
+
+        this._throttledRequestHandler();
+        clearTimeout(this._idleTimeout);
+        this._idleTimeout = setTimeout(this._onIdle.bind(this), 100);
+    },
+
+    /** Function: flush
+     *  Immediately send any pending outgoing data.
+     *  
+     *  Normally send() queues outgoing data until the next idle period
+     *  (100ms), which optimizes network use in the common cases when
+     *  several send()s are called in succession. flush() can be used to 
+     *  immediately send all pending data.
+     */
+    flush: function ()
+    {
+        // cancel the pending idle period and run the idle function
+        // immediately
+        clearTimeout(this._idleTimeout);
+        this._onIdle();
+    },
+
+    /** Function: sendIQ
+     *  Helper function to send IQ stanzas.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The stanza to send.
+     *    (Function) callback - The callback function for a successful request.
+     *    (Function) errback - The callback function for a failed or timed 
+     *      out request.  On timeout, the stanza will be null.
+     *    (Integer) timeout - The time specified in milliseconds for a 
+     *      timeout to occur.
+     *
+     *  Returns:
+     *    The id used to send the IQ.
+    */
+    sendIQ: function(elem, callback, errback, timeout) {
+        var timeoutHandler = null;
+        var that = this;
+
+        if (typeof(elem.tree) === "function") {
+            elem = elem.tree();
+        }
+	var id = elem.getAttribute('id');
+
+	// inject id if not found
+	if (!id) {
+	    id = this.getUniqueId("sendIQ");
+	    elem.setAttribute("id", id);
+	}
+
+	var handler = this.addHandler(function (stanza) {
+	    // remove timeout handler if there is one
+            if (timeoutHandler) {
+                that.deleteTimedHandler(timeoutHandler);
+            }
+
+            var iqtype = stanza.getAttribute('type');
+	    if (iqtype === 'result') {
+		if (callback) {
+                    callback(stanza);
+                }
+	    } else if (iqtype === 'error') {
+		if (errback) {
+                    errback(stanza);
+                }
+	    } else {
+                throw {
+                    name: "StropheError",
+                    message: "Got bad IQ type of " + iqtype
+                };
+            }
+	}, null, 'iq', null, id);
+
+	// if timeout specified, setup timeout handler.
+	if (timeout) {
+	    timeoutHandler = this.addTimedHandler(timeout, function () {
+                // get rid of normal handler
+                that.deleteHandler(handler);
+
+	        // call errback on timeout with null stanza
+                if (errback) {
+		    errback(null);
+                }
+		return false;
+	    });
+	}
+
+	this.send(elem);
+
+	return id;
+    },
+
+    /** PrivateFunction: _queueData
+     *  Queue outgoing data for later sending.  Also ensures that the data
+     *  is a DOMElement.
+     */
+    _queueData: function (element) {
+        if (element === null ||
+            !element.tagName ||
+            !element.childNodes) {
+            throw {
+                name: "StropheError",
+                message: "Cannot queue non-DOMElement."
+            };
+        }
+        
+        this._data.push(element);
+    },
+
+    /** PrivateFunction: _sendRestart
+     *  Send an xmpp:restart stanza.
+     */
+    _sendRestart: function ()
+    {
+        this._data.push("restart");
+
+        this._throttledRequestHandler();
+        clearTimeout(this._idleTimeout);
+        this._idleTimeout = setTimeout(this._onIdle.bind(this), 100);
+    },
+
+    /** Function: addTimedHandler
+     *  Add a timed handler to the connection.
+     *
+     *  This function adds a timed handler.  The provided handler will
+     *  be called every period milliseconds until it returns false,
+     *  the connection is terminated, or the handler is removed.  Handlers
+     *  that wish to continue being invoked should return true.
+     *
+     *  Because of method binding it is necessary to save the result of
+     *  this function if you wish to remove a handler with
+     *  deleteTimedHandler().
+     *
+     *  Note that user handlers are not active until authentication is
+     *  successful.
+     *
+     *  Parameters:
+     *    (Integer) period - The period of the handler.
+     *    (Function) handler - The callback function.
+     *
+     *  Returns:
+     *    A reference to the handler that can be used to remove it.
+     */
+    addTimedHandler: function (period, handler)
+    {
+        var thand = new Strophe.TimedHandler(period, handler);
+        this.addTimeds.push(thand);
+        return thand;
+    },
+
+    /** Function: deleteTimedHandler
+     *  Delete a timed handler for a connection.
+     *
+     *  This function removes a timed handler from the connection.  The
+     *  handRef parameter is *not* the function passed to addTimedHandler(),
+     *  but is the reference returned from addTimedHandler().
+     *
+     *  Parameters:
+     *    (Strophe.TimedHandler) handRef - The handler reference.
+     */
+    deleteTimedHandler: function (handRef)
+    {
+        // this must be done in the Idle loop so that we don't change
+        // the handlers during iteration
+        this.removeTimeds.push(handRef);
+    },
+
+    /** Function: addHandler
+     *  Add a stanza handler for the connection.
+     *
+     *  This function adds a stanza handler to the connection.  The
+     *  handler callback will be called for any stanza that matches
+     *  the parameters.  Note that if multiple parameters are supplied,
+     *  they must all match for the handler to be invoked.
+     *
+     *  The handler will receive the stanza that triggered it as its argument.
+     *  The handler should return true if it is to be invoked again;
+     *  returning false will remove the handler after it returns.
+     *
+     *  As a convenience, the ns parameters applies to the top level element
+     *  and also any of its immediate children.  This is primarily to make
+     *  matching /iq/query elements easy.
+     *
+     *  The options argument contains handler matching flags that affect how
+     *  matches are determined. Currently the only flag is matchBare (a
+     *  boolean). When matchBare is true, the from parameter and the from
+     *  attribute on the stanza will be matched as bare JIDs instead of
+     *  full JIDs. To use this, pass {matchBare: true} as the value of
+     *  options. The default value for matchBare is false. 
+     *
+     *  The return value should be saved if you wish to remove the handler
+     *  with deleteHandler().
+     *
+     *  Parameters:
+     *    (Function) handler - The user callback.
+     *    (String) ns - The namespace to match.
+     *    (String) name - The stanza name to match.
+     *    (String) type - The stanza type attribute to match.
+     *    (String) id - The stanza id attribute to match.
+     *    (String) from - The stanza from attribute to match.
+     *    (String) options - The handler options
+     *
+     *  Returns:
+     *    A reference to the handler that can be used to remove it.
+     */
+    addHandler: function (handler, ns, name, type, id, from, options)
+    {
+        var hand = new Strophe.Handler(handler, ns, name, type, id, from, options);
+        this.addHandlers.push(hand);
+        return hand;
+    },
+
+    /** Function: deleteHandler
+     *  Delete a stanza handler for a connection.
+     *
+     *  This function removes a stanza handler from the connection.  The
+     *  handRef parameter is *not* the function passed to addHandler(),
+     *  but is the reference returned from addHandler().
+     *
+     *  Parameters:
+     *    (Strophe.Handler) handRef - The handler reference.
+     */
+    deleteHandler: function (handRef)
+    {
+        // this must be done in the Idle loop so that we don't change
+        // the handlers during iteration
+        this.removeHandlers.push(handRef);
+    },
+
+    /** Function: disconnect
+     *  Start the graceful disconnection process.
+     *
+     *  This function starts the disconnection process.  This process starts
+     *  by sending unavailable presence and sending BOSH body of type
+     *  terminate.  A timeout handler makes sure that disconnection happens
+     *  even if the BOSH server does not respond.
+     *
+     *  The user supplied connection callback will be notified of the
+     *  progress as this process happens.
+     *
+     *  Parameters:
+     *    (String) reason - The reason the disconnect is occuring.
+     */
+    disconnect: function (reason)
+    {
+        this._changeConnectStatus(Strophe.Status.DISCONNECTING, reason);
+
+        Strophe.info("Disconnect was called because: " + reason);
+        if (this.connected) {
+            // setup timeout handler
+            this._disconnectTimeout = this._addSysTimedHandler(
+                3000, this._onDisconnectTimeout.bind(this));
+            this._sendTerminate();
+        }
+    },
+
+    /** PrivateFunction: _changeConnectStatus
+     *  _Private_ helper function that makes sure plugins and the user's
+     *  callback are notified of connection status changes.
+     *
+     *  Parameters:
+     *    (Integer) status - the new connection status, one of the values
+     *      in Strophe.Status
+     *    (String) condition - the error condition or null
+     */
+    _changeConnectStatus: function (status, condition)
+    {
+        // notify all plugins listening for status changes
+        for (var k in Strophe._connectionPlugins) {
+            if (Strophe._connectionPlugins.hasOwnProperty(k)) {
+                var plugin = this[k];
+                if (plugin.statusChanged) {
+                    try {
+                        plugin.statusChanged(status, condition);
+                    } catch (err) {
+                        Strophe.error("" + k + " plugin caused an exception " +
+                                      "changing status: " + err);
+                    }
+                }
+            }
+        }
+
+        // notify the user's callback
+        if (this.connect_callback) {
+            try {
+                this.connect_callback(status, condition);
+            } catch (e) {
+                Strophe.error("User connection callback caused an " +
+                              "exception: " + e);
+            }
+        }
+    },
+
+    /** PrivateFunction: _buildBody
+     *  _Private_ helper function to generate the <body/> wrapper for BOSH.
+     *
+     *  Returns:
+     *    A Strophe.Builder with a <body/> element.
+     */
+    _buildBody: function ()
+    {
+        var bodyWrap = $build('body', {
+            rid: this.rid++,
+            xmlns: Strophe.NS.HTTPBIND
+        });
+
+        if (this.sid !== null) {
+            bodyWrap.attrs({sid: this.sid});
+        }
+
+        return bodyWrap;
+    },
+
+    /** PrivateFunction: _removeRequest
+     *  _Private_ function to remove a request from the queue.
+     *
+     *  Parameters:
+     *    (Strophe.Request) req - The request to remove.
+     */
+    _removeRequest: function (req)
+    {
+        Strophe.debug("removing request");
+
+        var i;
+        for (i = this._requests.length - 1; i >= 0; i--) {
+            if (req == this._requests[i]) {
+                this._requests.splice(i, 1);
+            }
+        }
+
+        // IE6 fails on setting to null, so set to empty function
+        req.xhr.onreadystatechange = function () {};
+
+        this._throttledRequestHandler();
+    },
+
+    /** PrivateFunction: _restartRequest
+     *  _Private_ function to restart a request that is presumed dead.
+     *
+     *  Parameters:
+     *    (Integer) i - The index of the request in the queue.
+     */
+    _restartRequest: function (i)
+    {
+        var req = this._requests[i];
+        if (req.dead === null) {
+            req.dead = new Date();
+        }
+
+        this._processRequest(i);
+    },
+
+    /** PrivateFunction: _processRequest
+     *  _Private_ function to process a request in the queue.
+     *
+     *  This function takes requests off the queue and sends them and
+     *  restarts dead requests.
+     *
+     *  Parameters:
+     *    (Integer) i - The index of the request in the queue.
+     */
+    _processRequest: function (i)
+    {
+        var req = this._requests[i];
+        var reqStatus = -1;
+
+        try {
+            if (req.xhr.readyState == 4) {
+                reqStatus = req.xhr.status;
+            }
+        } catch (e) {
+            Strophe.error("caught an error in _requests[" + i +
+                          "], reqStatus: " + reqStatus);
+        }
+
+        if (typeof(reqStatus) == "undefined") {
+            reqStatus = -1;
+        }
+
+        var time_elapsed = req.age();
+        var primaryTimeout = (!isNaN(time_elapsed) &&
+                              time_elapsed > Math.floor(Strophe.TIMEOUT * this.wait));
+        var secondaryTimeout = (req.dead !== null &&
+                                req.timeDead() > Math.floor(Strophe.SECONDARY_TIMEOUT * this.wait));
+        var requestCompletedWithServerError = (req.xhr.readyState == 4 &&
+                                               (reqStatus < 1 ||
+                                                reqStatus >= 500));
+        if (primaryTimeout || secondaryTimeout ||
+            requestCompletedWithServerError) {
+            if (secondaryTimeout) {
+                Strophe.error("Request " +
+                              this._requests[i].id +
+                              " timed out (secondary), restarting");
+            }
+            req.abort = true;
+            req.xhr.abort();
+            // setting to null fails on IE6, so set to empty function
+            req.xhr.onreadystatechange = function () {};
+            this._requests[i] = new Strophe.Request(req.xmlData,
+                                                    req.origFunc,
+                                                    req.rid,
+                                                    req.sends);
+            req = this._requests[i];
+        }
+
+        if (req.xhr.readyState === 0) {
+            Strophe.debug("request id " + req.id +
+                          "." + req.sends + " posting");
+
+            req.date = new Date();
+            try {
+                req.xhr.open("POST", this.service, true);
+            } catch (e2) {
+                Strophe.error("XHR open failed.");
+                if (!this.connected) {
+                    this._changeConnectStatus(Strophe.Status.CONNFAIL,
+                                              "bad-service");
+                }
+                this.disconnect();
+                return;
+            }
+
+            // Fires the XHR request -- may be invoked immediately
+            // or on a gradually expanding retry window for reconnects
+            var sendFunc = function () {
+                req.xhr.send(req.data);
+            };
+
+            // Implement progressive backoff for reconnects --
+            // First retry (send == 1) should also be instantaneous
+            if (req.sends > 1) {
+                // Using a cube of the retry number creats a nicely
+                // expanding retry window
+                var backoff = Math.pow(req.sends, 3) * 1000;
+                setTimeout(sendFunc, backoff);
+            } else {
+                sendFunc();
+            }
+
+            req.sends++;
+
+            this.xmlOutput(req.xmlData);
+            this.rawOutput(req.data);
+        } else {
+            Strophe.debug("_processRequest: " +
+                          (i === 0 ? "first" : "second") +
+                          " request has readyState of " +
+                          req.xhr.readyState);
+        }
+    },
+
+    /** PrivateFunction: _throttledRequestHandler
+     *  _Private_ function to throttle requests to the connection window.
+     *
+     *  This function makes sure we don't send requests so fast that the
+     *  request ids overflow the connection window in the case that one
+     *  request died.
+     */
+    _throttledRequestHandler: function ()
+    {
+        if (!this._requests) {
+            Strophe.debug("_throttledRequestHandler called with " +
+                          "undefined requests");
+        } else {
+            Strophe.debug("_throttledRequestHandler called with " +
+                          this._requests.length + " requests");
+        }
+
+        if (!this._requests || this._requests.length === 0) {
+            return;
+        }
+
+        if (this._requests.length > 0) {
+            this._processRequest(0);
+        }
+
+        if (this._requests.length > 1 &&
+            Math.abs(this._requests[0].rid -
+                     this._requests[1].rid) < this.window - 1) {
+            this._processRequest(1);
+        }
+    },
+
+    /** PrivateFunction: _onRequestStateChange
+     *  _Private_ handler for Strophe.Request state changes.
+     *
+     *  This function is called when the XMLHttpRequest readyState changes.
+     *  It contains a lot of error handling logic for the many ways that
+     *  requests can fail, and calls the request callback when requests
+     *  succeed.
+     *
+     *  Parameters:
+     *    (Function) func - The handler for the request.
+     *    (Strophe.Request) req - The request that is changing readyState.
+     */
+    _onRequestStateChange: function (func, req)
+    {
+        Strophe.debug("request id " + req.id +
+                      "." + req.sends + " state changed to " +
+                      req.xhr.readyState);
+
+        if (req.abort) {
+            req.abort = false;
+            return;
+        }
+
+        // request complete
+        var reqStatus;
+        if (req.xhr.readyState == 4) {
+            reqStatus = 0;
+            try {
+                reqStatus = req.xhr.status;
+            } catch (e) {
+                // ignore errors from undefined status attribute.  works
+                // around a browser bug
+            }
+
+            if (typeof(reqStatus) == "undefined") {
+                reqStatus = 0;
+            }
+
+            if (this.disconnecting) {
+                if (reqStatus >= 400) {
+                    this._hitError(reqStatus);
+                    return;
+                }
+            }
+
+            var reqIs0 = (this._requests[0] == req);
+            var reqIs1 = (this._requests[1] == req);
+
+            if ((reqStatus > 0 && reqStatus < 500) || req.sends > 5) {
+                // remove from internal queue
+                this._removeRequest(req);
+                Strophe.debug("request id " +
+                              req.id +
+                              " should now be removed");
+            }
+
+            // request succeeded
+            if (reqStatus == 200) {
+                // if request 1 finished, or request 0 finished and request
+                // 1 is over Strophe.SECONDARY_TIMEOUT seconds old, we need to
+                // restart the other - both will be in the first spot, as the
+                // completed request has been removed from the queue already
+                if (reqIs1 ||
+                    (reqIs0 && this._requests.length > 0 &&
+                     this._requests[0].age() > Math.floor(Strophe.SECONDARY_TIMEOUT * this.wait))) {
+                    this._restartRequest(0);
+                }
+                // call handler
+                Strophe.debug("request id " +
+                              req.id + "." +
+                              req.sends + " got 200");
+                func(req);
+                this.errors = 0;
+            } else {
+                Strophe.error("request id " +
+                              req.id + "." +
+                              req.sends + " error " + reqStatus +
+                              " happened");
+                if (reqStatus === 0 ||
+                    (reqStatus >= 400 && reqStatus < 600) ||
+                    reqStatus >= 12000) {
+                    this._hitError(reqStatus);
+                    if (reqStatus >= 400 && reqStatus < 500) {
+                        this._changeConnectStatus(Strophe.Status.DISCONNECTING,
+                                                  null);
+                        this._doDisconnect();
+                    }
+                }
+            }
+
+            if (!((reqStatus > 0 && reqStatus < 10000) ||
+                  req.sends > 5)) {
+                this._throttledRequestHandler();
+            }
+        }
+    },
+
+    /** PrivateFunction: _hitError
+     *  _Private_ function to handle the error count.
+     *
+     *  Requests are resent automatically until their error count reaches
+     *  5.  Each time an error is encountered, this function is called to
+     *  increment the count and disconnect if the count is too high.
+     *
+     *  Parameters:
+     *    (Integer) reqStatus - The request status.
+     */
+    _hitError: function (reqStatus)
+    {
+        this.errors++;
+        Strophe.warn("request errored, status: " + reqStatus +
+                     ", number of errors: " + this.errors);
+        if (this.errors > 4) {
+            this._onDisconnectTimeout();
+        }
+    },
+
+    /** PrivateFunction: _doDisconnect
+     *  _Private_ function to disconnect.
+     *
+     *  This is the last piece of the disconnection logic.  This resets the
+     *  connection and alerts the user's connection callback.
+     */
+    _doDisconnect: function ()
+    {
+        Strophe.info("_doDisconnect was called");
+        this.authenticated = false;
+        this.disconnecting = false;
+        this.sid = null;
+        this.streamId = null;
+        this.rid = Math.floor(Math.random() * 4294967295);
+
+        // tell the parent we disconnected
+        if (this.connected) {
+            this._changeConnectStatus(Strophe.Status.DISCONNECTED, null);
+            this.connected = false;
+        }
+
+        // delete handlers
+        this.handlers = [];
+        this.timedHandlers = [];
+        this.removeTimeds = [];
+        this.removeHandlers = [];
+        this.addTimeds = [];
+        this.addHandlers = [];
+    },
+
+    /** PrivateFunction: _dataRecv
+     *  _Private_ handler to processes incoming data from the the connection.
+     *
+     *  Except for _connect_cb handling the initial connection request,
+     *  this function handles the incoming data for all requests.  This
+     *  function also fires stanza handlers that match each incoming
+     *  stanza.
+     *
+     *  Parameters:
+     *    (Strophe.Request) req - The request that has data ready.
+     */
+    _dataRecv: function (req)
+    {
+    	var arrayIndexOf = function( pArray, pInd)
+    	{
+    		var len = pArray.length;
+    		
+    		for( var i = 0 ; i < len; i++ )
+    		{
+    			if( pArray[i] == pInd )
+    				return i;
+    		}
+    		
+    		return -1;
+    	};
+    	
+    	try {
+            var elem = req.getResponse();
+        } catch (e) {
+            if (e != "parsererror") { throw e; }
+            this.disconnect("strophe-parsererror");
+        }
+        if (elem === null) { return; }
+
+        this.xmlInput(elem);
+        this.rawInput(Strophe.serialize(elem));
+
+        // remove handlers scheduled for deletion
+        var i, hand;
+        while (this.removeHandlers.length > 0)
+        {
+            hand = this.removeHandlers.pop();
+            //i = this.handlers.indexOf(hand);
+            i = arrayIndexOf( this.handlers, hand );
+            
+            if ( i >= 0 )
+            {
+                this.handlers.splice(i, 1);
+            }
+        }
+
+        // add handlers scheduled for addition
+        while (this.addHandlers.length > 0) {
+            this.handlers.push(this.addHandlers.pop());
+        }
+
+        // handle graceful disconnect
+        if (this.disconnecting && this._requests.length === 0) {
+            this.deleteTimedHandler(this._disconnectTimeout);
+            this._disconnectTimeout = null;
+            this._doDisconnect();
+            return;
+        }
+
+        var typ = elem.getAttribute("type");
+        var cond, conflict;
+        if (typ !== null && typ == "terminate") {
+            // an error occurred
+            cond = elem.getAttribute("condition");
+            conflict = elem.getElementsByTagName("conflict");
+            if (cond !== null) {
+                if (cond == "remote-stream-error" && conflict.length > 0) {
+                    cond = "conflict";
+                }
+                this._changeConnectStatus(Strophe.Status.CONNFAIL, cond);
+            } else {
+                this._changeConnectStatus(Strophe.Status.CONNFAIL, "unknown");
+            }
+            this.disconnect();
+            return;
+        }
+
+        // send each incoming stanza through the handler chain
+        var self = this;
+        Strophe.forEachChild(elem, null, function (child) {
+            var i, newList;
+            // process handlers
+            newList = self.handlers;
+            self.handlers = [];
+            for (i = 0; i < newList.length; i++) {
+                var hand = newList[i];
+                if (hand.isMatch(child) &&
+                    (self.authenticated || !hand.user)) {
+                    if (hand.run(child)) {
+                        self.handlers.push(hand);
+                    }
+                } else {
+                    self.handlers.push(hand);
+                }
+            }
+        });
+    },
+
+    /** PrivateFunction: _sendTerminate
+     *  _Private_ function to send initial disconnect sequence.
+     *
+     *  This is the first step in a graceful disconnect.  It sends
+     *  the BOSH server a terminate body and includes an unavailable
+     *  presence if authentication has completed.
+     */
+    _sendTerminate: function ()
+    {
+        Strophe.info("_sendTerminate was called");
+        var body = this._buildBody().attrs({type: "terminate"});
+
+        if (this.authenticated) {
+            body.c('presence', {
+                xmlns: Strophe.NS.CLIENT,
+                type: 'unavailable'
+            });
+        }
+
+        this.disconnecting = true;
+
+        var req = new Strophe.Request(body.tree(),
+                                      this._onRequestStateChange.bind(this)
+                                          .prependArg(this._dataRecv.bind(this)),
+                                      body.tree().getAttribute("rid"));
+
+        this._requests.push(req);
+        this._throttledRequestHandler();
+    },
+
+    /** PrivateFunction: _connect_cb
+     *  _Private_ handler for initial connection request.
+     *
+     *  This handler is used to process the initial connection request
+     *  response from the BOSH server. It is used to set up authentication
+     *  handlers and start the authentication process.
+     *
+     *  SASL authentication will be attempted if available, otherwise
+     *  the code will fall back to legacy authentication.
+     *
+     *  Parameters:
+     *    (Strophe.Request) req - The current request.
+     */
+    _connect_cb: function (req)
+    {
+        Strophe.info("_connect_cb was called");
+
+        this.connected = true;
+        var bodyWrap = req.getResponse();
+        if (!bodyWrap) { return; }
+
+        this.xmlInput(bodyWrap);
+        this.rawInput(Strophe.serialize(bodyWrap));
+
+        var typ = bodyWrap.getAttribute("type");
+        var cond, conflict;
+        if (typ !== null && typ == "terminate") {
+            // an error occurred
+            cond = bodyWrap.getAttribute("condition");
+            conflict = bodyWrap.getElementsByTagName("conflict");
+            if (cond !== null) {
+                if (cond == "remote-stream-error" && conflict.length > 0) {
+                    cond = "conflict";
+                }
+                this._changeConnectStatus(Strophe.Status.CONNFAIL, cond);
+            } else {
+                this._changeConnectStatus(Strophe.Status.CONNFAIL, "unknown");
+            }
+            return;
+        }
+
+        // check to make sure we don't overwrite these if _connect_cb is
+        // called multiple times in the case of missing stream:features
+        if (!this.sid) {
+            this.sid = bodyWrap.getAttribute("sid");
+        }
+        if (!this.stream_id) {
+            this.stream_id = bodyWrap.getAttribute("authid");
+        }
+        var wind = bodyWrap.getAttribute('requests');
+        if (wind) { this.window = parseInt(wind, 10); }
+        var hold = bodyWrap.getAttribute('hold');
+        if (hold) { this.hold = parseInt(hold, 10); }
+        var wait = bodyWrap.getAttribute('wait');
+        if (wait) { this.wait = parseInt(wait, 10); }
+        
+
+        var do_sasl_plain = false;
+        var do_sasl_digest_md5 = false;
+        var do_sasl_anonymous = false;
+
+        var mechanisms = bodyWrap.getElementsByTagName("mechanism");
+        var i, mech, auth_str, hashed_auth_str;
+        if (mechanisms.length > 0) {
+            for (i = 0; i < mechanisms.length; i++) {
+                mech = Strophe.getText(mechanisms[i]);
+                if (mech == 'DIGEST-MD5') {
+                    do_sasl_digest_md5 = true;
+                } else if (mech == 'PLAIN') {
+                    do_sasl_plain = true;
+                } else if (mech == 'ANONYMOUS') {
+                    do_sasl_anonymous = true;
+                }
+            }
+        } else {
+            // we didn't get stream:features yet, so we need wait for it
+            // by sending a blank poll request
+            var body = this._buildBody();
+            this._requests.push(
+                new Strophe.Request(body.tree(),
+                                    this._onRequestStateChange.bind(this)
+                                      .prependArg(this._connect_cb.bind(this)),
+                                    body.tree().getAttribute("rid")));
+            this._throttledRequestHandler();
+            return;
+        }
+
+        if (Strophe.getNodeFromJid(this.jid) === null &&
+            do_sasl_anonymous) {
+            this._changeConnectStatus(Strophe.Status.AUTHENTICATING, null);
+            this._sasl_success_handler = this._addSysHandler(
+                this._sasl_success_cb.bind(this), null,
+                "success", null, null);
+            this._sasl_failure_handler = this._addSysHandler(
+                this._sasl_failure_cb.bind(this), null,
+                "failure", null, null);
+
+            this.send($build("auth", {
+                xmlns: Strophe.NS.SASL,
+                mechanism: "ANONYMOUS"
+            }).tree());
+        } else if (Strophe.getNodeFromJid(this.jid) === null) {
+            // we don't have a node, which is required for non-anonymous
+            // client connections
+            this._changeConnectStatus(Strophe.Status.CONNFAIL,
+                                      'x-strophe-bad-non-anon-jid');
+            this.disconnect();
+        } else if (do_sasl_digest_md5) {
+            this._changeConnectStatus(Strophe.Status.AUTHENTICATING, null);
+            this._sasl_challenge_handler = this._addSysHandler(
+                this._sasl_challenge1_cb.bind(this), null,
+                "challenge", null, null);
+            this._sasl_failure_handler = this._addSysHandler(
+                this._sasl_failure_cb.bind(this), null,
+                "failure", null, null);
+
+            this.send($build("auth", {
+                xmlns: Strophe.NS.SASL,
+                mechanism: "DIGEST-MD5"
+            }).tree());
+        } else if (do_sasl_plain) {
+            // Build the plain auth string (barejid null
+            // username null password) and base 64 encoded.
+            auth_str = Strophe.getBareJidFromJid(this.jid);
+            auth_str = auth_str + "\u0000";
+            auth_str = auth_str + Strophe.getNodeFromJid(this.jid);
+            auth_str = auth_str + "\u0000";
+            auth_str = auth_str + this.pass;
+
+            this._changeConnectStatus(Strophe.Status.AUTHENTICATING, null);
+            this._sasl_success_handler = this._addSysHandler(
+                this._sasl_success_cb.bind(this), null,
+                "success", null, null);
+            this._sasl_failure_handler = this._addSysHandler(
+                this._sasl_failure_cb.bind(this), null,
+                "failure", null, null);
+
+            hashed_auth_str = Base64.encode(auth_str);
+            this.send($build("auth", {
+                xmlns: Strophe.NS.SASL,
+                mechanism: "PLAIN"
+            }).t(hashed_auth_str).tree());
+        } else {
+            this._changeConnectStatus(Strophe.Status.AUTHENTICATING, null);
+            this._addSysHandler(this._auth1_cb.bind(this), null, null,
+                                null, "_auth_1");
+
+            this.send($iq({
+                type: "get",
+                to: this.domain,
+                id: "_auth_1"
+            }).c("query", {
+                xmlns: Strophe.NS.AUTH
+            }).c("username", {}).t(Strophe.getNodeFromJid(this.jid)).tree());
+        }
+    },
+
+    /** PrivateFunction: _sasl_challenge1_cb
+     *  _Private_ handler for DIGEST-MD5 SASL authentication.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The challenge stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_challenge1_cb: function (elem)
+    {
+        var attribMatch = /([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;
+
+        var challenge = Base64.decode(Strophe.getText(elem));
+        var cnonce = MD5.hexdigest(Math.random() * 1234567890);
+        var realm = "";
+        var host = null;
+        var nonce = "";
+        var qop = "";
+        var matches;
+
+        // remove unneeded handlers
+        this.deleteHandler(this._sasl_failure_handler);
+
+        while (challenge.match(attribMatch)) {
+            matches = challenge.match(attribMatch);
+            challenge = challenge.replace(matches[0], "");
+            matches[2] = matches[2].replace(/^"(.+)"$/, "$1");
+            switch (matches[1]) {
+            case "realm":
+                realm = matches[2];
+                break;
+            case "nonce":
+                nonce = matches[2];
+                break;
+            case "qop":
+                qop = matches[2];
+                break;
+            case "host":
+                host = matches[2];
+                break;
+            }
+        }
+
+        var digest_uri = "xmpp/" + this.domain;
+        if (host !== null) {
+            digest_uri = digest_uri + "/" + host;
+        }
+
+        var A1 = MD5.hash(Strophe.getNodeFromJid(this.jid) +
+                          ":" + realm + ":" + this.pass) +
+            ":" + nonce + ":" + cnonce;
+        var A2 = 'AUTHENTICATE:' + digest_uri;
+
+        var responseText = "";
+        responseText += 'username=' +
+            this._quote(Strophe.getNodeFromJid(this.jid)) + ',';
+        responseText += 'realm=' + this._quote(realm) + ',';
+        responseText += 'nonce=' + this._quote(nonce) + ',';
+        responseText += 'cnonce=' + this._quote(cnonce) + ',';
+        responseText += 'nc="00000001",';
+        responseText += 'qop="auth",';
+        responseText += 'digest-uri=' + this._quote(digest_uri) + ',';
+        responseText += 'response=' + this._quote(
+            MD5.hexdigest(MD5.hexdigest(A1) + ":" +
+                          nonce + ":00000001:" +
+                          cnonce + ":auth:" +
+                          MD5.hexdigest(A2))) + ',';
+        responseText += 'charset="utf-8"';
+
+        this._sasl_challenge_handler = this._addSysHandler(
+            this._sasl_challenge2_cb.bind(this), null,
+            "challenge", null, null);
+        this._sasl_success_handler = this._addSysHandler(
+            this._sasl_success_cb.bind(this), null,
+            "success", null, null);
+        this._sasl_failure_handler = this._addSysHandler(
+            this._sasl_failure_cb.bind(this), null,
+            "failure", null, null);
+
+        this.send($build('response', {
+            xmlns: Strophe.NS.SASL
+        }).t(Base64.encode(responseText)).tree());
+
+        return false;
+    },
+
+    /** PrivateFunction: _quote
+     *  _Private_ utility function to backslash escape and quote strings.
+     *
+     *  Parameters:
+     *    (String) str - The string to be quoted.
+     *
+     *  Returns:
+     *    quoted string
+     */
+    _quote: function (str)
+    {
+        return '"' + str.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'; 
+        //" end string workaround for emacs
+    },
+
+
+    /** PrivateFunction: _sasl_challenge2_cb
+     *  _Private_ handler for second step of DIGEST-MD5 SASL authentication.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The challenge stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_challenge2_cb: function (elem)
+    {
+        // remove unneeded handlers
+        this.deleteHandler(this._sasl_success_handler);
+        this.deleteHandler(this._sasl_failure_handler);
+
+        this._sasl_success_handler = this._addSysHandler(
+            this._sasl_success_cb.bind(this), null,
+            "success", null, null);
+        this._sasl_failure_handler = this._addSysHandler(
+            this._sasl_failure_cb.bind(this), null,
+            "failure", null, null);
+        this.send($build('response', {xmlns: Strophe.NS.SASL}).tree());
+        return false;
+    },
+
+    /** PrivateFunction: _auth1_cb
+     *  _Private_ handler for legacy authentication.
+     *
+     *  This handler is called in response to the initial <iq type='get'/>
+     *  for legacy authentication.  It builds an authentication <iq/> and
+     *  sends it, creating a handler (calling back to _auth2_cb()) to
+     *  handle the result
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The stanza that triggered the callback.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _auth1_cb: function (elem)
+    {
+        // build plaintext auth iq
+        var iq = $iq({type: "set", id: "_auth_2"})
+            .c('query', {xmlns: Strophe.NS.AUTH})
+            .c('username', {}).t(Strophe.getNodeFromJid(this.jid))
+            .up()
+            .c('password').t(this.pass);
+
+        if (!Strophe.getResourceFromJid(this.jid)) {
+            // since the user has not supplied a resource, we pick
+            // a default one here.  unlike other auth methods, the server
+            // cannot do this for us.
+            this.jid = Strophe.getBareJidFromJid(this.jid) + '/strophe';
+        }
+        iq.up().c('resource', {}).t(Strophe.getResourceFromJid(this.jid));
+
+        this._addSysHandler(this._auth2_cb.bind(this), null,
+                            null, null, "_auth_2");
+
+        this.send(iq.tree());
+
+        return false;
+    },
+
+    /** PrivateFunction: _sasl_success_cb
+     *  _Private_ handler for succesful SASL authentication.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The matching stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_success_cb: function (elem)
+    {
+        Strophe.info("SASL authentication succeeded.");
+
+        // remove old handlers
+        this.deleteHandler(this._sasl_failure_handler);
+        this._sasl_failure_handler = null;
+        if (this._sasl_challenge_handler) {
+            this.deleteHandler(this._sasl_challenge_handler);
+            this._sasl_challenge_handler = null;
+        }
+
+        this._addSysHandler(this._sasl_auth1_cb.bind(this), null,
+                            "stream:features", null, null);
+
+        // we must send an xmpp:restart now
+        this._sendRestart();
+
+        return false;
+    },
+
+    /** PrivateFunction: _sasl_auth1_cb
+     *  _Private_ handler to start stream binding.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The matching stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_auth1_cb: function (elem)
+    {
+        var i, child;
+
+        for (i = 0; i < elem.childNodes.length; i++) {
+            child = elem.childNodes[i];
+            if (child.nodeName == 'bind') {
+                this.do_bind = true;
+            }
+
+            if (child.nodeName == 'session') {
+                this.do_session = true;
+            }
+        }
+
+        if (!this.do_bind) {
+            this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+            return false;
+        } else {
+            this._addSysHandler(this._sasl_bind_cb.bind(this), null, null,
+                                null, "_bind_auth_2");
+
+            var resource = Strophe.getResourceFromJid(this.jid);
+            if (resource) {
+                this.send($iq({type: "set", id: "_bind_auth_2"})
+                          .c('bind', {xmlns: Strophe.NS.BIND})
+                          .c('resource', {}).t(resource).tree());
+            } else {
+                this.send($iq({type: "set", id: "_bind_auth_2"})
+                          .c('bind', {xmlns: Strophe.NS.BIND})
+                          .tree());
+            }
+        }
+
+        return false;
+    },
+
+    /** PrivateFunction: _sasl_bind_cb
+     *  _Private_ handler for binding result and session start.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The matching stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_bind_cb: function (elem)
+    {
+        if (elem.getAttribute("type") == "error") {
+            Strophe.info("SASL binding failed.");
+            this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+            return false;
+        }
+
+        // TODO - need to grab errors
+        var bind = elem.getElementsByTagName("bind");
+        var jidNode;
+        if (bind.length > 0) {
+            // Grab jid
+            jidNode = bind[0].getElementsByTagName("jid");
+            if (jidNode.length > 0) {
+                this.jid = Strophe.getText(jidNode[0]);
+
+                if (this.do_session) {
+                    this._addSysHandler(this._sasl_session_cb.bind(this),
+                                        null, null, null, "_session_auth_2");
+
+                    this.send($iq({type: "set", id: "_session_auth_2"})
+                                  .c('session', {xmlns: Strophe.NS.SESSION})
+                                  .tree());
+                } else {
+                    this.authenticated = true;
+                    this._changeConnectStatus(Strophe.Status.CONNECTED, null);
+                }
+            }
+        } else {
+            Strophe.info("SASL binding failed.");
+            this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+            return false;
+        }
+    },
+
+    /** PrivateFunction: _sasl_session_cb
+     *  _Private_ handler to finish successful SASL connection.
+     *
+     *  This sets Connection.authenticated to true on success, which
+     *  starts the processing of user handlers.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The matching stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_session_cb: function (elem)
+    {
+        if (elem.getAttribute("type") == "result") {
+            this.authenticated = true;
+            this._changeConnectStatus(Strophe.Status.CONNECTED, null);
+        } else if (elem.getAttribute("type") == "error") {
+            Strophe.info("Session creation failed.");
+            this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+            return false;
+        }
+
+        return false;
+    },
+
+    /** PrivateFunction: _sasl_failure_cb
+     *  _Private_ handler for SASL authentication failure.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The matching stanza.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _sasl_failure_cb: function (elem)
+    {
+        // delete unneeded handlers
+        if (this._sasl_success_handler) {
+            this.deleteHandler(this._sasl_success_handler);
+            this._sasl_success_handler = null;
+        }
+        if (this._sasl_challenge_handler) {
+            this.deleteHandler(this._sasl_challenge_handler);
+            this._sasl_challenge_handler = null;
+        }
+
+        this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+        return false;
+    },
+
+    /** PrivateFunction: _auth2_cb
+     *  _Private_ handler to finish legacy authentication.
+     *
+     *  This handler is called when the result from the jabber:iq:auth
+     *  <iq/> stanza is returned.
+     *
+     *  Parameters:
+     *    (XMLElement) elem - The stanza that triggered the callback.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _auth2_cb: function (elem)
+    {
+        if (elem.getAttribute("type") == "result") {
+            this.authenticated = true;
+            this._changeConnectStatus(Strophe.Status.CONNECTED, null);
+        } else if (elem.getAttribute("type") == "error") {
+            this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
+            this.disconnect();
+        }
+
+        return false;
+    },
+
+    /** PrivateFunction: _addSysTimedHandler
+     *  _Private_ function to add a system level timed handler.
+     *
+     *  This function is used to add a Strophe.TimedHandler for the
+     *  library code.  System timed handlers are allowed to run before
+     *  authentication is complete.
+     *
+     *  Parameters:
+     *    (Integer) period - The period of the handler.
+     *    (Function) handler - The callback function.
+     */
+    _addSysTimedHandler: function (period, handler)
+    {
+        var thand = new Strophe.TimedHandler(period, handler);
+        thand.user = false;
+        this.addTimeds.push(thand);
+        return thand;
+    },
+
+    /** PrivateFunction: _addSysHandler
+     *  _Private_ function to add a system level stanza handler.
+     *
+     *  This function is used to add a Strophe.Handler for the
+     *  library code.  System stanza handlers are allowed to run before
+     *  authentication is complete.
+     *
+     *  Parameters:
+     *    (Function) handler - The callback function.
+     *    (String) ns - The namespace to match.
+     *    (String) name - The stanza name to match.
+     *    (String) type - The stanza type attribute to match.
+     *    (String) id - The stanza id attribute to match.
+     */
+    _addSysHandler: function (handler, ns, name, type, id)
+    {
+        var hand = new Strophe.Handler(handler, ns, name, type, id);
+        hand.user = false;
+        this.addHandlers.push(hand);
+        return hand;
+    },
+
+    /** PrivateFunction: _onDisconnectTimeout
+     *  _Private_ timeout handler for handling non-graceful disconnection.
+     *
+     *  If the graceful disconnect process does not complete within the
+     *  time allotted, this handler finishes the disconnect anyway.
+     *
+     *  Returns:
+     *    false to remove the handler.
+     */
+    _onDisconnectTimeout: function ()
+    {
+        Strophe.info("_onDisconnectTimeout was called");
+
+        // cancel all remaining requests and clear the queue
+        var req;
+        while (this._requests.length > 0) {
+            req = this._requests.pop();
+            req.abort = true;
+            req.xhr.abort();
+            // jslint complains, but this is fine. setting to empty func
+            // is necessary for IE6
+            req.xhr.onreadystatechange = function () {};
+        }
+
+        // actually disconnect
+        this._doDisconnect();
+
+        return false;
+    },
+
+    /** PrivateFunction: _onIdle
+     *  _Private_ handler to process events during idle cycle.
+     *
+     *  This handler is called every 100ms to fire timed handlers that
+     *  are ready and keep poll requests going.
+     */
+    _onIdle: function ()
+    {
+    	var arrayIndexOf = function( pArray, pInd)
+    	{
+    		var len = pArray.length;
+    		
+    		for( var i = 0 ; i < len; i++ )
+    		{
+    			if( pArray[i] == pInd )
+    				return i;
+    		}
+    		
+    		return -1;
+    	};
+    	
+    	var i, thand, since, newList;
+
+        // remove timed handlers that have been scheduled for deletion
+        while (this.removeTimeds.length > 0)
+        {
+            thand = this.removeTimeds.pop();
+            //i = this.timedHandlers.indexOf(thand);
+            i = arrayIndexOf( this.timedHandlers, thand );
+            
+            if (i >= 0)
+            {
+                this.timedHandlers.splice(i, 1);
+            }
+        }
+
+        // add timed handlers scheduled for addition
+        while (this.addTimeds.length > 0) {
+            this.timedHandlers.push(this.addTimeds.pop());
+        }
+
+        // call ready timed handlers
+        var now = new Date().getTime();
+        newList = [];
+        for (i = 0; i < this.timedHandlers.length; i++) {
+            thand = this.timedHandlers[i];
+            if (this.authenticated || !thand.user) {
+                since = thand.lastCalled + thand.period;
+                if (since - now <= 0) {
+                    if (thand.run()) {
+                        newList.push(thand);
+                    }
+                } else {
+                    newList.push(thand);
+                }
+            }
+        }
+        this.timedHandlers = newList;
+
+        var body, time_elapsed;
+
+        // if no requests are in progress, poll
+        if (this.authenticated && this._requests.length === 0 &&
+            this._data.length === 0 && !this.disconnecting) {
+            Strophe.info("no requests during idle cycle, sending " +
+                         "blank request");
+            this._data.push(null);
+        }
+
+        if (this._requests.length < 2 && this._data.length > 0 &&
+            !this.paused) {
+            body = this._buildBody();
+            for (i = 0; i < this._data.length; i++) {
+                if (this._data[i] !== null) {
+                    if (this._data[i] === "restart") {
+                        body.attrs({
+                            to: this.domain,
+                            "xml:lang": "en",
+                            "xmpp:restart": "true",
+                            "xmlns:xmpp": Strophe.NS.BOSH
+                        });
+                    } else {
+                        body.cnode(this._data[i]).up();
+                    }
+                }
+            }
+            delete this._data;
+            this._data = [];
+            this._requests.push(
+                new Strophe.Request(body.tree(),
+                                    this._onRequestStateChange.bind(this)
+                                    .prependArg(this._dataRecv.bind(this)),
+                                    body.tree().getAttribute("rid")));
+            this._processRequest(this._requests.length - 1);
+        }
+
+        if (this._requests.length > 0) {
+            time_elapsed = this._requests[0].age();
+            if (this._requests[0].dead !== null) {
+                if (this._requests[0].timeDead() >
+                    Math.floor(Strophe.SECONDARY_TIMEOUT * this.wait)) {
+                    this._throttledRequestHandler();
+                }
+            }
+
+            if (time_elapsed > Math.floor(Strophe.TIMEOUT * this.wait)) {
+                Strophe.warn("Request " +
+                             this._requests[0].id +
+                             " timed out, over " + Math.floor(Strophe.TIMEOUT * this.wait) +
+                             " seconds since last activity");
+                this._throttledRequestHandler();
+            }
+        }
+
+        // reactivate the timer
+        clearTimeout(this._idleTimeout);
+        this._idleTimeout = setTimeout(this._onIdle.bind(this), 100);
+    }
+};
+
+if (callback) {
+    callback(Strophe, $build, $msg, $iq, $pres);
+}
+
+})(function () {
+    window.Strophe = arguments[0];
+    window.$build = arguments[1];
+    window.$msg = arguments[2];
+    window.$iq = arguments[3];
+    window.$pres = arguments[4];
+});
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 4453)
@@ -0,0 +1,76 @@
+
+(function()
+{var _THREADS=[];var _ie;function _config(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 _xhr()
+{try
+{return new XMLHttpRequest();}
+catch(_e)
+{_ie=true;try
+{return new ActiveXObject('Msxml2.XMLHTTP');}
+catch(_e1)
+{try
+{return new ActiveXObject('Microsoft.XMLHTTP');}
+catch(_e2)
+{return false;}}}}
+function _HANDLER()
+{var _ID=arguments[0];if(_THREADS[_ID])
+{if(_ie&&_THREADS[_ID]._XHR.readyState!=4)
+return false;switch(_THREADS[_ID]._XHR.readyState)
+{case 3:if(_THREADS[_ID]._HANDLER.stream)
+{var _data=_THREADS[_ID]._XHR.responseText.substr(_THREADS[_ID]._index).replace(/^ +| +$/g,'');_THREADS[_ID]._rtlen=_THREADS[_ID]._XHR.responseText.length;if(_THREADS[_ID]._index<_THREADS[_ID]._rtlen&&_data.length)
+{try
+{_THREADS[_ID]._HANDLER.stream(_data);}
+catch(_e)
+{}}
+if(_THREADS[_ID])
+{_THREADS[_ID]._index=_THREADS[_ID]._rtlen;}}
+break;case 4:try
+{switch(_THREADS[_ID]._XHR.status)
+{case 200:var _data=(_THREADS[_ID]._MODE=='XML')?_THREADS[_ID]._XHR.responseXML:_THREADS[_ID]._XHR.responseText;if(_ie&&_THREADS[_ID]._HANDLER.stream)
+_THREADS[_ID]._HANDLER.stream(_data);var _request=(_THREADS[_ID]._HANDLER.request)?_THREADS[_ID]._HANDLER.request:false;delete _THREADS[_ID];if(_request)
+try
+{_request(_data);}
+catch(_e)
+{}
+break;case 404:delete _THREADS[_ID];alert('Page Not Found!');break;default:delete _THREADS[_ID];}}
+catch(e)
+{}
+break;default:}}}
+function _execute()
+{var _ID=arguments[0];var _ACTION='act='+_ID;var _TARGET=this._PATH;var _SEND=null;if(_TARGET!=''&&_TARGET.lastIndexOf('/')!=(_TARGET.length-1))
+_TARGET+='/';_TARGET+=(this._CONTROLLER)?this._CONTROLLER:'controller.php';if(_THREADS[_ID]._METHOD=='GET')
+_TARGET+='?'+_ACTION;_THREADS[_ID]._XHR.open(_THREADS[_ID]._METHOD,_TARGET,true);if(_THREADS[_ID]._METHOD=='POST')
+{_THREADS[_ID]._XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded');_THREADS[_ID]._XHR.setRequestHeader('Cache-Control','no-store, no-cache, must-revalidate');_THREADS[_ID]._XHR.setRequestHeader('Cache-Control','post-check=0, pre-check=0');_THREADS[_ID]._XHR.setRequestHeader('Pragma','no-cache');_SEND=_ACTION+'&'+arguments[1];}
+_THREADS[_ID]._XHR.onreadystatechange=function(){_HANDLER(_ID);};_THREADS[_ID]._XHR.send(_SEND);}
+function usage()
+{return""+"Description:\n"+"\t<obj>.go(string access, [mixed handler[, mixed post]])\n\n"+"Parameters:\n"+"\taccess : assinatura de acesso Ã  camada de controle.\n"+"\thandler : uma funÃ§Ã£o a ser executada no fim da requisiÃ§Ã£o\n"+"\t\tou um objeto que poderÃ¡ conter dois Ã­ndices sendo\n"+"\t\tque ambos deverÃ£o ser uma funÃ§Ã£o que serÃ¡ executada\n"+"\t\tconforme o status do objeto xhr, sendo que na posiÃ§Ã£o\n"+"\t\t'stream' serÃ¡ a funÃ§Ã£o a ser executada a cada iteraÃ§Ã£o\n"+"\t\tdo objeto xhr e na posiÃ§Ã£o 'request' serÃ¡ a funÃ§Ã£o\n"+"\t\ta ser executada no fim da requisiÃ§Ã£o.\n"+"\tpost : se especificado deverÃ¡ ser uma query string ou um\n"+"\tXML bem formatado.\n\n";}
+function go()
+{var _argv=arguments;var _argc=_argv.length;var _ID=_argv[0];var _POST;if(_argc<1||_argc>3)
+return{'error':"#0\n\n"+usage()};if(typeof _ID!='string')
+return{'error':"#1\n\n"+usage()};_THREADS[_ID]={'_HANDLER':{},'_METHOD':(_argv[2])?'POST':'GET','_MODE':null,'_TYPE':null,'_XHR':null};if(_argv[2])
+_POST=_argv[2];if(_argv[1])
+switch(typeof _argv[1])
+{case'function':_THREADS[_ID]._HANDLER={'request':_argv[1]};break;case'object':for(var i in _argv[1])
+if(i!='stream'&&i!='request')
+{delete _THREADS[_ID];return{'error':"#3\n\n"+usage()};}
+else if(i=='stream')
+{_THREADS[_ID]._index=0;_THREADS[_ID]._rtlen=0;}
+_THREADS[_ID]._HANDLER=_argv[1];break;case'string':if(_argc==2)
+{_THREADS[_ID]._METHOD='POST';_POST=_argv[1];}
+break;default:}
+if(!(_THREADS[_ID]._XHR=_xhr()))
+return{'error':"#4 it cannot make a xhr object"};(_THREADS[_ID]._METHOD=='GET')?_execute.call(this,_ID):_execute.call(this,_ID,_POST);return{'success':"your thread is running and the response "+"will be manipulated by the handler"};}
+function abort()
+{for(var _ID in _THREADS)
+{try
+{if(_THREADS[_ID]&&_THREADS[_ID]._XHR&&_THREADS[_ID]._XHR.abort)
+_THREADS[_ID]._XHR.abort();delete _THREADS[_ID];}
+catch(e){}}}
+function Connector()
+{var _argv=arguments;this._PATH=(_argv.length>0)?_argv[0]:'';this._CONTROLLER=(_argv.length==2)?_argv[1]:false;}
+Connector.prototype.go=go;Connector.prototype.abort=abort;window.AjaxConnector=Connector;_config(window,'onbeforeunload',abort);})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.mini.js	(revision 4453)
@@ -0,0 +1,33 @@
+
+(function()
+{var _delay;var _event_show=false;var _event_hidden=false;var _last_displayed;var _timeout=false;function _config(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 hdObject()
+{if(_last_displayed)
+{_last_displayed.style.display='none';_last_displayed=false;}}
+function _hidden()
+{if(arguments.length>0)
+{if(arguments[0])
+clearTimeout(_timeout);else
+{_timeout=setTimeout(hdObject,_delay);}}}
+function _show(_element)
+{if(!(_last_displayed&&(_last_displayed.id==_element.id)))
+{_element.style.display='block';_last_displayed=_element;}}
+function _view()
+{if(arguments.length==3)
+{var _event=['onclick','onmousedown','onmouseout','onmouseover','onmouseup'];_event_show=false;_event_hidden=false;for(var i in _event)
+{if(_event[i]==arguments[0])
+_event_show=arguments[0];if(_event[i]==arguments[1])
+_event_hidden=arguments[1];}
+if(_event_show&&_event_hidden)
+{var _element=false;switch(typeof arguments[2])
+{case'object':_element=arguments[2];break;case'string':_element=document.getElementById(arguments[2]);break;}
+if(_element)
+_show(_element);}}}
+function ShowHidden()
+{_delay=((arguments.length>0)&&!isNaN(arguments[0]))?arguments[0]:3000;}
+ShowHidden.prototype.action=_view;ShowHidden.prototype.hiddenObject=_hidden;window.ShowHidden=ShowHidden;})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/AddUser.js	(revision 4453)
@@ -0,0 +1,353 @@
+(function()
+{
+		var Xtools	= null;
+		var conn	= null;	
+	
+		function addContact()
+		{
+			if( arguments.length > 0 )
+			{
+				var jidFrom		= Base64.decode( loadscript.getUserCurrent().jid );
+				var jidTo		= arguments[0];
+				var group 		= "";
+				var name		= jidTo.substring(0, jidTo.indexOf('@'));
+
+				var _groups		= "";
+
+				if( TrophyIM.rosterObj)
+				{
+					for (var group in TrophyIM.rosterObj.groups)
+					{
+						_groups += group + ";";
+					}	
+					
+					_groups = _groups.substring(0, ( _groups.length - 1) );
+				}
+				
+				var _paramNewUser =
+				{
+					'name_contact'		: name,
+					'jidFrom'			: jidFrom,					
+					'jidTo'				: jidTo,
+					'selectBoxOptions'	: _groups					
+				};
+				
+				var winNewUser =
+				{ 
+						id_window	 : "new_user_jabberit",
+						width		 : 320,
+						height		 : 165,
+						top		 	 : 100,
+						left		 : 350,
+						draggable	 : true,
+						visible	 	 : "display",
+						resizable	 : true,
+						zindex		 : loadscript.getZIndex(),
+						title		 : 'Expresso Messenger - ' + i18n.NEW_USER,
+						closeAction  : "remove",
+						content		 : Xtools.parse( Xtools.xml('new_user'), 'newUser.xsl', _paramNewUser)
+				};
+
+				_winBuild( winNewUser );
+				
+				// Select Editable
+				loadscript.setSelectEditable(document.getElementById('name_group_new_user_jabberit'), 5, 99);
+
+				var _pButtons =
+				{
+					'lang1' 		: i18n.ADD,
+					'lang2'			: i18n.CLOSE,
+					'onclickClose'	: '_winBuild("new_user_jabberit","remove");',
+					'onclickSubmit'	: 'loadscript.addNewUser();'
+				}; 
+
+				// Add Buttons
+				document.getElementById('buttons_newuser').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+
+			}
+			else
+			{	
+				var jidFrom		= Base64.decode( loadscript.getUserCurrent().jid );
+				var jidTo		= getElement('user_jid_jabberIM').value;
+				var name		= getElement('user_name_jabberIM').value;
+				var group		= getElement('user_group_jabberIM').value;
+				
+				_winBuild('add_user_info','remove');
+				
+				if( jidFrom != jidTo )
+				{
+					TrophyIM.setAutorization( jidTo, jidFrom, 'subscribe' );
+
+					TrophyIM.addContact( jidTo, name, group );
+				}
+			}
+		}
+		
+		function addNewUser()
+		{
+			var name 	= getElement('name_new_user_jabberit').value;
+			var group	= getElement('name_group_new_user_jabberit').value;
+			var jidFrom	= getElement('jidFrom_new_user_jabberit').value;
+			var jidTo	= getElement('jidTo_new_user_jabberit').value;
+
+			// Name
+			if(( name = name.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+				name = "";
+
+			if( name == null || name == "")
+				name = "";
+			
+			// Group
+			if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+				group = "";
+
+			if( group == null || group == "")
+				group = "";
+			
+			// Add Contact
+			if( jidFrom != jidTo )
+			{
+				TrophyIM.rosterObj.removeContact( jidTo );
+				
+				// Remove Element
+				loadscript.removeElement( getElement('itenContact_' + jidTo ) );
+				loadscript.removeElement( getElement('span_show_itenContact_' + jidTo ) );
+				loadscript.removeElement( getElement('itenContactNotification_' + jidTo ) );
+
+				TrophyIM.addContact( jidTo, name, group );
+				
+				TrophyIM.setAutorization( jidTo, jidFrom, 'subscribe' );
+				
+				_winBuild("new_user_jabberit","remove");
+			}
+
+		}
+		
+		function getElement( elementId )
+		{
+			return document.getElementById( elementId );
+		}
+
+		function search()
+		{
+			var _input	= document.getElementById('search_user_jabber');
+			var _span	= document.getElementById('span_searching_im');
+			var _div	= document.getElementById('list_users_ldap_im');
+
+			_span.style.display = "block";
+			
+			if( _input.value.substring((_input.value.length-1),_input.value.length) === "*" )
+				_input.value = _input.value.substring(0, ( _input.value.length - 1 ));
+
+			if( _input.value.substring(0 ,1) === "*" )
+				_input.value = _input.value.substring( 1, _input.value.length );
+			
+			conn.go('p.cc.getListContacts',
+					function(data)
+					{	
+						var _paramsVar =
+						{
+							'lang_addContact'	: i18n.ADD_CONTACTS ,
+							'lang_empty' 		: i18n.NONE_RESULT_WAS_FOUND,
+							'lang_error'		: i18n.TRY_AGAIN,
+							'lang_many_results' : i18n.MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH
+						};	
+						
+						_div.innerHTML = Xtools.parse( data, 'listLdapContacts.xsl', _paramsVar );
+
+						var _newUser = _div.firstChild;
+						
+						while ( _newUser )
+						{
+							if( _newUser.getAttribute('photo') === '1' )
+							{
+								var jid		= _newUser.getAttribute('jid'); 
+								var ou	 	= _newUser.getAttribute('ou');
+								
+								var _img_path  = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date );
+									_img_path += '&photo_session=' + jid + '&ou=' + ou;
+								
+								_newUser.style.backgroundImage = 'url(' + _img_path + ')';
+							}
+							
+							loadscript.configEvents(_newUser, 'onclick', showContact);
+							
+							_newUser = _newUser.nextSibling;
+						}
+						
+						_input.focus();
+						_input.value	 	= "";
+						_span.style.display = "none";
+						
+					},'name=' + _input.value );
+			
+		}
+		
+		function showContact(Element)
+		{
+			var element		= ( Element.target ) ? Element.target : Element.srcElement;
+			var infoUser	= null;		
+			var img			= document.createElement('img');
+			var _groups		= "";
+
+			if( TrophyIM.rosterObj)
+			{
+				for (var group in TrophyIM.rosterObj.groups)
+				{
+					_groups += group + ";";
+				}	
+				
+				_groups = _groups.substring(0, ( _groups.length - 1) );
+			}
+			
+			if( element.getAttribute('value') )
+			{
+				var infoUser = 
+				{
+					'email'				: element.getAttribute('value').substring( 0, element.getAttribute('value').indexOf(';')),
+					'jid'				: element.getAttribute('jid'),
+					'lang_group'		: "Grupo",
+					'lang_name_contact'	: "Contato",					
+					'group'				: element.getAttribute('ou'),
+					'name'				: element.getAttribute('name').substring( 0, element.getAttribute('name').indexOf(' ')),
+					'ou'				: element.getAttribute('ou'),
+					'selectBoxOptions'	: _groups,
+					'uid'				: element.getAttribute('value').substring( element.getAttribute('value').indexOf(';') + 1 )
+				};
+			}
+			else if( element.parentNode.getAttribute('value') )
+			{
+				var infoUser = 
+				{
+					'email'				: element.parentNode.getAttribute('value').substring( 0, element.parentNode.getAttribute('value').indexOf(';')),
+					'jid'				: element.parentNode.getAttribute('jid'),
+					'lang_group'		: "Grupo",
+					'lang_name_contact'	: "Contato",					
+					'group'				: element.parentNode.getAttribute('ou'),
+					'name'				: element.parentNode.getAttribute('name').substring( 0, element.parentNode.getAttribute('name').indexOf(' ')),
+					'ou'				: element.parentNode.getAttribute('ou'),
+					'selectBoxOptions'	: _groups,
+					'uid'				: element.parentNode.getAttribute('value').substring( element.parentNode.getAttribute('value').indexOf(';') + 1)
+				};
+			}
+			
+			var winAddUser =
+			{ 
+					id_window	 : "add_user_info",
+					width		 : 370,
+					height		 : 200,
+					top		 	 : 85,
+					left		 : 220,
+					draggable	 : true,
+					visible	 	 : "display",
+					resizable	 : true,
+					zindex		 : loadscript.getZIndex(),
+					title		 : 'Expresso Messenger - ' + i18n.ADD_CONTACT,
+					closeAction  : "remove",
+					content		 : Xtools.parse( Xtools.xml('adduser'), 'addUser.xsl', infoUser )
+			};
+
+			_winBuild( winAddUser );
+			
+			
+			var _pButtons =
+			{
+				'lang1' 		: i18n.ADD,
+				'lang2'			: i18n.CLOSE,
+				'onclickClose'	: '_winBuild("' + winAddUser.id_window + '","remove");',
+				'onclickSubmit'	: 'loadscript.addContact(this);'
+			}; 
+
+			// Add Buttons
+			document.getElementById('buttons_adduser').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+			
+			// Select Editable
+			loadscript.setSelectEditable(document.getElementById('user_group_jabberIM'),35, 155);
+			
+			// Load Photo;
+			var _img = null;
+			
+			if( element.style.backgroundImage )
+				_img = element.cloneNode( false );
+							
+			if( element.parentNode.style.backgroundImage )
+				_img = element.parentNode.cloneNode( false );
+			
+			if( _img != null )
+			{
+				_img.style.width	= '60px';
+				_img.style.height	= '80px';
+				_img.style.display	= 'block';
+				_img.style.backgroundRepeat = 'no-repeat';
+				
+			}
+			else
+			{
+				_img = document.createElement("img");
+				_img.style.width	= '60px';
+				_img.style.height	= '80px';
+				_img.style.display	= 'block';
+				_img.src 			= path_jabberit + "templates/default/images/photo.png";
+			}
+			
+			
+			with ( document.getElementById('photo_user_ldap_jabber') )
+			{
+				if( hasChildNodes( ) )
+					while( hasChildNodes( ) )
+					{
+						removeNode( firstChild );
+					}
+				
+				appendChild( _img );
+			}
+		}
+		
+		function showForm()
+		{
+			
+			var _paramsWindAddUser =
+			{
+					'lang_group'		: i18n.GROUP,
+					'lang_load'			: i18n.LOAD,
+					'lang_name_contact'	: i18n.NAME_CONTACT,
+					'lang_result'		: i18n.SEARCH_RESULT,
+					'path'				: path_jabberit	
+			};
+
+			var windAddUser = 
+			{ 
+					id_window	 : "add_user_im",
+					width		 : 440,
+					height		 : 350,
+					top		 	 : 80,
+					left		 : 200,
+					draggable	 : true,
+					visible	 	 : "display",
+					resizable	 : true,
+					zindex		 : loadscript.getZIndex(),
+					title		 : 'Expresso Messenger - ' + i18n.SEARCH_USERS,
+					closeAction  : "remove",
+					content		 : Xtools.parse( Xtools.xml('userinfo'), 'addUser.xsl', _paramsWindAddUser )
+			};
+			
+			_winBuild( windAddUser );
+			
+		}
+	
+		function loadAddUser()
+		{
+			if( arguments.length > 0 )
+			{
+				Xtools	= arguments[0];
+				conn	= arguments[1];				 
+			}	
+		}
+
+		loadAddUser.prototype.add		= addContact;
+		loadAddUser.prototype.newUser	= addNewUser;
+		loadAddUser.prototype.search	= search;
+		loadAddUser.prototype.show		= showForm;
+				
+		window.addUserIM	= loadAddUser;
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/connector.js	(revision 4453)
@@ -0,0 +1,298 @@
+(function()
+{
+	var _THREADS = [];
+	var _ie;
+
+	function _config(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);
+		}
+	}
+
+	/**
+	 * xhr = XMLHttpRequest
+	 */
+	
+	function _xhr()
+	{
+		try
+		{
+			return new XMLHttpRequest();
+		}
+		catch (_e)
+		{
+			_ie = true;
+			try
+			{
+				return new ActiveXObject('Msxml2.XMLHTTP');
+			}
+			catch (_e1)
+			{
+				try
+				{
+					return new ActiveXObject('Microsoft.XMLHTTP');
+				}
+				catch (_e2)
+				{
+					return false;
+				}
+			}
+		}
+	}
+
+	function _HANDLER()
+	{
+		var _ID = arguments[0];
+
+		if  ( _THREADS[_ID] )
+		{
+			if ( _ie && _THREADS[_ID]._XHR.readyState != 4 )
+				return false;
+
+			switch ( _THREADS[_ID]._XHR.readyState )
+			{
+				case 3 :
+					if ( _THREADS[_ID]._HANDLER.stream )
+					{
+						var _data = _THREADS[_ID]._XHR.responseText.substr(_THREADS[_ID]._index).replace(/^ +| +$/g, '');
+						
+						_THREADS[_ID]._rtlen = _THREADS[_ID]._XHR.responseText.length;
+
+						if ( _THREADS[_ID]._index < _THREADS[_ID]._rtlen && _data.length )
+						{
+							try
+							{
+								_THREADS[_ID]._HANDLER.stream(_data);
+							}
+							catch(_e)
+							{
+								//alert("#stream\n\n" + _e + "\n\n" + _e.description);
+							}
+						}
+						
+						if ( _THREADS[_ID] )
+						{
+							_THREADS[_ID]._index = _THREADS[_ID]._rtlen;
+						}
+					}
+				break;
+				case 4 :
+					try
+					{
+						switch ( _THREADS[_ID]._XHR.status )
+						{
+							case 200:
+								var _data = ( _THREADS[_ID]._MODE == 'XML' ) ?
+									_THREADS[_ID]._XHR.responseXML :
+									_THREADS[_ID]._XHR.responseText;
+
+								if ( _ie && _THREADS[_ID]._HANDLER.stream )
+									_THREADS[_ID]._HANDLER.stream(_data);
+
+								var _request = ( _THREADS[_ID]._HANDLER.request ) ?
+									_THREADS[_ID]._HANDLER.request : false;
+
+								delete _THREADS[_ID];
+
+								if ( _request )
+									try
+									{
+										_request(_data);
+									}
+									catch(_e)
+									{
+										//alert("#request\n\n" + _e + "\n\n" + _e.description);
+									}
+
+							break; // [case : status 200]
+							case 404:
+								delete _THREADS[_ID];
+								alert('Page Not Found!');
+							break; // [case : status 404]
+							default:
+								delete _THREADS[_ID];
+						}
+					}
+					catch(e)
+					{
+					}
+				break;
+				default :
+			}
+		}
+	}
+
+	function _execute()
+	{
+		var _ID = arguments[0];
+		var _ACTION = 'act=' + _ID;
+		var _TARGET = this._PATH;
+		var _SEND = null;
+
+		if ( _TARGET != '' && _TARGET.lastIndexOf('/') != (_TARGET.length - 1) )
+			_TARGET += '/';
+
+		_TARGET += ( this._CONTROLLER ) ?
+			this._CONTROLLER  : 'controller.php';
+
+		if ( _THREADS[_ID]._METHOD == 'GET' )
+			_TARGET += '?' + _ACTION;
+
+		_THREADS[_ID]._XHR.open(_THREADS[_ID]._METHOD, _TARGET, true);
+
+		if ( _THREADS[_ID]._METHOD == 'POST' )
+		{
+			_THREADS[_ID]._XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+			_THREADS[_ID]._XHR.setRequestHeader('Cache-Control',  'no-store, no-cache, must-revalidate');
+			_THREADS[_ID]._XHR.setRequestHeader('Cache-Control', 'post-check=0, pre-check=0');
+			_THREADS[_ID]._XHR.setRequestHeader('Pragma', 'no-cache');
+			_SEND = _ACTION + '&' + arguments[1];
+		}
+
+		_THREADS[_ID]._XHR.onreadystatechange = function(){_HANDLER(_ID);};
+		_THREADS[_ID]._XHR.send(_SEND);
+	}
+
+	function usage()
+	{
+		return ""+
+			"Description:\n"+
+			"\t<obj>.go(string access, [mixed handler[, mixed post]])\n\n"+
+			"Parameters:\n"+
+			"\taccess : assinatura de acesso Ã  camada de controle.\n"+
+			"\thandler : uma funÃ§Ã£o a ser executada no fim da requisiÃ§Ã£o\n"+
+			"\t\tou um objeto que poderÃ¡ conter dois Ã­ndices sendo\n"+
+			"\t\tque ambos deverÃ£o ser uma funÃ§Ã£o que serÃ¡ executada\n"+
+			"\t\tconforme o status do objeto xhr, sendo que na posiÃ§Ã£o\n"+
+			"\t\t'stream' serÃ¡ a funÃ§Ã£o a ser executada a cada iteraÃ§Ã£o\n"+
+			"\t\tdo objeto xhr e na posiÃ§Ã£o 'request' serÃ¡ a funÃ§Ã£o\n"+
+			"\t\ta ser executada no fim da requisiÃ§Ã£o.\n"+
+			"\tpost : se especificado deverÃ¡ ser uma query string ou um\n"+
+			"\tXML bem formatado.\n\n";
+	}
+
+	// @PARAM arguments[0] string :
+	//		assinatura de acesso a camada de controle
+	//
+	// @PARAM arguments[1] object :
+	//		OBS : neste caso a conexão assumirá que se trata de uma stream
+	//		objeto contendo dois duas funções, sendo,
+	//		no índice stream deverá conter uma função que será executada
+	//		a cada mudança de status do objeto xhr
+	//	
+	// @PARAM arguments[1] function : função a ser executada no retorno da requisição
+	//		OBS : neste caso a conexão assumirá que se trata de uma
+	//		requisição função que será executada no final da requisição
+	//
+	// @PARAM arguments[2] string :
+	//		este parâmetro define se a conexão é via GET ou POST
+	//		caso o parâmetro não esteja presente a conexão será executada
+	//		via GET, por outro lado, caso ele exista deverá ser uma query
+	//		string válida ou um xml bem formatado
+	//
+	function go()
+	{
+		var _argv = arguments;
+		var _argc = _argv.length;
+		var _ID = _argv[0];
+		var _POST;
+		if ( _argc < 1 || _argc > 3 )
+			return {'error' : "#0\n\n" + usage()};
+
+		if ( typeof _ID != 'string' )
+			return {'error' : "#1\n\n" + usage()};
+
+		_THREADS[_ID] = {
+			'_HANDLER'	: {},
+			'_METHOD'	: ( _argv[2] ) ? 'POST' : 'GET',  // [GET | POST]
+			'_MODE'		: null,	// [XML | TEXT]
+			'_TYPE'		: null,	// [4 for request | 3 for stream]
+			'_XHR'		: null	// [4 for request | 3 for stream]
+		};
+
+		if ( _argv[2] )
+			_POST = _argv[2];
+
+		if ( _argv[1] )
+			switch ( typeof _argv[1] )
+			{
+				case 'function' :
+					_THREADS[_ID]._HANDLER = {'request' : _argv[1]};
+				break;
+				case 'object' :
+					for ( var i in _argv[1] )
+						if ( i != 'stream' && i != 'request' )
+						{
+							delete _THREADS[_ID];
+							return {'error' : "#3\n\n" + usage()};
+						}
+						else if ( i == 'stream' )
+						{
+							_THREADS[_ID]._index = 0;
+							_THREADS[_ID]._rtlen = 0;
+						}
+						_THREADS[_ID]._HANDLER = _argv[1];
+				break;
+				case 'string' :
+					if ( _argc == 2 )
+					{
+						_THREADS[_ID]._METHOD = 'POST';
+						_POST = _argv[1];
+					}
+				break;
+				default :
+					//delete _THREADS[_ID];
+					//return {'error' : "#4\n\n" + usage()};
+			}
+
+		if ( !(_THREADS[_ID]._XHR = _xhr()) )
+			return {'error' : "#4 it cannot make a xhr object"};
+
+		( _THREADS[_ID]._METHOD == 'GET' ) ?
+			_execute.call(this, _ID) : _execute.call(this, _ID, _POST);
+		return {'success' : "your thread is running and the response "+
+							"will be manipulated by the handler"};
+	}
+
+	function abort()
+	{
+		for ( var _ID in _THREADS )
+		{
+			// @TODO
+			// try/catch for unknown error of IE.
+			// Check, store and retrieve the try/catch.
+			try
+			{
+				if ( _THREADS[_ID] && _THREADS[_ID]._XHR && _THREADS[_ID]._XHR.abort )
+					_THREADS[_ID]._XHR.abort();
+
+				delete _THREADS[_ID];
+			}
+			catch(e){}
+		}
+	}
+
+	function Connector()
+	{
+		var _argv = arguments;
+		this._PATH = ( _argv.length > 0 ) ?
+			_argv[0] : '';
+		this._CONTROLLER = ( _argv.length == 2 ) ?
+			_argv[1] : false;
+	}
+
+	Connector.prototype.go		= go;
+	Connector.prototype.abort	= abort;
+	window.AjaxConnector		= Connector;
+
+	_config( window, 'onbeforeunload', abort );
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/json2.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/json2.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/json2.js	(revision 4453)
@@ -0,0 +1,29 @@
+if(!this.JSON){JSON={};}
+(function(){function f(n){return n<10?'0'+n:n;}
+if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
+f(this.getUTCMonth()+1)+'-'+
+f(this.getUTCDate())+'T'+
+f(this.getUTCHours())+':'+
+f(this.getUTCMinutes())+':'+
+f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
+var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];if(typeof c==='string'){return c;}
+return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
+function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
+if(typeof rep==='function'){value=rep.call(holder,key,value);}
+switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
+gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
+v=partial.length===0?'[]':gap?'[\n'+gap+
+partial.join(',\n'+gap)+'\n'+
+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
+if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
+v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
+if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
+rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
+return str('',{'':value});};}
+if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
+return reviver.call(holder,key,value);}
+cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
+if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
+throw new SyntaxError('JSON.parse');};}})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/show_hidden.js	(revision 4453)
@@ -0,0 +1,112 @@
+(function()
+{
+	
+	var _delay;
+	var _event_show 	= false;
+	var _event_hidden	= false;
+
+	var _last_displayed;
+	var _timeout 		= false;
+
+	function _config(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 hdObject()
+	{
+		if( _last_displayed )
+		{
+			_last_displayed.style.display = 'none';
+			_last_displayed = false;
+		}
+	}
+
+	function _hidden()
+	{
+		if( arguments.length > 0 )
+		{
+			if( arguments[0] )
+				clearTimeout( _timeout );
+			else
+			{
+				_timeout = setTimeout( hdObject, _delay);
+			}
+		}
+	}
+
+	function _show(_element)
+	{
+		if( !(_last_displayed && ( _last_displayed.id == _element.id )))
+		{
+			_element.style.display = 'block';
+			_last_displayed = _element;
+		}
+	}
+
+	function _view()
+	{
+		if ( arguments.length == 3 )
+		{
+			var _event = [
+				'onclick',
+				'onmousedown',
+				'onmouseout',
+				'onmouseover',
+				'onmouseup'
+			];
+
+			_event_show = false;
+			_event_hidden = false;
+
+			for ( var i in _event )
+			{
+				if ( _event[i] == arguments[0] )
+					_event_show = arguments[0];
+
+				if ( _event[i] == arguments[1] )
+					_event_hidden = arguments[1];
+			}
+
+			if ( _event_show && _event_hidden )
+			{
+				var _element = false;
+				
+				switch ( typeof arguments[2] )
+				{
+					case 'object' :
+						_element = arguments[2];
+					break;
+					
+					case 'string' :
+						_element = document.getElementById(arguments[2]);
+					break;
+				}
+
+				if ( _element )
+					_show(_element);
+			}
+		}
+	}
+
+	function ShowHidden()
+	{
+		_delay = ( (arguments.length > 0) && !isNaN(arguments[0]) ) ? arguments[0] : 3000;
+	}
+
+	
+	ShowHidden.prototype.action  		= _view;
+	ShowHidden.prototype.hiddenObject	= _hidden;
+    
+	window.ShowHidden					= ShowHidden;
+    
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 4453)
@@ -0,0 +1,1628 @@
+(function()
+{
+	var _autoStatus;
+	var _autoStatusTime 		= 60000; // 1 minuto
+	var addUser			= null;
+	var conn			= null;
+	var fullName			= "";
+	var path			= "";
+        var path_phpgwapi               = "";
+	var _preferencesIM		= "";
+	var selectEditable		= null;
+	var showhidden 			= null;
+	var statusUserIM		= "";
+	var _statusMessage		= "";
+	var timeoutId			= null;
+	var userCurrent			= null;
+	var _timeOutNotification	= "";
+	var Xtools			= null;
+	var zIndex			= 9001;
+	var windowPopUp			= [];
+	
+	// Images
+	var add_user = new Image();
+	add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png';
+
+	var arrow_down = new Image();
+	arrow_down.src = path_jabberit + 'templates/default/images/arrow_down.gif'; 
+
+	var arrow_right	= new Image();
+	arrow_right.src = path_jabberit + 'templates/default/images/arrow_right.gif';
+	
+	function actionButton()
+	{
+		if( arguments.length > 0 )
+		{
+			var e 			= arguments[0];
+			var _element	= ( e.target ) ? e.target : e.srcElement;
+			var jid 	= arguments[1];
+			var coord	= null;
+
+			if ( !e )
+				e = window.event;
+
+			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 };
+		
+
+			var _onContextMenu = function()
+			{
+				return false;
+			};
+			
+			window.document.oncontextmenu	= _onContextMenu;
+			
+			if( e.button )
+			{
+				if( e.button > 1 )
+					optionsItensContact( jid, coord );
+				else
+					TrophyIM.rosterClick(jid);
+			}	
+			else if( e.which )
+			{
+				if( e.which > 1 )
+					optionsItensContact( jid, coord );
+				else
+					if( e.target.id )
+						TrophyIM.rosterClick(jid);
+			}
+			
+			setTimeout(function()
+			{
+				window.document.oncontextmenu = function()
+				{
+					return true;
+				};
+				
+			},500);
+		}
+	}
+
+	function addContact()
+	{
+		if( arguments.length > 0 )
+			addUser.add();
+		else
+			addUser.show();
+	}
+	
+	function addIcon()
+	{
+		
+		var div_write_msg	= ( getElement('em_div_write_msg') != null ) ? getElement('em_div_write_msg') : null ;
+		var StatusBar		= ( getElement('divStatusBar') != null ) ? getElement('divStatusBar') : null ;
+		var StatusBarIM		= ( getElement('JabberMessenger') != null ) ?  getElement('JabberMessenger') : null;
+		
+		/**************************************************************************
+		 * 
+		 * Quando estiver habilitada a opção fora de escritório nos filtros.
+		 *  
+		 */
+
+		if( ( div_write_msg && StatusBarIM ) != null )
+		{		
+			div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg);
+			StatusBarIM.style.paddingLeft = '33px';
+			return;
+		}
+		
+		/**************************************************************************/
+		
+		if ( !StatusBarIM )
+		{
+			StatusBarIM = document.createElement('div');
+			StatusBarIM.setAttribute('id', 'JabberMessenger');
+		}
+		
+		if( StatusBar )
+		{
+			StatusBar.style.paddingLeft = '33px';
+			
+			var _div = document.createElement('div');
+				_div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling));
+			
+				StatusBar.parentNode.insertBefore( _div, StatusBar);
+			
+			var _fastMenu = top.document.createElement('div');
+				_fastMenu.setAttribute('id', 'fast_menu_jabber_expresso');
+				_fastMenu.style.background		= 'no-repeat';
+				_fastMenu.style.backgroundImage = 'url(' + arrow_down.src + ')';
+				_fastMenu.style.float			= 'left';
+				_fastMenu.style.height			= '15px';
+				_fastMenu.style.left			= '7px';
+				_fastMenu.style.margin			= '8 0 0 10px';
+				_fastMenu.style.padding			= '0px';
+				_fastMenu.style.position		= 'absolute';
+				_fastMenu.style.width			= '15px';
+				_fastMenu.style.cursor			= 'pointer';
+
+			StatusBarIM.insertBefore( _fastMenu, StatusBarIM.firstChild );
+			
+			// Add event onclick element _fastMenu
+			configEvents( _fastMenu, 'onclick', function(){ fastMenu(_fastMenu); });
+
+			var _statusJabber = top.document.createElement('div');
+				_statusJabber.setAttribute('id','status_jabber_expresso');
+				_statusJabber.style.background		= 'no-repeat';
+				_statusJabber.style.backgroundImage = 'url(' + add_user.src +')';
+				_statusJabber.style.float			= 'left';
+				_statusJabber.style.height			= '18px';
+				_statusJabber.style.left			= '19px';
+				_statusJabber.style.margin			= '0 0 0 10px';
+				_statusJabber.style.padding			= '0px';
+				_statusJabber.style.position		= 'absolute';
+				_statusJabber.style.width			= '18px';
+				_statusJabber.style.cursor			= 'pointer';
+				_statusJabber.style.zindex			= '999999';
+			
+			StatusBarIM.insertBefore( _statusJabber, StatusBarIM.firstChild );
+			
+			StatusBar.insertBefore( StatusBarIM, StatusBar.firstChild );
+
+			// Add event onclick element _statusJabber
+			if( _preferencesIM[0] == "openWindowJabberit:true" )
+			{
+				configEvents( _statusJabber, 'onclick', function(){ rosterDiv(); });
+			}
+			else
+			{
+				configEvents( _statusJabber, 'onclick', function(){ TrophyIM.load(); });
+			}
+		}
+	}
+
+	function addNewUser()
+	{
+		addUser.newUser();
+	}
+	
+	function autoStatus()
+	{
+		var _div_status = ( getElement('status_jabber_expresso') != null ) ?  getElement('status_jabber_expresso') : null;
+		
+		if ( _autoStatus )
+			clearTimeout(_autoStatus);
+
+		if ( _div_status != null )
+		{
+			var _status = _div_status.style.backgroundImage;
+				_status = _status.substr(_status.lastIndexOf('/') + 1);
+				_status = _status.substr(0, _status.indexOf('.'));
+				
+			if( _status == "xa" && _div_status.getAttribute('autoStatus') )
+			{
+				if( getStatusMessage() != "")
+					TrophyIM.setPresence("available", getStatusMessage());
+				else
+					TrophyIM.setPresence("available");
+				
+				_div_status.removeAttribute('autoStatus');
+				loadscript.setStatusJabber("Disponível","available");
+			}
+		}
+		
+		var TimeStatus = _preferencesIM[2].split(':');
+
+		if( TimeStatus[1] )
+			_autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(TimeStatus[1]) * _autoStatusTime );
+		else
+			_autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(_autoStatusTime));
+	}
+	
+	function autoStatusHandler()
+	{
+		var _div_status = ( getElement('status_jabber_expresso') != null ) ?  getElement('status_jabber_expresso') : null;
+		
+		if ( _div_status != null )
+		{
+			var _status = _div_status.style.backgroundImage;
+				_status = _status.substr(_status.lastIndexOf('/') + 1);
+				_status = _status.substr(0, _status.indexOf('.'));
+			
+			if( _status == "available" )
+			{
+				if(getStatusMessage() != "")
+					TrophyIM.setPresence("xa", getStatusMessage());
+				else
+					TrophyIM.setPresence("xa");
+
+				_div_status.setAttribute('autoStatus','true');
+				
+				loadscript.setStatusJabber("Não Disponível","xa");
+			}
+		}
+	}
+
+	function clrAllContacts()
+	{
+		getElement("JabberIMRoster").innerHTML = "";
+	}
+	
+	function configEvents(pObj, pEvent, pHandler)
+	{
+		if ( typeof pObj == 'object' )
+		{
+			if ( pEvent.substring(0, 2) == 'on' )
+				pEvent = pEvent.substring(2, pEvent.length );
+
+			if ( arguments.length == 3 )
+			{
+				if ( pObj.addEventListener )
+					pObj.addEventListener(pEvent, pHandler, false );
+				else if ( pObj.attachEvent )
+					pObj.attachEvent( 'on' + pEvent, pHandler );
+			}
+			else if ( arguments.length == 4 )
+			{
+				if ( pObj.removeEventListener )
+					pObj.removeEventListener( pEvent, pHandler, false );
+				else if ( pObj.detachEvent )
+					pObj.detachEvent( 'on' + pEvent, pHandler );
+			}
+		}
+	}
+
+	function disabledNotificationNewUsers()
+	{
+		var _notification	= getElement('notification_new_users_jabber') ;
+		var _statusJabber	= getElement('status_jabber_expresso');
+
+		_notification.style.display = 'none';
+		
+		_statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat";
+		
+		if( _timeOutNotification )
+			clearTimeout(_timeOutNotification );
+		
+		TrophyIM.controll.notificationNewUsers = 0;
+	}
+	
+	function enabledNotificationNewUsers()
+	{
+		var _notification	= getElement('notification_new_users_jabber') ;
+		var _statusJabber	= getElement('status_jabber_expresso');
+	
+		if( _notification && _statusJabber )
+		{	
+			if ( _notification.style.display == 'none' )
+			{
+				_notification.style.display = 'block';
+				
+				_statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat";
+				
+				if( _timeOutNotification )
+					clearTimeout(_timeOutNotification );
+
+				_timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 2000 );
+			}
+			else
+			{
+				_notification.style.display = 'none';
+				
+				_statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat";
+				
+				if( _timeOutNotification )
+					clearTimeout(_timeOutNotification );
+
+				_timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 800 );
+			}
+		}
+	}
+
+	function fastMenu()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = arguments[0];
+
+			if( showhidden == null )
+				showhidden = new ShowHidden(300);
+
+			var _options =	[
+			              	 	['Adicionar Contato', 'loadscript.addContact();' ],
+			              	 	['Preferências', 'loadscript.preferences();']
+		                	];
+
+			if( im_chatroom == "false" )	
+			{	
+				_options[2] = [ 'Sala(s) de Bate-Papo','loadscript.getListRooms();'];
+			}
+
+			var _itens = "";
+			
+			for( var i in _options )
+			{
+				if( _options[i].constructor == Function )
+					continue;
+				
+				_itens += '<img src="'+arrow_right.src+'"/>';
+				_itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>';
+				_itens += _options[i][0] + '</span><br/>';
+			}
+			
+			var _optionsItens = document.createElement("div");
+				_optionsItens.id	= "fastMenu_Jabber";				
+				_optionsItens.style.marginTop	= "19px";
+				_optionsItens.style.marginLeft	= "-8px";
+				_optionsItens.className		= "x-menu";
+				_optionsItens.style.zIndex	= '999999';
+				_optionsItens.innerHTML		= _itens;
+				_optionsItens.onclick		= function(){ showhidden.hiddenObject(false); };
+				_optionsItens.onmouseout	= function(){ showhidden.hiddenObject(false); };
+				_optionsItens.onmouseover	= function(){ showhidden.hiddenObject(true); };	
+										  
+				showhidden.action('onmouseover', 'onmouseout', _optionsItens);
+				
+			element.parentNode.appendChild( _optionsItens );
+		}
+	}
+	
+	function getElement( elementId )
+	{
+		return document.getElementById( elementId );
+	}
+	
+	function getIsIE()
+	{
+		return SnifferBrowser.isCompatible('is_ie');
+	}
+	
+	function getPhotoUser( jid )
+	{
+		try
+		{
+			var _divPhoto = getElement( jid + '__photo' );
+	
+			if( _divPhoto.style.backgroundImage.indexOf('photo.png') > 0 )
+			{
+				var _imgUser  = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date );
+					_imgUser += '&photo_ldap=' + jid;
+	
+				_divPhoto.style.backgroundImage = 'url(' + _imgUser + ')';
+			}
+		}catch(e){}
+	}
+	
+	function getShowContactsOffline()
+	{
+		if( _preferencesIM[3] )
+		{
+			var showOffline = _preferencesIM[3].split(":");
+			
+			if( showOffline[1] === "true")
+				return true;
+			else
+				return false;
+		}
+		
+		return true;
+	}
+	
+	function getSmiles( String )
+	{
+		String = String.replace( /:\)|:-\)/g	, " <img src='"+path_jabberit+"templates/default/images/smiles/1.gif'/> ");
+		String = String.replace( /:-D/g			, " <img src='"+path_jabberit+"templates/default/images/smiles/2.gif'/> ");
+		String = String.replace( /;-\)/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/3.gif'/> ");
+		String = String.replace( /=-O/g			, " <img src='"+path_jabberit+"templates/default/images/smiles/4.gif'/> ");
+		String = String.replace( /:P/g			, " <img src='"+path_jabberit+"templates/default/images/smiles/5.gif'/> ");
+		String = String.replace( /8-\)/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/6.gif'/> ");
+		String = String.replace( /\>:o/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/7.gif'/> ");
+		String = String.replace( /:-\$/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/8.gif'/> ");
+		String = String.replace( /:s|:-X/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/9.gif'/> ");
+		String = String.replace( /:-\(/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/10.gif'/> ");
+		String = String.replace( /:\'\(/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/11.gif'/> ");
+		String = String.replace( /:\|/g			, " <img src='"+path_jabberit+"templates/default/images/smiles/12.gif'/> ");
+		String = String.replace( /O:-\)/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/13.gif'/> ");
+		String = String.replace( /\*\*@#%/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/14.gif'/> ");
+		String = String.replace( /\(I\)/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/15.gif'/> ");
+		String = String.replace( /C28I/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/16.gif'/> ");
+		String = String.replace( /CS2A/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/17.gif' style='width:42px;height:36px;'/> ");
+                String = String.replace( /\(CzzzzI\)/g		, " <img src='"+path_jabberit+"templates/default/images/smiles/18.gif'/> ");                
+ 
+		return String;
+	}
+	
+	function getStatusUserIM()
+	{
+		return statusUserIM;
+	}
+	
+	function getStatusMessage()
+	{
+		return _statusMessage;
+	}
+	
+	function getUserCurrent()
+	{
+		return userCurrent;
+	}
+	
+	function getZindex()
+	{
+		return zIndex++;
+	}
+	
+	function groupsHidden()
+	{
+		if( arguments.length > 0 )
+		{
+			var _element = arguments[0];
+				_element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left";
+				_element.onclick = function(){ groupsVisible(_element);};
+				
+				// Hidden all
+				var _elementNext = _element.nextSibling;
+				
+				while( _elementNext )
+				{	
+					if( _elementNext.nodeType == 1 )
+						_elementNext.style.display = "none";
+					
+					_elementNext = _elementNext.nextSibling;
+				}
+		}
+	}
+	
+	function groupsVisible()
+	{
+		if( arguments.length > 0 )
+		{
+			var _element = arguments[0];
+				_element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left";
+				_element.onclick = function(){ groupsHidden(_element);};
+
+				// Display all
+				var _elementNext = _element.nextSibling;
+				
+				while( _elementNext )
+				{	
+					if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div" )
+					{
+						var is_off = _elementNext.style.backgroundImage.indexOf("unavailable");	
+
+						if( is_off > 0 && !getShowContactsOffline())
+						{
+							_elementNext.style.display = "none";
+							getElement("span_show_" + _elementNext.id ).style.display = "none";
+							
+						}
+						else
+						{
+							_elementNext.style.display = "block";
+							getElement("span_show_" + _elementNext.id ).style.display = "block";
+						}
+					}
+
+					_elementNext = _elementNext.nextSibling;
+				}
+		}
+	}
+	
+	function keyPressSearch()
+	{
+		if( arguments.length > 0 )
+		{
+			var ev 		= arguments[0];
+			var element	= arguments[1];
+	
+			if ( ev.keyCode == 13 )
+				if( element.value.length >= 3 )
+					searchUser( element.value );	
+				else
+					alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' );
+		}
+	}
+
+	
+	function loginPage()
+	{
+		var paramsLoginPage = 
+		{
+			'username' : ((( Base64.decode(getUserCurrent().jid) )) ? Base64.decode(getUserCurrent().jid) : ""),
+			'password' : ((( Base64.decode(getUserCurrent().password) )) ? Base64.decode(getUserCurrent().password) : "") 
+		}
+		
+		var winLoginPage =
+		{	
+			 id_window		: "window_login_page",
+			 width			: 260,
+			 height			: 120,
+			 top			: 100,
+			 left			: 400,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: zIndex++,
+			 title			: "Expresso Messenger - Login",
+			 closeAction	: "remove",
+			 content		: Xtools.parse(Xtools.xml("login_page"), "loginPage.xsl", paramsLoginPage)	
+		};
+
+		_winBuild( winLoginPage );
+	}
+
+	function loadScripts(pFiles)
+	{
+		// Load JavaScript
+		var loadJavaScript = function(pJs)
+		{
+			var newScript = document.createElement("script");
+				newScript.setAttribute("type", "text/javascript");
+				newScript.setAttribute("src", pJs );
+				
+			return newScript;
+		};
+		
+		// Load CSS
+		var loadStyleSheet = function(pCss)
+		{
+			var newStyle = document.createElement("link");
+				newStyle.setAttribute("rel", "stylesheet");
+				newStyle.setAttribute("type", "text/css");
+				newStyle.setAttribute("href", pCss);
+				
+			return newStyle;
+		};
+		
+		for(var i = 0; i < pFiles.length; i++)
+		{
+			if( pFiles[i].indexOf(".js") > -1 )
+				document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i]));
+				
+			if( pFiles[i].indexOf(".css") > -1 )
+				document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i]));
+		}
+	}
+	
+	function notificationNewMessage()
+	{
+		var _doc		= document;
+		var _id			= arguments[0];
+		var _win_name	= _id.replace( /\W/g, '' ); 
+		
+		if ( windowPOPUP( _id ) )
+		{
+			_doc = windowPopUp[_win_name].document;
+		}
+		
+		var oldTitle 	= _doc.title; 
+		var newTitle 	= "## NOVA MENSAGEM ##"; 
+
+		if( timeoutId == null )
+		{
+			timeoutId = setInterval(function()
+			{
+				_doc.title = ( _doc.title == newTitle ) ? oldTitle : newTitle;
+			}, 1000);
+			
+			configEvents( _doc, 'onclick', function()
+			{ 
+				clearInterval(timeoutId);
+				_doc.title	= oldTitle;
+				timeoutId		= null;
+			});
+			
+			configEvents( _doc, 'onkeypress', function()
+			{ 
+				clearInterval(timeoutId);
+				_doc.title	= oldTitle;
+				timeoutId		= null;
+			});
+		}
+	}
+
+	function optionsItensContact()
+	{
+		if( arguments.length > 0 )
+		{
+			var jid 	= arguments[0];
+			var coord	= arguments[1];
+			var element = getElement('itenContact_' + jid );
+			var action	= ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar"; 	
+			
+			if( showhidden == null )
+				showhidden = new ShowHidden(300);
+
+			var _options = [
+			                	[ action , 'loadscript.setAutorization(\''+jid+'\')'],
+			                	['Remover' , 'loadscript.removeContact(\''+jid+'\')'],
+			                	['Renomear' , 'loadscript.renameContact(\''+jid+'\')'],
+			                	['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\')']
+						   ];
+
+			var _itens = "";
+			
+			for( var i in _options )
+			{
+				if( typeof(_options[i]) == "object")
+				{
+					_itens += '<img src="'+arrow_right.src+'"/>';
+					_itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>';
+					_itens += _options[i][0] + '</span><br/>';
+				}
+			}
+			
+			var _optionsItens = document.createElement("div");
+				_optionsItens.className		= "x-menu";
+				_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); };
+				
+				showhidden.action('onmouseover', 'onmouseout', _optionsItens);
+				
+			window.document.body.appendChild(_optionsItens);
+		}
+	}
+
+	function parse()
+	{
+		if( arguments.length == 2 )
+			return Xtools.parse(Xtools.xml(arguments[0]), arguments[1] );
+		
+		if( arguments.length === 3 )
+			return Xtools.parse(Xtools.xml(arguments[0]), arguments[1], arguments[2] );
+	}
+	
+	function preferences()
+	{
+		var paramPreferences =
+		{
+			'path'  : path,
+			'lang1' : 'Suas Preferências',
+			'lang2' : 'Conexão',	
+			'lang3' : 'Conectar Automaticamente o IM',
+			'lang4' : 'Usuários OffLine',
+			'lang5' : 'Exibir amigos Offline',
+			'lang6' : 'Salvar',
+			'lang7' : 'Cancelar',
+			'lang8' : 'Janela de Contatos',
+			'lang9' : 'Abrir janela como Pop-up',
+			'lang10' : 'Ausente',
+			'lang11' : 'Definir status de ausente depois de',
+			'lang12' : 'minutos',	
+			'lang13' : 'Mostrar Contatos',	
+			'lang14' : 'Mostrar contatos desconectados',
+			'langYes': 'Sim',
+			'langNo' : 'Não'											   
+	  	};
+		
+		
+		var _win_preferences =
+		{ 
+				id_window	 : "jabberit_preferences",
+				width		 : 430,
+				height		 : 350,
+				top		 	 : 150,
+				left		 : 100,
+				draggable	 : true,
+				visible	 	 : "display",
+				resizable	 : true,
+				zindex		 : zIndex++,
+				title		 : 'Expresso Messenger - Preferências',
+				closeAction  : "remove",
+				content		 : Xtools.parse(Xtools.xml('preferences'), 'preferences.xsl', paramPreferences)
+		};
+
+		_winBuild(_win_preferences);
+		
+		
+		var _pButtons = {
+				'lang1' : 'Salvar',
+				'lang2' : 'Fechar',
+				'onclickClose' : '_winBuild("jabberit_preferences","remove");',
+				'onclickSubmit' : 'javascript:loadscript.setPreferences();'
+		}; 
+		
+		document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+		
+		// Element openWindowJabberit
+		var value1			= _preferencesIM[0].split(':');
+		var element1		= document.getElementById(value1[0]);
+		var valueSelect1	= value1[1];
+		
+		for(var i = 0; i < element1.options.length; i++)
+			if( element1.options[i].value == valueSelect1 )
+				element1.options[i].selected = true;
+
+		// Element openWindowJabberitPopUp
+		var value2			= _preferencesIM[1].split(':');
+			
+		// Element flagAwayIM
+		var value3		= _preferencesIM[2].split(':');
+		var element3	= document.getElementById(value3[0]);
+		element3.value	= value3[1];
+		
+		// Element showContactsOfflineJabberit
+		var value4			= _preferencesIM[3].split(':');
+		var element4		= document.getElementById(value4[0]);
+		var valueSelect4	= value4[1];
+		for(var i = 0; i < element4.options.length; i++)
+			if( element4.options[i].value == valueSelect4 )
+				element4.options[i].selected = true;
+	}
+	
+	function removeContact( jid )
+	{
+		TrophyIM.removeContact( jid );
+	}
+	
+	function removeElement( )
+	{
+		if( arguments.length > 0 )
+		{
+			var _element = arguments[0] 
+			
+			if( _element != null )
+			{
+				_element.parentNode.removeChild( _element );
+			}
+		}
+	}
+	
+	function removeGroup()
+	{
+		var _parent = arguments[0];
+		
+		if( _parent.childNodes.length <= 2 )
+			_parent.parentNode.removeChild(_parent);
+	}
+	
+	function renameContact()
+	{
+		if( arguments.length > 0 )
+		{
+			var _jid	= arguments[0];
+			
+			TrophyIM.renameContact( _jid );
+		}
+	}
+	
+	function renameGroup()
+	{
+		if( arguments.length > 0 )
+		{
+			var _jid 	= arguments[0];
+			
+			TrophyIM.renameGroup( _jid );
+		}
+	}
+	
+	function rosterDiv()
+	{
+		var _rosterDiv = function()
+		{
+
+			var winRosterDiv = 
+			{
+				 id_window		: "window_Roster_im",
+				 width			: 250,
+				 height			: 410,
+				 top			: 50,
+				 left			: -1500,
+				 leftOld		: 50,
+				 draggable		: true,
+				 visible		: "display",
+				 resizable		: true,
+				 zindex			: zIndex++,
+				 title			: "Expresso Messenger - Contatos",
+				 closeAction	: "hidden",
+				 content		: ""	
+			};
+
+			if( _preferencesIM[0] == "openWindowJabberit:false" )
+			{
+				winRosterDiv.left		= 50;
+				winRosterDiv.leftOld	= -1500;
+			}
+			
+			if( SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3') )
+			{	
+				var _idUser	= Base64.decode(getUserCurrent().jid);
+				
+				var paramListContact = 
+				{
+					'idUser'	: _idUser,
+					'full_name'	: (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")),
+					'path_jabberit' : path_jabberit,
+					'help_expresso'	: help_expresso,
+					'zIndex_'		: zIndex++
+				};
+		
+				winRosterDiv.content = Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact)	
+				
+			}
+			else
+			{
+				var paramList = 
+				{
+					'path' : path_phpgwapi
+				};
+				
+				winRosterDiv.width		= 280;
+				winRosterDiv.height		= 430;
+				winRosterDiv.content	= Xtools.parse( Xtools.xml("navigator"), path_phpgwapi + "templates/default/xsl/navigatorCompatible.xsl" , paramList);
+			}
+			
+			_winBuild( winRosterDiv );				
+
+			// Photo User
+			getPhotoUser(_idUser);
+		}
+		
+		setTimeout( function(){ _rosterDiv(); }, 200 );
+	}
+
+	function searchUser()
+	{
+		var _input	= getElement('search_user_jabber');
+		
+		if( _input.value.length >= 3 )
+			addUser.search();
+		else
+			alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' );
+	}
+	
+	function setAutorization()
+	{
+		var divItenContact = null;
+		
+		if( arguments.length > 0 )
+		{
+			var jidTo = arguments[0];
+		
+			if( getElement('itenContact_' + jidTo) )
+				divItenContact = getElement('itenContact_' + jidTo );
+		}
+		
+    	if( divItenContact )
+    	{	
+    		var subscription = divItenContact.getAttribute('subscription');
+
+    		switch(subscription)
+    		{
+				case 'from':
+					
+					TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribe');
+    				break;
+
+				case 'subscribe' :
+					
+					TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribed');
+    				break;
+    				
+				case 'none' :					
+    				
+    				TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribe');
+    				break;
+    				
+    			case 'to' :    				
+    				
+    				TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribed');    				
+    				removeElement( getElement('itenContactNotification_' + jidTo ) );    				
+    				break;
+
+    			case 'not-in-roster':
+	   				
+    				TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed');
+    				addUser.add( jidTo );
+					break;
+    		}
+    	}
+	}
+	
+	function setMessageStatus()
+	{
+		if( arguments.length > 0 )
+		{
+			var _element = arguments[0];
+			var _parent	 = _element.parentNode;			
+
+			if( _element.nodeName.toLowerCase() == "label")
+			{
+				var _input				= document.createElement("input"); 
+					_input.size			= "35";
+					_input.maxlength	= "35";
+					_input.style.border = "0";
+					_input.value	 	= _element.innerHTML;
+					
+				// OnkeyUp
+				configEvents( _input, "onkeyup", function(e)
+						{
+							if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element);
+						}
+				);
+				
+				// Onblur	
+			    configEvents(_input, "onblur", function(){ loadscript.setMessageStatus(_input, _element)});		
+
+			    
+				if( _parent != null )
+				{	
+					// Remove label
+					if( _element != null )
+						_parent.removeChild( _element );
+						
+					// Add Input
+					if( _input != null ) 
+						_parent.appendChild( _input );
+				}
+
+				_input.focus();
+				_input.select();
+			}
+			else
+			{
+				var _label		= arguments[1];
+				_statusMessage	= _element.value.replace(/^\(+|\)+$/g,"");
+				
+				if( ( _statusMessage = _statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "")
+					_label.innerHTML = "( " + _statusMessage + " )";
+				else
+					_label.innerHTML = "( " + i18n.TYPE_YOUR_MESSAGE_HERE_STATUS + " )";
+				
+				if( _parent != null )
+				{	
+					// Remove Input
+					if( _element != null )
+						_parent.removeChild( _element );
+						
+					// Add Label
+					if( _label != null ) 
+						_parent.appendChild( _label );
+				}
+				
+				// Send Status Message
+				_statusMessage = ( ( _statusMessage !=  i18n.TYPE_YOUR_MESSAGE_HERE_STATUS ) ? _statusMessage : "" );				
+				
+				TrophyIM.setPresence("status", _statusMessage );
+			}	
+		}
+	}
+	
+	function setPreferences()
+	{
+		// Element openWindowJabberit
+		var elementOpenW	= document.getElementById('openWindowJabberit');
+		var value			= '';
+		
+		for(var i = 0 ; i < elementOpenW.options.length; i++)
+			if( elementOpenW.options[i].selected == true)
+			{
+				value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value;
+				_preferencesIM[0] = 'openWindowJabberit:' + elementOpenW.options[i].value;
+			}
+
+		// Element openWindowJabberitPopUp
+		value += '&preferences2=openWindowJabberitPopUp:false';
+		_preferencesIM[1] = 'openWindowJabberitPopUp:false';
+		
+		// Element flagAwayIM
+		var elementFlagIM = document.getElementById('flagAwayIM');
+		
+		if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 )
+		{
+			_preferencesIM[2] = 'flagAwayIM:' + elementFlagIM.value;
+			value += '&preferences3=flagAwayIM:' + elementFlagIM.value;
+		}
+		else
+		{
+			alert('Informe um valor igual ou maior que 1!');
+			return false;
+		}
+
+		// Element showContactsOfflineJabberit
+		var elementShowOffline	= document.getElementById('showContactsOfflineJabberit');
+		
+		for(var i = 0 ; i < elementShowOffline.options.length; i++)
+			if( elementShowOffline.options[i].selected == true)
+			{
+				_preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value;
+				value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value;
+			}
+		
+		// Save Preferences
+		conn.go('p.pf.setPreferences',
+				 function(data)
+				 {
+					if( data == 'false' )
+					{
+						alert('Erro salvando suas preferências!');
+					}
+
+					_winBuild('jabberit_preferences', 'remove');
+				 },
+				 value);
+	}
+	
+	function setPresence()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = arguments[0];
+			
+			if( showhidden == null )
+				showhidden = new ShowHidden(300);
+			
+			var _status = [
+				               ['Afastado', 'away', '<img src="'+path_jabberit+'templates/default/images/away.gif" />'],
+				               ['Disponível', 'available', '<img src="'+path_jabberit+'templates/default/images/available.gif" />'],
+				               ['Livre p/ Conversa', 'chat', '<img src="'+path_jabberit+'templates/default/images/chat.gif" />'],
+				               ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'],
+				               ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'],
+				               ['Desconectado', 'unavailable', '<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'],
+				               ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'],				                
+				          ];
+			
+			var _itens = "";
+			
+			for( var i in _status )
+			{
+				if( typeof( _status[i]) == "object" )
+				{
+					_itens += '<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">';
+					_itens += _status[i][2]+ "<span style='margin:3px;'>" + _status[i][0] + "</span></span><br/>";
+				}
+			}
+			
+			var _statusItens = document.createElement("div");
+				_statusItens.style.marginTop	= "65px";
+				_statusItens.style.marginLeft	= "67px";
+				_statusItens.className		 	= "x-menu";
+				_statusItens.style.zIndex	 	= '99999';
+				_statusItens.innerHTML		 	= _itens;  
+				_statusItens.onclick 		 	= function(){ showhidden.hiddenObject(false); };
+										  
+				showhidden.action('onmouseover', 'onmouseout', _statusItens);
+				
+			element.parentNode.onmouseout	= function(){ showhidden.hiddenObject(false); };
+			element.parentNode.onmouseover	= function(){ showhidden.hiddenObject(true); };
+			element.parentNode.appendChild(_statusItens);
+		}
+	}
+
+	function setSelectEditable(element, top, left )
+	{
+		if( getElement('selectBox0') == null )
+			selectEditable.create(element, top, left );
+	}
+
+	function setStatusJabber()
+	{
+		if( arguments.length > 0 )
+		{
+			if( arguments[1] != 'status' )
+			{
+				var _text	= arguments[0];
+				var _img	= statusUserIM = arguments[1];
+				
+				getElement('statusJabberText').innerHTML		= _text;
+				getElement('statusJabberImg').style.background	= "url('"+path_jabberit+"templates/default/images/"+_img+".gif')";
+				getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat";
+			}
+		}	
+	}
+
+	function _setUserCurrent( _user )
+	{
+		userCurrent = 
+		{
+			'jid'		: _user.jid.substring(11, _user.jid.length),
+			'password'	: _user.password.substring(11, _user.password.length)
+		}		
+	}
+	
+	function setUserCurrent()
+	{
+		if( getUserCurrent() == null )
+		{
+			conn.go('p.ff.data_0',
+						function(_User)
+						{
+							conn.go('p.ff.data_1',
+									function(_pass)
+									{
+										_setUserCurrent( { jid : _User, password : _pass } );
+									});
+						});
+		}
+	}
+
+	var _stylesheets = [ ];
+	var _links = document.getElementsByTagName( 'link' );
+	
+	for ( var i = 0; i < _links.length; i++ )
+		if ( _links.item( i ).type && _links.item( i ).type.toLowerCase( ) == 'text/css' )
+			_stylesheets[ _stylesheets.length ] = _links.item( i );  
+	
+	function windowPOPUP()
+	{
+		var _id = arguments[0];
+		var _win_name = _id.replace( /\W/g, '' ); 
+
+		if ( arguments.length == 1 )
+		{
+			if ( windowPopUp[_win_name] )
+				return true;
+			else
+				return false;
+		}
+		
+		if( arguments.length == 2 )
+		{	
+			if( !windowPopUp[_win_name] )
+			{
+				windowPopUp[_win_name] = window.open( '', _win_name + '__popup', 'height=355,width=380,top=50,left=50,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,titlebar=no');
+				var tmp = windowPopUp[_win_name].document;
+				
+				tmp.write('<html><head>');
+				tmp.write('</head><body>');
+				tmp.write('</body></html>');
+				tmp.close();
+				
+				for ( var i = 0; i < _stylesheets.length; i++ )
+					tmp.documentElement.getElementsByTagName( 'head' ).item(0).appendChild( _stylesheets[ i ].cloneNode( true ) );
+
+				var divPOP = getElement( _id + "__popUp" );
+					divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat";
+					divPOP.innerHTML = "PopIn";
+					
+				function _close( )
+				{
+					windowPopUp[_win_name].close();
+					configEvents( divPOP ,'onclick', _close, true );
+				}
+					
+				configEvents( divPOP ,'onclick', _close );
+
+				var _content = tmp.documentElement.getElementsByTagName( 'body' ).item(0).appendChild( getElement(_id + '__chatBox' ).parentNode );
+
+				_content.firstChild.scrollTop = _content.firstChild.scrollHeight;
+
+				configEvents( windowPopUp[_win_name] ,'onbeforeunload', function()
+				{
+					delete windowPopUp[_win_name];
+					divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat";
+					divPOP.innerHTML = "PopUp";
+					divPOP.onclick	= function(){ loadscript.windowPOPUP( _id , true ); };
+					_winBuild( 'window_chat_area_' + _id, "display" ).content( true );
+				});
+
+				_winBuild( 'window_chat_area_' + _id, 'hidden' );
+			}
+		}
+	}
+	
+	function windowNotificationNewUsers()
+	{
+		var _users = Xtools.xml('notification_new_users');
+		
+		for( var user in TrophyIM.rosterObj.roster )
+		{
+			if ( TrophyIM.rosterObj.roster[ user ].constructor == Function )
+				continue;
+
+			if( TrophyIM.rosterObj.roster[ user ].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) )
+			{
+				var _subscription = TrophyIM.rosterObj.roster[user].contact.subscription;
+				
+				if ( _subscription == 'to' || _subscription == 'not-in-roster' )
+				{
+					var _user	= _users.createElement('user');
+					var _jid 	= _users.createElement('jid');
+					var _status	= _users.createElement('status');
+					_jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) );
+					_status.appendChild( _users.createTextNode( _subscription ) );
+					_user.appendChild( _jid );
+					_user.appendChild( _status );
+					_users.documentElement.appendChild( _user );
+				}
+			}
+		}
+		
+		var paramsNotification = 
+		{
+			'lang_1' : "Notificação",	
+			'lang_2' : "O(s) usuário(s) abaixo pedem sua autorização.",
+			'lang_3' : "Autorizar",
+			'lang_4' : "Remover"
+		};
+		
+		var winNotification =
+		{	
+			 id_window		: "window_notification_new_users",
+			 width			: 400,
+			 height			: 300,
+			 top			: 100,
+			 left			: 400,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: zIndex++,
+			 title			: "Expresso Messenger - Notificação de Novos Usuários",
+			 closeAction	: "remove",
+			 content		: Xtools.parse( _users , "notificationNewUsers.xsl", paramsNotification )	
+		};
+
+		_winBuild( winNotification );
+	}
+
+	function createChatRooms()
+	{
+		_winBuild("window_List_Rooms_jabberit_messenger","remove");
+		
+		var paramCreateChatRoom = 
+		{
+			'lang_nameChatRoom'	: "Nome da Sala",
+			'lang_nickName'		: "Apelido"
+		};
+		
+		var winCreateChatRooms =
+		{	
+			 id_window		: "window_create_chat_rooms",
+			 width			: 360,
+			 height			: 160,
+			 top			: 100,
+			 left			: 410,
+			 draggable		: true,
+			 visible		: "display",
+			 resizable		: true,
+			 zindex			: loadscript.getZIndex(),
+			 title			: "Expresso Messenger - Criar Sala de Bate Papo",
+			 closeAction	: "remove",
+			 content		: Xtools.parse( Xtools.xml("create_chat_room"), "createChatRoom.xsl", paramCreateChatRoom )
+		};
+		
+		_winBuild( winCreateChatRooms );
+
+		var _pButtons =
+		{
+			'lang1' 		: 'Ingressar',
+			'lang2'			: 'Fechar',
+			'onclickClose'	: '_winBuild("window_create_chat_rooms","remove");',
+			'onclickSubmit'	: 'TrophyIM.createChatRooms(); _winBuild("window_create_chat_rooms","remove");'
+		}; 
+
+		// Add Buttons
+		document.getElementById('buttons_createChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+		
+	}
+	
+	function listRooms( element )
+	{
+		element = element.getElementsByTagName( 'item' );
+
+		var _roomsCount	= 0;
+		var _xml		= Xtools.xml('listRooms');
+		var _listRooms	= _xml.documentElement; 
+		
+		var show = function( )
+		{
+			if ( _roomsCount != element.length )
+				return false;
+			
+			var paramsListRooms = 
+			{
+				"path_jabberit" : path_jabberit	
+			};
+			
+			var winListRooms =
+    		{	
+				 id_window		: "window_List_Rooms_jabberit_messenger",
+    			 width			: 450,
+    			 height			: 300,
+    			 top			: 100,
+    			 left			: 400,
+    			 draggable		: true,
+    			 visible		: "display",
+    			 resizable		: true,
+    			 zindex			: loadscript.getZIndex(),
+    			 title			: "Expresso Messenger - Salas de Bate Papo",
+    			 closeAction	: "remove",
+    			 content		: Xtools.parse( _xml, "listRooms.xsl", paramsListRooms )
+    		};
+			
+			_winBuild( winListRooms );
+			
+			var _pButtons =
+			{
+				'lang1' 		: 'Criar Nova Sala',
+				'lang2'			: 'Fechar',
+				'onclickClose'	: '_winBuild("window_List_Rooms_jabberit_messenger","remove");',
+				'onclickSubmit'	: 'loadscript.createChatRooms();'
+			}; 
+
+			// Add Buttons
+			document.getElementById('buttons_addChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+		};
+
+		var _add_room = function( _room )
+    	{
+			_roomsCount++;
+
+			var _ROOM 		= _xml.createElement('room'); 
+			var _JIDROOM	= _xml.createElement('jidRoom');
+			var nameRoom	= _room.getAttribute( 'from' );
+
+			_ROOM.setAttribute( 'nameRoom', unescape((nameRoom.substring(0, nameRoom.indexOf("@"))).toUpperCase()) );
+			_JIDROOM.appendChild( _xml.createTextNode(nameRoom) );
+			_ROOM.appendChild( _JIDROOM );
+
+			// Get fields elements;
+			var _fields = _room.getElementsByTagName( 'field' );
+
+			for ( var f = 0; f < _fields.length; f++ )
+			{
+				if ( _fields[ f ].getAttribute( 'var' ) )
+				{
+					if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_description' )
+					{
+						var _description	= _xml.createElement("description");
+							_description.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue ) );
+							_ROOM.appendChild( _description );
+					}
+
+					if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_occupants' )
+					{
+						var _occupants = _xml.createElement("occupants")
+							_occupants.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue) );
+							_ROOM.appendChild( _occupants );
+					}
+				}
+			}
+
+			// Get feature elements;
+			var _feature = _room.getElementsByTagName( 'feature' );
+			
+			for( var f = 0 ; f < _feature.length; f++ )
+			{
+				if ( _feature[ f ].getAttribute( 'var' ) )
+				{
+					if( _feature[ f ].getAttribute( 'var' ) == 'muc_unsecured' )
+					{
+						var _password = _xml.createElement("password");
+							_password.appendChild( _xml.createTextNode("false") );
+							_ROOM.appendChild( _password );
+					}
+					else if( _feature[ f ].getAttribute( 'var' ) == 'muc_passwordprotected' )
+					{
+						var _password = _xml.createElement("password");
+							_password.appendChild( _xml.createTextNode("true") );
+							_ROOM.appendChild( _password );
+					}	
+				}
+			}
+			
+			_listRooms.appendChild( _ROOM );
+			
+			show( );
+    	};
+		
+		var _get_room_info = function( _room )
+		{
+    		TrophyIM.connection.sendIQ(
+    				$iq( { "to" : _room, "type" : "get" } ).c( "query",{xmlns: Strophe.NS.DISCO_INFO } ),
+    				_add_room,
+		        	function( a )
+		        	{
+		        		_roomsCount++;
+		        	
+		        		show( );
+		        		
+		        	}, 500 );
+		};
+
+		if( element.length > 0 )
+		{
+			for ( var i = 0; i < element.length; i++ )
+			{
+				_get_room_info( element[ i ].getAttribute( 'jid' ) );
+			}
+		}
+		else
+		{
+			show();
+		}
+	}
+	
+	function getListRooms()
+	{
+		TrophyIM.getListRooms();	
+	}
+	
+	function joinRoom( jidRoom, nameRoom )
+	{
+		var append_nick = function( room, nick )
+	    {
+	        var room_nick = room;
+	        
+	        if ( nick ) 
+	        {
+	            room_nick += "/" + nick; 
+	        }
+	        
+	        return room_nick;
+	    }
+		
+	    if( document.getElementById( 'window_chat_room_' + jidRoom + '__main' ) != null )
+	    {
+	    	_winBuild('window_chat_room_' + jidRoom, 'display');
+	    }
+	    else
+	    {
+		    var nickName = Base64.decode( loadscript.getUserCurrent().jid );
+		    	nickName = nickName.substring(0, nickName.indexOf('@'));
+		    
+		    var _prompt = prompt("Deseja informar um Apelido ?", nickName );
+		    
+		    if( _prompt )
+		    { 	
+			   	_prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");
+			    
+			    var room_nick 	= append_nick( jidRoom, nickName );
+			    
+			    var nickChat	= nickName.toString();
+			    	
+			    if( _prompt && _prompt != "" )
+			    {
+			    	nickChat		= _prompt.toString();
+			    	var room_nick	= append_nick( jidRoom, _prompt );
+			    }
+			    
+			    TrophyIM.makeChatRoom( jidRoom , nameRoom );
+
+			    TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = room_nick; 
+			    
+			    TrophyIM.joinChatRoom( room_nick);
+			 
+			    setTimeout(function()
+			    {
+			    	var _message	=  nickName.toUpperCase() + " entrou como : "  + nickChat;
+				   
+				    TrophyIM.sendMessageChatRoom( jidRoom , _message );
+				    
+			    }, 500);
+			    
+		    }
+	    }
+	    
+	    _winBuild("window_List_Rooms_jabberit_messenger","remove");
+	}
+	
+	function loadIM()
+	{
+		if( arguments.length > 0 )
+		{
+			var files = [
+			            	 	path_jabberit + 'templates/default/css/button.css',
+			            	 	path_jabberit + 'templates/default/css/common.css',
+			            	 	path_jabberit + 'templates/default/css/selectEditableStyle.css',
+			            	 	path_jabberit + 'templates/default/css/' + theme_jabberit
+			            ];
+			// FullName
+			fullName = arguments[0];
+			
+			// Preferences
+			_preferencesIM = arguments[1].split(";");
+                        
+                        //Path Phpgwapi
+                        path_phpgwapi = arguments[2];
+                        
+			if( !_preferencesIM[3] ) _preferencesIM[3] = "showContactsOfflineJabberit:true";
+			
+			loadScripts(files);
+			
+			setTimeout(function()
+			{
+				// Object Xtools	
+				if( Xtools == null )
+					Xtools = new xtools(path_jabberit);
+				
+				// Object Conector
+				if( conn == null )
+					conn = new AjaxConnector(path_jabberit);
+				
+				// Object Add User
+				if( addUser == null )
+					addUser = new addUserIM(Xtools, conn);
+
+				
+				// Object SelectEditable
+				if( selectEditable == null )
+					selectEditable = new SelectEditable();
+					
+				// Add Jabber in StatusBar;
+				addIcon();
+				
+				// Auto Connect
+				setTimeout(function()
+				{
+					if( _preferencesIM[0] === 'openWindowJabberit:true' )
+					{
+						if( SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3') )
+							TrophyIM.load();
+					}
+					
+				},1500);
+				
+				// Auto Status
+				autoStatus();
+				configEvents( document, 'onmousemove', autoStatus );
+				configEvents( document, 'onkeypress', autoStatus );
+				
+			}, 2000);
+		}
+	}
+
+	loadIM.prototype.adIcon			= addIcon;
+	loadIM.prototype.actionButton		= actionButton;
+	loadIM.prototype.addContact		= addContact;
+	loadIM.prototype.addNewUser		= addNewUser;
+	loadIM.prototype.clrAllContacts		= clrAllContacts;
+	loadIM.prototype.configEvents		= configEvents;
+	loadIM.prototype.createChatRooms	= createChatRooms;
+	loadIM.prototype.disabledNotificationNewUsers	= disabledNotificationNewUsers;
+	loadIM.prototype.enabledNotificationNewUsers	= enabledNotificationNewUsers;	
+	loadIM.prototype.getListRooms		= getListRooms;	
+	loadIM.prototype.getIsIE		= getIsIE;
+	loadIM.prototype.getPhotoUser		= getPhotoUser;
+	loadIM.prototype.getSmiles		= getSmiles;
+	loadIM.prototype.getStatusUserIM	= getStatusUserIM;
+	loadIM.prototype.getStatusMessage	= getStatusMessage;
+	loadIM.prototype.getShowContactsOffline	= getShowContactsOffline;
+	loadIM.prototype.getUserCurrent		= getUserCurrent;
+	loadIM.prototype.getZIndex		= getZindex;
+	loadIM.prototype.groupsHidden		= groupsHidden;
+	loadIM.prototype.groupsVisible		= groupsVisible;
+	loadIM.prototype.joinRoom		= joinRoom;	
+	loadIM.prototype.keyPressSearch		= keyPressSearch;	
+	loadIM.prototype.listRooms		= listRooms;
+	loadIM.prototype.loginPage		= loginPage;
+	loadIM.prototype.notification		= notificationNewMessage;
+	loadIM.prototype.parse			= parse;
+	loadIM.prototype.preferences		= preferences;
+	loadIM.prototype.searchUser		= searchUser
+	loadIM.prototype.setAutorization	= setAutorization;
+	loadIM.prototype.setMessageStatus	= setMessageStatus;
+	loadIM.prototype.setPreferences		= setPreferences;
+	loadIM.prototype.setPresence		= setPresence;
+	loadIM.prototype.setStatusJabber	= setStatusJabber;
+	loadIM.prototype.setSelectEditable	= setSelectEditable;
+	loadIM.prototype.setUserCurrent		= setUserCurrent;
+	loadIM.prototype.removeContact		= removeContact;
+	loadIM.prototype.removeElement		= removeElement;
+	loadIM.prototype.removeGroup		= removeGroup;
+	loadIM.prototype.renameContact		= renameContact;
+	loadIM.prototype.renameGroup		= renameGroup;
+	loadIM.prototype.rosterDiv		= rosterDiv;
+	loadIM.prototype.windowNotificationNewUsers  = windowNotificationNewUsers;
+	loadIM.prototype.windowPOPUP		= windowPOPUP;
+	
+	window.LoadIM = loadIM;
+	
+	// Necessário para não ocasionar problema no ExpressoMail
+	// quando os itens abaixo não são criados pelo próprio ExpressoMail
+	if( SnifferBrowser.isCompatible('is_ie') )
+	{
+		configEvents( window, 'onload', function( )
+		{
+			if ( ! document.getElementById( 'cc_msg_err_serialize_data_unknown' ) )
+			{
+				var fix	= document.createElement('input');
+					fix.type	= 'hidden';
+					fix.id		= 'cc_msg_err_serialize_data_unknown';
+				
+					document.appendChild( fix );
+			}
+			if ( ! window.showMessage )
+				window.showMessage = function(){};
+		});
+	}
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 4453)
@@ -0,0 +1,332 @@
+(function()
+{var _autoStatus;var _autoStatusTime=60000;var addUser=null;var conn=null;var fullName="";var path="";var path_phpgwapi="";var _preferencesIM="";var selectEditable=null;var showhidden=null;var statusUserIM="";var _statusMessage="";var timeoutId=null;var userCurrent=null;var _timeOutNotification="";var Xtools=null;var zIndex=9001;var windowPopUp=[];var add_user=new Image();add_user.src=path_jabberit+'templates/default/images/adduser_azul.png';var arrow_down=new Image();arrow_down.src=path_jabberit+'templates/default/images/arrow_down.gif';var arrow_right=new Image();arrow_right.src=path_jabberit+'templates/default/images/arrow_right.gif';function actionButton()
+{if(arguments.length>0)
+{var e=arguments[0];var _element=(e.target)?e.target:e.srcElement;var jid=arguments[1];var coord=null;if(!e)
+e=window.event;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};var _onContextMenu=function()
+{return false;};window.document.oncontextmenu=_onContextMenu;if(e.button)
+{if(e.button>1)
+optionsItensContact(jid,coord);else
+TrophyIM.rosterClick(jid);}
+else if(e.which)
+{if(e.which>1)
+optionsItensContact(jid,coord);else
+if(e.target.id)
+TrophyIM.rosterClick(jid);}
+setTimeout(function()
+{window.document.oncontextmenu=function()
+{return true;};},500);}}
+function addContact()
+{if(arguments.length>0)
+addUser.add();else
+addUser.show();}
+function addIcon()
+{var div_write_msg=(getElement('em_div_write_msg')!=null)?getElement('em_div_write_msg'):null;var StatusBar=(getElement('divStatusBar')!=null)?getElement('divStatusBar'):null;var StatusBarIM=(getElement('JabberMessenger')!=null)?getElement('JabberMessenger'):null;if((div_write_msg&&StatusBarIM)!=null)
+{div_write_msg.parentNode.insertBefore(StatusBarIM,div_write_msg);StatusBarIM.style.paddingLeft='33px';return;}
+if(!StatusBarIM)
+{StatusBarIM=document.createElement('div');StatusBarIM.setAttribute('id','JabberMessenger');}
+if(StatusBar)
+{StatusBar.style.paddingLeft='33px';var _div=document.createElement('div');_div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling));StatusBar.parentNode.insertBefore(_div,StatusBar);var _fastMenu=top.document.createElement('div');_fastMenu.setAttribute('id','fast_menu_jabber_expresso');_fastMenu.style.background='no-repeat';_fastMenu.style.backgroundImage='url('+arrow_down.src+')';_fastMenu.style.float='left';_fastMenu.style.height='15px';_fastMenu.style.left='7px';_fastMenu.style.margin='8 0 0 10px';_fastMenu.style.padding='0px';_fastMenu.style.position='absolute';_fastMenu.style.width='15px';_fastMenu.style.cursor='pointer';StatusBarIM.insertBefore(_fastMenu,StatusBarIM.firstChild);configEvents(_fastMenu,'onclick',function(){fastMenu(_fastMenu);});var _statusJabber=top.document.createElement('div');_statusJabber.setAttribute('id','status_jabber_expresso');_statusJabber.style.background='no-repeat';_statusJabber.style.backgroundImage='url('+add_user.src+')';_statusJabber.style.float='left';_statusJabber.style.height='18px';_statusJabber.style.left='19px';_statusJabber.style.margin='0 0 0 10px';_statusJabber.style.padding='0px';_statusJabber.style.position='absolute';_statusJabber.style.width='18px';_statusJabber.style.cursor='pointer';_statusJabber.style.zindex='999999';StatusBarIM.insertBefore(_statusJabber,StatusBarIM.firstChild);StatusBar.insertBefore(StatusBarIM,StatusBar.firstChild);if(_preferencesIM[0]=="openWindowJabberit:true")
+{configEvents(_statusJabber,'onclick',function(){rosterDiv();});}
+else
+{configEvents(_statusJabber,'onclick',function(){TrophyIM.load();});}}}
+function addNewUser()
+{addUser.newUser();}
+function autoStatus()
+{var _div_status=(getElement('status_jabber_expresso')!=null)?getElement('status_jabber_expresso'):null;if(_autoStatus)
+clearTimeout(_autoStatus);if(_div_status!=null)
+{var _status=_div_status.style.backgroundImage;_status=_status.substr(_status.lastIndexOf('/')+1);_status=_status.substr(0,_status.indexOf('.'));if(_status=="xa"&&_div_status.getAttribute('autoStatus'))
+{if(getStatusMessage()!="")
+TrophyIM.setPresence("available",getStatusMessage());else
+TrophyIM.setPresence("available");_div_status.removeAttribute('autoStatus');loadscript.setStatusJabber("Disponível","available");}}
+var TimeStatus=_preferencesIM[2].split(':');if(TimeStatus[1])
+_autoStatus=setTimeout(function(){autoStatusHandler();},parseInt(TimeStatus[1])*_autoStatusTime);else
+_autoStatus=setTimeout(function(){autoStatusHandler();},parseInt(_autoStatusTime));}
+function autoStatusHandler()
+{var _div_status=(getElement('status_jabber_expresso')!=null)?getElement('status_jabber_expresso'):null;if(_div_status!=null)
+{var _status=_div_status.style.backgroundImage;_status=_status.substr(_status.lastIndexOf('/')+1);_status=_status.substr(0,_status.indexOf('.'));if(_status=="available")
+{if(getStatusMessage()!="")
+TrophyIM.setPresence("xa",getStatusMessage());else
+TrophyIM.setPresence("xa");_div_status.setAttribute('autoStatus','true');loadscript.setStatusJabber("Não Disponível","xa");}}}
+function clrAllContacts()
+{getElement("JabberIMRoster").innerHTML="";}
+function configEvents(pObj,pEvent,pHandler)
+{if(typeof pObj=='object')
+{if(pEvent.substring(0,2)=='on')
+pEvent=pEvent.substring(2,pEvent.length);if(arguments.length==3)
+{if(pObj.addEventListener)
+pObj.addEventListener(pEvent,pHandler,false);else if(pObj.attachEvent)
+pObj.attachEvent('on'+pEvent,pHandler);}
+else if(arguments.length==4)
+{if(pObj.removeEventListener)
+pObj.removeEventListener(pEvent,pHandler,false);else if(pObj.detachEvent)
+pObj.detachEvent('on'+pEvent,pHandler);}}}
+function disabledNotificationNewUsers()
+{var _notification=getElement('notification_new_users_jabber');var _statusJabber=getElement('status_jabber_expresso');_notification.style.display='none';_statusJabber.style.background="url('"+path_jabberit+"templates/default/images/"+statusUserIM+".gif') no-repeat";if(_timeOutNotification)
+clearTimeout(_timeOutNotification);TrophyIM.controll.notificationNewUsers=0;}
+function enabledNotificationNewUsers()
+{var _notification=getElement('notification_new_users_jabber');var _statusJabber=getElement('status_jabber_expresso');if(_notification&&_statusJabber)
+{if(_notification.style.display=='none')
+{_notification.style.display='block';_statusJabber.style.background="url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat";if(_timeOutNotification)
+clearTimeout(_timeOutNotification);_timeOutNotification=setTimeout(function(){enabledNotificationNewUsers();},2000);}
+else
+{_notification.style.display='none';_statusJabber.style.background="url('"+path_jabberit+"templates/default/images/"+statusUserIM+".gif') no-repeat";if(_timeOutNotification)
+clearTimeout(_timeOutNotification);_timeOutNotification=setTimeout(function(){enabledNotificationNewUsers();},800);}}}
+function fastMenu()
+{if(arguments.length>0)
+{var element=arguments[0];if(showhidden==null)
+showhidden=new ShowHidden(300);var _options=[['Adicionar Contato','loadscript.addContact();'],['Preferências','loadscript.preferences();']];if(im_chatroom=="false")
+{_options[2]=['Sala(s) de Bate-Papo','loadscript.getListRooms();'];}
+var _itens="";for(var i in _options)
+{if(_options[i].constructor==Function)
+continue;_itens+='<img src="'+arrow_right.src+'"/>';_itens+='<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>';_itens+=_options[i][0]+'</span><br/>';}
+var _optionsItens=document.createElement("div");_optionsItens.id="fastMenu_Jabber";_optionsItens.style.marginTop="19px";_optionsItens.style.marginLeft="-8px";_optionsItens.className="x-menu";_optionsItens.style.zIndex='999999';_optionsItens.innerHTML=_itens;_optionsItens.onclick=function(){showhidden.hiddenObject(false);};_optionsItens.onmouseout=function(){showhidden.hiddenObject(false);};_optionsItens.onmouseover=function(){showhidden.hiddenObject(true);};showhidden.action('onmouseover','onmouseout',_optionsItens);element.parentNode.appendChild(_optionsItens);}}
+function getElement(elementId)
+{return document.getElementById(elementId);}
+function getIsIE()
+{return SnifferBrowser.isCompatible('is_ie');}
+function getPhotoUser(jid)
+{try
+{var _divPhoto=getElement(jid+'__photo');if(_divPhoto.style.backgroundImage.indexOf('photo.png')>0)
+{var _imgUser=path_jabberit+'inc/WebService.php?'+Date.parse(new Date);_imgUser+='&photo_ldap='+jid;_divPhoto.style.backgroundImage='url('+_imgUser+')';}}catch(e){}}
+function getShowContactsOffline()
+{if(_preferencesIM[3])
+{var showOffline=_preferencesIM[3].split(":");if(showOffline[1]==="true")
+return true;else
+return false;}
+return true;}
+function getSmiles(String)
+{String=String.replace(/:\)|:-\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/1.gif'/> ");String=String.replace(/:-D/g," <img src='"+path_jabberit+"templates/default/images/smiles/2.gif'/> ");String=String.replace(/;-\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/3.gif'/> ");String=String.replace(/=-O/g," <img src='"+path_jabberit+"templates/default/images/smiles/4.gif'/> ");String=String.replace(/:P/g," <img src='"+path_jabberit+"templates/default/images/smiles/5.gif'/> ");String=String.replace(/8-\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/6.gif'/> ");String=String.replace(/\>:o/g," <img src='"+path_jabberit+"templates/default/images/smiles/7.gif'/> ");String=String.replace(/:-\$/g," <img src='"+path_jabberit+"templates/default/images/smiles/8.gif'/> ");String=String.replace(/:s|:-X/g," <img src='"+path_jabberit+"templates/default/images/smiles/9.gif'/> ");String=String.replace(/:-\(/g," <img src='"+path_jabberit+"templates/default/images/smiles/10.gif'/> ");String=String.replace(/:\'\(/g," <img src='"+path_jabberit+"templates/default/images/smiles/11.gif'/> ");String=String.replace(/:\|/g," <img src='"+path_jabberit+"templates/default/images/smiles/12.gif'/> ");String=String.replace(/O:-\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/13.gif'/> ");String=String.replace(/\*\*@#%/g," <img src='"+path_jabberit+"templates/default/images/smiles/14.gif'/> ");String=String.replace(/\(I\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/15.gif'/> ");String=String.replace(/C28I/g," <img src='"+path_jabberit+"templates/default/images/smiles/16.gif'/> ");String=String.replace(/CS2A/g," <img src='"+path_jabberit+"templates/default/images/smiles/17.gif' style='width:42px;height:36px;'/> ");String=String.replace(/\(CzzzzI\)/g," <img src='"+path_jabberit+"templates/default/images/smiles/18.gif'/> ");return String;}
+function getStatusUserIM()
+{return statusUserIM;}
+function getStatusMessage()
+{return _statusMessage;}
+function getUserCurrent()
+{return userCurrent;}
+function getZindex()
+{return zIndex++;}
+function groupsHidden()
+{if(arguments.length>0)
+{var _element=arguments[0];_element.style.background="url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left";_element.onclick=function(){groupsVisible(_element);};var _elementNext=_element.nextSibling;while(_elementNext)
+{if(_elementNext.nodeType==1)
+_elementNext.style.display="none";_elementNext=_elementNext.nextSibling;}}}
+function groupsVisible()
+{if(arguments.length>0)
+{var _element=arguments[0];_element.style.background="url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left";_element.onclick=function(){groupsHidden(_element);};var _elementNext=_element.nextSibling;while(_elementNext)
+{if(_elementNext.nodeType==1&&_elementNext.nodeName.toLowerCase()=="div")
+{var is_off=_elementNext.style.backgroundImage.indexOf("unavailable");if(is_off>0&&!getShowContactsOffline())
+{_elementNext.style.display="none";getElement("span_show_"+_elementNext.id).style.display="none";}
+else
+{_elementNext.style.display="block";getElement("span_show_"+_elementNext.id).style.display="block";}}
+_elementNext=_elementNext.nextSibling;}}}
+function keyPressSearch()
+{if(arguments.length>0)
+{var ev=arguments[0];var element=arguments[1];if(ev.keyCode==13)
+if(element.value.length>=3)
+searchUser(element.value);else
+alert(i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS+'.');}}
+function loginPage()
+{var paramsLoginPage={'username':(((Base64.decode(getUserCurrent().jid)))?Base64.decode(getUserCurrent().jid):""),'password':(((Base64.decode(getUserCurrent().password)))?Base64.decode(getUserCurrent().password):"")}
+var winLoginPage={id_window:"window_login_page",width:260,height:120,top:100,left:400,draggable:true,visible:"display",resizable:true,zindex:zIndex++,title:"Expresso Messenger - Login",closeAction:"remove",content:Xtools.parse(Xtools.xml("login_page"),"loginPage.xsl",paramsLoginPage)};_winBuild(winLoginPage);}
+function loadScripts(pFiles)
+{var loadJavaScript=function(pJs)
+{var newScript=document.createElement("script");newScript.setAttribute("type","text/javascript");newScript.setAttribute("src",pJs);return newScript;};var loadStyleSheet=function(pCss)
+{var newStyle=document.createElement("link");newStyle.setAttribute("rel","stylesheet");newStyle.setAttribute("type","text/css");newStyle.setAttribute("href",pCss);return newStyle;};for(var i=0;i<pFiles.length;i++)
+{if(pFiles[i].indexOf(".js")>-1)
+document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i]));if(pFiles[i].indexOf(".css")>-1)
+document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i]));}}
+function notificationNewMessage()
+{var _doc=document;var _id=arguments[0];var _win_name=_id.replace(/\W/g,'');if(windowPOPUP(_id))
+{_doc=windowPopUp[_win_name].document;}
+var oldTitle=_doc.title;var newTitle="## NOVA MENSAGEM ##";if(timeoutId==null)
+{timeoutId=setInterval(function()
+{_doc.title=(_doc.title==newTitle)?oldTitle:newTitle;},1000);configEvents(_doc,'onclick',function()
+{clearInterval(timeoutId);_doc.title=oldTitle;timeoutId=null;});configEvents(_doc,'onkeypress',function()
+{clearInterval(timeoutId);_doc.title=oldTitle;timeoutId=null;});}}
+function optionsItensContact()
+{if(arguments.length>0)
+{var jid=arguments[0];var coord=arguments[1];var element=getElement('itenContact_'+jid);var action=(element.getAttribute("subscription")==="not-in-roster")?"Adicionar":"Autorizar";if(showhidden==null)
+showhidden=new ShowHidden(300);var _options=[[action,'loadscript.setAutorization(\''+jid+'\')'],['Remover','loadscript.removeContact(\''+jid+'\')'],['Renomear','loadscript.renameContact(\''+jid+'\')'],['Trocar grupo','loadscript.renameGroup(\''+jid+'\')']];var _itens="";for(var i in _options)
+{if(typeof(_options[i])=="object")
+{_itens+='<img src="'+arrow_right.src+'"/>';_itens+='<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>';_itens+=_options[i][0]+'</span><br/>';}}
+var _optionsItens=document.createElement("div");_optionsItens.className="x-menu";_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);};showhidden.action('onmouseover','onmouseout',_optionsItens);window.document.body.appendChild(_optionsItens);}}
+function parse()
+{if(arguments.length==2)
+return Xtools.parse(Xtools.xml(arguments[0]),arguments[1]);if(arguments.length===3)
+return Xtools.parse(Xtools.xml(arguments[0]),arguments[1],arguments[2]);}
+function preferences()
+{var paramPreferences={'path':path,'lang1':'Suas Preferências','lang2':'Conexão','lang3':'Conectar Automaticamente o IM','lang4':'Usuários OffLine','lang5':'Exibir amigos Offline','lang6':'Salvar','lang7':'Cancelar','lang8':'Janela de Contatos','lang9':'Abrir janela como Pop-up','lang10':'Ausente','lang11':'Definir status de ausente depois de','lang12':'minutos','lang13':'Mostrar Contatos','lang14':'Mostrar contatos desconectados','langYes':'Sim','langNo':'Não'};var _win_preferences={id_window:"jabberit_preferences",width:430,height:350,top:150,left:100,draggable:true,visible:"display",resizable:true,zindex:zIndex++,title:'Expresso Messenger - Preferências',closeAction:"remove",content:Xtools.parse(Xtools.xml('preferences'),'preferences.xsl',paramPreferences)};_winBuild(_win_preferences);var _pButtons={'lang1':'Salvar','lang2':'Fechar','onclickClose':'_winBuild("jabberit_preferences","remove");','onclickSubmit':'javascript:loadscript.setPreferences();'};document.getElementById('buttons_preferences_jabberit').innerHTML=Xtools.parse(Xtools.xml('buttons_main'),'buttons.xsl',_pButtons);var value1=_preferencesIM[0].split(':');var element1=document.getElementById(value1[0]);var valueSelect1=value1[1];for(var i=0;i<element1.options.length;i++)
+if(element1.options[i].value==valueSelect1)
+element1.options[i].selected=true;var value2=_preferencesIM[1].split(':');var value3=_preferencesIM[2].split(':');var element3=document.getElementById(value3[0]);element3.value=value3[1];var value4=_preferencesIM[3].split(':');var element4=document.getElementById(value4[0]);var valueSelect4=value4[1];for(var i=0;i<element4.options.length;i++)
+if(element4.options[i].value==valueSelect4)
+element4.options[i].selected=true;}
+function removeContact(jid)
+{TrophyIM.removeContact(jid);}
+function removeElement()
+{if(arguments.length>0)
+{var _element=arguments[0]
+if(_element!=null)
+{_element.parentNode.removeChild(_element);}}}
+function removeGroup()
+{var _parent=arguments[0];if(_parent.childNodes.length<=2)
+_parent.parentNode.removeChild(_parent);}
+function renameContact()
+{if(arguments.length>0)
+{var _jid=arguments[0];TrophyIM.renameContact(_jid);}}
+function renameGroup()
+{if(arguments.length>0)
+{var _jid=arguments[0];TrophyIM.renameGroup(_jid);}}
+function rosterDiv()
+{var _rosterDiv=function()
+{var winRosterDiv={id_window:"window_Roster_im",width:250,height:410,top:50,left:-1500,leftOld:50,draggable:true,visible:"display",resizable:true,zindex:zIndex++,title:"Expresso Messenger - Contatos",closeAction:"hidden",content:""};if(_preferencesIM[0]=="openWindowJabberit:false")
+{winRosterDiv.left=50;winRosterDiv.leftOld=-1500;}
+if(SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3'))
+{var _idUser=Base64.decode(getUserCurrent().jid);var paramListContact={'idUser':_idUser,'full_name':((fullName.length<25)?fullName:(fullName.substring(0,25)+"...")),'path_jabberit':path_jabberit,'help_expresso':help_expresso,'zIndex_':zIndex++};winRosterDiv.content=Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl",paramListContact)}
+else
+{var paramList={'path':path_phpgwapi};winRosterDiv.width=280;winRosterDiv.height=430;winRosterDiv.content=Xtools.parse(Xtools.xml("navigator"),path_phpgwapi+"templates/default/xsl/navigatorCompatible.xsl",paramList);}
+_winBuild(winRosterDiv);getPhotoUser(_idUser);}
+setTimeout(function(){_rosterDiv();},200);}
+function searchUser()
+{var _input=getElement('search_user_jabber');if(_input.value.length>=3)
+addUser.search();else
+alert(i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS+'.');}
+function setAutorization()
+{var divItenContact=null;if(arguments.length>0)
+{var jidTo=arguments[0];if(getElement('itenContact_'+jidTo))
+divItenContact=getElement('itenContact_'+jidTo);}
+if(divItenContact)
+{var subscription=divItenContact.getAttribute('subscription');switch(subscription)
+{case'from':TrophyIM.setAutorization(jidTo,Base64.decode(this.getUserCurrent().jid),'subscribe');break;case'subscribe':TrophyIM.setAutorization(jidTo,Base64.decode(this.getUserCurrent().jid),'subscribed');break;case'none':TrophyIM.setAutorization(jidTo,Base64.decode(this.getUserCurrent().jid),'subscribe');break;case'to':TrophyIM.setAutorization(jidTo,Base64.decode(this.getUserCurrent().jid),'subscribed');removeElement(getElement('itenContactNotification_'+jidTo));break;case'not-in-roster':TrophyIM.setAutorization(jidTo,Base64.decode(this.getUserCurrent().jid),'subscribed');addUser.add(jidTo);break;}}}
+function setMessageStatus()
+{if(arguments.length>0)
+{var _element=arguments[0];var _parent=_element.parentNode;if(_element.nodeName.toLowerCase()=="label")
+{var _input=document.createElement("input");_input.size="35";_input.maxlength="35";_input.style.border="0";_input.value=_element.innerHTML;configEvents(_input,"onkeyup",function(e)
+{if(e.keyCode==13)loadscript.setMessageStatus(_input,_element);});configEvents(_input,"onblur",function(){loadscript.setMessageStatus(_input,_element)});if(_parent!=null)
+{if(_element!=null)
+_parent.removeChild(_element);if(_input!=null)
+_parent.appendChild(_input);}
+_input.focus();_input.select();}
+else
+{var _label=arguments[1];_statusMessage=_element.value.replace(/^\(+|\)+$/g,"");if((_statusMessage=_statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,""))!="")
+_label.innerHTML="( "+_statusMessage+" )";else
+_label.innerHTML="( "+i18n.TYPE_YOUR_MESSAGE_HERE_STATUS+" )";if(_parent!=null)
+{if(_element!=null)
+_parent.removeChild(_element);if(_label!=null)
+_parent.appendChild(_label);}
+_statusMessage=((_statusMessage!=i18n.TYPE_YOUR_MESSAGE_HERE_STATUS)?_statusMessage:"");TrophyIM.setPresence("status",_statusMessage);}}}
+function setPreferences()
+{var elementOpenW=document.getElementById('openWindowJabberit');var value='';for(var i=0;i<elementOpenW.options.length;i++)
+if(elementOpenW.options[i].selected==true)
+{value='preferences1=openWindowJabberit:'+elementOpenW.options[i].value;_preferencesIM[0]='openWindowJabberit:'+elementOpenW.options[i].value;}
+value+='&preferences2=openWindowJabberitPopUp:false';_preferencesIM[1]='openWindowJabberitPopUp:false';var elementFlagIM=document.getElementById('flagAwayIM');if(elementFlagIM.value.length>0&&parseInt(elementFlagIM.value)>0)
+{_preferencesIM[2]='flagAwayIM:'+elementFlagIM.value;value+='&preferences3=flagAwayIM:'+elementFlagIM.value;}
+else
+{alert('Informe um valor igual ou maior que 1!');return false;}
+var elementShowOffline=document.getElementById('showContactsOfflineJabberit');for(var i=0;i<elementShowOffline.options.length;i++)
+if(elementShowOffline.options[i].selected==true)
+{_preferencesIM[3]='showContactsOfflineJabberit:'+elementShowOffline.options[i].value;value+='&preferences4=showContactsOfflineJabberit:'+elementShowOffline.options[i].value;}
+conn.go('p.pf.setPreferences',function(data)
+{if(data=='false')
+{alert('Erro salvando suas preferências!');}
+_winBuild('jabberit_preferences','remove');},value);}
+function setPresence()
+{if(arguments.length>0)
+{var element=arguments[0];if(showhidden==null)
+showhidden=new ShowHidden(300);var _status=[['Afastado','away','<img src="'+path_jabberit+'templates/default/images/away.gif" />'],['Disponível','available','<img src="'+path_jabberit+'templates/default/images/available.gif" />'],['Livre p/ Conversa','chat','<img src="'+path_jabberit+'templates/default/images/chat.gif" />'],['Não Disponível','xa','<img src="'+path_jabberit+'templates/default/images/xa.gif" />'],['Ocupado','dnd','<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'],['Desconectado','unavailable','<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'],['Mensagem de Status...','status','<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'],];var _itens="";for(var i in _status)
+{if(typeof(_status[i])=="object")
+{_itens+='<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">';_itens+=_status[i][2]+"<span style='margin:3px;'>"+_status[i][0]+"</span></span><br/>";}}
+var _statusItens=document.createElement("div");_statusItens.style.marginTop="65px";_statusItens.style.marginLeft="67px";_statusItens.className="x-menu";_statusItens.style.zIndex='99999';_statusItens.innerHTML=_itens;_statusItens.onclick=function(){showhidden.hiddenObject(false);};showhidden.action('onmouseover','onmouseout',_statusItens);element.parentNode.onmouseout=function(){showhidden.hiddenObject(false);};element.parentNode.onmouseover=function(){showhidden.hiddenObject(true);};element.parentNode.appendChild(_statusItens);}}
+function setSelectEditable(element,top,left)
+{if(getElement('selectBox0')==null)
+selectEditable.create(element,top,left);}
+function setStatusJabber()
+{if(arguments.length>0)
+{if(arguments[1]!='status')
+{var _text=arguments[0];var _img=statusUserIM=arguments[1];getElement('statusJabberText').innerHTML=_text;getElement('statusJabberImg').style.background="url('"+path_jabberit+"templates/default/images/"+_img+".gif')";getElement('status_jabber_expresso').style.background="url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat";}}}
+function _setUserCurrent(_user)
+{userCurrent={'jid':_user.jid.substring(11,_user.jid.length),'password':_user.password.substring(11,_user.password.length)}}
+function setUserCurrent()
+{if(getUserCurrent()==null)
+{conn.go('p.ff.data_0',function(_User)
+{conn.go('p.ff.data_1',function(_pass)
+{_setUserCurrent({jid:_User,password:_pass});});});}}
+var _stylesheets=[];var _links=document.getElementsByTagName('link');for(var i=0;i<_links.length;i++)
+if(_links.item(i).type&&_links.item(i).type.toLowerCase()=='text/css')
+_stylesheets[_stylesheets.length]=_links.item(i);function windowPOPUP()
+{var _id=arguments[0];var _win_name=_id.replace(/\W/g,'');if(arguments.length==1)
+{if(windowPopUp[_win_name])
+return true;else
+return false;}
+if(arguments.length==2)
+{if(!windowPopUp[_win_name])
+{windowPopUp[_win_name]=window.open('',_win_name+'__popup','height=355,width=380,top=50,left=50,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,titlebar=no');var tmp=windowPopUp[_win_name].document;tmp.write('<html><head>');tmp.write('</head><body>');tmp.write('</body></html>');tmp.close();for(var i=0;i<_stylesheets.length;i++)
+tmp.documentElement.getElementsByTagName('head').item(0).appendChild(_stylesheets[i].cloneNode(true));var divPOP=getElement(_id+"__popUp");divPOP.style.background="url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat";divPOP.innerHTML="PopIn";function _close()
+{windowPopUp[_win_name].close();configEvents(divPOP,'onclick',_close,true);}
+configEvents(divPOP,'onclick',_close);var _content=tmp.documentElement.getElementsByTagName('body').item(0).appendChild(getElement(_id+'__chatBox').parentNode);_content.firstChild.scrollTop=_content.firstChild.scrollHeight;configEvents(windowPopUp[_win_name],'onbeforeunload',function()
+{delete windowPopUp[_win_name];divPOP.style.background="url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat";divPOP.innerHTML="PopUp";divPOP.onclick=function(){loadscript.windowPOPUP(_id,true);};_winBuild('window_chat_area_'+_id,"display").content(true);});_winBuild('window_chat_area_'+_id,'hidden');}}}
+function windowNotificationNewUsers()
+{var _users=Xtools.xml('notification_new_users');for(var user in TrophyIM.rosterObj.roster)
+{if(TrophyIM.rosterObj.roster[user].constructor==Function)
+continue;if(TrophyIM.rosterObj.roster[user].contact.jid!=Base64.decode(loadscript.getUserCurrent().jid))
+{var _subscription=TrophyIM.rosterObj.roster[user].contact.subscription;if(_subscription=='to'||_subscription=='not-in-roster')
+{var _user=_users.createElement('user');var _jid=_users.createElement('jid');var _status=_users.createElement('status');_jid.appendChild(_users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid));_status.appendChild(_users.createTextNode(_subscription));_user.appendChild(_jid);_user.appendChild(_status);_users.documentElement.appendChild(_user);}}}
+var paramsNotification={'lang_1':"Notificação",'lang_2':"O(s) usuário(s) abaixo pedem sua autorização.",'lang_3':"Autorizar",'lang_4':"Remover"};var winNotification={id_window:"window_notification_new_users",width:400,height:300,top:100,left:400,draggable:true,visible:"display",resizable:true,zindex:zIndex++,title:"Expresso Messenger - Notificação de Novos Usuários",closeAction:"remove",content:Xtools.parse(_users,"notificationNewUsers.xsl",paramsNotification)};_winBuild(winNotification);}
+function createChatRooms()
+{_winBuild("window_List_Rooms_jabberit_messenger","remove");var paramCreateChatRoom={'lang_nameChatRoom':"Nome da Sala",'lang_nickName':"Apelido"};var winCreateChatRooms={id_window:"window_create_chat_rooms",width:360,height:160,top:100,left:410,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:"Expresso Messenger - Criar Sala de Bate Papo",closeAction:"remove",content:Xtools.parse(Xtools.xml("create_chat_room"),"createChatRoom.xsl",paramCreateChatRoom)};_winBuild(winCreateChatRooms);var _pButtons={'lang1':'Ingressar','lang2':'Fechar','onclickClose':'_winBuild("window_create_chat_rooms","remove");','onclickSubmit':'TrophyIM.createChatRooms(); _winBuild("window_create_chat_rooms","remove");'};document.getElementById('buttons_createChatRoom').innerHTML=Xtools.parse(Xtools.xml('buttons_main'),'buttons.xsl',_pButtons);}
+function listRooms(element)
+{element=element.getElementsByTagName('item');var _roomsCount=0;var _xml=Xtools.xml('listRooms');var _listRooms=_xml.documentElement;var show=function()
+{if(_roomsCount!=element.length)
+return false;var paramsListRooms={"path_jabberit":path_jabberit};var winListRooms={id_window:"window_List_Rooms_jabberit_messenger",width:450,height:300,top:100,left:400,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:"Expresso Messenger - Salas de Bate Papo",closeAction:"remove",content:Xtools.parse(_xml,"listRooms.xsl",paramsListRooms)};_winBuild(winListRooms);var _pButtons={'lang1':'Criar Nova Sala','lang2':'Fechar','onclickClose':'_winBuild("window_List_Rooms_jabberit_messenger","remove");','onclickSubmit':'loadscript.createChatRooms();'};document.getElementById('buttons_addChatRoom').innerHTML=Xtools.parse(Xtools.xml('buttons_main'),'buttons.xsl',_pButtons);};var _add_room=function(_room)
+{_roomsCount++;var _ROOM=_xml.createElement('room');var _JIDROOM=_xml.createElement('jidRoom');var nameRoom=_room.getAttribute('from');_ROOM.setAttribute('nameRoom',unescape((nameRoom.substring(0,nameRoom.indexOf("@"))).toUpperCase()));_JIDROOM.appendChild(_xml.createTextNode(nameRoom));_ROOM.appendChild(_JIDROOM);var _fields=_room.getElementsByTagName('field');for(var f=0;f<_fields.length;f++)
+{if(_fields[f].getAttribute('var'))
+{if(_fields[f].firstChild.hasChildNodes()&&_fields[f].getAttribute('var')=='muc#roominfo_description')
+{var _description=_xml.createElement("description");_description.appendChild(_xml.createTextNode(_fields[f].firstChild.firstChild.nodeValue));_ROOM.appendChild(_description);}
+if(_fields[f].firstChild.hasChildNodes()&&_fields[f].getAttribute('var')=='muc#roominfo_occupants')
+{var _occupants=_xml.createElement("occupants")
+_occupants.appendChild(_xml.createTextNode(_fields[f].firstChild.firstChild.nodeValue));_ROOM.appendChild(_occupants);}}}
+var _feature=_room.getElementsByTagName('feature');for(var f=0;f<_feature.length;f++)
+{if(_feature[f].getAttribute('var'))
+{if(_feature[f].getAttribute('var')=='muc_unsecured')
+{var _password=_xml.createElement("password");_password.appendChild(_xml.createTextNode("false"));_ROOM.appendChild(_password);}
+else if(_feature[f].getAttribute('var')=='muc_passwordprotected')
+{var _password=_xml.createElement("password");_password.appendChild(_xml.createTextNode("true"));_ROOM.appendChild(_password);}}}
+_listRooms.appendChild(_ROOM);show();};var _get_room_info=function(_room)
+{TrophyIM.connection.sendIQ($iq({"to":_room,"type":"get"}).c("query",{xmlns:Strophe.NS.DISCO_INFO}),_add_room,function(a)
+{_roomsCount++;show();},500);};if(element.length>0)
+{for(var i=0;i<element.length;i++)
+{_get_room_info(element[i].getAttribute('jid'));}}
+else
+{show();}}
+function getListRooms()
+{TrophyIM.getListRooms();}
+function joinRoom(jidRoom,nameRoom)
+{var append_nick=function(room,nick)
+{var room_nick=room;if(nick)
+{room_nick+="/"+nick;}
+return room_nick;}
+if(document.getElementById('window_chat_room_'+jidRoom+'__main')!=null)
+{_winBuild('window_chat_room_'+jidRoom,'display');}
+else
+{var nickName=Base64.decode(loadscript.getUserCurrent().jid);nickName=nickName.substring(0,nickName.indexOf('@'));var _prompt=prompt("Deseja informar um Apelido ?",nickName);if(_prompt)
+{_prompt=_prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");var room_nick=append_nick(jidRoom,nickName);var nickChat=nickName.toString();if(_prompt&&_prompt!="")
+{nickChat=_prompt.toString();var room_nick=append_nick(jidRoom,_prompt);}
+TrophyIM.makeChatRoom(jidRoom,nameRoom);TrophyIM.activeChatRoom.name[TrophyIM.activeChatRoom.name.length]=room_nick;TrophyIM.joinChatRoom(room_nick);setTimeout(function()
+{var _message=nickName.toUpperCase()+" entrou como : "+nickChat;TrophyIM.sendMessageChatRoom(jidRoom,_message);},500);}}
+_winBuild("window_List_Rooms_jabberit_messenger","remove");}
+function loadIM()
+{if(arguments.length>0)
+{var files=[path_jabberit+'templates/default/css/button.css',path_jabberit+'templates/default/css/common.css',path_jabberit+'templates/default/css/selectEditableStyle.css',path_jabberit+'templates/default/css/'+theme_jabberit];fullName=arguments[0];_preferencesIM=arguments[1].split(";");path_phpgwapi=arguments[2];if(!_preferencesIM[3])_preferencesIM[3]="showContactsOfflineJabberit:true";loadScripts(files);setTimeout(function()
+{if(Xtools==null)
+Xtools=new xtools(path_jabberit);if(conn==null)
+conn=new AjaxConnector(path_jabberit);if(addUser==null)
+addUser=new addUserIM(Xtools,conn);if(selectEditable==null)
+selectEditable=new SelectEditable();addIcon();setTimeout(function()
+{if(_preferencesIM[0]==='openWindowJabberit:true')
+{if(SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3'))
+TrophyIM.load();}},1500);autoStatus();configEvents(document,'onmousemove',autoStatus);configEvents(document,'onkeypress',autoStatus);},2000);}}
+loadIM.prototype.adIcon=addIcon;loadIM.prototype.actionButton=actionButton;loadIM.prototype.addContact=addContact;loadIM.prototype.addNewUser=addNewUser;loadIM.prototype.clrAllContacts=clrAllContacts;loadIM.prototype.configEvents=configEvents;loadIM.prototype.createChatRooms=createChatRooms;loadIM.prototype.disabledNotificationNewUsers=disabledNotificationNewUsers;loadIM.prototype.enabledNotificationNewUsers=enabledNotificationNewUsers;loadIM.prototype.getListRooms=getListRooms;loadIM.prototype.getIsIE=getIsIE;loadIM.prototype.getPhotoUser=getPhotoUser;loadIM.prototype.getSmiles=getSmiles;loadIM.prototype.getStatusUserIM=getStatusUserIM;loadIM.prototype.getStatusMessage=getStatusMessage;loadIM.prototype.getShowContactsOffline=getShowContactsOffline;loadIM.prototype.getUserCurrent=getUserCurrent;loadIM.prototype.getZIndex=getZindex;loadIM.prototype.groupsHidden=groupsHidden;loadIM.prototype.groupsVisible=groupsVisible;loadIM.prototype.joinRoom=joinRoom;loadIM.prototype.keyPressSearch=keyPressSearch;loadIM.prototype.listRooms=listRooms;loadIM.prototype.loginPage=loginPage;loadIM.prototype.notification=notificationNewMessage;loadIM.prototype.parse=parse;loadIM.prototype.preferences=preferences;loadIM.prototype.searchUser=searchUser
+loadIM.prototype.setAutorization=setAutorization;loadIM.prototype.setMessageStatus=setMessageStatus;loadIM.prototype.setPreferences=setPreferences;loadIM.prototype.setPresence=setPresence;loadIM.prototype.setStatusJabber=setStatusJabber;loadIM.prototype.setSelectEditable=setSelectEditable;loadIM.prototype.setUserCurrent=setUserCurrent;loadIM.prototype.removeContact=removeContact;loadIM.prototype.removeElement=removeElement;loadIM.prototype.removeGroup=removeGroup;loadIM.prototype.renameContact=renameContact;loadIM.prototype.renameGroup=renameGroup;loadIM.prototype.rosterDiv=rosterDiv;loadIM.prototype.windowNotificationNewUsers=windowNotificationNewUsers;loadIM.prototype.windowPOPUP=windowPOPUP;window.LoadIM=loadIM;if(SnifferBrowser.isCompatible('is_ie'))
+{configEvents(window,'onload',function()
+{if(!document.getElementById('cc_msg_err_serialize_data_unknown'))
+{var fix=document.createElement('input');fix.type='hidden';fix.id='cc_msg_err_serialize_data_unknown';document.appendChild(fix);}
+if(!window.showMessage)
+window.showMessage=function(){};});}})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.mini.js	(revision 4453)
@@ -0,0 +1,51 @@
+
+(function()
+{var _element=null;var _elementA=null;var _elementB=null;var _parent=null;function _configEvent(pObj,pEvent,pHandler)
+{if(pObj&&typeof pObj=='object')
+{if(pEvent.substring(0,2)=='on')
+pEvent=pEvent.substring(2,pEvent.length);if(arguments.length==3)
+{if(pObj.addEventListener)
+pObj.addEventListener(pEvent,pHandler,false);else if(pObj.attachEvent)
+pObj.attachEvent('on'+pEvent,pHandler);}
+else if(arguments.length==4)
+{if(pObj.removeEventListener)
+{pObj.removeEventListener(pEvent,pHandler,false);}
+else if(pObj.detachEvent)
+{pObj.detachEvent('on'+pEvent,pHandler);}}}}
+function _drag(e)
+{if(typeof e.preventDefault!='undefined')
+e.preventDefault();else
+e.onselectstart=new Function("return false;");_element=(e.target)?e.target:e.srcElement;if(_element)
+{_configEvent(_element,'onmousemove',_mouseMove);_configEvent(top.document,'onmousemove',_mouseMove);_configEvent(_element,'onmouseup',_mouseUp);_configEvent(top.document,'onmouseup',_mouseUp);}}
+function _elementShadow(pId)
+{if(_elementA)
+{var _elShadow=document.createElement("div");_elShadow.id=_elementA.id+"__Shadow";_elShadow.setAttribute("onselectstart","return false");_elShadow.style.width=_elementA.style.width;_elShadow.style.height=_elementA.style.height;_elShadow.style.top=_elementA.style.top;_elShadow.style.left=_elementA.style.left;_elShadow.style.zIndex=_elementA.style.zIndex;_elShadow.className="x-shadow_Div";return _elShadow;}}
+function _load()
+{if(arguments.length>0)
+{var pId=arguments[0];_configEvent(document.getElementById(pId+"__draggable"),'onmousedown',_mouseDownShadow);}}
+function _getMouseOffset(e,el)
+{var docPos=_getPosition(el);var mousePos=_mouseCoords(e);return{'x':mousePos.x-docPos.x,'y':mousePos.y-docPos.y};}
+function _getPosition(_pObject)
+{var left=0;var top=0;while(_pObject.offsetParent)
+{left+=_pObject.offsetLeft;top+=_pObject.offsetTop;_pObject=_pObject.offsetParent;}
+left+=_pObject.offsetLeft;top+=_pObject.offsetTop;return{'x':left,'y':top};}
+function _mouseCoords(ev)
+{var CoordX="";var CoordY="";if(ev.pageX||ev.pageY)
+return{'x':ev.pageX,'y':ev.pageY};CoordX=ev.clientX+document.body.scrollLeft-document.body.clientLeft;CoordY=ev.clientY+document.body.scrollTop-document.body.clientTop;return{'x':CoordX,'y':CoordY};}
+function _mouseMove(e)
+{if(_element)
+{if(_element.mouseOffset==null)
+_element.mouseOffset=_getMouseOffset(e,_element);var mousePos=_mouseCoords(e);var x=mousePos.x-_element.mouseOffset.x;var y=mousePos.y-_element.mouseOffset.y;_element.style.left=((x<0)?0:x)+'px';_element.style.top=((y<0)?0:y)+'px';}}
+function _mouseUp()
+{if(_element)
+{_configEvent(_element,'onmousemove',_mouseMove,'remove');_configEvent(top.document,'onmousemove',_mouseMove,'remove');_configEvent(_element,'onmouseup',_mouseUp,'remove');_configEvent(top.document,'onmouseup',_mouseUp,'remove');_element.mouseOffset=null;_mouseUpShadow();}}
+function _mouseDownShadow(e)
+{try
+{if(arguments.length>0)
+{var _el=(e.target)?e.target:e.srcElement;var _id=(_el.id.substring(0,_el.id.indexOf("__draggable")));_elementA=document.getElementById(_id+"__parent");_elementB=_elementShadow(_id+"__parent");_elementA.style.left='-1500px';_parent=_elementA.parentNode;var _B=_parent.appendChild(_elementB);_configEvent(_elementB,'onmouseup',_mouseUpShadow);_configEvent(_elementB,'onmousemove',_drag);}}catch(e){}}
+function _mouseUpShadow()
+{try
+{_elementA.style.top=_elementB.style.top;_elementA.style.left=_elementB.style.left;var _B=_parent.removeChild(_elementB);_elementA=null;_elementB=null;_element=null;}
+catch(e){}}
+function _drag_drop(){}
+_drag_drop.prototype.set=_load;window._drag_drop=_drag_drop;})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.mini.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.mini.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/makeW.mini.js	(revision 4453)
@@ -0,0 +1,42 @@
+
+(function()
+{var _xtools=null;var dragDrop=null;var path=path_jabberit;var _dialogs=[];function build(pObj)
+{var _window=getElement(pObj.id_window+'__parent');_xtools=new xtools(path);if(_window==null)
+{pObj.width=((pObj.width>160)?pObj.width:160);pObj.height=((pObj.height>80)?pObj.height:80);pObj.onclick="_winBuild('"+pObj.id_window+"', '"+pObj.closeAction+"')";_window=document.createElement("div");_window.id=pObj.id_window+"__parent";_window.setAttribute("onselectstart","return false");_window.style.width=pObj.width+"px";_window.style.height=pObj.height+"px";_window.style.top=pObj.top+"px";_window.style.left=pObj.left+"px";_window.style.position="absolute";_window.style.zIndex=pObj.zindex;_window.innerHTML=_xtools.parse(_xtools.xml('window_main'),'window.xsl',pObj);if(pObj.closeAction=="hidden")
+_window.setAttribute("leftOld",pObj.left+"px");if(pObj.leftOld)
+_window.setAttribute("leftOld",pObj.leftOld+"px");window.document.body.insertBefore(_window,document.body.lastChild);if(pObj.content.constructor==String)
+getElement(pObj.id_window+'__content').innerHTML=pObj.content;else
+getElement(pObj.id_window+'__content').appendChild(pObj.content);_dialogs[pObj.id_window]=getElement(pObj.id_window+'__content').firstChild;if(pObj.draggable)
+{dragDrop=new _drag_drop();dragDrop.set(pObj.id_window);}}
+else
+{if(pObj.barejid&&loadscript.windowPOPUP(pObj.barejid))
+return false;load(pObj.id_window,"display");}}
+function getElement(pElement)
+{return document.getElementById(pElement);}
+function load(pId,pVisible)
+{var _window=document.getElementById(pId+'__parent')
+if(_window!=null)
+{if(pVisible=="display")
+{if(_window.style.left=="-1500px")
+_window.style.left=_window.getAttribute("leftOld");}
+if(pVisible=="hidden")
+{_window.setAttribute("leftOld",_window.style.left);_window.style.left="-1500px";}
+if(pVisible=="remove")
+{document.body.removeChild(_window);}}}
+function _window()
+{if(arguments.length>0)
+{var pId=null;if(arguments.length==1)
+{var obj=arguments[0];pId=obj.id_window
+build(obj);}
+if(arguments.length==2)
+{load((pId=arguments[0]),arguments[1]);}}
+return(new function()
+{this.content=function()
+{if(arguments.length)
+getElement(pId+'__content').appendChild(_dialogs[pId]);return _dialogs[obj.id_window];};});}
+window.bWindow=_window;})();function _winBuild()
+{if(arguments.length>0)
+{if(arguments.length==1)
+return bWindow(arguments[0]);if(arguments.length==2)
+return bWindow(arguments[0],arguments[1]);}
+return false;}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/js/dragdrop.js	(revision 4453)
@@ -0,0 +1,210 @@
+(function()
+{
+	var _element	= null;
+	var _elementA	= null;
+	var _elementB	= null;
+	var _parent		= null;
+
+	function _configEvent( pObj, pEvent, pHandler )
+	{
+		if ( pObj && typeof pObj == 'object' )
+		{
+			if ( pEvent.substring(0, 2) == 'on' )
+				pEvent = pEvent.substring(2, pEvent.length);
+	
+			if ( arguments.length == 3 )
+			{
+				if ( pObj.addEventListener )
+					pObj.addEventListener(pEvent, pHandler, false);
+				else if ( pObj.attachEvent )
+					pObj.attachEvent('on' + pEvent, pHandler);
+			}
+			else if ( arguments.length == 4 )
+			{
+				if ( pObj.removeEventListener )
+				{
+					pObj.removeEventListener( pEvent, pHandler, false );
+				}
+				else if ( pObj.detachEvent )
+				{
+					pObj.detachEvent( 'on' + pEvent, pHandler );
+				}
+			}
+		}
+	}
+
+	function _drag(e)
+	{
+		if (typeof e.preventDefault != 'undefined')
+			e.preventDefault();
+		else
+			e.onselectstart = new Function("return false;");
+
+		_element = ( e.target ) ? e.target : e.srcElement;
+
+		if ( _element )
+		{
+			_configEvent(_element, 'onmousemove', _mouseMove);
+			_configEvent(top.document, 'onmousemove', _mouseMove);
+
+			_configEvent(_element, 'onmouseup', _mouseUp);
+			_configEvent(top.document, 'onmouseup', _mouseUp);
+		}
+	}
+
+	function _elementShadow( pId )
+	{
+		if( _elementA )
+		{
+			var _elShadow 			= document.createElement("div");
+			_elShadow.id 			= _elementA.id + "__Shadow";
+			_elShadow.setAttribute("onselectstart" , "return false");
+			_elShadow.style.width	= _elementA.style.width;
+			_elShadow.style.height	= _elementA.style.height;
+			_elShadow.style.top		= _elementA.style.top;
+			_elShadow.style.left	= _elementA.style.left;
+			_elShadow.style.zIndex	= _elementA.style.zIndex;
+			_elShadow.className		= "x-shadow_Div";
+			
+			return _elShadow;
+		}
+	}
+
+	function _load()
+	{
+		if( arguments.length > 0 )
+		{
+			var pId = arguments[0];
+			
+			_configEvent(document.getElementById( pId + "__draggable"), 'onmousedown', _mouseDownShadow);
+		}
+	}
+
+	function _getMouseOffset(e, el)
+	{
+		var docPos = _getPosition(el);
+		var mousePos = _mouseCoords(e);
+		return {
+			'x' : mousePos.x - docPos.x,
+			'y' : mousePos.y - docPos.y
+		};
+	}
+
+	function _getPosition(_pObject)
+	{
+		var left = 0;
+		var top  = 0;
+
+		while ( _pObject.offsetParent )
+		{
+			left += _pObject.offsetLeft;
+			top  += _pObject.offsetTop;
+			_pObject = _pObject.offsetParent;
+		}
+
+		left += _pObject.offsetLeft;
+		top  += _pObject.offsetTop;
+
+		return {
+			'x' : left,
+			'y' : top
+		};
+	}
+
+	function _mouseCoords(ev)
+	{
+		var CoordX = "";
+		var CoordY = "";
+
+		if ( ev.pageX || ev.pageY )
+			return {
+				'x' : ev.pageX,
+				'y' : ev.pageY
+			};
+
+		CoordX = ev.clientX + document.body.scrollLeft - document.body.clientLeft;
+		CoordY = ev.clientY + document.body.scrollTop  - document.body.clientTop;
+		
+		return {
+			'x' : CoordX,
+			'y' : CoordY
+		};
+	}
+
+	function _mouseMove(e)
+	{
+		if ( _element )
+		{
+			if ( _element.mouseOffset == null )
+				_element.mouseOffset = _getMouseOffset(e, _element);
+
+			var mousePos = _mouseCoords(e);
+
+			var x = mousePos.x - _element.mouseOffset.x;
+			var y = mousePos.y - _element.mouseOffset.y;
+			_element.style.left = (( x < 0 ) ? 0 : x) + 'px';
+			_element.style.top  = (( y < 0 ) ? 0 : y) + 'px';
+		}
+	}
+
+	function _mouseUp()
+	{
+		if ( _element )
+		{
+			_configEvent(_element, 'onmousemove', _mouseMove, 'remove');
+			_configEvent(top.document, 'onmousemove', _mouseMove, 'remove');
+
+			_configEvent(_element, 'onmouseup', _mouseUp, 'remove');
+			_configEvent(top.document, 'onmouseup', _mouseUp, 'remove');
+
+			_element.mouseOffset = null;
+			_mouseUpShadow();
+		}
+	}
+
+	function _mouseDownShadow(e)
+	{
+		try
+		{
+			if( arguments.length > 0 )
+			{
+				var _el = ( e.target ) ? e.target : e.srcElement;
+				var _id = (_el.id.substring(0, _el.id.indexOf("__draggable")));	
+				
+				_elementA = document.getElementById( _id + "__parent");
+				_elementB = _elementShadow( _id + "__parent");
+				
+				_elementA.style.left = '-1500px';
+				_parent	  = _elementA.parentNode;
+				
+				var _B = _parent.appendChild(_elementB);
+				
+				_configEvent( _elementB, 'onmouseup', _mouseUpShadow);
+				_configEvent( _elementB, 'onmousemove', _drag);
+			}
+			
+		}catch(e){}
+	}
+
+	function _mouseUpShadow()
+	{
+		try
+		{
+			_elementA.style.top		= _elementB.style.top;
+			_elementA.style.left	= _elementB.style.left;
+			
+			var _B = _parent.removeChild(_elementB);
+
+			_elementA = null;
+			_elementB = null;
+			_element = null;
+		}
+		catch(e){}
+	}
+	
+	function _drag_drop(){}
+
+	_drag_drop.prototype.set 	= _load;
+	window._drag_drop = _drag_drop;
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/common.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/common.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/common.css	(revision 4453)
@@ -0,0 +1,124 @@
+/* IM:WINDOW - ADD USER */
+
+div.add_organization_members
+{
+	margin-bottom: 30px;
+}
+
+div.add_organization_members span
+{
+	border-bottom: 1px solid #809aa9;
+	float:left;
+	font-size: 8pt !important;
+	font-family: Arial, Verdana, helvetica, sans-serif !important;
+	font-weight: bold;
+	position:aboslute;
+	width: 200px;
+}
+
+div.add_organization_members div
+{
+	font-weight: normal;
+	margin: 2px;
+	padding: 3px;
+	height: 230px;
+	overflow: auto;
+}
+
+div.add_organization_members div span
+{
+	background: url(../images/photo.png) no-repeat;
+	border-bottom: 1px dashed #809aa9;
+	clear:both;
+	float:left;
+	font-weight: normal;
+	height: 65px;
+	letter-spacing: 0.2em;
+	padding: 4px 0 4px 80px;
+	margin-bottom: 20px;
+	width: 300px;
+}
+
+div.add_organization_members div#im_ldap_ou
+{
+	float: left;
+	width: 200px;
+}
+
+div.add_member_info
+{
+	margin: 10px 0px 0px 0px;
+}
+
+div.add_member_info span
+{
+	float: left;
+	font: 9pt Verdana, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	margin-right: 3px;
+	text-align: right;
+	width: 80px;
+}
+
+div.search_user 
+{
+	font-size: 8pt !important;
+	font-family: Arial, Verdana, helvetica, sans-serif !important;
+	font-weight: bold;
+	margin: 0 0 0 5px;
+}
+
+.search_user_button
+{
+	border: 1px solid #000 !important;
+}
+
+span.im_button
+{
+	background: #dedede;
+	border: 1px solid;
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	letter-spacing: 1px;
+	padding: 0 15px;
+	text-align: center;
+	line-height: 1.5em;
+}
+
+div.loading
+{
+	background: #fdd url(../images/loading.gif) no-repeat 1px 1px;
+	border: 1px dashed #f00;
+	margin:	2px;
+	padding: 3px 3px 3px 20px;
+	text-align: center;
+}
+
+span.message_time
+{
+	color: #aaa;
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+}
+
+.font_menu
+{
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+}
+
+.layer
+{
+	background: url(../images/photo.png) no-repeat 2px 2px;
+	border:	1px solid #dedede;
+	height: 65px;
+	margin:	2px;
+	padding: 2px 0px 2px 54px;
+}
+
+/* Disconnected */
+
+.disconnected
+{
+	font: 9pt Verdana, Arial, Helvetica, sans-serif;
+	border: 1px solid #dedede;
+	margin: 2px;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_escritorio.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_escritorio.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_escritorio.css	(revision 4453)
@@ -0,0 +1,332 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #a7b9e7 !important;
+	border : 1px solid #1e4098; 
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #1e4098;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#1e4098;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #1e4098;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#1e4098;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#1e4098;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#1e4098;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/escritorio/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/escritorio/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/escritorio/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/escritorio/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/escritorio/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/escritorio/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/escritorio/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#1e4098;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/escritorio/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/escritorio/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#fff;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/selectEditableStyle.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/selectEditableStyle.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/selectEditableStyle.css	(revision 4453)
@@ -0,0 +1,49 @@
+	.selectBoxArrow
+	{
+		margin-top:1px;
+		float:left;
+		position:absolute;
+		right:1px;
+
+	}	
+	
+	.selectBoxInput
+	{
+		font-family: Verdana, Helvetica, sans;
+		font-size: 11px !important;
+		border:0px !important;
+		padding-left:1px;
+		height:16px;
+		position:absolute;
+		bottom:0px;
+		left:0px;
+	}
+
+	.selectBox
+	{
+		border:1px solid #cecece !important;
+		height:20px;	
+	}
+	
+	.selectBoxOptionContainer
+	{
+		position:absolute;
+		border:1px solid #cecece !important;
+		font-size:12px;
+		background-color:#FFF;
+		left:-1px;
+		top:20px;
+		visibility:hidden;
+		height: 100px;
+		overflow-y:auto;
+	}
+
+	.selectBoxAnOption
+	{
+		font-family: Verdana, Helvetica, sans;
+		font-size:12px;
+		cursor:default;
+		margin:1px;
+		overflow:hidden;
+		white-space:nowrap;
+	}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_cataratas.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_cataratas.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_cataratas.css	(revision 4453)
@@ -0,0 +1,327 @@
+.x-menu
+{
+	background-color : #98c17f !important;
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #98c17f !important; 
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #98c17f !important;
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #4c9b1d !important;
+	border : 1px solid #7bc64e;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #7bc64e;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#7bc64e;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #7bc64e;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#7bc64e;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#7bc64e;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#7bc64e;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/cataratas/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/cataratas/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/cataratas/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/cataratas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/cataratas/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/cataratas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/cataratas/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+	border:1px solid;
+	border-color:#7bc64e;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/cataratas/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/cataratas/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#ffffed;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/button.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/button.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/button.css	(revision 4453)
@@ -0,0 +1,176 @@
+.x-btn
+{
+	-x-system-font:none;
+	font-family:tahoma,verdana,helvetica;
+	font-size:11px;
+	font-size-adjust:none;
+	font-stretch:normal;
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	line-height:normal;
+	white-space:nowrap;
+}
+
+.x-btn td 
+{
+	padding:0 !important;
+}
+
+.x-btn-tl, .x-btn-tr, .x-btn-tc, .x-btn-ml, .x-btn-mr, .x-btn-mc, .x-btn-bl, .x-btn-br, .x-btn-bc 
+{
+	background-image: url(../images/btn.gif) !important;
+}
+
+.x-btn-tl 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 0;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-tr i, .x-btn-tl i, .x-btn-br i, .x-btn-bl i
+{
+	height:3px;
+}
+
+.x-btn-tc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -6px;
+	height:3px;
+}
+
+.x-btn-tr 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px 0;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-tr i, .x-btn-tl i, .x-btn-mr i, .x-btn-ml i, .x-btn-br i, .x-btn-bl i
+{
+	display:block;
+	font-size:1px;
+	line-height:1px;
+	overflow:hidden;
+	width:3px;
+}
+
+.x-btn-ml
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 -24px;
+	width:3px;
+}
+
+.x-btn-mc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -1096px;
+	cursor:pointer;
+	padding:0 5px;
+	text-align:center;
+	vertical-align:middle;
+	white-space:nowrap;
+}
+
+.x-btn em
+{
+	font-style:normal;
+	font-weight:normal;
+}
+
+.x-btn-noicon .x-btn-small .x-btn-text
+{
+	height:16px;
+}
+
+.x-btn button
+{
+	-x-system-font:none;
+	font-family:arial,tahoma,verdana,helvetica;
+	font-size:11px;
+	font-size-adjust:none;
+	font-stretch:normal;
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	line-height:normal;
+}
+
+.x-btn button 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat scroll 0 0;
+	border:0 none !important;
+	cursor:pointer;
+	margin:0;
+	outline-color:-moz-use-text-color;
+	outline-style:none;
+	outline-width:0;
+	overflow:visible;
+	padding-left:3px;
+	padding-right:3px;
+	width:auto;
+}
+
+.x-btn-text
+{
+	color: #000 !important;
+	cursor:pointer;
+	padding:0;
+	white-space:nowrap;
+}
+
+.x-btn-mr
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px -24px;
+	width:3px;
+}
+
+.x-btn-bl
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 -3px;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-bc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -15px;
+	height:3px;
+}
+
+.x-btn-br
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px -3px;
+	height:3px;
+	width:3px;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_default.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_default.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_default.css	(revision 4453)
@@ -0,0 +1,331 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cecece;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #e8e6e6 !important;
+	border : 1px solid #918b8b;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #918b8b;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#918b8b;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #918b8b;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#918b8b;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#918b8b;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#918b8b;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/default/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/default/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/default/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#918b8b;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/default/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/default/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#585656;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_metropole.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_metropole.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_metropole.css	(revision 4453)
@@ -0,0 +1,332 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #404040 !important;
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #404040 !important;
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #404040 !important; 
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #4a79b1 !important;
+	border : 1px solid #000;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #4a79b1;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#4a79b1;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #4a79b1;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#4a79b1;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#4a79b1;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#4a79b1;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/metropole/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/metropole/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/metropole/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/metropole/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/metropole/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/metropole/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/metropole/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#4a79b1;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/metropole/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/metropole/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#fffcdf;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_azul.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_azul.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_azul.css	(revision 4453)
@@ -0,0 +1,329 @@
+.x-menu
+{
+	background-color : #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #96bdf3 !important;
+	border : 1px solid #8ea4c1;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #99bbe8;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#99bbe8;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #99bbe8;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#99bbe8;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#99bbe8;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#99bbe8;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/azul/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/azul/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/azul/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/azul/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/azul/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/azul/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/azul/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#99bbe8;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/azul/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/azul/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#15428b;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_celepar.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_celepar.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_celepar.css	(revision 4453)
@@ -0,0 +1,331 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cecece;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #e8e6e6 !important;
+	border : 1px solid #918b8b;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #918b8b;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#918b8b;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #918b8b;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#918b8b;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#918b8b;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#918b8b;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/default/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/default/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/default/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#918b8b;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/default/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/default/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#585656;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_comics.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_comics.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_comics.css	(revision 4453)
@@ -0,0 +1,331 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #fff !important;
+	border		: 1px solid #000;
+	color		: #000 !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #fff !important;
+	border		: 1px solid #000;
+	color		: #000 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #fff !important; 
+	border		: 1px solid #000; 
+	color		: #000 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #f4f2f2 !important;
+	border : 1px solid #000;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #000000;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#000000;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #000000;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#000000;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#000000;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#000000;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/comics/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	/*display		: block;*/
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/comics/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/comics/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/comics/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/comics/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/comics/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/comics/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#000000;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/comics/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/comics/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#000000;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_rochas.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_rochas.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/jmessenger/templates/default/css/window_rochas.css	(revision 4453)
@@ -0,0 +1,330 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cfb69e !important;
+	border		: 1px solid #bd8d5d;
+	color		: #000 !important;
+	display		: none;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cfb69e !important;
+	border		: 1px solid #bd8d5d;
+	color		: #000 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cfb69e !important;
+	border		: 1px solid #bd8d5d; 
+	color		: #000 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #f4dcc4 !important; 
+	border : 1px solid #bd8d5d;  
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #bd8d5d;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#bd8d5d;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #bd8d5d;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#bd8d5d;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#bd8d5d;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#bd8d5d;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/rochas/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/rochas/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/rochas/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/rochas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/rochas/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/rochas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/rochas/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+	border:1px solid;
+	border-color:#bd8d5d;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/rochas/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/rochas/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#000;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/default.xml
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/default.xml	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/default.xml	(revision 4453)
@@ -0,0 +1,42 @@
+<?xml version='1.0'?>
+<preferences>
+	<!-- Message Receive -->
+	<preference key="jeti.toFrontOnNewMessage" value="false"/>
+	
+	<!-- File Transfer -->
+	<preference key="filetransfer.closeOnComplete" value="true"/>
+	<preference key="filetransfer.useLocalIP" value="true"/>
+	
+	<!--Main Jeti menu-->
+	<preference key="jeti.jetimenuShowMessage" value="false"/>
+	<preference key="jeti.jetimenuShowAccount" value="false"/>
+	<preference key="jeti.jetimenuShowOptions" value="false"/>
+	<preference key="jeti.jetimenuShowLog" value="false"/>
+	<preference key="jeti.jetimenuShowAddContact" value="false"/>
+	<preference key="jeti.jetimenuShowChat" value="false"/>
+	<preference key="jeti.jetimenuShowExit" value="false"/>
+	<preference key="jeti.jetimenuShowComment" value="false"/>
+
+	<!--Roster menu-->
+	<preference key="jeti.rostermenuShowMessage" value="false"/>
+	<preference key="jeti.rostermenuShowChat" value="false"/>
+	<preference key="jeti.rostermenuSubscriptions" value="true"/>
+	<preference key="jeti.rostermenuRemove" value="true"/>
+	<preference key="jeti.rostermenuRename" value="true"/>
+	<preference key="jeti.rostermenuGroup" value="true"/>
+	<preference key="jeti.rostermenuLocalTime" value="false"/>
+	<preference key="jeti.rostermenuLocalVersion" value="false"/>
+	<preference key="jeti.rostermenuLastSeen" value="false"/>
+	<preference key="jeti.rostermenuInvisible" value="false"/>
+	<preference key="jeti.language" value="pt"/>
+	<preference key="jeti.jetiShowError" value="false"/>
+	<preference key="jeti.hideLoginWindow" value="false"/>
+
+	<!--Hide the server selection box-->
+	<preference key="jeti.hideServerSelect" value="true"/>
+	<!--Hide the port and ssl selection in the login window-->
+	<preference key="jeti.hidePortSelect" value="true"/>
+	<!--Hide the resource input field-->
+	<preference key="jeti.hideResourceInput" value="true"/>
+	<!--Hide the register button-->
+</preferences>
Index: /branches/2.2.0.1/jabberit_messenger/client.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/client.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/client.php	(revision 4453)
@@ -0,0 +1,24 @@
+<?php
+   /*****************************************************
+	* Applet - JabberIt
+ 	* Colaboradores : Alexandre Correia / Rodrigo Souza
+	*
+	***************************************************/
+	
+	if( file_exists("../header.session.inc.php"))
+		require_once("../header.session.inc.php");
+	else if(file_exists("../../header.session.inc.php"))
+		require_once("../../header.session.inc.php");
+	
+	$currentApp = ($_SESSION['phpgw_info']['expresso']['currentapp']) ? $_SESSION['phpgw_info']['expresso']['currentapp'] : "jabberit_messenger";
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+							'currentapp' => $currentApp,
+							'nonavbar'   => true,
+							'noheader'   => true
+						);
+	require_once("../header.inc.php");
+	
+	require_once(dirname(__FILE__)."/inc/login.php");
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/options.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/options.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/options.xsl	(revision 4453)
@@ -0,0 +1,18 @@
+<?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:param name="style" />
+
+	<xsl:template match="/">
+
+		<dl style="margin:0;">
+			<xsl:apply-templates select="." mode="option" />
+		</dl>
+	</xsl:template>
+
+	<xsl:template match="option" mode="option">
+		<dt style="{style}" onmouseover="elementOnMouseOver(this);" onmouseout="elementOnMouseOut(this);"><xsl:value-of select="item"/></dt>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/tableExternalParticipants.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/tableExternalParticipants.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/tableExternalParticipants.xsl	(revision 4453)
@@ -0,0 +1,23 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	
+	<xsl:template match="/">
+		<table id="tableExternalParticipantsJabberit" cellspacing="2" style="width:100%">
+			<tr>
+				<td align="left" class="row_on"><xsl:value-of select="$lang1" /></td>
+				<td align="left" class="row_on" style="width:30% !important"><xsl:value-of select="$lang2" /></td>
+			</tr>
+			<xsl:for-each select="return/ou	">
+				<tr id="{.}" style="width:40%" class="row_off">
+					<td><xsl:value-of select="." /></td>
+					<td><a href="javascript:constructScript.removePartExternal('{.}');"><xsl:value-of select="$lang2" /></a></td>
+				</tr>
+			</xsl:for-each>
+		</table>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/tableConfServersJabber.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/tableConfServersJabber.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/tableConfServersJabber.xsl	(revision 4453)
@@ -0,0 +1,30 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="lang3" />
+	<xsl:param name="lang4" />
+	
+	<xsl:template match="/">
+		<table id="tableConfServersJabber" cellspacing="2" style="width:100%">
+			<tr style="width:60%">
+				<td align="left" class="row_on" style="width:40%"><xsl:value-of select="$lang1" /></td>
+				<td align="left" class="row_on" style="width:40% !important"><xsl:value-of select="$lang2" /></td>
+				<td align="left" class="row_on" style="width:10% !important"><xsl:value-of select="$lang4" /></td>					
+				<td align="left" class="row_on" style="width:10% !important"><xsl:value-of select="$lang3" /></td>				
+			</tr>
+			<xsl:for-each select="return/confServer">
+				<tr id="{.}" style="width:40%" class="row_off">
+					<td><xsl:value-of select="@ou" /></td>
+					<td><xsl:value-of select="@serverName" /></td>
+					<td><a href="javascript:constructScript.editHostsJ('{.}');"><xsl:value-of select="$lang4" /></a></td>
+					<td><a href="javascript:constructScript.removeHostsJ('{.}');"><xsl:value-of select="$lang3" /></a></td>
+				</tr>
+			</xsl:for-each>
+		</table>
+		
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizationsEnabledGroupsJabberit.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizationsEnabledGroupsJabberit.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizationsEnabledGroupsJabberit.xsl	(revision 4453)
@@ -0,0 +1,23 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	
+	<xsl:template match="/">
+		<table id="tableOrganizationsEnabledGroupsJabberit" cellspacing="2" style="width:100%">
+			<tr class="th">
+				<td align="left" class="row_on"><xsl:value-of select="$lang1" /></td>
+				<td align="left" class="row_on" style="width:30% !important"><xsl:value-of select="$lang2" /></td>
+			</tr>
+			<xsl:for-each select="return/ou	">
+				<tr id="{.}" style="width:40%" class="row_off">
+					<td class="row_on"><xsl:value-of select="." /></td>
+					<td class="row_on" style="width:30% !important"><a href="javascript:constructScript.removeOrgGroupsLocked('{.}');"><xsl:value-of select="$lang2"/></a></td>
+				</tr>
+			</xsl:for-each>
+		</table>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/buttons.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/buttons.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/buttons.xsl	(revision 4453)
@@ -0,0 +1,67 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="onclickClose" />
+	<xsl:param name="onclickSubmit" />
+	
+	<xsl:template match="buttons_main">
+		<table cellspacing="2">
+			<tr>
+				<td>
+					<table cellspacing="0" class="x-btn  x-btn-noicon" style="width: 75px;">
+						<tbody class="x-btn-small x-btn-icon-small-left">
+						<tr>
+							<td class="x-btn-tl"><i> </i></td>
+							<td class="x-btn-tc"></td>
+							<td class="x-btn-tr"><i> </i></td>
+						</tr>
+						<tr>
+							<td class="x-btn-ml"><i> </i></td>
+							<td class="x-btn-mc" onclick="{$onclickSubmit};">
+								<em unselectable="on">
+									<button type="button" class="x-btn-text"><xsl:value-of select="$lang1"/></button>
+								</em>
+							</td>
+							<td class="x-btn-mr"><i> </i></td>
+						</tr>
+						<tr>
+							<td class="x-btn-bl"><i> </i></td>
+							<td class="x-btn-bc"></td>
+							<td class="x-btn-br"><i> </i></td>
+						</tr>
+						</tbody>
+					</table>
+				</td>
+				<td>
+					<table cellspacing="0" class="x-btn  x-btn-noicon" style="width: 75px;">
+						<tbody class="x-btn-small x-btn-icon-small-left">
+							<tr>
+								<td class="x-btn-tl"><i> </i></td>
+								<td class="x-btn-tc"></td>
+								<td class="x-btn-tr"><i> </i></td>
+							</tr>
+							<tr>
+								<td class="x-btn-ml"><i> </i></td>
+								<td class="x-btn-mc"  onclick="{$onclickClose};">
+									<em unselectable="on">
+										<button type="button" class="x-btn-text"><xsl:value-of select="$lang2"/></button>
+									</em>
+								</td>
+								<td class="x-btn-mr"><i> </i></td>
+							</tr>
+							<tr>
+								<td class="x-btn-bl"><i> </i></td>
+								<td class="x-btn-bc"></td>
+								<td class="x-btn-br"><i> </i></td>
+							</tr>
+						</tbody>
+					</table>
+				</td>
+			</tr>
+		</table>
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizations.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizations.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/tableOrganizations.xsl	(revision 4453)
@@ -0,0 +1,27 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="lang3" />
+	
+	<xsl:template match="/">
+		<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 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>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/contacts_jabberit.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/contacts_jabberit.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/contacts_jabberit.xsl	(revision 4453)
@@ -0,0 +1,14 @@
+<?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:param name="path" />
+	<xsl:param name="width" />
+
+	<xsl:template match="contacts_jabberit">
+	
+		<iframe id="iframe_applet_jabberit" style="position:fixed;" src="{$path}client.php" frameborder="0" width="{$width}" height="400px"></iframe>
+		
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_org.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_org.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_org.xsl	(revision 4453)
@@ -0,0 +1,12 @@
+<?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="organizations">
+		<xsl:for-each select="ou">
+			<xsl:sort select="." case-order="upper-first" />
+			<span><xsl:value-of select="." /></span><br/>
+		</xsl:for-each>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/preferences_jabberit.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/preferences_jabberit.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/preferences_jabberit.xsl	(revision 4453)
@@ -0,0 +1,51 @@
+<?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:param name="path" />
+	<xsl:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="lang3" />
+	<xsl:param name="lang4" />	
+	<xsl:param name="lang5" />	
+	<xsl:param name="lang8" />
+	<xsl:param name="lang9" />
+	<xsl:param name="lang10" />
+	<xsl:param name="lang11" />
+	<xsl:param name="lang12" />
+	<xsl:param name="langYes" />
+	<xsl:param name="langNo" />		
+	
+	<xsl:template match="preferences_jabberit">
+		<fieldset style="margin:3px; padding:5px;border:1px solid #cecece;">
+			<legend><xsl:value-of select="$lang1"/></legend>
+			<fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang2"/></legend>	
+				<br/>
+				<label><xsl:value-of select="$lang3"/> .: </label>
+				<select id="openWindowJabberit">
+					<option value="true"><xsl:value-of select="$langYes"/></option>
+					<option value="false"><xsl:value-of select="$langNo"/></option>					
+				</select>
+			</fieldset>
+			<fieldset style="height:60px;margin-bottom:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang8"/></legend>
+				<br/>
+				<label><xsl:value-of select="$lang9"/> .: </label>
+				<select id="openWindowJabberitPopUp">
+					<option value="true"><xsl:value-of select="$langYes"/></option>
+					<option value="false"><xsl:value-of select="$langNo"/></option>
+				</select>
+			</fieldset>
+			<fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;">
+				<legend><xsl:value-of select="$lang10"/></legend>			
+				<br/>
+				<label><xsl:value-of select="$lang11"/><input id="flagAwayIM" type="text" size="2" maxlength="2" style="margin-left:4px; margin-right:4px;" onclick="this.select();" /><xsl:value-of select="$lang12"/></label>
+			</fieldset>
+		</fieldset>
+
+		<div id="buttons_preferences_jabberit" style="margin:5px;padding:5px;cellpadding:5px;"/>
+		
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/add_user.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/add_user.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/add_user.xsl	(revision 4453)
@@ -0,0 +1,51 @@
+<?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:param name="lang1" />
+	<xsl:param name="lang2" />
+	<xsl:param name="lang3" />
+	<xsl:param name="lang4" />
+	<xsl:param name="lang5" />
+	<xsl:param name="lang6" />
+	<xsl:param name="lang7" />
+	
+	<xsl:template match="userinfo">
+		
+		<div style="margin:2px">
+			<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 0px;"/>
+				<input type="image" src='../jabberit_messenger/templates/default/images/users.png' value="{$lang2}" onclick="javascript:loadscript.search(this);" />
+			</div>
+			<br/>
+			<div class="add_organization_members">
+				<span style="margin: 5px; width:auto;"><xsl:value-of select="$lang3"/> .: </span>
+				<br style="clear:both"/>
+				<div id="im_ldap_user"></div>
+			</div>
+		</div>
+
+		<span id="im_status_add" style="color:#f00;"></span>
+		<span id="__span_load_im" style="background-color:#cc4444;color:white;display:none;position:absolute;right:5px;top:26px">Carregando .....</span>
+		<input id="im_jidUser" type="hidden" />
+		<input id="im_jid" type="hidden" />
+		<input id="im_uid" type="hidden" />
+
+	</xsl:template>
+	
+	<xsl:template match="adduser">
+		
+		<div class="add_member_info">
+			<span><xsl:value-of select="$lang4"/> : </span>
+			<input id="im_name" type="text" size="39" maxlength="50" onclick="this.select();"/>
+			<br/><br style="line-height:4px"/>
+			<span><xsl:value-of select="$lang5"/> : </span>
+			<input id="im_group" type="text" size="40" maxlength="50" selectboxoptions="" onclick="this.select();"/>
+		</div>
+		
+		<div id="buttons_adduser" style="padding-top:30px; padding-bottom: 30px; margin-left: 83px;"/>
+	
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/window.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/window.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/window.xsl	(revision 4453)
@@ -0,0 +1,64 @@
+<?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:param name = "id_window" />
+	<xsl:param name = "left" />	
+	<xsl:param name = "height" />
+	<xsl:param name = "onclick" />
+	<xsl:param name = "title" />
+	<xsl:param name = "top" />
+	<xsl:param name = "width" />
+	<xsl:param name = "zindex" />
+	
+	<xsl:template match="window_main">
+			
+			<!-- Principal -->
+			<div id="{$id_window}__main" style="z-index: {($zindex)+1}; width: {$width}px;" class="x-window">
+				<div class="x-window-tl">
+					<div class="x-window-tr">
+						<div class="x-window-tc">
+							<div id="{$id_window}__draggable" style="-moz-user-select: none; width: {($width)-31}px;" class="x-window-header x-unselectable x-window-draggable">
+								<xsl:value-of select="$title"/>
+							</div>
+							<div class="x-tool x-tool-close" onclick="{$onclick}"></div>
+						</div>
+					</div>
+				</div>
+				<div class="x-window-bwrap">
+					<div class="x-window-ml">
+						<div class="x-window-mr">
+							<div class="x-window-mc">
+								<div style="width: {($width)-14}px; height: {($height)-32}px;" class="x-window-body">
+									<div style="width: {($width)-14}px;" class="x-tab-panel x-tab-panel-noborder">
+										
+										<!-- Conteudo -->
+										<div class="x-tab-panel-bwrap">
+											<div style="width: {($width)-14}px; height: {$height}px;" class="x-tab-panel-body x-tab-panel-body-noborder x-tab-panel-body-top">
+												<div style="width: {($width)-14}px;" class="x-panel x-panel-noborder">
+													<div class="x-panel-bwrap">
+														<div style="width: {($width)-14}px; height: {($height)-34}px;" class="x-panel-body x-panel-body-noheader x-panel-body-noborder">
+															<div id="{$id_window}__content">
+															</div>
+														</div>
+													</div>
+												</div>
+											</div>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+					
+					<div class="x-window-bl x-panel-nofooter">
+						<div class="x-window-br">
+							<div class="x-window-bc"></div>
+						</div>
+					</div>
+				</div>
+			</div>
+			
+	</xsl:template>
+	
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_contacts.xsl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_contacts.xsl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/xsl/list_ldap_contacts.xsl	(revision 4453)
@@ -0,0 +1,45 @@
+<?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:param name="lang_addContact" />
+	<xsl:param name="lang_empty" />
+	<xsl:param name="lang_error" />
+	<xsl:param name="lang_many_results" />
+	
+	<xsl:template match="/">
+
+		<xsl:if test="error">
+			<label style="color:red;"><xsl:value-of select="$lang_error" /></label>
+		</xsl:if>
+		
+		<xsl:if test="empty">
+			<label style="color:red;"><xsl:value-of select="$lang_empty" /></label>
+		</xsl:if>
+		
+		<xsl:if test="manyresults">
+			<label style="color:red;"><xsl:value-of select="$lang_many_results" /></label>
+		</xsl:if>
+
+		<xsl:if test="uids">
+			<xsl:apply-templates select="uids/*" mode="uids" />
+		</xsl:if>
+		
+	</xsl:template>
+
+	<xsl:template match="*" mode="uids">
+		<xsl:for-each select="data">
+			<xsl:sort select="cn"/>
+			<span value="{mail};{uid}" jid="{jid}" ou="{ou}" photo="{photo}">
+				<span id="{mail};{uid}" style="display:none;"><xsl:value-of select="cn" /></span>
+				<b><xsl:value-of select="name(..)"/></b>
+				<br/><xsl:value-of select="cn" />
+				<br/>
+				<br/>
+				<label id="__label__{mail};{uid}" style="color:blue;cursor:pointer;"><xsl:value-of select="$lang_addContact" /></label>
+				<br/>
+			</span>
+		</xsl:for-each>
+	</xsl:template>
+
+</xsl:stylesheet>
Index: /branches/2.2.0.1/jabberit_messenger/controller.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/controller.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/controller.php	(revision 4453)
@@ -0,0 +1,37 @@
+<?php
+
+if(!isset($GLOBALS['phpgw_info']))
+{
+        $GLOBALS['phpgw_info']['flags'] = array(
+                'currentapp' => 'jabberit_messenger',
+        );
+}
+
+require_once '../header.session.inc.php';
+
+$request_method = '_' . $_SERVER['REQUEST_METHOD'];
+switch ( $request_method )
+{
+	case '_GET' :
+		$params = $_GET;
+	break;
+	case '_POST' :
+		$params = $_POST;
+	break;
+	case '_HEAD' :
+	case '_PUT' :
+	default :
+		echo "controller - request method not avaible";
+		return false;
+}
+
+if( file_exists(dirname(__FILE__) . "/inc/Controller.class.php") )
+{
+	require_once dirname(__FILE__) . '/inc/Controller.class.php';
+
+	$controller = new Controller();
+	printf("%s", $controller->exec($$request_method, dirname(__FILE__)));
+	exit(0);
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupsldap.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupsldap.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupsldap.inc.php	(revision 4453)
@@ -0,0 +1,177 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bogroupsldap.inc.php";
+
+class uigroupsldap
+{
+	private $bo;
+	
+	public $public_functions = array (
+			'edit' => True,
+			'editServersLdap' => True,
+			'setAddGroups' => True
+	);		
+	
+	function __construct()
+	{
+		$this->bo = new bogroupsldap();
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Servidores Jabber';	
+	}
+
+	function edit()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		$ldapInternal = $this->bo->getServerLdapInternal();
+
+		$valueListsLdaps = "";
+		$valueListsLdaps .= "<tr>";
+		$valueListsLdaps .= "<td>&nbsp;".$ldapInternal."</td>";
+		$valueListsLdaps .= "<td><a href='index.php?menuaction=jabberit_messenger.uigroupsldap.editServersLdap&host=".$ldapInternal."'>&nbsp;".lang('View')."</a></td>";
+		$valueListsLdaps .= "</tr>";
+
+		// Ldap Externos		
+		$serversLdap = $this->bo->getServersLdapExternal();
+
+		if(is_array($serversLdap))
+		{
+			foreach($serversLdap as $tmp)
+			{
+				$valueListsLdaps .= "<tr>";	
+				$valueListsLdaps .= "<td>&nbsp;".$tmp['serverLdap']."</td>";	
+				$valueListsLdaps .= "<td><a href='index.php?menuaction=jabberit_messenger.uigroupsldap.editServersLdap&host=".$tmp['serverLdap']."'>&nbsp;".lang('View')."</a></td>";
+				$valueListsLdaps .= "</tr>";
+			}	
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'groupsLdap.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','groups_ldap');	
+		$GLOBALS['phpgw']->template->set_var(array(
+												'action_url_back' => './index.php?menuaction=jabberit_messenger.uiconfig.configPermission',										
+												'label_Back' => "Voltar",
+												'lang_Edit' => lang('View'),
+												'lang_Servers_ldap' => "Servidores Ldap",
+												'value_lists_ldaps' => $valueListsLdaps,
+											));
+
+		$GLOBALS['phpgw']->template->pparse('out','groups_ldap');
+
+	}	
+	
+	function editServersLdap()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
+		
+		$optionsOUS = "<option value='-1'>-- ".lang('Select Organization')." --</option>";	
+		
+		if( ($LdapOus = $this->bo->getOrganizationsLdap($_REQUEST['host'])) )
+		{
+			foreach( $LdapOus as $key => $val )
+				$optionsOUS .= "<option value='".$key."'>".$val."</option>";
+		}
+
+		$optionsGroups = "";
+		
+		if( ($groupsLdaps = unserialize($this->bo->getGroupsSearch())))
+		{
+			if(count($groupsLdaps) > 0 )
+			{
+				foreach( $groupsLdaps as $key => $val )
+				{
+					if( trim($key) == trim($_REQUEST['host']) )
+					{
+						$groups = unserialize($val);
+
+						if( $groups )
+						{
+							natcasesort($groups);
+							
+							foreach($groups as $tmp)
+							{
+								$grp = explode(":", $tmp);
+								$optionsGroups .= "<option value='".$tmp."'>".$grp[0]."</option>";
+							}
+						}						
+					}
+				}
+			}	
+		}
+
+
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'groupsLdap.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','edit_servers');	
+		$GLOBALS['phpgw']->template->set_var(array(
+												'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupsldap.setAddGroups'),										
+												'label_Back'		=> "Voltar",
+												'label_serverLdap'	=> lang("Server Ldap"),
+												'lang_add'			=> lang("add"),
+												'lang_cancel'		=> lang("Cancel"),
+												'lang_description'	=> "Adicione somente os grupos que possuem o módulo JMessenger liberado.",
+												'lang_groups_add'	=> lang("Groups Added"),
+												'lang_groups_ldap'	=> lang("Groups Ldap"),
+												'lang_organizations'	=> lang("Organizations"),
+												'lang_remove'		=> lang("Remove"),
+												'lang_save'			=> lang("Save"),
+												'lang_Search_quick_for'	=> "Busca rápida por",
+												'lang_settings'		=> lang("Settings"),
+												'value_ous_ldap'	=> $optionsOUS,
+												'value_groups_added'	=> $optionsGroups,												
+												'value_serverLdap' 	=> $_REQUEST['host']
+											));
+
+		$GLOBALS['phpgw']->template->pparse('out','edit_servers');
+		
+	}
+	
+	function setAddGroups()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+	
+		if( $_POST['cancel'] )
+		{
+			$this->edit();
+		}
+		
+		if( $_POST['save'])
+		{
+			$serverLdap = array( $_POST['name_serverLdap'] => serialize($_POST['groups_added_jabberit']));
+			$this->bo->setAddGroups($serverLdap);
+			$this->edit();
+		}
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/controller.xml
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/controller.xml	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/controller.xml	(revision 4453)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<controller>
+	<controller-security>
+		<string-access>act</string-access>
+		<string-delimiter>.</string-delimiter>
+	</controller-security>
+	<controller-contentes>
+		<item param="c" section="css" />
+		<item param="j" section="js" />
+		<item param="p" section="php" />
+		<item param="php" section="php" />
+		<item param="xm" section="xml" />
+		<item param="xs" section="xsl" />
+		<item param="t" section="php" />
+		<item param="$this" section="php" />
+	</controller-contentes>
+	<controller-sections>
+		<css></css>
+		<js path="/js" suffix=".js">
+			<item ref="connector" js="connector" />
+			<item ref="editSelect" js="editSelect" />
+			<item ref="groups_ldap" js="groups_ldap" />			
+			<item ref="dragdrop" js="dragdrop" />
+			<item ref="images" js="images" />
+			<item ref="ldap" js="ldap" />
+			<item ref="load" js="load" />
+			<item ref="show_hidden" js="show_hidden" />
+			<item ref="setup" js="setup"/>
+			<item ref="jsloader" js="jsloader" />
+			<item ref="makeW" js="makeW" />
+		</js>
+		<php path="/inc" suffix=".class.php">
+			<item ref="contacts_im" alias="getParticipantsExternal" class="contacts_im" method="getParticipantsExternal" prefix="class." suffix=".inc.php"/>
+			<item ref="contacts_im" alias="list_contacts" class="contacts_im" method="list_contacts" prefix="class." suffix=".inc.php"/>
+			<item ref="contacts_im" alias="verifyAddNewContact" class="contacts_im" method="verifyAddNewContact" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="editHostJabber" class="db_im" method="editHostJabber" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="setHostJabber" class="db_im" method="setHostJabber" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="setOuGroupsLocked" class="db_im" method="setOuGroupsLocked" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="setOrganization" class="db_im" method="setOrganization" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="setUseParticipantsExternal" class="db_im" method="setUseParticipantsExternal" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="removeHostsJabber" class="db_im" method="removeHostsJabber" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="removeOuGroupsLocked" class="db_im" method="removeOuGroupsLocked" prefix="class." suffix=".inc.php"/>
+			<item ref="db_im" alias="removeParticipantsExternal" class="db_im" method="removeParticipantsExternal" prefix="class." suffix=".inc.php"/>
+			<item ref="fileDefine" alias="ldapExternal" class="fileDefine" method="ldapExternal" prefix="class." suffix=".inc.php"/>
+			<item ref="fileDefine" alias="ldapInternal" class="fileDefine" method="ldapInternal" prefix="class." suffix=".inc.php"/>			
+			<item ref="ldap_im" alias="getGroupsLdap" class="ldap_im" method="getGroupsLdap" prefix="class." suffix=".inc.php"/>
+			<item ref="preferences" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/>
+			<item ref="preferences" alias="setPreferences" class="preferencesJMessenger" method="setPreferences" prefix="" suffix=".php"/>
+		</php>
+		<xml></xml>
+		<xsl></xsl>
+	</controller-sections>
+</controller>
Index: /branches/2.2.0.1/jabberit_messenger/inc/webservice.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/webservice.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/webservice.php	(revision 4453)
@@ -0,0 +1,406 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class webService
+{
+	private $attribute;
+	private $conn;
+	private $contextLdap;
+	private $userLDAP;	
+	private $jabberName = null;
+	private $passwd;
+	private $photo_user = array();
+	private $refer;
+	private $serverLdap;
+	private $fileLdapInternal = false;
+	private $fileLdapExternal = false;
+	private $version3;
+	
+	function __construct()
+	{
+		if ( file_exists('confLDAPInternal.php') )
+		{
+			require_once('confLDAPInternal.php');
+			$handle   = unserialize(base64_decode($LDAP_INTERNAL));
+	
+			$this->jabberName	= $handle['jabberName'];
+			$this->serverLdap	= $handle['serverLdap'];
+			$this->contextLdap	= $handle['contextLdap'];
+			$this->userLDAP		= $handle['user'];
+			$this->passwd		= $handle['password'];
+			
+			$this->refer  	= true;
+			$this->version3 = true;
+			
+			$this->fileLdapInternal = true;
+		}
+		
+		$this->attribute = "uid";
+		
+		if ( file_exists('attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
+	}
+	
+	private final function ldapConnect()
+	{
+		if(!function_exists('ldap_connect'))
+			return False;
+		
+		if(!$this->conn = ldap_connect($this->serverLdap))
+			return False;
+
+		if( $this->version3 )
+			if( !ldap_set_option($this->conn,LDAP_OPT_PROTOCOL_VERSION,3) )
+				$this->version3 = false;
+
+		ldap_set_option($this->conn, LDAP_OPT_REFERRALS, $this->refer);
+
+		// Bind as Admin
+		if( $this->userLDAP && $this->passwd && !ldap_bind($this->conn, $this->userLDAP . "," . $this->contextLdap, $this->passwd) )
+			return False;
+		
+		// Bind as Anonymous
+		if( !$this->userLDAP && !$this->passwd && !@ldap_bind($this->conn) )
+			return False;
+	}
+
+	private final function ldapConnectExternal($pHostJabber)
+	{
+		if( file_exists('confLDAPExternal.php'))
+		{ 
+			require_once('confLDAPExternal.php');
+			$handle   = unserialize(base64_decode($LDAP_EXTERNAL));
+			foreach($handle as $itens)
+			{
+				if(trim($pHostJabber) == $itens['jabberName'])
+				{
+					$this->jabberName	= $itens['jabberName'];
+					$this->serverLdap	= $itens['serverLdap'];
+					$this->contextLdap	= $itens['contextLdap'];
+					$this->userLDAP		= $itens['user'];
+					$this->passwd		= $itens['password'];
+					
+					$this->fileLdapExternal = true;
+				}
+			}		
+	
+			$this->refer  	= true;
+			$this->version3 = true;
+			
+			$this->ldapConnect();
+		}
+	}
+	
+	public final function CallVoipConnect($pVoipFrom, $pVoipTo)
+	{
+		$this->ldapConnect();
+
+		if( $this->conn )
+		{
+			$filter  = "(|(&(phpgwaccounttype=u)(uid=".$pVoipFrom."))(&(phpgwaccounttype=u)(uid=".$pVoipTo.")))";
+			$justthese = array("telephoneNumber", "uid");
+			$search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
+			$entry = ldap_get_entries($this->conn,$search);
+
+			$fromNumber = $entry[0]['telephonenumber'][0];
+			$toNumber = $entry[1]['telephonenumber'][0];
+
+			if ( trim($entry[0]['uid'][0]) !== trim($pVoipFrom) )
+			{
+				$fromNumber = $entry[1]['telephonenumber'][0];
+				$toNumber = $entry[0]['telephonenumber'][0];
+			}
+		}
+		
+		if( $fromNumber && $toNumber )
+		{
+			$voipServer	= "www.pabx.celepar.parana";
+			$voipUrl	= "/telefoniaip/servicos/voip.php";
+			$voipPort	= "80";
+	
+			if( !$voipServer || !$voipUrl || !$voipPort )
+				return false;
+			
+			$url		= "http://".$voipServer.":".$voipPort.$voipUrl."?magic=1333&acao=liga&ramal=".$fromNumber."&numero=".$toNumber;
+			$sMethod	= 'GET ';
+			$crlf		= "\r\n";
+			$sRequest	= " HTTP/1.1" . $crlf;
+			$sRequest	.= "Host: localhost" . $crlf;
+			$sRequest	.= "Accept: */* " . $crlf;
+			$sRequest	.= "Connection: Close" . $crlf . $crlf;            
+			$sRequest	= $sMethod . $url . $sRequest;    
+			$sockHttp	= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);            
+			
+			if ( !$sockHttp )
+			    return false;
+			
+			$resSocketConnect = socket_connect($sockHttp, $voipServer, $voipPort);
+			
+			if ( !$resSocketConnect )
+			    return false;
+	
+			$resSocketWrite = socket_write($sockHttp, $sRequest, strlen($sRequest));
+	
+			if ( !$resSocketWrite )
+			    return false;
+	    
+			$sResponse = '';    
+	
+			while ($sRead = socket_read($sockHttp, 512))
+			{
+			    $sResponse .= $sRead;
+			}            
+			
+			socket_close($sockHttp);            
+			
+			$pos = strpos($sResponse, $crlf . $crlf);
+			
+			return substr($sResponse, $pos + 2 * strlen($crlf));
+		}
+		
+		return "ERRO";									
+	}
+	
+	
+	public final function getNameOrganization($pJid, $pCharset)
+	{
+		$uid = substr($pJid, 0, strpos($pJid,"@"));
+		$return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado");
+		
+		if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 )))
+		{
+			$this->ldapConnect();
+
+			if( $this->fileLdapInternal )
+			{
+				if( $this->conn )
+				{
+					$filter = "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese = array($this->attribute,"cn","dn");
+					$search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese);
+					$get_entries = ldap_get_entries( $this->conn, $search);
+		
+					if( $get_entries['count'] > 0 )
+					{					
+						$cn = $get_entries[0]['cn'][0];
+						$ou = explode("dc=", $get_entries[0]['dn']);
+						$ou = explode("ou=",$ou[0]);
+						$ou = array_pop($ou);
+						$dn = strtoupper(substr($ou,0,strlen($ou)-1));
+						$return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn);
+					}
+				}
+			}
+		}
+		else
+		{
+			$this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 ));
+			
+			if( $this->fileLdapExternal )
+			{
+				if( $this->conn )
+				{
+					$filter = "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese = array($this->attribute,"cn","dn");
+					$search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese);
+					$get_entries = ldap_get_entries( $this->conn, $search);
+					
+					if( $get_entries['count'] > 0 )
+					{
+						$cn = $get_entries[0]['cn'][0];
+						$ou = explode("dc=", $get_entries[0]['dn']);
+						$ou = explode("ou=",$ou[0]);
+						$ou = array_pop($ou);
+						$dn = strtoupper(substr($ou,0,strlen($ou)-1));
+						$return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn);
+					}
+				}
+			}
+		}
+
+		if( $pCharset === "1" || $pCharset === 1 )
+			return $return;
+		else
+			return mb_convert_encoding($return, "ISO-8859-1", "UTF-8");
+
+	}
+	
+	public final function getPhotoLdap( $pJid , $pLdapInternal )
+	{
+		$uid = substr($pJid, 0, strpos($pJid, "@"));
+
+		if( $pLdapInternal )
+		{
+			if( !$this->fileLdapInternal )
+				return false;
+
+			if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 )))
+			{
+				
+				$this->ldapConnect();
+				
+				if( $this->conn )
+				{
+					$filter			= "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese		= array($this->attribute,"jpegPhoto");
+					$search			= ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
+					$get_entries	= ldap_get_entries($this->conn,$search);
+					
+					if( $get_entries['count'] > 0 )
+					{
+						$first_entry = ldap_first_entry( $this->conn, $search );
+						$photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto');
+						
+						if ( $photo )
+							return $photo[0];
+						
+						return false;								
+					}
+				}
+			}
+		}
+		else
+		{				
+			$jabberName = substr($pJid, strpos($pJid, "@") + 1 );
+
+			if( strpos($jabberName, "/") )
+				$jabberName = substr($jabberName, 0, strpos($jabberName, "/"));
+
+			$this->ldapConnectExternal($jabberName);
+
+			if( !$this->fileLdapExternal )
+				return false;
+			
+			if( $this->conn )
+			{
+				$filter			= "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+				$justthese		= array($this->attribute,"jpegPhoto");
+				$search			= ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
+				$get_entries	= ldap_get_entries($this->conn,$search);
+				
+				if( $get_entries['count'] > 0 )
+				{
+					$first_entry = ldap_first_entry( $this->conn, $search );
+					$photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto');
+					
+					if ( $photo )
+						return $photo[0];
+					
+					return false;								
+				}
+			}
+		}
+		
+		return false;
+	}
+	
+	public final function getPhotoSession($pUid, $pOu)
+	{
+		$uid = $pUid;
+		if( strpos($pUid, "@") )
+			$uid = substr($pUid, 0, strpos($pUid, "@"));
+		
+		require_once("../../header.session.inc.php");
+		
+		if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]) )
+		{
+			$photo = imagecreatefromstring($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]);
+
+			header("Content-Type: image/jpeg");
+			$width = imagesx($photo);
+			$height = imagesy($photo);
+			$twidth = 60;
+			$theight = 80;
+			$small_photo = imagecreatetruecolor ($twidth, $theight);
+			imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
+			imagejpeg($small_photo,'',100);
+
+			unset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]);
+
+			return;	
+		}
+	}
+}
+
+// Applet - utilizando o serviço Voip;
+if(trim($_REQUEST['javaVoipFrom']) != "" && trim($_REQUEST['javaVoipTo']) != "" )
+{
+	$obj = new webService();
+	$voipFrom = $_REQUEST['javaVoipFrom'];
+	$voipTo = $_REQUEST['javaVoipTo'];
+	printf("%s",$obj->CallVoipConnect($voipFrom, $voipTo));
+}
+
+// Applet - fotos pelo applet; 
+if(trim($_REQUEST['javaPhoto']) != "" )
+{
+	$obj = new webService();
+	$jid = $_REQUEST['javaPhoto'];
+	$jid = ( strpos($jid, "/") !== false ) ? substr($jid, 0, strpos($jid, "/")) : $jid;
+	$photo = $obj->getPhotoLdap( $jid, true );
+	$photoWidth = 70;
+	$photoHeight = 90;
+	$newImage = imagecreatetruecolor($photoWidth,$photoHeight);		
+
+	if( $photo )
+	{
+		$photo = imagecreatefromstring($photo);
+		imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo));
+	}
+	else
+	{
+		$photo = $obj->getPhotoLdap($jid, false);
+		if( $photo )
+		{
+			$photo = imagecreatefromstring($photo);
+			imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo));
+		}
+		else
+		{
+			$photo = @imagecreatefrompng("../templates/default/images/photo.png");
+			imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo));
+		}
+	}
+	
+	ob_start();
+	imagepng($newImage);
+	$imagePhoto = ob_get_contents();
+	imagedestroy($newImage);
+	ob_end_clean();
+	printf("%s",base64_encode($imagePhoto));
+}
+
+// Applet - jid;
+if(trim($_REQUEST['jid']) != "")
+{
+	
+	$jid = trim($_REQUEST['jid']);
+	$charset = trim($_REQUEST['charset']);
+	$obj = new webService();
+	
+	printf("%s",$obj->getNameOrganization($jid, $charset));
+}
+
+// Php - fotos pelo php;
+if(trim($_REQUEST['phpPhoto']) != "")
+{
+	$obj = new webservice();
+	$ou = $_REQUEST['phpOu'];
+	$jid = $_REQUEST['phpPhoto'];
+	
+	$obj->getPhotoSession($jid, $ou);
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupslocked.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupslocked.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupslocked.inc.php	(revision 4453)
@@ -0,0 +1,31 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bogroupslocked
+{
+	private $db;
+	
+	function __construct()
+	{
+		$this->db = new db_im();
+	}
+	
+	public final function setGroupsLocked($pGroups)
+	{
+		return $this->db->setGroupsLocked($pGroups);
+	}	
+}  
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uimodule.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uimodule.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uimodule.inc.php	(revision 4453)
@@ -0,0 +1,113 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bomodule.inc.php"; 
+
+class uimodule
+{
+	public $public_functions = array(
+		'add'      => True,
+		'edit_conf' => True,
+	);
+
+	private $bo;
+	
+	final function __construct()
+	{
+		$this->bo = new bomodule();	
+	}	
+	
+	public final function edit_conf()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar o Uso do Módulo';	
+		
+		if(!@is_object($GLOBALS['phpgw']->js))
+		{
+			$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
+		}
+			
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+		
+		$js = array('functions');
+		
+		foreach( $js as $tmp )
+			$GLOBALS['phpgw']->js->validate_file('',$tmp,'jabberit_messenger');
+		
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		if( $apps_list = $this->bo->getApplicationsEnabled())
+		{
+			$apps_list = unserialize($apps_list);
+			if(is_array($apps_list))
+			{
+				foreach($apps_list as $tmp)
+					$apps_en .= "<option value='".$tmp."'>".substr($tmp,strpos($tmp, ";")+1)."</option>";
+			}
+		}
+
+		if( $apps_enabled = $this->bo->getApplicationsList() )
+		{
+			if(is_array($apps_enabled))
+			{
+				foreach($apps_enabled as $tmp )
+					$apps .= "<option value='".$tmp['name'].";".$tmp['title']."'>".$tmp['title']."</option>";
+			}
+		}
+
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'module.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','module');	
+		$GLOBALS['phpgw']->template->set_var(array(
+										'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.add'),
+										'apps_enabled' => $apps_en,
+										'apps_list' => $apps,
+										'lang_Select_the_modules_where_the_Expresso_Messenger_will_be_loaded' => lang('Select the modules where the Expresso Messenger will be loaded.'),										
+										'lang_Enable_the_Expresso_Messenger_module' => lang('Enable the Expresso Messenger module'),
+										'lang_Modules_List' => lang('Modules List'),
+										'lang_Modules_Enabled' => lang('Modules Enabled'),
+										'lang_save' => lang('Save'),
+										'lang_cancel' => lang('Cancel')
+										));
+	
+		$GLOBALS['phpgw']->template->pparse('out','module');
+	}
+	
+	public final function add()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		if ($_POST['cancel'])
+		{
+			$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission');
+		}
+
+		if ( $_POST['save'] )
+		{
+			if(is_array($_POST['apps_enabled']))
+				$this->bo->setApplications($_POST['apps_enabled']);
+			else
+				$this->bo->setApplications("");
+		}
+		
+		$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission');
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bojmessenger.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bojmessenger.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bojmessenger.inc.php	(revision 4453)
@@ -0,0 +1,35 @@
+<?php
+
+require_once "class.db_im.inc.php";
+require_once "class.ldap_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bojmessenger
+{
+	private $db;
+	private $ldap;
+
+	function __construct()
+	{
+		$this->db	= new db_im();
+		$this->ldap = new ldap_im();
+	}
+	
+	public final function getGroupsJmessenger()
+	{
+		return $this->db->getGroupsJmessenger();
+	}
+	
+	public final function getOrganizationsLdap($pHost)
+	{
+		return $this->ldap->getOrganizationsLdap($pHost);				
+	}
+	
+	public final function setAddGroupsJmessenger($pData)
+	{
+		$this->db->setAddGroupsJmessenger($pData);		
+	}
+	
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uilogmessage.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uilogmessage.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uilogmessage.inc.php	(revision 4453)
@@ -0,0 +1,360 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bologmessage.inc.php";
+
+class uilogmessage
+{
+	private $bo;
+	
+	public $public_functions = array(
+		'getLog'  => True,
+		'getMessageUser' => True,
+		'getMessageUserComplete' => True,		
+		'getMessageUserDate' => True
+	);
+	
+	function __construct()
+	{
+		$this->bo = new bologmessage(); 
+	}
+	
+	private function formatDate($pDate)
+	{
+		$newDt = date_parse($pDate);
+		
+		// Hour
+		$newDt['hour'] = ( strlen($newDt['hour']) == 1 ) ? "0".$newDt['hour'] : $newDt['hour'];
+		$newDt['minute'] = ( strlen($newDt['minute']) == 1 ) ? "0".$newDt['minute'] : $newDt['minute'];
+		$newDt['second'] = ( strlen($newDt['second']) == 1 ) ? "0".$newDt['second'] : $newDt['second']; 
+		
+		// Date
+		$newDt['day'] = ( strlen($newDt['day']) == 1 ) ? "0".$newDt['day'] : $newDt['day'];
+		$newDt['month'] = ( strlen($newDt['month']) == 1 ) ? "0".$newDt['month'] : $newDt['month'];
+		
+		return $newDt['hour'].":".$newDt['minute'].":".$newDt['second'] . " - " . $newDt['day']."/".$newDt['month']."/".$newDt['year'];
+	}
+	
+	public function getLog()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Log de Mensagens Instântaneas - BanderSnatch';	
+
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'logMessagesJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','log_message');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUser'),
+													'action_url_back' => './admin',
+													'bt_previous' => '<input type="submit" name="bt_previous" value="Anterior" />',
+													'bt_next' => '<input type="submit" name="bt_next" value="Proximo" />',													
+													'label_back' => lang("Back"),
+													'label_first_message' => lang("First Message"),
+													'label_last_message' => lang("Last Message"),
+													'label_page' => "",
+													'label_total' => lang("Total"),
+													'label_user' => lang("User"),
+													'label_view' => lang("View"),
+													'value_messages' => "",
+													'value_next' => 30,
+													'value_page' => "",
+													'value_previous' => 0,
+													'value_txtUser' => "" 													
+												));
+	
+		$GLOBALS['phpgw']->template->pparse('out','log_message');
+	}
+	
+	public function getMessageUser()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Log de Mensagens Instântaneas - BanderSnatch';	
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		$value_messages = "";
+
+		if(trim($_REQUEST['txtUser']))
+		{
+			$limitPrevious 	= 0;
+			$limitNext 		= 30;
+
+			if( $_REQUEST['bt_next'] )
+			{
+				$limitPrevious	= $_REQUEST['button_previous'] + 30;
+				$limitNext		= 30;		
+			}
+			else if ( $_REQUEST['bt_previous'] )
+			{
+				if( $_REQUEST['button_previous'] != 0 )
+				{
+					$limitPrevious	= $_REQUEST['button_previous'] - 30;
+					$limitNext	 	= 30;
+				}
+				else
+				{
+					$limitPrevious	= 0;
+					$limitNext	 	= 30;
+				}
+			}
+			
+			if($_REQUEST['pg1_next'] || $_REQUEST['pg1_previous'])
+			{
+ 				$limitPrevious	= $_REQUEST['pg1_previous'];
+				$limitNext 		= $_REQUEST['pg1_next'];
+			}
+			
+			$data = $this->bo->getMessageUser($_REQUEST['txtUser'], $limitPrevious, $limitNext );
+			
+			foreach($data as $key=>$value)
+			{
+				$className = (($key % 2 ) == 0 ) ? "row_off" : "row_on";
+				
+				$value_messages .= "<tr>";
+				$value_messages .= "<td align='left' style='width:40%;' class='".$className."'>". $value['message_from']."</td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'>".$value['total_messages']."</td>";
+				$value_messages .= "<td align='center' style='width:20%;' class='".$className."'>".$this->formatDate($value['first_message'])."</td>";
+				$value_messages .= "<td align='center' style='width:20%;' class='".$className."'>".$this->formatDate($value['last_message'])."</td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'><a href='index.php?menuaction=jabberit_messenger.uilogmessage.getMessageUserDate&txtUser=".$_REQUEST['txtUser']."&user=".$value['message_from']."&first_message=".$value['first_message']."&last_message=".$value['last_message']."&pg1_previous=".$limitPrevious."&pg1_next=".$limitNext."'>".lang("View")."</a></td>";
+				$value_messages .= "</tr>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'logMessagesJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','log_message');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUser'),
+													'action_url_back' => './admin',
+													'bt_previous' => ( $limitPrevious == 0 ) ? '<input type="submit" name="bt_previous" value="Anterior" disabled="disabled" style="color:#cecece !important"/>' : '<input type="submit" name="bt_previous" value="Anterior"/>',
+													'bt_next' => ( count($data) < 30 ) ? '<input type="submit" name="bt_next" value="Proximo" disabled="disabled" style="color:#cecece !important"/>': '<input type="submit" name="bt_next" value="Proximo"/>',													
+													'label_back' => lang("Back"),
+													'label_first_message' => lang("First Message"),
+													'label_last_message' => lang("Last Message"),
+													'label_page' => ( count($data) > 0 ) ? lang("Page") . " : " : "",
+													'label_total' => lang("Total"),													
+													'label_user' => lang("User"),
+													'label_view' => lang("View"),													 
+													'value_messages' => $value_messages,
+													'value_next' => $limitNext,
+													'value_page' => ( count($data) > 0 ) ? (( $limitPrevious / 30 ) + 1) : "",													
+													'value_previous' => $limitPrevious,
+													'value_txtUser' => $_REQUEST['txtUser']
+												));
+	
+		$GLOBALS['phpgw']->template->pparse('out','log_message');
+	}
+	
+	public function getMessageUserDate()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Log de Mensagens Instântaneas - BanderSnatch';	
+
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		$user 			= $_REQUEST['user'];
+		$firstDate		= $_REQUEST['first_message'];
+		$lastDate		= $_REQUEST['last_message'];
+		$value_messages = "";		
+		
+		$limitPrevious 	= 0;
+		$limitNext 		= 30;
+		
+		if( $_REQUEST['bt_next'] )
+		{
+			$limitPrevious	= $_REQUEST['button_previous'] + 30;
+			$limitNext		= 30;		
+		}
+		else if ( $_REQUEST['bt_previous'] )
+		{
+			if( $_REQUEST['button_previous'] != 0 )
+			{
+				$limitPrevious	= $_REQUEST['button_previous'] - 30;
+				$limitNext	 	= 30;
+			}
+			else
+			{
+				$limitPrevious	= 0;
+				$limitNext	 	= 30;
+			}
+		}
+		
+		if($_REQUEST['pg2_next'] || $_REQUEST['pg2_previous'])
+		{
+ 			$limitPrevious	= $_REQUEST['pg2_previous'];
+			$limitNext 		= $_REQUEST['pg2_next'];
+		}
+
+		$data = $this->bo->getMessageUserDate($user, $firstDate, $lastDate, $limitPrevious, $limitNext );
+		
+		if(count($data) > 0 )
+		{
+			foreach($data as $key=>$value)
+			{
+				$className = (($key % 2 ) == 0 ) ? "row_off" : "row_on";
+				
+				$value_messages .= "<tr>";
+				$value_messages .= "<td align='left' style='width:30%;' class='".$className."'> ".$value['message_from']." </td>";
+				$value_messages .= "<td align='left' style='width:30%;' class='".$className."'> ".$value['message_to']." </td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'> ".$value['total_messages']." </td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'> ".$this->formatDate($value['first_message'])." </td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'> ".$this->formatDate($value['last_message'])." </td>";
+				$value_messages .= "<td align='center' style='width:10%;' class='".$className."'><a href='index.php?menuaction=jabberit_messenger.uilogmessage.getMessageUserComplete&txtUser=".$_REQUEST['txtUser']."&user=".$user."&user1=".$value['message_from']."&user2=".$value['message_to']."&dtfirst=".$value['first_message']."&dtlast=".$value['last_message']."&first_message=".$_REQUEST['first_message']."&last_message=".$_REQUEST['last_message']."&pg1_previous=".$_REQUEST['pg1_previous']."&pg1_next=".$_REQUEST['pg1_next']."&pg2_previous=".$limitPrevious."&pg2_next=".$limitNext."'>".lang("View")."</a></td>";
+				$value_messages .= "</tr>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'logMessagesJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','log_message_date');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUserDate'),
+													'action_url_back' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUser'),
+													'bt_previous' => ( $limitPrevious == 0 ) ? '<input type="submit" value="Anterior" name="bt_previous" disabled="disabled" style="color:#cecece !important"/>' : '<input type="submit" value="Anterior" name="bt_previous" />',
+													'bt_next' => ( count($data) < 30 ) ? '<input type="submit" value="Próxima" name="bt_next" disabled="disabled" style="color:#cecece !important"/>' : '<input type="submit" value="Próxima" name="bt_next" />',
+													'label_back' => lang("Back"),
+													'label_first_message' => lang("First Message"),
+													'label_last_message' => lang("Last Message"),
+													'label_next' => lang("Next"),
+													'label_page' => ( count($data) > 0 ) ? lang("Page") . " : " : "",													
+													'label_previous' => lang("Previous"),
+													'label_total' => lang("Total"),	
+													'label_user_1' => lang("From"),
+													'label_user_2' => lang("To"),
+													'label_view' => lang("View"),
+													'value_first_message' => $_REQUEST['first_message'],
+													'value_last_message' => $_REQUEST['last_message'],												
+													'value_messages' => $value_messages,
+													'value_next' => $limitNext,
+													'value_page' => ( count($data) > 0 ) ? (( $limitPrevious / 30 ) + 1) : "",
+													'value_pg1_next' => $_REQUEST['pg1_next'],
+													'value_pg1_previous' => $_REQUEST['pg1_previous'],
+													'value_previous' => $limitPrevious,
+													'value_txtUser' => $_REQUEST['txtUser'],
+													'value_user' => $_REQUEST['user'] 
+												));
+	
+		$GLOBALS['phpgw']->template->pparse('out','log_message_date');
+	}
+	
+	public function getMessageUserComplete()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Log de Mensagens Instântaneas - BanderSnatch';	
+
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		$user1	= $_REQUEST['user1'];
+		$user2	= $_REQUEST['user2'];
+		$firstDate	= $_REQUEST['dtfirst'];
+		$lastDate	= $_REQUEST['dtlast'];
+		$value_messages	= "";
+		
+		$limitPrevious 	= 0;
+		$limitNext 		= 30;
+		
+		if( $_REQUEST['bt_next'] )
+		{
+			$limitPrevious	= $_REQUEST['button_previous'] + 30;
+			$limitNext		= 30;		
+		}
+		else if ( $_REQUEST['bt_previous'] )
+		{
+			if( $_REQUEST['button_previous'] != 0 )
+			{
+				$limitPrevious	= $_REQUEST['button_previous'] - 30;
+				$limitNext	 	= 30;
+			}
+			else
+			{
+				$limitPrevious	= 0;
+				$limitNext	 	= 30;
+			}
+		}
+		
+		$data = $this->bo->getMessageUserComplete( $user1, $user2, $firstDate, $lastDate, $limitPrevious, $limitNext );
+		
+		if( count($data) > 0 )
+		{
+			foreach($data as $key=>$value)
+			{
+				$className = (($key % 2 ) == 0 ) ? "row_off" : "row_on";	
+				
+				$value_messages .= "<tr>";
+				$value_messages .= "<td align='left' style='width:25%;' class='".$className."'> ".$value['message_from']." </td>";
+				$value_messages .= "<td align='left' style='width:25%;' class='".$className."'> ".$value['message_to']." </td>";
+				$value_messages .= "<td align='left' style='width:40%;' class='".$className."'> ".utf8_decode($value['message_body'])." </td>";
+				$value_messages .= "<td align='center' style='width:10%' class='".$className."'> ".$this->formatDate($value['message_timestamp'])." </td>";
+				$value_messages .= "</tr>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'logMessagesJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','log_message_complete');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUserComplete'),
+													'action_url_back' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uilogmessage.getMessageUserDate'),
+													'bt_previous' => ( $limitPrevious == 0 ) ? '<input type="submit" value="Anterior" name="bt_previous" disabled="disabled" style="color:#cecece !important"/>' : '<input type="submit" value="Anterior" name="bt_previous"/>',
+													'bt_next' => ( count($data) < 30 ) ? '<input type="submit" value="Próximo" name="bt_next" disabled="disabled" style="color:#cecece !important"/>' : '<input type="submit" value="Próximo" name="bt_next" />',
+													'label_back' => lang("Back"),													
+													'label_body' => lang("Content"),
+													'label_date' =>	lang("Date and Hour"),
+													'label_next' => lang("Next"),
+													'label_page' => (count($data) > 0 ) ? lang("Page") . " : " : "",													
+													'label_previous' => lang("Previous"),
+													'label_user_1' => lang("From"),
+													'label_user_2' => lang("To"),												
+													'value_first_message' => $_REQUEST['first_message'],
+													'value_last_message' => $_REQUEST['last_message'],
+													'value_messages' => $value_messages,
+													'value_next' => $limitNext,
+													'value_page' => (count($data) > 0 ) ? (( $limitPrevious / 30 ) + 1) : "",													
+													'value_previous' => $limitPrevious,
+													'value_pg1_next' => $_REQUEST['pg1_next'],
+													'value_pg1_previous' => $_REQUEST['pg1_previous'],
+													'value_pg2_next' => $_REQUEST['pg2_next'],
+													'value_pg2_previous' => $_REQUEST['pg2_previous'],
+													'value_txtUser' => $_REQUEST['txtUser'],
+													'value_user' => $_REQUEST['user'],
+													'value_user1' => $_REQUEST['user1'],
+													'value_user2' => $_REQUEST['user2'],
+													'value_dtfirst' => $_REQUEST['dtfirst'],
+													'value_dtlast' => $_REQUEST['dtlast']
+												));
+	
+		$GLOBALS['phpgw']->template->pparse('out','log_message_complete');
+	}		
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/preferences.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/preferences.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/preferences.php	(revision 4453)
@@ -0,0 +1,37 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+											'currentapp' => 'jabberit_messenger',
+											'noheader'   => True, 
+											'nonavbar'   => True
+											);
+	if( is_dir('../phpgwapi/inc') )
+		require_once("../header.inc.php");
+	else
+		require_once("../../header.inc.php");			
+
+	function setPreferences($pArgs)
+	{
+		if( $GLOBALS['phpgw_info']['user']['preferences']['jabberit_messenger']['preferences'] )
+			$GLOBALS['phpgw']->preferences->change('jabberit_messenger','preferences',$pArgs);
+		else
+			$GLOBALS['phpgw']->preferences->add('jabberit_messenger','preferences',$pArgs);
+
+		if ( $GLOBALS['phpgw']->preferences->save_repository() )
+			return "true";
+		else
+			return "false";
+	}	
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bohostsjabber.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bohostsjabber.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bohostsjabber.inc.php	(revision 4453)
@@ -0,0 +1,31 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bohostsjabber
+{
+	private $db;	
+	
+	function __construct()
+	{
+		$this->db = new db_im();
+	}
+	
+	public final function getHostsJabber()
+	{
+		return $this->db->getHostsJabber();				
+	}	
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/attributeLdap.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/attributeLdap.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/attributeLdap.php	(revision 4453)
@@ -0,0 +1,16 @@
+<?php
+ 
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+  
+	$attributeTypeName = "uid";
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uienabledgroups.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uienabledgroups.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uienabledgroups.inc.php	(revision 4453)
@@ -0,0 +1,161 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+  
+require_once "class.boenabledgroups.inc.php";
+
+class uienabledgroups
+{
+	private $bo;
+	
+	public $public_functions = array(
+		'backPage'  => True,
+		'editGroups' => True,
+		'getGroups' => True,
+	);
+	
+	function __construct()
+	{
+		$this->bo = new boenabledgroups();
+	}
+	
+	public final function editGroups()
+	{
+		if($_GET['menuaction'])
+		{
+			if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+			{
+				$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+			}		
+			
+			$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Liberar Organizações para grupos restritos';
+	
+			$GLOBALS['phpgw']->common->phpgw_header();
+			echo parse_navbar();
+	
+			$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+			$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+	
+			if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+				$webserver_url .= '/';
+	
+			// Load Language;
+			require_once "load_lang.php";
+			
+			// Load Ldap;
+			require_once "class.ldap_im.inc.php";
+			
+			$ldap = new ldap_im();
+			
+			$ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";	
+			if( ($LdapOus = $ldap->getOrganizationsLdap('localhost')) )
+			{
+				foreach($LdapOus as $key => $val )
+					$ous .= "<option value='".$key."'>".$val."</option>";
+			}
+
+			$group = explode(":",$_GET['groups']);
+
+			$valueGroupsOrganizations = "";
+			
+			if( $group[2] )
+			{
+				$ou_groups = explode(",",$group[2]);
+			
+				natcasesort($ou_groups);
+			
+				foreach($ou_groups as $tmp)
+				{
+					$valueGroupsOrganizations .= "<tr id='".$tmp."'>";
+					$valueGroupsOrganizations .= "<td align='left' class='row_on'>".$tmp."</td>";
+					$valueGroupsOrganizations .= "<td align='left' class='row_on' style='width:30% !important'><a href='javascript:constructScript.removeOrgGroupsLocked(\"".$tmp."\");'>Excluir</a></td>";					
+					$valueGroupsOrganizations .= "</tr>";
+				}
+			}
+			
+			$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'confGroupsLocked.tpl'));
+			$GLOBALS['phpgw']->template->set_block('jabberit_messenger','confGroups');	
+			$var = array(
+							'action_url' => "./index.php?menuaction=jabberit_messenger.uienabledgroups.getGroups",
+							'lang_Back' => "Voltar",	
+							'lang_Cadastrar_Organizacao' => "Cadastrar Organização",	
+							'lang_Delete' => "Excluir",							
+							'lang_Informe_as_Organizacoes' => "Informe as Organizações",
+							'lang_Nome_Grupo' => "Nome do Grupo",
+							'lang_Organizacoes_cadastradas_para_grupo' => "Organizações cadastradas para o grupo",	
+							'lang_Organization' => "Organização",
+							'lang_save' => "Salvar",
+							'value_Groups_Organizations' => $valueGroupsOrganizations,	
+							'value_organizations_ldap' => $ous,							
+							'value_Name_Group' => $group[0],
+							'value_gidNumber' => $group[1],
+						);	
+			$GLOBALS['phpgw']->template->set_var($var);
+			$GLOBALS['phpgw']->template->pparse('out','confGroups');
+		}
+	}
+
+	public final function getGroups()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') ) 
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Liberar Organizações para grupos restritos';
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
+
+		// Load Language;
+		require_once "load_lang.php";
+
+		$groups_locked_jabberit = $this->bo->getGroupsBlocked();
+
+		if(trim($groups_locked_jabberit))
+		{
+			$glocked = explode(';',$GLOBALS['phpgw_info']['server']['groups_locked_jabberit']);
+			$list_groups = "";
+
+			natcasesort($glocked);
+						
+			foreach( $glocked as $tmp )
+			{
+				$groups = explode(":",$tmp);
+				$list_groups .= "<tr class='row_off'>";
+				$list_groups .= "<td width='30%'>".$groups[0]."</td>";
+				$list_groups .= "<td width='55%'>".$groups[2]."</td>";
+				$list_groups .= "<td width='5%' align='center'><a href='./index.php?menuaction=jabberit_messenger.uienabledgroups.editGroups&groups=".$tmp."'>Editar</a></td>";
+				$list_groups .= "</tr>";
+			}
+		}
+
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'enabled_ou_groups.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','enabled_ous');	
+		$var = array(
+						'action_url' => './index.php?menuaction=jabberit_messenger.uiconfig.configPermission',						
+						'lang_back' => lang("Back"),
+						'list_groups' => (trim($list_groups) != "") ? $list_groups : "",
+					);	
+		$GLOBALS['phpgw']->template->set_var($var);
+		$GLOBALS['phpgw']->template->pparse('out','enabled_ous');
+	}
+}
+
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.fileDefine.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.fileDefine.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.fileDefine.inc.php	(revision 4453)
@@ -0,0 +1,78 @@
+<?php
+ /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class fileDefine
+{
+	public final function ldapExternal($pConfLdap)
+	{
+		$file = "confLDAPExternal.php";
+		$writeFile = "<?php $"."LDAP_EXTERNAL="."\"".base64_encode(serialize($pConfLdap))."\""." ?>";
+		
+		return $this->writeFile($writeFile, $file);
+	}
+
+	public final function ldapInternal($pParam)
+	{
+		$array_values = explode("\n", $pParam['val']);	
+		$file = "confLDAPInternal.php";
+		$infoServer = array();
+		
+		foreach($array_values as $tmp )
+		{
+			$nvalue = explode(";", $tmp);
+			
+			switch(trim($nvalue[0]))
+			{
+				case "JETTI_NAME_JABBERIT" :
+						$infoServer['jabberName'] = $nvalue[1];				
+						break;
+						
+				case "JETTI_SERVER_LDAP_JABBERIT" :
+						$infoServer['serverLdap'] = $nvalue[1];							
+						break;			
+			
+				case "JETTI_CONTEXT_LDAP_JABBERIT" :	
+						$infoServer['contextLdap'] = $nvalue[1];
+						break;
+			
+				case "JETTI_USER_LDAP_JABBERIT" :
+						$infoServer['user'] = $nvalue[1];
+						break;
+			
+				case "JETTI_PASSWORD_LDAP_JABBERIT" :
+						$infoServer['password'] = $nvalue[1];				
+						break;
+			}
+		}
+		
+		$writeFile = "<?php $"."LDAP_INTERNAL="."\"".base64_encode(serialize($infoServer))."\""." ?>";
+		
+		return $this->writeFile( $writeFile, $file );
+	}
+
+	private final function writeFile($pContent, $pfile)
+    {
+		$filename = dirname(__FILE__).'/'.$pfile;
+		$content = $pContent;
+			
+		if ( !$handle = fopen($filename, 'w+') )
+			return false;
+		
+		if (fwrite($handle, $content) === FALSE)
+			return false;
+
+		fclose($handle);
+		
+		return true;
+    }
+}
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/login.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/login.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/login.php	(revision 4453)
@@ -0,0 +1,180 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+	define('PHPGW_API_INC','../../phpgwapi/inc');
+	require_once(PHPGW_API_INC . '/class.Template.inc.php');
+
+	if(isset($_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']))
+    {
+		// Path Server
+		$path = $_SESSION['phpgw_info']['jabberit_messenger']['webserver_url'];
+		$SERVER_EXPRESSO = $_SERVER['HTTP_HOST'] . $path;
+
+		/** 
+		 ******  Type Protocol http / https **********************************************************
+		 *	Esta variável é carregada no header.inc.php, onde é possível definir
+		 * 	se será com http ou https. Verifique em seu arquivo header.inc.php como está configurada
+		 *	a variável $GLOBALS['phpgw_info']['server']['use_https']. 
+		 *	Abaixo segue esquema :
+		 *	Expresso 0 = Sem https
+		 *	Expresso 1 = Com https apenas no login
+		 * 	Expresso 2 = Completo
+		 *********************************************************************************************
+		 **/
+
+		$PROTOCOL = trim("http");
+		if( $_SESSION['phpgw_info']['jabberit_messenger']['use_https'] === 2 )
+			$PROTOCOL = trim("https");
+
+		// Define Attribute Ldap
+		$attribute = "uid";
+		if ( file_exists('inc/attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$attribute = trim($attributeTypeName);
+		}
+
+		// Uid user
+		if( $attribute === "uid" )
+		{
+			$uid = $_SESSION['phpgw_info']['jabberit_messenger']['user_jabber'];
+		}
+		else
+		{
+			$uid = "DEFINA AQUI A VARIAVEL DE SESSÃO QUE CONTEM O ATRIBUTO DE AUTENTICAÇÂO";
+		}
+		
+		// FirstName
+		$CnName = explode(" ",$_SESSION['phpgw_info']['jabberit_messenger']['fullname']);
+		
+		//Enable/Disable VoIP Service -> Voip Server Config
+		$voip_enabled = false;
+		$voip_groups = array();	
+		if( $GLOBALS['phpgw_info']['server']['voip_groups'] )
+		{
+			$emailVoip = false;
+			foreach(explode(",",$GLOBALS['phpgw_info']['server']['voip_groups']) as $i => $voip_group)
+			{
+				$a_voip = explode(";",$voip_group);			
+				$voip_groups[] = $a_voip[1];
+			}
+			foreach($GLOBALS['phpgw']->accounts->membership() as $idx => $group){			
+				if(array_search($group['account_name'],$voip_groups) !== FALSE)
+				{		 
+					$voip_enabled = true;
+					$emailVoip = $GLOBALS['phpgw_info']['server']['voip_email_redirect'];
+				}
+			}
+		}
+
+		// Load Applet ( Java )
+		$javaFiles = $path . "applet.jar,";
+		$javaPlugins = "";
+				
+		// Enable Plugins Java;
+		$pluginsJava[] = "xhtml.jar";
+		$pluginsJava[] = "filetransfer.jar";
+		
+		if( $voip_enabled )
+			$pluginsJava[] = "callVoip.jar";		
+		
+		for( $i = 0; $i < count($pluginsJava); $i++ )
+		{
+			$javaFiles	 .= $path . "plugins/" . $pluginsJava[$i] . ",";
+			$javaPlugins .= substr($pluginsJava[$i], 0, strpos($pluginsJava[$i],".")).","; 
+		}
+		
+		$javaPlugins = trim(substr($javaPlugins, 0, strlen($javaPlugins)-1));
+
+		// Code Base Java;
+		$codeBase = 'nu.fw.jeti.applet.Jeti.class';
+
+		// Lang Expresso
+		$lang = explode("-", $_SESSION['phpgw_info']['jabberit_messenger']['applet_lang']); 
+		$country = strtoupper($lang[1]);
+		$language = $lang[0];
+		
+		// Porta/(SSL)? 		
+		$conn_SSL = "false";
+		$port_jabber = "5222";
+		
+		if( $_SESSION['phpgw_info']['jabberit_messenger']['port_1_jabberit'] === "true" )
+		{	
+			$conn_SSL = "true";
+			$port_jabber = "5223";
+		}
+				
+		if( trim($_SESSION['phpgw_info']['jabberit_messenger']['port_2_jabberit']) )
+		{		
+			$port_jabber = $_SESSION['phpgw_info']['jabberit_messenger']['port_2_jabberit'];
+		}
+		
+		// Crypt Password
+		if( function_exists('mcrypt_module_open') )		
+		{
+			require_once("crypto.php");
+			$CRYPT_JAVA = "DefaultJava1234@";
+
+			// Load Template;
+			$template = new Template('templates/default');
+			$template->set_var("path", $path);
+			$template->set_var("java_files", $javaFiles);
+			$template->set_var("value_cnname", encrypt($CnName[0],$CRYPT_JAVA));
+			$template->set_var("value_codeBase", $codeBase);
+			$template->set_var("value_company", encrypt($_SESSION['phpgw_info']['jabberit_messenger']['name_company'],$CRYPT_JAVA));
+			$template->set_var("value_country", encrypt($country,$CRYPT_JAVA));
+			$template->set_var("value_expresso", encrypt($SERVER_EXPRESSO,$CRYPT_JAVA));		
+			$template->set_var("value_host", encrypt($_SESSION['phpgw_info']['jabberit_messenger']['ip_server_jabberit'], $CRYPT_JAVA));
+			$template->set_var("value_javaPlugins", $javaPlugins);
+			$template->set_var("value_language", encrypt($language,$CRYPT_JAVA));			
+			$template->set_var("value_password", encrypt($_SESSION['phpgw_info']['jabberit_messenger']['passwd'],$CRYPT_JAVA));
+			$template->set_var("value_port", encrypt($port_jabber,$CRYPT_JAVA));
+			$template->set_var("value_resource", encrypt($_SESSION['phpgw_info']['jabberit_messenger']['resource_jabberit'],$CRYPT_JAVA));
+			$template->set_var("value_server", encrypt($_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'],$CRYPT_JAVA));
+			$template->set_var("value_ssl", encrypt($conn_SSL,$CRYPT_JAVA));
+			$template->set_var("value_use_https", encrypt($PROTOCOL,$CRYPT_JAVA));
+			$template->set_var("value_user", encrypt($uid,$CRYPT_JAVA));
+			$template->set_var("value_mc", "true");
+		}
+		else
+		{
+			// Load Template;
+			$template = new Template('templates/default');
+			$template->set_var("path", $path);
+			$template->set_var("java_files", $javaFiles);
+			$template->set_var("value_cnname", $CnName[0] );
+			$template->set_var("value_codeBase", $codeBase);
+			$template->set_var("value_company", $_SESSION['phpgw_info']['jabberit_messenger']['name_company'] );
+			$template->set_var("value_country", $country );
+			$template->set_var("value_expresso", $SERVER_EXPRESSO );		
+			$template->set_var("value_host", $_SESSION['phpgw_info']['jabberit_messenger']['ip_server_jabberit'] );
+			$template->set_var("value_javaPlugins", $javaPlugins);
+			$template->set_var("value_language", $language );			
+			$template->set_var("value_password", $_SESSION['phpgw_info']['jabberit_messenger']['passwd'] );
+			$template->set_var("value_port", $port_jabber );
+			$template->set_var("value_resource", $_SESSION['phpgw_info']['jabberit_messenger']['resource_jabberit'] );
+			$template->set_var("value_server", $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'] );
+			$template->set_var("value_ssl", $conn_SSL );
+			$template->set_var("value_use_https", $PROTOCOL );
+			$template->set_var("value_user", $uid );
+			$template->set_var("value_mc", "false");
+		}
+
+		if( strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") )
+			$template->set_file(Array('jabberit_messenger' => 'jabberIM_IE.tpl'));
+		else
+			$template->set_file(Array('jabberit_messenger' => 'jabberIM.tpl'));
+			
+		$template->set_block('jabberit_messenger','index');
+		$template->pfp('out','index');
+    }
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/jabberit_acl.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/jabberit_acl.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/jabberit_acl.inc.php	(revision 4453)
@@ -0,0 +1,126 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+// Verifica qual será o módulo a ser carregado.
+$flag = false;
+
+$groupsJmessenger = unserialize( $GLOBALS['phpgw_info']['server']['groups_jmessenger_jabberit'] );
+
+if( is_array($groupsJmessenger) )
+{
+
+	foreach( $groupsJmessenger as $tmp )
+	{
+		$_explode = explode( ":", $tmp );
+		$groups[] = $_explode[1];
+	}
+
+	foreach( $GLOBALS['phpgw']->accounts->membership() as $idx => $group )
+	{
+		if( array_search($group['account_name'], $groups) !== FALSE )
+			$flag = true;
+	}
+}
+
+if( $flag )
+{
+	require_once PHPGW_SERVER_ROOT . '/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php';
+}
+else
+{	
+	$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']);
+	
+	for( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'] != "jabberit_messenger"; $i++ )
+	{
+		$apps = unserialize($GLOBALS['phpgw_info']['server']['apps_jabberit']);
+		$flag = false;
+	
+		if( is_array($apps) )
+		{
+			foreach($apps as $tmp)
+			{
+				$app_enabled = substr($tmp,0,strpos($tmp,";"));
+				if( $GLOBALS['phpgw_info']['flags']['currentapp'] == $app_enabled )
+					$flag = true;
+			}	
+		}
+		
+		if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'jabberit_messenger' && ( $flag || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'jabberit_messenger' ))
+		{
+	
+			$ldapManager = CreateObject('contactcenter.bo_ldap_manager');
+			$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager'] = $ldapManager->srcs[1];
+			
+			$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+			$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+	
+			if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+				$webserver_url .= '/';
+	
+                        
+                        $webserver_expresso = $webserver_url . "phpgwapi/";
+			$webserver_url      = $webserver_url . 'jabberit_messenger/'; 
+			
+			require_once PHPGW_SERVER_ROOT . '/jabberit_messenger/inc/jabberit_sessions.inc.php';
+			
+			$_SESSION['phpgw_info']['jabberit_messenger']['webserver_url'] = $webserver_url;
+			
+                        
+			require_once dirname(__FILE__) . '/load_lang.php';
+			
+			$js  = "var path_jabberit='".$webserver_url."';";
+			$js .= "var _ZINDEX='99000'; ";	
+	
+                        // Xtools Phpgwapi
+                        echo "<script type='text/javascript' src='".$webserver_expresso."js/x_tools/xtools.js'></script>";
+                        
+                        // Javascript JMessenger
+                        echo "<script type=\"text/javascript\">".$js."</script>";
+			$js = array(
+						'j.connector',
+						'j.dragdrop',
+						'j.makeW',
+						'j.ldap',
+						'j.images',
+						'j.show_hidden',
+						'j.load',
+						'j.editSelect'
+						);
+
+			require_once dirname(__FILE__) . '/Controller.class.php';
+	
+			$controller = new Controller;
+			$script = '';
+			
+			foreach( $js as $key => $val ) 
+			{
+				$script .= $controller->exec(array('act' => $val), PHPGW_SERVER_ROOT . "/jabberit_messenger");
+			}	
+			
+			$theme = "window_" . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . ".css";
+	
+			if( !file_exists('../jabberit_messenger/templates/default/css/'.$theme) )
+				$theme = "window_default.css";
+			
+			print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/'.$theme.'" >';
+			print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css" >';
+			print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/button.css" >';
+			print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/selectEditStyle.css" >';		
+	
+			printf("<script type=\"text/javascript\">%s</script>", $script);
+	
+			break;
+		}
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupslocked.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupslocked.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uigroupslocked.inc.php	(revision 4453)
@@ -0,0 +1,129 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bogroupslocked.inc.php";
+
+class uigroupslocked
+{
+	
+	private $bo;
+	
+	public $public_functions = array(
+		'add'  => True,
+		'editGroups' => True,
+	);
+	
+	function __construct()
+	{
+		$this->bo = new bogroupslocked();
+		
+		if(!isset($_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['host']))
+		{
+			$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host'];
+			$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['acc'] = $GLOBALS['phpgw_info']['server']['ldap_root_dn'];
+			$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['pw'] = $GLOBALS['phpgw_info']['server']['ldap_root_pw'];
+			$_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['dn'] = $GLOBALS['phpgw_info']['server']['ldap_context'];
+		}
+	}
+
+	public final function editGroups()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Restringir o Uso do Módulo por Grupo';	
+
+		$_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
+    	$_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
+    	$_SESSION['phpgwinfo']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
+    	$_SESSION['phpgwinfo']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
+    	$_SESSION['phpgwinfo']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
+    	$_SESSION['phpgwinfo']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];			
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
+
+		// Load Language;
+		require_once "load_lang.php";
+		require_once "class.ldap_im.inc.php";
+		
+		$ldap = new ldap_im();
+		
+		$ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";	
+		
+		if( ($LdapOus = $ldap->getOrganizationsLdap("localhost")) )
+		{
+			foreach( $LdapOus as $key => $val )
+				$ous .= "<option value='".$key."'>".$val."</option>";
+		}
+
+		$groupsRestricts = "";
+
+		if(isset($GLOBALS['phpgw_info']['server']['groups_locked_jabberit']))
+		{
+			$glocked = explode(';',$GLOBALS['phpgw_info']['server']['groups_locked_jabberit']);
+			natcasesort($glocked);
+	
+			foreach( $glocked as $tmp ){
+				$option = explode(":",$tmp);
+				$groupsRestricts .= "<option value='".$tmp."'>".$option[0]."</option>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'groupslocked.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','groups_locked');	
+		$GLOBALS['phpgw']->template->set_var(array(
+										'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupslocked.add'),
+										'lang_add' => "Adicionar",
+										'lang_cancel' => lang('Cancel'),										
+										'lang_description' => "Os grupos cadastrados como restritos, só poderão adicionar contatos da sua própria organização",
+										'lang_grupos_ldap' => "Grupos Ldap",
+										'lang_grupos_restritos' => "Grupos Restritos",
+										'lang_save' => lang('Save'),
+										'lang_Jabberit_settings' => "Configurações",
+										'lang_remove' => "Remover",
+										'lang_organizations' => lang('Organizations'),										
+										'groups_restricts' => trim($groupsRestricts),
+										'ous_ldap' => $ous,
+										'value_serverLdap' 	=> "localhost"										
+										));
+	
+		$GLOBALS['phpgw']->template->pparse('out','groups_locked');
+	}	
+	
+	public final function add()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		if ( $_POST['save'] )
+		{
+			$this->bo->setGroupsLocked($_POST['groups_locked_jabberit']);
+		}
+
+		$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission');
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uijmessenger.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uijmessenger.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uijmessenger.inc.php	(revision 4453)
@@ -0,0 +1,113 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bojmessenger.inc.php";
+
+class uijmessenger
+{
+	private $bo;
+	
+	public $public_functions = array(
+		'backPage'		=> true,
+		'getGroups'		=> true,
+		'setGroups'		=> true,
+	);
+	
+	function __construct()
+	{
+		$this->bo = new bojmessenger();
+	}
+
+	public final function getGroups()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+		
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
+		
+		// Ldap Groups;
+		$optionsOUS = "<option value='-1'>-- ".lang('Select Organization')." --</option>";	
+		if( ($LdapOus = $this->bo->getOrganizationsLdap('localhost')) )
+		{
+			foreach($LdapOus as $key => $val )
+				$optionsOUS .= "<option value='".$key."'>".$val."</option>";
+		}
+		
+		// JMessenger Groups;		
+		$groups = unserialize($this->bo->getGroupsJmessenger());
+
+		if( $groups )
+		{
+			natcasesort($groups);
+				
+			foreach($groups as $tmp)
+			{
+				$grp = explode(":", $tmp);
+				$optionsGroups .= "<option value='".$tmp."'>".$grp[0]."</option>";
+			}
+		}						
+
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'jmessenger.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','edit_groups_jmessenger');	
+		$GLOBALS['phpgw']->template->set_var(array(
+												'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uijmessenger.setGroups'),										
+												'label_Back'			=> "Voltar",
+												'lang_add'				=> lang("add"),
+												'lang_cancel'			=> lang("Cancel"),
+												'lang_description'		=> "Adicione somente os grupos para utilizar o JMESSENGER SEM JAVA.",
+												'lang_groups_add'		=> lang("Groups Added"),
+												'lang_groups_ldap'		=> lang("Groups Ldap"),
+												'lang_organizations'	=> lang("Organizations"),
+												'lang_remove'			=> lang("Remove"),
+												'lang_save'				=> lang("Save"),
+												'lang_Search_quick_for'	=> "Busca rápida por",
+												'lang_settings'			=> lang("Settings"),
+												'value_ous_ldap'		=> $optionsOUS,
+												'value_groups_added'	=> $optionsGroups,												
+												'value_serverLdap' 		=> 'localhost'
+											));
+
+		$GLOBALS['phpgw']->template->pparse('out','edit_groups_jmessenger');
+	}
+
+	public final function setGroups()
+	{ 		
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+		
+		if( $_POST['cancel'] || $_POST['save'] )
+		{
+			if( $_POST['save'] )
+			{
+				$groups_added_jabberit = ( $_POST['groups_added_jabberit'] ) ? $_POST['groups_added_jabberit'] : "";				
+				$this->bo->setAddGroupsJmessenger($groups_added_jabberit);
+			}	
+				
+			$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission');
+		}
+	}
+			
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupsldap.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupsldap.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bogroupsldap.inc.php	(revision 4453)
@@ -0,0 +1,54 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "class.ldap_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bogroupsldap
+{
+	private $db;
+	private $ldap;
+	
+	function __construct()
+	{
+		$this->db		= new db_im();
+		$this->ldap		= new ldap_im();
+	}
+
+	public function getGroupsSearch()
+	{
+		return $this->db->getGroupsSearch();
+	}
+
+	public function getServerLdapInternal()
+	{
+		return $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];		
+	}
+	
+	public function getServersLdapExternal()
+	{
+		return unserialize($this->db->getHostsJabber());		
+	}
+	
+	public function getOrganizationsLdap($pHost)
+	{
+		return $this->ldap->getOrganizationsLdap($pHost);	
+	}
+	
+	public function setAddGroups($pData)
+	{
+		$this->db->setAddGroupsSearch($pData);		
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uiconfig.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uiconfig.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uiconfig.inc.php	(revision 4453)
@@ -0,0 +1,92 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+  
+class uiconfig
+{
+	private $uimodule;
+	
+	public $public_functions = array(
+		'configAudit'  => True,
+		'configPermission'  => True,		
+		'configServer'  => True,
+		'css' => True
+	);
+	
+	function __construct()
+	{
+		$GLOBALS['phpgw']->common->phpgw_header();
+	}	
+
+	public final function configPermission()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Permissões de Acesso';
+		echo parse_navbar();
+
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'configItens.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','configPermission');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url_back' => "./admin",
+													'label_config1' => lang("Enable the Expresso Messenger inside of the modules"),
+													'label_config2' => "Habilitar adição de novos contatos somente por grupos",
+													'label_config3' => lang("Restrict group"),													
+													'label_config4' => lang("Free organization for group"),	
+													'label_config5' => "Habilitar módulo SEM Java para os grupos",
+													'value_config1' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.edit_conf'),												
+													'value_config2' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupsldap.edit'),
+													'value_config3' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupslocked.editGroups'),
+													'value_config4' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uienabledgroups.getGroups'),
+													'value_config5' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uijmessenger.getGroups'),
+													'value_display_jmessenger' => ( (is_dir('./jabberit_messenger/jmessenger') ) ? "block" : "none"),
+													'value_image1' 	=> "./jabberit_messenger/templates/default/images/app.gif",
+													'value_image2' 	=> "./jabberit_messenger/templates/default/images/group.gif",
+													'value_image3' 	=> "./jabberit_messenger/templates/default/images/group_deny.gif",													
+													'value_image4' 	=> "./jabberit_messenger/templates/default/images/group_add.gif",
+													'value_image5'	=> "./jabberit_messenger/templates/default/images/sem_java.png"												
+													));
+	
+		$GLOBALS['phpgw']->template->pparse('out','configPermission');
+		
+	}
+
+	public final function configServer()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurações do Servidor';
+		echo parse_navbar();
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'configItens.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','configServer');	
+		$GLOBALS['phpgw']->template->set_var(array(
+													'action_url_back' => "./admin",
+													'label_config1' => lang("Site Configuration Jabber"),
+													'label_config2' => lang("Map organization for realm jabber"),
+													'value_config1' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=jabberit_messenger'),												
+													'value_config2' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uihostsjabber.edit_conf'),
+													'value_image1' 	=> "jabberit_messenger/templates/default/images/navbar.png",
+													'value_image2' 	=> "jabberit_messenger/templates/default/images/gear.png",
+													));
+	
+		$GLOBALS['phpgw']->template->pparse('out','configServer');
+	}
+
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.contacts_im.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.contacts_im.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.contacts_im.inc.php	(revision 4453)
@@ -0,0 +1,394 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+
+require_once "class.ldap_im.inc.php";
+require_once "class.db_im.inc.php"; 
+
+class contacts_im
+{
+	private $db;
+	private $dn_User;
+	private $hostsJabberLdap;	
+	private $ldap;
+	private $ou_User;
+	private $serverJabber;
+	private $serverLdap;
+		
+	function __construct()
+	{
+		$this->ldap = new ldap_im();
+		$this->db = new db_im();
+
+		// (DN) User
+		$this->dn_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn'];
+
+		// (OU) User
+		$this->ou_User = $this->dn_User;
+		$this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou="));
+		$this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc=")));
+		
+		// Server Name Jabber
+		$this->serverJabber = $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'];
+	
+		// Server Name Ldap
+		$this->serverLdap	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		
+		// Hosts Jabber / Ldap
+		$this->hostsJabberLdap = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);	
+	}
+
+	private final function groupsLocked()
+	{
+		$memberShip = array();
+		$groupsLocked =  explode(";",$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']);
+		
+		foreach($_SESSION['phpgw_info']['jabberit_messenger']['membership'] as $tmp)
+			$memberShip[] = $tmp['account_name'];
+		
+		foreach($groupsLocked as $tmp)
+		{
+			$groups = explode(":", $tmp);
+			
+			if( array_search($groups[1], $memberShip) !== False )
+			{	
+				$_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked'] = $groups[2]; 
+				return true;
+			}
+		}
+		
+		return false;
+	}
+
+	public final function list_contacts($param)
+	{
+		$order		= array();
+		$ou_User	= substr($this->ou_User, (strpos($this->ou_User,"=")+1));
+		$return		= "";
+		$users		= $this->getUsersIm($param['name']);
+
+		if( count($users) == 0  )
+			return "<empty></empty>";
+		
+		if( $users === "manyresults" )
+		{
+			if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo']) )
+				unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']);
+			
+			return "<manyresults></manyresults>";
+		}
+				
+		// Hosts Jabber
+		$hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);
+
+		if( is_array($users) )
+		{	
+			for($i = 0; $i < count($users); $i++)				
+			{
+				if( is_array($hostsJabber) )
+				{
+					foreach($hostsJabber as $itens)
+					{
+						if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false )
+						{
+							$users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName'];
+						}
+						
+						if( array_key_exists('ouAll', $users[$i]) && trim($itens['org']) === "*" )
+						{
+							$users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName'];
+						}
+					}
+				}
+
+				if( strpos($users[$i]['jid'],"@") === false )
+				{
+					$users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber;
+				}
+			}
+
+			foreach($users as $tmp)
+			{
+			    if ( !array_key_exists($tmp['ou'], $order) )
+					$order[$tmp['ou']] = array();
+
+				$order[$tmp['ou']][] = '<data><ou>'.$tmp['ou'].'</ou><cn>'.$tmp['cn'].'</cn><mail>'.$tmp['mail'].'</mail><uid>'.$tmp['uid'].'</uid><jid>'.$tmp['jid'].'</jid><photo>'.$tmp['photo'].'</photo></data>';
+			}
+			
+			ksort($order);
+				
+			$return	= '<uids>';
+			foreach ( $order as $key => $val )
+				$return .= '<'.$key.'>'.implode('',$val).'</'.$key.'>';
+			$return .= '</uids>';
+		}
+		
+		return $return;
+	}
+
+	private final function getUsersIm($pName)
+	{
+		$array_uids		= array();
+		$countUids		= 0;
+        $members		= array();
+        $result			= array();
+        $uidType		= "uid";
+		$serversLdap	= unserialize( trim($_SESSION['phpgw_info']['jabberit_messenger']['groups_search']) );
+
+		if( $serversLdap )
+		{
+			// Usa Grupos Ldap
+			$filters = array( );
+			
+			foreach( $serversLdap as $servers => $groups )
+			{
+				$filter = '';
+				foreach( unserialize($groups) as $group )
+					$filter .= '(gidnumber' . strstr( $group, ':' ) . ')';
+
+				$filters[ $servers ] = str_replace( ':', '=', $filter );
+			}
+
+			foreach( $serversLdap as $key => $tmp )
+			{
+				if( $key === $this->serverLdap )
+				{
+					$result[$key] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*");
+					$countUids += count($result[$key]);
+				}
+				else
+				{
+					if( !$this->groupsLocked() )
+					{
+						$result[$key] =  $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $key );
+						$countUids += count($result[$key]);
+					}
+				}
+			}
+
+			if( $countUids >  $this->ldap->getMaxResults() )
+			{
+				return "manyresults";
+			}
+
+			$_RESULT = $this->ldap->getMembers($result, $filters);
+			
+			foreach( $_RESULT as $key => $value )
+				$array_uids = array_merge($array_uids, $_RESULT[$key]);
+		}
+		else
+		{
+	       	// Ldap Root
+	        $result[] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*");
+	       
+	       	// Ldap Catalog			
+			if( count($this->hostsJabberLdap) )
+			{
+				foreach( $this->hostsJabberLdap as $conf )
+				{
+					$result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $conf['serverLdap'] );
+				}
+			}
+	       
+	       	foreach( $result as $key => $value )
+	       	{
+				$array_uids = array_merge($array_uids, $value);
+	       	}
+	       	
+	       	if( count($array_uids) >  $this->ldap->getMaxResults() )
+			{
+				return "manyresults";
+			}
+		}
+
+		if( $this->groupsLocked() )
+		{
+            $orgs[] 			= substr($this->ou_User, ( strpos($this->ou_User, "ou=") + 3 ) );
+            $orgsGroupsLocked	= explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked']); 
+            
+			foreach( $orgsGroupsLocked as $tmp )
+			{
+				if( $tmp != "")
+					$orgs[] = $tmp;
+			}
+
+            $orgs = array_unique($orgs);
+
+			$_restrict = array();
+			
+			for( $i = 0 ; $i < count($orgs) ; $i++ )
+			{
+				for( $j = 0 ; $j < count($array_uids) ; $j++ )
+				{
+					if( trim($array_uids[$j]['ou']) === trim($orgs[$i]) )
+					{
+						$_restrict[] = $array_uids[$j];
+					}	
+				}	
+			}
+			
+			return $_restrict;
+		}
+		else
+		{	
+			return $array_uids;
+		}	
+	}
+	
+	private final function strallpos($haystack, $needle, $offset = 0)
+	{
+	    $result = array();
+	    for($i = $offset; $i< strlen($haystack); $i++ )
+	    {
+	        $pos = strpos($haystack,$needle,$i);
+	        if($pos !== FALSE)
+	        {
+	            $offset =  $pos;
+	            if($offset >= $i)
+	                $result[] = $i = $offset;
+	        }
+	    }
+    	
+    	return $result;
+	} 
+
+	public final function verifyAddNewContact($pUid)
+	{
+		$groupsLocked	= explode(";",$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']);
+		$gidNumbers		= array();
+		$uid			= $pUid['uid'];
+		$uid_User		= substr($this->dn_User, 0, strpos($this->dn_User, ","));
+		$uid_User		= substr($uid_User, 4);
+		
+		foreach($groupsLocked as $tmp)
+		{
+			$groups = explode(":", $tmp);
+			$gidNumbers[] = $groups[1];
+		}
+
+		$filter_gid = implode(")(gidnumber=",$gidNumbers);
+	    $filter_gid = "(gidnumber=". $filter_gid. ")";
+	
+		$result = $this->ldap->getGroupsMemberUid( $filter_gid, "localhost" );
+
+		if( $result && is_array($result) )
+		{
+			array_shift($result);
+			$i = 0;
+			
+			foreach($result as $value)
+			{
+				$Groups[$i]['dn'] = $value['dn'];
+				$Groups[$i]['gidnumber'] = $value['gidnumber'][0];
+				if(array_key_exists('memberuid',$value))
+				{
+					array_shift($value['memberuid']);
+					$Groups[$i++]['memberuid'] = $value['memberuid'];
+				}
+			}
+
+			$search = array();
+			$search_Gid = array();
+
+			// Verifica Uid em Grupo Bloqueado
+			foreach($Groups as $value)
+			{			
+				if( array_search( $uid , $value['memberuid'] ) !== false )
+				{
+					$ou = substr($value['dn'],strpos($value['dn'], "ou="));
+					if( array_search($uid_User, $value['memberuid']) === false )
+					{
+						$search[] = strtoupper(substr($ou, 0, strpos($ou, ",dc=")));
+						$search_Gid[] = $value['gidnumber'];
+					}
+				}
+			}
+		}
+		
+	
+		if( $this->groupsLocked() )
+		{
+			if( count($search) > 0 )
+			{
+				// Verifica permissões do grupo
+				foreach($groupsLocked as $value)
+				{							
+					$tpGroups = explode(":",$value);
+					if( $tpGroups[1] == $search_Gid[0] )
+					{
+						$ousTp = explode(",",$tpGroups[2]);
+						$ou_User = strtoupper(trim($this->dn_User));
+						
+						$posAll = $this->strallpos($ou_User, "OU=" );
+						$orgs = array();
+				
+						for( $i = 0 ; $i < count($posAll); $i++ )
+						{
+							$pos = strpos($ou_User, ",");
+							$tmpString = substr($ou_User, $posAll[$i] + 3);
+							$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+						}
+				
+						$ou_User = implode("/", array_reverse($orgs));
+
+						if( array_search( $ou_User, $ousTp) !== false )
+							return "true";
+					}
+				}
+				return "false";
+			}
+			else
+				return "true";
+		} 
+		else
+		{		
+			// Se Bloqueado verifica o Grupo	
+			if( count($search) > 0 )
+			{
+				if( array_search($this->ou_User, $search) === false )
+				{
+					// Verifica permissões do grupo
+					foreach($groupsLocked as $value)
+					{							
+						$tpGroups = explode(":",$value);
+						
+						if( $tpGroups[1] == $search_Gid[0] )
+						{
+							$ousTp = explode(",",$tpGroups[2]);
+							$ou_User = strtoupper(trim($this->dn_User));
+					
+							$posAll = $this->strallpos($ou_User, "OU=" );
+							$orgs = array();
+					
+							for( $i = 0 ; $i < count($posAll); $i++ )
+							{
+								$pos = strpos($ou_User, ",");
+								$tmpString = substr($ou_User, $posAll[$i] + 3);
+								$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+							}
+					
+							$ou_User = implode("/", array_reverse($orgs));
+							
+							if( array_search( $ou_User, $ousTp) !== false )
+								return "true";
+						}
+					}
+					return "false";
+				}
+				return "true";
+			}					
+			return "true";
+		}
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.uihostsjabber.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.uihostsjabber.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.uihostsjabber.inc.php	(revision 4453)
@@ -0,0 +1,114 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.bohostsjabber.inc.php";
+
+class uihostsjabber
+{
+	private $bo;
+	private $ldap;
+
+	public $public_functions = array(
+		'backPage'  => True,
+		'edit_conf' => True,
+	);
+
+	function __construct()
+	{
+		$this->bo = new bohostsjabber();
+	}
+	
+	public final function edit_conf()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar Organizações e Servidores Jabber';	
+		
+		$_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
+    	$_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
+    	$_SESSION['phpgwinfo']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
+    	$_SESSION['phpgwinfo']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
+    	$_SESSION['phpgwinfo']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
+    	$_SESSION['phpgwinfo']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];
+			
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+		
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		// Load Language;
+		require_once "load_lang.php";
+
+		$ConfHosts = $this->bo->getHostsJabber();
+		
+		if( $ConfHosts )
+		{
+			$ConfHosts = unserialize($this->bo->getHostsJabber());
+		}
+		
+		$value_Organizations_Servers = "";
+		
+		if( is_array($ConfHosts) )	
+		{
+			foreach($ConfHosts as $itens)
+			{
+				$value_Organizations_Servers .= "<tr id='".$itens['org'].":".$itens['jabberName']."' style='width:40%' class='row_off'>";
+				$value_Organizations_Servers .=	"<td>".$itens['org']."</td>";
+				$value_Organizations_Servers .=	"<td>".$itens['jabberName']."</td>";
+				$value_Organizations_Servers .=	"<td><a href='javascript:constructScript.editHostsJ(\"".$itens['org'].":".$itens['jabberName']."\");'>".lang('Edit')."</a></td>";
+				$value_Organizations_Servers .=	"<td><a href='javascript:constructScript.removeHostsJ(\"".$itens['org'].":".$itens['jabberName']."\");'>".lang('Delete')."</a></td>";				
+				$value_Organizations_Servers .= "</tr>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'confServersJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','confServersJabber');	
+		$GLOBALS['phpgw']->template->set_var(array(
+												    'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uihostsjabber.backPage'),
+													'lang_Add_Organizations_and_Servers_Jabber' => lang('Add organizations and servers jabber'),
+													'lang_Back' => lang('Back'),
+												    'lang_Delete' => lang('Delete'),
+												    'lang_Edit' => lang('Edit'),
+												    'lang_Example' => lang('Example'),
+												    'lang_new' => lang('New'),
+												    'lang_Organization' => lang('Organization'),
+													'lang_save' => lang('Save'),
+												    'lang_ServerJabber' => lang('Servers Jabber'),
+													'lang_Registration_Organizations_and_Server_Jabber' => lang("Registration of Organizations and Servers Jabber"),													
+													'value_Organizations_Servers' => $value_Organizations_Servers,
+										));
+	
+		$GLOBALS['phpgw']->template->pparse('out','confServersJabber');
+	}
+	
+	public final function backPage()
+	{
+		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}		
+		
+		if ($_POST['cancel'])
+		{
+			$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configServer');
+		}
+
+		$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configServer');
+	}
+	
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/crypto.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/crypto.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/crypto.php	(revision 4453)
@@ -0,0 +1,27 @@
+<?php
+/***************************************************************************\
+*  Expresso - Expresso Messenger                                            *
+*      - Serge Rehem                                                        *
+*      - JETI - http://jeti-im.org/                                         *
+* ------------------------------------------------------------------------- *
+*  This code is based on AES Interop Between PHP and Java (Part 1) post at  *
+*  http://propaso.com/blog/?cat=6                                           *
+* ------------------------------------------------------------------------- *
+*  This program is free software; you can redistribute it and/or modify it  *
+*  under the terms of the GNU General Public License as published by the    *
+*  Free Software Foundation; either version 2 of the License, or (at your   *
+*  option) any later version.                                               *
+\***************************************************************************/                
+function encrypt($plain_text , $secret_key)
+{
+    $cipher     = "rijndael-128";
+    $mode       = "cbc";
+    $iv			= "@4321avaJtluafeD";
+    $td = mcrypt_module_open($cipher, "", $mode, $iv);
+    mcrypt_generic_init($td, $secret_key, $iv);
+    $cyper_text = mcrypt_generic($td, $plain_text);
+    mcrypt_generic_deinit($td);
+    mcrypt_module_close($td);
+    return bin2hex($cyper_text);
+}
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/hook_admin.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/hook_admin.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/hook_admin.inc.php	(revision 4453)
@@ -0,0 +1,26 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+// Only Modify the $file and $title variables.....
+	$title = 'jabberit_messenger';
+
+	$file = array(
+		'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconfig.configServer'),
+		'Access Permissions' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconfig.configPermission'),
+		'Auditing'	=> $GLOBALS['phpgw']->link('/index.php', 'menuaction=jabberit_messenger.uilogmessage.getLog'),	
+	);
+	
+
+//Do not modify below this line
+	display_section($appname,$title,$file);
+	
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/jabberit_sessions.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 4453)
@@ -0,0 +1,65 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+		//User
+		$_SESSION['phpgw_info']['jabberit_messenger']['user_jabber']	= $GLOBALS['phpgw_info']['user']['account_lid'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['user_id']		= $GLOBALS['phpgw_info']['user']['account_id'];		
+        $_SESSION['phpgw_info']['jabberit_messenger']['passwd']			= $GLOBALS['phpgw_info']['user']['passwd'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['mail']			= $GLOBALS['phpgw_info']['user']['email'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['fullname']		= $GLOBALS['phpgw_info']['user']['fullname'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['account_dn']		= $GLOBALS['phpgw_info']['user']['account_dn'];
+
+		// User Lang 
+		$_SESSION['phpgw_info']['jabberit_messenger']['applet_lang']	= $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+
+		//Members Group
+		$_SESSION['phpgw_info']['jabberit_messenger']['membership']		= $GLOBALS['phpgw']->accounts->membership();
+
+		//Groups Locked
+		$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']	= $GLOBALS['phpgw_info']['server']['groups_locked_jabberit'];
+
+		//Groups Search Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['groups_search']	= $GLOBALS['phpgw_info']['server']['groups_search_jabberit'];
+
+		//Server http or https 
+		$_SESSION['phpgw_info']['jabberit_messenger']['use_https']		= $GLOBALS['phpgw_info']['server']['use_https'];
+
+		//Organization Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['account_dn']		= $GLOBALS['phpgw_info']['user']['account_dn'];
+
+		//Ldap
+		$_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit']   = $GLOBALS['phpgw_info']['server']['server_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit']  = $GLOBALS['phpgw_info']['server']['context_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit']     = $GLOBALS['phpgw_info']['server']['user_ldap_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['password_ldap_jabberit'];
+        
+        //DB
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name']	 = $GLOBALS['phpgw_info']['server']['db_name'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host']	 = $GLOBALS['phpgw_info']['server']['db_host'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port']	 = $GLOBALS['phpgw_info']['server']['db_port'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user']	 = $GLOBALS['phpgw_info']['server']['db_user'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass']	 = $GLOBALS['phpgw_info']['server']['db_pass'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'] 	 = $GLOBALS['phpgw_info']['server']['db_type'];
+
+		//Jabberd
+        $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']					= $GLOBALS['phpgw_info']['server']['name_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['ip_server_jabberit']				= $GLOBALS['phpgw_info']['server']['ip_server_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['port_1_jabberit']				= $GLOBALS['phpgw_info']['server']['port_1_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['port_2_jabberit']				= $GLOBALS['phpgw_info']['server']['port_2_jabberit'];        
+        $_SESSION['phpgw_info']['jabberit_messenger']['resource_jabberit']				= $GLOBALS['phpgw_info']['server']['resource_jabberit'];
+        $_SESSION['phpgw_info']['jabberit_messenger']['group_chat_jabberit']			= $GLOBALS['phpgw_info']['server']['group_chat_server_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['name_company']					= $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit']			= $GLOBALS['phpgw_info']['server']['use_attribute_jabberit'];
+		$_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']			= $GLOBALS['phpgw_info']['server']['map_org_realm_jabberit'];
+		
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/load_lang.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/load_lang.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/load_lang.php	(revision 4453)
@@ -0,0 +1,25 @@
+<?php
+
+if ( file_exists(($fn = dirname(__FILE__) . '/../setup/phpgw_pt-br.lang')) )
+	if ( ($fp = fopen($fn,'r')) )
+	{
+		while ($data = fgets($fp,16000))
+		{
+			list($message_id, $app_name, $null, $content) = explode("\t",substr($data,0,-1));
+			$LANG_IM[$message_id] = $content;
+		}
+		fclose($fp);
+	}
+
+$script  = '<script>function jabberitGetLang(pKey){';
+$script .= 'var lang = [];';
+
+foreach ( $LANG_IM as $key => $value )
+   $script .= "lang['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';";
+
+$script .= "return lang[pKey.toLowerCase()] || '* ' + pKey;}</script>";
+
+echo $script;
+
+unset($LANG_IM);
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.ldap_im.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.ldap_im.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.ldap_im.inc.php	(revision 4453)
@@ -0,0 +1,502 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+if( is_dir('../phpgwapi/inc') )
+	define('PHPGW_API_INC','../phpgwapi/inc');
+else
+	define('PHPGW_API_INC','../../phpgwapi/inc');
+
+require_once( PHPGW_API_INC . '/class.common.inc.php');
+
+class ldap_im
+{
+	private $attribute;
+	private $common;
+	private $hostsJabber;
+	private $ldap;
+	private $ldap_context;
+	private $ldap_user;
+	private $ldap_host;
+	private $ldap_org;
+	private $ldap_pass;
+	private $max_result;
+	
+	public final function __construct()
+	{
+		$this->ldap_host 	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		$this->ldap_context	= $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];
+		$this->ldap_user	= $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];
+		$this->ldap_pass	= $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];
+
+		// Hosts Jabber
+		$this->hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);
+		
+		// Result Ldap
+		$this->max_result = 15;
+		
+		if ( file_exists('inc/attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
+		else
+			$this->attribute = "uid";
+	}
+
+	public final function __destruct()
+	{
+		if( $this->ldap )
+			@ldap_close($this->ldap);
+	}	
+
+	private final function ldapConn()
+	{
+		$this->common = new common();		
+		
+		$GLOBALS['phpgw_info']['server']['ldap_version3'] = true;
+		
+		if( $this->ldap_user && $this->ldap_pass )
+			$this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_user . "," . $this->ldap_context , $this->ldap_pass, false );
+		else
+			$this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_context , "", false );
+	}
+	
+	private final function ldapRoot()
+	{
+		$this->ldap_host 	= $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+		$this->ldap_context	= $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];
+		$this->ldap_user	= $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];
+		$this->ldap_pass	= $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];
+		
+		$this->ldapConn();
+	}
+
+	private final function ldapCatalog()
+	{
+		$version3 = true;
+		$refer	= true;
+
+		if(!function_exists('ldap_connect'))
+			return false;
+		
+		if(!$conn = ldap_connect($this->ldap_host))
+			return false;
+
+		if( $version3 )
+			if( !ldap_set_option($conn,LDAP_OPT_PROTOCOL_VERSION,3) )
+				$version3 = false;
+
+		ldap_set_option($conn, LDAP_OPT_REFERRALS, $refer);
+
+		// Bind as Admin
+		if($this->ldap_user && $this->ldap_pass && !ldap_bind($conn, $this->ldap_user . "," .$this->ldap_context, $this->ldap_pass))
+			return false;
+		
+		// Bind as Anonymous
+		if(!$this->ldap_user && !$this->ldap_pass && !@ldap_bind($conn))
+			return false;
+
+		return $conn;
+	}
+
+	private function getLdapHost()
+	{
+		return	$_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];
+	}
+
+	public final function getGroupsLdap($pData)
+	{
+		$result_groups = "";
+		
+		if( $pData['serverLdap'] == $this->ldap_host || $pData['serverLdap'] == 'localhost' )
+		{
+			$this->ldapRoot();
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+			
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $pData['serverLdap'] == $confHosts[$i]['serverLdap'] )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+				
+					$this->ldap = $this->ldapCatalog();
+				}
+			}
+		}		
+
+		if( $this->ldap )	
+		{
+			if( !$pData['search'] && $pData['ou'] != "-1" )
+			{
+				$filter = "(&(phpgwAccountType=g)(objectClass=posixGroup))";
+				$justthese = array("cn","gidNumber");
+				$search = ldap_list( $this->ldap, $pData['ou'] , $filter, $justthese );
+				$entry = ldap_get_entries( $this->ldap, $search );
+			}
+			
+			if( $pData['search'] )
+			{
+				$filter = "(&(phpgwAccountType=g)(&(objectClass=posixGroup)(cn=".$pData['search']."*)))";
+				$justthese = array("cn","gidNumber");
+				$search = ldap_search( $this->ldap, $this->ldap_context , $filter, $justthese );
+				$entry = ldap_get_entries( $this->ldap, $search );
+			}
+			
+			if( $entry && $entry['count'] > 0 )
+			{					
+				array_shift($entry);
+
+				foreach($entry as $tmp)
+					$groups[] = $tmp['cn'][0]."/".$tmp['gidnumber'][0];
+				
+				natsort($groups);
+				
+				$result_groups = "<ldap>";
+				foreach($groups as $gtmp)
+				{
+					$tmp = explode("/",$gtmp);	
+					$result_groups .= "<org><cn>".$tmp[0]."</cn><gid>".$tmp[1]."</gid></org>";
+				}
+				$result_groups .= "</ldap>";
+			}
+		}
+
+		return $result_groups;
+	}
+
+	public final function getMaxResults()
+	{
+		return $this->max_result;
+	}
+
+	public final function getMembers( $pMembers, $pServers )
+	{
+		$members = $pMembers;
+		
+		foreach( $pServers as $servers => $groups )
+		{
+			if( $servers == $this->getLdapHost() || $servers == 'localhost')
+			{
+				$this->ldapRoot();
+				
+				$count = count($members[$servers]);
+				
+				for( $i = 0; $i < $count; $i++ )
+				{
+					if ( ! $this->getMemberUid($groups, $members[$servers][$i]['uid'] ) )
+						unset( $members[$servers][$i] );
+				}
+
+				if( $this->ldap )
+					@ldap_close($this->ldap);
+			}
+			else
+			{
+				$confHosts	= $this->hostsJabber;
+			
+				for($i = 0; $i < count($confHosts); $i++ )
+				{
+					if( $this->ldap )
+						@ldap_close($this->ldap);
+						
+					if( trim($servers) === trim($confHosts[$i]['serverLdap']) )
+					{
+						$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+						$this->ldap_context = $confHosts[$i]['contextLdap'];
+						$this->ldap_user	= $confHosts[$i]['user'];
+						$this->ldap_org		= $confHosts[$i]['org'];
+						$this->ldap_pass	= $confHosts[$i]['password'];
+						$this->ldap 		= $this->ldapCatalog();
+
+						$count = count($members[$servers]);
+						
+						for( $i = 0; $i < $count; $i++ )
+						{
+							if ( ! $this->getMemberUid($groups, $members[$servers][$i]['uid'] ) )
+								unset( $members[$servers][$i] );
+						}
+		
+						if( $this->ldap )
+							@ldap_close($this->ldap);
+					}
+				}
+			}
+		}
+		
+		return $members;
+	}
+
+	private function getMemberUid( $pGidNumber, $pMemberUid )
+	{
+		$filter		= "(&(phpgwAccountType=g)(|{$pGidNumber})(memberuid={$pMemberUid}))";
+		$justthese	= array("memberuid");
+	
+		if( $this->ldap )
+		{
+			$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese );
+			$result = ldap_get_entries($this->ldap,$search);
+			if( $result["count"] )
+				return true;
+		}
+
+		return false;
+	}
+
+	public final function getGroupsMemberUid( $pGroup, $pLdap )
+	{
+		if( $pLdap == $this->ldap_host || $pLdap == 'localhost' )
+		{
+			$this->ldapRoot();
+			
+			if( $this->ldap )
+			{
+				$filter = "(&(objectclass=posixgroup)(|".$pGroup."))";
+				if( strpos($pGroup, "gidnumber") === false )
+					$filter = "(&(objectclass=posixgroup)(cn=".$pGroup."))";
+					
+				$justthese = array("dn","memberuid","gidnumber");
+				$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese);
+				$result = ldap_get_entries($this->ldap,$search);
+			}
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+		
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $this->ldap )
+					@ldap_close($this->ldap);
+					
+				if( trim($pLdap) === trim($confHosts[$i]['serverLdap']) )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+					$this->ldap = $this->ldapCatalog();
+					
+					if( $this->ldap )
+					{
+						$filter = "(&(objectclass=posixgroup)(cn=".$pGroup."))";
+						$justthese = array("dn","memberuid","gidnumber");
+						$search = ldap_search($this->ldap,$this->ldap_context,$filter, $justthese);
+						$result = ldap_get_entries($this->ldap,$search);
+					}
+					
+				}
+			}
+		}
+
+		if( $result['count'] > 0 )
+			return $result;
+
+		return false;
+	}
+
+	public final function getOrganizationsLdap($pLdap_host)
+	{
+
+		if( $pLdap_host == $this->ldap_host || $pLdap_host == 'localhost' )
+		{
+			$this->ldapRoot();
+		}
+		else
+		{
+			$confHosts	= $this->hostsJabber;
+			
+			for($i = 0; $i < count($confHosts); $i++ )
+			{
+				if( $pLdap_host == $confHosts[$i]['serverLdap'] )
+				{
+					$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+					$this->ldap_context = $confHosts[$i]['contextLdap'];
+					$this->ldap_user	= $confHosts[$i]['user'];
+					$this->ldap_org		= $confHosts[$i]['org'];
+					$this->ldap_pass	= $confHosts[$i]['password'];
+				
+					$this->ldap = $this->ldapCatalog();
+				}
+			}
+		}
+		
+		if( $this->ldap )
+		{
+			$filter = "(objectClass=organizationalUnit)";
+			$justthese = array("dn");
+			$search = ldap_search($this->ldap, $this->ldap_context, $filter, $justthese);
+			$info = ldap_get_entries($this->ldap, $search);
+		
+			for ($i=0; $i<$info["count"]; $i++)
+			{
+				$a_sectors[] = $info[$i]['dn'];
+			}	
+		}
+
+		// Retiro o count do array info e inverto o array para ordenação.
+		foreach ($a_sectors as $context)
+		{
+			$array_dn = ldap_explode_dn ( $context, 1 );
+			$array_dn_reverse  = array_reverse ( $array_dn, true );
+			array_pop ( $array_dn_reverse );
+			$inverted_dn[$context] = implode ( "#", $array_dn_reverse );
+		}
+		
+		// Ordenação
+		natcasesort($inverted_dn);
+
+		foreach ( $inverted_dn as $dn=>$invert_ufn )
+		{
+            $display = '';
+
+            $array_dn_reverse = explode ( "#", $invert_ufn );
+            $array_dn  = array_reverse ( $array_dn_reverse, true );
+
+            $level = count( $array_dn ) - (int)(count(explode(",", $this->ldap_context)) + 1);
+
+            if ($level == 0)
+                    $display .= '+';
+            else 
+            {
+				for( $i = 0; $i < $level; $i++)
+					$display .= '---';
+            }
+
+            reset ( $array_dn );
+            $display .= ' ' . (current ( $array_dn ) );
+			
+			$dn = trim(strtolower($dn));
+			$options[$dn] = $display;
+    	}
+
+	    return $options;
+
+	}
+
+	public final function getUsersLdapCatalog( $search, $pLdap = false, $uid = false )
+	{
+		$confHosts	= $this->hostsJabber;
+		$result = array();
+		$return	= array();
+		$conn	= "";		
+
+		for( $i = 0; $i < count($confHosts); $i++ )
+		{
+			if( $pLdap && $pLdap == $confHosts[$i]['serverLdap'] )
+			{
+				$this->ldap_host 	= $confHosts[$i]['serverLdap'];
+				$this->ldap_context = $confHosts[$i]['contextLdap'];
+				$this->ldap_user	= $confHosts[$i]['user'];
+				$this->ldap_org		= $confHosts[$i]['org'];
+				$this->ldap_pass	= $confHosts[$i]['password'];
+				$this->ldap 		= $this->ldapCatalog();
+
+				if( $this->ldap )
+				{
+					$filter 	= ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))";
+					$justthese	= array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" );								
+					$searchRoot	= ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context;
+					$search1	= @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
+					$entry1		= @ldap_get_entries( $this->ldap, $search1 );
+					$result 	= $this->resultArray( $entry1, $this->ldap, $this->ldap_org );
+	
+					if( count($return) > 0 )
+			          	$return = array_merge($return, $result);
+					else
+						$return = $result;
+				}
+				
+				if( $this->ldap )
+					ldap_close($this->ldap);
+			}
+		}
+		
+		return $return;
+	}
+
+	public final function getUsersLdapRoot( $search, $uidnumber = false, $ous = false )
+	{
+		$result = array();
+		$this->ldapRoot();
+
+		if( $this->ldap )
+		{
+			$searchRoot	= ( $ous ) ? $ous.",".$this->ldap_context : $this->ldap_context ;
+			$filter		= ($uidnumber) ? "(&(phpgwaccounttype=u)(|".$uidnumber.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))";
+			$justthese	= array( $this->attribute, "uidNumber", "cn", "mail", "phpgwAccountVisible", "dn", "jpegPhoto" );								
+			$search		= @ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
+			$entry		= @ldap_get_entries( $this->ldap, $search );
+			$result		= $this->resultArray( $entry, $this->ldap );
+		}		
+
+		return $result;
+	}
+	
+	private final function resultArray($pArray, $pConn, $pOrg = false)
+	{
+		$entry	= $pArray;
+		$result	= array();
+		$j		= 0;
+		
+		for( $i = 0 ; $i < $entry['count']; $i++ )
+		{
+			if ( $entry[$i]['phpgwaccountvisible'][0] != '-1' )
+			{
+				$result[$j]['uidnumber']	= $entry[$i]['uidnumber'][0];			
+				$result[$j]['mail']			= $entry[$i]['mail'][0];
+				$result[$j]['uid']			= $entry[$i][$this->attribute][0];
+				$result[$j]['jid']			= $entry[$i][$this->attribute][0];
+
+				if(!strpos($entry[$i]['dn'],"ou=") === FALSE){
+				    $ou = explode("dc=", $entry[$i]['dn']);
+				    $ou = explode("ou=",$ou[0]);
+				    $ou = array_pop($ou);
+				    $result[$j]['ou']	= strtoupper(substr($ou,0,strlen($ou)-1));
+				}else{
+				    $ou = explode("dc=", $entry[$i]['dn']);
+				    $result[$j]['ou'] = strtoupper(substr($ou[1],0,strlen($ou[1])-1));
+				}
+				
+				if( $pOrg === "*" )
+					$result[$j]['ouAll'] = "*";
+										
+				if( $entry[$i]['jpegphoto'][0] )
+				{
+					$result[$j]['photo'] = "1";
+					$filterPhoto = "(objectclass=*)";
+					$photoLdap = ldap_read($pConn, $entry[$i]['dn'], $filterPhoto, array("jpegPhoto"));
+					$firstEntry = ldap_first_entry($pConn, $photoLdap);
+					$photo = ldap_get_values_len($pConn, $firstEntry, "jpegPhoto");
+					$_SESSION['phpgw_info']['jabberit_messenger']['photo'][trim($result[$j]['ou'])][trim($result[$j]['uid'])] = $photo[0];
+				}
+				else
+					$result[$j]['photo'] = "0";
+
+				$result[$j++]['cn']	= $entry[$i]['cn'][0];
+			}
+		
+			$organization = $this->attr_org;
+		}
+		
+		return $result;
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bomodule.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bomodule.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bomodule.inc.php	(revision 4453)
@@ -0,0 +1,40 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bomodule
+{
+	private $db;
+	
+	function __construct()
+	{
+		$this->db = new db_im();
+	}
+	
+	public final function getApplicationsEnabled()
+	{
+		return $this->db->getApplicationsEnabled();
+	}
+	
+	public final function getApplicationsList()
+	{
+		return $this->db->getApplicationsList();
+	}
+	
+	public final function setApplications($Applications)
+	{
+		return $this->db->setApplications($Applications);
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.bologmessage.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.bologmessage.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.bologmessage.inc.php	(revision 4453)
@@ -0,0 +1,104 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+define('PHPGW_INCLUDE_ROOT','../');	
+define('PHPGW_API_INC','../phpgwapi/inc');
+require_once(PHPGW_API_INC . '/class.db.inc.php');
+
+class bologmessage
+{
+	private $db;
+	private $db_name;
+	private $db_host;
+	private $db_port;
+	private $db_user;
+	private $db_pass;
+	private $db_type;
+	
+	function __construct()
+	{
+		$this->db = new db();
+		$this->db_name = "bandersnatch";
+		$this->db_host = "localhost";
+		$this->db_port = "3306";
+		$this->db_user = "";
+		$this->db_pass = "";
+		$this->db_type = "mysql";
+		$this->connectDB();
+	}
+
+	function __destruct()
+	{
+		$this->db->disconnect();		
+	}
+
+	private function connectDB()
+	{
+		$this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);
+	}	
+
+	public function getMessageUser( $pUser, $pLim1, $pLim2 )
+	{
+		$query = "SELECT message_from, COUNT(*) AS total_messages, MIN(message_timestamp) AS first_message, MAX(message_timestamp) AS last_message FROM message WHERE message_from like '%".$pUser."%' GROUP BY message_from LIMIT ".$pLim1.",".$pLim2.";";
+
+		$data = array();
+
+		if($this->db->query($query))
+		{
+			while($this->db->next_record())
+				$data[] = $this->db->row();
+		}
+		
+		return $data;
+	}
+	
+	public function getMessageUserDate( $pUser, $pDtFirst, $pDtLast, $pLim1, $pLim2 )
+	{
+		$data 		= array();
+		$field_1	= "message_from";
+		$field_2	= "message_to";
+		
+		$user = explode( '@', $pUser );
+		$user = rawurlencode( $user[ 0 ] ) . '@' . $user[ 1 ]; 
+
+		$query = "SELECT ".$field_1.", ".$field_2.", COUNT(*) AS total_messages, MIN(message_timestamp) AS first_message, MAX(message_timestamp) AS last_message FROM message WHERE ".$field_1." = '".$user."' AND message_timestamp BETWEEN '".$pDtFirst."' AND '".$pDtLast."' GROUP BY ".$field_2." LIMIT ".$pLim1.",".$pLim2.";";
+		
+		if($this->db->query($query))
+		{
+			while($this->db->next_record())
+				$data[] = $this->db->row();
+		}
+		
+		return $data;
+	}
+	
+	public function getMessageUserComplete( $pUser1, $pUser2, $pDtFirst, $pDtLast, $pLim1, $pLim2 )
+	{
+		$user1 = explode( '@', $pUser1 );
+		$user1 = rawurlencode( $user1[ 0 ] ) . '@' . $user1[ 1 ]; 
+		
+		$user2 = explode( '@', $pUser2 );
+		$user2 = rawurlencode( $user2[ 0 ] ) . '@' . $user2[ 1 ]; 
+		
+		$query = "SELECT message_from, message_to, message_body, message_timestamp FROM message WHERE message_from = '".$user1."' AND message_to = '".$user2."' AND message_timestamp BETWEEN '".$pDtFirst."' AND '".$pDtLast."' ORDER BY message_timestamp DESC LIMIT ".$pLim1.",".$pLim2.";";
+		
+		if($this->db->query($query))
+		{
+			while($this->db->next_record())
+				$data[] = $this->db->row();
+		}
+		
+		return $data;
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/preferencesJMessenger.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/preferencesJMessenger.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/preferencesJMessenger.php	(revision 4453)
@@ -0,0 +1,31 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class preferencesJMessenger
+{
+	public function setPreferences($pArgs)
+	{
+		require_once "preferences.php";
+		
+		$preferences = $pArgs['preferences1'];
+		
+		if(isset($pArgs['preferences2']))
+			$preferences .= ";". $pArgs['preferences2'];
+		
+		if(isset($pArgs['preferences3']))
+			$preferences .= ";". $pArgs['preferences3'];
+
+		return setPreferences($preferences);
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.db_im.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.db_im.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.db_im.inc.php	(revision 4453)
@@ -0,0 +1,747 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+define('PHPGW_INCLUDE_ROOT','../');	
+define('PHPGW_API_INC','../phpgwapi/inc');
+require_once(PHPGW_API_INC . '/class.db.inc.php');
+require_once "class.fileDefine.inc.php";
+	
+class db_im
+{	
+	private $db;
+	private $db_name;
+	private $db_host;
+	private $db_port;
+	private $db_user;
+	private $db_pass;
+	private $db_type;
+	private $user_id;
+	private $fileD;
+	
+	public final function __construct()
+	{
+		$this->fileD = new fileDefine();
+		$this->db_name = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name'];
+		$this->db_host = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host'];
+		$this->db_port = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port'];
+		$this->db_user = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user'];
+		$this->db_pass = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass'];
+		$this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'];
+		$this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id'];		
+		$this->connectDB();
+	}
+
+	private final function connectDB()
+	{
+		$this->db = new db();
+		$this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name;
+		$this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host;
+		$this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port;
+		$this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user;
+		$this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass;
+		$this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type;
+		
+		$this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);		
+	}	
+
+	public final function editHostJabber($pItem)
+	{
+		$hostsJabber = unserialize($this->getHostsJabber());
+		$findHosts	= explode(":", $pItem['item']);
+		$return = "";	
+		
+		for( $i = 0 ; $i < count($hostsJabber); $i++ )
+			if( $hostsJabber[$i]['org'] == $findHosts[0] && $hostsJabber[$i]['jabberName'] == $findHosts[1] )
+			{
+				$return = "org:" . $hostsJabber[$i]['org'] . ";" .
+						  "jabberName:" . $hostsJabber[$i]['jabberName'] . ";" .						  	 
+						  "serverLdap:" . $hostsJabber[$i]['serverLdap'] . ";" .
+						  "contextLdap:" . $hostsJabber[$i]['contextLdap'] . ";" .
+						  "user:" . $hostsJabber[$i]['user'] . ";" .
+						  "password:" . $hostsJabber[$i]['password'] ;						  						  						  						  
+			}
+
+		return trim($return);
+	}
+	
+	public final function getApplicationsEnabled()
+	{
+		
+		$this->db->query("SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'");
+		if($this->db->num_rows())
+		{
+			$tmp = "";
+			while($this->db->next_record())
+			{
+				$tmp[]= $this->db->row();
+			}
+			return $tmp[0]['config_value'];
+		}
+		return false;
+	}
+	
+	public final function getApplicationsList()
+	{
+		$this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled = '1' order by app_name");
+		if($this->db->num_rows())
+		{
+			while ($this->db->next_record())
+			{
+				$app = $this->db->f('app_name');
+				$title = @$GLOBALS['phpgw_info']['apps'][$app]['title'];
+				if (empty($title))
+				{
+					$title = lang($app) == $app.'*' ? $app : lang($app);
+				}
+				$apps[$app] = array(
+					'title'  => $title,
+					'name'   => $app,
+					'status' => $this->db->f('app_enabled')
+				);
+			}
+		}
+		return $apps;
+	}
+	
+	public final function getGroupsBlocked()
+	{
+		$return = "";
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+				
+				if( count($result) > 0 )
+					$return = $result[0]['config_value'];
+			}
+		}
+		
+		return $return;
+	}
+
+	public final function getGroupsJmessenger()
+	{
+		$return = "";
+	
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_jmessenger_jabberit';";
+			
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+
+			if( count($result) > 0 )
+				$return = $result[0]['config_value'];
+		}
+		
+		return $return;
+		
+	}
+
+	public final function getGroupsSearch()
+	{
+		$return = "";
+	
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+			
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+
+			if( count($result) > 0 )
+				$return = $result[0]['config_value'];
+		}
+		
+		return $return;
+	}
+	
+	public final function getHostsJabber()
+	{
+		$return = "";
+	
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+			
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+
+			if( count($result) > 0 )
+				$return = $result[0]['config_value'];
+		}
+		
+		return $return;
+	}
+	
+	public final function getPreferences()
+	{
+		$result = array();
+		$query = "SELECT * FROM phpgw_preferences WHERE preference_owner = '".$this->user_id."' AND preference_app = 'jabberit_messenger'";
+		
+ 		if ( $this->db->query($query) )
+		{	
+			while($this->db->next_record())
+				$result[] = $this->db->row();
+	
+			if( count($result) > 0 )
+			{
+				$_return = unserialize($result[0]['preference_value']);
+				
+				if( is_array($_return) )
+					return $_return['preferences'];
+				else
+					return $_return;
+			}
+		}
+
+		return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5";
+	}
+
+	public final function setApplications($pApplications)
+	{
+		$apps = serialize($pApplications);
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'";
+				
+			$this->db->query($query);
+					
+			if(!$this->db->next_record())
+			{
+				$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','apps_jabberit','".$apps."')";
+				$this->db->query($query);
+				return true;
+			}
+			else
+			{
+				$query = "UPDATE phpgw_config SET config_value = '".$apps."' WHERE config_app = 'phpgwapi' AND config_name = 'apps_jabberit'";
+				$this->db->query($query);
+				return true;
+			}
+		}
+		return false;	
+	}
+	
+	public final function setAttributesLdap($pAttributes)
+	{
+		$values = $pAttributes['conf'];
+		$attributesOrg = "";		
+
+		if( $this->db )
+		{
+			$query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
+
+			if ( $this->db->query($query) )
+			{	
+				while($this->db->next_record())
+					$result[] = $this->db->row();
+		
+				if(count($result) > 0)
+					$attributesOrg = $result[0]['config_value'];
+			}
+
+			if( trim($attributesOrg) == "" )
+			{
+				$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')";
+				$this->db->query($query);
+				
+				$attr = explode(";", $values);
+				$values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>";
+				return $values;
+			}
+			else
+			{
+				$org = explode(",", $attributesOrg);
+				$newValue = explode(";", $values);
+				
+				foreach( $org as $tmp )
+				{
+					$attr = explode(";",$tmp);
+					if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) )
+						return false;
+				}
+
+				$values = $values . "," . $attributesOrg;
+				$query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
+				$this->db->query($query);
+
+				$return = explode(",",$values);
+				natcasesort($return);
+
+				$values = "<return>";
+				
+				foreach($return as $tmp)
+				{
+					$attr = explode(";", $tmp);
+					$values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>";
+				}
+					
+				$values .= "</return>";
+				
+				return $values;				
+			}
+		}
+		return false; 
+	}
+	
+	public final function setAddGroupsJmessenger($pData)
+	{
+		$pData = ( $pData ) ? serialize($pData) : "";
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_jmessenger_jabberit';";
+			
+			if( $this->db->query($query) )
+			{
+				while( $this->db->next_record())
+					$result[] = $this->db->row();					
+			}
+			
+			if( count($result) == 0 )
+				$query = "INSERT INTO phpgw_config( config_app, config_name, config_value ) VALUES('phpgwapi', 'groups_jmessenger_jabberit', '".$pData."');";
+			else
+				$query = "UPDATE phpgw_config SET config_value = '".$pData."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_jmessenger_jabberit';";
+			
+			if ( $this->db->query($query) )
+				return true;
+		}
+		
+		return false;
+	}
+
+	public final function setAddGroupsSearch($pData)
+	{
+		if( $pData)
+		{
+			if( $this->db )
+			{
+				$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND  config_name = 'groups_search_jabberit';";
+				
+				if( $this->db->query($query) )
+				{
+					while( $this->db->next_record())
+						$result[] = $this->db->row();				
+				}
+				
+				if( count($result) == 0 )
+				{
+					$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_search_jabberit','".serialize($pData)."');";
+					$this->db->query($query);
+					return true;
+				}
+				else
+				{
+					$keyLdap = array_keys($pData);
+					$resultQuery = unserialize($result[0]['config_value']);					
+					
+					if( is_array(unserialize($pData[$keyLdap[0]])) )
+						$resultQuery[$keyLdap[0]] = $pData[$keyLdap[0]];
+					else
+						unset($resultQuery[$keyLdap[0]]);
+
+					if( count($resultQuery))
+						$query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+					else
+						$query = "DELETE FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
+						
+					$this->db->query($query);
+					return true;
+				}
+			}			
+		}
+	}
+
+	public final function setGroupsLocked($pGroups)
+	{
+		$groups = "";
+		
+		if( is_array($pGroups) )
+		{
+			foreach($pGroups as $tmp)		
+				if(trim($tmp) != "")
+					$groups .= $tmp . ";";
+		
+			$groups = substr($groups, 0, strlen($groups) - 1 );		
+		}
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				if( count($result) == 0 )
+				{
+					$query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_locked_jabberit','".$groups."');";
+					$this->db->query($query);
+					return true;
+				}
+				else
+				{
+					$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+					$this->db->query($query);
+					return true;
+				}
+			}
+		}
+		
+		return false;
+	}
+	
+	public final function setHostJabber($pParam)
+	{
+		$confHostsJabber =  array();
+
+		foreach($pParam as $key => $itens)
+			$confHostsJabber[$key] = ( $key === 'org' ) ? strtoupper($itens) : $itens;
+
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+			
+			if( $this->db->query($query) )
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();				
+			}
+			
+			if( count($result) == 0 )
+			{
+				$return = "<return><confServer ou='".strtoupper($confHostsJabber['org'])."' serverName='".$confHostsJabber['jabberName']."'>".strtoupper($confHostsJabber['org']).":".$confHostsJabber['jabberName']."</confServer></return>";				
+				$hostsJabber[0] = $confHostsJabber;
+				
+				$this->fileD->ldapExternal($hostsJabber);
+				 
+				$query = "INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES('phpgwapi','map_org_realm_jabberit','".serialize($hostsJabber)."')";
+				$this->db->query($query);				
+			}
+			else
+			{
+				$resultQuery = unserialize($result[0]['config_value']);	
+				$foundOrg = false;
+				
+				foreach($resultQuery as $key => $itens)
+				{
+					$foundString = array_search($confHostsJabber['org'], $itens);
+					if( $foundString )
+					{
+						$foundOrg = $foundString;
+						$ky = $key;
+					}
+				}	
+
+				if( ! $foundOrg )
+					$resultQuery[] = $confHostsJabber;	
+				else
+					$resultQuery[$ky] = $confHostsJabber;
+
+				$return = "<return>";
+				
+				foreach( $resultQuery as $itens )
+					$return .= "<confServer ou='".$itens['org']."' serverName='".$itens['jabberName']."'>".$itens['org'].":".$itens['jabberName']."</confServer>";
+				
+				$return .= "</return>";
+				
+				$this->fileD->ldapExternal($resultQuery);
+				
+				$query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_name = 'map_org_realm_jabberit';";
+				$this->db->query($query);
+			}
+			return $return;
+		}	
+		return false;
+	}
+	
+	public final function setOuGroupsLocked($pGroup)
+	{
+		
+		function strallpos($haystack, $needle, $offset = 0)
+		{
+		    $result = array();
+		    for($i = $offset; $i< strlen($haystack); $i++ )
+		    {
+		        $pos = strpos($haystack,$needle,$i);
+		        if($pos !== FALSE)
+		        {
+		            $offset =  $pos;
+		            if($offset >= $i)
+		                $result[] = $i = $offset;
+		        }
+		    }
+	    	
+	    	return $result;
+		} 
+
+		$group = $pGroup['group'];
+		$gidnumber = $pGroup['gidnumber'];
+		$organization = strtoupper(trim($pGroup['ou']));
+
+		$posAll = strallpos($organization, "OU=" );
+		$orgs = array();
+
+		for( $i = 0 ; $i < count($posAll); $i++ )
+		{
+			$pos = strpos($organization, ",");
+			$tmpString = substr($organization, $posAll[$i] + 3);
+			$orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
+		}
+
+		$organization = implode("/", array_reverse($orgs));
+
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				$groupsLocked = explode(";",$result[0]['config_value']);
+					
+				foreach( $groupsLocked as $tmp )
+				{
+					$aux = explode(":", $tmp);
+					if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
+					{
+						if( $aux[2] )
+						{
+							$ou_groups = explode(",",$aux[2]);
+							natcasesort($ou_groups);
+							$key = array_search($organization, $ou_groups);
+							
+							if( $key === false )
+								array_push($ou_groups, $organization);
+							
+							$groups .= $group.":".$gidnumber.":";
+							
+							$return = "<return>";						
+							
+							foreach($ou_groups as $tmp)
+							{
+								$return .= "<ou attr='".$tmp."'>".$tmp."</ou>";
+								$groups .= $tmp .",";	
+							}
+							
+							$return .= "</return>";
+							
+							$groups  = substr($groups,0,strlen($groups)-1);
+							$groups .= ";";
+						}
+						else
+						{
+							$groups .= $group.":".$gidnumber.":".$organization.";";
+							$return = "<return><ou attr='".$organization."'>".$organization."</ou></return>";
+						}
+					}
+					else
+						$groups .= $tmp . ";" ;
+				}
+
+				$groups = substr($groups,0,strlen($groups)-1);
+
+				$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+				$this->db->query($query);
+				
+				return $return;
+			}
+		}
+		
+		return false;
+	}
+	
+	public final function removeAttributesLdap($pOrg)
+	{
+		$organization = $pOrg['org'];
+		
+		if( $this->db )
+		{
+			$query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
+				
+			if ( $this->db->query($query) )
+			{	
+				while( $this->db->next_record() )
+					$result[] = $this->db->row();
+		
+				if( count($result) > 0 )
+					$attributesOrg = $result[0]['config_value'];
+			}
+
+			$attributesOrg = explode(",", $attributesOrg);
+			$newValue = ""; 
+			foreach($attributesOrg as $tmp)
+			{
+				$attr = explode(";",$tmp);
+				 
+				if( strtolower(trim($attr[0])) != strtolower(trim($organization)))
+				{
+					$newValue .= $attr[0] . ";" . $attr[1] . ",";
+				}
+			}
+			
+			$newValue = substr($newValue, 0,(strlen($newValue) -1 ));
+			
+			if( trim($newValue) != "")
+				$query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
+			else
+				$query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'";
+				
+			if( $this->db->query($query))
+				return true;
+			else
+				return false;
+		}
+		return false;	
+	}
+
+	public final function removeHostsJabber($pItem)
+	{
+		$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
+
+		if( $this->db )
+		{
+			if($this->db->query($query))
+			{
+				while($this->db->next_record())
+					$result[] = $this->db->row();
+					
+				if( count($result) > 0 )
+				{
+					$confHostsOrgs = unserialize($result[0]['config_value']);
+					$hosts = explode(":", $pItem['item']);
+					$key = "";
+
+					if( count($confHostsOrgs) > 0 )
+					{
+						for( $i = 0; $i < count($confHostsOrgs); $i++)
+							if( $confHostsOrgs[$i]['org'] == $hosts[0] && $confHostsOrgs[$i]['jabberName'] == $hosts[1])
+								$key = $i;	
+
+						array_splice($confHostsOrgs, $key, 1);
+				
+						if(count($confHostsOrgs) > 0)
+						{					
+							$this->fileD->ldapExternal($confHostsOrgs);
+							$query = "UPDATE phpgw_config SET config_value = '".serialize($confHostsOrgs)."' WHERE config_name = 'map_org_realm_jabberit';";
+						}
+						else
+						{
+							$this->fileD->ldapExternal("");
+							$query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
+						}
+					}
+					else
+					{	
+						$this->fileD->ldapExternal("");						
+						$query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
+					}
+
+					if( $this->db->query($query) )
+						return "true";
+				}		
+			}			
+		}
+		return "false";
+	}
+
+	public final function removeOuGroupsLocked($pGroup)
+	{
+		$group = $pGroup['group'];
+		$gidnumber = $pGroup['gidnumber'];
+		$organization = strtoupper($pGroup['ou']);
+		$return = false;
+		
+		if( $this->db )
+		{
+			$query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";	
+			
+			if($this->db->query($query))
+			{
+
+				if ( $this->db->query($query) )
+				{	
+					while($this->db->next_record())
+						$result[] = $this->db->row();
+				}
+
+				$groupsLocked = explode(";",$result[0]['config_value']);
+				
+				foreach( $groupsLocked as $tmp )
+				{
+					$aux = explode(":",$tmp);
+					
+					if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
+					{
+						$ous = explode(",", $aux[2]);
+						$key = array_search($organization, $ous);
+
+						if( $key !== false )
+							unset($ous[$key]);
+
+						$groups .= $group.":".$gidnumber.":";
+						
+						foreach($ous as $ouTmp)
+							$groups .= $ouTmp .",";	
+						
+						$groups  = substr($groups,0,strlen($groups)-1);
+						$groups .= ";";
+					}
+					else
+						$groups .= $tmp . ";" ;									
+				}
+					
+				$groups  = substr($groups,0,strlen($groups)-1);
+			
+				$query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
+
+				if( $this->db->query($query))
+					$return = true;
+			}
+		}	
+		
+		return $return;
+	}
+
+}
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/class.boenabledgroups.inc.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/class.boenabledgroups.inc.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/class.boenabledgroups.inc.php	(revision 4453)
@@ -0,0 +1,31 @@
+<?php
+
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class boenabledgroups
+{
+	private $db;
+	
+	function __construct()
+	{
+		$this->db = new db_im();
+	}
+
+	public final function getGroupsBlocked()
+	{
+		return $this->db->getGroupsBlocked();		
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/inc/Controller.class.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/inc/Controller.class.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/inc/Controller.class.php	(revision 4453)
@@ -0,0 +1,204 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class Controller
+{
+	const __CONTROLLER_SECURITY__				= 'controller-security';
+	const __CONTROLLER_CONTENTES__				= 'controller-contentes';
+	const __CONTROLLER_SECTIONS__				= 'controller-sections';
+
+	const __STRING_ACCESS__						= 'string-access';
+	const __STRING_DELIMITER__					= 'string-delimiter';
+
+	const __CONTROLLER_CONTENTES_ITEM__			= 'item';
+	const __CONTROLLER_CONTENTES_ITEM_PARAM__	= 'param';
+	const __CONTROLLER_CONTENTES_ITEM_SECTION__	= 'section';
+
+	const __CONTROLLER_SECTIONS_ITEM__			= 'item';
+
+	private $fatalError							= false;
+	private $_PATH								= "";
+
+	public function __construct()
+	{
+		try
+		{
+			$controler_xml = dirname(__FILE__) . '/controller.xml';
+			
+			if ( !file_exists($controler_xml) )
+				throw new Exception(__CLASS__ . ' [ ERROR ] :: the configuration file does not exist');
+
+			$this->dom = new DOMDocument;
+			$this->dom->preserveWhiteSpace = FALSE;
+			$this->dom->load($controler_xml);
+
+			unset($controler_xml);
+
+			$this->controller_security = $this->dom->getElementsByTagName(self::__CONTROLLER_SECURITY__);
+			if ( $this->controller_security->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #0 ] :: the tag "' . self::__CONTROLLER_SECURITY__ . '" does not exist');
+			if ( $this->controller_security->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #1 ] :: exists more of a tag "' . self::__CONTROLLER_SECURITY__ . '"');
+
+			$this->controller_contentes = $this->dom->getElementsByTagName(self::__CONTROLLER_CONTENTES__);
+			if ( $this->controller_contentes->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #2 ] :: the tag "' . self::__CONTROLLER_CONTENTES__ . '" does not exist');
+			if ( $this->controller_contentes->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #3 ] :: exists more of a tag "' . self::__CONTROLLER_CONTENTES__ . '"');
+			$this->controller_contentes = $this->controller_contentes->item(0);
+
+			$this->controller_sections = $this->dom->getElementsByTagName("controller-sections");
+			if ( $this->controller_sections->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #4 ] :: the tag "' . self::__CONTROLLER_SECTIONS__ . '" does not exist');
+			if ( $this->controller_sections->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #5 ] :: exists more of a tag "' . self::__CONTROLLER_SECTIONS__ . '"');
+			$this->controller_sections = $this->controller_sections->item(0);
+
+			$this->string_access = $this->controller_security->item(0)->getElementsByTagName(self::__STRING_ACCESS__);
+			if ( $this->string_access->length === (int)0 )
+				throw new Exception(__CLASS__ . ' [ ERROR #6 ] :: the tag "' . self::__STRING_ACCESS__ . '" does not exist');
+			if ( $this->string_access->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #7 ] :: exists more of a tag "' . self::__STRING_ACCESS__ . '"');
+			$this->string_access = $this->string_access->item(0)->nodeValue;
+
+			$this->string_delimiter = $this->controller_security->item(0)->getElementsByTagName(self::__STRING_DELIMITER__);
+			( $this->string_delimiter->length === (int)0 )
+				and die(__CLASS__ . ' [ ERROR #8 ] :: the tag "' . self::__STRING_DELIMITER__ . '" does not exist');
+			if ( $this->string_delimiter->length !== (int)1 )
+				throw new Exception(__CLASS__ . ' [ ERROR #9 ] :: exists more of a tag "' . self::__STRING_DELIMITER__ . '"');
+			$this->string_delimiter = $this->string_delimiter->item(0)->nodeValue;
+		}
+		catch(Exception $e)
+		{
+			$this->fatalError = true;
+			return $e->getMessage();
+		}
+	}
+
+	public function __call($name, $arguments)
+	{
+		if ( !$this->fatalError )
+			switch ( $name )
+			{
+				case 'exec' :
+					return $this->_exec($arguments[0], $arguments[1]);
+				break;
+				default : return "Method not avaible";
+			}
+	}
+
+	public function __toString()
+	{
+		return __CLASS__;
+	}
+
+	private final function _exec(array &$pRequest, $pPath)
+	{
+		( $pRequest[$this->string_access] )
+			or die(__CLASS__ . ' [ ERROR #10 ] :: bad string action argument');
+
+		list($section_name, $ref, $alias) = explode($this->string_delimiter, $pRequest[$this->string_access]);
+		unset($pRequest[$this->string_access]);
+
+		$contents_itens = $this->controller_contentes->getElementsByTagName(self::__CONTROLLER_CONTENTES_ITEM__);
+
+		for ( $i = 0; $i < $contents_itens->length && $contents_itens->item($i)->getAttribute(self::__CONTROLLER_CONTENTES_ITEM_PARAM__) != $section_name; $i++ );
+		( !($i < $contents_itens->length) )
+			and die(__CLASS__ . ' [ ERROR #11 ] :: invalid section "' . $section_name . '"');
+
+		$section_name = $contents_itens->item($i)->getAttribute(self::__CONTROLLER_CONTENTES_ITEM_SECTION__);
+
+		$section = $this->controller_sections->getElementsByTagName($section_name);
+		( $section->length === (int)0 )
+			and die(__CLASS__ . ' [ ERROR #12 ] :: the tag "' . $section_name . '" does not exist');
+		( $section->length === (int)1 )
+			or die(__CLASS__ . ' [ ERROR #13 ] :: exists more of a tag "' . $section_name . '"');
+		$section = $section->item(0);
+
+		$section_itens = $section->getElementsByTagName(self::__CONTROLLER_SECTIONS_ITEM__);
+
+		if ( empty($alias) && $alias !== '0' )
+			for ( $i = 0; $i < $section_itens->length && $section_itens->item($i)->getAttribute('ref') != $ref; $i++ );
+		else
+			for ( $i = 0; $i < $section_itens->length && ( $section_itens->item($i)->getAttribute('ref') != $ref || $section_itens->item($i)->getAttribute('alias') !== $alias); $i++ );
+
+		( !($i < $section_itens->length) )
+			and die(__CLASS__ . ' [ ERROR #14 ] :: invalid reference "' . $ref . '"');
+
+		if( $section_itens->item($i)->getAttribute('path') )
+			$path = $section_itens->item($i)->getAttribute('path');
+		else if	( $section->getAttribute('path') )
+			$path = $pPath . $section->getAttribute('path');
+
+		if( !$path ) die(__CLASS__ . ' [ ERROR #15 ] :: bad path argument');
+
+		$prefix = $section_itens->item($i)->getAttribute('prefix')
+			or $prefix = $section->getAttribute('prefix');
+
+		$suffix = $section_itens->item($i)->getAttribute('suffix')
+			or $suffix = $section->getAttribute('suffix')
+			or die(__CLASS__ . ' [ ERROR #16 ] :: bad suffix argument');
+
+		return $this->$section_name(array("pSectionItem" => $section_itens->item($i), "pPath" => $path, "pPrefix" => $prefix, "pSuffix" => $suffix, "pRequest" => $pRequest));
+	}
+
+	private final function php()
+	{
+		$params = func_get_args();
+		extract($params[0]);
+
+		$class = $pSectionItem->getAttribute('class')
+			and $method = $pSectionItem->getAttribute('method')
+			or die(__CLASS__ . ' [ ERROR #17 ] :: bad class or method argument');
+
+		$file = "{$pPath}/{$pPrefix}{$class}{$pSuffix}";
+
+		file_exists($file)
+			or die(__CLASS__ . ' [ ERROR #18 ] :: the file that has the class was not opened');
+
+		require_once $file;
+
+		$obj = new ReflectionClass($class);
+
+		if ( $pRequest['classConstructor'] )
+		{
+			$obj = $obj->newInstance($pRequest['classConstructor']);
+			unset($pRequest['classConstructor']);
+		}
+		else
+			$obj = $obj->newInstance();
+
+		$method = new ReflectionMethod($class, $method);
+		$result = $method->invoke($obj, $pRequest);
+
+		return $result;
+	}
+
+	private final function js()
+	{
+		$params = func_get_args();
+		extract($params[0]);
+
+		$js = $pSectionItem->getAttribute('js')
+			or die(__CLASS__ . ' [ ERROR #18 ] :: bad js argument');
+
+		$file = "{$pPath}/{$pPrefix}{$js}{$pSuffix}";
+
+		file_exists($file)
+			or die(__CLASS__ . ' [ ERROR #19 ] :: the file that has the class was not opened' . $file );
+
+		$debug = $pSectionItem->parentNode->getAttribute('debug');
+		
+		return file_get_contents($file);
+	}
+}
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/js/makeW.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/makeW.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/makeW.js	(revision 4453)
@@ -0,0 +1,137 @@
+(function()
+{
+	var Xtools		= null;
+	var dragDrop	= null;
+	var path		= path_jabberit;
+	
+	var _dialogs = [ ];
+	
+	function build(pObj)
+	{
+		var _window = getElement( pObj.id_window + '__parent');
+		Xtools = new xtools(path);	
+		
+		if( _window == null )
+		{
+			pObj.width		= ( ( pObj.width > 160 ) ? pObj.width : 160 );
+			pObj.height		= ( ( pObj.height > 80 ) ? pObj.height : 80 );
+			pObj.onclick	= "winBuild('" + pObj.id_window + "', '" + pObj.closeAction + "')";
+			
+			_window = document.createElement("div");
+			_window.id	= pObj.id_window + "__parent";
+			_window.setAttribute("onselectstart" , "return false");
+			_window.style.width		= pObj.width + "px";
+			_window.style.height	= pObj.height + "px";
+			_window.style.top		= pObj.top + "px";
+			_window.style.left		= pObj.left + "px";
+			_window.style.position	= "absolute";
+			_window.style.zIndex	= pObj.zindex;
+			_window.innerHTML		= Xtools.parse( Xtools.xml('window_main'), 'window.xsl', pObj );
+
+			if( pObj.closeAction == "hidden" )
+				_window.setAttribute("leftOld", pObj.left + "px" );
+			
+			if( pObj.leftOld )
+				_window.setAttribute("leftOld", pObj.leftOld + "px" );
+			
+			window.document.body.insertBefore( _window, document.body.lastChild );
+			
+			if ( pObj.content.constructor == String )
+				getElement(pObj.id_window + '__content').innerHTML = pObj.content;
+			else
+				getElement(pObj.id_window + '__content').appendChild( pObj.content );
+			
+			_dialogs[ pObj.id_window ] = getElement(pObj.id_window + '__content').firstChild;
+
+			if( pObj.draggable )
+			{
+				dragDrop = new dragdrop();
+				dragDrop.set( pObj.id_window );
+			}
+			
+		}
+		else
+		{
+	    	if ( pObj.barejid && loadscript.windowPOPUP( pObj.barejid ) )
+	    		return false;
+
+	    	load(pObj.id_window, "display");
+		}
+	}
+
+	function getElement(pElement)
+	{
+		return document.getElementById(pElement);
+	}
+	
+	function load( pId, pVisible )
+	{
+		var _window = document.getElementById( pId + '__parent')
+		
+		if( _window != null )
+		{
+			if ( pVisible == "display" )
+			{
+				if( _window.style.left == "-1500px" )
+					_window.style.left = _window.getAttribute("leftOld");
+			}
+			
+			if ( pVisible == "hidden")
+			{
+				_window.setAttribute("leftOld" , _window.style.left );
+				_window.style.left = "-1500px";
+			}
+			
+			if( pVisible == "remove" )
+			{
+				document.body.removeChild( _window );
+			}
+		}
+	}
+	
+	function _window()
+	{
+		if( arguments.length > 0 )
+		{
+			var pId = null;
+			if( arguments.length == 1 )
+			{
+				var obj = arguments[0];
+				pId = obj.id_window
+				build(obj);
+			}
+			
+			if( arguments.length == 2 )
+			{
+				load( ( pId = arguments[0] ), arguments[1]);
+			}	
+		}
+
+		return ( new function( )
+		{
+			this.content = function( )
+			{
+				if ( arguments.length )
+					getElement( pId + '__content').appendChild( _dialogs[ pId ] );
+
+				return _dialogs[ obj.id_window ];
+			};
+		} );
+	}
+
+	window.bWindow	= _window;
+
+})();
+
+function winBuild()
+{
+	if( arguments.length > 0 )
+	{	
+		if( arguments.length == 1 )
+			return bWindow( arguments[0] );
+		
+		if( arguments.length == 2 )
+			return bWindow( arguments[0], arguments[1]);	
+	}
+	return false;
+}
Index: /branches/2.2.0.1/jabberit_messenger/js/editSelect.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/editSelect.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/editSelect.js	(revision 4453)
@@ -0,0 +1,186 @@
+(function()
+{
+	// Path to arrow images
+	var arrowImage = path_jabberit + 'templates/default/images/select_arrow.gif';				// Regular arrow
+	var arrowImageOver = path_jabberit + 'templates/default/images/select_arrow_over.gif';		// Mouse over
+	var arrowImageDown = path_jabberit + 'templates/default/images/select_arrow_down.gif';		// Mouse down
+
+	var activeOption;
+	var selectBoxIds = 0;
+	var currentlyOpenedOptionBox = false;
+	var editableSelect_activeArrow = false;
+	
+	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 createEditableSelect()
+	{
+		if( arguments.length > 0 )
+			dest = arguments[0];
+		else
+			return false; 
+			
+		dest.className='selectBoxInput';		
+		
+		var div = document.createElement('DIV');
+		div.id	= 'selectBox' + selectBoxIds;	
+		div.style.left		= '83px';
+		div.style.width		= dest.offsetWidth;
+		div.style.position	= 'absolute';
+		div.style.styleFloat	= 'left';			
+		
+		var parent = dest.parentNode;
+		parent.insertBefore(div,dest);
+
+		div.appendChild(dest);	
+		div.className='selectBox';
+		
+		var img = document.createElement('IMG');
+		img.src = arrowImage;
+		img.className = 'selectBoxArrow';
+		
+		img.onclick = selectBox_showOptions;
+		img.id = 'arrowSelectBox' + selectBoxIds;
+
+		div.appendChild(img);
+		
+		var optionDiv = document.createElement('DIV');
+			optionDiv.id = 'selectBoxOptions' + selectBoxIds;
+			optionDiv.className='selectBoxOptionContainer';
+			optionDiv.style.width = div.offsetWidth-2 + 'px';
+		
+		div.appendChild(optionDiv);
+		
+		if(dest.getAttribute('selectBoxOptions'))
+		{
+			var options = dest.getAttribute('selectBoxOptions').split(';');
+			var optionsTotalHeight = 0;
+			var optionArray = new Array();
+			for(var no = 0 ; no < options.length ; no++)
+			{
+				var anOption = document.createElement('DIV');
+					anOption.innerHTML = options[no];
+					anOption.className='selectBoxAnOption';
+					anOption.onclick = selectOptionValue;
+					anOption.style.width = optionDiv.style.width.replace('px','') - 2 + 'px'; 
+					anOption.onmouseover = highlightSelectBoxOption;
+					
+				
+				optionDiv.appendChild(anOption);	
+				optionsTotalHeight = optionsTotalHeight + anOption.offsetHeight;
+				optionArray.push(anOption);
+			}
+		
+			if(optionsTotalHeight > optionDiv.offsetHeight)
+			{				
+				for(var no = 0; no < optionArray.length ; no++)
+				{
+					optionArray[no].style.width = optionDiv.style.width.replace('px','') - 22 + 'px';
+				} 	
+			}		
+			
+			optionDiv.style.display = 'none';
+			optionDiv.style.visibility = 'visible';
+			optionDiv.style.zIndex = _ZINDEX++;
+		}
+
+		configEvents(dest,
+					'onkeydown',
+					function(e)
+					{
+						switch(e.keyCode)
+						{
+							case 13:
+							case 27:							
+								dest.value = dest.value;
+						        dest.focus();
+        						dest.select();
+    							break;
+						}
+					});
+					
+		configEvents(dest,
+					 'onclick',
+					 function(e)
+					 {	
+						dest.value = dest.value;
+						dest.focus();
+        				dest.select();
+						document.getElementById('selectBoxOptions0').style.display='none';
+						document.getElementById('arrowSelectBox0').src = arrowImageOver;														
+					 });		
+	}
+
+	function highlightSelectBoxOption()
+	{
+		if( this.style.backgroundColor == '#316AC5' )
+		{
+			this.style.backgroundColor = '';
+			this.style.color = '';
+		}
+		else
+		{
+			this.style.backgroundColor = '#316AC5';
+			this.style.color = '#FFF';			
+		}	
+		
+		if( activeOption )
+		{
+			activeOption.style.backgroundColor='';
+			activeOption.style.color='';			
+		}
+		activeOption = this;
+	}
+
+	function selectOptionValue()
+	{
+		var parentNode = this.parentNode.parentNode;
+		var textInput = parentNode.getElementsByTagName('INPUT')[0];
+		textInput.value = this.innerHTML;
+		this.parentNode.style.display='none';
+		document.getElementById('arrowSelectBox' + parentNode.id.replace(/[^\d]/g,'')).src = arrowImageOver;
+	}
+
+	function selectBox_showOptions()
+	{
+		if( editableSelect_activeArrow && editableSelect_activeArrow!=this )
+			editableSelect_activeArrow.src = arrowImage;
+
+		editableSelect_activeArrow = this;
+		
+		var numId = this.id.replace(/[^\d]/g,'');
+		var optionDiv = document.getElementById('selectBoxOptions' + numId);
+		if(optionDiv.style.display=='block')
+		{
+			optionDiv.style.display='none';
+			this.src = arrowImageOver;	
+		}
+		else
+		{			
+			optionDiv.style.display='block';
+			this.src = arrowImageDown;	
+			
+			if( currentlyOpenedOptionBox && currentlyOpenedOptionBox!=optionDiv)
+				currentlyOpenedOptionBox.style.display='none';	
+			
+			currentlyOpenedOptionBox= optionDiv;			
+		}
+	}
+
+	function editableSelect(){}
+	
+	editableSelect.prototype.create = createEditableSelect;
+	window.editS = new editableSelect;
+		
+})();
Index: /branches/2.2.0.1/jabberit_messenger/js/images.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/images.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/images.js	(revision 4453)
@@ -0,0 +1,31 @@
+// Images IM
+	
+	var jabberit_add_user = new Image();
+	jabberit_add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png';
+
+	var jabberit_group_close = new Image();
+	jabberit_group_close.src = path_jabberit + 'templates/default/images/group_close.gif';
+
+	var jabberit_group_close_black = new Image();
+	jabberit_group_close_black.src = path_jabberit + 'templates/default/images/group_close_black.gif';
+
+	var jabberit_group_open = new Image();
+	jabberit_group_open.src = path_jabberit + 'templates/default/images/group_open.gif';
+
+	var available_jabberit = new Image();
+	available_jabberit.src =  path_jabberit + 'templates/default/images/available.gif';
+
+	var chat_jabberit = new Image();
+	chat_jabberit.src =  path_jabberit + 'templates/default/images/chat.gif';
+
+	var away_jabberit = new Image();
+	away_jabberit.src =  path_jabberit + 'templates/default/images/away.gif';
+
+	var xa_jabberit = new Image();
+	xa_jabberit.src =  path_jabberit + 'templates/default/images/xa.gif';
+	
+	var dnd_jabberit = new Image();
+	dnd_jabberit.src = path_jabberit + 'templates/default/images/dnd.gif';
+	
+	var invisible_jabberit = new Image();
+	invisible_jabberit.src = path_jabberit + 'templates/default/images/invisible.gif';
Index: /branches/2.2.0.1/jabberit_messenger/js/functions.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/functions.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/functions.js	(revision 4453)
@@ -0,0 +1,49 @@
+(function()
+{
+	
+	function addApplication()
+	{
+		var select_appList = document.getElementById('apps_list');
+		for(var i = 0; i < select_appList.options.length ; i++)
+			if( select_appList.options[i].selected )
+			{
+				var select_appEnabled =  document.getElementById('apps_enabled');
+				var flag = false;
+				for(var j = 0; j < select_appEnabled.options.length ; j++ )
+				{
+					if( select_appEnabled.options[j].value === select_appList.options[i].value )
+						flag = true;
+				}
+				
+				if ( !flag )
+					select_appEnabled.options[select_appEnabled.length] = new Option(select_appList.options[i].text, select_appList.options[i].value, false, true);
+			}
+	}
+	
+	function removeApplication()
+	{
+		var select_appEnabled = document.getElementById('apps_enabled');
+		
+		for(var i = 0 ; i < select_appEnabled.options.length; i++ )
+			if( select_appEnabled.options[i].selected )
+			{
+				select_appEnabled.options[i].parentNode.removeChild(select_appEnabled.options[i]);
+				i--;
+			}
+	}
+	
+	function Selected()
+	{
+		var select_appEnabled = document.getElementById('apps_enabled');
+		for(var i = 0 ; i < select_appEnabled.options.length; i++ )
+			select_appEnabled.options[i].selected = true;
+	}
+	
+	function AppJabberit(){}
+
+	AppJabberit.prototype.add		= addApplication;
+	AppJabberit.prototype.remove	= removeApplication;
+	AppJabberit.prototype.select_	= Selected; 
+	window.App = new AppJabberit;
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/js/changeStatus.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/changeStatus.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/changeStatus.js	(revision 4453)
@@ -0,0 +1,28 @@
+(function()
+{
+	// Path JabberIt 
+	var path_jabberit = null;
+	
+	function getStatus(pStatus, pElement)
+	{
+    	var element = pElement;
+		var status = pStatus;
+
+		var url_img = path_jabberit + 'templates/default/images/' + status + '.gif';
+		element.style.backgroundImage = 'url(' + url_img +')';
+	}
+
+	function setPath()
+	{
+		if( arguments.length > 0 && path_jabberit == null )
+			path_jabberit = arguments[0];
+	}
+	
+	function changeStatus(){}
+
+	changeStatus.prototype.get			= getStatus;
+	changeStatus.prototype.setpath		= setPath;
+	
+	window.changestatus = new changeStatus;
+
+})();	
Index: /branches/2.2.0.1/jabberit_messenger/js/connector.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/connector.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/connector.js	(revision 4453)
@@ -0,0 +1,295 @@
+(function()
+{
+	var _THREADS = [];
+	var _ie;
+
+	function _config(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);
+		}
+	}
+
+	// xhr = XMLHttpRequest
+	function _xhr()
+	{
+		try
+		{
+			return new XMLHttpRequest();
+		}
+		catch (_e)
+		{
+			_ie = true;
+			try
+			{
+				return new ActiveXObject('Msxml2.XMLHTTP');
+			}
+			catch (_e1)
+			{
+				try
+				{
+					return new ActiveXObject('Microsoft.XMLHTTP');
+				}
+				catch (_e2)
+				{
+					return false;
+				}
+			}
+		}
+	}
+
+	function _HANDLER()
+	{
+		var _ID = arguments[0];
+
+		if  ( _THREADS[_ID] )
+		{
+			if ( _ie && _THREADS[_ID]._XHR.readyState != 4 )
+				return false;
+
+			switch ( _THREADS[_ID]._XHR.readyState )
+			{
+				case 3 :
+					if ( _THREADS[_ID]._HANDLER.stream )
+					{
+						var _data = _THREADS[_ID]._XHR.responseText.substr(_THREADS[_ID]._index).replace(/^ +| +$/g, '');
+						//alert(_data);
+						_THREADS[_ID]._rtlen = _THREADS[_ID]._XHR.responseText.length;
+
+						if ( _THREADS[_ID]._index < _THREADS[_ID]._rtlen && _data.length )
+							try
+							{
+								_THREADS[_ID]._HANDLER.stream(_data);
+							}
+							catch(_e)
+							{
+								//alert("#stream\n\n" + _e + "\n\n" + _e.description);
+							}
+
+						if ( _THREADS[_ID] )
+							_THREADS[_ID]._index = _THREADS[_ID]._rtlen;
+					}
+				break;
+				case 4 :
+					try
+					{
+						switch ( _THREADS[_ID]._XHR.status )
+						{
+							case 200:
+								var _data = ( _THREADS[_ID]._MODE == 'XML' ) ?
+									_THREADS[_ID]._XHR.responseXML :
+									_THREADS[_ID]._XHR.responseText;
+
+								if ( _ie && _THREADS[_ID]._HANDLER.stream )
+									_THREADS[_ID]._HANDLER.stream(_data);
+
+								var _request = ( _THREADS[_ID]._HANDLER.request ) ?
+									_THREADS[_ID]._HANDLER.request : false;
+
+								delete _THREADS[_ID];
+
+								if ( _request )
+									try
+									{
+										_request(_data);
+									}
+									catch(_e)
+									{
+										//alert("#request\n\n" + _e + "\n\n" + _e.description);
+									}
+
+							break; // [case : status 200]
+							case 404:
+								delete _THREADS[_ID];
+								alert('Page Not Found!');
+							break; // [case : status 404]
+							default:
+								delete _THREADS[_ID];
+						}
+					}
+					catch(e)
+					{
+					}
+				break;
+				default :
+			}
+		}
+	}
+
+	function _execute()
+	{
+		var _ID = arguments[0];
+		var _ACTION = 'act=' + _ID;
+		var _TARGET = this._PATH;
+		var _SEND = null;
+
+		if ( _TARGET != '' && _TARGET.lastIndexOf('/') != (_TARGET.length - 1) )
+			_TARGET += '/';
+
+		_TARGET += ( this._CONTROLLER ) ?
+			this._CONTROLLER  : 'controller.php';
+
+		if ( _THREADS[_ID]._METHOD == 'GET' )
+			_TARGET += '?' + _ACTION;
+
+		_THREADS[_ID]._XHR.open(_THREADS[_ID]._METHOD, _TARGET, true);
+
+		if ( _THREADS[_ID]._METHOD == 'POST' )
+		{
+			_THREADS[_ID]._XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
+			_THREADS[_ID]._XHR.setRequestHeader('Cache-Control',  'no-store, no-cache, must-revalidate');
+			_THREADS[_ID]._XHR.setRequestHeader('Cache-Control', 'post-check=0, pre-check=0');
+			_THREADS[_ID]._XHR.setRequestHeader('Pragma', 'no-cache');
+			_SEND = _ACTION + '&' + arguments[1];
+		}
+
+		_THREADS[_ID]._XHR.onreadystatechange = function(){_HANDLER(_ID);};
+		_THREADS[_ID]._XHR.send(_SEND);
+	}
+
+	function usage()
+	{
+		return ""+
+			"Description:\n"+
+			"\t<obj>.go(string access, [mixed handler[, mixed post]])\n\n"+
+			"Parameters:\n"+
+			"\taccess : assinatura de acesso Ã  camada de controle.\n"+
+			"\thandler : uma funÃ§Ã£o a ser executada no fim da requisiÃ§Ã£o\n"+
+			"\t\tou um objeto que poderÃ¡ conter dois Ã­ndices sendo\n"+
+			"\t\tque ambos deverÃ£o ser uma funÃ§Ã£o que serÃ¡ executada\n"+
+			"\t\tconforme o status do objeto xhr, sendo que na posiÃ§Ã£o\n"+
+			"\t\t'stream' serÃ¡ a funÃ§Ã£o a ser executada a cada iteraÃ§Ã£o\n"+
+			"\t\tdo objeto xhr e na posiÃ§Ã£o 'request' serÃ¡ a funÃ§Ã£o\n"+
+			"\t\ta ser executada no fim da requisiÃ§Ã£o.\n"+
+			"\tpost : se especificado deverÃ¡ ser uma query string ou um\n"+
+			"\tXML bem formatado.\n\n";
+	}
+
+	// @PARAM arguments[0] string :
+	//		assinatura de acesso Ã  camada de controle
+	//
+	// @PARAM arguments[1] object :
+	//		OBS : neste caso a conexÃ£o assumirÃ¡ que se trata de uma stream
+	//		objeto contendo dois duas funÃ§Ãµes, sendo,
+	//		no Ã­ndice stream deverÃ¡ conter uma funÃ§Ã£o que serÃ¡ execultada
+	//		a cada mudanÃ§a de status do objeto xhr
+	//	or
+	// @PARAM arguments[1] function : funcÃ£o a ser executada no retorno da
+	//		requisiÃ§Ã£o
+	//		OBS : neste caso a conexÃ£o assumirÃ¡ que se trata de uma
+	//		requisiÃ§Ã£o funÃ§Ã£o que serÃ¡ execultada no final da requisiÃ§Ã£o
+	//
+	// @PARAM arguments[2] string :
+	//		este parÃ¢metro define se a conexÃ£o Ã© via GET ou POST
+	//		caso o parÃ¢metro nÃ£o esteja presente a conexÃ£o serÃ¡ execultada
+	//		via GET, por outro lado, caso ele exista deverÃ¡ ser uma query
+	//		string vÃ¡lida ou um xml bem formatado
+	//
+	function go()
+	{
+		var _argv = arguments;
+		var _argc = _argv.length;
+		var _ID = _argv[0];
+		var _POST;
+		if ( _argc < 1 || _argc > 3 )
+			return {'error' : "#0\n\n" + usage()};
+
+		if ( typeof _ID != 'string' )
+			return {'error' : "#1\n\n" + usage()};
+
+		//if ( _THREADS[_ID] )
+		//	return {'error' : '#2 - there is a equal request running'};
+
+		_THREADS[_ID] = {
+			'_HANDLER'	: {},
+			'_METHOD'	: ( _argv[2] ) ? 'POST' : 'GET',  // [GET | POST]
+			'_MODE'		: null,	// [XML | TEXT]
+			'_TYPE'		: null,	// [4 for request | 3 for stream]
+			'_XHR'		: null	// [4 for request | 3 for stream]
+		};
+
+		if ( _argv[2] )
+			_POST = _argv[2];
+
+		if ( _argv[1] )
+			switch ( typeof _argv[1] )
+			{
+				case 'function' :
+					_THREADS[_ID]._HANDLER = {'request' : _argv[1]};
+				break;
+				case 'object' :
+					for ( var i in _argv[1] )
+						if ( i != 'stream' && i != 'request' )
+						{
+							delete _THREADS[_ID];
+							return {'error' : "#3\n\n" + usage()};
+						}
+						else if ( i == 'stream' )
+						{
+							_THREADS[_ID]._index = 0;
+							_THREADS[_ID]._rtlen = 0;
+						}
+						_THREADS[_ID]._HANDLER = _argv[1];
+				break;
+				case 'string' :
+					if ( _argc == 2 )
+					{
+						_THREADS[_ID]._METHOD = 'POST';
+						_POST = _argv[1];
+					}
+				break;
+				default :
+					//delete _THREADS[_ID];
+					//return {'error' : "#4\n\n" + usage()};
+			}
+
+		if ( !(_THREADS[_ID]._XHR = _xhr()) )
+			return {'error' : "#4 it cannot make a xhr object"};
+
+		( _THREADS[_ID]._METHOD == 'GET' ) ?
+			_execute.call(this, _ID) : _execute.call(this, _ID, _POST);
+		return {'success' : "your thread is running and the response "+
+							"will be manipulated by the handler"};
+	}
+
+	function _abort()
+	{
+		for ( var _ID in _THREADS )
+		{
+			// @TODO
+			// try/catch for unknown error of IE.
+			// Check, store and retrieve the try/catch.
+			try
+			{
+				if ( _THREADS[_ID] && _THREADS[_ID]._XHR && _THREADS[_ID]._XHR.abort )
+					_THREADS[_ID]._XHR.abort();
+
+				delete _THREADS[_ID];
+			}
+			catch(e){}
+		}
+	}
+
+	function Connector()
+	{
+		var _argv = arguments;
+		this._PATH = ( _argv.length > 0 ) ?
+			_argv[0] : '';
+		this._CONTROLLER = ( _argv.length == 2 ) ?
+			_argv[1] : false;
+	}
+
+	Connector.prototype.go = go;
+	Connector.prototype.abort = _abort;
+	window.JITConnector = Connector;
+
+	_config(window, 'onbeforeunload', _abort);
+}
+)();
Index: /branches/2.2.0.1/jabberit_messenger/js/show_hidden.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/show_hidden.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/show_hidden.js	(revision 4453)
@@ -0,0 +1,104 @@
+(function()
+{
+	var _delay;
+
+	var _last_displayed;
+	var _timeout = false;
+
+	var _event_show = false;
+	var _event_hidden = false;
+	var count = 0;
+
+	function _config(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 hdObject()
+	{
+		if( _last_displayed )
+		{
+			_last_displayed.style.display = 'none';
+			_last_displayed = false;
+		}
+	}
+
+	function _hidden()
+	{
+		if( arguments.length > 0 )
+		{
+			if( arguments[0] )
+				clearTimeout(_timeout);
+			else
+				_timeout = setTimeout( hdObject, _delay);
+		}
+	}
+
+	function _show(_element)
+	{
+		_element.style.display = 'block';
+		_last_displayed = _element;
+	}
+
+	function _view()
+	{
+		if ( arguments.length == 3 )
+		{
+			var _event = [
+				'onclick',
+				'onmousedown',
+				'onmouseout',
+				'onmouseover',
+				'onmouseup'
+			];
+
+			_event_show = false;
+			_event_hidden = false;
+
+			for ( var i in _event )
+			{
+				if ( _event[i] == arguments[0] )
+					_event_show = arguments[0];
+
+				if ( _event[i] == arguments[1] )
+					_event_hidden = arguments[1];
+			}
+
+			if ( _event_show && _event_hidden )
+			{
+				var _element = false;
+				switch ( typeof arguments[2] )
+				{
+					case 'object' :
+						_element = arguments[2];
+					break;
+					case 'string' :
+						_element = document.getElementById(arguments[2]);
+					break;
+				}
+
+				if ( _element )
+					_show(_element);
+			}
+		}
+	}
+
+	function ShowHidden()
+	{
+		_delay = ( (arguments.length > 0) && !isNaN(arguments[0]) ) ? arguments[0] : 3000;
+	}
+
+	ShowHidden.prototype.action  = _view;
+	ShowHidden.prototype.hiddenObject = _hidden;
+    window.ShowHidden = ShowHidden;
+}
+)();
Index: /branches/2.2.0.1/jabberit_messenger/js/groups_ldap.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/groups_ldap.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/groups_ldap.js	(revision 4453)
@@ -0,0 +1,199 @@
+(function()
+{
+	var _conn		= '';
+	var _keyTimeOut = false;
+	var Xtools		= '';
+
+	function addGroup()
+	{
+		if( arguments.length > 0 )
+		{
+			var select_from	= document.getElementById(arguments[0]);
+			var select_to	= document.getElementById(arguments[1]);
+			
+			for(var i = 0; i < select_to.options.length; i++)
+			{
+				if(select_to.options[i].value === "")
+				{
+					select_to.options[i].parentNode.removeChild(select_to.options[i]);
+					i--;
+				}
+			}
+			
+			for(var i = 0; i < select_from.options.length ; i++)
+			{
+				if( select_from.options[i].selected )
+				{
+					
+					var flag = false;
+					for(var j = 0; j < select_to.options.length ; j++ )
+					{
+						if( select_to.options[j].value === select_from.options[i].value )
+							flag = true;
+					}
+					
+					if ( !flag )
+					{					
+						var option = select_from.options[i].value.split(":");
+						select_to.options[select_to.length] = new Option(option[0], select_from.options[i].value, false, true);
+					}
+				}
+			}
+		}
+	}
+
+	function createObject()
+	{
+		if ( typeof(_conn) != "object" )
+			_conn   = new JITConnector(path_jabberit + 'jabberit_messenger/');				
+
+		if ( typeof(Xtools) != "object" )
+			Xtools = new xtools(path_jabberit + 'jabberit_messenger/');
+	}
+
+	function CompleteSelect(data)
+	{
+		var select_ldap = document.getElementById('groups_ldap_jabberit');
+		data = Xtools.convert(data);
+
+		while( select_ldap.hasChildNodes())
+			select_ldap.removeChild(select_ldap.firstChild);
+		
+		try
+		{
+			if ( data && data.documentElement && data.documentElement.hasChildNodes() )
+			{
+				data = data.documentElement.firstChild;
+				var label = "";
+				var value = "";
+				
+				while(data)
+				{
+					var no = data.firstChild;
+					while(no)
+					{
+						if( label == "" )
+							var label = no.firstChild.nodeValue;
+						else
+							var value = no.firstChild.nodeValue;
+						no = no.nextSibling;
+					}
+					select_ldap.options[select_ldap.options.length] = new Option(label,label + ":" + value, false, false);
+					label = value = ""; 
+					data = data.nextSibling;
+				}
+			}
+		}catch(e){}
+	}
+
+	function groupsLdap()
+	{
+		var element			= null;
+		var organization 	= "";
+		var serverLdap		= null;
+
+		createObject();
+		
+		if( arguments.length > 0 )
+		{
+			element		= arguments[0];
+			serverLdap	= element.getAttribute('serverLdap');
+			
+			if( element.options.length > 0 )
+			{
+				for(var i = 0; i < element.options.length ; i++ )
+				{
+					if( element.options[i].selected )
+					{		
+						organization =  'ou=' + element.options[i].value;
+						organization = ( serverLdap != null ) ? organization + "&serverLdap=" + serverLdap : organization ;
+					}
+				}
+			}
+			_conn.go('$this.ldap_im.getGroupsLdap', CompleteSelect, organization);
+		}
+	}
+
+	function groupsQuickSearch()
+	{
+		if( arguments.length > 0 )
+		{
+			var key = [8,27,37,38,39,40];
+			var ev = arguments[1];
+			var elGroups 	= arguments[0];
+			var labelGroups = "label_" + elGroups.id;
+			var search		= "search="+elGroups.value+"&serverLdap=" + document.getElementById(labelGroups).getAttribute('serverLdap');
+			
+			var cleanLabel = function(Id)
+			{
+				document.getElementById(Id).innerHTML = "";
+			}
+			
+			var getGroups = function(search, Id)
+			{
+				createObject();
+				
+				_conn.go('$this.ldap_im.getGroupsLdap',CompleteSelect , search);
+
+				cleanLabel(Id);
+			}
+
+			for(var i in key)
+				if( ev.keyCode == key[i])
+					return false;
+
+			if( elGroups.value.length < 4 )
+			{
+				document.getElementById(labelGroups).innerHTML = " ( Digite mais " + ( 4 - elGroups.value.length ) + " )";
+				setTimeout(function(){cleanLabel(labelGroups);}, 2000);
+			}
+			else
+			{
+				document.getElementById(labelGroups).innerHTML = " ( Buscando aguarde .... )";
+				
+				if( _keyTimeOut )
+					clearTimeout(_keyTimeOut);
+
+				_keyTimeOut = setTimeout(function(){ getGroups(search, labelGroups); }, 1000);
+			}	
+		}
+	}
+	
+	function Selected()
+	{
+		if( arguments.length > 0 )
+		{
+			var _select = document.getElementById(arguments[0]);
+			
+			for( var i = 0 ; i < _select.options.length; i++ )
+				_select[i].selected = true;
+		}
+	}
+	
+	function removeGroup()
+	{
+		if( arguments.length > 0 )
+		{
+			var _select = document.getElementById(arguments[0]);
+			
+			for( var i = 0 ; i < _select.options.length; i++ )
+			{
+				if( _select.options[i].selected )
+				{
+					_select.options[i].parentNode.removeChild( _select.options[i] );
+					i--;
+				}
+			}
+		}
+	}
+	
+	function groups_ldap(){}
+
+	groups_ldap.prototype.add			= addGroup;
+	groups_ldap.prototype.remove		= removeGroup;
+	groups_ldap.prototype.groups		= groupsLdap;
+	groups_ldap.prototype.quickSearch	= groupsQuickSearch;
+	groups_ldap.prototype.selectAll		= Selected;
+	window.groups_ldap					= new groups_ldap;
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/js/load.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/load.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/load.js	(revision 4453)
@@ -0,0 +1,793 @@
+(function()
+{
+	var _autoStatusTime = 60000; // 1 minuto
+	var _autoStatus;
+	var _conn		= new JITConnector(path_jabberit);
+	var Xtools 		= new xtools(path_jabberit);
+	var _showhidden = new ShowHidden(300);
+	var _win_contacts = null;
+	var myWindow	  = null;
+	var flagMouseOver = '';
+	var flagOpenIM	  = '';
+	var flagOpenPopup = '';
+	var flagAwayIM	  = '';
+	var itensSubMenu  = [];
+    
+	// Sniffer Browser
+	var agt	= navigator.userAgent.toLowerCase();
+    var is_major = parseInt(navigator.appVersion);
+    var is_minor = parseFloat(navigator.appVersion);    
+    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
+                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
+                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
+    var is_gecko = (agt.indexOf('gecko') != -1);
+    var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1);
+    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
+    var is_ie3    = (is_ie && (is_major < 4));
+    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
+    var is_ie4up  = (is_ie && (is_major >= 4));
+    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
+    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
+    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
+    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
+    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
+    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);    
+    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
+
+	var _ldap = new JITLdap( _conn, Xtools, is_ie );
+
+	function addContacts()
+	{
+		_ldap.load(myWindow);
+	}
+
+	function addIcon()
+	{
+		
+		var StatusBar = document.getElementById('divStatusBar');
+
+		/**
+		 * @quando estiver habilitada a opção fora de escritório nos filtros. 
+		 */
+		
+		if( div_write_msg = document.getElementById('em_div_write_msg') )
+		{		
+			var StatusBarIM = document.getElementById('JabberMessenger');
+			div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg);
+			StatusBarIM.style.paddingLeft = '33px';
+			return;			
+		}
+		
+		if( StatusBar )
+		{
+			StatusBar.style.paddingLeft = '33px';
+			
+			var _div = document.createElement('div');
+			_div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling));
+			StatusBar.parentNode.insertBefore(_div,StatusBar);
+			
+			var divJabber = document.createElement('div');
+				divJabber.setAttribute('id', 'JabberMessenger');
+			
+			var _status = top.document.createElement('div');
+				_status.setAttribute('id', 'jabberit_login');
+				_status.style.background = 'no-repeat';
+				_status.style.backgroundImage = 'url(' + jabberit_group_open.src + ')';
+				_status.style.float = 'left';
+				_status.style.height = '15px';
+				_status.style.left = '7px';
+				_status.style.margin = '8 0 0 10px';
+				_status.style.padding = '0px';
+				_status.style.position = 'absolute';
+				_status.style.width = '15px';
+				_status.style.cursor = 'pointer';
+
+			divJabber.insertBefore(_status,divJabber.firstChild);
+
+			var _menu;
+				_menu = top.document.createElement('div');
+				_menu.setAttribute('id','fast_menu_jabberit');
+				_menu.className = "x-menu";
+				_menu.style.zIndex = '99999';
+				_menu.onmouseout = function(){ _showhidden.hiddenObject(false); };
+				_menu.onmouseover = function(){ _showhidden.hiddenObject(true); };
+				
+			divJabber.insertBefore(_menu, divJabber.firstChild);
+
+			var _menu_div = top.document.createElement('div');
+				_menu_div.setAttribute('id','status_Jabber_Expresso');
+				_menu_div.style.background = 'no-repeat';
+				_menu_div.style.backgroundImage = 'url(' + jabberit_add_user.src + ')';
+				_menu_div.style.float = 'left';
+				_menu_div.style.height = '18px';
+				_menu_div.style.left = '19px';
+				_menu_div.style.margin = '0 0 0 10px';
+				_menu_div.style.padding = '0px';
+				_menu_div.style.position = 'absolute';
+				_menu_div.style.width = '18px';
+				_menu_div.style.cursor = 'pointer';
+				_menu_div.style.zindex = '999999';
+			
+			statusJabberExpresso = _menu_div;
+			
+			divJabber.insertBefore(_menu_div, divJabber.firstChild);
+			StatusBar.insertBefore(divJabber, StatusBar.firstChild);			
+			
+			configEvents(_menu_div,'onclick', windowShow);
+
+			configEvents(
+				_status,
+				'onclick',
+				function()
+				{
+					var _options = [
+						['Add Contact', addContacts],
+						['Help', helpJabberit],
+						['Preferences', preferences],
+						['Change Status', subMenuChangeStatus]
+					];
+
+					var _style_text = 'cursor: pointer;' +
+									  'padding:2px 2px 2px 15px;' +
+									  'background: no-repeat url(' + jabberit_group_close.src + ');';					
+
+					var _xml = Xtools.xml('menu');
+					var _option;
+					var _item;
+					var _action;
+					var _style;
+
+					for ( var i in _options )
+					{
+						_option = _xml.createElement('option');
+
+						_item = _xml.createElement('item');
+						_item.appendChild(_xml.createTextNode(jabberitGetLang(_options[i][0])));
+						
+						_style = _xml.createElement('style');
+						_style.appendChild(_xml.createTextNode(_style_text));
+
+						_option.appendChild(_item);
+						_option.appendChild(_style);
+
+						_xml.documentElement.appendChild(_option);
+					}
+
+					_menu.innerHTML = Xtools.parse(_xml, 'options.xsl');
+					_showhidden.action('onmouseover', 'onmouseout', _menu);
+
+					_item = _menu.firstChild;
+
+					for ( var i in _options )
+					{
+						_item.childNodes[i].setAttribute('presence', _options[i]);
+						configEvents( _item.childNodes[i], 'onclick', _options[i][1] );
+					}
+				});
+		}
+	}
+
+	function addUser()
+	{
+		_ldap.addUser();
+	}
+	
+	function autoStatus()
+	{
+		if ( _autoStatus )
+			clearTimeout(_autoStatus);
+
+		var _div_status = document.getElementById('status_Jabber_Expresso');
+		if ( _div_status )
+		{
+			var _status = _div_status.style.backgroundImage;
+			_status = _status.substr(_status.lastIndexOf('/') + 1);
+			_status = _status.substr(0, _status.indexOf('.'));
+			if ( _status == 'xa' && _div_status.getAttribute('autoStatus') )
+			{
+				_div_status.removeAttribute('autoStatus');
+				changeStatusJava("2");
+			}
+		}
+
+		var TimeStatus = flagAwayIM.split(':');
+
+		if( TimeStatus[1] )
+			_autoStatus = setTimeout(autoStatusHandler, parseInt(TimeStatus[1])*_autoStatusTime);
+		else
+			_autoStatus = setTimeout(autoStatusHandler, parseInt(_autoStatusTime));
+	}
+
+	function autoStatusHandler()
+	{
+		var _div_status = document.getElementById('status_Jabber_Expresso');
+		if ( _div_status )
+		{
+			var _status = _div_status.style.backgroundImage;
+			_status = _status.substr(_status.lastIndexOf('/') + 1);
+			_status = _status.substr(0, _status.indexOf('.'));
+			if ( _status == 'available' )
+			{
+				_div_status.setAttribute('autoStatus','true');
+				changeStatusJava("5");
+			}
+		}
+	}
+
+	function changeStatusJava()
+	{
+  		if(arguments.length > 0 )
+  		{
+	 		try
+	 		{
+	 			var status	= arguments[0];
+	 			var msg	   	= ( arguments[1] ) ? arguments[1] : "";
+	 		
+	 			// If Layer;
+	 			if( elementIframe = document.getElementById('iframe_applet_jabberit') )
+	 			{
+					if( !is_ie )
+						elementIframe.contentDocument.applets[0].changeStatusfromExpresso(status, msg);
+					else
+						elementIframe.contentWindow.document.applets[0].changeStatusfromExpresso(status, msg);
+				}
+				else // If Pop-Up
+				{
+					myWindow.document.applets[0].changeStatusfromExpresso(status, msg);
+				}
+				
+			}
+			catch(e)
+			{
+				if( confirm('Deseja conectar o IM ?') )
+					windowShow();
+			}
+	   	}		
+	}
+
+	function configEvents(pObj, pEvent, pHandler)
+	{
+		if ( typeof pObj == 'object' )
+		{
+			if ( pEvent.substring(0, 2) == 'on' )
+				pEvent = pEvent.substring(2, pEvent.length );
+
+			if ( arguments.length == 3 )
+			{
+				if ( pObj.addEventListener )
+					pObj.addEventListener(pEvent, pHandler, false );
+				else if ( pObj.attachEvent )
+					pObj.attachEvent( 'on' + pEvent, pHandler );
+			}
+			else if ( arguments.length == 4 )
+			{
+				if ( pObj.removeEventListener )
+					pObj.removeEventListener( pEvent, pHandler, false );
+				else if ( pObj.detachEvent )
+					pObj.detachEvent( 'on' + pEvent, pHandler );
+			}
+		}
+	}
+
+	function closeWindow()
+	{
+		var url_img 		= path_jabberit + 'templates/default/images/unavailable.gif';
+		var elementStatus	= getElementStatus('status_Jabber_Expresso');
+
+		elementStatus.style.backgroundImage = 'url(' + url_img +')';
+
+		myWindow = null;
+	}
+
+	function getElementStatus()
+	{
+		return document.getElementById('status_Jabber_Expresso');
+	}
+
+	function getPreferences()
+	{
+		if( flagOpenIM == '' )
+		{
+			_conn.go("$this.preferences.getPreferences",
+						function(data)
+						{
+							var autoConnect = '';
+							flagOpenIM = data;
+
+							if( data.indexOf(';') != -1)
+							{
+								var temp = data.split(';');
+								autoConnect = flagOpenIM = temp[0];
+								
+								// Open as Pop-Up
+								flagOpenPopup = 'openWindowJabberitPopUp:false';
+								
+								if( temp[1] )
+								{ 
+									if( temp[1] == 'openWindowJabberitPopUp:true' || temp[1] == 'openWindowJabberitPopUp:false')
+										flagOpenPopup = temp[1];
+								}
+								
+								// Away
+								flagAwayIM = 'flagAwayIM:5';
+								
+								if( temp[2] )
+								{
+									flagAwayIM = temp[2];
+								}
+							}
+							else
+							{
+								autoConnect = flagOpenIM;
+							}
+							
+							if( autoConnect == 'openWindowJabberit:true' )
+							{
+								setTimeout('loadscript.windowHidden();', 2500);
+							}
+					 	});
+		}
+
+	}
+
+	function helpJabberit()
+	{
+		var myWindowHelp = window.open( path_jabberit + 'help.php', 'HelpjabberIM', 'width=800,height=495,top=50,left=50,scrollbars=yes');
+	}
+
+	function keyPressSearch()
+	{
+		var ev = arguments[0];
+		var element = arguments[1];
+
+		if ( ev.keyCode == 13 )
+			if( element.value.length >= 4 )
+				_ldap.search( element.value );	
+			else
+				alert(jabberitGetLang('Your search argument must be longer than 4 characters.'));
+	}
+	
+	function openPopup()
+	{
+		var widPopup = '220';
+
+		if( is_ie )
+			widPopup = '250';
+
+		try{
+
+			if( myWindow == null )
+			{	
+				myWindow = window.open('','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
+				myWindow.close();
+				myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
+				myWindow.blur();
+				configEvents( myWindow, 'onbeforeunload', closeWindow );
+			}
+			else
+			{
+				for( var i = 15 ; i > 0 ; i-- )
+				{
+					myWindow.moveBy(i,0); myWindow.moveBy(-i,0);
+				}
+				myWindow.focus();
+			}
+		}
+		catch(e)
+		{
+			delete myWindow;
+			myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
+			myWindow.blur();
+			configEvents( myWindow, 'onbeforeunload', closeWindow );
+		}
+	}
+
+	function openWindow()
+	{
+		if( document.getElementById(_win_contacts.id_window + "__content") == null )
+		{
+			
+			var _params = {
+							'path' : path_jabberit,
+							'width' : ( is_ie ) ? '100%' : '220px'
+			};
+			
+			_win_contacts.content = Xtools.parse(Xtools.xml('contacts_jabberit'), 'contacts_jabberit.xsl', _params );
+			
+			winBuild( _win_contacts );
+		}
+	}
+
+	function preferences()
+	{
+		var _params = {
+					   'path'  : path_jabberit,
+					   'lang1' : jabberitGetLang('Your Preferences'),
+					   'lang2' : jabberitGetLang('Connection'),	
+					   'lang3' : jabberitGetLang('Enable Auto Login IM'),
+					   'lang4' : jabberitGetLang('Users OffLine'),
+					   'lang5' : jabberitGetLang('Show friends Offline'),
+					   'lang6' : jabberitGetLang('Save'),
+					   'lang7' : jabberitGetLang('Cancel'),
+					   'lang8' : jabberitGetLang('Window'),
+					   'lang9' : jabberitGetLang('Open as Pop-Up Window'),
+					   'lang10' : jabberitGetLang('Away'),
+					   'lang11' : jabberitGetLang('Set status to away after'),
+					   'lang12' : jabberitGetLang('minutes'),						   
+					   'langYes': jabberitGetLang('Yes'),
+					   'langNo' : jabberitGetLang('No')											   
+	  	};
+		
+		var _win_preferences = { 
+									id_window	 : "jabberit_preferences",
+									width		 : 430,
+									height		 : 330,
+									top		 	 : 150,
+									left		 : 100,
+									draggable	 : true,
+									visible	 	 : "display",
+									resizable	 : true,
+									zindex		 : _ZINDEX++,
+									title		 : 'Expresso Messenger - ' + jabberitGetLang('Preferences'),
+									closeAction  : "remove",
+									content		 : Xtools.parse(Xtools.xml('preferences_jabberit'), 'preferences_jabberit.xsl', _params)
+		};
+
+		winBuild(_win_preferences);
+
+		// Element openWindowJabberit
+		var value1			= flagOpenIM.split(':');
+		var element1		= document.getElementById(value1[0]);
+		var valueSelect1	= value1[1];
+		
+		for(var i = 0; i < element1.options.length; i++)
+			if( element1.options[i].value == valueSelect1 )
+				element1.options[i].selected = true;
+
+		
+		// Element openWindowJabberitPopUp
+		var value2			= flagOpenPopup.split(':');
+		var element2		= document.getElementById(value2[0]);
+		var valueSelect2	= value2[1];
+			
+		for(var i = 0; i < element2.options.length; i++)
+			if( element2.options[i].value == valueSelect2 )
+				element2.options[i].selected = true;
+				
+		// Element flagAwayIM
+		var value3		= flagAwayIM.split(':');
+		var element3	= document.getElementById(value3[0]);
+		element3.value	= value3[1];
+		
+		
+		var _pButtons =
+		{
+			'lang1' : jabberitGetLang('Save'),
+			'lang2' : jabberitGetLang('Close'),
+			'onclickClose' : 'winBuild("jabberit_preferences","remove");',
+			'onclickSubmit' : 'javascript:loadscript.setPrefe();'
+		}; 
+		
+		document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
+		
+	}
+
+	function searchUser()
+	{
+		var element = arguments[0].previousSibling;
+		
+		if( element.value.length >= 4 )
+			_ldap.search( element.value );	
+		else
+			alert(jabberitGetLang('Your search argument must be longer than 4 characters.'));
+	}
+
+	function setItensStatusMenu()
+	{
+		var applet = "";
+		
+		try
+		{
+			// Layer
+			if( elementIframe = document.getElementById('iframe_applet_jabberit') )
+			{
+				if( !is_ie )
+					applet = elementIframe.contentDocument.applets[0];
+				else
+					applet = elementIframe.contentWindow.document.applets[0];
+			}
+			else // Pop-up
+			{
+				applet = myWindow.document.applets[0];
+			}
+			
+			for( i = 1; i < 6; i++ )
+				itensSubMenu[i] = applet.getStatusMessages(i);
+			
+		}catch(e){}
+	}
+	
+	function setPreferences()
+	{
+		// Element openWindowJabberit
+		var elementOpenW = document.getElementById('openWindowJabberit');
+		var value = '';
+		var flagReload = false;
+		
+		for(var i = 0 ; i < elementOpenW.options.length; i++)
+			if( elementOpenW.options[i].selected == true)
+			{
+				value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value;
+				flagOpenIM = 'openWindowJabberit:' + elementOpenW.options[i].value;
+			}
+
+		// Element openWindowJabberitPopUp
+		var elementOpenPop = document.getElementById('openWindowJabberitPopUp');	
+
+		for(var i = 0; i < elementOpenPop.options.length; i++ )
+			if( elementOpenPop.options[i].selected ==  true )
+			{
+				value += '&preferences2=openWindowJabberitPopUp:' + elementOpenPop.options[i].value;
+				
+				if( flagOpenPopup != 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value)
+					flagReload = true;
+					
+				flagOpenPopup = 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value;
+			}
+		
+		// Element flagAwayIM
+		var elementFlagIM = document.getElementById('flagAwayIM');
+		
+		if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 )
+		{
+			flagAwayIM = 'flagAwayIM:' + elementFlagIM.value;
+			value += '&preferences3=flagAwayIM:' + elementFlagIM.value;
+		}
+		else
+		{
+			alert(jabberitGetLang('Enter a value greater than or equal to 1!'));
+			return false;
+		}
+
+		_conn.go('$this.preferences.setPreferences',
+				 function(data)
+				 {
+					if(data == 'true')
+					{
+						if( flagReload )
+						{
+							window.location.reload();
+							myWindow.close();							
+						}
+					}
+					else{ alert(jabberitGetLang('Error saving your preferences!')); }
+
+					winBuild('jabberit_preferences', 'remove');
+				 },
+				 value);
+	}
+	
+	function windowConf(pLeft)
+	{
+		if( !is_ie )
+			var sizeW = { w : 234, h : 432 };
+		else
+			var sizeW = { w : 264, h : 430 };
+		
+		_win_contacts = {
+							id_window	 : "jabberit_contacts",
+							width		 : sizeW.w,
+							height		 : sizeW.h,
+							top		 	 : 60,
+							left 		 : -1500,
+							leftOld		 : 50,
+							draggable	 : true,
+							visible	 	 : "display",
+							resizable	 : true,
+							zindex		 : _ZINDEX++,
+							title		 : "Expresso Messenger",
+							closeAction  : "hidden",
+							content		 : ""
+		};
+		
+	}
+	
+	function windowHidden()
+	{
+		if( _win_contacts == null )
+		{
+			windowConf(-1500);
+			windowContacts();
+		}
+		else
+			winBuild( _win_contacts.id_window , "display" );
+	}
+	
+	function windowShow()
+	{
+		if( _win_contacts == null )
+		{
+			windowConf(70);
+			windowContacts();			
+		}
+		else
+			winBuild( _win_contacts.id_window , "display" );
+	}
+	
+	function windowContacts()
+	{
+		if( flagOpenPopup === 'openWindowJabberitPopUp:true' )
+		{
+			openPopup();
+		}
+		else
+		{
+			openWindow();
+		}
+	}
+
+	function subMenuChangeStatus()
+	{
+		if(document.getElementById('subMenu_Change_Status_JabberIt') == null )
+		{
+			var _itens  = [
+								['Online', 'loadscript.subMnChStIt("2",this);', 'available_jabberit.src','jabberit_group_close.src'],
+								['Free For Chat', 'loadscript.subMnChStIt("1",this);', 'chat_jabberit.src','jabberit_group_close.src'],
+								['Xa', 'loadscript.subMnChStIt("3",this);','xa_jabberit.src','jabberit_group_close.src'],
+								['Dnd', 'loadscript.subMnChStIt("4",this);','dnd_jabberit.src','jabberit_group_close.src'],
+								['Away', 'loadscript.subMnChStIt("5",this);','away_jabberit.src','jabberit_group_close.src'],
+								['Invisible', 'loadscript.subMnChStIt("6",this);','invisible_jabberit.src']
+						  ];
+	
+			var _itensMenu = "<dl style='margin:2px 2px !important; font-size:8pt !important;'>";
+			
+			for(var i in _itens)
+			{
+				_itensMenu += '<dt onmouseover="elementOnMouseOver(this);" onmouseout="elementOnMouseOut(this, false);" style="cursor: pointer;">';
+				_itensMenu += "<div ";
+				if( _itens[i][3] )
+					_itensMenu += "style='background: url(" + eval(_itens[i][3]) + ") no-repeat center right'";
+				_itensMenu += "onclick="+_itens[i][1] +"><img src='" + eval(_itens[i][2]) + "' style='margin-right:3px;'/>" + jabberitGetLang(_itens[i][0]) + "</div></dt>";
+			}
+
+			_itensMenu += "</dl>";
+	
+			var _subMenu_div = document.createElement("div");
+				_subMenu_div.setAttribute('id','subMenu_Change_Status_JabberIt');
+				_subMenu_div.className		= 'x-subMenuChangeStatus';
+				_subMenu_div.style.left		= '55px'; 
+				_subMenu_div.style.width	= ( is_ie ) ? '160px': '140px';;
+				_subMenu_div.style.zindex	= '99999';
+				_subMenu_div.innerHTML		= _itensMenu; 
+	
+			var elementParent = document.getElementById('fast_menu_jabberit');
+			elementParent.appendChild(_subMenu_div);
+			
+			setItensStatusMenu();
+		}
+	}
+	
+	function subMenuChangeStatusItens()
+	{
+		if( arguments.length > 0 )
+		{
+			var status	= arguments[0];
+			var element	= arguments[1];
+			var msg		= "";
+
+			if( itensSubMenu.length > 0 )
+			{
+				var string = "";
+				for( var i = 0; i < itensSubMenu.length ; i++ )
+				{
+					if( itensSubMenu[i] != undefined )
+					{
+						string = itensSubMenu[i].substring(1);
+						string = string.substring(0, string.indexOf("]")).toString();
+
+						if( string != "" )
+						{
+							if( status == i )
+							{
+								if ( ! ( string.indexOf( ',' ) < 0 ) )
+								{
+									var phases = string.split(',');
+									var _itensMenu = "<dl style='padding:1px !important; margin:2px 2px !important;font-size:8pt !important;'>";
+									for ( var m = 0; m < phases.length; m++ )
+									{
+										_itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;'>";
+										_itensMenu += "<div onclick='loadscript.chgStatusJava(\""+i+"\", \""+phases[m]+"\")'><img src='" + jabberit_group_close.src + "' style='margin-right:3px;'/>" + phases[m] + "</div></dt>";	
+									}
+									_itensMenu += "</dl>";
+								}
+								else
+								{
+									var _itensMenu  = "<dl style='padding:1px !important; margin:2px 2px !important;font-size:8pt !important;'>";
+										_itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;'>";								
+										_itensMenu += "<div onclick='loadscript.chgStatusJava(\""+i+"\", \""+string+"\");'><img src='" + jabberit_group_close.src + "' style='margin-right:3px;'/>" + string + "</div></dt>";
+										_itensMenu += "</dl>";
+								}
+							}
+
+							for( var j = 0 ; j < 6 ; j++ )
+							{
+								if( document.getElementById('ItemSubMenuJabberd_' + j) != null )
+								{
+									var ElementItem = document.getElementById('ItemSubMenuJabberd_' + j);
+										ElementItem.parentNode.removeChild(ElementItem);
+								}
+							}
+						}
+					}
+				}
+				
+				if( _itensMenu ) 
+				{
+					var _subMenuItem_div = document.createElement("div");
+					_subMenuItem_div.setAttribute('id','ItemSubMenuJabberd_' + status);
+					_subMenuItem_div.className		= "x-subMenuChangeStatusItens";	
+					_subMenuItem_div.style.margin	= ( is_ie ) ? '-3px 5px 0px 0px' : '-20px 5px 0px 0px';
+					_subMenuItem_div.style.left		= ( is_ie ) ? '157px' : '140px'; 
+					_subMenuItem_div.style.width	= ( is_ie ) ? '180px': '160px';
+					_subMenuItem_div.style.zindex	= '99999';
+					_subMenuItem_div.innerHTML		= _itensMenu; 
+					
+					element.appendChild( _subMenuItem_div );
+					
+				}else
+					changeStatusJava(status,"");
+			}
+		}
+	}
+
+	function Load()
+	{
+		addIcon();
+		getPreferences();
+		
+		// AutoStatus Away		
+		autoStatus();
+		configEvents(document, 'onmousemove', autoStatus);
+		configEvents(document, 'onkeypress', autoStatus);
+	}
+
+	Load.prototype.adIcon			= addIcon;
+	Load.prototype.addUser			= addUser;
+	Load.prototype.autoStatusIM		= autoStatus;
+	Load.prototype.chgStatusJava	= changeStatusJava;
+	Load.prototype.closeW			= closeWindow;
+	Load.prototype.getElement		= getElementStatus;
+	Load.prototype.keyPress			= keyPressSearch;
+	Load.prototype.openPopup		= openPopup;
+	Load.prototype.search			= searchUser;
+	Load.prototype.setPrefe 		= setPreferences;
+	Load.prototype.subMnChStIt		= subMenuChangeStatusItens;
+	Load.prototype.windowHidden		= windowHidden;
+	
+	
+	configEvents(window, 'onload', function(){ window.loadscript = new Load; });
+
+})();
+
+// Functions OnMouseOver e OnMouseOut
+
+function elementOnMouseOut()
+{
+	if( arguments.length > 0 )
+	{
+		var _element = arguments[0];
+			_element.style.backgroundColor = '';
+			_element.style.border = '';
+			if( !arguments[1] )
+				_element.className = '';
+	}
+}
+
+function elementOnMouseOver()
+{
+	if( arguments.length > 0 )
+	{
+		var _element = arguments[0];
+			_element.className = 'x-menuOnMouseOver';
+	}
+}
Index: /branches/2.2.0.1/jabberit_messenger/js/ldap.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/ldap.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/ldap.js	(revision 4453)
@@ -0,0 +1,297 @@
+(function()
+{
+	var _conn;
+	var Xtools;
+	var _myWindow;
+	var _is_ie;
+
+	function addUser()
+	{
+		var _name = document.getElementById('im_name');
+		var _group = document.getElementById('im_group');
+		var jidUser = document.getElementById('im_jidUser').value; 
+		var	_jid = document.getElementById('im_jid').value;
+
+		if ( _jid )
+		{
+			_name.value = _name.value.replace(/^( )*|( )*$/g, '');
+			_group.value = _group.value.replace(/^( )*|( )*$/g, '');
+
+			if ( !(_name.value) || !(_group.value) )
+			{
+				if ( !(_name.value) || !(_group.value) )
+				{
+					alert( jabberitGetLang('ATTENTION') + "!!\n" +
+						   jabberitGetLang("Enter a NAME") + " / " +
+						   jabberitGetLang("Enter a GROUP") + ".");
+				}
+			}
+			else
+			{
+				var _uid;
+				
+				if ( (_uid = document.getElementById('im_uid')) )
+					_uid = _uid.value;
+				else
+					_uid = _jid.substr(0, (_jid.indexOf('@') - 1));
+
+				_conn.go('$this.contacts_im.verifyAddNewContact',
+						 function(data)
+						 {
+							data = eval(data);
+
+							if( !data )
+							{
+								alert("*********** " + jabberitGetLang("Attention") + "!! ***********\n" + 
+									  jabberitGetLang("This user is part of a small group!") + 
+									  "\n" + jabberitGetLang("Contact was not added!"));
+							}
+							else
+							{	
+								var result;
+		
+								try
+								{
+						 			if( elementIframe = document.getElementById('iframe_applet_jabberit') )
+						 			{
+										if( !_is_ie )
+											result = elementIframe.contentDocument.applets[0].addContact( jidUser, _name.value, _group.value );
+										else
+											result = elementIframe.contentWindow.document.applets[0].addContact( jidUser, _name.value, _group.value );
+									}
+									else // If Pop-Up
+									{
+										result = _myWindow.document.applets[0].addContact( jidUser, _name.value, _group.value );
+									}
+								}
+								catch(e)
+								{
+									alert("*********** " + jabberitGetLang("Attention") + "!! ***********\n" +
+										   jabberitGetLang('The module is not loaded') + "! " + 
+										   "\n" + jabberitGetLang('Contact was not added!')) ;
+								}
+							}
+							
+							winBuild("add_user_info","remove");
+							
+						 },"uid="+_uid);
+				}
+			}
+	}
+
+	function _config(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 _load()
+	{
+		if( arguments.length > 0 )
+			_myWindow = arguments[0];
+
+		var _params =	{
+				'lang1':jabberitGetLang('Name of Contacts'),
+				'lang2':jabberitGetLang('Search'),
+				'lang3':jabberitGetLang('Search result'),
+				'lang4':jabberitGetLang('Nickname'),
+				'lang5':jabberitGetLang('group')
+		};
+
+		var _win_addUser = { 
+				id_window	 : "add_user_im",
+				width		 : 440,
+				height		 : 350,
+				top		 	 : 80,
+				left		 : 200,
+				draggable	 : true,
+				visible	 	 : "display",
+				resizable	 : true,
+				zindex		 : _ZINDEX++,
+				title		 : 'Expresso Messenger - ' + jabberitGetLang('Search users'),
+				closeAction  : "remove",
+				content		 : Xtools.parse(Xtools.xml('userinfo'), 'add_user.xsl', _params)
+		};
+		
+		winBuild( _win_addUser );
+	}
+
+	function _search()
+	{
+		var _loading = document.getElementById('__span_load_im');		
+		var _target	 = document.getElementById('im_ldap_user');
+	
+		_loading.style.display = "block";
+	
+		_conn.go('$this.contacts_im.list_contacts',		
+				function( data )
+				{
+					if( data )
+					{
+						var _pList = {
+										'lang_addContact'	: "Adicionar Contatos" ,
+										'lang_empty' 		: "Nenhum resultado encontrado !",
+										'lang_error'		: "Tente Novamente!",
+										'lang_many_results' : "Muitos Resultados ! Por favor tente refinar sua busca !"
+									 };	
+						
+						_target.innerHTML = Xtools.parse( data, 'list_ldap_contacts.xsl', _pList);
+						
+						// Show Contact
+						function _show(Obj)
+						{
+							var data;
+							var _element = ( Obj.target ) ? Obj.target : Obj.srcElement;
+							var groups;
+			
+							if ( !_element || _element.id == "" )
+								return false;
+
+							
+							var _params	=	{
+									'lang1':jabberitGetLang('Name of Contacts'),
+									'lang2':jabberitGetLang('Search'),
+									'lang3':jabberitGetLang('Resultado da Busca'),
+									'lang4':jabberitGetLang('nickname'),
+									'lang5':jabberitGetLang('group')
+							};
+
+							var _win_addUser = { 
+									id_window	 : "add_user_info",
+									width		 : 400,
+									height		 : 190,
+									top		 	 : 85,
+									left		 : 220,
+									draggable	 : true,
+									visible	 	 : "display",
+									resizable	 : true,
+									zindex		 : _ZINDEX++,
+									title		 : 'Expresso Messenger - ' + jabberitGetLang('Add Contact'),
+									closeAction  : "remove",
+									content		 : Xtools.parse(Xtools.xml('adduser'), 'add_user.xsl', _params)
+							};
+
+							winBuild( _win_addUser );
+
+				 			try
+				 			{
+				 				var elementIframe = document.getElementById('iframe_applet_jabberit');
+				 				
+				 				// If Layer;
+				 				if( elementIframe != null )
+					 			{
+									if( !_is_ie )
+										groups = elementIframe.contentDocument.applets[0].getGroupsToExpresso();
+									else
+										groups = elementIframe.contentWindow.document.applets[0].getGroupsToExpresso();
+								}
+								else // If Pop-Up
+								{
+									groups = _myWindow.document.applets[0].getGroupsToExpresso();
+								}
+						
+								if( typeof(groups) == 'object')
+								{
+									data = groups + ";";
+									data = data.substring(0,(data.length-2));
+								}
+								else			
+									data = groups.substring(0,(groups.length-1));
+								
+								setTimeout(function(){showUser(data, _element);}, 250);
+							}
+							catch(e)
+							{
+								alert("*********** " + jabberitGetLang("Attention") + "!! ***********\n" + 
+									  jabberitGetLang("The module is not loaded") + "!\n" ); 
+							}
+						}
+					}
+					
+					var _member = _target.firstChild;
+			
+					while ( _member )
+					{
+						if( _member.getAttribute('photo') === '1' )
+						{
+							var jid = _member.getAttribute('jid'); 
+							var ou = _member.getAttribute('ou');
+
+							var _img_path = path_jabberit + 'inc/webservice.php?' + Date.parse( new Date );
+								_img_path += '&phpPhoto=' + jid + '&phpOu=' + ou;
+
+							_member.style.backgroundImage = 'url(' + _img_path + ')';
+						}
+						_config(_member, 'onclick', _show);
+						
+						_member = _member.nextSibling;
+					}
+
+					_loading.style.display = "none";						
+				},
+				'name='+ arguments[0]
+			    );
+	}
+
+	function showUser(pData, pElement)
+	{
+		var jidUser = "";
+		
+		if ( pElement.getAttribute('value'))
+		{
+			jidUser = pElement.getAttribute('jid');
+			pElement = m.getAttribute('value');
+		}
+		else
+		{
+			jidUser = pElement.parentNode.getAttribute('jid');
+			pElement = pElement.parentNode.getAttribute('value');
+		}
+
+		document.getElementById('im_jidUser').value = jidUser;
+		document.getElementById('im_jid').value 	= pElement.substr(0, pElement.indexOf(';'));
+		document.getElementById('im_uid').value 	= pElement.substr((pElement.indexOf(';')+1));
+
+		var fname = document.getElementById(pElement).innerHTML;
+		fname = fname.substr(0, fname.indexOf(' '));
+		document.getElementById('im_name').value = fname;
+
+		if( pData)
+		{
+			document.getElementById('im_group').setAttribute('selectboxoptions', pData);
+
+			if( document.getElementById('selectBox0') == null )
+				editS.create(document.getElementById('im_group'));
+		}
+		
+		var _pButtons = {
+							'lang1' : jabberitGetLang('add'),
+							'lang2' : jabberitGetLang('close'),
+							'onclickClose' : 'winBuild("add_user_info","remove")',
+							'onclickSubmit' : 'loadscript.addUser()'
+						}; 
+		
+		document.getElementById('buttons_adduser').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 
+	}
+	
+	function LDAP()
+	{
+		_conn		= arguments[0];
+		Xtools		= arguments[1];
+		_is_ie		= arguments[2];
+	}
+
+	LDAP.prototype.addUser	= addUser;
+	LDAP.prototype.load		= _load;
+	LDAP.prototype.search	= _search;
+	window.JITLdap = LDAP;
+}
+)();
Index: /branches/2.2.0.1/jabberit_messenger/js/setup.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/setup.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/setup.js	(revision 4453)
@@ -0,0 +1,441 @@
+(function()
+{
+	// Envio para o PHP
+	var _conn   = new JITConnector('jabberit_messenger/');
+	var Xtools  = new xtools('jabberit_messenger/');	
+
+	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 editHostsJabber()
+	{
+		if( arguments.length > 0 )
+		{
+			_conn.go("$this.db_im.editHostJabber",
+					 function(data)
+					 {
+							var fields = [
+											['org','organizationLdapJabberit'], 
+											['jabberName','hostNameJabberit'],
+											['serverLdap','serverLdapJabberit'], 
+											['contextLdap','contextLdapJabberit'],
+											['user','userLdapJabberit'], 
+											['password','passwordLdapJabberit']										
+										 ];						 	
+
+							data = data.split(';');
+
+							for( var i = 0 ; i < data.length ; i++ )
+							{
+								var values = data[i].split(':');
+
+								for( var j in fields )
+									if( values[0] == fields[j][0] )
+										document.getElementById(fields[j][1]).value = values[1];
+							}
+							
+					 },"item="+arguments[0]);
+		}
+	}
+	
+	function getInputs(pDocument)
+	{
+		var form = pDocument.forms[0];
+		var values = "";
+		var field_blank = false;
+		var anonymousBind;
+		var selectedAnonymous = document.getElementById("JETTI_anonymous_bind_jabberit");
+		
+		// Anonymous Bind Element Select
+		for( var i = 0; i < selectedAnonymous.length; i++ )
+			if ( selectedAnonymous.options[i].selected == true)
+				anonymousBind = eval(selectedAnonymous.options[i].value);
+		
+		for( var i = 0 ; i < form.elements.length; i++ )	
+		{
+			switch(form.elements[i].type)
+			{
+				case "text" :
+					
+						if( form.elements[i].id.toUpperCase() != "JETTI_PORT_2_JABBERIT" )
+						{
+							if( anonymousBind )
+							{
+								if( form.elements[i].id.toUpperCase() != "JETTI_USER_LDAP_JABBERIT" )
+								{
+									if( form.elements[i].value != "" )
+									{
+										values += form.elements[i].id.toUpperCase() + ";" + escape(form.elements[i].value) + "\n";
+										document.getElementById(form.elements[i].id + "__label").style.color = "black";
+									}
+									else
+									{
+										field_blank = true;
+										document.getElementById(form.elements[i].id + "__label").style.color = "red";
+									}
+								}
+								else
+								{
+									form.elements[i].value = "";
+									document.getElementById(form.elements[i].id + "__label").style.color = "black";
+								}
+							}
+							else
+							{
+								if ( form.elements[i].value != "" )
+								{
+									values += form.elements[i].id.toUpperCase() + ";" + escape(form.elements[i].value) + "\n";
+									document.getElementById(form.elements[i].id + "__label").style.color = "black";
+								}
+								else
+								{
+									field_blank = true;
+									document.getElementById(form.elements[i].id + "__label").style.color = "red";
+								}
+	
+							}
+						}
+						
+						break;
+
+				case "password"	:
+						
+						if( anonymousBind )
+						{
+							form.elements[i].value = "";
+							document.getElementById(form.elements[i].id + "__label").style.color = "black";
+						}
+						else
+						{
+							if( form.elements[i].value != "" )
+							{
+								values += form.elements[i].id.toUpperCase() + ";" + escape(form.elements[i].value) + "\n";
+								document.getElementById(form.elements[i].id + "__label").style.color = "black";
+							}
+							else
+							{
+								field_blank = true;
+								document.getElementById(form.elements[i].id + "__label").style.color = "red";
+							}
+						}
+						
+						break;
+			}
+		}
+
+		if( !field_blank )
+		{
+			values = values.substring(0,(values.length - 1 ));
+			_conn.go("$this.fileDefine.ldapInternal", function(){ form.submit.click(); }, "val=" + values);
+		}
+		else
+		{
+			alert('Preencha os campos em vermelho !');
+			return false;
+		}
+	}
+
+	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()
+	{
+		var doc = ( arguments.length == 1) ? arguments[0] : false;
+		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 )
+		{
+			if(flag && nameForm == 'HiddenJabberitExternals')
+				addParticipantsExternals(doc);
+		}	
+		else
+		{
+			if( doc )
+				return getInputs(doc);
+		}
+	}
+
+	function setConfServerJabber()
+	{
+		var orgLdap		= document.getElementById('organizationLdapJabberit');
+		var hostName	= document.getElementById('hostNameJabberit');
+		var	serverLdap	= document.getElementById('serverLdapJabberit');
+		var contextLdap = document.getElementById('contextLdapJabberit');
+		var userLdap	= document.getElementById('userLdapJabberit');
+		var pwdLdap		= document.getElementById('passwordLdapJabberit');	
+
+		var ArrayConf = [
+							['orgLdap', 'Informe uma organizacao !'],
+							['hostName', 'Informe o nome do servidor Jabber !'],
+							['serverLdap', 'Informe o nome do servidor Ldap !'],
+							['contextLdap', 'Informe um contexto Ldap !'],
+							['userLdap', ''],
+							['pwdLdap', '']
+						];
+
+		for (var i in ArrayConf)
+		{
+			if( !ltrim(eval(ArrayConf[i][0]).value) && ltrim(ArrayConf[i][1]) )
+			{
+				alert(ArrayConf[i][1]);
+				eval(ArrayConf[i][0]).focus();
+				return false;				
+			}	
+		}
+
+		_conn.go("$this.db_im.setHostJabber",
+				 function(data)
+				 {
+					var _params = {
+							'lang1': jabberitGetLang('Organization'),
+							'lang2': jabberitGetLang('Servers Jabber'),
+							'lang3': jabberitGetLang('Delete'),								
+							'lang4': jabberitGetLang('Edit')							
+					};
+
+					var Table = document.getElementById('tableConfServersJabber');
+					Table.parentNode.innerHTML = Xtools.parse( data, 'tableConfServersJabber.xsl', _params);
+					
+					for( var i in ArrayConf )
+						eval(ArrayConf[i][0]).value = "";
+				 },
+				 "org="+orgLdap.value+"&jabberName="+hostName.value+
+				 "&serverLdap="+serverLdap.value+"&contextLdap="+contextLdap.value+
+				 "&user="+userLdap.value+"&password="+pwdLdap.value);
+	}
+
+	function setOrganizationsForGroups()
+	{
+		var elementSel = document.getElementById('organizations_ldap_jabberit');
+		var Organization = "";
+		
+		for(var i = 0; i < elementSel.options.length; i++)
+		{
+			if( elementSel.options[i].selected == true && elementSel.options[i].value != "-1" )
+				Organization = elementSel.options[i].value;
+		}
+		
+		if( Organization )
+		{
+		
+			var group = document.getElementById('nameGroup').value;
+			var gidNumber = document.getElementById('gidNumber').value;
+	
+			_conn.go("$this.db_im.setOuGroupsLocked",
+					 function(data)
+					 {
+	 					if ( data )
+						{
+							var _params = {
+								'lang1': jabberitGetLang('Organization'),
+								'lang2': jabberitGetLang('Delete')
+							};
+							
+							var Table = document.getElementById('tableOrganizationsEnabledGroupsJabberit');
+							Table.parentNode.innerHTML = Xtools.parse( data, 'tableOrganizationsEnabledGroupsJabberit.xsl', _params);
+						}
+					 }, 	
+					 "group="+group+"&gidnumber="+gidNumber+"&ou="+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 removeHostsJabber()
+	{
+		if( arguments.length > 0 )
+		{
+			var idElement = arguments[0];
+			var elementTableTr = document.getElementById(idElement);
+
+			_conn.go("$this.db_im.removeHostsJabber",
+				     function(data)
+				     {
+				     	data = eval(data);
+				     	if( data )
+							elementTableTr.parentNode.removeChild(elementTableTr);				     		
+				     },
+					 "item="+idElement);
+		}
+	}
+
+	function removeOrgGroupsLocked()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = document.getElementById(arguments[0]);
+			var org = arguments[0];
+			var group = document.getElementById('nameGroup').value;
+			var gidNumber = document.getElementById('gidNumber').value;
+			
+			
+			_conn.go("$this.db_im.removeOuGroupsLocked",
+					function(data)
+					{
+						if( data )
+							element.parentNode.removeChild(element);
+					},
+					"group="+group+"&gidnumber="+gidNumber+"&ou="+org);
+		}
+	}
+
+
+	function removeOrgLdapAttributes()
+	{
+		if( arguments.length > 0 )
+		{
+			var element = document.getElementById(arguments[0]);
+			var org = arguments[0];
+			
+			_conn.go("$this.db_im.removeAttributesLdap",
+					function(data)
+					{
+						if( data )
+							element.parentNode.removeChild(element);
+					},
+					"org=" + org);
+		}
+	}
+
+	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.editHostsJ				= editHostsJabber;
+	constructScript.prototype.removeHostsJ				= removeHostsJabber;
+	constructScript.prototype.removeOrg 				= removeOrgLdapAttributes;
+	constructScript.prototype.removeOrgGroupsLocked 	= removeOrgGroupsLocked;
+	constructScript.prototype.removePartExternal 		= removeParticipantsExternal;
+	constructScript.prototype.setConfServerJabber		= setConfServerJabber;
+	constructScript.prototype.setOrgFgroups 			= setOrganizationsForGroups;
+	constructScript.prototype.setPartExternal 			= setParticipantsExternal;	
+	constructScript.prototype.sendf 					= sendf;
+	
+	window.constructScript = new constructScript;
+}
+)();
Index: /branches/2.2.0.1/jabberit_messenger/js/dragdrop.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/dragdrop.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/dragdrop.js	(revision 4453)
@@ -0,0 +1,217 @@
+(function()
+{
+	var _element	= null;
+	var _elementA	= null;
+	var _elementB	= null;
+	var _parent		= null;
+
+	function _configEvent(pObj, pEvent, pHandler)
+	{
+		try
+		{
+			if (typeof pObj == 'object')
+			{
+				if (pEvent.substring(0, 2) == 'on') 
+					pEvent = pEvent.substring(2, pEvent.length);
+				
+				if (arguments.length == 3)
+				{
+					if (pObj.addEventListener) 
+						pObj.addEventListener(pEvent, pHandler, false);
+					else 
+						if (pObj.attachEvent) 
+							pObj.attachEvent('on' + pEvent, pHandler);
+				}
+				else
+				{
+					if (arguments.length == 4)
+					{
+						if (pObj.removeEventListener && pObj.removeEventListener != 'undefined') 
+							pObj.removeEventListener(pEvent, pHandler, false);
+						else 
+							if (pObj.detachEvent) 
+								pObj.detachEvent('on' + pEvent, pHandler);
+					}
+				}
+			}
+		}
+		catch(e){}
+	}
+
+	function _drag(e)
+	{
+		if (typeof e.preventDefault != 'undefined')
+			e.preventDefault();
+		else
+			e.onselectstart = new Function("return false;");
+
+		_element = ( e.target ) ? e.target : e.srcElement;
+
+		if ( _element )
+		{
+			_configEvent(_element, 'onmousemove', _mouseMove);
+			_configEvent(top.document, 'onmousemove', _mouseMove);
+
+			_configEvent(_element, 'onmouseup', _mouseUp);
+			_configEvent(top.document, 'onmouseup', _mouseUp);
+		}
+	}
+
+	function _elementShadow( pId )
+	{
+		if( _elementA )
+		{
+			var _elShadow 			= document.createElement("div");
+			_elShadow.id 			= _elementA.id + "__Shadow";
+			_elShadow.setAttribute("onselectstart" , "return false");
+			_elShadow.style.width	= _elementA.style.width;
+			_elShadow.style.height	= _elementA.style.height;
+			_elShadow.style.top		= _elementA.style.top;
+			_elShadow.style.left	= _elementA.style.left;
+			_elShadow.style.zIndex	= _elementA.style.zIndex;
+			_elShadow.className		= "x-shadow_Div";
+			
+			return _elShadow;
+		}
+	}
+
+	function _load()
+	{
+		if( arguments.length > 0 )
+		{
+			var pId = arguments[0];
+			
+			_configEvent(document.getElementById( pId + "__draggable"), 'onmousedown', _mouseDownShadow);
+		}
+	}
+
+	function _getMouseOffset(e, el)
+	{
+		var docPos = _getPosition(el);
+		var mousePos = _mouseCoords(e);
+		return {
+			'x' : mousePos.x - docPos.x,
+			'y' : mousePos.y - docPos.y
+		};
+	}
+
+	function _getPosition(_pObject)
+	{
+		var left = 0;
+		var top  = 0;
+
+		while ( _pObject.offsetParent )
+		{
+			left += _pObject.offsetLeft;
+			top  += _pObject.offsetTop;
+			_pObject = _pObject.offsetParent;
+		}
+
+		left += _pObject.offsetLeft;
+		top  += _pObject.offsetTop;
+
+		return {
+			'x' : left,
+			'y' : top
+		};
+	}
+
+	function _mouseCoords(ev)
+	{
+		var CoordX = "";
+		var CoordY = "";
+
+		if ( ev.pageX || ev.pageY )
+			return {
+				'x' : ev.pageX,
+				'y' : ev.pageY
+			};
+
+		CoordX = ev.clientX + document.body.scrollLeft - document.body.clientLeft;
+		CoordY = ev.clientY + document.body.scrollTop  - document.body.clientTop;
+		
+		return {
+			'x' : CoordX,
+			'y' : CoordY
+		};
+	}
+
+	function _mouseMove(e)
+	{
+		if ( _element )
+		{
+			if ( _element.mouseOffset == null )
+				_element.mouseOffset = _getMouseOffset(e, _element);
+
+			var mousePos = _mouseCoords(e);
+
+			var x = mousePos.x - _element.mouseOffset.x;
+			var y = mousePos.y - _element.mouseOffset.y;
+			_element.style.left = (( x < 0 ) ? 0 : x) + 'px';
+			_element.style.top  = (( y < 0 ) ? 0 : y) + 'px';
+		}
+	}
+
+	function _mouseUp()
+	{
+		if ( _element )
+		{
+			_mouseUpShadow();
+			
+			_configEvent(_element, 'onmousemove', _mouseMove, 'remove');
+			_configEvent(top.document, 'onmousemove', _mouseMove, 'remove');
+
+			_configEvent(_element, 'onmouseup', _mouseUp, 'remove');
+			_configEvent(top.document, 'onmouseup', _mouseUp, 'remove');
+
+			_element.mouseOffset = null;
+			_element = null;
+		}
+	}
+
+	function _mouseDownShadow(e)
+	{
+		try
+		{
+			if( arguments.length > 0 )
+			{
+				var _el = ( e.target ) ? e.target : e.srcElement;
+				var _id = (_el.id.substring(0, _el.id.indexOf("__draggable")));	
+				
+				_elementA = document.getElementById( _id + "__parent");
+				_elementB = _elementShadow( _id + "__parent");
+				
+				_elementA.style.left = '-1500px';
+				_parent	  = _elementA.parentNode;
+				
+				var _B = _parent.appendChild(_elementB);
+				
+				_configEvent( _elementB, 'onmouseup', _mouseUpShadow);
+				_configEvent( _elementB, 'onmousemove', _drag);
+			}
+			
+		}catch(e){}
+	}
+
+	function _mouseUpShadow()
+	{
+		try
+		{
+			_elementA.style.top		= _elementB.style.top;
+			_elementA.style.left	= _elementB.style.left;
+			
+			var _B = _parent.removeChild(_elementB);
+
+			_elementA = null;
+			_elementB = null;
+			_element = null;
+		}
+		catch(e){}
+	}
+	
+	function dragdrop(){}
+
+	dragdrop.prototype.set 	= _load;
+	window.dragdrop = dragdrop;
+	
+})();
Index: /branches/2.2.0.1/jabberit_messenger/js/jsloader.js
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/js/jsloader.js	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/js/jsloader.js	(revision 4453)
@@ -0,0 +1,54 @@
+function JsLoader()
+{
+	this._loadedJS = [];
+	this._loadedCss = [];
+	
+	this.load = function(pFilesArray)
+	{
+		for(var i = 0; i < pFilesArray.length; i++)
+		{
+			var pFiles = pFilesArray[i];
+			
+			if( pFiles.indexOf(".js") > -1 )
+			{
+				var js = pFiles.toLowerCase();
+				
+				if(!this._loadedJS[js])
+				{
+					document.getElementsByTagName("head")[0].appendChild(this.loadJavaScript(js));
+					this._loadedJS[js] = true;
+				}
+			}
+			else if( pFiles.indexOf(".css") > -1 )
+			{
+				var css = pFiles.toLowerCase();
+				
+				if(!this._loadedCss[css])
+				{
+					document.getElementsByTagName("head")[0].appendChild(this.loadStyleSheet(css));
+					this._loadedCss[css] = true;
+				}
+			}
+		}
+	};
+	
+	this.loadJavaScript = function(pJs)
+	{
+		var _script = document.createElement("script");
+		_script.type = "text/javascript";
+		_script.src  = pJs;
+		
+		return _script;
+	};
+
+	this.loadStyleSheet=function(pCss)
+	{
+		var _style = document.createElement("link");
+		_style.rel = "stylesheet";
+		_style.type = "text/css";
+		_style.href = pCss;
+		return _style;
+	};
+}
+
+JSLoader = new JsLoader();
Index: /branches/2.2.0.1/jabberit_messenger/index.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/index.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/index.php	(revision 4453)
@@ -0,0 +1,48 @@
+<?php
+	/*******************************************************
+	 * Im - JabberIt
+	 * Colaboradores : Alexandre Correia / Rodrigo Souza
+	 *
+	 * ****************************************************/
+
+	$GLOBALS['phpgw_info']['flags']['currentapp'] = 'jabberit_messenger';
+
+	include("../header.inc.php");
+
+	$jabberit_version = $GLOBALS['phpgw_info']['flags']['jabberit_version'];
+	
+	$template = CreateObject('phpgwapi.Template', PHPGW_APP_TPL);
+
+	// Verifica qual será o módulo a ser carregado.
+	$flag = false;
+	
+	$groupsJmessenger = unserialize( $GLOBALS['phpgw_info']['server']['groups_jmessenger_jabberit'] );
+	
+	if( is_array($groupsJmessenger) )
+	{
+	
+		foreach( $groupsJmessenger as $tmp )
+		{
+			$_explode = explode( ":", $tmp );
+			$groups[] = $_explode[1];
+		}
+	
+		foreach( $GLOBALS['phpgw']->accounts->membership() as $idx => $group )
+		{
+			if( array_search($group['account_name'], $groups) !== FALSE )
+				$flag = true;
+		}
+	}
+	
+	if( $flag )
+		$template->set_file(Array('jabberit_messenger' => 'indexIM.tpl'));
+	else
+		$template->set_file(Array('jabberit_messenger' => 'indexIM_JAVA.tpl'));
+
+	$template->set_block('jabberit_messenger','index');
+	$template->set_var( 'url', $GLOBALS['phpgw']->link( '/jabberit_messenger/' ) );
+	$template->pfp('out','index');
+
+	$GLOBALS['phpgw']->common->phpgw_footer();
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/help.php
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/help.php	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/help.php	(revision 4453)
@@ -0,0 +1,28 @@
+<?php
+	/*******************************************************
+	 * Im - JabberIt
+	 * Colaboradores : Alexandre Correia / Rodrigo Souza
+	 *
+	 * ****************************************************/
+
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+						'currentapp' => 'jabberit_messenger',
+						'nonavbar'   => true,
+						'noheader'   => false,
+						'jabberit_version' => '0.7.7',
+						);
+
+	include("../header.inc.php");
+
+	$jabberit_version = $GLOBALS['phpgw_info']['flags']['jabberit_version'];
+
+	$template = CreateObject('phpgwapi.Template', PHPGW_APP_TPL);
+	$template->set_file(Array('jabberit_messenger' => 'index.tpl'));
+	$template->set_var('template_default', $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']);
+	$template->set_var('template_set', 'default');	
+	$template->set_block('jabberit_messenger','index');
+	$template->pfp('out','index');
+
+
+?>
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/module.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/module.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/module.tpl	(revision 4453)
@@ -0,0 +1,43 @@
+<!-- BEGIN module -->
+<form method="POST" action="{action_url}">
+<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+	<tr class="th">
+		<td colspan="2">&nbsp;<b>{lang_Enable_the_Expresso_Messenger_module}</b></td>
+	</tr>
+	<tr class="row_on">
+		<td style="height:30px;">&nbsp;{lang_Select_the_modules_where_the_Expresso_Messenger_will_be_loaded}</td>
+	</tr>
+	<tr class="row_off">
+		<td colspan="2">
+			<table align="center" cellspacing="0" style="margin-top:15px">
+				<tr>
+					<td class="row_off">	
+						{lang_Modules_List} :
+						<br/>
+						<select id="apps_list" size="10" style="width: 300px" multiple>{apps_list}</select>
+					</td>
+					<td class="row_off">
+						<input type="button" value="Adicionar" onclick="javascript:App.add();" />
+						<br/>
+						<br/>
+						<input type="button" value="Remover" onclick="javascript:App.remove();" />
+					</td>
+					<td class="row_off">
+						{lang_Modules_Enabled} :
+						<br/>
+						<select id="apps_enabled" size="10" style="width: 300px" multiple name="apps_enabled[]">{apps_enabled}</select>
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2" align="center">
+		  <input type="submit" name="save" value="{lang_save}" onclick="javascript:App.select_();">
+		  <input type="submit" name="cancel" value="{lang_cancel}">
+		  <br>
+		</td>
+	</tr>
+</table>
+</form>
+<!-- END module -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM_IE.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM_IE.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM_IE.tpl	(revision 4453)
@@ -0,0 +1,63 @@
+<!-- BEGIN index -->
+<html> 
+	<head>
+	<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
+	<meta HTTP-EQUIV="Expires" CONTENT="-1">
+	<meta HTTP-EQUIV="content-type" CONTENT="application/x-java-archive"> 
+	<script type="text/javascript" src="../jabberit_messenger/js/changeStatus.js"></script>
+	<script type="text/javascript">
+		
+		// Pop-up or Layer
+		if( window.parent.loadscript )
+			var element = window.parent.loadscript;
+		else
+			var element = self.opener.parent.loadscript;
+
+		changestatus.setpath('{path}');
+		
+		function getArgumentsApplet()
+		{
+			try
+			{
+				if( arguments.length > 0 )
+				{
+				 	if( arguments[0] == "getArgumentsApplet" )
+						changestatus.get(arguments[1], element.getElement());
+	
+					if( arguments[0] == "cleanStatus" )
+						element.autoStatusIM();
+				}
+			}
+			catch(e){}
+		}
+		
+	</script>
+	</head>
+	<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
+		<object classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' width='250px' height='400px'>
+			<param name='name' value='jeti'>
+			<param name='archive' value='{java_files}'>
+			<param name='code' value='{value_codeBase}'>
+			<param name='codebase' value='.'>	
+			<param name='FIELD01' value='{value_cnname}'>
+			<param name='FIELD02' value='{value_country}'>
+			<param name='FIELD03' value='{value_expresso}'>
+			<param name='FIELD04' value='javascript:window.close();'>			
+			<param name='FIELD05' value='{value_host}'>
+			<param name='FIELD06' value='{value_javaPlugins}'>
+			<param name='FIELD07' value='{value_language}'>
+			<param name='MAYSCRIPT' value='true'>
+			<param name='FIELD08' value='{value_company}'>
+			<param name='FIELD09' value='{value_password}'>
+			<param name='FIELD10' value='{value_port}'>
+			<param name='FIELD11' value='{value_resource}'>
+			<param name='FIELD12' value='{value_server}'>			
+			<param name='FIELD13' value='{value_ssl}'>
+			<param name='FIELD14' value='{value_use_https}'>
+			<param name='FIELD15' value='{value_userproxy}'>
+			<param name='FIELD16' value='{value_user}'>
+			<param name='FIELD17' value='{value_mc}'>			
+		</object>
+	</body>
+</html>
+<!-- END index -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/common.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/common.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/common.css	(revision 4453)
@@ -0,0 +1,139 @@
+/* IM:WINDOW - ADD USER */
+
+div.add_organization_members
+{
+	margin-bottom: 30px;
+}
+
+div.add_organization_members span
+{
+	border-bottom: 1px solid #809aa9;
+	float:left;
+	font-size: 8pt !important;
+	font-family: Arial, Verdana, helvetica, sans-serif !important;
+	font-weight: bold;
+	position:aboslute;
+	width: 200px;
+}
+
+div.add_organization_members div
+{
+	font-weight: normal;
+	margin: 2px;
+	padding: 3px;
+	height: 230px;
+	overflow: auto;
+}
+
+div.add_organization_members div span
+{
+	background: url(../images/photo.png) no-repeat;
+	border-bottom: 1px dashed #809aa9;
+	border-right: 1px dashed #809aa9;
+	clear:both;
+	float:left;
+	font-weight: normal;
+	height: 65px;
+	letter-spacing: 0.2em;
+	padding: 4px 0 4px 80px;
+	margin-bottom: 20px;
+	width: 300px;
+}
+
+div.add_organization_members div#im_ldap_ou
+{
+	float: left;
+	width: 200px;
+}
+
+div.add_member_info
+{
+	margin: 10px 0;
+}
+
+div.add_member_info span
+{
+	float: left;
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	margin-right: 3px;
+	text-align: right;
+	width: 80px;
+}
+
+div.search_user 
+{
+	font-size: 8pt !important;
+	font-family: Arial, Verdana, helvetica, sans-serif !important;
+	font-weight: bold;
+	margin: 0 0 0 5px;
+}
+
+.search_user_button
+{
+	border: 1px solid #000 !important;
+}
+
+span.im_button
+{
+	background: #dedede;
+	border: 1px solid;
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	letter-spacing: 1px;
+	padding: 0 15px;
+	text-align: center;
+	line-height: 1.5em;
+}
+
+div.loading
+{
+	background: #fdd url(../images/loading.gif) no-repeat 1px 1px;
+	border: 1px dashed #f00;
+	margin:	2px;
+	padding: 3px 3px 3px 20px;
+	text-align: center;
+}
+
+span.message_time
+{
+	color: #aaa;
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+}
+
+.font_menu
+{
+	font: 8pt Verdana, Arial, Helvetica, sans-serif;
+}
+
+.layer
+{
+	background: url(../images/photo.png) no-repeat 2px 2px;
+	border:	1px solid #dedede;
+	height: 65px;
+	margin:	2px;
+	padding: 2px 0px 2px 54px;
+}
+
+/* Disconnected */
+
+.disconnected
+{
+	font: 9pt Verdana, Arial, Helvetica, sans-serif;
+	border: 1px solid #dedede;
+	margin: 2px;
+}
+
+/* Vcard */
+
+.vcard_user
+{
+	font: 9pt Verdana, Arial, Helvetica, sans-serif;
+	margin:10px;
+}
+
+.vcard_contact
+{
+	font: 9pt Verdana, Arial, Helvetica, sans-serif;
+	margin:10px;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_escritorio.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_escritorio.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_escritorio.css	(revision 4453)
@@ -0,0 +1,333 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #3558b6 !important;
+	border		: 1px solid #1e4098;
+	color		: #fff !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #a7b9e7 !important;
+	border : 1px solid #1e4098; 
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #1e4098;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#1e4098;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #1e4098;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#1e4098;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#1e4098;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#1e4098;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/escritorio/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/escritorio/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/escritorio/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/escritorio/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/escritorio/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/escritorio/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/escritorio/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#1e4098;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/escritorio/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/escritorio/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#fff;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_cataratas.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_cataratas.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_cataratas.css	(revision 4453)
@@ -0,0 +1,328 @@
+.x-menu
+{
+	background-color : #98c17f !important;
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #98c17f !important; 
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #98c17f !important;
+	border		: 1px solid #7bc64e;
+	color		: #ffffed !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #4c9b1d !important;
+	border : 1px solid #7bc64e;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #7bc64e;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#7bc64e;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #7bc64e;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#7bc64e;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#7bc64e;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#7bc64e;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/cataratas/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/cataratas/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/cataratas/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/cataratas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/cataratas/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/cataratas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/cataratas/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+	border:1px solid;
+	border-color:#7bc64e;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/cataratas/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/cataratas/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#ffffed;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/button.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/button.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/button.css	(revision 4453)
@@ -0,0 +1,176 @@
+.x-btn
+{
+	-x-system-font:none;
+	font-family:tahoma,verdana,helvetica;
+	font-size:11px;
+	font-size-adjust:none;
+	font-stretch:normal;
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	line-height:normal;
+	white-space:nowrap;
+}
+
+.x-btn td 
+{
+	padding:0 !important;
+}
+
+.x-btn-tl, .x-btn-tr, .x-btn-tc, .x-btn-ml, .x-btn-mr, .x-btn-mc, .x-btn-bl, .x-btn-br, .x-btn-bc 
+{
+	background-image: url(../images/btn.gif) !important;
+}
+
+.x-btn-tl 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 0;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-tr i, .x-btn-tl i, .x-btn-br i, .x-btn-bl i
+{
+	height:3px;
+}
+
+.x-btn-tc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -6px;
+	height:3px;
+}
+
+.x-btn-tr 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px 0;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-tr i, .x-btn-tl i, .x-btn-mr i, .x-btn-ml i, .x-btn-br i, .x-btn-bl i
+{
+	display:block;
+	font-size:1px;
+	line-height:1px;
+	overflow:hidden;
+	width:3px;
+}
+
+.x-btn-ml
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 -24px;
+	width:3px;
+}
+
+.x-btn-mc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -1096px;
+	cursor:pointer;
+	padding:0 5px;
+	text-align:center;
+	vertical-align:middle;
+	white-space:nowrap;
+}
+
+.x-btn em
+{
+	font-style:normal;
+	font-weight:normal;
+}
+
+.x-btn-noicon .x-btn-small .x-btn-text
+{
+	height:16px;
+}
+
+.x-btn button
+{
+	-x-system-font:none;
+	font-family:arial,tahoma,verdana,helvetica;
+	font-size:11px;
+	font-size-adjust:none;
+	font-stretch:normal;
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	line-height:normal;
+}
+
+.x-btn button 
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat scroll 0 0;
+	border:0 none !important;
+	cursor:pointer;
+	margin:0;
+	outline-color:-moz-use-text-color;
+	outline-style:none;
+	outline-width:0;
+	overflow:visible;
+	padding-left:3px;
+	padding-right:3px;
+	width:auto;
+}
+
+.x-btn-text
+{
+	color: #000 !important;
+	cursor:pointer;
+	padding:0;
+	white-space:nowrap;
+}
+
+.x-btn-mr
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px -24px;
+	width:3px;
+}
+
+.x-btn-bl
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll 0 -3px;
+	height:3px;
+	width:3px;
+}
+
+.x-btn-bc
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none repeat-x scroll 0 -15px;
+	height:3px;
+}
+
+.x-btn-br
+{
+	-moz-background-clip:border;
+	-moz-background-inline-policy:continuous;
+	-moz-background-origin:padding;
+	background:transparent none no-repeat scroll -3px -3px;
+	height:3px;
+	width:3px;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_default.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_default.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_default.css	(revision 4453)
@@ -0,0 +1,332 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cecece;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #e8e6e6 !important;
+	border : 1px solid #918b8b;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #918b8b;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#918b8b;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #918b8b;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#918b8b;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#918b8b;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#918b8b;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/default/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/default/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/default/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#918b8b;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/default/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/default/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#585656;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_metropole.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_metropole.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_metropole.css	(revision 4453)
@@ -0,0 +1,333 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #404040 !important;
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #404040 !important;
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #404040 !important; 
+	border		: 1px solid #000;
+	color		: #fffcdf !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #4a79b1 !important;
+	border : 1px solid #000;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #4a79b1;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#4a79b1;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #4a79b1;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#4a79b1;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#4a79b1;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#4a79b1;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/metropole/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/metropole/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/metropole/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/metropole/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/metropole/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/metropole/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/metropole/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#4a79b1;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/metropole/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/metropole/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#fffcdf;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_azul.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_azul.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_azul.css	(revision 4453)
@@ -0,0 +1,330 @@
+.x-menu
+{
+	background-color : #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #ccd8e7 !important;
+	border		: 1px solid #8ea4c1;
+	color		: #15428b !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #96bdf3 !important;
+	border : 1px solid #8ea4c1;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #99bbe8;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#99bbe8;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #99bbe8;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#99bbe8;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#99bbe8;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#99bbe8;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/azul/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/azul/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/azul/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/azul/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/azul/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/azul/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/azul/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#99bbe8;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/azul/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/azul/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#15428b;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_celepar.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_celepar.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_celepar.css	(revision 4453)
@@ -0,0 +1,332 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cecece;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cecece !important;
+	border		: 1px solid #918b8b;
+	color:		: #585656 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #e8e6e6 !important;
+	border : 1px solid #918b8b;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #918b8b;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#918b8b;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #918b8b;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#918b8b;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#918b8b;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#918b8b;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/default/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/default/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/default/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/default/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/default/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#918b8b;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/default/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/default/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#585656;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_comics.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_comics.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_comics.css	(revision 4453)
@@ -0,0 +1,332 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #fff !important;
+	border		: 1px solid #000;
+	color		: #000 !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #fff !important;
+	border		: 1px solid #000;
+	color		: #000 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #fff !important; 
+	border		: 1px solid #000; 
+	color		: #000 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #f4f2f2 !important;
+	border : 1px solid #000;
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #000000;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#000000;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #000000;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#000000;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#000000;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#000000;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    border-color:#8db2e3;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/comics/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	/*display		: block;*/
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/comics/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/comics/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/comics/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/comics/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/comics/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/comics/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+    background-color:#dfe8f6;
+	border:1px solid;
+	border-color:#000000;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/comics/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/comics/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#000000;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/selectEditStyle.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/selectEditStyle.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/selectEditStyle.css	(revision 4453)
@@ -0,0 +1,49 @@
+	.selectBoxArrow
+	{
+		margin-top:1px;
+		float:left;
+		position:absolute;
+		right:1px;
+
+	}	
+	
+	.selectBoxInput
+	{
+		font-family: Verdana, Helvetica, sans;
+		font-size: 11px !important;
+		border:0px !important;
+		padding-left:1px;
+		height:16px;
+		position:absolute;
+		bottom:0px;
+		left:0px;
+	}
+
+	.selectBox
+	{
+		border:1px solid #cecece !important;
+		height:20px;	
+	}
+	
+	.selectBoxOptionContainer
+	{
+		position:absolute;
+		border:1px solid #cecece !important;
+		font-size:12px;
+		background-color:#FFF;
+		left:-1px;
+		top:20px;
+		visibility:hidden;
+		height: 100px;
+		overflow-y:auto;
+	}
+
+	.selectBoxAnOption
+	{
+		font-family: Verdana, Helvetica, sans;
+		font-size:12px;
+		cursor:default;
+		margin:1px;
+		overflow:hidden;
+		white-space:nowrap;
+	}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_rochas.css
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_rochas.css	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/css/window_rochas.css	(revision 4453)
@@ -0,0 +1,331 @@
+/* x-menu */
+
+.x-menu
+{
+	background-color : #cfb69e !important;
+	border		: 1px solid #bd8d5d;
+	color		: #000 !important;
+	display		: none;
+	margin		: 20px 5px 0px -15px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatus
+{
+	background-color : #cfb69e !important;
+	border		: 1px solid #bd8d5d;
+	color		: #000 !important;
+	float		: left;
+	margin		: -10px 5px 0px 0px;
+	position	: absolute;
+}
+
+.x-subMenuChangeStatusItens
+{
+	background-color 	: #cfb69e !important;
+	border		: 1px solid #bd8d5d; 
+	color		: #000 !important;
+	float		: left;
+	position	: absolute;
+}
+
+.x-menuOnMouseOut
+{
+}
+
+.x-menuOnMouseOver
+{
+	background-color : #f4dcc4 !important; 
+	border : 1px solid #bd8d5d;  
+}
+
+/* x-content */
+
+.x-content
+{
+	margin : 2px ;
+}
+
+
+/* x-panel */
+
+.x-panel
+{
+    border-color: #bd8d5d;
+    border-style: solid;
+    border-width:0;
+}
+
+.x-panel-body
+{
+    background-color:#fff;
+    border:1px solid;
+    border-color:#bd8d5d;
+    border-top:0 none;
+    position: relative; 
+    overflow:hidden;
+    zoom:1;
+}
+
+.x-panel-body-noheader
+{
+    border-top-color: #bd8d5d;
+}
+
+.x-panel-bwrap
+{
+    overflow:hidden;
+    zoom:1;
+    left:0;
+    top:0;
+}
+
+.x-panel-nofooter .x-btn-group-bc
+{
+	height:3px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-nofooter .x-window-bc
+{
+	height:6px;
+    font-size:0;
+    line-height:0;
+}
+
+.x-panel-noborder .x-panel-body-noborder
+{
+    border-width:0;
+}
+
+.x-panel-noborder .x-panel-header-noborder
+{
+    border-bottom-color:#bd8d5d;
+    border-width:0 0 1px;
+    border-style:solid;
+}
+
+.x-panel-noborder .x-panel-bbar-noborder .x-toolbar
+{
+    border-width:1px 0 0 0;
+    border-style:solid;
+    border-top-color:#bd8d5d;
+}
+
+.x-panel-noborder .x-panel-tbar-noborder .x-toolbar
+{
+    border-bottom-color:#bd8d5d;
+	border-width:0 0 1px;
+    border-style:solid;
+}
+
+/* x-shadow */ 
+
+.x-shadow_Div
+{
+	border 		: 1px dashed black;
+	position 	: absolute;
+}
+
+/* x-tab */
+
+.x-tab-panel
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-body
+{
+    border: 1px solid;
+    background-color:#fff;
+    overflow:hidden;
+}
+
+.x-tab-panel-body-top
+{
+    border-top: 0 none;
+}
+
+.x-tab-panel-bwrap
+{
+    overflow:hidden;
+}
+
+.x-tab-panel-noborder .x-tab-panel-body-noborder
+{
+	border-width:0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-footer-noborder
+{
+    border-width: 1px 0 0 0;
+}
+
+.x-tab-panel-noborder .x-tab-panel-header-noborder
+{
+    border-width: 0 0 1px 0;
+}
+
+
+/* x-tool */
+.x-tool
+{
+    overflow	: hidden;
+    width		: 15px;
+    height		: 15px;
+    float		: right;
+    cursor		: pointer;
+    background	: transparent no-repeat;
+    background-image : url(../images/rochas/tool-sprites.gif);
+    margin-left	: 2px;
+    margin-top	: 5px;
+}
+
+.x-tool-close
+{
+    background-position	: 0 -0;
+}
+
+/* x-unselectable */
+
+.x-unselectable, .x-unselectable * 
+{
+    -moz-user-select	: none;
+    -khtml-user-select	: none;
+    -webkit-user-select	: ignore;
+}
+
+/* x-window */
+
+.x-window
+{
+	visibility	: visible;
+	display		: block;
+}
+
+.x-window .x-resizable-handle
+{
+    opacity	:0;
+    -moz-opacity :0;
+    filter	:alpha(opacity=0);
+}
+
+.x-window-draggable, .x-window-draggable .x-window-header-text
+{
+    cursor	: move;
+}
+
+.x-window-header
+{
+    float		: left;
+    overflow	: hidden;
+    zoom		: 1;
+}
+
+.x-window-bc
+{
+	background	: transparent repeat-x 0 bottom;
+	background-image : url(../images/rochas/top-bottom.png);
+    zoom : 1;
+}
+
+.x-window-bc .x-window-footer
+{
+    padding-bottom	:6px;
+    zoom	: 1;
+    font-size	: 0;
+    line-height	: 0;
+}
+
+.x-window-body
+{
+    background	: transparent;
+    overflow	: hidden;
+}
+
+.x-window-bwrap
+{
+    position : relative;
+	overflow : hidden;
+    zoom	: 1;
+    left : 0;
+    top : 0;
+}
+
+.x-window-tc
+{
+	background: transparent repeat-x 0 0;
+	background-image: url(../images/rochas/top-bottom.png);
+	overflow:hidden;
+    zoom:1;
+}
+
+.x-window-tl
+{
+	background: transparent no-repeat 0 0;
+	background-image: url(../images/rochas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+    position:relative;
+}
+
+.x-window-tr
+{
+	background: transparent no-repeat right 0;
+	background-image: url(../images/rochas/right-corners.png);
+	padding-right:6px;
+}
+
+.x-window-bl
+{
+	background: transparent no-repeat 0 bottom;
+	background-image: url(../images/rochas/left-corners.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-br
+{
+	background: transparent no-repeat right bottom;
+	background-image: url(../images/rochas/right-corners.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-mc
+{
+	border:1px solid;
+	border-color:#bd8d5d;
+	font: normal 11px tahoma,arial,helvetica,sans-serif;
+    padding:0;
+    margin:0;
+}
+
+.x-window-ml
+{
+	background: transparent repeat-y 0 0;
+	background-image: url(../images/rochas/left-right.png);
+	padding-left:6px;
+    zoom:1;
+}
+
+.x-window-mr
+{
+	background: transparent repeat-y right 0;
+	background-image: url(../images/rochas/left-right.png);
+	padding-right:6px;
+    zoom:1;
+}
+
+.x-window-noborder .x-window-mc
+{
+    border-width:0;
+}
+
+.x-window-tl .x-window-header
+{
+    color:#000;
+	font:bold 11px tahoma,arial,verdana,sans-serif;
+	padding:5px 0 4px 0;
+}
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/enabled_ou_groups.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/enabled_ou_groups.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/enabled_ou_groups.tpl	(revision 4453)
@@ -0,0 +1,20 @@
+<!-- BEGIN enabled_ous -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+	<form>
+		<table align="center" width="90%" cellspacing="2" style="border:1px solid #000;margin-top:20px;">
+			<tr class="th">
+				<td width="30%"><b>Grupos<b/></td>
+				<td width="55%"><b>Organizações Liberadas<b/></td>
+				<td width="5%" align="center"><b>Editar</b></td>
+			</tr>
+			{list_groups}
+		</table>
+		<br/>
+		<table align="center" width="90%" cellspacing="2">
+			<tr>
+				<td><input type="button" value="{lang_back}" onClick="document.location.href='{action_url}'"></td>
+			</tr>
+		</table>
+	</form>
+<!-- END enabled_ous -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM.tpl	(revision 4453)
@@ -0,0 +1,154 @@
+<!-- BEGIN index -->
+
+<fieldset>
+	<legend style="font-size:10pt;font-weight:bold; ">Expresso Messenger - Como Utilizar</legend>
+	<div style="height:500px; margin:5px;">
+		<div style="width:24%; float:left;">
+			<ol>		
+				<li><a href="#intro">Introdução</a><br/>
+				<li><a href="#supported">Browsers Suportados</a><br/>
+				<li><a href="#prefe">Opções - Troca de Status</a><br/>
+				<li><a href="#conf_status">Mensagens de Status</a><br/>
+				<li><a href="#contact_list">Lista de Contatos</a><br/>
+				<li><a href="#status">Indicador de Status</a><br/>
+				<li><a href="#useradd">Adicionando um novo contato</a><br/>
+				<li><a href="#menu_right">Preferências Avançadas</a><br/>
+				<li><a href="#troca_mens">Troca de Mensagens</a><br/>
+			</ol>
+		</div>
+		<div style="height: 500px; margin-left:25%;overflow-y: auto;">
+		    <h2><a name="intro">1. Introdução</a></h2>
+		    
+		    O Expresso Messenger é um módulo que permite o envio e recebimento de mensagens instantaneamente. Você pode trocar mensagens em tempo real com a sua lista de contatos e 
+		    através da lista também é possível saber se seus contatos estão Online ou Offline. Para a troca de mensagens basta clicar em cima do nome do seu contato ( verifique a sessão <a href="#status">Indicador de Status</a> ) que abrirá uma janela para enviar e receber as mensagens. O Expresso Messenger está associado
+		    a um serviço de mensagens instantâneas Jabber e este serviço é responsável pelo armazenamento dos seus contatos e mensagens.
+			<br>
+			<br>
+			<img src="{url}templates/default/images/tela_inicial_sem_java.png" style="width:256px; height:414px;" alt="Im Screenshot" title="Im Screenshot" align="left" style="padding-right:4px;"> 
+		    <br clear="all">
+			( figura 1 )
+		    <h2><a name="supported">2. Browsers Suportados</a></h2>
+		
+		    <div style="margin:0px 5px 2px 5px; text-align: justify;">
+		    
+				<fieldset style="margin-bottom:10px; width:250px;">
+					<legend><img src="{url}jmessenger/templates/default/images/compatible_epiphany.png" align="middle"/><span style="margin:5px;">Epiphany</span></legend>
+					<span> Versão : 2.22 ou superior </span><br/>
+					<span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span>
+				</fieldset>
+				<br/>
+				<fieldset style="margin-bottom:10px; width:250px;">
+					<legend><img src="{url}jmessenger/templates/default/images/compatible_iceweasel.png" align="middle"/><span style="margin:5px;">Iceweasel</span></legend>
+					<span> Versão : 3.06 ou superior </span><br/>
+					<span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span>
+				</fieldset>
+				<br/>
+				<fieldset style="margin-bottom:10px; width:250px;">
+					<legend><img src="{url}jmessenger/templates/default/images/compatible_ie.gif" align="middle" /><span style="margin:5px;">Internet Explorer ( IE )</span></legend>
+					<span> Versão : 8.0 </span><br/>
+					<span> Avaliação : Recomendado</span>
+				</fieldset>
+				<br/>
+				<fieldset style="margin-bottom:10px; width:250px;">
+					<legend><img src="{url}jmessenger/templates/default/images/compatible_firefox.gif" align="middle"/><span style="margin:5px;">Mozilla Firefox</span></legend>
+					<span> Versão : 3.0 ou superior </span><br/>
+					<span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span>
+				</fieldset>
+			</div>		
+		    
+			<h2><a name="prefe">3. Opções - Troca de Status</a></h2>
+			<br/>
+			A troca do Status pode ser feita de duas maneiras, clicando dentro da janela que contém a lista de contatos (figura 2 ).
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/menu_opcoes_sem_java.png" style="width:260px; height:230px; margin-top:5px;" alt="Menu Opções" title="Menu Opções" align="left"/>
+		    <br clear="all">
+			( figura 2 )
+			
+		    <h2><a name="conf_status">4. Mensagens de Status</a></h2>
+		    <br/>
+		    É possível configurar uma mensagem de status acessando a janela que contém a lista de contatos (figura 3), ou clicando diretamente em cima da frase que aparece na janela da lista de contatos (figura 4).<br><br>
+			<table>
+				<tr>
+					<td>
+						<img src="{url}templates/default/images/menu_opcoes_sem_java.png" style="width:260px; height:230px; margin-top:5px;" alt="Menu Opções" title="Menu Opções" align="left"/>
+					</td>
+					<td valign="top">
+						<img src="{url}templates/default/images/status_mensagem.png" style="width:260px; height:152px; margin-top:5px;" alt="Menu Opções" title="Menu Opções" align="left"/>
+					</td>
+				</tr>
+				<tr>
+					<td align="center">( Figura 3 )</td>
+					<td align="center">( Figura 4 )</td>
+				
+				</tr>
+			</table>
+					    
+			<h2><a name="contact_list">5. Lista de Contatos</a></h2>
+			<br/>
+		    Na lista de contato ( conforme figura 4 ), você visualizará seus contatos.	
+		    <br/>
+		    <br/>
+		    <img src="{url}templates/default/images/lista_contatos_sem_java.png" width="258" height="265" alt="Lista de Contatos" align="left" style="margin:5px;"/>
+		    <br clear="all">
+		    ( figura 4 )
+		    <br/>
+		    <h2><a name="status">6. Status dos Usuários</a></h2>
+		    <img src="{url}templates/default/images/available.png" style="margin:1px;" align="top"> - Disponível<br/>
+		    <img src="{url}templates/default/images/away.png" style="margin:1px;" align="top"> - Ausente<br/>
+		    <img src="{url}templates/default/images/chat.png" style="margin:1px;" align="top"> - Bate-papo<br/>
+		    <img src="{url}templates/default/images/dnd.png" style="margin:1px;" align="top"> - Não Perturbe<br/>
+		    <img src="{url}templates/default/images/unavailable.png" style="margin:1px;" align="top"> - Offline / Desconectado<br/>    
+		    <img src="{url}templates/default/images/xa.png" style="margin:1px;" align="top"> - Ausência Prolongada<br/>    
+		    <h2><a name="useradd">7. Adicionando um novo contato </a></h2>
+			<br/>
+			Para adicionar um novo contato, clique na imagem <img src="{url}templates/default/images/group_open.gif"/>, no canto superior esquerdo (figura 5) e abrirá uma janela para adição dos contatos (figura 6) e
+			faça uma pesquisa pelo nome. O resultado retornará <u>somente</u> os usuários que <u>tem permissão</u> para usar o Mensageiro Instantâneo do Expresso. 
+			Clique sobre o link "Adicionar Contato" e aparecerá dois campos, sendo que o campo "Apelido" é preenchido no momento da escolha do novo contato e o campo grupo
+			terá que ser definido. Preenchendo estes dois campos basta clicar no "Botão Adicionar", e o contato será adicionado em sua Lista de Contatos.
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/adicionar_contato_sem_java.png" width="290px" height="131px" alt="Adicionar Contato" title="Adicionar Contato" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+			( figura 5 )
+		    <br/>
+			<br/>
+			<img src="{url}templates/default/images/janela_adicionar_contatos.png" width="444px" height="353px" style="margin-top:5px;" alt="Adicionar Contato" title="Adicionar Contato"/>
+			<br clear="all"/>
+			( figura 6 )
+			<br/>
+			<br/>
+		    <h2><a name="menu_right">8. Preferências Avançadas</a></h2>
+			<br/>
+			<br/>
+		    Clicando com o botão direito do mouse, você tera acesso a um menu ( conforme figura 7 ), com as seguintes funcionalidades :
+		
+		    <ul>
+		      <li>Autorizar : Requisitar e autorizar permissões ( Depois de adicionar um novo contato, é importante solicitar a autorização ).
+		      <li>Remover: Remove o contato.
+		      <li>Renomear : Renomeia o contato.
+		      <li>Trocar grupo: Altera o grupo do contato.
+		    </ul>
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/menu_right_sem_java.png" width="265px" height="127px" alt="Preferências Avançadas" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+			( figura 7 )    
+		    <br/>
+		    <br/>
+		    <h2><a name="troca_mens">9. Troca de Mensagens</a></h2>
+			<br/>
+			<br/>
+			Clicando com o mouse em cima do nome do contato escolhido, abrirá uma janela ( conforme figura 8 ), para a troca de mensagens. 
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/troca_de_mensagem_sem_java.png" width="391" height="377" alt="Troca de Mensagens" title="Troca de Mensagens" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+		    ( figura 8 )
+		    <br/>
+			<br/>
+		</div>
+	</div>
+</fieldset>	
+
+<!-- END index -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM_JAVA.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM_JAVA.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/indexIM_JAVA.tpl	(revision 4453)
@@ -0,0 +1,147 @@
+<!-- BEGIN index -->
+
+<fieldset>
+	<legend style="font-size:10pt;font-weight:bold; ">Expresso Messenger - Como Utilizar</legend>
+	<div style="height:500px; margin:5px;">
+		<div style="width:24%; float:left;">
+			<ol>		
+				<li><a href="#intro">Introdução</a><br/>
+				<li><a href="#supported">Browsers Suportados</a><br/>
+				<li><a href="#prefe">Opções - Troca de Status</a><br/>
+				<li><a href="#conf_status">Mensagens de Status</a><br/>
+				<li><a href="#contact_list">Lista de Contatos</a><br/>
+				<li><a href="#status">Indicador de Status</a><br/>
+				<li><a href="#useradd">Adicionando um novo contato</a><br/>
+				<li><a href="#menu_right">Preferências Avançadas</a><br/>
+				<li><a href="#troca_mens">Troca de Mensagens</a><br/>
+				<li><a href="#certi_java">Assinatura de Applet - Java</a><br/>
+			</ol>
+		</div>
+		<div style="height: 500px; margin-left:25%;overflow-y: auto;">
+		    <h2><a name="intro">1. Introdução</a></h2>
+		    
+		    O Expresso Messenger é uma aplicação que permite o envio e recebimento de mensagens instantaneamente. Através da sua lista de contatos, você pode trocar mensagens e arquivos com seus contatos. Através da lista também é possível saber se seus contatos estão Online ou Offline. Para a troca de mensagens basta clicar em cima do nome do seu contato, se o mesmo estiver online ( verifique a sessão <a href="#status">Indicador de Status</a> ) abrirá uma janela onde você poderá enviar/receber as mensagens. O Expresso Messenger está associado
+		    a um serviço de mensagens instantâneas Jabber e este serviço é responsável pelo armazenamento dos seus contatos, preferências e mensagens.
+			<br>
+			<br>
+			<img src="{url}templates/default/images/tela_inicial.png" style="width:239px; height:436px;" alt="Im Screenshot" title="Im Screenshot" align="left" style="padding-right:4px;"> 
+		    <br clear="all">
+			( figura 1 )
+		    <h2><a name="supported">2. Browsers Suportados</a></h2>
+		
+		    <p>
+		      <b>Windows XP/2000/ME/98/95:</b>
+			  <ul>
+			    <!--li>MS Internet Explorer desde a versão 6.0</li-->
+			    <li>Internet Explorer 6.0</li>
+			    <li>Mozilla Firefox desde a versão 2.0</li>
+			    <li>Mozilla Firefox desde a versão 3.0</li>
+			  </ul>
+			  
+		    <p>
+		      <b>Linux:</b>
+		      <ul>
+			    <li>Mozilla Firefox desde a versão 2.0</li>
+			    <li>Mozilla Firefox desde a versão 3.0</li>
+		      </ul>
+		    </p>
+			<h2><a name="prefe">3. Opções - Troca de Status</a></h2>
+			<br/>
+			Para a troca de status ( conforme figura 2 ), basta dar um clique com o mouse e em cima do botão <img src="{url}templates/default/images/botao_opcoes.png" width="116" height="21" style="margin-left:5px; margin-right:5px;"/> .
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/menu_opcoes.png" style="width:238px; height:267px; margin-top:5px;" alt="Menu Opções" title="Menu Opções" align="left"/>
+		    <br clear="all">
+			( figura 2 )    
+		    <h2><a name="conf_status">4. Mensagens de Status</a></h2>
+		    <br/>
+		    É possível configurar as mensagens para cada status escolhido (figura 3) clicando no item Personalizar.<br><br>
+			<img src="{url}templates/default/images/conf_status.png" style="width:345px; height:270px; margin-top:5px;" alt="Mensagens de Status" title="Mensagens de Status" align="left"/>
+			<br clear="all"/>
+			( Figura 3 )
+			<br clear="all"/>
+			<h2><a name="contact_list">5. Lista de Contatos</a></h2>
+			<br/>
+		    Na lista de contato ( conforme figura 4 ), você visualizará seus contatos.	
+		    <br/>
+		    <br/>
+		    <img src="{url}templates/default/images/lista_contatos.png" width="274" height="239" alt="Lista de Contatos" align="left" style="margin:5px;"/>
+		    <br clear="all">
+		    ( figura 4 )
+		    <br/>
+		    <h2><a name="status">6. Status dos Usuários</a></h2>
+		    <img src="{url}templates/default/images/available.png" style="margin:1px;" align="top"> - Disponível<br/>
+		    <img src="{url}templates/default/images/away.png" style="margin:1px;" align="top"> - Ausente<br/>
+		    <img src="{url}templates/default/images/chat.png" style="margin:1px;" align="top"> - Bate-papo<br/>
+		    <img src="{url}templates/default/images/dnd.png" style="margin:1px;" align="top"> - Não Perturbe<br/>
+		    <img src="{url}templates/default/images/invisible.png" style="margin:1px;" align="top"> - Invisível<br/>    
+		    <img src="{url}templates/default/images/unavailable.png" style="margin:1px;" align="top"> - Offline / Desconectado<br/>    
+		    <img src="{url}templates/default/images/xa.png" style="margin:1px;" align="top"> - Ausência Prolongada<br/>    
+		    <h2><a name="useradd">7. Adicionando um novo contato </a></h2>
+			<br/>
+			Para adicionar um novo contato, clique na imagem <img src="{url}templates/default/images/group_open.gif"/>, no canto superior esquerdo (figura 5) e abrirá uma janela para adição dos contatos (figura 6) e
+			faça uma pesquisa pelo nome. O resultado retornará <u>somente</u> os usuários que <u>tem permissão</u> para usar o Mensageiro Instantâneo do Expresso. 
+			Clique sobre o link "Adicionar Contato" e aparecerá dois campos, sendo que o campo "Apelido" é preenchido no momento da escolha do novo contato e o campo grupo
+			terá que ser definido. Preenchendo estes dois campos basta clicar no "Botão Adicionar", e o contato será adicionado em sua Lista de Contatos.
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/adicionar_contato.png" width="282px" height="142px" alt="Adicionar Contato" title="Adicionar Contato" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+			( figura 5 )
+		    <br/>
+			<br/>
+			<img src="{url}templates/default/images/janela_adicionar_contatos.png" width="444px" height="353px" style="margin-top:5px;" alt="Adicionar Contato" title="Adicionar Contato"/>
+			<br clear="all"/>
+			( figura 6 )
+			<br/>
+			<br/>
+		    <h2><a name="menu_right">8. Preferências Avançadas</a></h2>
+			<br/>
+			<br/>
+		    Clicando com o botão direito do mouse, você tera acesso a um menu ( conforme figura 7 ), com as seguintes funcionalidades :
+		
+		    <ul>
+		      <li>Autorizações : Requisitar e autorizar permissões ( Depois de adicionar um novo contato, é importante solicitar a autorização ).
+		      <li>Grupo: Trocar / Adicionar / Remover do grupo.
+		      <li>Renomear : Renomeia o contato.
+		      <li>Remover: Exclui o contato.
+		    </ul>
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/menu_right.png" width="412px" height="183px" alt="Preferências Avançadas" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+			( figura 7 )    
+		    <br/>
+		    <br/>
+		    <h2><a name="troca_mens">9. Troca de Mensagens</a></h2>
+			<br/>
+			<br/>
+			Clicando com o mouse em cima do nome do contato escolhido, abrirá uma janela ( conforme figura 8 ), para a troca de mensagens. Nessa mesma janela existe um menu, o qual é possível
+			configurar o formato da fonte e enviar smiles.
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/troca_de_mensagem.png" width="300" height="351" alt="Troca de Mensagens" title="Troca de Mensagens" align="left" style="margin-top:5px;"/>
+		    <br clear="all"/>
+		    ( figura 8 )
+		    <br/>
+			<br/>
+		    <h2><a name="certi_java">10. Assinatura de Applet - Java</a></h2>
+			<br/>
+			<br/>
+			O modelo de segurança implementado pela plataforma Java, está sobre o conceito que um código remoto (applet) não é confiável, garantindo assim que um applet malicioso não danifique
+			o computador. Porém existem applets que são de confiança e necessitam de permissões para fornecer determinado tipo de serviço. O Expresso Messenger é desenvolvido em
+			Java e precisa dessas permissões para fornecer o serviço de mensagens instantâneas. Quando carregado pela primeira vez, o Java que está instalado no computador, mostrará uma
+			janela ( figura 9), perguntando se deseja realmente rodar este código remoto e mostra dois botões, "Run" e o "Cancel". É necessário que seja marcada a opção "Run", e caso não queira
+			que esta janela abra, marque a opção "Always trust content from this publisher".
+			<br/>
+			<br/>
+		    <img src="{url}templates/default/images/cert_java.png" width="520" height="356" alt="Troca de Mensagens" title="Troca de Mensagens" align="bottom" style="margin-top:5px;"/>
+		    <br clear="all"/>
+		    ( figura 9 )
+		    <br/>
+			<br/>
+		</div>
+	</div>
+</fieldset>	
+
+<!-- END index -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/groupslocked.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/groupslocked.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/groupslocked.tpl	(revision 4453)
@@ -0,0 +1,58 @@
+<!-- BEGIN groups_locked -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script>
+<form method="POST" action="{action_url}">
+	<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+		<tr class="th">
+			<td colspan="2">&nbsp;<b>{lang_Jabberit_settings}</b></td>
+		</tr>
+		<tr class="row_off">
+			<td colspan="2" style="color:red !important">{lang_description}</td>
+		</tr>
+		<tr class="row_on">
+			<td colspan="2">
+				{lang_organizations} :
+				&nbsp;
+				<select id="admin_organizations_ldap" serverLdap="{value_serverLdap}" name="organizations" onchange="groups_ldap.groups(this);">
+					{ous_ldap}
+				</select>
+				<span id="admin_span_loading" style="color:red;visibility:hidden;">&nbsp;{lang_load}</span>
+			</td>
+		</tr>
+		<tr class="row_off">
+			<td colspan="2">
+				<table align="center" cellspacing="0">
+					<tr>
+						<td class="row_off">	
+							{lang_grupos_ldap} :
+							<br/>
+							<select id="groups_ldap_jabberit" size="10" style="width: 300px" multiple></select>
+						</td>
+						<td class="row_off">
+							<input type="button" value="{lang_add}" onclick="groups_ldap.add('groups_ldap_jabberit', 'groups_locked_jabberit');" />
+							<br/>
+							<br/>
+							<input type="button" value="{lang_remove}" onclick="groups_ldap.remove('groups_locked_jabberit');" />
+						</td>
+						<td class="row_off">
+							{lang_grupos_restritos} :
+							<br/>
+							<select id="groups_locked_jabberit" size="10" style="width: 300px" multiple name="groups_locked_jabberit[]">
+								{groups_restricts}
+							</select>
+						</td>
+					</tr>
+				</table>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="2" align="center">
+			  <input type="submit" name="save" value="{lang_save}" onclick="groups_ldap.selectAll('groups_locked_jabberit');">
+			  <input type="submit" name="cancel" value="{lang_cancel}">
+			  <br>
+			</td>
+		</tr>
+	</table>
+</form>
+<!-- END groups_locked -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/jmessenger.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/jmessenger.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/jmessenger.tpl	(revision 4453)
@@ -0,0 +1,72 @@
+<!-- BEGIN edit_groups_jmessenger -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script>
+
+<form method="POST" action="{action_url}">
+	<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+		<tr class="th">
+			<td colspan="2">&nbsp;<b>{lang_settings}</b></td>
+		</tr>
+		<tr class="row_off">
+			<td colspan="2">{lang_description}</td>
+		</tr>
+		
+		<tr class="row_on">
+			<td colspan="2">
+				{lang_organizations} :
+				&nbsp;
+				<select id="admin_organizations_ldap" serverLdap="{value_serverLdap}" name="organizations" onchange="groups_ldap.groups(this);">
+					{value_ous_ldap}
+				</select>
+				<span id="admin_span_loading" style="color:red;visibility:hidden;">&nbsp;{lang_load}</span>
+			</td>
+			
+		</tr>
+		
+		<tr class="row_off">
+			<td colspan="2">
+				<label>{lang_Search_quick_for} : </label>
+				<input type="text" id="groups_search_quick_for" size="40" maxlength="40" onkeyup="groups_ldap.quickSearch(this, event);">
+				<label id='label_groups_search_quick_for' serverLdap="{value_serverLdap}" style="color:red;"/>
+			</td>
+		</tr>	
+		
+		<tr class="row_on">
+			<td colspan="2">
+				<table align="center" cellspacing="0">
+					<tr>
+						<td class="row_off">	
+							{lang_groups_ldap} :
+							<br/>
+							<select id="groups_ldap_jabberit" size="10" style="width: 300px" multiple></select>
+						</td>
+						<td class="row_off">
+							<input type="button" value="{lang_add}" onclick="groups_ldap.add('groups_ldap_jabberit', 'groups_added_jabberit');" />
+							<br/>
+							<br/>
+							<input type="button" value="{lang_remove}" onclick="groups_ldap.remove('groups_added_jabberit');" />
+						</td>
+						<td class="row_off">
+							{lang_groups_add} :
+							<br/>
+							<select id="groups_added_jabberit" size="10" style="width: 300px" multiple name="groups_added_jabberit[]">
+								{value_groups_added}
+							</select>
+						</td>
+					</tr>
+				</table>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="2" align="center">
+				<input type="hidden" name="name_serverLdap" value="{value_serverLdap}" />
+				<input type="submit" name="save" value="{lang_save}" onclick="groups_ldap.selectAll('groups_added_jabberit');" />
+				<input type="submit" name="cancel" value="{lang_cancel}" />
+				<br>
+			</td>
+		</tr>
+	</table>
+</form>
+
+<!-- END edit_groups_jmessenger -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/confServersJabber.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/confServersJabber.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/confServersJabber.tpl	(revision 4453)
@@ -0,0 +1,98 @@
+<!-- BEGIN confServersJabber -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script>
+<form>
+<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+	<tr class="th">
+		<td colspan="2">&nbsp;<b>{lang_Add_Organizations_and_Servers_Jabber}</b></td>
+	</tr>
+	<tr class="row_on">
+		<td colspan="2">
+			<table width="100%;">
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>{lang_Organization}</label>
+					</td>
+					<td style="width:80%">
+						<input id="organizationLdapJabberit" type="text" size="30" maxlength="30"/>
+						<label style="font-size:7pt !important;color:red;">
+							{lang_Example}&nbsp;.:&nbsp;ORGANIZACAO&nbsp;&nbsp;(ou = CIA)
+						</label>
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>{lang_ServerJabber}</label>
+					</td>
+					<td style="width:80%">
+						<input id="hostNameJabberit" type="text" size="40" maxlength="40"/>
+						<label style="font-size:7pt !important;color:red;">{lang_Example}&nbsp;:&nbsp;jabber.server.com</label>
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>Servidor Ldap</label>
+					</td>
+					<td style="width:80%">
+						<input id="serverLdapJabberit" type="text" size="50" maxlength="50"/>
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>Contexto</label>
+					</td>
+					<td style="width:80%">
+						<input id="contextLdapJabberit" type="text" size="50" maxlength="50"/>
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>Usuário Ldap</label>
+					</td>
+					<td style="width:80%">
+						<input id="userLdapJabberit" type="text" size="50" maxlength="50"/>
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td style="width:20%">
+						<label>Password</label>	
+					</td>
+					<td style="width:80%">
+						<input id="passwordLdapJabberit" type="password" size="40" maxlength="40"/>					
+					</td>
+				</tr>
+				<tr class="row_off">
+					<td colspan="2" style="border:1px solid #00000; width:100%;">
+					  <input type="button" name="add" value="{lang_save}" onclick="constructScript.setConfServerJabber();" />
+					  <input type="reset" name="reset" value="{lang_new}" />
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr class="row_on">
+		<td colspan="2" style="padding:5 0 5 0px;">&nbsp;<b>{lang_Registration_Organizations_and_Server_Jabber}</b></td>
+	</tr>
+	<tr>
+		<td colspan="2">
+			<table id="tableConfServersJabber" cellspacing="2" style="width:100%">
+				<tr class='th'>
+					<td align="left" class="row_on" style="width:40%">{lang_Organization}</td>
+					<td align="left" class="row_on" style="width:40% !important">{lang_ServerJabber}</td>
+					<td align="left" class="row_on" style="width:10% !important">{lang_Edit}</td>										
+					<td align="left" class="row_on" style="width:10% !important">{lang_Delete}</td>
+				</tr>
+				{value_Organizations_Servers}
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2" align="center">
+		  <input type="button" name="back" value="{lang_Back}" onClick="document.location.href='{action_url}'" />
+		  <br/>
+		</td>
+	</tr>
+</table>
+</form>
+<!-- END confServersJabber -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/config.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/config.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/config.tpl	(revision 4453)
@@ -0,0 +1,109 @@
+<!-- BEGIN header -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script>
+<form method="POST" action="{action_url}">
+<table border="0" align="center">
+	<tr bgcolor="{th_bg}">
+		<td colspan="2"><font color="{th_text}">&nbsp;<b>{title} - Jetti Applet</b></font></td>
+	</tr>
+<!-- END header -->
+
+<!-- BEGIN body -->
+	<tr bgcolor="{row_on}">
+		<td colspan="2">&nbsp;</td>
+	</tr>
+
+	<tr bgcolor="{row_off}">
+		<td colspan="2">&nbsp;<b>:: Configuração do Servidor Jabber com Jeti Applet ::</b></td>
+	</tr>
+
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_name_jabberit__label">Digite o nome do Domínio Jabber</td>
+		<td>&nbsp;<input type="text" id="JETTI_name_jabberit" name="newsettings[name_jabberit]" value="{value_name_jabberit}" size="41" maxlength="47"></td>
+	</tr>
+
+	<tr bgcolor="{row_off}">
+		<td id="JETTI_ip_server_jabberit__label">Digite o Ip(s) do Servidor Jabber</td>		
+		<td>&nbsp;<input type="text" id="JETTI_ip_server_jabberit" name="newsettings[ip_server_jabberit]" value="{value_ip_server_jabberit}" size="41" maxlength="47"></td>
+	</tr>
+	
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_port_1_jabberit__label">Porta do servidor Jabber</td>
+		<td>&nbsp;<select id="JETTI_port_1_jabberit" name="newsettings[port_1_jabberit]">
+				<option value="false" {selected_port_1_jabberit_false}>Não Segura ( Sem SSL )</option>
+				<option value="true" {selected_port_1_jabberit_true}>Segura ( Com SSL )</option>
+			</select>
+		</td> 
+	</tr>
+
+	<tr bgcolor="{row_off}">		   
+		<td id="JETTI_port_2_jabberit__label">Mudança de porta</td>
+		<td>&nbsp;<input type="text" id="JETTI_port_2_jabberit" name="newsettings[port_2_jabberit]" value="{value_port_2_jabberit}"></td>
+	</tr>
+   
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_resource_jabberit__label">Digite Nome da Conexão</td>
+		<td>&nbsp;<input type="text" id="JETTI_resource_jabberit" name="newsettings[resource_jabberit]" value="{value_resource_jabberit}"></td>
+	</tr>
+   
+	<tr bgcolor="{row_off}">
+		<td colspan="2">&nbsp;<b>:: Configurando o Nome da Empresa ::</b></td>
+	</tr>
+	
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_name_company_applet_jabberit__label">Digite o Nome da sua Empresa</td> 
+		<td>&nbsp;<input type="text" id="JETTI_name_company_applet_jabberit" name="newsettings[name_company_applet_jabberit]" value="{value_name_company_applet_jabberit}"></td>	
+	</tr>
+
+	<tr bgcolor="{row_off}">
+		<td colspan="2">&nbsp;<b>:: Configuração do Servidor Ldap ::</b></td>
+	</tr>
+
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_server_ldap_jabberit__label">Servidor Ldap</td>
+		<td>&nbsp;<input type="text" id="JETTI_server_ldap_jabberit" name="newsettings[server_ldap_jabberit]" value="{value_server_ldap_jabberit}"></td>
+	</tr>
+
+	<tr bgcolor="{row_off}">
+		<td id="JETTI_context_ldap_jabberit__label">Contexto</td>
+		<td>&nbsp;<input type="text" id="JETTI_context_ldap_jabberit" name="newsettings[context_ldap_jabberit]" value="{value_context_ldap_jabberit}" size="30"></td>
+	</tr>
+
+	<tr bgcolor="{row_on}">
+		<td id="JETTI_anonymous_bind_jabberit__label">Anonimous Bind</td>
+		<td>&nbsp;<select id="JETTI_anonymous_bind_jabberit" name="newsettings[anonymous_bind_jabberit]">
+				<option value="false" {selected_anonymous_bind_jabberit_false}>Não</option>
+				<option value="true" {selected_anonymous_bind_jabberit_true}>Sim</option>
+			</select>
+		</td>
+	</tr>	
+
+	<tr bgcolor="{row_off}">
+		<td id="JETTI_user_ldap_jabberit__label">Usuário Ldap</td>
+		<td>&nbsp;<input type="text" id="JETTI_user_ldap_jabberit" name="newsettings[user_ldap_jabberit]" value="{value_user_ldap_jabberit}" size="30"></td>
+	</tr>
+
+	<tr bgcolor="{row_off}">
+		<td id="JETTI_password_ldap_jabberit__label">Password</td>
+		<td>&nbsp;<input type="password" id="JETTI_password_ldap_jabberit" name="newsettings[password_ldap_jabberit]" value="{value_password_ldap_jabberit}"></td>
+	</tr>
+
+<!-- END body -->
+
+<!-- BEGIN footer -->
+	<tr>
+		<td colspan="2" align="center">
+			<input type="button" value="{lang_submit}" onclick="constructScript.sendf(document);">
+			<!--
+			No MSIE utilizar um botão do tipo submit não permite que seja gravado o arquivo e configuração.
+			Por esse motivo o envio do formulário está sendo feito através do javascript.
+			NÃO REMOVA...			 
+			-->
+			<input type="submit" name="submit" style="display: none">
+			<input type="button" name="cancel" value="{lang_cancel}" onclick="document.location.href='./index.php?menuaction=jabberit_messenger.uiconfig.configServer'">
+		</td>
+	</tr>
+</table>
+</form>
+<!-- END footer -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/confGroupsLocked.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/confGroupsLocked.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/confGroupsLocked.tpl	(revision 4453)
@@ -0,0 +1,59 @@
+<!-- BEGIN confGroups -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script>
+<form>
+<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+	<tr class="th">
+		<td colspan="2">&nbsp;<b>{lang_Informe_as_Organizacoes}</b></td>
+	</tr>
+	<tr class="row_on">	
+		<td colspan="2" style="padding:5 0 5 0px;">
+			&nbsp;<b>&nbsp;{lang_Nome_Grupo}&nbsp;:</b><span style="font-size:12px;color:red;">&nbsp;{value_Name_Group}&nbsp;</span>
+		</td>
+	</tr>
+	<tr class="row_on">
+		<td colspan="2" style="padding:5 0 5 0px;">&nbsp;<b>&nbsp;{lang_Cadastrar_Organizacao}&nbsp;</b></td>
+	</tr>
+	<tr class="row_on">
+		<td colspan="2">
+			<table>
+				<tr>
+					<td colspan="3">
+						<label>{lang_Organization}</label>&nbsp;.:&nbsp;
+						<select id="organizations_ldap_jabberit">
+				   			{value_organizations_ldap}
+				   		</select>
+					</td>
+					<td class="row_on" style="border:1px solid #00000">
+					  <input type="button" name="add" value="{lang_save}" {value_flag} onclick="constructScript.setOrgFgroups();">
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr class="row_on">
+		<td colspan="2" style="padding:5 0 5 0px;">&nbsp;<b>{lang_Organizacoes_cadastradas_para_grupo}</b></td>
+	</tr>
+	<tr>
+		<td colspan="2">
+			<table id="tableOrganizationsEnabledGroupsJabberit" cellspacing="2" style="width:100%">
+				<tr class='th'>
+					<td align="left" class="row_on">{lang_Organization}</td>
+					<td align="left" class="row_on" style="width:30% !important">{lang_Delete}</td>					
+				</tr>
+				{value_Groups_Organizations}
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2" align="center">
+		  <input type="button" name="back" value="{lang_Back}" onclick="document.location.href='{action_url}'">
+		  <input type="hidden" id="nameGroup" value="{value_Name_Group}"/>
+		  <input type="hidden" id="gidNumber" value="{value_gidNumber}"/>
+		  <br/>
+		</td>
+	</tr>
+</table>
+</form>
+<!-- END confGroups -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/index.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/index.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/index.tpl	(revision 4453)
@@ -0,0 +1,15 @@
+<!-- BEGIN index -->
+<html>
+<head>
+<link rel='stylesheet' type='text/css' href='../help/templates/{template_default}/css/index.css'>
+</head>
+<body style="margin:0px;padding:0px">
+<table width='100%'>
+<tr><td align='right' background="../help/templates/{template_default}/images/fundo_topo.jpg">
+<img src="../help/templates/{template_default}/images/topo.jpg" style="overflow:hidden;z-index:-1;">
+<p class='titulo' style="font-color:blue;text-align:center;position:absolute;top:20px;left:5px;z-index:0;">Ajuda</p>
+</td></tr></table>
+	<iframe bgcolor="WHITE" frameborder='0' width='100%' height='410px' src="templates/{template_set}/content.html"></iframe>
+</body>
+</html>
+<!-- END index -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/configItens.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/configItens.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/configItens.tpl	(revision 4453)
@@ -0,0 +1,65 @@
+<!-- BEGIN configPermission -->
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image1}" align="middle" width="32" height="32" />
+			<a href="{value_config1}" style="padding:5px;">{label_config1}</a>
+		</p>
+	</div>
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image2}" align="middle" width="32" height="32" />
+			<a href="{value_config2}" style="padding:5px;">{label_config2}</a>
+		</p>
+	</div>	
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image3}" align="middle" width="32" height="32" />
+			<a href="{value_config3}" style="padding:5px;">{label_config3}</a>
+		</p>
+	</div>	
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image4}" align="middle" width="32" height="32" />
+			<a href="{value_config4}" style="padding:5px;">{label_config4}</a>
+		</p>
+	</div>	
+	
+	<div style="margin:15px; display:{value_display_jmessenger};">
+		<p>
+			<img src="{value_image5}" align="middle" width="32" height="32" />
+			<a href="{value_config5}" style="padding:5px;">{label_config5}</a>
+		</p>
+	</div>	
+	
+	<div style="margin:15px;">
+		<input type="button" value="Voltar" onclick="document.location.href='{action_url_back}'" />
+	</div>
+
+<!-- END configPermission -->
+
+
+<!-- BEGIN configServer -->
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image1}" align="middle" width="32" height="32" />
+			<a href="{value_config1}" style="padding:5px;cursor:pointer;">{label_config1}</a>
+		</p>
+	</div>
+
+	<div style="margin:15px;">
+		<p>
+			<img src="{value_image2}" align="middle" width="32" height="32" />
+			<a href="{value_config2}" style="padding:5px;">{label_config2}</a>
+		</p>
+	</div>	
+	</br>
+	<div style="margin:15px;">
+		<input type="button" value="Voltar" onclick="document.location.href='{action_url_back}'" />
+	</div>
+
+<!-- END configServer -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/jabberIM.tpl	(revision 4453)
@@ -0,0 +1,58 @@
+<!-- BEGIN index -->
+<html> 
+	<head>
+	<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
+	<meta HTTP-EQUIV="Expires" CONTENT="-1">
+	<meta HTTP-EQUIV="content-type" CONTENT="application/x-java-archive"> 
+	<script type="text/javascript" src="../jabberit_messenger/js/changeStatus.js"></script>
+	<script type="text/javascript">
+		
+		// Pop-up or Layer
+		if( window.parent.loadscript )
+			var element = window.parent.loadscript;
+		else
+			var element = self.opener.parent.loadscript;
+
+		changestatus.setpath('{path}');
+		
+		function getArgumentsApplet()
+		{
+			try
+			{
+				if( arguments.length > 0 )
+				{ 
+					if( arguments[0] == "getArgumentsApplet" )
+						changestatus.get(arguments[1], element.getElement());
+					
+					if( arguments[0] == "cleanStatus" )
+						element.autoStatusIM();
+				}
+			}
+			catch(e){}
+		}
+		
+	</script>
+	</head>
+	<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
+		<applet name='jeti' archive='{java_files}' code='{value_codeBase}' codebase='.' vspace='0px' hspace='0px' width='220px' height='400px' MAYSCRIPT>
+			<param name='FIELD01' value='{value_cnname}'>
+			<param name='FIELD02' value='{value_country}'>
+			<param name='FIELD03' value='{value_expresso}'>
+			<param name='FIELD04' value='javascript:window.close();'>			
+			<param name='FIELD05' value='{value_host}'>
+			<param name='FIELD06' value='{value_javaPlugins}'>
+			<param name='FIELD07' value='{value_language}'>
+			<param name='FIELD08' value='{value_company}'>
+			<param name='FIELD09' value='{value_password}'>
+			<param name='FIELD10' value='{value_port}'>			
+			<param name='FIELD11' value='{value_resource}'>			
+			<param name='FIELD12' value='{value_server}'>
+			<param name='FIELD13' value='{value_ssl}'>			
+			<param name='FIELD14' value='{value_use_https}'>
+			<param name='FIELD15' value='{value_userproxy}'>
+			<param name='FIELD16' value='{value_user}'>
+			<param name='FIELD17' value='{value_mc}'>
+		</applet>
+	</body>
+</html>
+<!-- END index -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/content.html
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/content.html	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/content.html	(revision 4453)
@@ -0,0 +1,129 @@
+<html>
+<head>
+<title>Ajuda</title>
+<link rel='stylesheet' type='text/css' href='../../../help/templates/celepar/css/index.css'>
+</head>
+<body bgcolor="WHITE">
+<a name='indice'/>
+<table width='100%'>
+    <p class='item'>JMessenger - Como Utilizar</p>
+    <ol>
+      <a href="#intro"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Introdução</li></font></a>
+      <a href="#supported"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Browsers Suportados</li></font></a>
+      <a href="#prefe"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Opções - Troca de Status</li></font></a>
+      <a href="#conf_status"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Mensagens de Status</li></font></a>
+	  <a href="#contact_list"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Lista de Contatos</li></font></a>
+      <a href="#status"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Indicador de Status</li></font></a>
+      <a href="#useradd"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Adicionando um novo contato</li></font></a>
+      <a href="#menu_right"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Preferências Avançadas</li></font></a>
+	  <a href="#troca_mens"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Troca de Mensagens</li></font></a>
+	  <a href="#certi_java"><font size="2" style="text-decoration:underline" color="DARKBLUE"><li>Assinatura de Applet - Java</li></font></a>		  
+    </ol>
+
+    <a name="intro"><p class='item'>1. Introdução</p></a>
+    <div class='texto'>
+    O JMessenger é uma aplicação que permite o envio e recebimento de mensagens instantaneamente. Através da sua lista de contatos, você pode trocar mensagens e arquivos com seus contatos. Através da lista também é possível saber se seus contatos estão Online ou Offline. Para a troca de mensagens basta clicar em cima do nome do seu contato, se o mesmo estiver online ( verifique a sessão <a href="#status">Indicador de Status</a> ) abrirá uma janela onde você poderá enviar/receber as mensagens. O JMessenger está associado
+    a um serviço de mensagens instantâneas Jabber e este serviço é responsável pelo armazenamento dos seus contatos, preferências e mensagens.
+    <br><br>
+	<img src="images/tela_inicial.png" style="width:239px; height:436px;" alt="Im Screenshot" title="Im Screenshot" align="bottom" style="padding:4px;">
+	<br clear="all">
+	( Figura 1 )
+	</div>
+    <br clear="all">
+    <p class='item'><a name="supported">2. Navegadores Suportados</a></p>
+    <div class='texto'>
+      	<p><u>Windows XP/2000/ME/98/95</u></p>
+	    <li>Internet Explorer 6.0</li>
+	    <li>Mozilla Firefox desde a versão 2.0</li>
+	    <li>Mozilla Firefox desde a versão 3.0</li>
+	 	<p><u>Linux</u></p>
+	    <li>Mozilla Firefox desde a versão 2.0</li>
+	    <li>Mozilla Firefox desde a versão 3.0</li>
+   </div>
+	<p class='back'><a href="#indice">Voltar</a></p>
+	<p class='item'><a name="prefe">3. Opções - Troca de Status</a></p>
+    <div class='texto'>
+	Para a troca de status ( conforme figura 2 ), basta dar um clique com o mouse e em cima do botão <img src="images/botao_opcoes.png" width="116" height="21" style="margin-left:5px; margin-right:5px;"/> .
+	<br><br>
+    <img src="images/menu_opcoes.png" style="width:238px; height:267px;" alt="Menu Opções" title="Menu Opções" align="bottom"/><br>( figura 2 )
+	</div>
+    <p class='item'><a name="conf_status">4. Mensagens de Status</a></p>
+	<div class='texto'>
+	É possível configurar as mensagens para cada status escolhido (figura 3) clicando no item Personalizar.<br><br>
+	<img src="images/conf_status.png" style="width:345px; height:270px; margin-top:5px;" alt="Mensagens de Status" title="Mensagens de Status" align="bottom"/>
+	<br>
+	( figura 3 )
+	</div>
+	<p class='back'><a href="#indice">Voltar</a></p>
+    <p class='item'><a name="contact_list">5. Lista de Contatos</a></p>
+	<div class='texto'> 
+	Na lista de contato (figura 4), você visualizará seus contatos.<br><br>
+    <img src="images/lista_contatos.png" width="274px" height="239px" alt="Lista de Contatos" align="bottom" style="border:1px solid black;margin:5px;"/>
+    <br>
+    ( figura 4 )
+	</div>
+    <p class='item'><a name="status">6. Status dos Usuários</a></p>    
+    <div class='texto' style="border:1px solid black;width:30%"><br>
+    <img src="images/available.png" style="margin:1px;" align="top"> - Disponível<br/>
+    <img src="images/away.png" style="margin:1px;" align="top"> - Ausente<br/>
+    <img src="images/chat.png" style="margin:1px;" align="top"> - Bate-papo<br/>
+    <img src="images/dnd.png" style="margin:1px;" align="top"> - Não Perturbe<br/>
+    <img src="images/invisible.png" style="margin:1px;" align="top"> - Invisível<br/>    
+    <img src="images/unavailable.png" style="margin:1px;" align="top"> - Offline / Desconectado<br/>    
+    <img src="images/xa.png" style="margin:1px;" align="top"> - Ausência Prolongada<br/>    
+	</div>
+    <p class='item'><a name="useradd">7. Adicionando um novo contato </a></p>
+	<div class='texto'>
+	Para adicionar um novo contato, clique na imagem <img src="images/group_open.gif"/>, no canto superior esquerdo (figura 5) e abrirá uma janela para adição dos contatos (figura 6) e
+	faça uma pesquisa pelo nome. O resultado retornará <u>somente</u> os usuários que <u>tem permissão</u> para usar o Mensageiro Instantâneo do Expresso. 
+	Clique sobre o link "Adicionar Contato" e aparecerá dois campos, sendo que o campo "Apelido" é preenchido no momento da escolha do novo contato e o campo grupo
+	terá que ser definido. Preenchendo estes dois campos basta clicar no "Botão Adicionar", e o contato será adicionado em sua Lista de Contatos.
+	<br/>
+    <img src="images/adicionar_contato.png" width="282px" height="142px" alt="Adicionar Contato" title="Adicionar Contato" align="bottom" style="margin-top:5px;"/>
+   	<br>( figura 5 )
+    <br/>
+	<br/>
+	<img src="images/janela_adicionar_contatos.png" width="444" height="353" style="margin-top:5px;" alt="Adicionar Contato" title="Adicionar Contato"/>
+	<br clear="all"/>
+	( figura 6 )
+	<br/>
+	<br/>
+	</div>
+	<p class='back'><a href="#indice">Voltar</a></p>
+    <p class='item'><a name="menu_right">8. Preferências Avançadas</a></p>
+	<div class='texto'>
+    Clicando com o botão direito do mouse, você terá acesso a um menu (figura 7), com as seguintes funcionalidades:
+    <blockquote><br>
+      - Autorizações: Requisitar e autorizar permissões.<br>
+      - Grupo: Trocar / Adicionar / Remover do grupo.<br>
+      - Renomear : Renomeia o contato.<br>
+      - Remover: Exclui o contato.
+     </blockquote>
+    <br>
+    <img src="images/menu_right.png" width="412" height="183" alt="Preferências Avançadas" align="bottom" style="margin-top:5px;"/>
+    <br>( figura 7 )
+	</div>
+	<p class='back'><a href="#indice">Voltar</a></p>
+	<p class='item'><a name="troca_mens">9. Troca de Mensagens</a></p>
+	<div class='texto'>
+	Clicando duas vezes com o botão esquerdo sobre o nome do contato escolhido, abrirá uma janela (figura 8), para a troca de mensagens. Nessa mesma janela existe um menu, o qual é possível
+	configurar o formato da fonte e enviar smiles.<br><br>
+    <img src="images/troca_de_mensagem.png" width="300" height="351" alt="Troca de Mensagens" title="Troca de Mensagens" align="bottom" style="margin-top:5px;"/><br>( figura 8 )
+	</div>	
+	<br/>
+	<p class='back'><a href="#indice">Voltar</a></p>
+	<p class='item'><a name="certi_java">10. Assinatura de Applet - Java</a></p>
+	<div class='texto'>
+	O modelo de segurança implementado pela plataforma Java, está sobre o conceito que um código remoto (applet) não é confiável, garantindo assim que um applet malicioso não danifique
+	o computador. Porém existem applets que são de confiança e necessitam de permissões para fornecer determinado tipo de serviço. O Expresso Messenger é desenvolvido em
+	Java e precisa dessas permissões para fornecer o serviço de mensagens instantâneas. Quando carregado pela primeira vez, o Java que está instalado no computador, mostrará uma
+	janela ( figura 9), perguntando se deseja realmente rodar este código remoto e mostra dois botões, "Run" e o "Cancel". É necessário que seja marcada a opção "Run", e caso não queira
+	que esta janela abra, marque a opção "Always trust content from this publisher".
+	<br><br>
+    <img src="images/cert_java.png" width="520" height="356" alt="Troca de Mensagens" title="Troca de Mensagens" align="bottom" style="margin-top:5px;"/><br>( figura 9 )
+	</div>	
+	<br/>	
+	<p class='back'><a href="#indice">Voltar</a></p>
+	<hr noshade>
+</body>
+</html>
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/logMessagesJabber.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/logMessagesJabber.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/logMessagesJabber.tpl	(revision 4453)
@@ -0,0 +1,142 @@
+<!-- BEGIN log_message -->
+
+<form method="POST" action="{action_url}">
+	
+	<div style="margin:10px;">
+		<label>{label_user}:</label>
+		<input type="text" size="40" maxlength="50" name="txtUser" value="{value_txtUser}"/>
+		<input type="submit" value="{label_view}" />
+		<br/>
+		<br/>
+	</div>
+	
+	<span style="margin-left:93%;">{label_page}{value_page}</span>
+	
+	<div style="margin:10px;width:100%;"> 
+		<table align="center" border="0" style="width:100%;">
+			<tr>
+				<td align="left" style="width:40%;" class="row_on"> {label_user} </td>
+				<td align="center" style="width:10%" class="row_on"> {label_total}</td>
+				<td align="center" style="width:20%;" class="row_on"> {label_first_message} </td>
+				<td align="center" style="width:20%" class="row_on"> {label_last_message} </td>
+				<td align="center" style="width:10%;" class="row_on"> {label_view}</td>
+			</tr>
+				{value_messages}			
+		</table>
+	</div>
+	
+	<div>
+		<div style="margin:10px; position:relative; float:left;">
+			<input type="button" onClick="document.location.href='{action_url_back}'" value="{label_back}"/>
+		</div>
+		<div style="margin:10px; position:relative; float:right;">
+			{bt_previous}
+			{bt_next}
+		</div>
+		<input type="hidden" name="button_previous" value="{value_previous}" />
+		<input type="hidden" name="button_next" value="{value_next}" />
+	</div>
+</form>
+
+<!-- END log_message -->
+
+<!-- BEGIN log_message_date -->
+
+	<span style="margin-left:93%;">{label_page}{value_page}</span>
+	
+	<div style="margin:10px;width:100%;"> 
+		<table align="center" border="0" style="width:100%;">
+			<tr>
+				<td align="left" style="width:30%;" class="row_on"> {label_user_1} </td>
+				<td align="left" style="width:30%" class="row_on"> {label_user_2} </td>
+				<td align="center" style="width:10%;" class="row_on"> {label_total} </td>
+				<td align="center" style="width:10%" class="row_on"> {label_first_message} </td>
+				<td align="center" style="width:10%" class="row_on"> {label_last_message} </td>
+				<td align="center" style="width:10%;" class="row_on"> {label_view} </td>
+			</tr>
+				{value_messages}			
+		</table>
+	</div>
+	
+	<div>
+		<form method="POST" action="{action_url_back}">
+			<div style="margin:10px; position:relative; float:left;">
+				<input type="submit" value="{label_back}"/>
+				<input type="hidden" name="txtUser" value="{value_txtUser}" />
+				<input type="hidden" name="pg1_next" value="{value_pg1_next}">
+				<input type="hidden" name="pg1_previous" value="{value_pg1_previous}">
+			</div>
+		</form>
+		
+		<form method="POST" action="{action_url}">
+			<div style="margin:10px; position:relative; float:right;">
+				{bt_previous}
+				{bt_next}
+			</div>
+			<input type="hidden" name="button_previous" value="{value_previous}" />
+			<input type="hidden" name="button_next" value="{value_next}" />
+			<input type="hidden" name="user" value="{value_user}" />
+			<input type="hidden" name="first_message" value="{value_first_message}" />
+			<input type="hidden" name="last_message" value="{value_last_message}" />
+			<input type="hidden" name="pg1_next" value="{value_pg1_next}">
+			<input type="hidden" name="pg1_previous" value="{value_pg1_previous}">
+		</form>
+		
+	</div>
+
+<!-- END log_message_date -->
+
+<!-- BEGIN log_message_complete -->
+
+	<span style="margin-left:93%;">{label_page}{value_page}</span>
+	
+	<div style="margin:10px;width:100%;"> 
+		<table align="center" border="0" style="width:100%;">
+			<tr>
+				<td align="left" style="width:25%;" class="row_on"> {label_user_1} </td>
+				<td align="left" style="width:25%" class="row_on"> {label_user_2} </td>
+				<td align="left" style="width:40%;" class="row_on"> {label_body} </td>
+				<td align="center" style="width:10%" class="row_on"> {label_date} </td>
+			</tr>
+				{value_messages}			
+		</table>
+	</div>
+	
+	<div>
+		<form method="POST" action="{action_url_back}">
+			<div style="margin:10px; position:relative; float:left;">
+				<input type="submit" value="{label_back}"/>
+				<input type="hidden" name="user" value="{value_user}" />
+				<input type="hidden" name="first_message" value="{value_first_message}" />
+				<input type="hidden" name="last_message" value="{value_last_message}" />
+				<input type="hidden" name="pg1_next" value="{value_pg1_next}">
+				<input type="hidden" name="pg1_previous" value="{value_pg1_previous}">
+				<input type="hidden" name="pg2_next" value="{value_pg2_next}">
+				<input type="hidden" name="pg2_previous" value="{value_pg2_previous}">
+				<input type="hidden" name="txtUser" value="{value_txtUser}" />
+			</div>
+		</form>
+	
+		<form method="POST" action="{action_url}">
+			<div style="margin:10px; position:relative; float:right;">
+				{bt_previous}
+				{bt_next}
+			</div>
+			<input type="hidden" name="button_previous" value="{value_previous}" />
+			<input type="hidden" name="button_next" value="{value_next}" />
+			<input type="hidden" name="dtfirst" value="{value_dtfirst}" />
+			<input type="hidden" name="dtlast" value="{value_dtlast}" />
+			<input type="hidden" name="first_message" value="{value_first_message}" />
+			<input type="hidden" name="last_message" value="{value_last_message}" />
+			<input type="hidden" name="txtUser" value="{value_txtUser}" />			
+			<input type="hidden" name="user" value="{value_user}" />
+			<input type="hidden" name="user1" value="{value_user1}" />
+			<input type="hidden" name="user2" value="{value_user2}" />
+			<input type="hidden" name="pg1_next" value="{value_pg1_next}">
+			<input type="hidden" name="pg1_previous" value="{value_pg1_previous}">
+			<input type="hidden" name="pg2_next" value="{value_pg2_next}">
+			<input type="hidden" name="pg2_previous" value="{value_pg2_previous}">
+		</form>
+	</div>
+
+<!-- END log_message_complete -->
Index: /branches/2.2.0.1/jabberit_messenger/templates/default/groupsLdap.tpl
===================================================================
--- /branches/2.2.0.1/jabberit_messenger/templates/default/groupsLdap.tpl	(revision 4453)
+++ /branches/2.2.0.1/jabberit_messenger/templates/default/groupsLdap.tpl	(revision 4453)
@@ -0,0 +1,93 @@
+<!-- BEGIN groups_ldap -->
+	
+	<table cellspacing="2" style="border:1px solid #000; margin-top:20px; width: 60%;" align="center">
+		<tr>
+			<td style='background:#dedede;'>&nbsp;{lang_Servers_ldap}</td>
+			<td style='background:#dedede;'>&nbsp;{lang_Edit}</td>
+		</tr>
+		{value_lists_ldaps}
+	</table>
+	<br/>
+	<table cellspacing="2" style="border:0; width: 60%;" align="center">
+		<tr>
+			<td><input type="button" onClick="document.location.href='{action_url_back}'" value="{label_Back}"/></td>
+		</tr>
+	</table>
+	
+<!-- END groups_ldap -->
+
+<!-- BEGIN edit_servers -->
+<script type="text/javascript" src="jabberit_messenger/js/connector.js"></script>
+<script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script>
+<script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script>
+
+<form method="POST" action="{action_url}">
+	<table align="center" width="60%" cellspacing="2" style="border: 1px solid #000000;">
+		<tr class="th">
+			<td colspan="2">&nbsp;<b>{lang_settings}</b></td>
+		</tr>
+		<tr class="row_on">
+			<td colspan="2">{label_serverLdap} : {value_serverLdap} </td>
+		</tr>
+		<tr class="row_off">
+			<td colspan="2">{lang_description}</td>
+		</tr>
+		
+		<tr class="row_on">
+			<td colspan="2">
+				{lang_organizations} :
+				&nbsp;
+				<select id="admin_organizations_ldap" serverLdap="{value_serverLdap}" name="organizations" onchange="groups_ldap.groups(this);">
+					{value_ous_ldap}
+				</select>
+				<span id="admin_span_loading" style="color:red;visibility:hidden;">&nbsp;{lang_load}</span>
+			</td>
+			
+		</tr>
+		
+		<tr class="row_off">
+			<td colspan="2">
+				<label>{lang_Search_quick_for} : </label>
+				<input type="text" id="groups_search_quick_for" size="40" maxlength="40" onkeyup="groups_ldap.quickSearch(this, event);">
+				<label id='label_groups_search_quick_for' serverLdap="{value_serverLdap}" style="color:red;"/>
+			</td>
+		</tr>	
+		
+		<tr class="row_on">
+			<td colspan="2">
+				<table align="center" cellspacing="0">
+					<tr>
+						<td class="row_off">	
+							{lang_groups_ldap} :
+							<br/>
+							<select id="groups_ldap_jabberit" size="10" style="width: 300px" multiple></select>
+						</td>
+						<td class="row_off">
+							<input type="button" value="{lang_add}" onclick="groups_ldap.add('groups_ldap_jabberit', 'groups_added_jabberit');" />
+							<br/>
+							<br/>
+							<input type="button" value="{lang_remove}" onclick="groups_ldap.remove('groups_added_jabberit');" />
+						</td>
+						<td class="row_off">
+							{lang_groups_add} :
+							<br/>
+							<select id="groups_added_jabberit" size="10" style="width: 300px" multiple name="groups_added_jabberit[]">
+								{value_groups_added}
+							</select>
+						</td>
+					</tr>
+				</table>
+			</td>
+		</tr>
+		<tr>
+			<td colspan="2" align="center">
+				<input type="hidden" name="name_serverLdap" value="{value_serverLdap}" />
+				<input type="submit" name="save" value="{lang_save}" onclick="groups_ldap.selectAll('groups_added_jabberit');" />
+				<input type="submit" name="cancel" value="{lang_cancel}" />
+				<br>
+			</td>
+		</tr>
+	</table>
+</form>
+
+<!-- END edit_servers -->
