(function()
{
var path = "/jmessenger/";
var _showhidden = null;
var _xtools = null;
var zIndex = 9001;
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 TrophyIMChatArea()
{
/*
var winImChatArea =
{
id_window : "window_chat_area",
width : 490,
height : 395,
top : 100,
left : 400,
draggable : true,
visible : "display",
resizable : true,
zindex : zIndex++,
title : "Mensagens - Expresso Messenger",
closeAction : "remove",
content : '
'
};
_winBuild( winImChatArea );
return '';
*/
}
function TrophyIMChatBox()
{
var chatBox = '';
return chatBox;
}
function TrophyIMChatTab()
{
var chatTab = '';
return chatTab;
}
function TrophyIMLoggingDiv()
{
return '';
}
function TrophyIMLoginPage()
{
setXTools();
var winLoginPage =
{
id_window : "window_login_page",
width : 260,
height : 150,
top : 100,
left : 400,
draggable : true,
visible : "display",
resizable : true,
zindex : zIndex++,
title : "Login - Expresso Messenger",
closeAction : "remove",
content : _xtools.parse(_xtools.xml("login_page"), "loginPage.xsl")
};
_winBuild( winLoginPage );
}
function TrophyIMRosterDiv()
{
setXTools();
var winRosterDiv =
{
id_window : "window_Roster_im",
width : 250,
height : 410,
top : 50,
left : 50,
draggable : true,
visible : "display",
resizable : true,
zindex : zIndex++,
title : "Contatos - Expresso Messenger",
closeAction : "hidden",
content : _xtools.parse(_xtools.xml("contacts_list"),"contactsList.xsl")
};
_winBuild( winRosterDiv );
}
function TrophyIMRosterGroup()
{
return '';
}
function TrophyIMRosterItem()
{
var rosterItem = '';
return rosterItem;
}
function HTMLSnippets( pType )
{
return new ( function( )
{
this.chatArea = TrophyIMChatArea;
this.chatBox = TrophyIMChatBox;
this.chatTab = TrophyIMChatTab;
this.loggingDiv = TrophyIMLoggingDiv;
this.loginPage = TrophyIMLoginPage;
this.rosterDiv = TrophyIMRosterDiv;
this.rosterGroup = TrophyIMRosterGroup;
this.rosterItem = TrophyIMRosterItem;
} );
}
function getZindex()
{
return zIndex++;
}
function parse()
{
if( arguments.length == 2 )
return _xtools.parse(_xtools.xml(arguments[0]), arguments[1] );
if( arguments.length === 3 )
return _xtools.parse(_xtools.xml(arguments[0]), arguments[1], arguments[2] );
}
function loadScripts(pFiles)
{
// Load JavaScript
var loadJavaScript = function(pJs)
{
var newScript = document.createElement("script");
newScript.setAttribute("type", "text/javascript");
newScript.setAttribute("src", pJs );
return newScript;
};
// Load CSS
var loadStyleSheet = function(pCss)
{
var newStyle = document.createElement("link");
newStyle.setAttribute("rel", "stylesheet");
newStyle.setAttribute("type", "text/css");
newStyle.setAttribute("href", pCss);
return newStyle;
};
for(var i = 0; i < pFiles.length; i++)
{
if( pFiles[i].indexOf(".js") > -1 )
document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i]));
if( pFiles[i].indexOf(".css") > -1 )
document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i]));
}
}
function setPresence()
{
if( arguments.length > 0 )
{
var element = arguments[0];
if( _showhidden == null )
_showhidden = new ShowHidden(300);
var _status = [
['Afastado', 'away', ''],
['Disponível', 'available', ''],
['Livre p/ Conversa', 'chat', ''],
['Não Disponível', 'xa', ''],
['Ocupado', 'dnd', ''],
];
var _itens = "";
for( var i in _status )
{
_itens += '';
_itens += _status[i][2]+ "" + _status[i][0] + "
";
}
var _statusItens = document.createElement("div");
_statusItens.setAttribute("style", "margin: 62px 0px 0px 76px;");
_statusItens.className = "x-menu";
_statusItens.style.zIndex = '99999';
_statusItens.innerHTML = _itens;
_showhidden.action('onmouseover', 'onmouseout', _statusItens);
element.parentNode.onmouseout = function(){ _showhidden.hiddenObject(false); };
element.parentNode.onmouseover = function(){ _showhidden.hiddenObject(true); };
element.parentNode.appendChild(_statusItens);
}
}
function setStatusJabber()
{
if( arguments.length > 0 )
{
var _text = arguments[0];
var _img = arguments[1];
document.getElementById('statusJabberImg').setAttribute("style", "background-image: url('images/"+_img+".gif'); margin-left: 13px;width:15px; height:15px;");
document.getElementById('statusJabberText').innerHTML = _text;
}
}
function setXTools()
{
if( _xtools == null )
_xtools = new xtools(path);
}
function loadIM()
{
var files = [
'js/xtools.js',
'js/dragdrop.js',
'js/makeW.js',
'js/show_hidden.js',
'css/trophyim.css',
'css/window_azul.css'
//'css/window_cataratas.css'
//'css/window_celepar.css'
//'css/window_comics.css'
//'css/window_default.css'
//'css/window_escritorio.css'
//'css/window_metropole.css'
//'css/window_rochas.css'
];
loadScripts(files);
}
loadIM.prototype.configEvents = configEvents;
loadIM.prototype.getZIndex = getZindex;
loadIM.prototype.parse = parse;
loadIM.prototype.setPresence = setPresence;
loadIM.prototype.setStatusJabber = setStatusJabber;
loadIM.prototype.HTMLSnippets = new HTMLSnippets;
window.loadIM = new loadIM;
})();