Use this new generate_smilies function instead of yours under smilies.inc.php
function generate_smilies($form = 'post', $field = 'message')
{
global $THEME_DIR;
$smilies = get_smilies_table2();
$paths = array($THEME_DIR.'/smiles/','images/smiles/');
if (function_exists('theme_generate_smilies'))
{
$html = theme_generate_smilies($smilies, $form);
}
else
{
$html = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' . "\n" . ' <tr align="center" valign="middle">' . "\n";
$c=0;
foreach($smilies as $smiley) {
$c=$c+1;
$smile_path = (file_exists($paths[0].$smiley[1]))?($paths[0]):($paths[1]);
$caption = $smiley[2] . " " . $smiley[0];
if($c >= 19){
$html .= '</tr><tr>' . "\n";
$c=0;
}
$html .= ' <td width="5%"><img src="images/smiles/' . $smiley[1] . '" alt="' . $caption . '" width="15" height="15" border="0" style="cursor:pointer;" title="' . $caption . '" onclick="javascript:emoticon_' . $form . '(\'' . $smiley[0] . '\')" /></td>' . "\n";
}
$html .= ' </tr>' . "\n" . '</table>' . "\n";
}
$html .= <<<EOT
<script language="JavaScript" type="text/javascript">
<!--
function emoticon_$form(text) {
text = ' ' + text + ' ';
if (document.$form.$field.createTextRange && document.post.message.caretPos) {
var caretPos = document.$form.$field.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.$form.$field.focus();
} else {
document.$form.$field.value += text;
document.$form.$field.focus();
}
}
I don't test it cause I don't have my test bed , report back the result...