The chat box was made using CSS and JS only, here's the JS:
[code:1:8761]
[size=9]/*[/size][size=9][/size]
[size=9]* Shoutbox for Forumotion forums[/size][size=9][/size]
[size=9]* Developed by Ange Tuteur - FM Design[/size][size=9][/size]
[size=9]* Database must be installed for full functionality ( http://fmdesign.forumotion.com/t281- )[/size][size=9][/size]
[size=9]*/[/size][size=9][/size]
[size=9]$(function() {[/size][size=9][/size]
[size=9] var config = {[/size][size=9][/size]
[size=9] pid : 884,[/size][size=9][/size]
[size=9] char_limit : 750,[/size][size=9][/size]
[size=9] msg_max : 50,[/size][size=9][/size]
[size=9] msg_del : 10,[/size][size=9][/size]
[size=9] timeout : 60,[/size][size=9][/size]
[size=9] public_chat : 1,[/size][size=9][/size]
[size=9] title : 'CDA Staff Chat',[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] mods : [1,3,8,89],[/size][size=9][/size]
[size=9] banned : [-1],[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] timezone : -5,[/size][size=9][/size]
[size=9] rights : 0, // choose to allow a small backlink to the developer's website[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] plugins : function() {[/size][size=9][/size]
[size=9] // custom content such as buttons and modifications can go here[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] if (!config.public_chat && !_userdata.session_logged_in) return;[/size][size=9][/size]
[size=9] var fo = {},[/size][size=9][/size]
[size=9] ud = {[/size][size=9][/size]
[size=9] id : _userdata.user_id,[/size][size=9][/size]
[size=9] name : _userdata.username,[/size][size=9][/size]
[size=9] ava : _userdata.avatar,[/size][size=9][/size]
[size=9] mod : 0[/size][size=9][/size]
[size=9] },[/size][size=9][/size]
[size=9] main = document.getElementById('content') || document.getElementById('page-body'),[/size][size=9][/size]
[size=9] fmd_chat = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] id : 'fmd_chatbox'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] box = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] id : 'fmd_chat_messagebox'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] header = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] id : 'fmd_chat_header',[/size][size=9][/size]
[size=9] html : '<span class="fmd_chat_title">'+config.title+'</span><div class="fmd_chat_options"></div><div style="clear:both"></div>'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] footer = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] id : 'fmd_chat_footer'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] actions = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] classname : 'fmd_chat_actions'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] emo_frame = cre({[/size][size=9][/size]
[size=9] tag : 'IFRAME',[/size][size=9][/size]
[size=9] classname : 'fmd_chat_frame',[/size][size=9][/size]
[size=9] src : '/post?mode=smilies_chatbox'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] color_frame = cre({[/size][size=9][/size]
[size=9] tag : 'IFRAME',[/size][size=9][/size]
[size=9] classname : 'fmd_chat_frame',[/size][size=9][/size]
[size=9] src : '/chatbox/selectcolor'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] color_selected = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] classname : 'fmd_color_selected'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] message = cre({[/size][size=9][/size]
[size=9] tag : 'INPUT',[/size][size=9][/size]
[size=9] type : 'text',[/size][size=9][/size]
[size=9] style : 'font-weight:normal;font-style:normal',[/size][size=9][/size]
[size=9] id : 'fmd_chat_message'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] send = cre({[/size][size=9][/size]
[size=9] tag : 'INPUT',[/size][size=9][/size]
[size=9] type : 'button',[/size][size=9][/size]
[size=9] id : 'fmd_chat_send',[/size][size=9][/size]
[size=9] value : 'Send'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] refresh = cre({[/size][size=9][/size]
[size=9] tag : 'INPUT',[/size][size=9][/size]
[size=9] id : 'fmd_chat_refresh',[/size][size=9][/size]
[size=9] type : 'checkbox',[/size][size=9][/size]
[size=9] title : 'Auto refresh',[/size][size=9][/size]
[size=9] checked : (my_getcookie('fmd_chat_refresh') && my_getcookie('fmd_chat_refresh').length) ? Number(my_getcookie('fmd_chat_refresh')) : 1,[/size][size=9][/size]
[size=9] click : function() {[/size][size=9][/size]
[size=9] this.checked ? my_setcookie('fmd_chat_refresh',1) : my_setcookie('fmd_chat_refresh',0);[/size][size=9][/size]
[size=9] idle = 0;[/size][size=9][/size]
[size=9] this.previousSibling.className.match(/fmd_idle/) && (this.previousSibling.className = '');[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] reftxt = cre({[/size][size=9][/size]
[size=9] tag : 'LABEL',[/size][size=9][/size]
[size=9] forId : 'fmd_chat_refresh',[/size][size=9][/size]
[size=9] html : 'Auto : <div class="fmd_chat_dropdown fmd_notice">Auto-refresh has been disabled due to inactivity.. Click this message to enable it.</div>',[/size][size=9][/size]
[size=9] style : 'cursor:pointer',[/size][size=9][/size]
[size=9] title : 'Auto refresh'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] cnote = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] html : '\x44\x65\x76\x65\x6c\x6f\x70\x65\x64\x20\x62\x79\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x66\x6d\x64\x65\x73\x69\x67\x6e\x2e\x66\x6f\x72\x75\x6d\x6f\x74\x69\x6f\x6e\x2e\x63\x6f\x6d\x2f\x74\x33\x31\x38\x2d\x66\x6d\x64\x2d\x73\x68\x6f\x75\x74\x62\x6f\x78\x23\x32\x30\x39\x35\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x41\x6e\x67\x65\x20\x54\x75\x74\x65\x75\x72\x3c\x2f\x61\x3e',[/size][size=9][/size]
[size=9] style : 'text-align:right'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] options = header.childNodes[1],[/size][size=9][/size]
[size=9] doct = document.title,[/size][size=9][/size]
[size=9] newmsg = 0,[/size][size=9][/size]
[size=9] loading = 0,[/size][size=9][/size]
[size=9] idle = 0,[/size][size=9][/size]
[size=9] focus = 1,[/size][size=9][/size]
[size=9] msg,[/size][size=9][/size]
[size=9] color;[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] fmd_chat.appendChild(header);[/size][size=9][/size]
[size=9] options.appendChild(reftxt);[/size][size=9][/size]
[size=9] options.appendChild(refresh);[/size][size=9][/size]
[size=9] fmd_chat.appendChild(box);[/size][size=9][/size]
[size=9] fmd_chat.appendChild(footer);[/size][size=9][/size]
[size=9] footer.appendChild(message);[/size][size=9][/size]
[size=9] footer.appendChild(send);[/size][size=9][/size]
[size=9] footer.appendChild(actions);[/size][size=9][/size]
[size=9] config.rights && fmd_chat.appendChild(cnote);[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* check if the user is a moderator */[/size][size=9][/size]
[size=9] for (var i=0,j=config.mods.length; i<j; i++) ud.id == config.mods[i] && (ud.mod = 1);[/size][i][size=9][/size]
[size=9][/size]
[size=9] /* check if the user has been blocked from writing */[/size][size=9][/size]
[size=9] for (var i=0,j=config.banned.length; i<j; i++) {[/size][size=9][/size]
[size=9] if (ud.id == config.banned[i]) {[/size][i][size=9][/size]
[size=9] if (ud.id == -1) footer.innerHTML = '<p class="fmd_chat_error">Please <a href="/login">login</a> or <a href="/register">register</a> to use the shoutbox.</p>';[/size][size=9][/size]
[size=9] else footer.innerHTML = '<p class="fmd_chat_error">You have been blocked from using the shoutbox. Please contact the board Administrator for more information.</p>';[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] popup({[/size][size=9][/size]
[size=9] text : '?',[/size][size=9][/size]
[size=9] title : 'help',[/size][size=9][/size]
[size=9] content : '<table class="fmd_chat_help"><tr class="fmd_chat_header"><td width="25%">Command Line</td><td>Explanation</td></tr><tr><td colspan="2">All command lines are used at the beginning of a message. They\'re not case sensitive and can be written capital or lowercase.</td></tr><tr><td>/me</td><td>This is replaced with your username. <br/>Example : <em>/me smells the flowers</em> <b>will send as</b> <em>* '+ud.name+' smells the flowers</em></td></tr><tr><td>/rand<br/>/random</td><td>Will return a number between 1 and 100. You can pass along your own range by writing /rand <strong>(n1:n2)</strong>. n1 is the minimum and n2 is the maximum. <br/>Example : '+ud.name+' thinks of a number between 1 and 100 ...24 !</td></tr><tr><td>/8ball</td><td>Ask a question to the Magic 8-ball and get an answer ! <br/>Example : <em>/8ball will it snow ?</em> <b>will send as</b> <em>will it snow ? <strong>[The Magic 8-Ball says : Signs point to yes]</strong></em></td></tr>'+ (ud.mod ? '<tr><td>/cls<br/>/clear</td><td>This command clears all shoutbox messages.</td></tr>' : '') +'</table>',[/size][size=9][/size]
[size=9] pop_style : 'width:99%;overflow-y:auto',[/size][size=9][/size]
[size=9] where : actions[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'refresh messages',[/size][size=9][/size]
[size=9] text : 'Refresh',[/size][size=9][/size]
[size=9] where : options,[/size][size=9][/size]
[size=9] advanced : function(b) {[/size][size=9][/size]
[size=9] b.onclick = function() {[/size][size=9][/size]
[size=9] idle = 0;[/size][size=9][/size]
[size=9] getMessages({[/size][size=9][/size]
[size=9] apply : function() { b.style.opacity = 0.3 },[/size][size=9][/size]
[size=9] callback : function() {[/size][size=9][/size]
[size=9] b.style.opacity = '';[/size][size=9][/size]
[size=9] scrollBox();[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'resize shoutbox',[/size][size=9][/size]
[size=9] text : '+',[/size][size=9][/size]
[size=9] where : options,[/size][size=9][/size]
[size=9] advanced : function(b) {[/size][size=9][/size]
[size=9] b.style.fontWeight = 'bold';[/size][size=9][/size]
[size=9] b.onclick = function() {[/size][size=9][/size]
[size=9] scrollBox();[/size][size=9][/size]
[size=9] if (!fmd_chat.style.zIndex) {[/size][size=9][/size]
[size=9] this.innerHTML = '-';[/size][size=9][/size]
[size=9] document.body.style.overflow = 'hidden';[/size][size=9][/size]
[size=9] fmd_chat.className = 'fmd_chat_max';[/size][size=9][/size]
[size=9] fmd_chat.style.zIndex = '1000000';[/size][size=9][/size]
[size=9] } else {[/size][size=9][/size]
[size=9] this.innerHTML = '+';[/size][size=9][/size]
[size=9] document.body.style.overflow = '';[/size][size=9][/size]
[size=9] fmd_chat.className = '';[/size][size=9][/size]
[size=9] fmd_chat.style.zIndex = '';[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'bold',[/size][size=9][/size]
[size=9] text : 'B',[/size][size=9][/size]
[size=9] css : 'font-weight:bold',[/size][size=9][/size]
[size=9] tags : ['[b]','[/b]'],[/size][size=9][/size]
[size=9] where : actions[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'italic',[/size][size=9][/size]
[size=9] text : 'I',[/size][size=9][/size]
[size=9] css : 'font-style:italic',[/size][size=9][/size]
[size=9] tags : ['[i]','[/i]'],[/size][size=9][/size]
[size=9] where : actions[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'underline',[/size][size=9][/size]
[size=9] text : 'U',[/size][size=9][/size]
[size=9] css : 'text-decoration:underline',[/size][size=9][/size]
[size=9] tags : ['[u]','[/u]'],[/size][size=9][/size]
[size=9] where : actions[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] button({[/size][size=9][/size]
[size=9] name : 'strike',[/size][size=9][/size]
[size=9] text : 'S',[/size][size=9][/size]
[size=9] css : 'text-decoration:line-through',[/size][size=9][/size]
[size=9] tags : ['[strike]','[/strike]'],[/size][size=9][/size]
[size=9] where : actions[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] // emoticons[/size][size=9][/size]
[size=9] popup({[/size][size=9][/size]
[size=9] text : 'Smilies',[/size][size=9][/size]
[size=9] title : 'Insert emoticon',[/size][size=9][/size]
[size=9] add : emo_frame,[/size][size=9][/size]
[size=9] where : actions,[/size][size=9][/size]
[size=9] advanced : function(b, box) {[/size][size=9][/size]
[size=9] emo_frame.onload = function() {[/size][size=9][/size]
[size=9] for (var i=0,frame=frameContent(emo_frame),a=frame.getElementsByTagName('A'); i<a.length; i++) {[/size][size=9][/size]
[size=9] if (/close\(\)/.test(a[i].href)) {[/size][size=9][/size]
[size=9] a[i].href = '#close';[/size][size=9][/size]
[size=9] a[i].onclick = function() { box.style.display = 'none' }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] if (/chatboxsmilie/.test(a[i].href)) {[/size][size=9][/size]
[size=9] a[i].href = '#' + a[i].href.match(/chatboxsmilie\('(.*?)'\)/)[1];[/size][size=9][/size]
[size=9] a[i].onclick = function() {[/size][size=9][/size]
[size=9] message.value += ' ' + this.getAttribute('href').slice(1);[/size][size=9][/size]
[size=9] box.style.display = 'none';[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9][/size]
[size=9] // colors[/size][size=9][/size]
[size=9] popup({[/size][size=9][/size]
[size=9] text : 'Color',[/size][size=9][/size]
[size=9] title : 'Change text color',[/size][size=9][/size]
[size=9] add : color_frame,[/size][size=9][/size]
[size=9] where : actions,[/size][size=9][/size]
[size=9] advanced : function(b, box) {[/size][size=9][/size]
[size=9] var colortxt = my_getcookie('fmd_chat_colortxt') || '';[/size][size=9][/size]
[size=9] b.appendChild(color_selected);[/size][size=9][/size]
[size=9] color_frame.onload = function() {[/size][size=9][/size]
[size=9] function setColor(val) {[/size][size=9][/size]
[size=9] my_setcookie('fmd_chat_colortxt',val);[/size][size=9][/size]
[size=9] message.style.color = val;[/size][size=9][/size]
[size=9] color_selected.style.background = val;[/size][size=9][/size]
[size=9] box.style.display = 'none';[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] var frame = frameContent(color_frame), hex = frame.getElementById('ColorHex'),[/size][size=9][/size]
[size=9] remove = cre({[/size][size=9][/size]
[size=9] tag : 'A',[/size][size=9][/size]
[size=9] html : 'Remove Color',[/size][size=9][/size]
[size=9] href : '#',[/size][size=9][/size]
[size=9] style : 'font-size:12px;text-decoration:none;position:absolute;right:20px;color:red',[/size][size=9][/size]
[size=9] click : function() {[/size][size=9][/size]
[size=9] my_setcookie('fmd_chat_colortxt',0);[/size][size=9][/size]
[size=9] setColor('');[/size][size=9][/size]
[size=9] return false;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] if (!hex) return;[/size][size=9][/size]
[size=9] hex.parentNode.appendChild(remove);[/size][size=9][/size]
[size=9] hex.onkeydown = function(e) { if (e.keyCode == 13) { setColor(this.value); return false } };[/size][size=9][/size]
[size=9] for (var i=0,td=frame.getElementsByTagName('TD'); i<td.length; i++) if (td[i].bgColor) td[i].onclick = function() { setColor(this.bgColor) }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] if (colortxt.length) {[/size][size=9][/size]
[size=9] message.style.color = colortxt;[/size][size=9][/size]
[size=9] color_selected.style.background = colortxt;[/size][size=9][/size]
[size=9] } [/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* apply plugins, and add the shoutbox to the page */[/size][size=9][/size]
[size=9] config.plugins();[/size][size=9][/size]
[size=9] main.insertBefore(fmd_chat,main.firstChild);[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* get the messages, and refresh them if auto-refresh enabled */[/size][size=9][/size]
[size=9] getMessages();[/size][size=9][/size]
[size=9] var chatRefresh = window.setInterval(function() {[/size][size=9][/size]
[size=9] if (!refresh.checked || message.disabled) return;[/size][size=9][/size]
[size=9] getMessages();[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /*[/size][size=9][/size]
[size=9] * idle time is 5*60(5mins) without typing[/size][size=9][/size]
[size=9] * used to prevent extra requests and members appearing active if they left their browser unattended[/size][size=9][/size]
[size=9] */[/size][size=9][/size]
[size=9] idle++;[/size][size=9][/size]
[size=9] if (idle > config.timeout) {[/size][size=9][/size]
[size=9] refresh.checked = 0;[/size][size=9][/size]
[size=9] reftxt.className = 'fmd_idle';[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] },5000);[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* determine the window state */[/size][size=9][/size]
[size=9] window.onblur = function() { focus = 0 };[/size][size=9][/size]
[size=9] window.onfocus = function() {[/size][size=9][/size]
[size=9] if (!focus) {[/size][size=9][/size]
[size=9] focus = 1;[/size][size=9][/size]
[size=9] newmsg = 0;[/size][size=9][/size]
[size=9] document.title = doct;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* typing and message submission */[/size][size=9][/size]
[size=9] message.onkeydown = function(e) {[/size][size=9][/size]
[size=9] if (e.keyCode == 8) return true;[/size][size=9][/size]
[size=9] else if (this.value.length > config.char_limit) e.preventDefault(); /* prevent further typing if char limit is reached */[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] message.onkeyup = function(e) {[/size][size=9][/size]
[size=9] e.keyCode == 13 && sendMessage();[/size][size=9][/size]
[size=9] idle > 0 && (idle = 0);[/size][size=9][/size]
[size=9] if (reftxt.className.match(/fmd_idle/)) {[/size][size=9][/size]
[size=9] reftxt.className = '';[/size][size=9][/size]
[size=9] refresh.checked = 1;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] send.onclick = function() { sendMessage() };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* get message rows from the database */[/size][size=9][/size]
[size=9] function getMessages(o) {[/size][size=9][/size]
[size=9] if (loading) return;[/size][size=9][/size]
[size=9] (o && o.apply) && o.apply();[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] loading = 1;[/size][size=9][/size]
[size=9] $.get(_database.tid, function(data) {[/size][size=9][/size]
[size=9] var table = $('#fmd_chat',data), dbr=$('#fmd_chat .db_chat_row',data), sbr = box.childNodes, idset = [];[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* check if the last sent message is in the database, if not we'll resend the message */[/size][size=9][/size]
[size=9] if (o && o.last && !table.find('#'+o.last).length) {[/size][size=9][/size]
[size=9] message.value = o.msg;[/size][size=9][/size]
[size=9] sendMessage('Error detected, resending message...');[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* remove shouts from database that exceed the maximum limit */[/size][size=9][/size]
[size=9] if (dbr.length > config.msg_max) {[/size][size=9][/size]
[size=9] $.get('/post?p='+config.pid+'&mode=editpost',function(data){[/size][size=9][/size]
[size=9] var rows = $('#text_editor_textarea',data).val().match(/\[tr id="shout_u.*?" class="db_chat_row"\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[\/tr\]/g);[/size][tr id="shout_u.*?" class="db_chat_row"\][size=9][/size]
[size=9] $.post('/post?p='+config.pid+'&mode=editpost',{[/size][size=9][/size]
[size=9] subject : _database.name,[/size][size=9][/size]
[size=9] message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr]'+rows.slice(Number(rows.length - config.msg_max) + config.msg_del,rows.length).join('')+'[/table]',[/size][size=9][/size]
[size=9] post : 1[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] }); [/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* remove messages from the shoutbox that aren't in the database */[/size][size=9][/size]
[size=9] for (var i=0,j=sbr.length; i<j; i++) !table.find('#'+sbr[i].id).length && idset.push(sbr[i].id);[/size][size=9][/size]
[size=9] for (var i=0,j=idset.length; i<j; i++) box.removeChild(document.getElementById(idset[i]));[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* apply new messages */[/size][size=9][/size]
[size=9] if (sbr.length < dbr.length) {[/size][size=9][/size]
[size=9] for (var i=0,j=dbr.length,rid; i<j; i++) {[/size][size=9][/size]
[size=9] rid = dbr[i].id;[/size][size=9][/size]
[size=9] if (!document.getElementById(rid)) {[/size][size=9][/size]
[size=9] var uid = dbr[i].firstChild.innerHTML.match(/(.*?):.*?:.*/)[1], unm = dbr[i].firstChild.innerHTML.match(/.*?:(.*?):.*/)[1],[/size][size=9][/size]
[size=9] crow = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] id : rid,[/size][size=9][/size]
[size=9] classname : 'fmd_chat_row',[/size][size=9][/size]
[size=9] html : '<div class="fmd_chat_avatar"><a href="/u'+uid+'" title="View '+unm+'\'s profile"><img src="'+(dbr[i].childNodes[1].firstChild.tagName == 'A' ? dbr[i].childNodes[1].firstChild.innerHTML : dbr[i].childNodes[1].innerHTML)+'" alt="avatar"/></a></div><div class="fmd_chat_name"> <span class="fmd_chat_time"><img class="fmd_chat_clock" src="http://i38.servimg.com/u/f38/18/45/41/65/time10.png" alt="time :"/> '+dbr[i].firstChild.innerHTML.match(/.*?:.*?:(.*)/)[1]+'</span></div><div class="fmd_chat_message">'+dbr[i].lastChild.innerHTML.replace(/\[custom (.*?)\]/ig,'<span $1>').replace(/\[\/custom\]/ig,'</span>')+'</div>'[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] ulink = cre({[/size][size=9][/size]
[size=9] tag : 'A',[/size][size=9][/size]
[size=9] href : '/u' + uid,[/size][size=9][/size]
[size=9] html : unm,[/size][size=9][/size]
[size=9] title : 'Mention ' + unm,[/size][size=9][/size]
[size=9] click : function() {[/size][size=9][/size]
[size=9] message.focus();[/size][size=9][/size]
[size=9] message.value += '@"'+this.innerHTML+'" ';[/size][size=9][/size]
[size=9] return false;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] crow.childNodes[1].insertBefore(ulink,crow.childNodes[1].firstChild);[/size][size=9][/size]
[size=9] box.appendChild(crow);[/size][size=9][/size]
[size=9] !focus && newmsg++;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] !focus && (document.title = '** '+newmsg+' NEW MESSAGE'+ (newmsg > 1 ? 'S' : '') +' **');[/size][size=9][/size]
[size=9] scrollBox();[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] (o && o.callback) && o.callback();[/size][size=9][/size]
[size=9] loading = 0;[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9][/size]
[size=9] /* post a message to the database */[/size][size=9][/size]
[size=9] function sendMessage(txt) {[/size][size=9][/size]
[size=9] /* filter out tags */[/size][size=9][/size]
[size=9] msg = message.value.replace(/(\[td\]|\[\/td\]|\[tr\]|\[\/tr\]|\[table\]|\[\/table\]|\[th\]|\[\/th\]|\[tbody\]|\[\/tbody\]|\[quote\]|\[quote=.*?\]|\[\/quote\]|\[code\]|\[\/code\]|\[hide\]|\[\/hide\]|\[spoiler\]|\[spoiler=.*?\]|\[\/spoiler\])/gi,'');[/size][size=9][/size]
[size=9][/size]
[size=9] if (!msg.length || msg.length > config.char_limit + 1 || message.disabled) return;[/size][size=9][/size]
[size=9] message.value = txt ? txt : 'Sending...';[/size][size=9][/size]
[size=9] message.disabled = true;[/size][size=9][/size]
[size=9] footer.className = 'fmd_chat_sending';[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /* command lines */[/size][size=9][/size]
[size=9] /^\/me/i.test(msg) && (msg = '[b]* ' + msg.replace(/^\/me/i,ud.name) + '[/b]');[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] /^\/8ball/i.test(msg) && (msg = msg.replace(/^\/8ball/i,'') + ' [b][The Magic 8-Ball says : ' + ['It is certain','It is decidedly so','Without a doubt','Yes definitely','You may rely on it','As I see it, yes','Most likely','Outlook good','Yes','Signs point to yes','Reply hazy try again','Ask again later','Better not tell you now','Cannot predict now','Concentrate and ask again','Don\'t count on it','My reply is no','My sources say no','Outlook not so good','Very doubtful'][Math.floor(Math.random()*20)] + '][/b]');[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] if (/^(\/random|\/rand)/i.test(msg)) {[/size][size=9][/size]
[size=9] var min = 1, max = 100, n = Math.floor(Math.random() * (max - min + 1)) + min;[/size][size=9][/size]
[size=9] if (msg.match(/\(\d+:\d+\)/)) {[/size][size=9][/size]
[size=9] min = Number(msg.match(/\((\d+):\d+\)/)[1]), max = Number(msg.match(/\(\d+:(\d+)\)/)[1]);[/size][size=9][/size]
[size=9] n = Math.floor(Math.random() * (max - min + 1)) + min;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] msg = ud.name + ' thinks of a number between ' + min + ' and ' + max + ' ...' + n + ' !';[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] if (/^(\/clear|\/cls)/i.test(msg) && ud.mod) {[/size][size=9][/size]
[size=9] message.value = 'Clearing messages...';[/size][size=9][/size]
[size=9] $.post('/post?p='+config.pid+'&mode=editpost',{[/size][size=9][/size]
[size=9] subject : _database.name,[/size][size=9][/size]
[size=9] message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr][tr id="shout_u' + ud.id + '-' + +new Date + '" class="db_chat_row"][td]'+ud.id+':Shout Monster:'+setDate()+'[/td][td]http://i38.servimg.com/u/f38/18/21/60/73/sm11.png[/td][td][b]MESSAGES HAVE BEEN CLEARED BY '+ud.name.toUpperCase()+'[/b][/td][/tr][/table]',[/size][size=9][/size]
[size=9] post : 1[/size][size=9][/size]
[size=9] },function() {[/size][size=9][/size]
[size=9] msgEnabled();[/size][size=9][/size]
[size=9] getMessages();[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] return;[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] // formatting[/size][size=9][/size]
[size=9] if (message.style.length) for (var i in fo) RegExp(fo[i].d.a[1], 'i').test(message.style[fo[i].d.a[0]]) && (msg = fo[i].d.b[0] + msg + fo[i].d.b[1]);[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] // coloring[/size][size=9][/size]
[size=9] if (message.style.color) {[/size][size=9][/size]
[size=9] color = message.style.color.replace(/\s/g,'').toUpperCase();[/size][size=9][/size]
[size=9] color.match(/RGB/) ? msg = '[color='+toHex(color.match(/RGB\((\d+),\d+,\d+\)/)[1], color.match(/RGB\(\d+,(\d+),\d+\)/)[1], color.match(/RGB\(\d+,\d+,(\d+)\)/)[1])+']' + msg + '[/color]' : msg = '[color='+color+']' + msg + '[/color]';[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] var rid = 'shout_u' + ud.id + '-' + +new Date;[/size][size=9][/size]
[size=9] _database.post({[/size][size=9][/size]
[size=9] pid : config.pid,[/size][size=9][/size]
[size=9] tableid : 'null',[/size][size=9][/size]
[size=9] update : ['null','null'],[/size][size=9][/size]
[size=9] newRow : '[tr id="'+rid+'" class="db_chat_row"][td]'+ud.id+':'+ud.name+':'+setDate()+'[/td][td]'+ud.ava.match(/src="(.*?)"/)[1]+'[/td][td]'+msg+'[/td][/tr]',[/size][size=9][/size]
[size=9] callback : function(state) {[/size][size=9][/size]
[size=9] msgEnabled();[/size][size=9][/size]
[size=9] getMessages({ last : rid, msg : msg });[/size][size=9][/size]
[size=9] state == 'ERROR' && ( footer.innerHTML = '<p class="fmd_chat_error">An error occured : You don\'t have permission to send messages. Please contact the board Administrator for more information.</p>' );[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function msgEnabled() { message.disabled = false; footer.className = ''; message.value = ''; message.focus() };[/size][size=9][/size]
[size=9] function scrollBox() { box.scrollTop = 99999 };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function setDate() {[/size][size=9][/size]
[size=9] var a=new Date(), b=new Date(a.getTime()+(a.getTimezoneOffset()*60000)+(3600000*config.timezone));[/size][size=9][/size]
[size=9] function set(i) { return i > 9 ? i : '0' + i };[/size][size=9][/size]
[size=9] return b.getDate() + '/' + (b.getMonth() + 1) + '/' + b.getFullYear() + ' - ' + set(b.getHours()) + ':' + set(b.getMinutes()) + ':' + set(b.getSeconds());[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function toHex() {[/size][size=9][/size]
[size=9] for (var i=0, n=arguments, j=n.length, colorString = '#', h; i<j; i++) {[/size][size=9][/size]
[size=9] h = Number(n[i]).toString(16);[/size][size=9][/size]
[size=9] colorString += (h.length < 2 ? '0' + h : h);[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] return colorString.toUpperCase();[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function cre(o) {[/size][size=9][/size]
[size=9] var el = document.createElement(o.tag);[/size][size=9][/size]
[size=9] o.html && (el.innerHTML = o.html);[/size][size=9][/size]
[size=9] o.id && (el.id = o.id);[/size][size=9][/size]
[size=9] o.forId && (el.htmlFor = o.forId);[/size][size=9][/size]
[size=9] o.classname && (el.className = o.classname);[/size][size=9][/size]
[size=9] o.src && (el.src = o.src);[/size][size=9][/size]
[size=9] o.type && (el.type = o.type);[/size][size=9][/size]
[size=9] o.href && (el.href = o.href);[/size][size=9][/size]
[size=9] o.title && (el.title = o.title);[/size][size=9][/size]
[size=9] o.value && (el.value = o.value);[/size][size=9][/size]
[size=9] o.checked && (el.checked = o.checked);[/size][size=9][/size]
[size=9] if (o.style) {[/size][size=9][/size]
[size=9] o.style = o.style.split(';');[/size][size=9][/size]
[size=9] for (var i = 0, j = o.style.length, d; i<j; i++) {[/size][size=9][/size]
[size=9] if (o.style[i].length) {[/size][size=9][/size]
[size=9] d = o.style[i].split(':');[/size][size=9][/size]
[size=9] el.style[d[0]] = d[1];[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] o.click && (el.onclick = o.click);[/size][size=9][/size]
[size=9] o.mouseup && (el.onmouseup = o.mouseup);[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] return el;[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function frameContent(frame) {[/size][size=9][/size]
[size=9] if (frame.contentDocument) frame = frame.contentDocument;[/size][size=9][/size]
[size=9] else if (frame.contentWindow) frame = frame.contentWindow.document;[/size][size=9][/size]
[size=9] frame.body.style.background = 'none';[/size][size=9][/size]
[size=9] return frame;[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function button(o) {[/size][size=9][/size]
[size=9] var actif = my_getcookie('fmd_chat_'+o.name) == 1,font,a;[/size][size=9][/size]
[size=9] if (o.tags) {[/size][size=9][/size]
[size=9] a = o.css.split(':'), font = a[0].match(/(font-weight|font-style)/);[/size][size=9][/size]
[size=9] fo[o.name] = {[/size][size=9][/size]
[size=9] d : { a : a, b : o.tags },[/size][size=9][/size]
[size=9] press : function() {[/size][size=9][/size]
[size=9] if (message.style[a[0]].match(RegExp(a[1],'i'))) {[/size][size=9][/size]
[size=9] message.style[a[0]] = message.style[a[0]].replace(RegExp(a[1],'i'),(font ? 'normal' : ''));[/size][size=9][/size]
[size=9] this.className = this.className.replace(/actif/,'');[/size][size=9][/size]
[size=9] my_setcookie('fmd_chat_'+o.name,0);[/size][size=9][/size]
[size=9] } else {[/size][size=9][/size]
[size=9] font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1];[/size][size=9][/size]
[size=9] this.className += ' actif';[/size][size=9][/size]
[size=9] my_setcookie('fmd_chat_'+o.name,1);[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] actif && (font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1]);[/size][size=9][/size]
[size=9] }[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] var button = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : '') + (actif ? ' actif' : ''),[/size][size=9][/size]
[size=9] html : o.text,[/size][size=9][/size]
[size=9] title : o.name,[/size][size=9][/size]
[size=9] style : (o.style ? o.style : ''),[/size][size=9][/size]
[size=9] mouseup : (fo[o.name] ? fo[o.name].press : '')[/size][size=9][/size]
[size=9] });[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] o.where.appendChild(button);[/size][size=9][/size]
[size=9] o.advanced && o.advanced(button);[/size][size=9][/size]
[size=9] };[/size][size=9][/size]
[size=9] [/size][size=9][/size]
[size=9] function popup(o) {[/size][size=9][/size]
[size=9] var box = cre({[/size][size=9][/size]
[size=9] tag : 'DIV',[/size][size=9][/size]
[size=9] classname : 'fmd_chat_dropdown',[/size][size=9][/size]
[size=9] style : 'display:none;z-index:10000;' + (o.pop_style ? o.pop_style : ''),[/size][size=9][/size]
[size=9] html : (o.content ? o.content : '')[/size][size=9][/size]
[size=9] }),[/size][size=9][/size]
[size=9] button = cre({[/size][size=9][/size]
[si