(function() { var _autoStatusTime = 60000; // 1 minuto var _autoStatus; var _conn = new JITConnector(path_jabberit); var _xtools = new JITXTools(path_jabberit); var _showhidden = new ShowHidden(300); var myWindow = ''; var flagMouseOver = ''; var flagOpenIM = ''; var flagOpenPopup = ''; var flagAwayIM = ''; var itensSubMenu = []; // Sniffer Browser var agt=navigator.userAgent.toLowerCase(); var is_major = parseInt(navigator.appVersion); var is_minor = parseFloat(navigator.appVersion); var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); var is_gecko = (agt.indexOf('gecko') != -1); var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1); var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var is_ie3 = (is_ie && (is_major < 4)); var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) ); var is_ie4up = (is_ie && (is_major >= 4)); var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1)); var is_ie5up = (is_ie && !is_ie3 && !is_ie4); var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5); var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) ); var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5); var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); if ( !(document.getElementById('jabberit_messenger_content')) ) { var _jabberit_content = document.createElement('div'); _jabberit_content.setAttribute('id', 'jabberit_messenger_content'); _jabberit_content = document.body.appendChild(_jabberit_content); } var _window = new JITWindows(_xtools, _jabberit_content); var _ldap = new JITLdap( _conn, _xtools, _window ); function addContacts() { _ldap.add(myWindow); } function addIcon() { var StatusBar = document.getElementById('divStatusBar'); /** * @quando estiver habilitada a opção fora de escritório nos filtros. */ if( div_write_msg = document.getElementById('em_div_write_msg') ) { var StatusBarIM = document.getElementById('JabberMessenger'); div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg); StatusBarIM.style.paddingLeft = '33px'; return; } if( StatusBar ) { StatusBar.style.paddingLeft = '33px'; var _div = document.createElement('div'); _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling)); StatusBar.parentNode.insertBefore(_div,StatusBar); var divJabber = document.createElement('div'); divJabber.setAttribute('id', 'JabberMessenger'); var _status = top.document.createElement('div'); _status.setAttribute('id', 'jabberit_login'); _status.style.background = 'no-repeat'; _status.style.backgroundImage = 'url(' + jabberit_group_open.src + ')'; _status.style.float = 'left'; _status.style.height = '15px'; _status.style.left = '7px'; _status.style.margin = '8 0 0 10px'; _status.style.padding = '0px'; _status.style.position = 'absolute'; _status.style.width = '15px'; _status.style.cursor = 'pointer'; divJabber.insertBefore(_status,divJabber.firstChild); var _menu; _menu = top.document.createElement('div'); _menu.setAttribute('id','fast_menu_jabberit'); _menu.style.backgroundColor = 'cecece'; _menu.style.border = '1px dashed #000'; _menu.style.display = 'none'; _menu.style.margin = '20px 5px 0px -15px'; _menu.style.position = 'absolute'; _menu.style.zIndex = '99999'; _menu.onmouseout = function(){ _showhidden.hiddenObject(false); }; _menu.onmouseover = function(){ _showhidden.hiddenObject(true); }; divJabber.insertBefore(_menu, divJabber.firstChild); var _menu_div = top.document.createElement('div'); _menu_div.setAttribute('id','status_Jabber_Expresso'); _menu_div.style.background = 'no-repeat'; _menu_div.style.backgroundImage = 'url(' + jabberit_add_user.src + ')'; _menu_div.style.float = 'left'; _menu_div.style.height = '18px'; _menu_div.style.left = '19px'; _menu_div.style.margin = '0 0 0 10px'; _menu_div.style.padding = '0px'; _menu_div.style.position = 'absolute'; _menu_div.style.width = '18px'; _menu_div.style.cursor = 'pointer'; _menu_div.style.zindex = '99999999'; statusJabberExpresso = _menu_div; divJabber.insertBefore(_menu_div, divJabber.firstChild); StatusBar.insertBefore(divJabber, StatusBar.firstChild); configEvents(_menu_div,'onclick',showWindow); configEvents( _status, 'onclick', function() { var _options = [ ['Add Contacts',addContacts], ['Help',helpJabberit], ['Preferences', preferences], ['Change Status', subMenuChangeStatus] ]; var _style_text = 'cursor: pointer; padding:2px 2px 2px 15px; border-bottom:1px solid #dedede; background: no-repeat url(' + jabberit_group_close.src + ');'; var _xml = _xtools.xml('menu'); var _option; var _item; var _action; var _style; for ( var i in _options ) { _option = _xml.createElement('option'); _item = _xml.createElement('item'); _item.appendChild(_xml.createTextNode(jabberitGetLang(_options[i][0]))); _style = _xml.createElement('style'); _style.appendChild(_xml.createTextNode(_style_text)); _option.appendChild(_item); _option.appendChild(_style); _xml.documentElement.appendChild(_option); } _menu.innerHTML = _xtools.parse(_xml, 'options.xsl'); _showhidden.action('onmouseover', 'onmouseout', _menu); _item = _menu.firstChild; for ( var i in _options ) { _item.childNodes[i].setAttribute('presence', _options[i]); configEvents( _item.childNodes[i], 'onclick', _options[i][1] ); } }); } } function autoStatus() { if ( _autoStatus ) clearTimeout(_autoStatus); var _div_status = document.getElementById('status_Jabber_Expresso'); if ( _div_status ) { var _status = _div_status.style.backgroundImage; _status = _status.substr(_status.lastIndexOf('/') + 1); _status = _status.substr(0, _status.indexOf('.')); if ( _status == 'xa' && _div_status.getAttribute('autoStatus') ) { _div_status.removeAttribute('autoStatus'); changeStatusJava("2"); } } var TimeStatus = flagAwayIM.split(':'); if( TimeStatus[1] ) _autoStatus = setTimeout(autoStatusHandler, parseInt(TimeStatus[1])*_autoStatusTime); else _autoStatus = setTimeout(autoStatusHandler, parseInt(_autoStatusTime)); } function autoStatusHandler() { var _div_status = document.getElementById('status_Jabber_Expresso'); if ( _div_status ) { var _status = _div_status.style.backgroundImage; _status = _status.substr(_status.lastIndexOf('/') + 1); _status = _status.substr(0, _status.indexOf('.')); if ( _status == 'available' ) { _div_status.setAttribute('autoStatus','true'); changeStatusJava("5"); } } } function changeLabel() { if( arguments.length > 0 ) { var element = arguments[0].parentNode.parentNode.firstChild; if(arguments[0].checked) element.innerHTML = "Digite o Email .: "; else element.innerHTML = "Nome do Contato .: "; } } function changeStatusJava() { if(arguments.length > 0 ) { try { var status = arguments[0]; var msg = ( arguments[1] ) ? arguments[1] : ""; // If Layer; if( elementIframe = document.getElementById('iframe_applet_jabberit') ) { if( !is_ie ) elementIframe.contentDocument.applets[0].changeStatusfromExpresso(status, msg); else elementIframe.contentWindow.document.applets[0].changeStatusfromExpresso(status, msg); } else // If Pop-Up { myWindow.document.applets[0].changeStatusfromExpresso(status, msg); } } catch(e) { if( confirm('Deseja conectar o IM ?') ) showWindow(); } } } function configEvents(pObj, pEvent, pHandler) { if ( typeof pObj == 'object' ) { if ( pEvent.substring(0, 2) == 'on' ) pEvent = pEvent.substring(2, pEvent.length); if ( pObj.addEventListener ) pObj.addEventListener(pEvent, pHandler, false); else if ( pObj.attachEvent ) pObj.attachEvent('on' + pEvent, pHandler); } } function closeWindow() { myWindow = ''; } function getElementStatus() { return document.getElementById('status_Jabber_Expresso'); } function getPreferences() { if( flagOpenIM == '' ) { _conn.go("$this.db_im.getPreferences", function(data) { var autoConnect = ''; flagOpenIM = data; if( data.indexOf(';') != -1) { var temp = data.split(';'); autoConnect = flagOpenIM = temp[0]; // Open as Pop-Up flagOpenPopup = 'openWindowJabberitPopUp:false'; if( temp[1] ) { if( temp[1] == 'openWindowJabberitPopUp:true' || temp[1] == 'openWindowJabberitPopUp:false') flagOpenPopup = temp[1]; } // Away flagAwayIM = 'flagAwayIM:5'; if( temp[2] ) { flagAwayIM = temp[2]; } } else { autoConnect = flagOpenIM; } if( autoConnect == 'openWindowJabberit:true' ) { setTimeout('loadscript.showW();', 2500); } }); } } function helpJabberit() { var myWindowHelp = window.open( path_jabberit + 'help.php', 'HelpjabberIM', 'width=800,height=495,top=50,left=50,scrollbars=yes'); } function keyPressSearch() { var ev = arguments[0]; var element = arguments[1]; if ( ev.keyCode == 13 ) if( element.value.length >= 4 ) _ldap.search( element.value ); else alert(jabberitGetLang('Your search argument must be longer than 4 characters.')); } function openPopup() { var widPopup = '220'; if( is_ie ) widPopup = '250'; try{ if(!myWindow ) { 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'); myWindow.close(); 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'); myWindow.blur(); configEvents(myWindow,'onbeforeunload', closeWindow ); } else { for( var i = 15 ; i > 0 ; i-- ) { myWindow.moveBy(i,0); myWindow.moveBy(-i,0); } myWindow.focus(); } } catch(e) { delete myWindow; 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'); myWindow.blur(); configEvents(myWindow,'onbeforeunload', closeWindow ); } } function openWindow() { var _win_contacts = _window.load('jabberit_contacts'); var flagOpenAux = ''; if( flagOpenIM.indexOf(';') != -1 ) { var aux = flagOpenIM.split(';'); flagOpenAux = aux[0]; } else flagOpenAux = flagOpenIM; if( flagOpenAux == 'openWindowJabberit:false' ) { if( !is_ie ) _win_contacts.size(220,400); else _win_contacts.size(250,400); } else { if( !is_ie ) { _win_contacts.size(1,1); _win_contacts.wm.style.visibility = 'hidden'; } else { _win_contacts.size(0,0); } } _win_contacts.bc.style.display = "none"; _win_contacts.bx.style.display = "none"; if( _win_contacts.bz.removeEventListener ) _win_contacts.bz.removeEventListener('click',_win_contacts.button, false); else _win_contacts.bz.detachEvent('onclick',_win_contacts.button); configEvents( _win_contacts.bz, "onclick", function() { _win_contacts.size(1,1); _win_contacts.wm.style.visibility = 'hidden'; _win_contacts.position(50,50); _win_contacts.title(''); } ); var _params = {'path' : path_jabberit}; _win_contacts.content(_xtools.parse(_xtools.xml('contacts_jabberit'), 'contacts_jabberit.xsl', _params)); if( flagOpenAux == 'openWindowJabberit:false' ) { if( !is_ie ) { _win_contacts.wm.style.visibility = "visible"; _win_contacts.size(220,400); _win_contacts.title('.:: Expresso - JMessenger ::.'); } else { _win_contacts.size(250,400); _win_contacts.title('.:: Expresso - JMessenger ::.'); } _win_contacts.position(50,50); } else { if( !is_ie ) _win_contacts.wm.style.visibility = "hidden"; } } function openWindowParticipantsExternal() { if( arguments.length > 0) { var element = arguments[0]; var orgPartExternal = externalParticipantsJabberit.split(","); var _splash = top.document.createElement('span'); _splash.setAttribute('id','fast_splash_jabberit'); _splash.style.backgroundColor = 'dedede'; _splash.style.position = 'absolute'; _splash.style.display = 'block'; _splash.style.width = '200px'; _splash.style.height = 'auto'; _splash.style.margin = ( !is_ie ) ? '0px 5px 0px 130px' : '20px 0px 0px 0px'; _splash.style.zIndex = '99999'; _splash.style.border = '2px outset #000'; _splash.onmouseout = function(){ _showhidden.hiddenObject(false); }; _splash.onmouseover = function(){ _showhidden.hiddenObject(true); }; for(var i = 0; i < orgPartExternal.length; i++) _splash.innerHTML += '