function FJInsertIcon(mt_icon_base) {    var mt_icons = [    [ "wicon1.gif", "wicon1", 24, 18 ],    [ "wicon2.gif", "wicon2", 24, 18 ],    [ "wicon3.gif", "wicon3", 24, 18 ],    [ "wicon4.gif", "wicon4", 24, 18 ],    [ "wicon5.gif", "wicon5", 24, 18 ],    [ "wicon6.gif", "wicon6", 24, 18 ],    [ "f_acha.gif", "face01", 18, 12 ],    [ "f_bikkuri.gif", "face02", 18, 12 ],    [ "f_ga-n.gif", "face03", 18, 12 ],    [ "f_komarun.gif", "face04", 18, 12 ],    [ "f_naku1.gif", "face05", 18, 12 ],    [ "f_naku2.gif", "face06", 18, 12 ],    [ "f_nikoniko.gif", "face07", 18, 12 ],    [ "f_okorigao.gif", "face08", 18, 12 ],    [ "e9.gif", "e9", 15, 15 ],    [ "e10.gif", "e10", 15, 15 ],    [ "asikko1.gif", "ashi_1", 15, 15 ],    [ "asikko2.gif", "ashi_2", 15, 15 ],    [ "ha-to.gif", "hato_1", 17, 12 ],    [ "val1.gif", "val1", 17, 22 ],    [ "hana.gif", "hana_1", 15, 14 ],    [ "kaerusan.gif", "kaeru_1", 15, 15 ],    [ "kamera.gif", "kamera_1", 15, 15 ],    [ "kurumasan.gif", "kuruma_1", 15, 15 ],    [ "bu-bu-.gif", "bu-bu_1", 15, 15 ],    [ "onpusan.gif", "onpu_1", 18, 17 ],    [ "ranchi.gif", "ranchi_1", 15, 15 ],    [ "kirakira.gif", "kira_1", 11, 13 ],    [ "icon-2b2a.gif", "icon-2b2a", 10, 14 ],    [ "ikari1.gif", "ikari1", 9, 9 ],    [ "ase1.gif", "ase1", 13, 14 ],    [ "e1.gif", "e1", 15, 15 ],    [ "e8.gif", "e8", 15, 15 ],    [ "e11.gif", "e11", 15, 15 ],    [ "e12.gif", "e12", 15, 15 ],    [ "e13.gif", "e13", 15, 15 ],    [ "e14.gif", "e14", 15, 15 ],    [ "e15.gif", "e15", 12, 12 ],    [ "e16.gif", "e16", 15, 14 ],    [ "yajirusi1.gif", "up_1", 15, 15 ],    [ "yajirusi2.gif", "down_1", 15, 15 ],    [ "e6.gif", "e6", 15, 15 ],    [ "cat1.gif", "cat1", 23, 16 ],    [ "cat2.gif", "cat2", 24, 17 ],    [ "cat3.gif", "cat3", 24, 17 ],    [ "cat5.gif", "cat5", 24, 20 ],    [ "dog2.gif", "dog2", 32, 24 ],    [ "e2.gif", "e2", 15, 15 ],    [ "e3.gif", "e3", 15, 15 ],    [ "e4.gif", "e4", 15, 15 ],    [ "e5.gif", "e5", 15, 15 ],    [ "e7.gif", "e7", 15, 15 ],    [ "icon71.gif", "icon71", 24, 28 ],    [ "icon72.gif", "icon72", 19, 18 ],    [ "e-dog2.gif", "e-dog2", 48, 19 ],    [ "e-prof.gif", "e-prof", 38, 31 ],    [ "icon01.gif", "icon01", 19, 19 ],    [ "icon02.gif", "icon02", 15, 15 ],    [ "icon03.gif", "icon03", 15, 22 ],    [ "icon04.gif", "icon04", 21, 20 ],    [ "icon05.gif", "icon05", 15, 15 ],    [ "icon06.gif", "icon06", 22, 18 ],    [ "e_angry2.gif", "e_angry2", 29, 18 ],    [ "icon07.gif", "icon07", 15, 22 ],    [ "icon81.gif", "icon81", 26, 26 ],    [ "icon82.gif", "icon82", 22, 16 ],    [ "icon84.gif", "icon84", 21, 29 ],    [ "icon85.gif", "icon85", 24, 21 ],    [ "icon86.gif", "icon86", 30, 15 ],    [ "e-tongue.gif", "e-tongue", 33, 19 ],    [ "icon87.gif", "icon87", 30, 30 ],    [ "icon88.gif", "icon88", 15, 24 ],    [ "e-sleep.gif", "e-sleep", 33, 25 ],    [ "e-drop.gif", "e-drop", 17, 15 ],    [ "e_nono.gif", "e_nono", 24, 18 ],    [ "icon89.gif", "icon89", 15, 15 ],    [ "icon90.gif", "icon90", 15, 22 ],    [ "icon91.gif", "icon91", 15, 22 ],    [ "icon79.gif", "icon79", 38, 26 ],    [ "e_chatting.gif", "e_chatting", 40, 20 ],    [ "e_camera2.gif", "e_camera2", 28, 24 ],    [ "icon80.gif", "icon80", 32, 25 ],    [ "e-drumsplay.gif", "e-drumsplay", 25, 28 ],    [ "e_tv.gif", "e_tv", 50, 26 ],    [ "e_angry1.gif", "e_angry1", 42, 38 ],    [ "e-onhead.gif", "e-onhead", 37, 23 ],    [ "e_cheerleader.gif", "e_cheerleader", 55, 43 ],    [ "e_pompom.gif", "e_pompom", 45, 30 ],    [ "e_dancing.gif", "e_dancing", 33, 23 ],    [ "e_director.gif", "e_director", 38, 18 ],    [ "icon08.gif", "icon08", 19, 15 ],    [ "icon83.gif", "icon83", 57, 15 ],    [ "e_drinking2.gif", "e_drinking2", 39, 26 ],    [ "e_drinking3.gif", "e_drinking3", 57, 28 ],    [ "e_flower4you.gif", "e_flower4you", 24, 16 ],    [ "e_ready.gif", "e_ready", 29, 17 ],    [ "e-birthday.gif", "e-birthday", 15, 23 ],    [ "e-icecream.gif", "e-icecream", 22, 25 ],    [ "e_roundflower.gif", "e_roundflower", 41, 22 ],    [ "e_schumaker.gif", "e_schumaker", 40, 30 ],    [ "e_shocked.gif", "e_shocked", 22, 21 ],    [ "icon98.gif", "icon98", 15, 15 ],    [ "icon99.gif", "icon99", 15, 15 ],    [ "icon95.gif", "icon95", 22, 21 ],    [ "pp_00.gif", "pp_00.gif", 17, 17 ],    [ "pp_01.gif", "pp_01.gif", 17, 17 ],    [ "pp_02.gif", "pp_02.gif", 17, 17 ],    [ "pp_03.gif", "pp_03.gif", 17, 17 ],    [ "pp_04.gif", "pp_04.gif", 17, 17 ],    [ "pp_05.gif", "pp_05.gif", 17, 17 ],    [ "pp_06.gif", "pp_06.gif", 17, 17 ],    [ "pp_07.gif", "pp_07.gif", 17, 17 ],    [ "pp_08.gif", "pp_08.gif", 17, 17 ],    [ "pp_09.gif", "pp_09.gif", 17, 17 ],    [ "pp_10.gif", "pp_10.gif", 17, 17 ],    [ "pp_11.gif", "pp_11.gif", 17, 17 ],    [ "pp_12.gif", "pp_12.gif", 17, 17 ],    [ "kao1.gif", "kao1", 53, 15 ],    [ "kao2.gif", "kao2", 56, 12 ],    [ "kao3.gif", "kao3", 84, 15 ],    [ "kao4.gif", "kao4", 40, 15 ],    [ "kao5.gif", "kao5", 81, 15 ],    [ "kao6.gif", "kao6", 53, 15 ],    [ "kao7.gif", "kao7", 39, 15 ],    [ "kao8.gif", "kao8", 60, 15 ],    [ "kao9.gif", "kao9", 50, 15 ],    [ "kao10.gif", "kao10", 33, 15 ],    [ "kao11.gif", "kao11", 44, 12 ],    [ "kao12.gif", "kao12", 50, 12 ],    [ "kao13.gif", "kao13", 29, 15 ],    [ "kao14.gif", "kao14", 56, 12 ],    [ "kao15.gif", "kao15", 53, 15 ],    [ "kao16.gif", "kao16", 53, 15 ]    ];    var i_file = 0;    var i_alt = 1;    var i_width = 2;    var i_height = 3;    this.insertToTextArea = function(v) {        var e = document.getElementById('comment-text');        if (document.selection) {            e.focus();            var range = document.selection.createRange();            range.text = v;        } else {            var length = e.textLength;            var start = e.selectionStart;            var end = e.selectionEnd;            if (end == 1 || end == 2) end = length;            e.value = e.value.substring(0, start) + v + e.value.substr(end, length);            e.selectionStart = start + v.length;            e.selectionEnd = start + v.length;        }        e.focus();    };    this.insertIconEditor = function(i) {        var i_html;        if (app.editor.mode == 'iframe') {            var id = "temp_id_for_retrieving_inserted_element_" + Unique.id();            i_html = '<img src="' + mt_icon_base + mt_icons[i][i_file] + '" class="mt_icon" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" id="' + id + '" />';            var inserted = _insertHTML(i_html, false, id, true);            if (inserted) {                inserted.src = mt_icon_base + mt_icons[i][i_file];            }        }        else {            i_html = '<img src="' + mt_icon_base + mt_icons[i][i_file] + '" class="mt_icon" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" />';            app.editor.actual.setSelection(i_html);        }    };    this.insertIconTag = function(i) {        var i_html;        i_html = '<img src="' + mt_icon_base + mt_icons[i][0] + '" class="mt_icon" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" />';        this.insertToTextArea(i_html);    };    this.insertIconMacro = function(i) {        var i_html;        i_html = ':' + mt_icons[i][0] + ':';        this.insertToTextArea(i_html);    };    this.listIconsEditor = function() {        var i;        var html = '';        for (i = 0; i < mt_icons.length; i++) {            html += '<img src="' + mt_icon_base + mt_icons[i][i_file] + '" border="0" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" onclick="_fj_insert_icon_obj.insertIconEditor(' + i + ');" style="cursor : pointer;" />';        }        document.getElementById('editor_insert_icons').innerHTML = html;    };    this.listIconsCommentForm = function(mode) {        var i;        var html = '';        for (i = 0; i < mt_icons.length; i++) {            if (mode == 'tag') {                html += '<img src="' + mt_icon_base + mt_icons[i][i_file] + '" border="0" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" onclick="_fj_insert_icon_obj.insertIconTag(' + i + ');" style="cursor : pointer;" />';            }            else if (mode == 'macro') {                html += '<img src="' + mt_icon_base + mt_icons[i][i_file] + '" border="0" width="' + mt_icons[i][i_width] + '" height="' + mt_icons[i][i_height] + '" alt="' + mt_icons[i][i_alt] + '" onclick="_fj_insert_icon_obj.insertIconMacro(' + i + ');" style="cursor : pointer;" />';            }        }        document.write(html);    };    _insertHTML = function(html, select, id, isTempId) {        var editor = app.editor.actual;        var selection = editor.getSelection();        var inserted = null;        if (selection.createRange) { // Internet Explorer (IE)            var range = selection.createRange();            if (selection.type == "None" || selection.type == "Text") {                try {                    range.pasteHTML(html);                } catch (err) {                    log("Error pasting html on selection of type 'Text' or 'None': " + err);                                }                if (defined(id)) {                    inserted = editor.document.getElementById(id);                    if(select)                         range.moveToElementText(inserted);                } else {                    if(range.moveStart) {                        range.moveStart("character", ((html.length) * (-1)));                        inserted = range.parentElement();                    }                }                if (select)                     range.select();            }            else { // IE 'Control' selection                    range.item(0).outerHTML = html;                inserted = range.item(0);             }        }         // mozilla        else if (selection.getRangeAt) {            var range;            if (selection.rangeCount)                range = selection.getRangeAt(0);            else {                range = editor.document.createRange();                range.setStart(editor.document.body, 0);                range.setEnd(editor.document.body, 0);                selection.addRange(range);            }            var anchor = range.startContainer;            if (selection && range && editor.isCaretAtEnd(selection, range)) {                 var paragraph = editor.document.createElement(editor.FORMAT_BLOCK_TAG);                paragraph.insertBefore(editor.document.createElement("br"), null);                editor.document.getElementsByTagName("body")[0].insertBefore(paragraph, null);            }             if (select && anchor.nodeType == Node.TEXT_NODE && !html.match( /<[a-z][a-z]*\s/i)) {                range.setStart(anchor, selection.anchorOffset);                var insertNode = editor.document.createTextNode(html);                range.insertNode(insertNode);                var inserted = insertNode;            }            else {                var pS = anchor.previousSibling;                var nS = anchor.nextSibling;                editor.document.execCommand("insertHTML", false, html);                if(pS !== anchor.previousSibling)                    inserted = anchor.previousSibling;                else if(nS !== anchor.nextSibling)                    inserted = anchor.nextSibling;                else                     inserted = anchor.firstChild;            }            if (defined(id))                inserted = editor.document.getElementById(id);            if (inserted && inserted.tagName && inserted.tagName.toLowerCase() == "a")                editor.tagJustInserted = true;            if (select) {                range.selectNode(inserted);                editor.monitorSelection(); // Required for Mozilla for proper arrow keys on highlighted link.            }            selection.addRange(range);                }        if(isTempId && inserted) {            inserted.id = undefined;            inserted.removeAttribute("id");        }        return inserted;    };}
