<{php}>
global $xoopsTpl;
$emj_list = array(
140,141,142,143,144,1021,1022,1023,1024,1025,1026,1027,1029,1030,1031,1032,
1033,1034,1035,1071,1072,1076,145,156,150,151,152,157,158,162,163,164,
146,155,147,149,136,137,138,139,154,153,1028,86,87,88,85,84,
1,2,3,4,5,6,8,1052,172,100,101,1068,1069,1070,1073,1074,
9,10,11,12,13,14,15,16,17,18,19,20,80,81,82,83,
1011,75,110,105,106,107,74,1012,76,103,1054,1056,1058,1059,1060,1061,
115,116,123,125,126,127,128,129,130,131,132,133,134,1038,1039,1043,
1010,113,114,119,120,135,1041,1044,59,104,89,90,48,49,50,94,
38,39,40,41,42,43,44,1051,1053,45,46,47,1046,1048,66,67,
1040,22,23,24,25,26,27,28,51,52,53,54,55,56,57,58,
61,62,63,65,68,69,70,71,72,73,1063,1075,1066,1062,1019,1064,
1065,77,79,91,92,1003,1005,1016,1015,1008,167,176,95,96,97,98,
30,31,32,33,34,35,36,37,1018,102
);
$this->_tpl_vars['emj_list'] = $emj_list;
<{/php}>

<script type="text/javascript">
<!--//
function doSmilie(addSmilie) {
  var currentMessage = window.opener.xoopsGetElementById("<{$targetName}>").value;
  window.opener.xoopsGetElementById("<{$targetName}>").value=currentMessage+addSmilie;
  return;
}

function doEmoji(addEmoji) {
  var currentMessage = window.opener.xoopsGetElementById("<{$targetName}>").value;
  window.opener.xoopsGetElementById("<{$targetName}>").value=currentMessage+"[emj:"+addEmoji+"]";
  return;
}

function seltab(bpref, hpref, id_max, selected) {
  if (! document.getElementById) return;
  for (i = 0; i <= id_max; i++) {
    if (! document.getElementById(bpref + i)) continue;
    if (i == selected) {
      document.getElementById(bpref + i).style.visibility = "visible";
      document.getElementById(bpref + i).style.display = "block";
      document.getElementById(bpref + i).style.position = "";
    } else {
      document.getElementById(bpref + i).style.visibility = "hidden";
      document.getElementById(bpref + i).style.display = "none";
      document.getElementById(bpref + i).style.position = "absolute";
    }
  }
}

function init() {
  seltab('box', 'head', 10, 1);
}

window.onload = init;
// -->
</script>

<div class="tabheader">
  <table width="100%" class="outer">
      <tr class="head">
      <td style="width: 50%; margin: auto; text-align: center;">
          <a href="javascript:seltab('box', 'head', 10, 1)"><{$smarty.const._MD_LEGACY_LANG_SMILIES}></a>
      </td>
      <td style="width: 50%; margin: auto; text-align: center;">
          <a href="javascript:seltab('box', 'head', 10, 2)"><{"WIZMOBILE_LANG_EMOTICON"|wiz_constant}></a>
      </td>
    </tr>
  </table>
</div>

<div class="tabbody">
  <!-- smilie tab start -->
  <div id="box1" style="display: none;">
    <table width="100%" class="outer">
      <tr>
        <th colspan="3"><{$smarty.const._MD_LEGACY_LANG_SMILIES}></th>
      </tr>
      <tr class="head">
        <td><{$smarty.const._MD_LEGACY_LANG_CODE}></td>
        <td><{$smarty.const._MD_LEGACY_LANG_EMOTION}></td>
        <td><{$smarty.const._MD_LEGACY_LANG_IMAGE}></td>
      </tr>
      <{foreach item=obj from=$objects}>
      <tr class="<{cycle values="even,odd"}>">
        <td><{$obj->getShow('code')}></td>
        <td><{$obj->getShow('emotion')}></td>
        <td>
          <a href="#" onclick='doSmilie(" <{$obj->getShow('code')}> "); return false;'><img src='<{$smarty.const.XOOPS_UPLOAD_URL}>/<{$obj->getShow('smile_url')}>' alt='<{$obj->getShow('emotion')}>' title='<{$obj->getShow('emotion')}>' /></a>
        </td>
      </tr>
      <{/foreach}>
    </table>
    <div style="text-align:center;"><{xoops_pagenavi pagenavi=$pageNavi}></div>
    <br />
    <p><{$smarty.const._MD_LEGACY_LANG_CLICKASMILIE}></p>
  </div>
  <!-- smilie tab end -->

  <!-- emoji tab start -->
  <div id="box2" style="display: none;">
    <table width="100%" class="outer">
      <tr class="head">
        <th colspan="8"><{"WIZMOBILE_LANG_EMOTICON"|wiz_constant}></th>
      </tr>
      <tr class="<{cycle values="even,odd"}>">
        <{foreach item=emjid key=count from=$emj_list}>
          <td><a href="#" onclick='doEmoji("<{$emjid}>"); return false;'>[emj:<{$emjid}>]</a></td>
          <{if ($count+1) is div by 8}><tr/><tr class="<{cycle values="even,odd"}>"><{/if}>
        <{/foreach}>
      </tr>
    </table>
  </div>
  <!-- emoji tab end -->
</div>
