Index: trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3332)
+++ trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 5041)
@@ -1,3 +1,2 @@
-
 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">\
@@ -108,5 +107,13 @@
 TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
 return true;},onPresenceChatRoom:function(msg)
-{var xquery=msg.getElementsByTagName("x");if(xquery.length>0)
+{var xquery=msg.getElementsByTagName("x");var _error=msg.getElementsByTagName("error");if(_error.length>0)
+{for(var i=0;i<_error.length;i++)
+{if(_error[i].getElementsByTagName("text"))
+{var _errorMsg=Strophe.getText(_error[i].getElementsByTagName("text")[0]);if(_errorMsg=="Room creation is denied by service policy")
+{alert(i18n.ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY);}
+else
+{alert(" Informe ao seu Administrador ERRO : \n"+_errorMsg);}}}}
+else
+{if(xquery.length>0)
 {for(var i=0;i<xquery.length;i++)
 {var xmlns=xquery[i].getAttribute("xmlns");if(xmlns.indexOf("http://jabber.org/protocol/muc#user")==0)
@@ -121,5 +128,5 @@
 {nodeUser.parentNode.removeChild(nodeUser);}
 else if(show)
-{nodeUser.style.backgroundImage='url("'+path_jabberit+'templates/default/images/'+show+'.gif")';}}}}}},onMessage:function(msg)
+{nodeUser.style.backgroundImage='url("'+path_jabberit+'templates/default/images/'+show+'.gif")';}}}}}}},onMessage:function(msg)
 {var checkTime=function(i)
 {if(i<10)i="0"+i;return i;};var messageDate=function(_date)
@@ -164,5 +171,5 @@
 {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])
+{var barejid=Strophe.getBareJidFromJid(fulljid);var titleWindow="";var paramsChatBox={'enabledPopUp':((loadscript.getBrowserCompatible())?"block":"none"),'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'];}}
@@ -179,5 +186,7 @@
 {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()
+_win=_winBuild(winChatBox);loadscript.notification(barejid);loadscript.getPhotoUser(barejid);_textarea.focus();_messages=_win.content().firstChild;while(_messages&&_messages.nodeType!==1)
+{_messages=_messages.nextSibling;}
+return(_messages);},makeChatRoom:function()
 {var jidChatRoom=arguments[0];var titleWindow="ChatRoom - "+unescape(arguments[1]);var paramsChatRoom={'idChatRoom':jidChatRoom+"__roomChat",'jidTo':jidChatRoom,'lang_Send':i18n.SEND,'lang_Leave_ChatRoom':i18n.LEAVE_CHATROOM,'path_jabberit':path_jabberit};TrophyIM.posWindow.top=TrophyIM.posWindow.top+10;if(TrophyIM.posWindow.top>200)
 TrophyIM.posWindow.top=100;TrophyIM.posWindow.left=TrophyIM.posWindow.left+5;if(TrophyIM.posWindow.left>455)
@@ -193,5 +202,7 @@
 {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)
+_win=_winBuild(winChatRoom);_messages=_win.content().firstChild;while(_messages&&_messages.nodeType!==1)
+{_messages=_messages.nextSibling;}
+return(_messages);},addContact:function(jidTo,name,group)
 {var _flag=true;if(TrophyIM.removeResult.idResult.length>0)
 {for(var i=0;i<TrophyIM.removeResult.idResult.length;i++)
@@ -396,5 +407,6 @@
 {current=presence}
 else
-{if(presence['priority']>current['priority']&&((presence['show']=="chat"||presence['show']=="available")||(current['show']!="chat"||current['show']!="available")))
+{if(presence['priority']>current['priority']&&((presence['show']=="chat"
+||presence['show']=="available")||(current['show']!="chat"||current['show']!="available")))
 {current=presence}}}}
 return current;}
