Index: trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php
===================================================================
--- trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3013)
+++ trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3100)
@@ -68,15 +68,15 @@
 		echo "<script type='text/javascript'>".$js."</script>";
 		echo "<script type='text/javascript' src='".$webserver_url . "js/strophe.min.js'></script>";
-		echo "<script type='text/javascript' src='".$webserver_url . "js/jscode/loadIM.js'></script>";
-        echo "<script type='text/javascript' src='".$webserver_url . "js/connector.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/xtools.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/lang/i18n_pt_Br.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/dragdrop.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/makeW.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/show_hidden.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/trophyim.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/AddUser.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_url . "js/xtools.mini.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.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.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."'); </script>";
 		
Index: trunk/jabberit_messenger/jmessenger/js/SelectEditable.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/SelectEditable.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/SelectEditable.mini.js	(revision 3100)
@@ -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: trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3100)
@@ -0,0 +1,432 @@
+
+var TROPHYIM_BOSH_SERVICE="/proxy/ejabberd";var TROPHYIM_LOG_LINES=200;var TROPHYIM_LOGLEVEL=0;var TROPHYIM_VERSION="0.3";var TROPHYIM_RESOURCE="/JABBERITWEB";var TROPHYIM_CHATROOM="conference.im.pr.gov.br";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},chatHistory:{},constants:{stale_roster:false},posWindow:{left:400,top:100},statusConn:{connected:false},_timeOut:{renderRoster:null},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;var _flag=0;do
+{_getUserCurrent=loadscript.getUserCurrent();_flag++;}while((_getUserCurrent==null||_flag>3))
+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)
+{TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
+return true;},onPresenceChatRoom:function(msg)
+{var xquery=msg.getElementsByTagName("x");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 nameChatRoom=xquery[i].parentNode.getAttribute('from');nameChatRoom=Strophe.getBareJidFromJid(nameChatRoom);var nickName=xquery[i].parentNode.getAttribute('from');nickName=Strophe.getResourceFromJid(nickName);var type=xquery[i].parentNode.getAttribute('type')?xquery[i].parentNode.getAttribute('type'):'available';var show=(xquery[i].parentNode.firstChild.firstChild!=null)?xquery[i].parentNode.firstChild.firstChild.nodeValue:type;if(xquery[i].firstChild.getAttribute('jid'))
+{if(Strophe.getBareJidFromJid(xquery[i].firstChild.getAttribute('jid'))==Strophe.getBareJidFromJid(TrophyIM.connection.jid))
+show=loadscript.getStatusUserIM();}
+var _UserChatRoom=document.createElement("div");_UserChatRoom.id=nameChatRoom+"_UserChatRoom__"+xquery[i].firstChild.getAttribute('jid');_UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/"+show+".gif')no-repeat center left");_UserChatRoom.appendChild(document.createTextNode(nickName));var nodeUser=document.getElementById(nameChatRoom+"_UserChatRoom__"+xquery[i].firstChild.getAttribute('jid'));if(nodeUser==null&&xquery[i].firstChild.getAttribute('jid'))
+{if(document.getElementById(nameChatRoom+'__roomChat__participants')!=null)
+{nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}
+else
+{TrophyIM.makeChatRoom(nameChatRoom,nameChatRoom);nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}}
+else
+{if(type=='unavailable')
+{var nodeUser="";if(xquery[i].firstChild.getAttribute('jid')!=null)
+nodeUser=document.getElementById(nameChatRoom+"_UserChatRoom__"+xquery[i].firstChild.getAttribute('jid'));else
+nodeUser=document.getElementById(nameChatRoom+"_UserChatRoom__"+xquery[i].parentNode.getAttribute('to'));nodeUser.parentNode.removeChild(nodeUser);}
+else if(show)
+{var _UserChatRoom=document.getElementById(nameChatRoom+"_UserChatRoom__"+xquery[i].firstChild.getAttribute('jid'))
+_UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/"+show+".gif')no-repeat center left");}}}}}},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");_message.innerHTML=Strophe.getText(elems[0]);var scripts=_message.getElementsByTagName('script');for(var i=0;i<scripts.length;i++)
+_message.removeChild(scripts[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 - "+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);setTimeout(function()
+{_winBuild('window_chat_room_'+jidChatRoom,'remove');},500);});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 _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.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()
+{var _error_return=function(element)
+{alert(" ERROR : "+element);};var iq=$iq({to:"conference.im.pr.gov.br",type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS});TrophyIM.connection.sendIQ(iq,loadscript.listRooms,_error_return,500);},removeContact:function(jidTo)
+{var divItenContact=null;if((divItenContact=document.getElementById('itenContact_'+jidTo)))
+{var _id=TrophyIM.connection.getUniqueId();var delContact=$iq({type:'set',id:_id})
+delContact=delContact.c('query').attrs({xmlns:'jabber:iq:roster'});delContact=delContact.c('item').attrs({jid:jidTo,subscription:'remove'}).tree();TrophyIM.connection.send(delContact);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)
+{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());}
+else
+{TrophyIM.connection.send($pres().c('show').t(_type).tree());}}}}}
+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());}}},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(room)
+{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: trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 3100)
@@ -0,0 +1,2 @@
+
+i18n={ME:'Eu',INACTIVE:' está inativo.',COMPOSING:' está digitando...',GONE:' saiu da conversa.',LEAVE_CHATROOM:'Sair da Sala',PAUSED:' está parado.',SEND:'Enviar',STATUS_ANAVAILABLE:'Desconectado',STATUS_AVAILABLE:'Disponível',STATUS_ANAVAILABLE:'Desconectado',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 !',CONTACT_ASK_FOR_AUTH:'CONTATO PEDE AUTORIZAÇÃO !',AUTHORIZED:'AUTORIZADO !',AUTH_SENT:'AUTORIZAÇÃO ENVIADA !',ASK_FOR_AUTH_QUESTION:'QUERO ADICIONÁ-LO(A) ! POSSO ?',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',NEW_USER:'Novo Usuário'};
Index: trunk/jabberit_messenger/jmessenger/js/AddUser.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/AddUser.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/AddUser.mini.js	(revision 3100)
@@ -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':'Adicionar','lang2':'Fechar','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.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);_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':'Adicionar Contatos','lang_empty':'None result was found.','lang_many_results':'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 - Add Contact',closeAction:"remove",content:Xtools.parse(Xtools.xml('adduser'),'addUser.xsl',infoUser)};_winBuild(winAddUser);var _pButtons={'lang1':'Adicionar','lang2':'Fechar','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':'Grupo','lang_load':'Carregando','lang_name_contact':'Nome do Contato','lang_result':'Resultado da Busca','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 - 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: trunk/jabberit_messenger/jmessenger/js/xtools.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/xtools.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/xtools.mini.js	(revision 3100)
@@ -0,0 +1,48 @@
+
+(function()
+{var _FILES=[];function _convert(pString)
+{if(typeof pString!='string')
+return false;if(window.ActiveXObject)
+{var _xmlDoc=new ActiveXObject("Microsoft.XMLDOM");_xmlDoc.async="false";_xmlDoc.loadXML(pString);}
+else
+{var parser=new DOMParser();var _xmlDoc=parser.parseFromString(pString,"text/xml");}
+return _xmlDoc;}
+function _load(pFile)
+{pFile=this._PATH+'xsl/'+pFile;if(!(_FILES[pFile]))
+{var _data=null;if(document.implementation.createDocument)
+_data=document.implementation.createDocument("","",null);else
+_data=new ActiveXObject("Msxml2.FreeThreadedDOMDocument");_data.async=false;_data.load(pFile+'?'+Date.parse(new Date));_FILES[pFile]=_data;}
+return _FILES[pFile];}
+function _parse()
+{if(arguments.length==1)
+{pXML=_xml('root');pXSL=arguments[0];}
+else
+{pXML=arguments[0];pXSL=arguments[1];}
+switch(typeof pXML)
+{case'object':break;case'string':if(pXML.indexOf('<')==0)
+pXML=_convert(pXML);else
+pXML=_load.call(this,pXML);break;default:return{'error':'invalid xml'}}
+switch(typeof pXSL)
+{case'object':break;case'string':pXSL=_load.call(this,pXSL);break;default:return{'error':'invalid xsl'}}
+var fragment=null;if(window.XSLTProcessor)
+{var xslProc=new XSLTProcessor();xslProc.importStylesheet(pXSL);if((arguments.length==3)&&(typeof arguments[2]=='object'))
+{var params=arguments[2];for(var i in params)
+if(params[i]&&params[i].constructor!=Function)
+xslProc.setParameter(null,String(i),String(params[i]));}
+fragment=xslProc.transformToFragment(pXML,document);var aux=document.createElement("div");aux.appendChild(fragment);fragment=aux.innerHTML;}
+else
+{var xslTemplate=new ActiveXObject("MSXML2.XSLTemplate");xslTemplate.stylesheet=pXSL;var xslProc=xslTemplate.createProcessor();xslProc.input=pXML;if((arguments.length==3)&&(typeof arguments[2]=='object'))
+{var params=arguments[2];for(var i in params)
+if(params[i]&&params[i].constructor!=Function)
+{xslProc.addParameter(String(i),String(params[i]),'');}}
+xslProc.transform();fragment=xslProc.output;}
+return fragment;}
+function _xml()
+{var a=false;if(document.implementation.createDocument)
+a=document.implementation.createDocument("","",null);else if(ActiveXObject)
+a=new ActiveXObject("Msxml2.DOMDocument");if(arguments.length==1&&typeof arguments[0]=='string')
+a.appendChild(a.createElement(arguments[0]));return a;}
+function xtools()
+{var _argv=arguments;this._PATH=(_argv.length>0)?_argv[0]:'';if(this._PATH!=''&&this._PATH.lastIndexOf('/')!=(this._PATH.length-1))
+this._PATH+='/';}
+xtools.prototype.convert=_convert;xtools.prototype.load=_load;xtools.prototype.parse=_parse;xtools.prototype.xml=_xml;window.xtools=xtools;})();
Index: trunk/jabberit_messenger/jmessenger/js/connector.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 3100)
@@ -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: trunk/jabberit_messenger/jmessenger/js/show_hidden.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/show_hidden.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/show_hidden.mini.js	(revision 3100)
@@ -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: trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 3100)
@@ -0,0 +1,325 @@
+
+(function()
+{var _autoStatus;var _autoStatusTime=60000;var addUser=null;var conn=null;var fullName="";var path="";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 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 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();'],['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 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'/> ");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('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 _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++};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:Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl",paramListContact)};if(_preferencesIM[0]=="openWindowJabberit:false")
+{winRosterDiv.left=50;winRosterDiv.leftOld=-1500;}
+_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),'subscribed');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),'subscribe');addUser.add(jidTo);break;default:alert("UNDEFINED : "+subscription);}}}
+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()
+{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",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","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',(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].hasAttribute('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].hasAttribute('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);};for(var i=0;i<element.length;i++)
+{_get_room_info(element[i].getAttribute('jid'));}}
+function getListRooms()
+{TrophyIM.getListRooms();}
+function joinRoom(jidRoom,nameRoom)
+{var test_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=test_append_nick(jidRoom,nickName);if(_prompt&&_prompt!="")
+{var room_nick=test_append_nick(jidRoom,_prompt);}
+TrophyIM.makeChatRoom(jidRoom,nameRoom);TrophyIM.joinChatRoom(room_nick);}}}
+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(";");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')
+{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(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: trunk/jabberit_messenger/jmessenger/js/dragdrop.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/dragdrop.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/dragdrop.mini.js	(revision 3100)
@@ -0,0 +1,50 @@
+
+(function()
+{var _element=null;var _elementA=null;var _elementB=null;var _parent=null;function _configEvent(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!='undefined')
+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)
+{_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 _drag_drop(){}
+_drag_drop.prototype.set=_load;window._drag_drop=_drag_drop;})();
Index: trunk/jabberit_messenger/jmessenger/js/makeW.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/makeW.mini.js	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/js/makeW.mini.js	(revision 3100)
@@ -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;}
