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

Revision 3005, 39.7 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #1116 - Melhorias para a implementacao  http://xmpp.org/rfcs/rfc3921, secao 8.3, happy path

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