source: trunk/jabberit_messenger/js/load.js @ 697

Revision 697, 22.4 KB checked in by niltonneto, 15 years ago (diff)

Fechamento das ocorrências referentes à versão 0.7.11

  • Property svn:executable set to *
Line 
1(function()
2{
3        var _autoStatusTime = 60000; // 1 minuto
4        var _autoStatus;
5        var _conn   = new JITConnector(path_jabberit);
6        var _xtools = new JITXTools(path_jabberit);
7        var _showhidden = new ShowHidden(1000);
8        var myWindow      = '';
9        var flagMouseOver = '';
10        var flagOpenIM    = '';
11        var flagOpenPopup = '';
12        var flagAwayIM    = '';
13   
14        // Sniffer Browser
15        var agt=navigator.userAgent.toLowerCase();
16    var is_major = parseInt(navigator.appVersion);
17    var is_minor = parseFloat(navigator.appVersion);   
18    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
19                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
20                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
21    var is_gecko = (agt.indexOf('gecko') != -1);
22    var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1);
23    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
24    var is_ie3    = (is_ie && (is_major < 4));
25    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
26    var is_ie4up  = (is_ie && (is_major >= 4));
27    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
28    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
29    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
30    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
31    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
32    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);   
33    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
34
35        if ( !(document.getElementById('jabberit_messenger_content')) )
36        {
37                var _jabberit_content = document.createElement('div');
38                _jabberit_content.setAttribute('id', 'jabberit_messenger_content');
39                _jabberit_content = document.body.appendChild(_jabberit_content);
40        }
41
42        var _window = new JITWindows(_xtools, _jabberit_content);
43        var _ldap       = new JITLdap( _conn, _xtools, _window);
44
45        function addContacts()
46        {
47                _ldap.add();
48        }
49
50        function addIcon()
51        {
52               
53                var StatusBar = document.getElementById('divStatusBar');
54
55                /**
56                 * @quando estiver habilitada a opção fora de escritório nos filtros.
57                 */
58               
59                if( div_write_msg = document.getElementById('em_div_write_msg') )
60                {               
61                        var StatusBarIM = document.getElementById('JabberMessenger');
62                        div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg);
63                        StatusBarIM.style.paddingLeft = '33px';
64                        return;                 
65                }
66               
67                if( StatusBar )
68                {
69                        StatusBar.style.paddingLeft = '33px';
70                       
71                        var _div = document.createElement('div');
72                        _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling));
73                        StatusBar.parentNode.insertBefore(_div,StatusBar);
74                       
75                        var divJabber = document.createElement('div');
76                                divJabber.setAttribute('id', 'JabberMessenger');
77                       
78                        var _status = top.document.createElement('div');
79                                _status.setAttribute('id', 'jabberit_login');
80                                _status.style.background = 'no-repeat';
81                                _status.style.backgroundImage = 'url(' + jabberit_group_open.src + ')';
82                                _status.style.float = 'left';
83                                _status.style.height = '15px';
84                                _status.style.left = '7px';
85                                _status.style.margin = '8 0 0 10px';
86                                _status.style.padding = '0px';
87                                _status.style.position = 'absolute';
88                                _status.style.width = '15px';
89                                _status.style.cursor = 'pointer';
90
91                        divJabber.insertBefore(_status,divJabber.firstChild);
92
93                        var _menu;
94                                _menu = top.document.createElement('div');
95                                _menu.setAttribute('id','fast_menu_jabberit');
96                                _menu.style.backgroundColor = 'cecece';
97                                _menu.style.border = '1px dashed #000';
98                                _menu.style.display = 'none';
99                                _menu.style.margin = '20px 5px 0px -15px';
100                                _menu.style.position = 'absolute';
101                                _menu.style.zIndex = '99999';
102                                _menu.onmouseout = function(){ _showhidden.hiddenObject(false); };
103                                _menu.onmouseover = function(){ _showhidden.hiddenObject(true); };
104                               
105                        divJabber.insertBefore(_menu, divJabber.firstChild);
106
107                        var _menu_div = top.document.createElement('div');
108                                _menu_div.setAttribute('id','status_Jabber_Expresso');
109                                _menu_div.style.background = 'no-repeat';
110                                _menu_div.style.backgroundImage = 'url(' + jabberit_add_user.src + ')';
111                                _menu_div.style.float = 'left';
112                                _menu_div.style.height = '18px';
113                                _menu_div.style.left = '19px';
114                                _menu_div.style.margin = '0 0 0 10px';
115                                _menu_div.style.padding = '0px';
116                                _menu_div.style.position = 'absolute';
117                                _menu_div.style.width = '18px';
118                                _menu_div.style.cursor = 'pointer';
119                                _menu_div.style.zindex = '99999999';
120                       
121                        statusJabberExpresso = _menu_div;
122                       
123                        divJabber.insertBefore(_menu_div, divJabber.firstChild);
124                        StatusBar.insertBefore(divJabber, StatusBar.firstChild);                       
125                       
126                        configEvents(_menu_div,'onclick',showWindow);
127
128                        configEvents(
129                                _status,
130                                'onclick',
131                                function()
132                                {
133                                        var _options = [
134                                                ['Add Contacts',addContacts],
135                                                ['Help',helpJabberit],
136                                                ['Preferences', preferences],
137                                                ['Change Status', subMenuChangeStatus]
138                                        ];
139
140                                        var _style_text = 'cursor: pointer; padding:2px 2px 2px 15px; border-bottom:1px solid #dedede; background: no-repeat url(' + jabberit_group_close.src + ');';                                   
141
142                                        var _xml = _xtools.xml('menu');
143                                        var _option;
144                                        var _item;
145                                        var _action;
146                                        var _style;
147
148                                        for ( var i in _options )
149                                        {
150                                                _option = _xml.createElement('option');
151
152                                                _item = _xml.createElement('item');
153                                                _item.appendChild(_xml.createTextNode(jabberitGetLang(_options[i][0])));
154                                               
155                                                _style = _xml.createElement('style');
156                                                _style.appendChild(_xml.createTextNode(_style_text));
157
158                                                _option.appendChild(_item);
159                                                _option.appendChild(_style);
160
161                                                _xml.documentElement.appendChild(_option);
162                                        }
163
164                                        _menu.innerHTML = _xtools.parse(_xml, 'options.xsl');
165                                        _showhidden.action('onmouseover', 'onmouseout', _menu);
166
167                                        _item = _menu.firstChild;
168
169                                        for ( var i in _options )
170                                        {
171                                                _item.childNodes[i].setAttribute('presence', _options[i]);
172                                                configEvents(
173                                                        _item.childNodes[i],
174                                                        'onclick',
175                                                        _options[i][1]
176                                                );
177                                        }
178                                });
179                }
180        }
181
182        function autoStatus()
183        {
184               
185                if ( _autoStatus )
186                        clearTimeout(_autoStatus);
187
188                var _div_status = document.getElementById('status_Jabber_Expresso');
189                if ( _div_status )
190                {
191                        var _status = _div_status.style.backgroundImage;
192                        _status = _status.substr(_status.lastIndexOf('/') + 1);
193                        _status = _status.substr(0, _status.indexOf('.'));
194                        if ( _status == 'xa' && _div_status.getAttribute('autoStatus') )
195                        {
196                                _div_status.removeAttribute('autoStatus');
197                                changeStatusJava("2");
198                        }
199                }
200
201                var TimeStatus = flagAwayIM.split(':');
202
203                if( TimeStatus[1] )
204                        _autoStatus = setTimeout(autoStatusHandler, parseInt(TimeStatus[1])*_autoStatusTime);
205                else
206                        _autoStatus = setTimeout(autoStatusHandler, parseInt(_autoStatusTime));
207        }
208
209        function autoStatusHandler()
210        {
211                var _div_status = document.getElementById('status_Jabber_Expresso');
212                if ( _div_status )
213                {
214                        var _status = _div_status.style.backgroundImage;
215                        _status = _status.substr(_status.lastIndexOf('/') + 1);
216                        _status = _status.substr(0, _status.indexOf('.'));
217                        if ( _status == 'available' )
218                        {
219                                _div_status.setAttribute('autoStatus','true');
220                                changeStatusJava("5");
221                        }
222                }
223        }
224
225        function changeLabel()
226        {
227                if( arguments.length > 0 )
228                {
229                        var element = arguments[0].parentNode.parentNode.firstChild;
230
231                        if(arguments[0].checked)
232                                element.innerHTML = "<span style='color:red;'>Digite o Email .: </span>";
233                        else
234                                element.innerHTML = "Nome do Contato .: ";
235                }
236        }
237
238        function changeStatusJava()
239        {
240                if(arguments.length > 0 )
241                {
242                        try
243                        {
244                                // If Layer;
245                                if( elementIframe = document.getElementById('iframe_applet_jabberit') )
246                                {
247                                        if( !is_ie )
248                                                elementIframe.contentDocument.applets[0].changeStatusfromExpresso(arguments[0]);
249                                        else
250                                                elementIframe.contentWindow.document.applets[0].changeStatusfromExpresso(arguments[0]);
251                                }
252                                else // If Pop-Up
253                                {
254                                        myWindow.document.applets[0].changeStatusfromExpresso(arguments[0]);
255                                }
256                        }
257                        catch(e)
258                        {
259                                if( confirm('Deseja conectar o IM ?') )
260                                        showWindow();
261                        }
262                }               
263        }
264
265        function configEvents(pObj, pEvent, pHandler)
266        {
267                if ( typeof pObj == 'object' )
268                {
269                        if ( pEvent.substring(0, 2) == 'on' )
270                                pEvent = pEvent.substring(2, pEvent.length);
271
272                        if ( pObj.addEventListener )
273                                pObj.addEventListener(pEvent, pHandler, false);
274                        else if ( pObj.attachEvent )
275                                pObj.attachEvent('on' + pEvent, pHandler);
276                }
277        }
278
279        function closeWindow()
280        {
281                myWindow = '';
282        }
283
284        function getElementStatus()
285        {
286                return document.getElementById('status_Jabber_Expresso');
287        }
288
289        function getPreferences()
290        {
291                if( flagOpenIM == '' )
292                {
293                        _conn.go("$this.db_im.getPreferences",
294                                                function(data)
295                                                {
296                                                        var autoConnect = '';
297                                                        flagOpenIM = data;
298
299                                                        if( data.indexOf(';') != -1)
300                                                        {
301                                                                var temp = data.split(';');
302                                                                autoConnect = flagOpenIM = temp[0];
303                                                               
304                                                                // Open as Pop-Up
305                                                                flagOpenPopup = 'openWindowJabberitPopUp:false';
306                                                               
307                                                                if( temp[1] )
308                                                                {
309                                                                        if( temp[1] == 'openWindowJabberitPopUp:true' || temp[1] == 'openWindowJabberitPopUp:false')
310                                                                                flagOpenPopup = temp[1];
311                                                                }
312                                                               
313                                                                // Away
314                                                                flagAwayIM = 'flagAwayIM:5';
315                                                               
316                                                                if( temp[2] )
317                                                                {
318                                                                        flagAwayIM = temp[2];
319                                                                }
320                                                        }
321                                                        else
322                                                        {
323                                                                autoConnect = flagOpenIM;
324                                                        }
325                                                       
326                                                        if( autoConnect == 'openWindowJabberit:true' )
327                                                        {
328                                                                setTimeout('loadscript.showW();', 2500);
329                                                        }
330                                                });
331                }
332
333        }
334
335        function helpJabberit()
336        {
337                var myWindowHelp = window.open( path_jabberit + 'help.php', 'HelpjabberIM', 'width=800,height=495,top=50,left=50,scrollbars=yes');
338        }
339
340        function keyPressSearch()
341        {
342                var ev = arguments[0];
343                var element = arguments[1];
344
345                if ( ev.keyCode == 13 )
346                        if( element.value.length >= 4 )
347                                _ldap.search( element.value ); 
348                        else
349                                alert(jabberitGetLang('Your search argument must be longer than 4 characters.'));
350        }
351
352        function openPopup()
353        {
354                var widPopup = '220';
355
356                if( is_ie )
357                        widPopup = '250';
358
359                try{
360
361                        if(!myWindow )
362                        {       
363                                myWindow = window.open('','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
364                                myWindow.close();
365                                myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
366                                myWindow.blur();
367                                configEvents(myWindow,'onbeforeunload', closeWindow );
368                        }
369                        else
370                        {
371                                for( var i = 15 ; i > 0 ; i-- )
372                                {
373                                        myWindow.moveBy(i,0); myWindow.moveBy(-i,0);
374                                }
375                                myWindow.focus();
376                        }
377                }
378                catch(e)
379                {
380                        delete myWindow;
381                        myWindow = window.open(path_jabberit + 'client.php','JabberIM','width='+widPopup+',height=400,top=50,left=50,toolbar=0,menubar=0,resizable=0,scrollbars=0,status=0,location=0,titlebar=0');
382                        myWindow.blur();
383                        configEvents(myWindow,'onbeforeunload', closeWindow );
384                }
385        }
386
387        function openWindow()
388        {
389                var _win_contacts = _window.load('jabberit_contacts');
390
391                var flagOpenAux = '';
392               
393                if( flagOpenIM.indexOf(';') != -1 )
394                {
395                        var aux = flagOpenIM.split(';');
396                        flagOpenAux = aux[0];
397                }
398                else
399                        flagOpenAux = flagOpenIM;
400
401                if( flagOpenAux == 'openWindowJabberit:false' )
402                {
403                        if( !is_ie )
404                                _win_contacts.size(220,400);
405                        else   
406                                _win_contacts.size(250,400);
407                }                                       
408                else
409                {
410                        if( !is_ie )
411                        {
412                                _win_contacts.size(1,1);
413                                _win_contacts.wm.style.visibility = 'hidden';
414                        }
415                        else
416                        {
417                                _win_contacts.size(0,0);
418                        }
419                }
420
421                _win_contacts.bc.style.display = "none";
422                _win_contacts.bx.style.display = "none";
423
424                if( _win_contacts.bz.removeEventListener )
425                        _win_contacts.bz.removeEventListener('click',_win_contacts.button, false);
426                else
427                        _win_contacts.bz.detachEvent('onclick',_win_contacts.button);
428
429                configEvents(
430                        _win_contacts.bz,
431                        "onclick",
432                        function()
433                        {
434                                _win_contacts.size(1,1);
435                                _win_contacts.wm.style.visibility = 'hidden';
436                                _win_contacts.position(50,50);
437                                _win_contacts.title('');
438                        }
439                );
440
441                var _params = {'path' : path_jabberit};
442                _win_contacts.content(_xtools.parse(_xtools.xml('contacts_jabberit'), 'contacts_jabberit.xsl', _params));
443
444                if( flagOpenAux == 'openWindowJabberit:false' )
445                {
446                        if( !is_ie )
447                        {
448                                _win_contacts.wm.style.visibility = "visible";
449                                _win_contacts.size(220,400);
450                                _win_contacts.title('.:: Expresso - JMessenger ::.');
451                        }
452                        else
453                        {
454                                _win_contacts.size(250,400);
455                                _win_contacts.title('.:: Expresso - JMessenger ::.');
456                        }
457                        _win_contacts.position(50,50);
458                }
459                else
460                {
461                        if( !is_ie )
462                                _win_contacts.wm.style.visibility = "hidden";
463                }
464        }
465
466        function openWindowParticipantsExternal()
467        {
468                if( arguments.length > 0)
469                {
470                        var element = arguments[0];
471                        var orgPartExternal = externalParticipantsJabberit.split(",");
472                       
473                        var _splash = top.document.createElement('span');
474                                _splash.setAttribute('id','fast_splash_jabberit');
475                                _splash.style.backgroundColor = 'dedede';
476                                _splash.style.position = 'absolute';
477                                _splash.style.display = 'block';
478                                _splash.style.width = '200px';
479                                _splash.style.height = 'auto';
480                                _splash.style.margin = ( !is_ie ) ? '0px 5px 0px 130px' : '20px 0px 0px 0px';
481                                _splash.style.zIndex = '99999';
482                                _splash.style.border = '2px outset #000';
483                                _splash.onmouseout = function(){ _showhidden.hiddenObject(false); };
484                                _splash.onmouseover = function(){ _showhidden.hiddenObject(true); };
485                       
486                                for(var i = 0; i < orgPartExternal.length; i++)
487                                        _splash.innerHTML += '<div style="margin:5px;border-bottom:1px dashed #000;cursor:default !important;">' + (i + 1) + " - " + orgPartExternal[i] + '</div>';     
488                               
489                        _showhidden.action('onmouseover', 'onmouseout', _splash);
490                        element.appendChild(_splash);
491                }
492        }
493
494        function preferences()
495        {
496                if( !(_window.get('jabberit_preferences')) )
497                {
498                        var _win_preferences = _window.load('jabberit_preferences');
499                                _win_preferences.size(400,310);                         
500                                _win_preferences.position(150,100);
501                                _win_preferences.title('.:: Expresso - JMessenger '+jabberitGetLang('Preferences')+'::.');
502                                _win_preferences.bc.style.display = "none";
503                                _win_preferences.bx.style.display = "none";
504                                _win_preferences.wc.style.padding = "5px";                                                             
505
506                        if( _win_preferences.bz.removeEventListener )
507                                _win_preferences.bz.removeEventListener('click',_win_preferences.button, false);
508                        else
509                                _win_preferences.bz.detachEvent('onclick',_win_preferences.button);
510                               
511                        configEvents(
512                                _win_preferences.bz,
513                                "onclick",
514                                function()
515                                {
516                                        _win_preferences.size(1,1);
517                                        _win_preferences.wm.style.visibility = 'hidden';
518                                        _win_preferences.position(50,50);
519                                        _win_preferences.title('');
520                                });
521
522                        var _params = {'path'  : path_jabberit,
523                                                   'lang1' : jabberitGetLang('Your Preferences'),
524                                                   'lang2' : jabberitGetLang('Connection'),     
525                                                   'lang3' : jabberitGetLang('Enable Auto Login IM'),
526                                                   'lang4' : jabberitGetLang('Users OffLine'),
527                                                   'lang5' : jabberitGetLang('Show friends Offline'),
528                                                   'lang6' : jabberitGetLang('Save'),
529                                                   'lang7' : jabberitGetLang('Cancel'),
530                                                   'lang8' : jabberitGetLang('Window'),
531                                                   'lang9' : jabberitGetLang('Open as Pop-Up Window'),
532                                                   'lang10' : jabberitGetLang('Away'),
533                                                   'lang11' : jabberitGetLang('Set status to away after'),
534                                                   'lang12' : jabberitGetLang('minutes'),                                                 
535                                                   'langYes': jabberitGetLang('Yes'),
536                                                   'langNo' : jabberitGetLang('No')                                                                                       
537                                                  };
538                        _win_preferences.content(_xtools.parse(_xtools.xml('preferences_jabberit'), 'preferences_jabberit.xsl', _params));
539                        _win_preferences.wc.lastChild.lastChild.onclick = _win_preferences.close;
540                }
541                else
542                {
543                        var _win_preferences = _window.get('jabberit_preferences');
544                        _win_preferences.wm.style.visibility = "visible";
545                        _win_preferences.position(150,100);                                                     
546                        _win_preferences.title('.:: Expresso - JMessenger '+jabberitGetLang('Preferences')+'::.');
547                        _win_preferences.size(320,250);
548                }
549               
550                // Element openWindowJabberit
551                var value1 = flagOpenIM.split(':');
552                var element1 = document.getElementById(value1[0]);
553                var valueSelect1 = value1[1];
554               
555                for(var i = 0; i < element1.options.length; i++)
556                        if( element1.options[i].value == valueSelect1 )
557                                element1.options[i].selected = true;
558
559               
560                // Element openWindowJabberitPopUp
561                var value2 = flagOpenPopup.split(':');
562                var element2 = document.getElementById(value2[0]);
563                var valueSelect2 = value2[1];
564                       
565                for(var i = 0; i < element2.options.length; i++)
566                        if( element2.options[i].value == valueSelect2 )
567                                element2.options[i].selected = true;
568                               
569                // Element flagAwayIM
570                var value3 = flagAwayIM.split(':');
571                var element3 = document.getElementById(value3[0]);
572                element3.value = value3[1];
573               
574        }
575
576        function searchUser()
577        {
578                var element = arguments[0].previousSibling;
579               
580                if( element.value.length >= 4 )
581                        _ldap.search( element.value ); 
582                else
583                        alert(jabberitGetLang('Your search argument must be longer than 4 characters.'));
584        }
585       
586        function setPreferences()
587        {
588                // Element openWindowJabberit
589                var elementOpenW = document.getElementById('openWindowJabberit');
590                var value = '';
591                var flagReload = false;
592               
593                for(var i = 0 ; i < elementOpenW.options.length; i++)
594                        if( elementOpenW.options[i].selected == true)
595                        {
596                                value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value;
597                                flagOpenIM = 'openWindowJabberit:' + elementOpenW.options[i].value;
598                        }
599
600                // Element openWindowJabberitPopUp
601                var elementOpenPop = document.getElementById('openWindowJabberitPopUp');       
602
603                for(var i = 0; i < elementOpenPop.options.length; i++ )
604                        if( elementOpenPop.options[i].selected ==  true )
605                        {
606                                value += '&preferences2=openWindowJabberitPopUp:' + elementOpenPop.options[i].value;
607                               
608                                if( flagOpenPopup != 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value)
609                                        flagReload = true;
610                                       
611                                flagOpenPopup = 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value;
612                        }
613               
614                // Element flagAwayIM
615                var elementFlagIM = document.getElementById('flagAwayIM');
616               
617                if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 )
618                {
619                        flagAwayIM = 'flagAwayIM:' + elementFlagIM.value;
620                        value += '&preferences3=flagAwayIM:' + elementFlagIM.value;
621                }
622                else
623                {
624                        alert(jabberitGetLang('Enter a value greater than or equal to 1!'));
625                        return false;
626                }
627
628                _conn.go('$this.db_im.setPreferences',
629                                 function(data)
630                                 {
631                                        if(data == 'true')
632                                        {
633                                                if( flagReload )
634                                                {
635                                                        window.location.reload();
636                                                        myWindow.close();                                                       
637                                                }
638                                        }
639                                        else{ alert(jabberitGetLang('Error saving your preferences!')); }
640                                                                               
641                                        var _win_preferences = _window.get('jabberit_preferences');
642                                                _win_preferences.close();
643                                 },
644                                 value);
645        }
646       
647        function showDiv()
648        {
649                var _element = ( myWindow ) ? myWindow.document.body.firstChild : null ;
650                if( _element != null )
651                        _element.style.visibility = 'visible';
652        }
653
654        function showWindow()
655        {
656                var _win_contacts = _window.get('jabberit_contacts');
657               
658                if( flagOpenPopup === 'openWindowJabberitPopUp:true' )
659                {
660                        openPopup();                                   
661                }
662                else
663                {
664                        if ( _win_contacts )
665                        {       
666                                _win_contacts.wm.style.visibility = "visible";
667                                _win_contacts.title('.:: Expresso - JMessenger ::.');
668       
669                                if( !is_ie )
670                                        _win_contacts.size(220,400);
671                                else
672                                        _win_contacts.size(250,400);
673       
674                                _win_contacts.position(60,60);
675                        }
676                        else
677                                openWindow();
678                }
679        }
680
681        function subMenuChangeStatus()
682        {
683                if(document.getElementById('subMenu_Change_Status_JabberIt') == null )
684                {
685                        var _itens  = [
686                                                                ['Online', 'loadscript.chstatusJava("2")', 'available_jabberit.src'],
687                                                                ['Free For Chat', 'loadscript.chstatusJava("1")', 'chat_jabberit.src'],
688                                                                ['Xa', 'loadscript.chstatusJava("3")','xa_jabberit.src'],
689                                                                ['Dnd', 'loadscript.chstatusJava("4")','dnd_jabberit.src'],
690                                                                ['Away', 'loadscript.chstatusJava("5")','away_jabberit.src'],
691                                                                ['Invisible', 'loadscript.chstatusJava("6")','invisible_jabberit.src']
692                                                  ];
693       
694                        var _itensMenu = "<dl style='padding:1px !important; margin:2px 2px !important;font-size:8pt !important;background: #cecece;color: #000;'>";
695                       
696                        for(var i in _itens)
697                        {
698                                if( i == 5 )
699                                        _itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;' onclick=" + _itens[i][1] + ">";
700                                else
701                                        _itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;border-bottom:1px solid #dedede;' onclick=" + _itens[i][1] + ">";
702                                _itensMenu += "<img src='" + eval(_itens[i][2]) + "' style='margin-right:3px;'/>" + jabberitGetLang(_itens[i][0]) + "</dt>";
703                        }
704
705                        _itensMenu += "</dl>";
706       
707                        var _subMenu_div = document.createElement("div");
708                                _subMenu_div.setAttribute('id','subMenu_Change_Status_JabberIt');
709                                _subMenu_div.style.margin = '-10px 5px 0px 0px';
710                                _subMenu_div.style.background = '#cecece';
711                                _subMenu_div.style.border = '1px dashed #000';
712                                _subMenu_div.style.float = 'left';
713                                _subMenu_div.style.position = 'absolute';
714                                _subMenu_div.style.left = '55px';
715                                _subMenu_div.style.width = '120px';
716                                _subMenu_div.style.zindex = '99999';
717                                _subMenu_div.innerHTML = _itensMenu;
718       
719                        var elementParent = document.getElementById('fast_menu_jabberit');
720                        elementParent.appendChild(_subMenu_div);
721                }
722        }
723
724        function Load()
725        {
726                addIcon();
727                getPreferences();
728               
729                // AutoStatus Away             
730                autoStatus();
731                configEvents(document, 'onmousemove', autoStatus);
732                configEvents(document, 'onkeypress', autoStatus);
733        }
734
735        Load.prototype.adIcon           = addIcon;
736        Load.prototype.autoStatusIM     = autoStatus;
737        Load.prototype.chstatusJava     = changeStatusJava;
738        Load.prototype.closeW           = closeWindow;
739        Load.prototype.cLabel           = changeLabel;
740        Load.prototype.getElement       = getElementStatus;
741        Load.prototype.keyPress         = keyPressSearch;
742        Load.prototype.openWinParExt = openWindowParticipantsExternal;
743        Load.prototype.search           = searchUser;
744        Load.prototype.setPrefe         = setPreferences;
745        Load.prototype.show                     = showDiv;
746        Load.prototype.showW            = showWindow;
747       
748        window.loadscript = new Load;
749
750})();
751
752// Functions OnMouseOver e OnMouseOut
753
754function elementOnMouseOut()
755{
756        if( arguments.length > 0 )
757        {
758                var _element = arguments[0];
759                        _element.style.backgroundColor = '';
760                        _element.style.border = '';
761                        if( !arguments[1] )
762                                _element.style.borderBottom = '1px solid #dedede';
763        }
764}
765
766function elementOnMouseOver()
767{
768        if( arguments.length > 0 )
769        {
770                var _element = arguments[0];
771                        _element.style.backgroundColor = 'white';
772                        _element.style.border = '1px solid black';
773        }
774}
775
Note: See TracBrowser for help on using the repository browser.