source: trunk/jmessenger/js/jscode/loadIM.js @ 2969

Revision 2969, 39.3 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #1116 - Melhorar a visualizacao/avisos de novos contatos e pedidos de autorizacao no modulo.

  • Property svn:executable set to *
Line 
1(function()
2{
3        var _autoStatus;
4        var _autoStatusTime             = 60000; // 1 minuto
5        var addUser                                     = null;
6        var conn                                        = null;
7        var fullName                            = "";
8        var path                                        = "";
9        var _preferencesIM                      = "";
10        var selectEditable                      = null;
11        var showhidden                          = null;
12        var statusUserIM                        = "";
13        var _statusMessage                      = "";
14        var timeoutId                           = null;
15        var userCurrent                         = null;
16        var _timeOutNotification        = "";
17        var Xtools                                      = null;
18        var zIndex                                      = 9001;
19        var windowPopUp                         = [];
20       
21        // Sniffer Browser
22        var agt = navigator.userAgent.toLowerCase();
23    var is_major = parseInt(navigator.appVersion);
24    var is_minor = parseFloat(navigator.appVersion);   
25    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
26                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
27                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
28    var is_gecko = (agt.indexOf('gecko') != -1);
29    var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1);
30    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
31    var is_ie3    = (is_ie && (is_major < 4));
32    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
33    var is_ie4up  = (is_ie && (is_major >= 4));
34    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
35    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
36    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
37    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
38    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
39    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);   
40    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
41
42        // Images
43        var add_user = new Image();
44        add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png';
45
46        var arrow_down = new Image();
47        arrow_down.src = path_jabberit + 'templates/default/images/arrow_down.gif';
48
49        var arrow_right = new Image();
50        arrow_right.src = path_jabberit + 'templates/default/images/arrow_right.gif';
51       
52        function actionButton()
53        {
54                if( arguments.length > 0 )
55                {
56                        var e                   = arguments[0];
57                        var _element    = ( e.target ) ? e.target : e.srcElement;
58                        var jid         = arguments[1];
59                        var index       = arguments[2];
60                        var coord       = null;
61
62                        if ( !e )
63                                e = window.event;
64
65                        var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft;
66                        var _Y = e.clientY + document.body.scrollTop  - document.body.clientTop;
67                               
68                        coord = { X : _X, Y : _Y };
69               
70
71                        var _onContextMenu = function()
72                        {
73                                return false;
74                        };
75                       
76                        window.document.oncontextmenu   = _onContextMenu;
77                       
78                        if( e.button )
79                        {
80                                if( e.button > 1 )
81                                        optionsItensContact( jid, index, coord );
82                                else
83                                        TrophyIM.rosterClick(jid);
84                        }       
85                        else if( e.which )
86                        {
87                                if( e.which > 1 )
88                                        optionsItensContact( jid, index, coord );
89                                else
90                                        if( e.target.id )
91                                                TrophyIM.rosterClick(jid);
92                        }
93                       
94                        setTimeout(function()
95                        {
96                                window.document.oncontextmenu = function()
97                                {
98                                        return true;
99                                };
100                               
101                        },500);
102                }
103        }
104
105        function addContact()
106        {
107                if( arguments.length > 0 )
108                        addUser.add();
109                else
110                        addUser.show();
111        }
112       
113        function addIcon()
114        {
115               
116                var div_write_msg       = ( getElement('em_div_write_msg') != null ) ? getElement('em_div_write_msg') : null ;
117                var StatusBar           = ( getElement('divStatusBar') != null ) ? getElement('divStatusBar') : null ;
118                var StatusBarIM         = ( getElement('JabberMessenger') != null ) ?  getElement('JabberMessenger') : null;
119               
120                /**************************************************************************
121                 *
122                 * Quando estiver habilitada a opção fora de escritório nos filtros.
123                 * 
124                 */
125
126                if( ( div_write_msg && StatusBarIM ) != null )
127                {               
128                        div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg);
129                        StatusBarIM.style.paddingLeft = '33px';
130                        return;
131                }
132               
133                /**************************************************************************/
134               
135                if ( !StatusBarIM )
136                {
137                        StatusBarIM = document.createElement('div');
138                        StatusBarIM.setAttribute('id', 'JabberMessenger');
139                }
140               
141                if( StatusBar )
142                {
143                        StatusBar.style.paddingLeft = '33px';
144                       
145                        var _div = document.createElement('div');
146                                _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling));
147                       
148                                StatusBar.parentNode.insertBefore( _div, StatusBar);
149                       
150                        var _fastMenu = top.document.createElement('div');
151                                _fastMenu.setAttribute('id', 'fast_menu_jabber_expresso');
152                                _fastMenu.style.background              = 'no-repeat';
153                                _fastMenu.style.backgroundImage = 'url(' + arrow_down.src + ')';
154                                _fastMenu.style.float                   = 'left';
155                                _fastMenu.style.height                  = '15px';
156                                _fastMenu.style.left                    = '7px';
157                                _fastMenu.style.margin                  = '8 0 0 10px';
158                                _fastMenu.style.padding                 = '0px';
159                                _fastMenu.style.position                = 'absolute';
160                                _fastMenu.style.width                   = '15px';
161                                _fastMenu.style.cursor                  = 'pointer';
162
163                        StatusBarIM.insertBefore( _fastMenu, StatusBarIM.firstChild );
164                       
165                        // Add event onclick element _fastMenu
166                        configEvents( _fastMenu, 'onclick', function(){ fastMenu(_fastMenu); });
167
168                        var _statusJabber = top.document.createElement('div');
169                                _statusJabber.setAttribute('id','status_jabber_expresso');
170                                _statusJabber.style.background          = 'no-repeat';
171                                _statusJabber.style.backgroundImage = 'url(' + add_user.src +')';
172                                _statusJabber.style.float                       = 'left';
173                                _statusJabber.style.height                      = '18px';
174                                _statusJabber.style.left                        = '19px';
175                                _statusJabber.style.margin                      = '0 0 0 10px';
176                                _statusJabber.style.padding                     = '0px';
177                                _statusJabber.style.position            = 'absolute';
178                                _statusJabber.style.width                       = '18px';
179                                _statusJabber.style.cursor                      = 'pointer';
180                                _statusJabber.style.zindex                      = '999999';
181                       
182                        StatusBarIM.insertBefore( _statusJabber, StatusBarIM.firstChild );
183                       
184                        StatusBar.insertBefore( StatusBarIM, StatusBar.firstChild );
185
186                        // Add event onclick element _statusJabber
187                        if( _preferencesIM[0] == "openWindowJabberit:true" )
188                        {
189                                configEvents( _statusJabber, 'onclick', function(){ rosterDiv(); });
190                        }
191                        else
192                        {
193                                configEvents( _statusJabber, 'onclick', function(){ TrophyIM.load(); });
194                        }
195                }
196        }
197
198        function autoStatus()
199        {
200                var _div_status = ( getElement('status_jabber_expresso') != null ) ?  getElement('status_jabber_expresso') : null;
201               
202                if ( _autoStatus )
203                        clearTimeout(_autoStatus);
204
205                if ( _div_status != null )
206                {
207                        var _status = _div_status.style.backgroundImage;
208                                _status = _status.substr(_status.lastIndexOf('/') + 1);
209                                _status = _status.substr(0, _status.indexOf('.'));
210                               
211                        if( _status == "xa" && _div_status.getAttribute('autoStatus') )
212                        {
213                                if( getStatusMessage() != "")
214                                        TrophyIM.setPresence("available", getStatusMessage());
215                                else
216                                        TrophyIM.setPresence("available");
217                               
218                                _div_status.removeAttribute('autoStatus');
219                                loadscript.setStatusJabber("Disponível","available");
220                        }
221                }
222               
223                var TimeStatus = _preferencesIM[2].split(':');
224
225                if( TimeStatus[1] )
226                        _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(TimeStatus[1]) * _autoStatusTime );
227                else
228                        _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(_autoStatusTime));
229        }
230       
231        function autoStatusHandler()
232        {
233                var _div_status = ( getElement('status_jabber_expresso') != null ) ?  getElement('status_jabber_expresso') : null;
234               
235                if ( _div_status != null )
236                {
237                        var _status = _div_status.style.backgroundImage;
238                                _status = _status.substr(_status.lastIndexOf('/') + 1);
239                                _status = _status.substr(0, _status.indexOf('.'));
240                       
241                        if( _status == "available" )
242                        {
243                                if(getStatusMessage() != "")
244                                        TrophyIM.setPresence("xa", getStatusMessage());
245                                else
246                                        TrophyIM.setPresence("xa");
247
248                                _div_status.setAttribute('autoStatus','true');
249                               
250                                loadscript.setStatusJabber("Não Disponível","xa");
251                        }
252                }
253        }
254
255        function clrAllContacts()
256        {
257                getElement("JabberIMRoster").innerHTML = "";
258        }
259       
260        function configEvents(pObj, pEvent, pHandler)
261        {
262                if ( typeof pObj == 'object' )
263                {
264                        if ( pEvent.substring(0, 2) == 'on' )
265                                pEvent = pEvent.substring(2, pEvent.length );
266
267                        if ( arguments.length == 3 )
268                        {
269                                if ( pObj.addEventListener )
270                                        pObj.addEventListener(pEvent, pHandler, false );
271                                else if ( pObj.attachEvent )
272                                        pObj.attachEvent( 'on' + pEvent, pHandler );
273                        }
274                        else if ( arguments.length == 4 )
275                        {
276                                if ( pObj.removeEventListener )
277                                        pObj.removeEventListener( pEvent, pHandler, false );
278                                else if ( pObj.detachEvent )
279                                        pObj.detachEvent( 'on' + pEvent, pHandler );
280                        }
281                }
282        }
283       
284        function fastMenu()
285        {
286                if( arguments.length > 0 )
287                {
288                        var element = arguments[0];
289
290                        if( showhidden == null )
291                                showhidden = new ShowHidden(300);
292
293                        var _options = [
294                                                ['Adicionar Contato', 'loadscript.addContact();' ],
295                                                ['Ajuda', 'alert("2")' ],
296                                                ['Preferências', 'loadscript.preferences();'],
297                                                   ];
298
299                        var _itens = "";
300                       
301                        for( var i in _options )
302                        {
303                                if( _options[i].constructor == Function )
304                                        continue;
305                               
306                                _itens += '<img src="'+arrow_right.src+'"/>';
307                                _itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>';
308                                _itens += _options[i][0] + '</span><br/>';
309                        }
310                       
311                        var _optionsItens = document.createElement("div");
312                                _optionsItens.id        = "fastMenu_Jabber";                           
313                                _optionsItens.style.marginTop   = "19px";
314                                _optionsItens.style.marginLeft  = "-8px";
315                                _optionsItens.className         = "x-menu";
316                                _optionsItens.style.zIndex      = '999999';
317                                _optionsItens.innerHTML         = _itens;
318                                _optionsItens.onclick           = function(){ showhidden.hiddenObject(false); };
319                                _optionsItens.onmouseout        = function(){ showhidden.hiddenObject(false); };
320                                _optionsItens.onmouseover       = function(){ showhidden.hiddenObject(true); };
321                                                                                 
322                                showhidden.action('onmouseover', 'onmouseout', _optionsItens);
323                               
324                        element.parentNode.appendChild( _optionsItens );
325                }
326        }
327       
328        function getElement( elementId )
329        {
330                return document.getElementById( elementId );
331        }
332       
333        function getIsIE()
334        {
335                return is_ie;
336        }
337       
338        function getPhotoUser( jid )
339        {
340                try
341                {
342                var _divPhoto = getElement( jid + '__photo' );
343
344                if( _divPhoto.style.backgroundImage.indexOf('photo.png') > 0 )
345                {
346                        var _imgUser  = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date );
347                                _imgUser += '&photo_ldap=' + jid;
348
349                        _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')';
350                }
351                }
352                catch(e)
353                {}
354        }
355       
356        function getShowContactsOffline()
357        {
358                if( _preferencesIM[3] )
359                {
360                        var showOffline = _preferencesIM[3].split(":");
361                       
362                        if( showOffline[1] === "true")
363                                return true;
364                        else
365                                return false;
366                }
367               
368                return true;
369        }
370       
371        function getSmiles( String )
372        {
373                String = String.replace( /:\)|:-\)/g    , " <img src='"+path_jabberit+"templates/default/images/smiles/1.gif'/> ");
374                String = String.replace( /:-D/g                 , " <img src='"+path_jabberit+"templates/default/images/smiles/2.gif'/> ");
375                String = String.replace( /;-\)/g                , " <img src='"+path_jabberit+"templates/default/images/smiles/3.gif'/> ");
376                String = String.replace( /=-O/g                 , " <img src='"+path_jabberit+"templates/default/images/smiles/4.gif'/> ");
377                String = String.replace( /:P/g                  , " <img src='"+path_jabberit+"templates/default/images/smiles/5.gif'/> ");
378                String = String.replace( /8-\)/g                , " <img src='"+path_jabberit+"templates/default/images/smiles/6.gif'/> ");
379                String = String.replace( /\>:o/g                , " <img src='"+path_jabberit+"templates/default/images/smiles/7.gif'/> ");
380                String = String.replace( /:-\$/g                , " <img src='"+path_jabberit+"templates/default/images/smiles/8.gif'/> ");
381                String = String.replace( /:s|:-X/g              , " <img src='"+path_jabberit+"templates/default/images/smiles/9.gif'/> ");
382                String = String.replace( /:-\(/g                , " <img src='"+path_jabberit+"templates/default/images/smiles/10.gif'/> ");
383                String = String.replace( /:\'\(/g               , " <img src='"+path_jabberit+"templates/default/images/smiles/11.gif'/> ");
384                String = String.replace( /:\|/g                 , " <img src='"+path_jabberit+"templates/default/images/smiles/12.gif'/> ");
385                String = String.replace( /O:-\)/g               , " <img src='"+path_jabberit+"templates/default/images/smiles/13.gif'/> ");
386                String = String.replace( /\*\*@#%/g             , " <img src='"+path_jabberit+"templates/default/images/smiles/14.gif'/> ");
387                String = String.replace( /\(I\)/g               , " <img src='"+path_jabberit+"templates/default/images/smiles/15.gif'/> ");
388 
389                return String;
390        }
391       
392        function getStatusMessage()
393        {
394                return _statusMessage;
395        }
396       
397        function getUserCurrent()
398        {
399                return userCurrent;
400        }
401       
402        function getZindex()
403        {
404                return zIndex++;
405        }
406       
407        function groupsHidden()
408        {
409                if( arguments.length > 0 )
410                {
411                        var _element = arguments[0];
412                                _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left";
413                                _element.onclick = function(){ groupsVisible(_element);};
414                               
415                                // Hidden all
416                                var _elementNext = _element.nextSibling;
417                               
418                                while( _elementNext )
419                                {       
420                                        if( _elementNext.nodeType == 1 )
421                                                _elementNext.style.display = "none";
422                                       
423                                        _elementNext = _elementNext.nextSibling;
424                                }
425                }
426        }
427       
428        function groupsVisible()
429        {
430                if( arguments.length > 0 )
431                {
432                        var _element = arguments[0];
433                                _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left";
434                                _element.onclick = function(){ groupsHidden(_element);};
435
436                                // Display all
437                                var _elementNext = _element.nextSibling;
438                               
439                                while( _elementNext )
440                                {       
441                                        if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div" )
442                                        {
443                                                var is_off = _elementNext.style.backgroundImage.indexOf("unavailable");
444
445                                                if( is_off > 0 && !getShowContactsOffline())
446                                                {
447                                                        _elementNext.style.display = "none";
448                                                        getElement("span_show_" + _elementNext.id ).style.display = "none";
449                                                       
450                                                }
451                                                else
452                                                {
453                                                        _elementNext.style.display = "block";
454                                                        getElement("span_show_" + _elementNext.id ).style.display = "block";
455                                                }
456                                        }
457
458                                        _elementNext = _elementNext.nextSibling;
459                                }
460                }
461        }
462       
463        function keyPressSearch()
464        {
465                if( arguments.length > 0 )
466                {
467                        var ev          = arguments[0];
468                        var element     = arguments[1];
469       
470                        if ( ev.keyCode == 13 )
471                                if( element.value.length >= 3 )
472                                        searchUser( element.value );   
473                                else
474                                        alert('Your search argument must be longer than 3 characters.');
475                }
476        }
477
478       
479        function loginPage()
480        {
481                var paramsLoginPage =
482                {
483                        'username' : ((( Base64.decode(getUserCurrent().jid) )) ? Base64.decode(getUserCurrent().jid) : ""),
484                        'password' : ((( Base64.decode(getUserCurrent().password) )) ? Base64.decode(getUserCurrent().password) : "")
485                }
486               
487                var winLoginPage =
488                {       
489                         id_window              : "window_login_page",
490                         width                  : 260,
491                         height                 : 120,
492                         top                    : 100,
493                         left                   : 400,
494                         draggable              : true,
495                         visible                : "display",
496                         resizable              : true,
497                         zindex                 : zIndex++,
498                         title                  : "Expresso Messenger - Login",
499                         closeAction    : "remove",
500                         content                : Xtools.parse(Xtools.xml("login_page"), "loginPage.xsl", paramsLoginPage)     
501                };
502
503                _winBuild( winLoginPage );
504        }
505
506        function loadScripts(pFiles)
507        {
508                // Load JavaScript
509                var loadJavaScript = function(pJs)
510                {
511                        var newScript = document.createElement("script");
512                                newScript.setAttribute("type", "text/javascript");
513                                newScript.setAttribute("src", pJs );
514                               
515                        return newScript;
516                };
517               
518                // Load CSS
519                var loadStyleSheet = function(pCss)
520                {
521                        var newStyle = document.createElement("link");
522                                newStyle.setAttribute("rel", "stylesheet");
523                                newStyle.setAttribute("type", "text/css");
524                                newStyle.setAttribute("href", pCss);
525                               
526                        return newStyle;
527                };
528               
529                for(var i = 0; i < pFiles.length; i++)
530                {
531                        if( pFiles[i].indexOf(".js") > -1 )
532                                document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i]));
533                               
534                        if( pFiles[i].indexOf(".css") > -1 )
535                                document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i]));
536                }
537        }
538       
539        function notificationNewMessage()
540        {
541                var _doc                = document;
542                var _id                 = arguments[0];
543                var _win_name   = _id.replace( /\W/g, '' );
544               
545                if ( windowPOPUP( _id ) )
546                {
547                        _doc = windowPopUp[_win_name].document;
548                }
549               
550                var oldTitle    = _doc.title;
551                var newTitle    = "## NOVA MENSAGEM ##";
552
553                if( timeoutId == null )
554                {
555                        timeoutId = setInterval(function()
556                        {
557                                _doc.title = ( _doc.title == newTitle ) ? oldTitle : newTitle;
558                        }, 1000);
559                       
560                        configEvents( _doc, 'onclick', function()
561                        {
562                                clearInterval(timeoutId);
563                                _doc.title      = oldTitle;
564                                timeoutId               = null;
565                        });
566                       
567                        configEvents( _doc, 'onkeypress', function()
568                        {
569                                clearInterval(timeoutId);
570                                _doc.title      = oldTitle;
571                                timeoutId               = null;
572                        });
573                }
574        }
575
576        function optionsItensContact()
577        {
578                if( arguments.length > 0 )
579                {
580                        var jid         = arguments[0];
581                        var index       = arguments[1];
582                        var coord       = arguments[2];
583                        var element = getElement('itenContact_' + jid + '_' + index );
584                        var action      = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar";     
585                       
586                        if( showhidden == null )
587                                showhidden = new ShowHidden(300);
588
589                        var _options = [
590                                                [ action , 'loadscript.setAutorization(\''+jid+'\',\''+index+'\')'],
591                                                ['Remover' , 'loadscript.removeContact(\''+jid+'\',\''+index+'\')'],
592                                                ['Renomear' , 'loadscript.renameContact(\''+jid+'\',\''+index+'\')'],
593                                                ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\',\''+index+'\')']
594                                                   ];
595
596                        var _itens = "";
597                       
598                        for( var i in _options )
599                        {
600                                if( typeof(_options[i]) == "object")
601                                {
602                                        _itens += '<img src="'+arrow_right.src+'"/>';
603                                        _itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>';
604                                        _itens += _options[i][0] + '</span><br/>';
605                                }
606                        }
607                       
608                        var _optionsItens = document.createElement("div");
609                                _optionsItens.className         = "x-menu";
610                                _optionsItens.style.top         = coord.Y;
611                                _optionsItens.style.left        = ( coord.X - element.offsetLeft );
612                                _optionsItens.style.zIndex      = getZindex();
613                                _optionsItens.innerHTML         = _itens; 
614                                _optionsItens.onclick           = function(){ showhidden.hiddenObject(false); };
615                                _optionsItens.onmouseout        = function(){ showhidden.hiddenObject(false); };       
616                                _optionsItens.onmouseover       = function(){ showhidden.hiddenObject(true); };
617                               
618                                showhidden.action('onmouseover', 'onmouseout', _optionsItens);
619                               
620                        window.document.body.appendChild(_optionsItens);
621                }
622        }
623
624        function parse()
625        {
626                if( arguments.length == 2 )
627                        return Xtools.parse(Xtools.xml(arguments[0]), arguments[1] );
628               
629                if( arguments.length === 3 )
630                        return Xtools.parse(Xtools.xml(arguments[0]), arguments[1], arguments[2] );
631        }
632       
633        function preferences()
634        {
635                var paramPreferences =
636                {
637                        'path'  : path,
638                        'lang1' : 'Suas Preferências',
639                        'lang2' : 'Conexão',   
640                        'lang3' : 'Conectar Automaticamente o IM',
641                        'lang4' : 'Usuários OffLine',
642                        'lang5' : 'Exibir amigos Offline',
643                        'lang6' : 'Salvar',
644                        'lang7' : 'Cancelar',
645                        'lang8' : 'Janela de Contatos',
646                        'lang9' : 'Abrir janela como Pop-up',
647                        'lang10' : 'Ausente',
648                        'lang11' : 'Definir status de ausente depois de',
649                        'lang12' : 'minutos',   
650                        'lang13' : 'Mostrar Contatos', 
651                        'lang14' : 'Mostrar contatos desconectados',
652                        'langYes': 'Sim',
653                        'langNo' : 'Não'                                                                                           
654                };
655               
656               
657                var _win_preferences =
658                {
659                                id_window        : "jabberit_preferences",
660                                width            : 430,
661                                height           : 350,
662                                top                      : 150,
663                                left             : 100,
664                                draggable        : true,
665                                visible          : "display",
666                                resizable        : true,
667                                zindex           : zIndex++,
668                                title            : 'Expresso Messenger - Preferências',
669                                closeAction  : "remove",
670                                content          : Xtools.parse(Xtools.xml('preferences'), 'preferences.xsl', paramPreferences)
671                };
672
673                _winBuild(_win_preferences);
674               
675               
676                var _pButtons = {
677                                'lang1' : 'Salvar',
678                                'lang2' : 'Fechar',
679                                'onclickClose' : '_winBuild("jabberit_preferences","remove");',
680                                'onclickSubmit' : 'javascript:loadscript.setPreferences();'
681                };
682               
683                document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons);
684               
685                // Element openWindowJabberit
686                var value1                      = _preferencesIM[0].split(':');
687                var element1            = document.getElementById(value1[0]);
688                var valueSelect1        = value1[1];
689               
690                for(var i = 0; i < element1.options.length; i++)
691                        if( element1.options[i].value == valueSelect1 )
692                                element1.options[i].selected = true;
693
694                // Element openWindowJabberitPopUp
695                var value2                      = _preferencesIM[1].split(':');
696                       
697                // Element flagAwayIM
698                var value3              = _preferencesIM[2].split(':');
699                var element3    = document.getElementById(value3[0]);
700                element3.value  = value3[1];
701               
702                // Element showContactsOfflineJabberit
703                var value4                      = _preferencesIM[3].split(':');
704                var element4            = document.getElementById(value4[0]);
705                var valueSelect4        = value4[1];
706                for(var i = 0; i < element4.options.length; i++)
707                        if( element4.options[i].value == valueSelect4 )
708                                element4.options[i].selected = true;
709        }
710       
711        function removeContact(jid, index)
712        {
713                setTimeout(function()
714                {
715                        TrophyIM.removeContact(jid, index);
716                       
717                },300);
718        }
719       
720        function removeElement( )
721        {
722                if( arguments.length > 0 )
723                {
724                        var _element = arguments[0]
725                        var _parent  = _element.parentNode;
726       
727                        _parent.removeChild( _element );
728                }
729        }
730       
731        function removeGroup()
732        {
733                var _parent = arguments[0];
734               
735                if( _parent.childNodes.length <= 2 )
736                        _parent.parentNode.removeChild(_parent);
737        }
738       
739        function renameContact()
740        {
741                if( arguments.length > 0 )
742                {
743                        var _jid        = arguments[0];
744                        var _index      = arguments[1];
745                       
746                        TrophyIM.renameContact( _jid, _index );
747                }
748        }
749       
750        function renameGroup()
751        {
752                if( arguments.length > 0 )
753                {
754                        var _jid        = arguments[0];
755                        var _index      = arguments[1];
756                       
757                        TrophyIM.renameGroup( _jid , _index );
758                }
759        }
760       
761        function rosterDiv()
762        {
763                var _rosterDiv = function()
764                {
765                        var _idUser     = Base64.decode(getUserCurrent().jid);
766                       
767                        var paramListContact =
768                        {
769                                'idUser'                : _idUser,
770                                'full_name'             : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")),
771                                'path_jabberit' : path_jabberit,
772                                'zIndex_'               : zIndex++
773                        };
774       
775                        var winRosterDiv =
776                        {
777                                 id_window              : "window_Roster_im",
778                                 width                  : 250,
779                                 height                 : 410,
780                                 top                    : 50,
781                                 left                   : -1500,
782                                 leftOld                : 50,
783                                 draggable              : true,
784                                 visible                : "display",
785                                 resizable              : true,
786                                 zindex                 : zIndex++,
787                                 title                  : "Expresso Messenger - Contatos",
788                                 closeAction    : "hidden",
789                                 content                : Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact)       
790                        };
791                       
792                        if( _preferencesIM[0] == "openWindowJabberit:false" )
793                        {
794                                winRosterDiv.left               = 50;
795                                winRosterDiv.leftOld    = -1500;
796                        }
797                               
798                        _winBuild( winRosterDiv );
799                       
800                        // Photo User
801                        getPhotoUser(_idUser);
802                }
803               
804                setTimeout( function(){ _rosterDiv(); }, 200 );
805        }
806
807        function searchUser()
808        {
809                var _input      = getElement('search_user_jabber');
810               
811                if( _input.value.length >= 3 )
812                        addUser.search();
813                else
814                        alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' );
815        }
816       
817        function setAutorization(jidTo, indexTo)
818        {
819        var divItenContact = null;
820       
821        if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo )))
822        {       
823                var subscription = divItenContact.getAttribute('subscription');
824               
825                switch(subscription)
826                {
827                        case 'from':
828                               
829                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe');
830                                break;
831
832                        case 'none' :
833                               
834                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe');
835                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed');
836                               
837                                break;
838
839                        case 'not-in-roster':
840                                       
841                                setTimeout(function()
842                                        {
843                                        var _add = "";
844                               
845                                        if( ( _add = confirm("Deseja adicionar o usuario!")) )         
846                                        {
847                                                addUser.add( jidTo, indexTo );
848                                        }
849                                       
850                                        },100);
851                               
852                                        break;
853                                       
854                        case 'to' :
855
856                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed');
857                                       
858                        case 'subscribe' :
859                               
860                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe');
861                               
862                                        break;
863                                       
864                                default :
865                                       
866                                        alert( "DEFAULT : " + subscription );
867                }
868        }       
869        }
870       
871        function setMessageStatus()
872        {
873                if( arguments.length > 0 )
874                {
875                        var _element = arguments[0];
876                        var _parent      = _element.parentNode;                 
877
878                        if( _element.nodeName.toLowerCase() == "label")
879                        {
880                                var _input                              = document.createElement("input");
881                                        _input.size                     = "35";
882                                        _input.maxlength        = "35";
883                                        _input.style.border = "0";
884                                        _input.value            = _element.innerHTML;
885                                       
886                                // OnkeyUp
887                                configEvents( _input, "onkeyup", function(e)
888                                                {
889                                                        if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element);
890                                                }
891                                );
892                               
893                                // Onblur       
894                            configEvents(_input, "onblur", function(){ loadscript.setMessageStatus(_input, _element)});         
895
896                           
897                                if( _parent != null )
898                                {       
899                                        // Remove label
900                                        if( _element != null )
901                                                _parent.removeChild( _element );
902                                               
903                                        // Add Input
904                                        if( _input != null )
905                                                _parent.appendChild( _input );
906                                }
907
908                                _input.focus();
909                                _input.select();
910                        }
911                        else
912                        {
913                                var _label              = arguments[1];
914                                _statusMessage  = _element.value.replace(/^\(+|\)+$/g,"");
915                               
916                                if( ( _statusMessage = _statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "")
917                                        _label.innerHTML = "( " + _statusMessage + " )";
918                                else
919                                        _label.innerHTML = "( " + i18n.TYPE_YOUR_MESSAGE_HERE_STATUS + " )";
920                               
921                                if( _parent != null )
922                                {       
923                                        // Remove Input
924                                        if( _element != null )
925                                                _parent.removeChild( _element );
926                                               
927                                        // Add Label
928                                        if( _label != null )
929                                                _parent.appendChild( _label );
930                                }
931                               
932                                // Send Status Message
933                                _statusMessage = ( ( _statusMessage !=  i18n.TYPE_YOUR_MESSAGE_HERE_STATUS ) ? _statusMessage : "" );                           
934                               
935                                TrophyIM.setPresence("status", _statusMessage );
936                        }       
937                }
938        }
939       
940        function setPreferences()
941        {
942                // Element openWindowJabberit
943                var elementOpenW        = document.getElementById('openWindowJabberit');
944                var value                       = '';
945               
946                for(var i = 0 ; i < elementOpenW.options.length; i++)
947                        if( elementOpenW.options[i].selected == true)
948                        {
949                                value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value;
950                                _preferencesIM[0] = 'openWindowJabberit:' + elementOpenW.options[i].value;
951                        }
952
953                // Element openWindowJabberitPopUp
954                value += '&preferences2=openWindowJabberitPopUp:false';
955                _preferencesIM[1] = 'openWindowJabberitPopUp:false';
956               
957                // Element flagAwayIM
958                var elementFlagIM = document.getElementById('flagAwayIM');
959               
960                if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 )
961                {
962                        _preferencesIM[2] = 'flagAwayIM:' + elementFlagIM.value;
963                        value += '&preferences3=flagAwayIM:' + elementFlagIM.value;
964                }
965                else
966                {
967                        alert('Informe um valor igual ou maior que 1!');
968                        return false;
969                }
970
971                // Element showContactsOfflineJabberit
972                var elementShowOffline  = document.getElementById('showContactsOfflineJabberit');
973               
974                for(var i = 0 ; i < elementShowOffline.options.length; i++)
975                        if( elementShowOffline.options[i].selected == true)
976                        {
977                                _preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value;
978                                value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value;
979                        }
980               
981                // Save Preferences
982                conn.go('p.pf.setPreferences',
983                                 function(data)
984                                 {
985                                        if( data == 'false' )
986                                        {
987                                                alert('Erro salvando suas preferências!');
988                                        }
989
990                                        _winBuild('jabberit_preferences', 'remove');
991                                 },
992                                 value);
993        }
994       
995        function setPresence()
996        {
997                if( arguments.length > 0 )
998                {
999                        var element = arguments[0];
1000                       
1001                        if( showhidden == null )
1002                                showhidden = new ShowHidden(300);
1003                       
1004                        var _status = [
1005                                               ['Afastado', 'away', '<img src="'+path_jabberit+'templates/default/images/away.gif" />'],
1006                                               ['Disponível', 'available', '<img src="'+path_jabberit+'templates/default/images/available.gif" />'],
1007                                               ['Livre p/ Conversa', 'chat', '<img src="'+path_jabberit+'templates/default/images/chat.gif" />'],
1008                                               ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'],
1009                                               ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'],
1010                                               ['Desconectado', 'unavailable', '<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'],
1011                                               ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'],                                               
1012                                          ];
1013                       
1014                        var _itens = "";
1015                       
1016                        for( var i in _status )
1017                        {
1018                                if( typeof( _status[i]) == "object" )
1019                                {
1020                                        _itens += '<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">';
1021                                        _itens += _status[i][2]+ "<span style='margin:3px;'>" + _status[i][0] + "</span></span><br/>";
1022                                }
1023                        }
1024                       
1025                        var _statusItens = document.createElement("div");
1026                                _statusItens.style.marginTop    = "65px";
1027                                _statusItens.style.marginLeft   = "67px";
1028                                _statusItens.className                  = "x-menu";
1029                                _statusItens.style.zIndex               = '99999';
1030                                _statusItens.innerHTML                  = _itens; 
1031                                _statusItens.onclick                    = function(){ showhidden.hiddenObject(false); };
1032                                                                                 
1033                                showhidden.action('onmouseover', 'onmouseout', _statusItens);
1034                               
1035                        element.parentNode.onmouseout   = function(){ showhidden.hiddenObject(false); };
1036                        element.parentNode.onmouseover  = function(){ showhidden.hiddenObject(true); };
1037                        element.parentNode.appendChild(_statusItens);
1038                }
1039        }
1040
1041        function setSelectEditable(element)
1042        {
1043                if( getElement('selectBox0') == null )
1044                        selectEditable.create(element);
1045        }
1046
1047        function setStatusJabber()
1048        {
1049                if( arguments.length > 0 )
1050                {
1051                        if( arguments[1] != 'status' )
1052                        {
1053                                var _text       = arguments[0];
1054                                var _img        = statusUserIM = arguments[1];
1055                               
1056                                getElement('statusJabberText').innerHTML                = _text;
1057                                getElement('statusJabberImg').style.background  = "url('"+path_jabberit+"templates/default/images/"+_img+".gif')";
1058                                getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat";
1059                        }
1060                }       
1061        }
1062
1063        function _setUserCurrent( _user )
1064        {
1065                userCurrent =
1066                {
1067                        'jid'           : _user.jid.substring(11, _user.jid.length),
1068                        'password'      : _user.password.substring(11, _user.password.length)
1069                }               
1070        }
1071       
1072        function setUserCurrent()
1073        {
1074                if( getUserCurrent() == null )
1075                {
1076                        conn.go('p.ff.data_0',
1077                                                function(_User)
1078                                                {
1079                                                        var _user = _User;
1080                                                       
1081                                                        conn.go('p.ff.data_1',
1082                                                                        function(_pass)
1083                                                                        {
1084                                                                                _setUserCurrent( { jid : _user, password : _pass } );
1085                                                                        });
1086                                                });
1087                }
1088        }
1089
1090        var _stylesheets = [ ];
1091        var _links = document.getElementsByTagName( 'link' );
1092       
1093        for ( var i = 0; i < _links.length; i++ )
1094                if ( _links.item( i ).type && _links.item( i ).type.toLowerCase( ) == 'text/css' )
1095                        _stylesheets[ _stylesheets.length ] = _links.item( i ); 
1096       
1097        function windowPOPUP()
1098        {
1099                var _id = arguments[0];
1100                var _win_name = _id.replace( /\W/g, '' );
1101
1102                if ( arguments.length == 1 )
1103                {
1104                        if ( windowPopUp[_win_name] )
1105                                return true;
1106                        else
1107                                return false;
1108                }
1109               
1110                if( arguments.length == 2 )
1111                {       
1112                        if( !windowPopUp[_win_name] )
1113                        {
1114                                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');
1115                                var tmp = windowPopUp[_win_name].document;
1116                               
1117                                tmp.write('<html><head>');
1118                                tmp.write('</head><body>');
1119                                tmp.write('</body></html>');
1120                                tmp.close();
1121                               
1122                                for ( var i = 0; i < _stylesheets.length; i++ )
1123                                        tmp.documentElement.getElementsByTagName( 'head' ).item(0).appendChild( _stylesheets[ i ].cloneNode( true ) );
1124
1125                                var divPOP = getElement( _id + "__popUp" );
1126                                        divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat";
1127                                        divPOP.innerHTML = "PopIn";
1128                                       
1129                                function _close( )
1130                                {
1131                                        windowPopUp[_win_name].close();
1132                                        configEvents( divPOP ,'onclick', _close, true );
1133                                }
1134                                       
1135                                configEvents( divPOP ,'onclick', _close );
1136
1137                                var _content = tmp.documentElement.getElementsByTagName( 'body' ).item(0).appendChild( getElement(_id + '__chatBox' ).parentNode );
1138
1139                                _content.firstChild.scrollTop = _content.firstChild.scrollHeight;
1140
1141                                configEvents( windowPopUp[_win_name] ,'onbeforeunload', function()
1142                                {
1143                                        delete windowPopUp[_win_name];
1144                                        divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat";
1145                                        divPOP.innerHTML = "PopUp";
1146                                        divPOP.onclick  = function(){ loadscript.windowPOPUP( _id , true ); };
1147                                        _winBuild( 'window_chat_area_' + _id, "display" ).content( true );
1148                                });
1149
1150                                _winBuild( 'window_chat_area_' + _id, 'hidden' );
1151                        }
1152                }
1153        }
1154       
1155        function windowNotificationNewUsers()
1156        {
1157                var _users = Xtools.xml('notification_new_users');
1158               
1159                for( var user in TrophyIM.rosterObj.roster )
1160                {
1161                        if ( TrophyIM.rosterObj.roster[ user ].constructor == Function )
1162                                continue;
1163
1164                        if( TrophyIM.rosterObj.roster[ user ].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) )
1165                        {
1166                                var _subscription = TrophyIM.rosterObj.roster[user].contact.subscription;
1167                               
1168                                if ( _subscription == 'to' || _subscription == 'not-in-roster' )
1169                                {
1170                                        var _user       = _users.createElement('user');
1171                                        var _jid        = _users.createElement('jid');
1172                                        var _index      = _users.createElement('index');
1173                                        _jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) );
1174                                        _index.appendChild( _users.createTextNode("0"));
1175                                        _user.appendChild( _jid );
1176                                        _user.appendChild( _index );
1177                                        _users.documentElement.appendChild( _user );
1178                                }
1179                        }
1180                }
1181               
1182                var paramsNotification =
1183                {
1184                        'lang_1' : "Notificação",       
1185                        'lang_2' : "O(s) usuário(s) abaixo pedem sua autorização.",
1186                        'lang_3' : "Autorizar",
1187                        'lang_4' : "Remover"
1188                };
1189               
1190                var winNotification =
1191                {       
1192                         id_window              : "window_notification_new_users",
1193                         width                  : 350,
1194                         height                 : 300,
1195                         top                    : 100,
1196                         left                   : 400,
1197                         draggable              : true,
1198                         visible                : "display",
1199                         resizable              : true,
1200                         zindex                 : zIndex++,
1201                         title                  : "Expresso Messenger - Notificação de Novos Usuários",
1202                         closeAction    : "remove",
1203                         content                : Xtools.parse( _users , "notificationNewUsers.xsl", paramsNotification )       
1204                };
1205
1206                _winBuild( winNotification );
1207        }
1208       
1209        function teste_new()
1210        {
1211                var _notification       = getElement('notification_new_users_jabber') ;
1212                var _statusJabber       = getElement('status_jabber_expresso');
1213       
1214                if( _notification && _statusJabber )
1215                {       
1216                        if ( _notification.style.display == 'none' )
1217                        {
1218                                _notification.style.display = 'block';
1219                               
1220                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat";
1221                               
1222                                if( _timeOutNotification )
1223                                        clearTimeout(_timeOutNotification );
1224
1225                                _timeOutNotification = setTimeout( function(){ teste_new(); }, 2000 );
1226                        }
1227                        else
1228                        {
1229                                _notification.style.display = 'none';
1230                               
1231                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat";
1232                               
1233                                if( _timeOutNotification )
1234                                        clearTimeout(_timeOutNotification );
1235
1236                                _timeOutNotification = setTimeout( function(){ teste_new(); }, 800 );
1237                        }
1238                }
1239        }
1240       
1241       
1242        loadIM.prototype.teste_new = teste_new;
1243       
1244       
1245        function loadIM()
1246        {
1247                if( arguments.length > 0 )
1248                {
1249                        var files = [
1250                                                path_jabberit + 'js/connector.js',
1251                                                path_jabberit + 'js/xtools.js',
1252                                                path_jabberit + 'js/lang/i18n_pt_Br.js',
1253                                                path_jabberit + 'js/dragdrop.js',
1254                                                path_jabberit + 'js/makeW.js',
1255                                                path_jabberit + 'js/show_hidden.js',
1256                                                path_jabberit + 'js/trophyim.js',
1257                                                path_jabberit + 'js/strophe.js',
1258                                                path_jabberit + 'js/json2.js',
1259                                                path_jabberit + 'js/AddUser.js',
1260                                                path_jabberit + 'js/SelectEditable.js',
1261                                                path_jabberit + 'templates/default/css/button.css',
1262                                                path_jabberit + 'templates/default/css/common.css',
1263                                                path_jabberit + 'templates/default/css/selectEditableStyle.css',
1264                                                path_jabberit + 'templates/default/css/' + theme_jabberit
1265                                    ];
1266                        // FullName
1267                        fullName = arguments[0];
1268                       
1269                        // Preferences
1270                        _preferencesIM = arguments[1].split(";");
1271                       
1272                        if( !_preferencesIM[3] ) _preferencesIM[3] = "showContactsOfflineJabberit:true";
1273                       
1274                        loadScripts(files);
1275                       
1276                        setTimeout(function()
1277                        {
1278                                // Object Xtools       
1279                                if( Xtools == null )
1280                                        Xtools = new xtools(path_jabberit);
1281                               
1282                                // Object Conector
1283                                if( conn == null )
1284                                        conn = new AjaxConnector(path_jabberit);
1285                               
1286                                // Object Add User
1287                                if( addUser == null )
1288                                        addUser = new addUserIM(Xtools, conn);
1289
1290                               
1291                                // Object SelectEditable
1292                                if( selectEditable == null )
1293                                        selectEditable = new SelectEditable();
1294                                       
1295                                // Add Jabber in StatusBar;
1296                                addIcon();
1297
1298                                // Auto Connect
1299                                setTimeout(function()
1300                                {
1301                                        if( _preferencesIM[0] === 'openWindowJabberit:true' )
1302                                        {
1303                                                TrophyIM.load();
1304                                        }
1305                                       
1306                                },1500);
1307                               
1308                                // Auto Status
1309                                autoStatus();
1310                                configEvents( document, 'onmousemove', autoStatus );
1311                                configEvents( document, 'onkeypress', autoStatus );
1312                               
1313                        }, 2000);
1314                }
1315        }
1316       
1317        loadIM.prototype.adIcon                         = addIcon;
1318        loadIM.prototype.actionButton           = actionButton;
1319        loadIM.prototype.addContact                     = addContact;
1320        loadIM.prototype.clrAllContacts         = clrAllContacts;
1321        loadIM.prototype.configEvents           = configEvents;
1322        loadIM.prototype.getIsIE                        = getIsIE;
1323        loadIM.prototype.getPhotoUser           = getPhotoUser;
1324        loadIM.prototype.getSmiles                      = getSmiles;
1325        loadIM.prototype.getStatusMessage       = getStatusMessage;
1326        loadIM.prototype.getShowContactsOffline = getShowContactsOffline;
1327        loadIM.prototype.getUserCurrent         = getUserCurrent;
1328        loadIM.prototype.getZIndex                      = getZindex;
1329        loadIM.prototype.groupsHidden           = groupsHidden;
1330        loadIM.prototype.groupsVisible          = groupsVisible;
1331        loadIM.prototype.keyPressSearch         = keyPressSearch;       
1332        loadIM.prototype.loginPage                      = loginPage;
1333        loadIM.prototype.notification           = notificationNewMessage;
1334        loadIM.prototype.parse                          = parse;
1335        loadIM.prototype.preferences            = preferences;
1336        loadIM.prototype.searchUser                     = searchUser
1337        loadIM.prototype.setAutorization        = setAutorization;
1338        loadIM.prototype.setMessageStatus       = setMessageStatus;
1339        loadIM.prototype.setPreferences         = setPreferences;
1340        loadIM.prototype.setPresence            = setPresence;
1341        loadIM.prototype.setStatusJabber        = setStatusJabber;
1342        loadIM.prototype.setSelectEditable      = setSelectEditable;
1343        loadIM.prototype.setUserCurrent         = setUserCurrent;
1344        loadIM.prototype.removeContact          = removeContact;
1345        loadIM.prototype.removeElement          = removeElement;
1346        loadIM.prototype.removeGroup            = removeGroup;
1347        loadIM.prototype.renameContact          = renameContact;
1348        loadIM.prototype.renameGroup            = renameGroup;
1349        loadIM.prototype.rosterDiv                      = rosterDiv;
1350        loadIM.prototype.windowNotificationNewUsers  = windowNotificationNewUsers;
1351        loadIM.prototype.windowPOPUP            = windowPOPUP;
1352       
1353       
1354        window.LoadIM = loadIM;
1355       
1356       
1357        // Necessário para não ocasionar problema no ExpressoMail
1358        // quando os itens abaixo não são criados pelo próprio ExpressoMail
1359        if( is_ie )
1360        {
1361                configEvents( window, 'onload', function( )
1362                {
1363                        if ( ! document.getElementById( 'cc_msg_err_serialize_data_unknown' ) )
1364                        {
1365                                var fix = document.createElement('input');
1366                                        fix.type        = 'hidden';
1367                                        fix.id          = 'cc_msg_err_serialize_data_unknown';
1368                               
1369                                        document.appendChild( fix );
1370                        }
1371                        if ( ! window.showMessage )
1372                                window.showMessage = function(){};
1373                });
1374        }
1375       
1376})();
Note: See TracBrowser for help on using the repository browser.