This is what I have in the global footer:
<script type="text/javascript">
<!--
/*
Extra Smilies, with preview, drop down menu and option to view all (V3.1)
by Todge
Copyright © 2012
Please keep this header intact
*/
if(document.postForm || pb_action == 'display')
{
// Edit below here...
var popBoxes = 10;
var popWidth = 900;
var popHeight = 600;
// Edit above here...
var smCode = new Array();
// Get smilie codes...
for(t=0; t<smilie.length; t++)
{
smCode[t] = ' ::'+smilie[t].split('/')[smilie[t].split('/').length-1].split('.')[0]+':: ';
}
// Create smilie pop-up...
var winleft = (screen.width/2)-(popWidth/2);
var winatts = 'width='+(popWidth+20)+',height='+popHeight+',left='+winleft+',top=50,scrollbars';
var content = document.getElementsByTagName('style')[0].innerHTML;
content = '<html><head></head><style>'+content+'</style><body onBlur="self.close()">';
content += '<br><table width="'+popWidth+'" cellspacing="1" cellpadding="0" border="0" align="center" class="bordercolor">';
content += '<tr><td width="100%" class="titlebg" colspan="'+popBoxes+'" align="center"><b>Smilies</b></td></tr>';
for(t=0; t<smilie.length; t++)
{
if(!smilie[t].match('http')){
content += '<tr><td width="100%" class="windowbg" colspan="'+popBoxes+'" align="center">'+smilie[t]+'</td></tr>';
content += '<tr>';
t++;
}
for(b=0; b<popBoxes; b++)
{
if(typeof(smilie[t]) != 'undefined'){
if(!smilie[t].match('http')){
content += '<td width="'+100/popBoxes+'%" class="windowbg2"></td>';
t--;
}
else{
if(document.all){
content += '<td width="'+100/popBoxes+'%" class="windowbg2" align="center"><b><a href="javascript:window.opener.add(\''+smCode[t]+'\');document.focus()"><img src="'+smilie[t]+'" border="0"></a></b></td>';}
else{
content += '<td width="'+100/popBoxes+'%" class="windowbg2" align="center"><a href="javascript:window.opener.add(\''+smCode[t]+'\')"><img src="'+smilie[t]+'" border="0"></a></td>';}}}
else{
content += '<td width="'+100/popBoxes+'%" class="windowbg2"></td>';
}
t++;
}
content += '</tr>';
t--;
}
content += '</td></tr></table>';
content += '</body></html>';
// display smilies
function aS(smiley)
{
smiley = smiley.split('::')[1].split('::')[0];
for(t=0; t<smCode.length; t++)
{
if(smCode[t].match(smiley))
{
if(document.postForm)
{
document.getElementById('smile').innerHTML = ' <a href=\'javascript:add(" '+smCode[t]+' ")\'><img src="'+smilie[t]+'" border="0" alt=" '+smCode[t]+' "/></a> ';
}
else
{
document.getElementById('smile').innerHTML = ' <a href=\'javascript:adds(" '+smCode[t]+' ")\'><img src="'+smilie[t]+'" border="0" alt=" '+smCode[t]+' "/></a> ';
}
}}}
function popSmilies()
{
var smilieWindow = window.open("","newWindow",winatts);
smilieWindow.document.write(content);
}
var smilieCode = '<br /><br /><table bgcolor="000000" border="0"><TR><TD><select name="selectsmilie" style="width: 120px;" onChange="aS(this.options[this.selectedIndex].value)"><option>Select Smilie';
for (p2=0; p2<smCode.length; p2++)
{
if(smilie[p2].match(/\.(gif|jpe?g|png)/i))
{
smilieCode += '<option value=" '+smCode[p2]+' ">'+smCode[p2];
}
else
{
smilieCode += '<option value="">---'+smilie[p2]+'---';
}
}
smilieCode += '</select></TD></TR><TR><TD ID="smile" class="windowbg2" height="60" align="center" valign="middle">';
smilieCode += '</TD></TR>';
smilieCode += '<TR><TD class="windowbg2" align="center" valign="middle" height="15"><a href="javascript:popSmilies()">View all smilies</a></TD></TR></table>';
// show smilies in posts
function showSmilies()
{
var posting = document.getElementsByTagName('input');
for(p=0; p<posting.length; p++)
{
if(posting
.type=='submit')
{
posting
.onmousedown=function()
{
var postBox = document.getElementsByTagName('textarea');
for(p=0; p<postBox.length; p++)
{
if(postBox
.name == 'message')
{
postBox = postBox
;
break;
}}
var post=postBox.value;
for(t=0; t<smCode.length; t++)
{
post = post.replace(new RegExp(smCode[t],"g"),'[im'+'g]'+smilie[t]+'[/i'+'mg]');
}
postBox.value = post;
}}}}
if(document.postForm)
{
// Create and place the smilie box on page etc...
var td = document.getElementsByTagName('TD');
document.postForm.message.parentNode.parentNode.previousSibling.innerHTML += smilieCode;
// Replace smilies in post text with codes
var post = document.postForm.message.value;
for(t=0; t<smCode.length; t++)
{
post = post.replace(new RegExp(smilie[t],"g"),smCode[t]);
}
post = post.split(' ::').join(' ::');
post = post.split('::
[/img]').join(':: ');
document.postForm.message.value = post;
showSmilies();
}}
// -->
</script>