function theme_url(e) {
    return "theme/" != e.substr(0, 6) ? ("" != $setting.cdn ? "http://" + $setting.cdn + "/theme/" + $setting.theme + "/" + e : "/theme/" + $setting.theme + "/" + e) : "" != $setting.cdn ? "http://" + $setting.cdn + "/" + e : "/" + e;
}
function url(e) {
    return "rewrite" == $setting.url_type ? "/" + e + $setting.rewrite_prefix : "i" == $url_type ? "?i=" + e.replace(/\//, "&") : void 0;
}
function Close() {
    document.getElementById("tarhpardaz").style.display = "none";
}
function unlockUser() {
    if($("vpassword").value == "") {
        alert("کلمه عبور را وارد کنید");
        return;
    }
    new Ajax.Request(url("ajax/chat.unlockuser"), {
        onSuccess: function (e) {
            if(e.responseText.indexOf("ok") == 0) {
                var response = e.responseText.split('|');
                $setting.chpw = response[2];
                $setting.token = response[1];
                document.getElementById("verfiyModal").style.display = "none";
                AjaxReadRequest();
                getUser();
                alert("حساب کاربری شما فعال شد");
            } else {
                alert(e.responseText)
            }
        },
        parameters: {
            password: $("vpassword").value
        }
    })
}
function addv(a, b, c, d) {
    var e = new Date,
        f = "font-weight:" + $("bold").value + ";font-style:" + $("italic").value + ";color:" + $("color").value;
    void 0 !== $("fontsize") && (f += ";font-size:" + $("fontsize").value), void 0 !== $("fontname") && (f += ";font-family:" + $("fontname").value);
    var g = {
        avatar: $me.avatar,
        css: f,
        id: "pm" == a ? "" : $msgid,
        length: 0,
        message: "<audio controls autoplay=false><source src=" + c + " type=\"audio/mp3\"></audio>",
        msgid: "myself",
        priv: $me.type,
        privat: "pm" == a ? b : 0,
        sex: $me.gender,
        tid: ("pm" == a ? "private_" : "public_") + getRandom(),
        time: e.getHours() + ":" + e.getMinutes(),
        type: "send",
        user: $me.username,
        user_id: $me.id
    };
    addmessage(g), $(g.tid).parentNode.parentNode.parentNode.addClassName("msgnum_" + d), $(g.tid).parentNode.parentNode.parentNode.removeClassName("msgnum_myself"), $(g.tid).src = theme_url("theme/images/chat/tick.png")
}
function voicechat($into, $to, title) {
    if ($temp = $("chatinhalt")) {
        "object" == typeof $windows.voicechat[$into + "_" + $to] && delete $windows.voicechat[$into + "_" + $to];
        
        $windows.voicechat[$into + "_" + $to] = new Window({
            className: $win_style,
            url: url("voi/" + $into + "/" + $to),
            title: "پیام صوتی به " + title,
            width: 315,
            height: 248,
            top: eval($temp.offsetTop + Math.round(50 * Math.random())),
            left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
            resizable: !0,
            showEffect: Effect.BlindDown,
            hideEffect: Effect.SwitchOff,
            showEffectOptions: {
                duration: .5
            },
            hideEffectOptions: {
                duration: .5
            },
            draggable: !0,
            minimizable: !0,
            maximizable: !0,
            destroyOnClose: !0,
            opacity: 1
        })
    }
    $windows.voicechat[$into + "_" + $to].show(), $windows.voicechat[$into + "_" + $to].toFront()
}
function closeStory() {
    document.getElementById("iframeStory").src = '';
    document.getElementById("storyModal").style.display = "none"
}
function openStory(id) {
    var key = $usersObj.userOnline.findIndex(function(user) {
        return user.ui == id
    });
    document.getElementById("storyHref").href = '/profile/' + id;
    document.getElementById("storyName").innerHTML = $usersObj.userOnline[key].un;
    document.getElementById("storyAvatar").src = './' + $setting.avatardir + "/" + $usersObj.userOnline[key].a;
    document.getElementById("iframeStory").src = '/story/' + id;
    document.getElementById("storyModal").style.display = "block"
}
function removepin() {
    new Ajax.Request(url("ajax/chat.delpinmsg"), {
        onSuccess: function (e) {
            switch (e.responseText) {
                case "ok":
                    $("pinned-box").style.display = "none", $("usernamepin").innerHTML = "", $("pmpin").innerHTML = "", $("pinby").innerHTML = "", $("avatar-pin").src = "", $("pindel").innerHTML = "";
                    break;
                default:
                    alert(e.responseText)
            }
        }
    })
}

function pinmsg(e) {
    var t = $("msgcode_" + e).up().className.replace("msgnum_", "");
    if (0 == t) return alert("این پیام شما ارسال نشده است");
    new Ajax.Request(url("ajax/chat.pinmsg"), {
        onSuccess: function (e) {
            var t = e.responseJSON;
            switch (t.result) {
                case "ok":
                    if ($numsmiles = 0, 1 == t.data.file) {
                        var i = 1 == $setting.music_autoplay ? "autoplay" : "";
                        if (1 == $setting.music_autoplay) {
                            for (var s = document.getElementsByTagName("audio"), a = document.getElementsByTagName("video"), n = 0, r = s.length; n < r; n++) s[n].pause();
                            for (n = 0, r = a.length; n < r; n++) a[n].pause()
                        }
                        var o = "image" == t.data.type ? '<a href="' + t.data.blob + '" target="_blank"><img style="width: 50px;height:50px;" src="' + t.data.blob + '" class="pvimg"/></a>' : "video" == t.data.type ? '<video width="300" height="100" controls src="' + t.data.blob + '" type="' + t.data.mtype + '" ' + i + "></video>" : "audio" == t.data.type ? "<audio controls " + i + '><source src="' + t.data.blob + '" type="' + t.data.mtype + '"></audio>' : '<a href="' + t.data.blob + '" target="_blank"><u><b><br><center><font color=red>برای مشاهده فایل پیوستی کلیک کنید</font></center></br></b></u></a>';
                        $("pmpin").innerHTML = o
                    } else $("pmpin").innerHTML = t.data.text.replace(/\(s(\d{1,4})\)/gi, numSmilies);
                    $("pinned-box").style.display = "", $("usernamepin").innerHTML = t.username, $("pinby").innerHTML = "پین شده توسط :" + $me.username, $("avatar-pin").src = t.avatar, in_array($me.type, $setting.useroptions.delpinmsg) && ($("pindel").innerHTML = '<div onclick="removepin()" class="close-pin" style="margin-right: 220px;">حذف پیام پین شده</div>');
                    break;
                default:
                    alert(e.responseText)
            }
        },
        parameters: {
            id: t
        }
    })
}


function privat_file() {
    if (document.getElementById("privat_file")) {
        var e = $("privat_file").checked ? "1" : "0";
        new Ajax.Request(url("ajax/msgaction"), {
            onSuccess: function (e) {
                alert(e.responseText);
            },
            postBody: "action=privat_file&status=" + e,
        });
    }
}
function privat_photo() {
    if (document.getElementById("privat_photo")) {
        var e = $("privat_photo").checked ? "1" : "0";
        new Ajax.Request(url("ajax/msgaction"), {
            onSuccess: function (e) {
                alert(e.responseText);
            },
            postBody: "action=allowphoto&status=" + e,
        });
    }
}
function show_msgs() {
    if (document.getElementById("show_msgs")) {
        var e = $("show_msgs").checked ? "1" : "0";
        new Ajax.Request("ajax/msgaction", {
            onSuccess: function (t) {
                var i = document.getElementById("chatinhalt");
                if ("1" == e) (i.innerHTML = ""), (i.style.backgroundImage = ""), (i.style.opacity = "0.5"), (i.style.backgroundColor = "rgb(68, 64, 64)");
                else {
                    var s = $thememanager.chat.chatinhalt;
                    "#fff" == s["background-color"] && (s["background-color"] = "transparent"),
                        (i.style.backgroundImage = "url(" + theme_url(s["background-image"]) + ")"),
                        (i.style.opacity = "1"),
                        (i.style.backgroundColor = s["background-color"]);
                }
            },
            postBody: "action=show_msgs&type=" + e,
        });
    }
}
function showmyrequest() {
    var showmyrequest = new Window({
        url: "ajax/chat.showmyrequest",
        title: "درخواست های شما",
        className: $win_style,
        width: 280,
        height: 340,
        top: eval($mouse.top - 100),
        left: eval($mouse.left + 100),
        resizable: !0,
        showEffect: Effect.Appear,
        hideEffect: Effect.DropOut,
        showEffectOptions: { duration: 0.5 },
        hideEffectOptions: { duration: 0.5 },
        draggable: !0,
        minimizable: !1,
        maximizable: !1,
        destroyOnClose: !1,
        opacity: 1,
    });
    showmyrequest.show();
}
function privat_Perm() {
    if (document.getElementById("privat_Perm")) {
        var e = $("privat_Perm").checked ? "1" : "0";
        new Ajax.Request("ajax/msgaction", {
            onSuccess: function (e) {
                alert(e.responseText);
            },
            postBody: "action=privat_perm&type=" + e,
        });
    }
}
function chack_allowchat(e) {
    for (i = 0; i < $usersObj.userOnline.length; i++)
        if ($usersObj.userOnline[i].ui == e) {
            var t = $usersObj.userOnline[i].pvstatus;
            break;
        }
    return getUser(), "open" == t;
}
function ScoreNameReporter(e) {
    new Ajax.Request(url("ajax/chat.reporter.score"), {
        onSuccess: function (e) {
            alert(e.responseText);
        },
        parameters: { id: e },
    });
}
function reportuser(e, t) {
    if (1 == e) var i = "report";
    else i = "delreport";
    $windows.admin_user[t].close(),
        new Ajax.Request(url("ajax/chat.user.report"), {
            onSuccess: function (e) {
                alert(e.responseText);
            },
            postBody: "userid=" + t + "&action=" + i,
        });
}
function stopreport(e, t) {
    if (1 == e) var i = "block";
    else i = "onblock";
    $windows.admin_user[t].close(),
        new Ajax.Request(url("ajax/chat.stop.report"), {
            onSuccess: function (e) {
                alert(e.responseText);
            },
            postBody: "userid=" + t + "&action=" + i,
        });
}
function removeMsg(e, t, i, s) {
    $("Dropdowns_" + s).hasClassName("showdropdowns") && $("Dropdowns_" + s).removeClassName("showdropdowns");
    var n = [];
    if ("delall" == i) {
        for (var a = $$("div[class^=msgnum_] > div[id=userid_" + e + "]"), o = 0; o < a.length; o++) n.push(parseInt(a[o].getAttribute("mid"))), a[o].remove();
        t = JSON.stringify(n);
    } else document.getElementsByClassName("msgnum_" + t)[0].remove(), n.push(t), (t = JSON.stringify(n));
    new Ajax.Request(url("ajax/clear"), { postBody: "id=" + e + "&msgid=" + t + "&action=" + i });
}
function SilentUser(e, t, i) {
    var s, n;
    $("Dropdowns_" + t).hasClassName("showdropdowns") && $("Dropdowns_" + t).removeClassName("showdropdowns");
    var a = prompt("کاربر چند دقيقه ساکت شود؟براي آزاد سازي 0 را وارد کنيد");
    if ("0" != a && "" != a && null != a && "true" == i) {
        n = "true" == i ? "1" : "2";
        for (var o = [], r = $$("div[class^=msgnum_] > div[id=userid_" + e + "]"), l = 0; l < r.length; l++) o.push(parseInt(r[l].getAttribute("mid")));
        s = JSON.stringify(o);
    } else s = "notdelmsg";
    new Ajax.Request(url("ajax/plugin"), {
        onSuccess: function (e) {
            switch (e.responseText) {
                case "ok":
                    for (var t = $$("div[class^=msgnum_] > div[id=userid_" + e + "]"), i = 0; i < t.length; i++) t[i].remove();
                    alert("کاربر با موفقيت به ليست ساکت شدگان اضافه شد");
                    break;
                case "no number":
                    alert("لطفا عدد وارد کنيد");
                    break;
                case "repeat":
                    alert("اين کاربر قبلا ساکت شده است");
                    break;
                default:
                    alert(e.responseText);
            }
        },
        postBody: "user=" + e + "&time=" + a + "&msgid=" + s + "&where=" + n + "&action=SilentUser",
    });
}
function BennUser(e, t) {
    var i, s;
    if (($("Dropdowns_" + t).hasClassName("showdropdowns") && $("Dropdowns_" + t).removeClassName("showdropdowns"), "true" == (0 == confirm("آيا از اخراج اين کاربر مطمئن هستيد؟") ? "false" : "true"))) {
        if ("" == (s = prompt("دليل اخراج را وارد کنيد")) || null == s) return alert("دليل اخراج الزامي ميباشد");
        for (var n = [], a = $$("div[class^=msgnum_] > div[id=userid_" + e + "]"), o = 0; o < a.length; o++) n.push(parseInt(a[o].getAttribute("mid"))), a[o].remove();
        (i = JSON.stringify(n)),
            new Ajax.Request(url("ajax/plugin"), {
                onSuccess: function (e) {
                    var t;
                    if ("pw" == e.responseText) {
                        if (null == (t = prompt("پسورد را وارد نماييد")) || "" == t) return !1;
                        new Ajax.Request(url("ajax/plugin"), {
                            onSuccess: function (e) {
                                "ok" == e.responseText ? (alert("انجام شد"), getUser()) : alert(e.responseText);
                            },
                            postBody: "user=" + e + "&reason=" + s + "&msgid=" + i + "&password=" + t + "&action=BennUser",
                        });
                    } else getUser(), "ok" == e.responseText ? (alert("انجام شد"), $windows.admin_user[id].close()) : alert(e.responseText);
                },
                postBody: "user=" + e + "&reason=" + s + "&msgid=" + i + "&action=BennUser",
            });
    }
}
function LoadHistory(e, t) {
    var i = 0;
    void 0 !== $LoadHistory_HISTORY[e] && (i = $LoadHistory_HISTORY[e]);
    var s = !0,
        n = $("history_loader_area_" + t),
        a = $("btn_loader_area_" + t),
        o = $$("#history_pivate_area_" + t + " > .last_" + $LoadHistory_HISTORY[e])[0];
    o || ((o = $("history_pivate_area_" + t)), (s = !1)),
        (n.innerHTML = "<center><img src='" + theme_url("theme/microblog/images/ajax-loader.gif?ver=1") + "'></center>"),
        new Ajax.Request(url("ajax/chat.loadhistory"), {
            onSuccess: function (i) {
                var r = i.responseJSON;
                if (((n.innerHTML = ""), 0 != r.count)) {
                    a.innerHTML = "نمايش بيشتر";
                    for (var l = 0; l < r.count; l++) {
                        var c,
                            d = $template.message_private_win,
                            m =
                                "0" != $me.admin && $me.id != r.message[l].user_id
                                    ? ' <span onclick=changeUserEvent("adminu_' +
                                      r.message[l].user_id +
                                      '") style="cursor:pointer"><img src="' +
                                      theme_url("theme/images/chat/chat.wand.png") +
                                      '" id="adminu_' +
                                      r.message[l].user_id +
                                      '" /></span>'
                                    : "",
                            p =
                                $me.id != r.message[l].user_id
                                    ? '<img src="' +
                                      theme_url("theme/images/chat/gozaresh.png") +
                                      '" onclick="report_text_2admins(\'' +
                                      r.message[l].user_id +
                                      "','" +
                                      r.message[l].text.replace(/<img[^>]*>|<a[^>]*>(.*?)<\/a>/g, "") +
                                      "','private')\" />"
                                    : "",
                            u = getType(r.message[l].priv),
                            g = '<img src="' + u.taj + '" align="absbottom" title="' + u.title + '" alt="' + u.title + '" />',
                            _ = $me.id == r.message[l].user_id ? '<img src="' + theme_url("theme/images/chat/tick.png") + '">' : "";
                        switch (r.message[l].sex) {
                            case "1":
                            case 1:
                                c = theme_url("theme/images/chat/chat.user_m.png");
                                break;
                            case "2":
                            case 2:
                                c = theme_url("theme/images/chat/chat.user_f.png");
                                break;
                            default:
                                c = theme_url("theme/images/chat/chat.user_n.png");
                        }
                        var f =
                                '<a target="_blank" href="' +
                                url("profile/" + r.message[l].user_id) +
                                '" /><img class="avatar" title="براي مشاهده پروفايل کليک کنيد" src="' +
                                theme_url($setting.avatardir + "/" + r.message[l].avatar) +
                                '" /></a><img src="' +
                                c +
                                '" />',
                            h = getRandom();
                        "{BUZZ}" == r.message[l].text && ((r.message[l].text = " BUZZ!!!"), (r.message[l].css = "color:red;font-weight:bold;font-family: arial;direction:ltr;")),
                            (DropDownWidths = 0),
                            (menus = ""),
                            ($setting.reply || $setting.forward) &&
                                ((menus = '<div class="dropdown">'),
                                (menus +=
                                    '<img style="cursor:pointer;" onclick="showDropDown(\'' +
                                    t +
                                    "_" +
                                    h +
                                    '\')" src="/theme/images/chat/replypm.png" class="dropbtn" /><div id="Dropdown_' +
                                    t +
                                    "_" +
                                    h +
                                    '" class="dropdown-content" style="width:[width]px"><div class="arrow"></div>'),
                                $setting.reply &&
                                    $me.reply &&
                                    ((DropDownWidths += 55),
                                    (menus +=
                                        '<a href="javascript:;" onclick="replymsg(\'' +
                                        t +
                                        "_" +
                                        h +
                                        "','pm','" +
                                        r.message[l].msgid +
                                        "','" +
                                        r.message[l].privat +
                                        "')\"><i class='fa fa-reply-all' style='margin-right: 2px;'></i> پاسخ</a>")),
                                $setting.forward &&
                                    $me.forward &&
                                    ((DropDownWidths += 55),
                                    (menus += '<a href="javascript:;" onclick="forwardmsg(\'' + t + "_" + h + "','" + r.message[l].msgid + "')\"><i class='fa fa-mail-forward' style='margin-right: 2px;'></i> ارسال</a>")),
                                (menus += "</div></div>"),
                                (menus = menus.replace(/\[width\]/gi, DropDownWidths))),
                            (d = r.message[l].hasOwnProperty("reply")
                                ? (d = (d = (d = (d = (d = (d = (d = (d = (d = (d = (d = (d = (d = $template.replymsg_private).replace(/\[1\]/gi, _ + p + m + f + g)).replace(/\[3\]/gi, r.message[l].user)).replace(
                                      /\[4\]/gi,
                                      r.message[l].css
                                  )).replace(/\[5\]/gi, r.message[l].reply.replace(/\(s(\d{1,4})\)/gi, numSmilies))).replace(/\[6\]/gi, r.message[l].text.replace(/\(s(\d{1,4})\)/gi, numSmilies))).replace(
                                      /\[7\]/gi,
                                      r.message[l].name
                                  )).replace(/\[msgid\]/gi, r.message[l].msgid)).replace(/\[10\]/gi, r.message[l].privat)).replace(/\[11\]/gi, "pm")).replace(/\[12\]/gi, "")).replace(/\[9\]/gi, t + "_" + h)).replace(
                                      /\[menus\]/gi,
                                      menus
                                  )).replace(/\[100\]/gi, UserClickable(r.message[l].user_id))
                                : r.message[l].hasOwnProperty("forward")
                                ? (d = (d = (d = (d = (d = (d = (d = (d = (d = $template.forwardmsg_private).replace(/\[1\]/gi, _ + p + m + f + g)).replace(/\[7\]/gi, UserClickable(r.message[l].user_id))).replace(
                                      /\[2\]/gi,
                                      r.message[l].user
                                  )).replace(/\[3\]/gi, r.message[l].css)).replace(/\[4\]/gi, r.message[l].forward.replace(/\(s(\d{1,4})\)/gi, numSmilies))).replace(/\[msgid\]/gi, r.message[l].msgid)).replace(
                                      /\[5\]/gi,
                                      r.message[l].name
                                  )).replace(/\[menus\]/gi, menus)).replace(/\[6\]/gi, t + "_" + h)
                                : (d = (d = (d = (d = (d = (d = (d = (d = (d = (d = d.replace(/\[0\]/gi, "-1" != r.message[l].user_id ? _ + m + p + f + g : "")).replace(/\[1\]/gi, r.message[l].user)).replace(
                                      /\[2\]/gi,
                                      r.message[l].css
                                  )).replace(/\[4\]/gi, t + "_" + h)).replace(/\[msgid\]/gi, r.message[l].msgid)).replace(/\[6\]/gi, r.message[l].privat)).replace(/\[100\]/gi, UserClickable(r.message[l].user_id))).replace(
                                      /\[7\]/gi,
                                      "pm"
                                  )).replace(/\[5\]/gi, "")).replace(/\[menus\]/gi, menus)).replace(/\[3\]/gi, r.message[l].text.replace(/\(s(\d{1,4})\)/gi, numSmilies)));
                        var $ = "<div class='last_" + r.last_id + "'>" + d + "</div>";
                        s ? o.insert({ before: $ }) : o.insert({ bottom: $ });
                    }
                    $LoadHistory_HISTORY[e] = r.last_id;
                } else (a.innerHTML = "پيامي براي نمايش وجود ندارد"), (a.disabled = !0), (a.style.background = "#e57373");
            },
            onFailure: function () {
                alert("خطايي رخ داده است !");
            },
            parameters: { to: e, msg_id: i },
        });
}
function delete_message(e, t, i, s) {
    if ((null == s && $("Dropdown_" + e).hasClassName("showdropdown") && $("Dropdown_" + e).removeClassName("showdropdown"), "myself" == t)) {
        if (!$setting.deletemessage) return alert("اين سيستم غيرفعال ميباشد"), !1;
        if (confirm("آيا مطمئن هستيد اين پيام حذف گردد؟")) {
            t = 0;
            try {
                t = $("msgcode_" + e)
                    .up()
                    .className.replace("msgnum_", "");
            } catch (e) {
                return;
            }
            var n,
                a = [];
            a.push(t),
                (n = JSON.stringify(a)),
                new Ajax.Request(url("ajax/plugin"), {
                    onSuccess: function (e) {
                        "ok" != e.responseText ? alert(e.responseText) : (document.getElementsByClassName("msgnum_" + t)[0].remove(), document.getElementsByClassName("ContextMenu" + t)[0].remove());
                    },
                    postBody: "msgid=" + n + "&action=DelMsg",
                });
        }
    } else alert("شما تنها مي توانيد پيام خود را پاک کنيد");
}
function update_message(e, t, i) {
    replyclose();
    var s,
        n,
        a,
        o = "msg";
    if ("myself" == t) {
        (s = $("message")),
            (n = s.value),
            (s.value = ""),
            (t = 0),
            "pmbox" ==
                (a = $("userName_" + e)
                    .up()
                    .up()
                    .className.replace("msgnum_", "")) &&
                ((a = $("userName_" + e)
                    .up()
                    .up()
                    .up()
                    .className.replace("msgnum_", "")),
                (o = "reply"));
        for (var r = 0; r != $smilies.smilies.length; r++) $smilies.smilies[r].hasOwnProperty("name") && (n = str_replace($smilies.smilies[r].name, $smilies.smilies[r].code, n));
        new Ajax.Request(url("ajax/plugin"), {
            onSuccess: function (t) {
                "ok" != t.responseText ? alert(t.responseText) : (($numsmiles = 0), ($("userText_" + e).innerHTML = n.replace(/\(s(\d{1,4})\)/gi, numSmilies) + ' <font color="green">[Edited]</font>'));
            },
            postBody: "id=" + a + "&msg=" + n + "&act=" + o + "&action=EidtMsg",
        });
    } else alert("شما تنها مي توانيد پيام خود را ويرايش کنيد");
}
function EditTextPriv(e, t, i) {
    function s(e, t) {
        replyclose();
        var i = $("message_win_" + e),
            s = i.value;
        i.value = "";
        for (var n = 0; n != $smilies.smilies.length; n++) $smilies.smilies[n].hasOwnProperty("name") && (s = str_replace($smilies.smilies[n].name, $smilies.smilies[n].code, s));
        var a = $("userText_priv_" + t)
            .up("div[class^=msgnum_]")
            .getAttribute("class");
        (a = a.substr(a.indexOf("_") + 1)),
            new Ajax.Request(url("ajax/plugin"), {
                onSuccess: function (e) {
                    "ok" != e.responseText ? alert(e.responseText) : (($numsmiles = 0), ($("userText_priv_" + t).innerHTML = s.replace(/\(s(\d{1,4})\)/gi, numSmilies) + ' <font color="green">[Edited]</font>'));
                },
                postBody: "id=" + a + "&msg=" + s + "&act=msg&action=EidtMsg",
            });
    }
    var n = $("Dropdown_" + e);
    if ((n.hasClassName("showdropdown") && n.removeClassName("showdropdown"), "myself" == i)) {
        var a = e.substr(0, e.indexOf("_")),
            o = $("userText_priv_" + e).textContent.replace("[Edited]", "");
        ($REPLY_LAST_ID = "message_win_" + a), new Effect.Highlight("message_win_" + a, { startcolor: "#5eb737", endcolor: "#ffffff", duration: 3 }), ($("replybox").style.display = "block"), (t = $("userText_priv_" + e).textContent);
        var r =
                ($("userName_priv_" + e).textContent,
                $("userAv_priv_" + e)
                    .select(".avatar")
                    .toArray()[0].outerHTML),
            l = $("userText_priv_" + e).select("img");
        if (0 != l.length) {
            o = $("userText_priv_" + e).outerHTML.match(/<span (.*?)>(.*?)<\/span>/i)[2];
            for (var c = 0; c < l.length; c++) o = o.replace(/<img (.*?)>/i, l[c].id).replace('<font color="green">[Edited]</font>', "");
        }
        ($("message_win_" + a).value = o), ($numsmiles = 0), ($("repAv").innerHTML = r), ($("repName").innerHTML = "ويرايش پيام"), ($("repText").innerHTML = t.replace(/\(s(\d{1,4})\)/gi, numSmilies).replace("[Edited]", ""));
        var d = $("win_form_" + a).onsubmit,
            m = $("submit_img_" + a).onclick;
        ($("win_form_" + a).onsubmit = function () {
            return s(a, e), ($("win_form_" + a).onsubmit = d), ($("submit_img_" + a).onclick = m), !1;
        }),
            ($("submit_img_" + a).onclick = function () {
                return s(a, e), ($("win_form_" + a).onsubmit = d), ($("submit_img_" + a).onclick = m), !1;
            });
    } else alert("شما تنها می توانید پیام خود را ویرایش کنید!");
}
function showDropDown(e) {
    $("Dropdown_" + e).toggleClassName("showdropdown"), $("Dropdowns_" + e).hasClassName("showdropdown") && $("Dropdowns_" + e).removeClassName("showdropdown");
}
function showDropDowns(e) {
    $("Dropdowns_" + e).hasClassName("showdropdown") && $("Dropdowns_" + e).removeClassName("showdropdown"),
        $("Dropdowns_" + e).toggleClassName("showdropdowns"),
        $("Dropdown_" + e).hasClassName("showdropdown") && $("Dropdown_" + e).removeClassName("showdropdown");
}
function editmsg(e, t, i, s) {
    if (($("Dropdown_" + e).hasClassName("showdropdown") && $("Dropdown_" + e).removeClassName("showdropdown"), !$setting.edittext)) return alert("اين سيستم غيرفعال ميباشد"), !1;
    if (0 != $me.silent) return alert("شما ساکت شده ايد!"), !1;
    if (1 == $me.guest) return alert("مهمان اجازه ندارد"), !1;
    if (0 != $setting.scoretosendmsg && $me.score < $setting.scoretosendmsg && "main" == t) return alert("امتياز شما کافي نميباشد"), !1;
    $("replybox").style.display = "block";
    var n,
        a,
        o,
        l = [],
        c = "userText_",
        d = "userName_",
        m = "userAv_";
    if (
        (($REPLY_LAST_ID = void 0 !== s ? ((c += "priv_"), (d += "priv_"), (m += "priv_"), (l = e.split("_")), $("message_win_" + l[0]).focus(), "message_win_" + l[0]) : ($("message").focus(), "message")),
        new Effect.Highlight($REPLY_LAST_ID, { startcolor: "#5eb737", endcolor: "#ffffff", duration: 3 }),
        (n = $(c + e).textContent),
        $(d + e).textContent,
        (a = $(m + e)
            .select(".avatar")
            .toArray()[0].outerHTML),
        0 != (o = $(c + e).select("img")).length)
    ) {
        n = $(c + e).outerHTML.match(/<span (.*?)>(.*?)<\/span>/i)[2];
        for (var p = 0; p < o.length; p++) n = n.replace(/<img (.*?)>/i, o[p].id).replace('<font color="green">[Edited]</font>', "");
    }
    switch ((($numsmiles = 0), ($("repAv").innerHTML = a), ($("repName").innerHTML = "ويرايش پيام"), ($("repText").innerHTML = n.replace(/\(s(\d{1,4})\)/gi, numSmilies).replace("[Edited]", "")), t)) {
        case "main":
            EditText(e, n, i, s);
            break;
        case "pm":
            $REPLY_PRIVATE_DATA.push({ key: l[0], val: s }), EditTextPriv(l[0], s, r, n);
            break;
        default:
            return alert("Error!"), replyclose(), !1;
    }
}
function EditText(e, t, i, s) {
    for (var n = t.replace("[Edited]", ""), a = 0; a != $smilies.smilies.length; a++) $smilies.smilies[a].hasOwnProperty("name") && (n = str_replace($smilies.smilies[a].code, $smilies.smilies[a].name, n));
    ($("message").value = n),
        ($("message_form").onsubmit = function () {
            return update_message(e, i, s), !1;
        }),
        ($("link_sagen").onclick = function () {
            return update_message(e, i, s), !1;
        });
}
function forwardmsg(e, t) {
    return (
        $("Dropdown_" + e).hasClassName("showdropdown") && $("Dropdown_" + e).removeClassName("showdropdown"),
        $setting.forward
            ? $me.forward
                ? 1 == $me.silent
                    ? (alert("ِشما ساکت شده ايد !"), !1)
                    : 1 == $me.guest
                    ? (alert("ِمهمان اجازه ندارد"), !1)
                    : 0 != $setting.scoretosendmsg && $me.score < $setting.scoretosendmsg && "main" == t
                    ? (alert("امتياز شما کافي نميباشد"), !1)
                    : (($("forwardBoxWindow").value = e),
                      ($("forwardBoxIdWindow").value = t),
                      ($("forwardBox").style.display = "block"),
                      ($("forwardSearchInput").value = ""),
                      forwardBoxSearch(),
                      ($("forwardBoxImageLoading").style.display = "none"),
                      new Effect.Highlight("forwardSearchInput", { startcolor: "#008000", endcolor: "#ffffff", duration: 3 }),
                      void $("forwardSearchInput").focus())
                : (alert("اين سيستم براي گروه کاربري شما غيرفعال شده است"), !1)
            : (alert("اين سيستم غيرفعال ميباشد"), !1)
    );
}
function forwardBoxSearch() {
    var e = $("forwardSearchInput").value;
    ($("forwardBoxImageLoading").style.display = "block"),
        ($("forwardResult").innerHTML = ""),
        $usersObj.rooms.forEach(function (e, t, i) {
            var s = $template.forwardUser;
            (s = (s = (s = s.replace("[0]", "room_" + e.ri)).replace("[1]", theme_url("theme/images/chat/roomsf.png"))).replace("[2]", e.rn)), $("forwardResult").insert(s);
        }),
        $usersObj.userOnline.forEach(function (t, i, s) {
            if (t.ui != $me.id && ("" == e || -1 < t.un.indexOf(e))) {
                var n = $template.forwardUser;
                (n = (n = (n = n.replace("[0]", "user_" + t.ui)).replace("[1]", theme_url($setting.avatardir + "/" + (void 0 === t.a ? $setting.defaultavatar : t.a)))).replace("[2]", t.un)), $("forwardResult").insert(n);
            }
        }),
        $usersObj.all_empty_rooms.forEach(function (e, t, i) {
            var s = $template.forwardUser;
            (s = (s = (s = s.replace("[0]", "room_" + e.room_id)).replace("[1]", theme_url("theme/images/chat/roomsf.png"))).replace("[2]", e.room)), $("forwardResult").insert(s);
        }),
        ($("forwardBoxImageLoading").style.display = "none");
}
function forwardBoxClose() {
    ($("forwardResult").innerHTML = ""), ($("forwardSearchInput").value = ""), ($("forwardBox").style.display = "none");
}
function forwardClickUser(e) {
    if ("" != e && void 0 !== e) {
        var t = e.split("_"),
            i = $("forwardBoxWindow").value,
            s = $("forwardBoxIdWindow").value;
        if ("" != i) {
            var n,
                a = t[0],
                o = "";
            if ("user" == a) var r = t[1];
            if ("room" == a) var l = t[1];
            n = void 0 === (t = i.split("_"))[1] ? t[0] : ((o = t[0]), t[1]);
            var c = $("userText_" + ("" == o ? "" : "priv_" + o + "_") + n).textContent,
                d = $("userName_" + ("" == o ? "" : "priv_" + o + "_") + n).textContent,
                m = "userText_" + ("" == o ? "" : "priv_");
            if (0 != (g = $(m + i).select("img")).length) {
                var p = $(m + i).outerHTML;
                c = (_ = p.match(/<span (.*?)>(.*?)<\/span>/i))[2];
                for (var u = 0; u < g.length; u++) c = c.replace(/<img (.*?)>/i, g[u].id).replace('<font color="green">[Edited]</font>', "");
            }
            if ((forwardBoxClose(), "room" == a && l != $("room").value)) alert("پيام مورد نظر در اتاق درخواستي فوروارد گرديد");
            else {
                var g = new Date(),
                    _ = ((p = "font-weight:" + $("bold").value + ";font-style:" + $("italic").value + ";color:" + $("color").value), new Array());
                void 0 !== $("fontsize") && (p += ";font-size:" + $("fontsize").value),
                    void 0 !== $("fontname") && (p += ";font-family:" + $("fontname").value),
                    (_.user = $me.username),
                    (_.msgid = s),
                    (_.user_id = $me.id),
                    (_.message = "Forwarded Message | " + ("room" == a ? "main" : "pm") + "|" + r),
                    (_.time = g.getHours() + ":" + g.getMinutes()),
                    (_.css = p),
                    (_.priv = $me.type),
                    (_.sex = $me.gender),
                    (_.type = "send"),
                    (_.avatar = $me.avatar),
                    (_.cf = "0"),
                    (_.forward = c),
                    (_.name = d),
                    "room" == a
                        ? ((_.id = $msgid), (_.privat = "0"), (_.into = "main"), (_.tid = "public_" + getRandom()))
                        : (changeUserEvent("privatwin_" + r), (_.id = ""), (_.privat = r), (_.into = "pm"), (_.tid = "private_" + getRandom())),
                    addmessage(_);
            }
            new Ajax.Request(url("ajax/chat.forward"), {
                onSuccess: function (e) {
                    ($("forwardBoxImageLoading").style.display = "none"),
                        "" != (t = e.getAllHeaders()) &&
                            (($(_.tid).src = theme_url("theme/images/chat/tick.png")),
                            "user" != a &&
                                "lin" != typeof e.responseText &&
                                ($(_.tid)
                                    .up("div")
                                    .up("div")
                                    .up("div")
                                    .addClassName("msgnum_" + e.responseText),
                                $(_.tid).up("div").up("div").up("div").removeClassName("msgnum_myself")),
                            "user" == a &&
                                "lin" != typeof e.responseText &&
                                ($(_.tid).parentNode.parentNode.parentNode.parentNode.addClassName("msgnum_" + e.responseText), $(_.tid).parentNode.parentNode.parentNode.parentNode.removeClassName("msgnum_myself")));
                },
                postBody: "name=" + d + "&text=" + c + "&id=" + r + "&msg=" + s + "&room=" + l,
            });
        } else alert("Error!");
    } else alert("Error!");
}
function load_settings(e) {
    if (e) {
        var t = $setup.evalJSON();
        ($Types = t.types),
		($setting.voicesetting = t.settings.voicesetting),
            ($setting.music_autoplay = t.settings.music_autoplay || false),
            ($setting.formsetting = t.settings.formsetting),
            ($OFFMSG = t.settings.offmsg),
            ($setting.forward = t.settings.forward),
            ($me.bank = t.me.bank),
            ($setting.chat_loadlastmsg = t.settings.chat_loadlastmsg),
            ($setting.Questionexit = t.settings.Questionexit),
            ($setting.winsize = t.settings.winsize),
            ($setting.winsizesmile = t.settings.winsizesmile),
            ($setting.winsizevip = t.settings.winsizevip),
            ($setting.winsizesitting = t.settings.winsizesitting),
            ($setting.deletemessage = t.settings.deletemsg),
            ($setting.edittext = t.settings.edittext),
            ($setting.theme = t.settings.theme),
            ($FONTLIST = "tahoma" == t.settings.fontlist ? "" : "font-family:" + t.settings.fontlist + ";"),
            ($setting.fontname = t.settings.fontname),
            ($setting.fontsize = t.settings.fontsize),
            ($setting.reply = t.settings.reply),
            ($setting.pluginreaction = t.settings.pluginreaction),
            ($setting.plugintyping = t.settings.plugintyping),
           ($setting.pluginadsvideo = t.settings.pluginadsvideo),
           ($setting.plugingroupsmile = t.settings.plugingroupsmile),
          ($setting.sizeofsmile=t.settings.sizeofsmile),
            ($setting.omomi = t.settings.omomi),
            ($setting.textcolor = t.settings.textcolor),
            ($setting.status_private = "pmme" == t.settings.status_private),
            ($setting.status_cf = "reqme" == t.settings.status_cf),
            ($setting.block_request2addf = "reqme" == t.settings.block_request2addf),
            ($setting.block_video_audio_chat = "reqme" == t.settings.block_video_audio_chat),
            ($setting.scoretosendmsg = t.settings.scoretosendmsg),
            ($setting.speedtext = t.settings.speedtext),
            ($setting.sendmsguest = t.settings.sendmsguest),
            ($setting.repeatmsg = t.settings.repeatmsg),
            ($setting.SmiliespMsg = t.settings.SmiliespMsg),
            ($setting.maxlengthmsg = t.settings.maxlengthmsg),
            ($setting.thumbavatar = t.settings.thumbavatar),
            ($setting.avatardir = t.settings.avatardir),
            ($setting.listplusonline = t.settings.listplusonline),
            ($setting.defaultavatar = t.settings.defaultavatar),
            ($setting.timemsg = t.settings.timemsg),
            ($setting.timemsgpv = t.settings.timemsgpv),
            ($setting.showubrowseronlist = t.settings.showubrowseronlist),
            ($setting.profile_enable = t.settings.profile_enable),
            ($setting.reg_btn = t.settings.reg_btn),
            ($setting.allowchat = t.settings.allowchat),
            ($setting.numsgmain = t.settings.numsgmain),
            ($setting.colorlistonline = t.settings.colorlistonline),
            ($setting.cdn = t.settings.cdn),
            ($setting.useroptions = t.settings.useroptions),
            ($setting.advcreg = t.settings.advcreg),
            ($setting.roomstyle = t.settings.roomstyle),
            ($setting.chpw = t.settings.chpw),
            ($setting.socialitems = t.settings.socialitems),
            ($setting.sideitems = t.settings.sideitems),
            ($setting.mainitems = t.settings.mainitems),
            ($setting.staticreg = t.settings.staticreg),
            ($setting.allowonlinelist = t.settings.allowonlinelist),
            ($setting.shoavataronlist = t.settings.shoavataronlist),
            ($me.score = t.me.score),
            ($me.username = t.me.username),
            ($me.type = t.me.type),
            ($me.typing = t.me.typing),
            ($me.gender = t.me.gender),
            ($me.id = t.me.id),
            ($me.forward = t.me.forward),
            ($me.delmsg = t.me.delmsg),
            ($me.edittext = t.me.editmsg),
            ($me.reactmsg = t.me.reactmsg),
            ($me.avatar = t.me.avatar),
            ($me.reply = t.me.reply),
            ($me.admin = getType($me.type).admin),
            ($me.guest = getType($me.type).guest);
    } else
        new Ajax.Request(url("ajax/chat.setup"), {
            onSuccess: function (e) {
                (e = e.responseJSON),
                    ($Types = e.types),
                    ($setting.theme = e.settings.theme),
                    ($me.bank = e.me.bank),
                    ($setting.fontname = t.settings.fontname),
                    ($setting.fontsize = t.settings.fontsize),
                    ($setting.textcolor = e.settings.textcolor),
                    ($setting.scoretosendmsg = e.settings.scoretosendmsg),
                    ($setting.speedtext = e.settings.speedtext),
                    ($setting.sendmsguest = e.settings.sendmsguest),
                    ($setting.repeatmsg = e.settings.repeatmsg),
                    ($setting.SmiliespMsg = e.settings.SmiliespMsg),
                    ($setting.maxlengthmsg = e.settings.maxlengthmsg),
                    ($setting.thumbavatar = e.settings.thumbavatar),
                    ($setting.avatardir = e.settings.avatardir),
                    ($setting.listplusonline = e.settings.listplusonline),
                    ($setting.defaultavatar = e.settings.defaultavatar),
                    ($setting.timemsg = e.settings.timemsg),
                    ($setting.profile_enable = e.settings.profile_enable),
                    ($setting.reg_btn = e.settings.reg_btn),
                    ($setting.numsgmain = e.settings.numsgmain),
                    ($setting.useroptions = e.settings.useroptions),
                    ($setting.colorlistonline = e.settings.colorlistonline),
                    ($setting.cdn = e.settings.cdn),
                    ($me.score = e.me.score),
                    ($me.username = e.me.username),
                    ($me.type = e.me.type),
                    ($me.gender = e.me.gender),
                    ($me.id = e.me.id),
                    ($me.avatar = e.me.avatar),
                    ($me.admin = getType($me.type).admin),
                    ($me.guest = getType($me.type).guest);
            },
        });
}
function TarhPardazIcons(e, t) {
    if ($setting.hideIcons) {
        for (var i = e.childNodes, s = i[0].getElementsByTagName("span")[0], n = 0; n < i[0].getElementsByTagName("img").length; n++)
            if ("replycls" == i[0].getElementsByTagName("img")[n].className) {
                i[0].getElementsByTagName("img")[n].style.display = t;
                break;
            }
        for (n = 0; n < s.childNodes.length; n++)
            switch (s.childNodes[n].className) {
                case "adminwand":
                    s.childNodes[n].style.display = t;
                    break;
                case "reportcls":
                    s.childNodes[n].style.display = t;
            }
    }
}
function showpending() {
    setTimeout(function () {
        var showpending = new Window({
            url: "ajax/chat.pending",
            title: "درخواست هاي دوستي تاييد نشده",
            className: $win_style,
            width: 350,
            height: 205,
            top: eval($temp.offsetTop - 400),
            left: eval($temp.offsetLeft - 200),
            resizable: !0,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        });
        showpending.show();
    }, 2e3);
}
function listlikecm() {
    setTimeout(function () {
        var listlikecm = new Window({
            url: "ajax/chat.social?action=likecm",
            title: "آخرین لایک ها و نظرات",
            className: $win_style,
            width: 650,
            height: 305,
            top: eval($temp.offsetTop - 400),
            left: eval($temp.offsetLeft - 200),
            resizable: !0,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        });
        listlikecm.show();
    }, 2e3);
}
function offMsg() {
    setTimeout(function () {
        var myoffbox = new Window({
            url: url("ajax/chat.offline.message"),
            title: "پيام هاي آفلاين",
            className: $win_style,
            width: 260,
            height: 350,
            top: eval($temp.offsetTop + Math.round(50 * Math.random())),
            left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
            resizable: !0,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        });
        myoffbox.show();
    }, 2e3);
}
function chatinhaltScroll() {
    var e = $("chatinhalt");
    e.onscroll = function () {
        $CHECK_AUTO_SCROLL = !(e.scrollTop + window.innerHeight <= e.scrollHeight);
    };
}
function _notify(e, t) {
    e.user = e.hasOwnProperty("cfname") ? e.cfname : e.user;
    try {
        $setting.window_status_s &&
            "hidden" == $setting.window_status &&
            notify(e.message.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ""), theme_url($setting.avatardir + "/" + e.avatar), " " + t + " " + e.user.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ""));
    } catch (e) {
        console.log(e);
    }
}
function UserClickable(e) {
    return $me.id != e ? "onclick='changeUserEvent(\"inflblock_" + e + '")\' style="cursor:pointer;"' : "";
}
function replymsg(e, t, i, s) {
    var n, a, o, r;
    if (($("Dropdown_" + e).hasClassName("showdropdown") && $("Dropdown_" + e).removeClassName("showdropdown"), !$setting.reply)) return alert("اين سيستم غيرفعال ميباشد"), !1;
    if (!$me.reply) return alert("اين سيستم براي گروه کاربري شما غيرفعال شده است"), !1;
    if (1 == $me.silent) return alert("ِشما ساکت شده ايد !"), !1;
    if (0 != $setting.scoretosendmsg && $me.score < $setting.scoretosendmsg && "main" == t) return alert("امتياز شما کافي نميباشد"), !1;
    $("replybox").style.display = "block";
    var l = [],
        c = "userText_",
        d = "userName_",
        m = "userAv_";
    ($REPLY_LAST_ID = void 0 !== s ? ((c = "userText_priv_"), (d = "userName_priv_"), (m = "userAv_priv_"), (l = e.split("_")), $("message_win_" + l[0]).focus(), "message_win_" + l[0]) : ($("message").focus(), "message")),
        new Effect.Highlight($REPLY_LAST_ID, { startcolor: "#FA0000", endcolor: "#ffffff", duration: 3 });
  
         var u = $(d + e).textContent;
        g = $(m + e)
            .select(".avatar")
            .toArray()[0].outerHTML,
        _ = $(c + e).select("img");



  var med=$(c+e).hasAttribute("type");
  if(med){
    
    var typemed=$(c+e).childNodes[0].getAttribute('media');
   if(typemed=="image"){var result='<img style="width:50px; height:50px;" src="'+$(c+e).childNodes[0].childNodes[0].getAttribute("src")+'">'}
          else if(typemed=="music"){var result='<audio style="width:150px; height:30px;" controls><source src="'+$(c+e).childNodes[0].childNodes[0].getAttribute("src")+'" type="audio/mpeg"></audio>'}
           else if(typemed=="video"){var result='<video style="width:50px; height:50px;" src="'+$(c+e).childNodes[0].childNodes[0].getAttribute("src")+'"></video>'}
            else {var result='<a target="_blank" href="'+$(c+e).childNodes[0].childNodes[0].getAttribute("src")+'">فایل شما </a>'}
  
  var p=result;  
    $("repText").innerHTML=p
   var ty="media";
    var tyme=typemed;
    var mesrep=$(c+e).childNodes[0].childNodes[0].getAttribute("src");
  }
  if (!med){
  var p = $(c + e).textContent.replace("[Edited]", ""); 
     
     if (0 != _.length) {
        for (n = $(c + e).outerHTML, find = n.match(/<span (.*?)>(.*?)<\/span>/i), p = find[2], a = 0; a < _.length; a++) p = p.replace(/<img (.*?)>/i, _[a].id).replace('<font color="green">[Edited]</font>', "");
        "-1" != find[2].search("nocheck") && "" != (o = find[2].match(/src="(.*?)"/i))[1] && (p= '<img width="50" height="50" id="nocheck" src="' + o[1] + '">');
    }
     
     $("repText").innerHTML=p
  var ty="text";  
    var tyme="text";
    var mesrep=p;
  }
  var qq=mesrep;
  var tq= ty;
  var tm=tyme;


    switch ((($numsmiles = 0), ($("repAv").innerHTML = g), ($("repName").innerHTML = u), ((r = []).msg = qq), (r.name = u), (r.msgid = i),(r.tytx=tq),(r.tymed=tm), t)) {
        case "main":
            initSend(r);
            break;
        case "pm":
            $REPLY_PRIVATE_DATA.push({ key: l[0], val: s }), initSend2Priv(l[0], s, r);
            break;
        case "cf":
            $REPLY_CF_DATA.push({ key: l[0], val: s }), initSend2CF(l[0], s, r);
            break;
        default:
            return alert("Error!"), replyclose(), !1;
    }
}
function getRandom(e) {
    for (var t = "", i = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s = void 0 === e ? 15 : e; 0 < s; --s) t += i[Math.floor(Math.random() * i.length)];
    return t;
}
function initSend(e) {
    void 0 === e && (e = "n"),
        ($("message_form").onsubmit = function () {
            return send(e);
        }),
        ($("link_sagen").onclick = function () {
            return send(e);
        });
}
function initSend2Priv(e, t, i) {
    void 0 !== i
        ? (($("win_form_" + e).onsubmit = function () {
              return send2privatwin("message_win_" + e, t, i);
          }),
          ($("submit_img_" + e).onclick = function () {
              return send2privatwin("message_win_" + e, t, i);
          }))
        : (($("win_form_" + e).onsubmit = function () {
              return send2privatwin("message_win_" + e, t);
          }),
          ($("submit_img_" + e).onclick = function () {
              return send2privatwin("message_win_" + e, t);
          }));
}
function initSend2CF(e, t, i) {
    void 0 !== i
        ? (($("win_form_" + e).onsubmit = function () {
              return send2cf("message_win_" + e, t, 0, i);
          }),
          ($("submit_img_" + e).onclick = function () {
              return send2cf("message_win_" + e, t, 0, i);
          }))
        : (($("win_form_" + e).onsubmit = function () {
              return send2cf("message_win_" + e, t, 0);
          }),
          ($("submit_img_" + e).onclick = function () {
              return send2cf("message_win_" + e, t, 0);
          }));
}
function replyclose() {
    $("replybox").hide(), initSend(), destroyAllReplys(), $($REPLY_LAST_ID).focus();
}
function destroyAllReplys() {
    for (var e = 0; e < $REPLY_PRIVATE_DATA.length; e++) initSend2Priv($REPLY_PRIVATE_DATA[e].key, $REPLY_PRIVATE_DATA[e].val);
    for (e = 0; e < $REPLY_CF_DATA.length; e++) initSend2CF($REPLY_CF_DATA[e].key, $REPLY_CF_DATA[e].val);
    ($REPLY_PRIVATE_DATA = []), ($REPLY_CF_DATA = []);
}
function isNumeric(e) {
    return !isNaN(parseFloat(e)) && isFinite(e);
}
function getUser() {
    ReloaderUserOnline(!0);
}
function getType(e) {
    for (var t = 0; t != $Types.length; t++) if ($Types[t].id == e) return $Types[t];
    return (
        new Ajax.Request(url("ajax/chat.setup"), {
            onSuccess: function (t) {
                (t = e.responseJSON), ($Types = t), ($me.admin = getType($me.type).admin), ($me.guest = getType($me.type).guest);
                for (var i = 0; i != $Types.length; i++) if ($Types[i].id == e) return $Types[i];
            },
        }),
        !1
    );
}
function loadads() {
    for (var e, t, i, s = 0; s != $codes.ads.length; s++)
        switch ($codes.ads[s].type) {
            case "fixedbanner":
                switch ($codes.ads[s].location) {
                    case "top-right":
                        e = "right:0;top:0";
                        break;
                    case "top-left":
                        e = "left:0;top:0";
                        break;
                    case "bottom-left":
                        e = "left:0;bottom:0";
                        break;
                    case "bottom-right":
                        e = "right:0;bottom:0";
                }
                (t = ""),
                    "true" == $codes.ads[s].inputs.closeable &&
                        (t = "<div onclick=\"this.parentNode.style.display = 'none';\" style='background: #acc531;cursor: pointer;border: solid 1px;font-size:12px;text-align: center;' >بستن [x]</div>"),
                    (i =
                        '<div id="ad-' +
                        $codes.ads[s].id +
                        '" style="position: fixed;' +
                        e +
                        ';background-color:transparent; z-index: 1000;">' +
                        t +
                        '<a target="_blank" href="' +
                        $codes.ads[s].url +
                        '"><img src="' +
                        theme_url($codes.ads[s].inputs.banner) +
                        '" border="0"></a></div>'),
                    $(document.body).insert({ bottom: i });
                break;
            case "banner":
                "top" == $codes.ads[s].location && 0 == isset_dom("bannerrow" + $codes.ads[s].location)
                    ? $("kopf").insert({ before: "<p id='bannerrow" + $codes.ads[s].location + "' style='text-align:center'></p>" })
                    : "bottom" == $codes.ads[s].location && 0 == isset_dom("bannerrow" + $codes.ads[s].location) && $("form").insert({ after: "<p id='bannerrow" + $codes.ads[s].location + "' style='text-align:center'></p>" }),
                    (i = ' <a target="_blank" href="' + $codes.ads[s].url + '"><img src="' + theme_url($codes.ads[s].inputs.banner) + '" border="0"></a>'),
                    $("bannerrow" + $codes.ads[s].location).insert({ bottom: i });
        }
}
function loadcodes() {
    for (var e = 0; e != $codes.codes.length; e++)
        "top" == $codes.codes[e].location ? $(document.body).insert({ top: $codes.codes[e].code }) : "bottom" == $codes.codes[e].location && $(document.body).insert({ bottom: $codes.codes[e].code });
}
function thememanager() {
    var e,
        t,
        i = $thememanager.chat.chatinhalt;
    "#fff" == i["background-color"] && (i["background-color"] = "transparent"),
        ((e = document.getElementById("chatinhalt")).style.backgroundImage = "url(" + theme_url(i["background-image"]) + ")"),
        (e.style.backgroundRepeat = i["background-repeat"]),
        (e.style.backgroundColor = i["background-color"]),
        (e.style.fontFamily = i["font-family"]),
        (e.style.fontSize = i["font-size"]),
        (e.style.boxShadow = i["box-shadow"]),
        (e.style.borderRadius = i["border-radius"]),
        (e.style.border = i.border),
        "right" == i.float &&
            ((e.style.direction = "rtl"),
            (document.getElementById("onlinelist").style.cssFloat = "left"),
            (document.getElementById("splitpane").style.cssFloat = "left"),
            (document.getElementById("form_left").style.cssFloat = "right"),
            (document.getElementById("form_right").style.cssFloat = "right"),
            (document.getElementById("message_form").style.direction = "rtl")),
        "#fff" == (i = $thememanager.chat.onlinelist)["background-color"] && (i["background-color"] = "transparent"),
        ((e = document.getElementById("onlinelist")).style.backgroundImage = "url(" + theme_url(i["background-image"]) + ")"),
        (e.style.backgroundRepeat = i["background-repeat"]),
        (e.style.backgroundColor = i["background-color"]),
        (e.style.border = i.border),
        (e.style.fontFamily = i["font-family"]),
        (e.style.fontSize = i["font-size"]),
        (e.style.boxShadow = i["box-shadow"]),
        (e.style.borderRadius = i["border-radius"]),
        void 0 !== i.width && (e.style.width = i.width),
        "#fff" == (i = $thememanager.chat.form)["background-color"] && (i["background-color"] = "transparent"),
        ((e = document.getElementById("form")).style.backgroundImage = "url(" + theme_url(i["background-image"]) + ")"),
        (e.style.backgroundRepeat = i["background-repeat"]),
        (e.style.backgroundColor = i["background-color"]),
        (e.style.border = i.border),
        (e.style.fontFamily = i["font-family"]),
        (e.style.fontSize = i["font-size"]),
        (e.style.boxShadow = i["box-shadow"]),
        (e.style.borderRadius = i["border-radius"]),
        (i = $thememanager.chat.body),
        ((e = document.body).style.backgroundImage = "url(" + theme_url(i["background-image"]) + ")"),
        (e.style.backgroundRepeat = i["background-repeat"]),
        (e.style.border = i.border),
        (e.style.backgroundColor = i["background-color"]),
        (i = $thememanager.chat["form-icons"]),
        document.getElementById("link_sagen").setAttribute("src", theme_url(i["icon-send"])),
        "list" == $setting.formsetting.offmsg && document.getElementById("link_offlinemsg").setAttribute("src", theme_url(i["icon-offlinemsg"])),
	    "list" == $setting.formsetting.voice && document.getElementById("link_voice").setAttribute("src", theme_url(i["icon-voice"])),
        document.getElementById("link_smileys").setAttribute("src", theme_url(i["icon-smilies"])),
        document.getElementById("link_color").setAttribute("src", theme_url(i["icon-fonts"])),
        document.getElementById("link_prop").setAttribute("src", theme_url(i["icon-settings"])),
        document.getElementById("link_vip").setAttribute("src", theme_url(i["icon-vip"])),
        "list" == $setting.formsetting.userscore && document.getElementById("link_ranks").setAttribute("src", theme_url(i["icon-ranks"])),
        "list" == $setting.formsetting.gameonline && document.getElementById("link_game").setAttribute("src", theme_url(i["icon-game"])),
        "list" == $setting.formsetting.addimage && document.getElementById("add_image").setAttribute("src", theme_url(i["icon-image"])),
        document.getElementById("link_eraser") && document.getElementById("link_eraser").setAttribute("src", theme_url(i["icon-eraser"])),
        document.getElementById("link_admin") && document.getElementById("link_admin").setAttribute("src", theme_url(i["icon-panel"])),
        document.getElementById("link_logout").setAttribute("src", theme_url(i["icon-logout"])),
        $setting.header && ((t = "<p style='text-align:center'><img src='" + theme_url($thememanager.chat.header.src) + "' border='0' alt=''></p>"), (document.body.innerHTML = t + document.body.innerHTML)),
        (t =
            "<style>.rooms,.rooms_not_allowed{    background-image:url(" +
            theme_url((i = $thememanager.chat.rooms)["background-image"]) +
            ");    background-repeat:" +
            i["background-repeat"] +
            ";    background-color:" +
            i["background-color"] +
            ";    font-family:" +
            i["font-family"] +
            ";    font-size:" +
            i["font-size"] +
            ";    font-weight:" +
            i["font-weight"] +
            ";    color:" +
            i.color +
            ";    box-shadow:" +
            i["box-shadow"] +
            ";    border-radius:" +
            i["border-radius"] +
            ";   border:" +
            i.border +
            ";}</style>"),
        $(document.body).insert({ top: t });
}
function add_banks() {
    var e;
    1 == window.confirm("شما با افزودن موجودي خود ميتوانيد در چتروم اقدام به خريد کنيد \n اما از امتياز شما کاسته ميشود\n آيا موافقيد؟")
        ? null != (e = prompt("مقدار موجودي خود را انتخاب کنيد")) &&
          "" != e &&
          (new Ajax.Request("ajax/chat.addbank", {
              onSuccess: function (e) {
                  alert(e.responseText);
              },
              postBody: "add_bank=add_bank&bank=" + e + "&token=" + $setting.chpw,
          }),
          $windows.vip.close())
        : $windows.vip.close();
}
function dragSplitpane() {
    var Offset,
        wi,
        dragspliter = new Draggable("splitpane", {
            constraint: "horizontal",
            zindex: 0,
            snap: function (x, y) {
                var v = Offset - $("splitpane").offsetLeft;
                return (v = eval(v) + wi), v <= 0 && 0 < x ? [0, y] : [x, y];
            },
            onStart: function () {
                (Offset = $("splitpane").offsetLeft), (wi = eval($("onlinelist").getStyle("width").replace(/px/g, "")));
            },
            onDrag: function () {
                var verschiebung = Offset - $("splitpane").offsetLeft;
                (verschiebung = eval(verschiebung) + wi), verschiebung <= 0 && (verschiebung = 0), $("onlinelist").setStyle({ width: verschiebung + "px" });
            },
            onEnd: function () {
                $("splitpane").setStyle({ left: "0px" });
            },
            revert: !1,
        });
}
function TarhPardaz_Js() {
    ($get_message_req = !1),
        ($thememanager = $thememanager.evalJSON()),
        ($setting.privat_anzeige = $("privat_anzeige").innerHTML),
        load_settings(!0),
        ($setting.window_status = "active"),
        ifvisible.on("statusChanged", function (e) {
            $setting.window_status = e.status;
        }),
        AjaxReadRequest(),
        ReloaderUserOnline(),
        setInterval(checkreload, 1e4),
        $("form_right").insert({ top: $template.form_icons }),
        window_height(),
        setInterval(window_height, 500),
        ($("chatinhalt").style.wordWrap = "break-word"),
        thememanager(),
        $("message").setAttribute("autocomplete", "off"),
        $("message").focus(),
        ($("message_form").onsubmit = function () {
            return send();
        }),
        ($("link_sagen").onclick = function () {
            return send();
        }),
        ($("link_vip").onclick = function () {
            if ("object" != typeof $windows.vip) {
                $windows.vip = new Window({
                    className: $win_style,
                    width: 280,
                    height: 350,
                    top: eval($mouse.top - 215),
                    left: eval($mouse.left - 140),
                    resizable: !1,
                    showEffect: Effect.Appear,
                    hideEffect: Effect.DropOut,
                    showEffectOptions: { duration: 0.5 },
                    hideEffectOptions: { duration: 0.5 },
                    draggable: !0,
                    minimizable: !1,
                    maximizable: !1,
                    destroyOnClose: !1,
                    opacity: 1,
                });
                var $code = $template.vip_list;
                ($code = $code.replace(/\[0\]/gi, theme_url("theme/images/chat/chat.add_image.png"))),
				 ($code = $code.replace(/\[voicechat\]/gi, theme_url("theme/images/chat/voicechat.png"))),
                    ($code = $code.replace(/\[1\]/gi, theme_url("theme/images/chat/chat.add_link.png"))),
                    ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/chat.buy_score.png"))),
                    ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/chat.user_details.png"))),
                    ($code = $code.replace(/\[4\]/gi, theme_url("theme/images/chat/chat.user_delete_file.png"))),
                    ($code = $code.replace(/\[5\]/gi, theme_url("theme/images/chat/chat.buy_room.png"))),
                    ($code = $code.replace(/\[6\]/gi, theme_url("theme/images/chat/chat.buy_type.png"))),
                    ($code = $code.replace(/\[music\]/gi, url("theme/images/chat/chat.add_music.png"))),
                    ($code = $code.replace(/\[film\]/gi, url("theme/images/chat/chat.add_film.png"))),
                    ($code = $code.replace(/\[7\]/gi, url("theme/images/chat/cuteuser.png"))),
                    ($code = $code.replace(/\[8\]/gi, url("theme/images/chat/chat.love.png"))),
                    ($code = $code.replace(/\[9\]/gi, url("theme/images/chat/chat.sendscore.png"))),
                    ($code = $code.replace(/\[10\]/gi, url("theme/images/chat/chat.fal.png"))),
                    ($code = $code.replace(/\[11\]/gi, url("theme/images/chat/addbank.png"))),
                    ($code = $code.replace(/\[12\]/gi, url("theme/images/chat/cmd.png"))),
                    ($code = $code.replace(/\[13\]/gi, url("theme/images/chat/offlinemsg.png"))),
                    ($code = $code.replace(/\[14\]/gi, url("theme/images/chat/comment.png"))),
                    ($code = $code.replace(/\[15\]/gi, url("theme/images/chat/addurlpriv.png"))),
                    ($code = $code.replace(/\[01\]/gi, "/theme/images/bg/bg804.png")),
                    ($code = $code.replace(/\[02\]/gi, "/theme/images/bg/bg3870.png")),
                    ($code = $code.replace(/\[03\]/gi, "/theme/images/chat/offlinemsg.png")),
                    $windows.vip.setHTMLContent($code),
                    $windows.vip.setHTMLContent($code),
				    in_array($me.type, $setting.voicesetting.main) && "vip" == $setting.formsetting.voice ? ($("sendVoice").onclick = function () {
                     voicechat("main", "-1", "عمومی"), $windows.vip.close()
                    }) : $("sendVoice").remove(),
                    in_array($me.type, $setting.useroptions.send_image) && "vip" == $setting.formsetting.addimage
                        ? ($("add_image").onclick = function () {
                              return 1 == $me.guest ? alert("مهمان اجازه ارسال عکس ندارد") : self.makeUploadMain();
                          })
                        : $("add_image").remove(),
                    ($("upload_avatar").onclick = function () {
                        var win_uploadavatar = new Window({
                            url: "ajax/chat.upload.avatar",
                            title: "آپلود آواتار",
                            className: $win_style,
                            width: 260,
                            height: 200,
                            top: eval($mouse.top - 260),
                            left: eval($mouse.left - 140),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        win_uploadavatar.show(), $windows.vip.close();
                    }),
                    ($("add_smile").onclick = function () {
                        var win_add_smile = new Window({
                            url: "ajax/chat.smile.upload",
                            title: "افزودن شکلک شحصی",
                            className: $win_style,
                            width: 260,
                            height: 350,
                            top: eval($mouse.top - 260),
                            left: eval($mouse.left - 140),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        win_add_smile.show(), $windows.vip.close();
                    }),
                    in_array($me.type, $setting.useroptions.users) && "vip" == $setting.formsetting.userscore
                        ? ($("link_ranks").onclick = function () {
                              window.open(url("users/rank"), "_blank"), $windows.vip.close();
                          })
                        : $("link_ranks").remove(),
                    in_array($me.type, $setting.useroptions.game) && "vip" == $setting.formsetting.gameonline
                        ? ($("link_game").onclick = function () {
                              window.open(url("game"), "_blank"), $windows.vip.close();
                          })
                        : $("link_game").remove(),
                    "vip" == $setting.formsetting.offmsg
                        ? ($("link_offlinemsg").onclick = function () {
                              var win_offlinemsgs = new Window({
                                  url: "ajax/chat.offline.message",
                                  title: "پيام هاي آفلاين",
                                  className: $win_style,
                                  width: 260,
                                  height: 350,
                                  top: eval($mouse.top - 400),
                                  left: eval($mouse.left - 140),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  maximizable: !1,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_offlinemsgs.show(), $windows.vip.close();
                          })
                        : $("link_offlinemsg").remove(),
                    in_array($me.type, $setting.useroptions.cmd)
                        ? ($("link_executecommand").onclick = function () {
                              var win_executecommand = new Window({
                                  url: "ajax/chat.cmd",
                                  title: "اجراي دستورات",
                                  className: $win_style,
                                  width: 560,
                                  height: 350,
                                  top: eval($mouse.top - 400),
                                  left: eval($mouse.left - 140),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.Fade,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  maximizable: !1,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_executecommand.show(), $windows.vip.close();
                          })
                        : $("link_executecommand").remove(),
                    in_array($me.type, $setting.useroptions.send_link)
                        ? ($("add_link").onclick = function () {
                              if (1 == $me.guest) return alert("مهمان اجازه ارسال لينک ندارد");
                              var e,
                                  t = "";
                              return null == (e = window.prompt("افزودن آدرس لينک \nبا http:// وارد نماييد"))
                                  ? ($windows.vip.close(), !1)
                                  : null == (t = window.prompt("افزودن متن لينک:"))
                                  ? ($windows.vip.close(), !1)
                                  : null == e || null == t
                                  ? ($windows.vip.close(), !1)
                                  : "" == e || "" == t
                                  ? ($windows.vip.close(), alert("ورودي ها نبايد خالي باشند"))
                                  : void new Ajax.Request("ajax/chat.vip", {
                                        onSuccess: function (i) {
                                            switch (i.responseText) {
                                                case "ok":
                                                    alert("ارسال شد"), ($("chatinhalt").innerHTML += 'لينک شما: <a style="color:red;" href="' + e + '" target="_blank"/>' + t + "</a><br />");
                                                    break;
                                                default:
                                                    alert(i.responseText);
                                            }
                                        },
                                        postBody: "switch=send_url&url=" + e + "&text=" + t + "&token=" + $setting.chpw,
                                    });
                          })
                        : $("add_link").remove(),
                    ($("buy_score").onclick = function () {
                        return 1 == $me.guest ? alert("مهمان اجازه خريد امتياز ندارد") : (window.open(url("buyscore"), "_blank", "height=600,width=870,resizable=no,scrollbars=yes,toolbar=no,titlebar=no"), void $windows.vip.close());
                    }),
                    in_array($me.type, $setting.useroptions.allow_removeimages)
                        ? ($("remove_images").onclick = function () {
                              new Ajax.Request(url("ajax/chat.rmimages"), {
                                  onSuccess: function (e) {
                                      alert(e.responseText);
                                  },
                              }),
                                  $windows.vip.close();
                          })
                        : $("remove_images").remove(),
                    ($("buy_room").onclick = function () {
                        return 1 == $me.guest
                            ? alert("مهمان اجازه خريد اتاق ندارد")
                            : null == (e = window.prompt("اسم اتاق")) || "" == e
                            ? ($windows.vip.close(), alert("ورودي ها نبايد خالي باشند"))
                            : null == (t = window.prompt("ميخواهيد مثل يک مدير در اتاق خود بر روي کاربران کنترل داشته باشيد؟\nاگر ميخواهيد عدد 1 را وارد کنيد در غير اينصورت عدد 0 را وارد نماييد")) || "" == t
                            ? ($windows.vip.close(), alert("ورودي ها نبايد خالي باشند"))
                            : null == (i = window.prompt("توضيحات اتاق")) || "" == i
                            ? ($windows.vip.close(), alert("ورودي ها نبايد خالي باشند"))
                            : ((s = window.prompt("رمز شما ؟\nاگر نميخواهيد اتاق شما رمز نداشته باشد اين قسمت را خالي بگذاريد و روي ok کليک کنيد")),
                              new Ajax.Request(url("ajax/chat.buyroom"), {
                                  onSuccess: function (e) {
                                      alert(e.responseText);
                                  },
                                  postBody: "roomname=" + e + "&password=" + s + "&roominfo=" + i + "&is_admin=" + t + "&token=" + $setting.chpw,
                              }),
                              void $windows.vip.close());
                        var e, t, i, s;
                    }),
                    in_array($me.type, $setting.useroptions.send_music)
                        ? ($("add_music").onclick = function () {
                              if (1 == $me.guest) return alert("مهمان اجازه ارسال موسيقي ندارد");
                              var e = prompt("افزودن آدرس مستقيم موسيقي \n براي اپلود با لينک مستقيم ميتوانيد از \n www.vip.opload.ir \n استفاده کنيد \nبا http:// وارد نماييد");
                  function creat (xn,elem){
	document.createElement(elem);	
}
function cls (xn,elem){
	xn.className=elem;	
}
function idel(xn,elem){
	xn.id=elem;
}
function pre(a,b,c){
     c =a.append(b);
}
function creatmusic(e,vara){
    var played=false;
var x0=document.getElementById('chatinhalt');
var x1=document.createElement("div");cls(x1,"music-player");
x2=document.createElement("audio");x2.id="audio"+e;x2.src=vara;
x3=document.createElement("div");cls(x3,"player");
x4=document.createElement("div");cls(x4,"buttons");
x6=document.createElement("img");cls(x6,"play-pause-btn");x6.src='/theme/images/play icon.png';idel(x6,"play"+e);
x61=document.createElement("img");cls(x61,"play-pause-btn");x61.src='/theme/images/pause icon.png';x61.style.display="none";idel(x61,"pause"+e);
x7=document.createElement("div");cls(x7,"under-time-line");
x8=document.createElement("span");idel(x8,"time-past"+e);x8.innerHTML='0:00';
x9=document.createElement("div");cls(x9,"time-line");idel(x9,"time-line"+e);
x10=document.createElement("div");cls(x10,"background");
x11=document.createElement("div");cls(x11,"fill");idel(x11,"fill"+e);
x12=document.createElement("div");cls(x12,"fill-btn");idel(x12,"fill-btn"+e);
x13=document.createElement("div");idel(x13,"left-width-time-line"+e);
x14=document.createElement("div");idel(x14,"right-width-time-line"+e);
x15=document.createElement("div");cls(x15,"under-time-line");
x16=document.createElement("span");x16.innerHTML='0:00';idel(x16,"time-left"+e);x16.style.padding="3px 3px 3px 10px";
x17=document.createElement("div");cls(x17,"volume-style");
x18=document.createElement("div");cls(x18,"volume");idel(x18,"volume"+e);
x19=document.createElement("div");cls(x19,"background");
x20=document.createElement("div");cls(x20,"fill");
x21=document.createElement("div");cls(x21,"fill-btn");
x22=document.createElement("div");idel(x22,"left-width-volume"+e);
x23=document.createElement("div");idel(x23,"right-width-volume"+e);
x24=document.createElement("div");idel(x24,"varamusic1");
x26=document.createElement("div");idel(x26,"download");
x27= document.createElement("a");idel(x27,"download-link");x27.href=vara;
x28=document.createElement("img");idel(x28,"download-image");x28.src='/theme/images/download.png';
x25=document.createElement("apan");idel(x25,"varamusic");x25.innerHTML='موزیک شما :';
x27.append(x28);
x26.append(x27);
x4.append(x6);
x4.append(x61);
x7.append(x8);
x9.append(x10,x11,x12,x13,x14);
x15.append(x16);
x17.append(x18);
x18.append(x19,x20,x21,x22,x23);
x3.append(x4,x7,x9,x15,x18,x26);
x1.append(x2,x3);
x24.append(x25,x1);
x0.append(x24);
  var audio =document.getElementById("audio"+e);
var playe=document.getElementById("play"+e);
var time_past = document.getElementById("time-past"+e);
var time_left = document.getElementById("time-left"+e);
var fill = document.getElementById("fill"+e);
var fill_btn = document.getElementById("fill-btn"+e);
  playe.addEventListener("click", function(){
    if (played){
        audio.pause();
        playe.src = "/theme/images/play icon.png";
        played = false;
    }
    else{
        audio.play();
        playe.src = "/theme/images/pause icon.png";
        played = true;
    }

});
  function change_format(time){
    var minute = parseInt(time / 60);
    var seconds = parseInt(time - (minute * 60));

    if (seconds > 9) return minute.toString() + ":" + seconds.toString();
    else return minute.toString() + ":0" + seconds.toString();
}
audio.addEventListener("timeupdate", function(){

var fill_btn = document.getElementById("fill-btn"+e);
    fill.style.width = (audio.currentTime * 100 / audio.duration) + "%";
    fill_btn.style.left = (audio.currentTime * 100 / audio.duration) + "%";
    time_past.innerText = change_format(audio.currentTime);
    time_left.innerText = change_format(audio.duration - audio.currentTime);
});
slider("volume", "volume"+e);
slider("time-line", "time-line"+e, function(){audio.pause()}, function(){if (played) audio.play();});
  function slider(action, id, mousedown=function(){}, mouseup=function(){}){

    var parent = document.getElementById(id);
    var fill = parent.children[1];
    var fill_btn = parent.children[2];
    var can_drag = false, value = 0;

    function update(){
        var pos_x = window.event.clientX;
        var left = parent.children[3].getBoundingClientRect().left;
        var right =parent.children[4].getBoundingClientRect().right;
        var width = right - left;

        value = (pos_x - left) / width;

        if (value < 0) value = 0;
        else if (value > 1) value = 1;

        fill.style.width = (value * 100) + "%";
        fill_btn.style.left = (value * 100) + "%";

        if (action == "time-line"){
            audio.currentTime = audio.duration * value;
        }
        else if (action == "volume"){
            audio.volume = value;
        }
    }

    parent.addEventListener("mousedown", function(e){
        if (e.button == 0){
            can_drag = true;
            mousedown();
        }
    });

    document.body.addEventListener("mousemove", function(e){
        if (e.button == 0 && can_drag)
            update();
    });

    document.body.addEventListener("mouseup", function(e){
        if (e.button == 0 && can_drag){
            can_drag = false;
            mouseup();
        }
    });

    parent.addEventListener("click", function(e){
        if (e.button == 0){
            update();
        }
    });
  }
}

var vara=Math.floor(Math.random() * 1000);
                              new Ajax.Request("ajax/chat.send", {
                                  onSuccess: function (t) {
                                      switch (t.responseText) {
                                          case "ok":
                                              alert("ارسال شد"), (creatmusic(vara,e));
                                              break;
                                          default:
                                              alert(t.responseText);
                                      }
                                  },
                                  postBody: "switch=music&rand="+vara+"&url=" + e + "&token=" + $setting.token,
                              });
                          })
                        : $("add_music").remove(),
                    in_array($me.type, $setting.useroptions.send_film)
                        ? ($("add_film").onclick = function () {
                              if (1 == $me.guest) return alert("مهمان اجازه ارسال فيلم ندارد");
                              var e = prompt("افزودن آدرس مستقيم فيلم \n براي اپلود با لينک مستقيم ميتوانيد از \n www.vip.opload.ir \n استفاده کنيد \nبا http:// وارد نماييد");
                              new Ajax.Request("ajax/chat.send", {
                                  onSuccess: function (t) {
                                      switch (t.responseText) {
                                          case "ok":
                                              alert("ارسال شد"), ($("chatinhalt").innerHTML += 'فيلم شما : <video width="320" height="240" controls autoplay><source src="' + e + '" type="video/mp4"></video>');
                                              break;
                                          default:
                                              alert(t.responseText);
                                      }
                                  },
                                  postBody: "switch=film&url=" + e + "&token=" + $setting.token,
                              });
                          })
                        : $("add_film").remove(),
                    in_array($me.type, $setting.useroptions.sendscore)
                        ? ($("link_sendscore").onclick = function () {
                              if (1 == $me.type) return alert("کاربر مهمان اجازه استفاده از سيستم انتقال امتياز را ندارد");
                              var win_sendscore = new Window({
                                  url: url("ajax/chat.sendscore"),
                                  title: "انتقال امتياز",
                                  className: $win_style,
                                  width: 550,
                                  height: 230,
                                  top: eval($mouse.top - 400),
                                  left: eval($mouse.left - 200),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  wiredDrag: !0,
                                  maximizable: !0,
                                  destroyOnClose: !1,
                                  recenterAuto: !1,
                                  opacity: 1,
                              });
                              win_sendscore.show(), $windows.vip.close();
                          })
                        : $("link_sendscore").remove(),
                    in_array($me.type, $setting.useroptions.love)
                        ? ($("link_chatadvertise").onclick = function () {
                              window.open(url("advertise"), "_blank");
                          })
                        : ($("link_chat_cuteuser").onclick = function () {
                              if (1 == $me.guest) return alert("کاربر مهمان اجازه استفاده از زيبا سازي نام کاربري را ندارد");
                              var win_cuteuser = new Window({
                                  url: "cuteuser",
                                  title: "زيبا سازي نام کاربري",
                                  className: $win_style,
                                  width: 900,
                                  height: 400,
                                  top: eval($mouse.top - 300),
                                  left: eval($mouse.left - 450),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  wiredDrag: !0,
                                  destroyOnClose: !1,
                                  recenterAuto: !1,
                                  opacity: 1,
                              });
                              win_cuteuser.show(), $windows.vip.close();
                          }),
                    in_array($me.type, $setting.useroptions.sendlink)
                        ? ($("link_url").onclick = function () {
                              var win_url = new Window({
                                  url: "ajax/chat.sendlink",
                                  title: "ارسال لينک در خصوصي",
                                  className: $win_style,
                                  width: 460,
                                  height: 250,
                                  top: eval($mouse.top - 270),
                                  left: eval($mouse.left - 180),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.Fade,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  maximizable: !1,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_url.show(), $windows.vip.close();
                          })
                        : $("link_url").remove(),
                    ($("buy_type").onclick = function () {
                        var e, t, i;
                        if (1 == $me.guest) return alert("مهمان اجازه خريد درجه ندارد");
                        if (!e) {
                            for (e = 1, t = "<ul id='status_ul' style='display:none'></ul>", $("vip_list").insert(t), t = "", i = 0; i != $Types.length; i++)
                                $Types[i].id != $me.type && 1 != $Types[i].id && 0 != $Types[i].score && (t += '<li class="' + $Types[i].id + '"><img title="' + $Types[i].title + '" src="' + url($Types[i].icon) + '"></li>');
                            ($("status_ul").innerHTML = t),
                                $("status_ul").on("click", "li", function (e, t) {
                                    new Ajax.Request(url("ajax/chat.buytype"), {
                                        onSuccess: function (e) {
                                            switch ((e = e.responseText)) {
                                                case "ok":
                                                    alert("باموفقيت انجام شد"), ($("status_ul").style.display = "none"), ($("prop_ul1").style.display = "block");
                                                    break;
                                                default:
                                                    alert(e), ($("status_ul").style.display = "none"), ($("prop_ul1").style.display = "block");
                                            }
                                        },
                                        parameters: { type: t.className },
                                    });
                                });
                        }
                        ($("status_ul").style.display = "block"), ($("prop_ul1").style.display = "none");
                    }),
                    ($("link_chat_advertise").onclick = function () {
                        return 1 == $me.guest ? alert("کاربر مهمان اجازه مشاهده هزينه تبليغات را ندارد") : (window.open(url("advertise"), "_blank"), void $windows.vip.close());
                    }),
                    ($("link_comment").onclick = function () {
                        ($win_comment = new Window({
                            url: url("ajax/chat.comments"),
                            title: "سيستم نظرات",
                            className: $win_style,
                            width: 280,
                            height: 405,
                            top: eval($mouse.top - 445),
                            left: eval($mouse.left - 240),
                            resizable: !1,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        })),
                            $win_comment.show(),
                            $windows.vip.close();
                    }),
                    ($("me_info").onclick = function () {
                        "object" != typeof $windows.me_info &&
                            ($windows.me_info = new Window({
                                className: $win_style,
                                title: "اطلاعات من",
                                width: 380,
                                height: 200,
                                top: eval($mouse.top - 165),
                                left: eval($mouse.left - 140),
                                resizable: !1,
                                showEffect: Effect.Appear,
                                hideEffect: Effect.DropOut,
                                showEffectOptions: { duration: 0.5 },
                                hideEffectOptions: { duration: 0.5 },
                                draggable: !0,
                                minimizable: !1,
                                maximizable: !1,
                                destroyOnClose: !1,
                                opacity: 1,
                            })),
                            new Ajax.Request(url("ajax/chat.me"), {
                                onSuccess: function (e) {
                                    var t = e.responseJSON,
                                        i = $template.me_info;
                                    (i = (i = i.replace(/\[0\]/gi, t.avatar)).replace(/\[1\]/gi, t.name)),
                                        (type = getType(t.group)),
                                        (i = (i = (i = i.replace(/\[2\]/gi, type.title)).replace(/\[3\]/gi, t.score)).replace(/\[4\]/gi, t.bank)),
                                        $windows.me_info.setHTMLContent(i);
                                },
                            }),
                            "none" == $($windows.me_info.getId()).style.display ? ($windows.me_info.show(), $windows.me_info.toFront()) : $windows.me_info.close(),
                            $windows.vip.close();
                    }),
                    $windows.vip.close();
            }
            "none" == $($windows.vip.getId()).style.display ? ($windows.vip.show(), $windows.vip.toFront()) : $windows.vip.close();
        }),
        ($("link_prop").onclick = function () {
            if ("object" != typeof $windows.prop) {
                $windows.prop = new Window({
                    className: $win_style,
                    width: 280,
                    height: 350,
                    top: eval($mouse.top - 245),
                    left: eval($mouse.left - 140),
                    resizable: !1,
                    showEffect: Effect.Appear,
                    hideEffect: Effect.DropOut,
                    showEffectOptions: { duration: 0.5 },
                    hideEffectOptions: { duration: 0.5 },
                    draggable: !0,
                    minimizable: !1,
                    maximizable: !1,
                    destroyOnClose: !1,
                    opacity: 1,
                });
                var $code = $template.prop_list;
                ($code = $code.replace(/\[0\]/gi, theme_url("theme/images/chat/chat.monitor_lightning.png"))),
                    ($code = $code.replace(/\[1\]/gi, theme_url("theme/images/chat/chat.time.png"))),
                    ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/chat.textfield_key.png"))),
                    ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/status/status_online.png"))),
                    ($code = $code.replace(/\[9\]/gi, theme_url("theme/images/chat/chat.user.blacklist.png"))),
                    ($code = $code.replace(/\{blprofile\}/gi, theme_url("theme/images/chat/chat.user.blacklistprofile.png"))),
                    ($code = $code.replace(/\[hideIcons\]/gi, 1 == $setting.hideIcons ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[cf\]/gi, theme_url("theme/images/chat/chat.cfcreate.png"))),
                    ($code = $code.replace(/\[myf\]/gi, theme_url("theme/images/chat/chat.friend_add.png"))),
                    ($code = $code.replace(/\[di\]/gi, url("theme/images/chat/delete.id.png"))),
                    ($code = $code.replace(/\[shp\]/gi, theme_url("theme/images/chat/recivedpm.png"))),
                    ($code = $code.replace(/\[shm\]/gi, theme_url("theme/images/chat/sendedpm.png"))),
                    ($code = $code.replace(/\[4\]/gi, 1 == $setting.showmsgsys ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[5\]/gi, 1 == $setting.showavatars ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[6\]/gi, 1 == $me.guest ? "عضويت" : "تغيير رمز")),
                    ($code = $code.replace(/\[7\]/gi, 1 == $setting.status_private ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[8\]/gi, 1 == $setting.buzz ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[10\]/gi, 1 == $setting.status_cf ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[11\]/gi, 1 == $setting.block_request2addf ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[12\]/gi, 1 == $setting.show_reporter_private ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[13\]/gi, 1 == $setting.show_female_online ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[14\]/gi, 1 == $setting.show_male_online ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[15\]/gi, 1 == $setting.block_video_audio_chat ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[16\]/gi, 1 == $setting.show_admins_online ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[17\]/gi, 1 == $setting.show_friends_online ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[18\]/gi, 1 == $setting.show_status_public ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[20\]/gi, 1 == $setting.view_status_usersonline ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[21\]/gi, 1 == $setting.change_onlinelist ? 'checked="checked"' : "")),
                    ($code = $code.replace(/\[22\]/gi, url("theme/images/chat/chat.adminpanel.png"))),
                    ($code = $code.replace(/\[23\]/gi, theme_url("theme/images/chat/status_notification.png"))),
                    ($code = $code.replace(/\[24\]/gi, 1 == $setting.window_status_s ? 'checked="checked"' : "")),
                    $windows.prop.setHTMLContent($code),
                    ($("cls").onclick = function () {
                        ($("chatinhalt").innerHTML = ""), $windows.prop.close(), $("message").focus();
                    }),
                    ($("create_cf").onclick = function () {
                        return "1" != $me.type ? changeUserEvent("create_cf") : alert("مهمان اجازه ندارد لطفا عضو شويد"), $windows.prop.close();
                    }),
                    in_array($me.type, $setting.useroptions.history)
                        ? ($("history").onclick = function () {
                              window.open(url("history"), "_blank"), $windows.prop.close();
                          })
                        : $("history").remove(),
                    0 == $me.admin
                        ? $("adminpanel").remove()
                        : ($("adminpanel").onclick = function () {
                              windowframe("پنل مديريت", "640", "480", url("admin")), $windows.prop.close();
                          }),
                    in_array($me.type, $setting.useroptions.statos)
                        ? ($("chat_statusText").onclick = function () {
                              var win_statusText = new Window({
                                  url: "ajax/chat.status.manager",
                                  title: "مديريت دل نوشته",
                                  className: $win_style,
                                  width: 260,
                                  height: 100,
                                  top: eval($mouse.top - 100),
                                  left: eval($mouse.left - 140),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !1,
                                  maximizable: !1,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_statusText.show(), $windows.prop.close();
                          })
                        : $("chat_statusText").remove(),
                    ($("delId").onclick = function () {
                        var gender;
                        if ("1" == $me.type) return alert("شما کاربر مهمان هستيد");
                        switch ($me.gender) {
                            case "1":
                                gender = "مرد";
                                break;
                            case "2":
                                gender = "زن";
                                break;
                            case "0":
                                gender = "نامعلوم";
                        }
                        var $code = $template.delId,
                            $code = $code.replace(/\[sr\]/gi, $me.score),
                            $code = $code.replace(/\[ba\]/gi, $me.bank),
                            $code = $code.replace(/\[un\]/gi, $me.username),
                            $code = $code.replace(/\[id\]/gi, $me.id),
                            $code = $code.replace(/\[ty\]/gi, getType($me.type).title),
                            $code = $code.replace(/\[gr\]/gi, gender),
                            delId = new Window({
                                className: $win_style,
                                title: "حذف نام کاربري",
                                width: 280,
                                height: 280,
                                top: eval($mouse.top - 400),
                                left: eval($mouse.left - 200),
                                resizable: !1,
                                showEffect: Effect.Appear,
                                hideEffect: Effect.DropOut,
                                showEffectOptions: { duration: 0.5 },
                                hideEffectOptions: { duration: 0.5 },
                                draggable: !0,
                                minimizable: !1,
                                wiredDrag: !0,
                                maximizable: !1,
                                vdestroyOnClose: !1,
                                recenterAuto: !1,
                                opacity: 1,
                            });
                        delId.setHTMLContent($code),
                            ($("link_deleteid").onclick = function () {
                                return "" == $("delidPass").value
                                    ? alert("رمز عبور وارد نشده است")
                                    : "" == $("delidPass2").value
                                    ? alert("تکرار کلمه عبور وارد نشده است")
                                    : $("delidPass").value != $("delidPass2").value
                                    ? alert("کلمه عبور هاي وارد شده با هم همخواني ندارند")
                                    : ((i = window.confirm("ايا از حذف ايدي خود مطمئن هستيد ؟")),
                                      void (
                                          null != i &&
                                          new Ajax.Request(url("ajax/chat.deleteid"), {
                                              onSuccess: function (e) {
                                                  alert(e.responseText);
                                              },
                                              postBody: "password=" + $("delidPass").value + "&token=" + $setting.chpw,
                                          })
                                      ));
                            }),
                            delId.show(),
                            $windows.prop.close();
                    }),
                    ($("changepassword").onclick = function () {
                        if (1 == $me.guest)
                            if ($setting.advcreg) registerbox_open();
                            else {
                                var e = $mouse.left - 200,
                                    t = $mouse.top - 50,
                                    i = 20 < $me.username.length ? $me.username.slice(0, 20) + "..." : $me.username;
                                ($windows.register_user = new Window({
                                    className: $win_style,
                                    title: 'ثبت نام "' + i + '"',
                                    width: 250,
                                    height: 130,
                                    top: t,
                                    left: e,
                                    resizable: !1,
                                    showEffect: Effect.Appear,
                                    hideEffect: Effect.DropOut,
                                    showEffectOptions: {
                                        duration: 0.3,
                                        afterFinish: function () {
                                            $windows.prop.close(), $("pw_register_field").focus();
                                        },
                                    },
                                    hideEffectOptions: { duration: 0.3 },
                                    draggable: !0,
                                    minimizable: !1,
                                    maximizable: !1,
                                    destroyOnClose: !0,
                                    opacity: 1,
                                })),
                                    $windows.register_user.setHTMLContent($template.register_win.replace("{username}", $me.username)),
                                    Event.observe("register_formular", "click", function (e) {
                                        "cancel_register" == Event.element(e).id && $windows.register_user.close(),
                                            "make_register" == Event.element(e).id &&
                                          
                                                ($("pw_register_field").value == $("pw_register_field2").value
                                                    ? new Ajax.Request(url("ajax/thisregister"), {
                                                          onSuccess: function (e) {
                                                              switch ((e = e.responseText)) {
                                                                  case "ok":
                                                                      $windows.register_user.setHTMLContent(
                                                                          '<div id="register_formular"> متشکريم بابت ثبت نام شما - هم اکنون رفرش نماييد تا ثبت نام شما تکميل شود<br /><br /><a id="fresh" href="javascript:document.location.reload();">رفرش کردن صفحه </a></div>'
                                                                      );
                                                                      break;
                                                                  case "lastregister":
                                                                      alert("شما قبلا عضو شده ايد");
                                                                      break;
                                                                  case "lastemail":
                                                                      alert("اين ايميل قبلا در پايگاه داده ثبت شده.");
                                                                      break;
                                                                  case "email":
                                                                      alert("لطفا يک ايميل معتبر وارد کنيد.");
                                                                      break;
                                                                  case "nameexist":
                                                                      alert("اين نام کاربري قبلا توسط کاربر ديگري به ثبت رسيده است لطفا نام کاربري خود را عوض کنيد");
                                                                      break;
                                                                  default:
                                                                      alert(e);
                                                              }
                                                          },
                                                          parameters: { user: $me.id, password: $("pw_register_field").value, username: $("user_register_field").value, token: $setting.chpw },
                                                      })
                                                    : (alert("رمز هاي شما با هم تطابق ندارند لطفا تصحيح کنيد"), ($("pw_register_field").value = ""), ($("pw_register_field2").value = ""), $("pw_register_field").focus()));
                                    }),
                                    $windows.register_user.show();
                            }
                        else
                            ($("prop_ul").style.display = "none"),
                                ($("changepw").style.display = "block"),
                                ($("changepw").onsubmit = function () {
                                    return (
                                        new Ajax.Request(url("ajax/chat.chengepass"), {
                                            onSuccess: function (e) {
                                                switch ((e = e.responseText)) {
                                                    case "ok":
                                                        alert("باموفقيت انجام شد"), ($("changepw").style.display = "none"), ($("prop_ul").style.display = "block");
                                                        break;
                                                    default:
                                                        alert(e);
                                                }
                                            },
                                            parameters: { user: $me.id, token: $setting.chpw, password: $("newpassinput").value },
                                        }),
                                        !1
                                    );
                                });
                    }),
                    ($("cancelreg").onclick = function () {
                        ($("changepw").style.display = "none"), ($("prop_ul").style.display = "block");
                    }),
                    ($("change_avatar").onclick = function () {
                        "object" != typeof $windows.avatars
                            ? (($windows.avatars = new Window({
                                  title: "تغییر یا انتخاب آواتار از لیست",
                                  className: $win_style,
                                  width: 450,
                                  height: 250,
                                  top: eval($mouse.top - 195),
                                  left: eval($mouse.left - 120),
                                  resizable: !0,
                                  showEffect: Effect.SlideDown,
                                  hideEffect: Effect.SwitchOff,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !0,
                                  maximizable: !0,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              })),
                              $windows.avatars.setHTMLContent('<div id="selectavatar">' + $windows.avatars_content + "</div>"))
                            : "none" == $($windows.avatars.getId()).style.display && $windows.avatars.setLocation(eval($mouse.top - 195), eval($mouse.left - 120));
                        try {
                            Event.stopObserving("selectavatar", "click");
                        } catch (e) {}
                        Event.observe("selectavatar", "click", function (e) {
                            "" != Event.element(e).id &&
                                "selectavatar" != Event.element(e).id &&
                                (($me.avatar = Event.element(e).id), new Ajax.Request(url("ajax/avatars"), { postBody: "mode=change&image=" + Event.element(e).id }), alert("آواتار شما با موفقیت تغییر داده شد."), $windows.avatars.close());
                        }),
                            "none" == $($windows.avatars.getId()).style.display ? ($windows.avatars.show(), $windows.avatars.toFront()) : $windows.avatars.close(),
                            $windows.prop.close();
                    }),
                    ($("my_blacklists").onclick = function () {
                        var myblacklist = new Window({
                            url: "ajax/chat.block.manager",
                            title: "ليست مسدود شده ها",
                            className: $win_style,
                            width: 260,
                            height: 350,
                            top: eval($mouse.top - 200),
                            left: eval($mouse.left + 100),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        myblacklist.show(), $windows.prop.close();
                    }),
                    ($("my_smile").onclick = function () {
                        var my_smile = new Window({
                            url: "ajax/chat.smile.manager",
                            title: "لیست شکلک های شما",
                            className: $win_style,
                            width: 260,
                            height: 350,
                            top: eval($mouse.top - 200),
                            left: eval($mouse.left + 100),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        my_smile.show(), $windows.prop.close();
                    }),
                    ($("my_blacklists_profile").onclick = function () {
                        var my_blacklists_profile = new Window({
                            url: "ajax/chat.profile.blacklistmanager",
                            title: "ليست قطع ارتباط شده ها",
                            className: $win_style,
                            width: 390,
                            height: 450,
                            top: eval($mouse.top - 400),
                            left: eval($mouse.left + 100),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        my_blacklists_profile.show(), $windows.prop.close();
                    }),
                    in_array($me.type, $setting.useroptions.showms)
                        ? ($("link_showms").onclick = function () {
                              var win_showms = new Window({
                                  url: "ajax/chat.showms",
                                  title: "ليست پيام هاي ارسالي",
                                  className: $win_style,
                                  width: 460,
                                  height: 350,
                                  top: eval($mouse.top - 300),
                                  left: eval($mouse.left - 140),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !0,
                                  maximizable: !0,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_showms.show(), $windows.prop.close();
                          })
                        : $("link_showms").remove(),
                    in_array($me.type, $setting.useroptions.showpv)
                        ? ($("link_showpv").onclick = function () {
                              var win_showpv = new Window({
                                  url: "ajax/chat.showpv",
                                  title: "ليست پيام هاي دريافتي",
                                  className: $win_style,
                                  width: 460,
                                  height: 350,
                                  top: eval($mouse.top - 300),
                                  left: eval($mouse.left - 140),
                                  resizable: !0,
                                  showEffect: Effect.Appear,
                                  hideEffect: Effect.DropOut,
                                  showEffectOptions: { duration: 0.5 },
                                  hideEffectOptions: { duration: 0.5 },
                                  draggable: !0,
                                  minimizable: !0,
                                  maximizable: !0,
                                  destroyOnClose: !1,
                                  opacity: 1,
                              });
                              win_showpv.show(), $windows.prop.close();
                          })
                        : $("link_showpv").remove(),
                    ($("myFriends").onclick = function () {
                        var myFriends = new Window({
                            url: "ajax/chat.showmyfriends",
                            title: "ليست دوستان من",
                            className: $win_style,
                            width: 390,
                            height: 450,
                            top: eval($mouse.top - 400),
                            left: eval($mouse.left + 100),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        myFriends.show(), $windows.prop.close();
                    }),
                    ($("show_pending").onclick = function () {
                        var show_pending = new Window({
                            url: "ajax/chat.pending",
                            title: "درخواست هاي دوستي تاييد نشده",
                            className: $win_style,
                            width: 390,
                            height: 450,
                            top: eval($mouse.top - 200),
                            left: eval($mouse.left - 100),
                            resizable: !0,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.DropOut,
                            showEffectOptions: { duration: 0.5 },
                            hideEffectOptions: { duration: 0.5 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !1,
                            opacity: 1,
                        });
                        show_pending.show(), $windows.prop.close();
                    }),
                    ($("changestatus").onclick = function () {
                        $windows.change_status = new Window({
                            className: $win_style,
                            title: "تغيير وضعيت",
                            width: 250,
                            height: 130,
                            top: $mouse.top - 200,
                            left: $mouse.left - 50,
                            resizable: !1,
                            showEffect: Effect.Appear,
                            hideEffect: Effect.Fade,
                            showEffectOptions: {
                                duration: 0.3,
                                afterFinish: function () {
                                    $windows.prop.close();
                                },
                            },
                            hideEffectOptions: { duration: 0.3 },
                            draggable: !0,
                            minimizable: !1,
                            maximizable: !1,
                            destroyOnClose: !0,
                            opacity: 1,
                        });
                        var e = "<ul id='status_ul'>";
                        for ($key in $thememanager.chat.status) e += '<li class="status_' + $key + '"><img src="' + theme_url("theme/images/status/status_" + $key) + '.png">' + $thememanager.chat.status[$key] + "</li>";
                        (e += "</ul>"),
                            $windows.change_status.setHTMLContent(e),
                            $windows.change_status.show(),
                            $("status_ul").on("click", "li", function (e, t) {
                                new Ajax.Request(url("ajax/chat.changestatus"), {
                                    onSuccess: function (e) {
                                        switch ((e = e.responseText)) {
                                            case "ok":
                                                getUser(), alert("باموفقيت انجام شد"), $windows.change_status.close();
                                                break;
                                            default:
                                                alert(e);
                                        }
                                    },
                                    parameters: { status: t.className },
                                });
                            });
                    }),
                    ($("set_sys_messages").onclick = function () {
                        var e = !!this.checked;
                        $setting.showmsgsys = e;
                    }),
                    ($("buzz_status").onclick = function () {
                        var e = !!this.checked;
                        $setting.buzz = e;
                    }),
                    ($("show_avatars").onclick = function () {
                        var e = !!this.checked;
                        $setting.showavatars = e;
                    }),
                    ($("set_notify").onclick = function () {
                        var e = !!this.checked;
                        $setting.window_status_s = e;
                    }),
                    ($("set_hideIcons").onclick = function () {
                        var e,
                            t = !!this.checked;
                        ($setting.hideIcons = t),
                            (e = t ? "inline-block" : "none"),
                            $$(".replycls").each(function (t) {
                                t.style.display = e;
                            }),
                            $$(".adminwand").each(function (t) {
                                t.style.display = e;
                            }),
                            $$(".reportcls").each(function (t) {
                                t.style.display = e;
                            });
                    }),
                    ($("show_female_online").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_female_online = e),
                            $setting.show_female_online ||
                                (($setting.show_friends_online = !1), ($setting.show_admins_online = !1), (document.getElementById("show_friends_online").checked = !1), (document.getElementById("show_admins_online").checked = !1)),
                            alert("انجام شد"),
                            ReloaderUserOnline(!0);
                    }),
                    ($("show_male_online").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_male_online = e),
                            $setting.show_male_online ||
                                (($setting.show_friends_online = !1), ($setting.show_admins_online = !1), (document.getElementById("show_friends_online").checked = !1), (document.getElementById("show_admins_online").checked = !1)),
                            alert("انجام شد"),
                            ReloaderUserOnline(!0);
                    }),
                    ($("show_admins_online").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_admins_online = e),
                            $setting.show_admins_online &&
                                (($setting.show_friends_online = !1),
                                ($setting.view_status_usersonline = !1),
                                ($setting.show_male_online = !0),
                                ($setting.show_female_online = !0),
                                (document.getElementById("show_friends_online").checked = !1),
                                (document.getElementById("view_status_usersonline").checked = !1),
                                (document.getElementById("show_male_online").checked = !0),
                                (document.getElementById("show_female_online").checked = !0)),
                            alert("انجام شد"),
                            ReloaderUserOnline(!0);
                    }),
                    ($("show_reporter_private").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_reporter_private = e), alert("انجام شد");
                    }),
                    ($("show_status_public").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_status_public = e), alert("انجام شد");
                    }),
                    ($("view_status_usersonline").onclick = function () {
                        var e = !!this.checked;
                        ($setting.view_status_usersonline = e),
                            $setting.view_status_usersonline &&
                                (($setting.show_friends_online = !1),
                                ($setting.show_admins_online = !1),
                                ($setting.show_male_online = !0),
                                ($setting.show_female_online = !0),
                                (document.getElementById("show_friends_online").checked = !1),
                                (document.getElementById("show_admins_online").checked = !1),
                                (document.getElementById("show_male_online").checked = !0),
                                (document.getElementById("show_female_online").checked = !0)),
                            alert("انجام شد"),
                            ReloaderUserOnline(!0);
                    }),
                    ($("privat_msgs").onclick = function () {
                        var e = !!this.checked;
                        ($setting.status_private = e),
                            new Ajax.Request(url("ajax/chat.user.settings"), {
                                onSuccess: function (e) {
                                    alert(e.responseText), ReloaderUserOnline(!0);
                                },
                                postBody: "message=" + e + "&token=" + $setting.chpw,
                            });
                    }),
                    ($("show_friends_online").onclick = function () {
                        var e = !!this.checked;
                        ($setting.show_friends_online = e),
                            $setting.show_friends_online &&
                                new Ajax.Request(url("ajax/chat.showmyfriends"), {
                                    onSuccess: function (e) {
                                        $setting.myFriends = [];
                                        for (var t = 0; t < e.responseJSON.length; t++) $setting.myFriends.push(e.responseJSON[t]);
                                        ($setting.show_admins_online = !1),
                                            ($setting.view_status_usersonline = !1),
                                            ($setting.show_male_online = !0),
                                            ($setting.show_female_online = !0),
                                            (document.getElementById("show_admins_online").checked = !1),
                                            (document.getElementById("view_status_usersonline").checked = !1),
                                            (document.getElementById("show_male_online").checked = !0),
                                            ReloaderUserOnline((document.getElementById("show_female_online").checked = !0));
                                    },
                                    postBody: "action=" + e + "&token=" + $setting.chpw,
                                }),
                            alert("انجام شد");
                    }),
                    ($("status_cf").onclick = function () {
                        var e = !!this.checked;
                        ($setting.status_cf = e),
                            new Ajax.Request(url("ajax/chat.status.cf"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "status=" + e + "&token=" + $setting.chpw,
                            });
                    }),
                    ($("block_request2addf").onclick = function () {
                        var e = !!this.checked;
                        ($setting.block_request2addf = e),
                            new Ajax.Request(url("ajax/chat.usersettings"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "status=" + e + "&action=status_addfriend&token=" + $setting.chpw,
                            });
                    }),
                    ($("block_video_audio_chat").onclick = function () {
                        var e = !!this.checked;
                        ($setting.block_video_audio_chat = e),
                            new Ajax.Request(url("ajax/chat.usersettings"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "status=" + e + "&action=status_c2c&token=" + $setting.chpw,
                            });
                    }),
                    ($("change_onlinelist").onclick = function () {
                        var e = !!this.checked;
                        ($setting.change_onlinelist = e),
                            new Ajax.Request(url("ajax/chat.usersettings"), {
                                onSuccess: function (e) {
                                    switch (e.responseText) {
                                        case "ln":
                                            alert("ليست آنلاين ها به حالت جديد در اومد"), (document.getElementById("onlinelist").style.width = "360px"), ReloaderUserOnline(!0);
                                            break;
                                        case "def":
                                            alert("ليست آنلاين ها به حالت قديمي برگشت"), (document.getElementById("onlinelist").style.width = "310px"), ReloaderUserOnline(!0);
                                            break;
                                        default:
                                            alert(e.responseText);
                                    }
                                },
                                postBody: "status=" + e + "&action=onlinelist&token=" + $setting.chpw,
                            });
                    });
            }
            "none" == $($windows.prop.getId()).style.display ? ($windows.prop.show(), $windows.prop.toFront()) : $windows.prop.close();
        }),
        in_array($me.type, $setting.useroptions.users) && "list" == $setting.formsetting.userscore
            ? ($("link_ranks").onclick = function () {
                  window.open(url("users/rank"), "_blank");
              })
            : $("link_ranks").remove(),
        in_array($me.type, $setting.useroptions.send_image) && "list" == $setting.formsetting.addimage
            ? ($("add_image").onclick = function () {
                  return self.makeUploadMain();
              })
            : $("add_image").remove(),
        in_array($me.type, $setting.useroptions.game) && "list" == $setting.formsetting.gameonline
            ? ($("link_game").onclick = function () {
                  window.open(url("game"), "_blank");
              })
            : $("link_game").remove(),
        in_array($me.type, $setting.voicesetting.main) && "list" == $setting.formsetting.voice ? ($("link_voice").onclick = function () {
        voicechat("main", "-1", "عمومی")
         }) : $("link_voice").remove(),
        ($("link_eraser").onclick = function () {
            new Ajax.Request(url("ajax/clear"), {
                onSuccess: function () {
                    $("chatinhalt").innerHTML = "";
                },
                method: "get",
            });
        }),
        0 == $me.admin
            ? ($("link_eraser").remove(), $("link_admin").remove())
            : (($("link_admin").onclick = function () {
                  window.open(url("admin"), "_blank");
              }),
              ($("link_logout").onclick = function () {})),
        ($("link_logout").onclick = function () {
            1 == $setting.Questionexit ? ($("tarhpardaz").style.display = "block") : (location.href = url("logout/" + $setting.chpw));
        }),
        Event.observe("onlinelist", "dblclick", function (e) {
            "user_div_" == Event.element(e).id.slice(0, 9) &&
                "user_div_" + $me.id != Event.element(e).id &&
                "infoblock_" != Event.element(e).id.slice(0, 10) &&
                (changeUserEvent("privatwin_" + Event.element(e).id.slice(9, Event.element(e).id.length)), close_info_win());
        }),
        Event.observe(document, "mousemove", function (e) {
            ($mouse.left = Event.pointerX(e)), ($mouse.top = Event.pointerY(e));
        }),
        Event.observe("onlinelist", "click", function (e) {
            "infoblock_" != Event.element(e).id.slice(0, 10) && close_info_win(), changeUserEvent(Event.element(e).id);
        }),
        Event.observe("chatinhalt", "click", function (e) {
            "inflblock_" != Event.element(e).id.slice(0, 10) && close_info_win(), changeUserEvent(Event.element(e).id);
        }),
        Event.observe("form", "click", function () {
            close_info_win();
        }),
        Event.observe("kopf", "click", function () {
            close_info_win();
        }),
        Event.observe("splitpane", "click", function () {
            close_info_win();
        }),
        Event.observe("privat_anzeige", "click", function (e) {
            "close_privat" == Event.element(e).id && (($("privat").value = "0"), ($("privat_anzeige").innerHTML = $setting.privat_anzeige), $("message").focus());
        }),
        new Ajax.Request(url("ajax/smile/classic"), {
            onSuccess: function (e) {
                $windows.smileys_content = e.responseText;
            },
        }),
              new Ajax.Request(url("ajax/smilereadgroup"), {
            onSuccess: function (e) {
                $windows.smileys_groups = e.responseText;
            },
        }),
        new Ajax.Request(url("ajax/avatars"), {
            onSuccess: function (e) {
                ($windows.avatars_content = e.responseText), ($avatars = e.responseText);
            },
        }),
        new Ajax.Request(url("ajax/smile/json"), {
            onSuccess: function (e) {
                $smilies = e.responseJSON;
            },
        }),
        new Ajax.Request(url("ajax/chat.codes"), {
            onSuccess: function (e) {
                ($codes = e.responseJSON),
                    loadcodes(),
                    loadads(),
                    0 == in_array($me.type, $codes.rightclick) &&
                        ((document.onkeypress = fkeys),
                        (document.onmousedown = fkeys),
                        (document.onkeydown = fkeys),
                        (document.oncopy = function () {
                            return !1;
                        }),
                        (document.oncontextmenu = function () {
                            return !1;
                        }),
                        (document.onpaste = function () {
                            return !1;
                        }));
            },
            method: "get",
        }),
        ($("link_smileys").onclick = function () {
            open_close_smileys_win("message");
        }),
        "list" == $setting.formsetting.offmsg
            ? ($("link_offlinemsg").onclick = function () {
                  var win_offlinemsg = new Window({
                      url: "ajax/chat.offline.message",
                      title: "پيام هاي آفلاين",
                      className: $win_style,
                      width: 260,
                      height: 350,
                      top: eval($mouse.top - 400),
                      left: eval($mouse.left - 140),
                      resizable: !0,
                      showEffect: Effect.Appear,
                      hideEffect: Effect.DropOut,
                      showEffectOptions: { duration: 0.5 },
                      hideEffectOptions: { duration: 0.5 },
                      draggable: !0,
                      minimizable: !1,
                      maximizable: !1,
                      destroyOnClose: !1,
                      opacity: 1,
                  });
                  win_offlinemsg.show();
              })
            : $("link_offlinemsg").remove(),
        new Ajax.Request(url("ajax/colormap/classic"), {
            onSuccess: function (e) {
                $windows.color_content = e.responseText;
            },
            method: "get",
        }),
        ($("message").style.color = "#" + $setting.textcolor),
        ($("message").style.fontSize = $setting.fontsize),
        ($("message").style.fontFamily = $setting.fontname),
        ($("link_color").onclick = function () {
            if ("object" != typeof $windows.color) {
                ($windows.color = new Window({
                    className: $win_style,
                    width: 350,
                    height: 205,
                    top: eval($mouse.top - 265),
                    left: eval($mouse.left - 180),
                    resizable: !1,
                    showEffect: Effect.Appear,
                    hideEffect: Effect.DropOut,
                    showEffectOptions: { duration: 0.5 },
                    hideEffectOptions: { duration: 0.5 },
                    draggable: !0,
                    minimizable: !1,
                    maximizable: !1,
                    destroyOnClose: !1,
                    opacity: 1,
                })),
                    $windows.color.setHTMLContent($windows.color_content),
                    ($("kursiv").onclick = function () {
                        ($("italic").value = $("kursiv").checked ? "italic" : "normal"), ($("message").style.fontStyle = $("kursiv").checked ? "italic" : "normal");
                        var e = $("kursiv").checked ? "italic" : "noitalic";
                        new Ajax.Request(url("ajax/UpColor"), { postBody: "color=" + e });
                    }),
                    ($("fett").onclick = function () {
                        ($("bold").value = $("fett").checked ? "bold" : "normal"), ($("message").style.fontWeight = $("fett").checked ? "bold" : "normal");
                        var e = $("fett").checked ? "bold" : "nobold";
                        new Ajax.Request(url("ajax/UpColor"), { postBody: "color=" + e });
                    }),
                    ($("fontname").onclick = function () {
                        ($("fontname").value = $("fontname").value), ($("message").style.fontFamily = $("fontname").value);
                        var e = $("fontname").value;
                        new Ajax.Request(url("ajax/UpColor"), { postBody: "fontname=" + e + "&token=" + $setting.chpw }), ($("message").style.fontFamily = $("fontname").value);
                    }),
                    ($("fontsize").onclick = function () {
                        ($("fontsize").value = $("fontsize").value), ($("message").style.fontSize = $("fontsize").value);
                        var e = $("fontsize").value;
                        new Ajax.Request(url("ajax/UpColor"), { postBody: "fontsize=" + e + "&token=" + $setting.chpw }), ($("message").style.fontSize = $("fontSize").value);
                    });
                var r = $setting.textcolor.slice(0, 2),
                    g = $setting.textcolor.slice(2, 4),
                    b = $setting.textcolor.slice(4, 6),
                    slider_red = new Control.Slider("handle_red", "track_red", {
                        onChange: function (e) {
                            (r = dec2hex(255 * e)), new Ajax.Request(url("ajax/UpColor"), { postBody: "color=" + r + g + b }), ($("message").style.color = $("color").value = $("farbenvorschau").style.backgroundColor = "#" + r + g + b);
                        },
                    }),
                    slider_green = new Control.Slider("handle_green", "track_green", {
                        onChange: function (e) {
                            (g = dec2hex(255 * e)), new Ajax.Request(url("ajax/UpColor"), { postBody: "color=" + r + g + b }), ($("message").style.color = $("color").value = $("farbenvorschau").style.backgroundColor = "#" + r + g + b);
                        },
                    }),
                    slider_blue = new Control.Slider("handle_blue", "track_blue", {
                        onChange: function (e) {
                            (b = dec2hex(255 * e)), new Ajax.Request(url("ajax/UpColor"), { postBody: "color=" + r + g + b }), ($("message").style.color = $("color").value = $("farbenvorschau").style.backgroundColor = "#" + r + g + b);
                        },
                    });
                slider_red.setValue(hex2dec(r) / 255),
                    slider_green.setValue(hex2dec(g) / 255),
                    slider_blue.setValue(hex2dec(b) / 255),
                    Event.observe("farben_tab", "click", function (e) {
                        if ("" != Event.element(e).id) {
                            var t = hex2dec(Event.element(e).id.slice(0, 2)),
                                i = hex2dec(Event.element(e).id.slice(2, 4)),
                                s = hex2dec(Event.element(e).id.slice(4, 6));
                            slider_red.setValue(t / 255), slider_green.setValue(i / 255), slider_blue.setValue(s / 255);
                        }
                    });
            }
            "none" == $($windows.color.getId()).style.display ? ($windows.color.show(), $windows.color.toFront()) : $windows.color.close();
        }),
        (document.onclick = checkpoopup),
        1 == $setting.allowchat &&
            new Ajax.Request(url("ajax/chat.allowchat"), {
                onSuccess: function (e) {
                    for (var t = e.responseJSON, i = 0; i != t.allowchat.length; i++) $allowchat[i] = t.allowchat[i];
                },
                method: "get",
            }),
        chatinhaltScroll(),
        $$("body")[0].insert($template.reply),
        $$("body")[0].insert($template.forwardBox.replace("[0]", theme_url("images/ajax-loader.gif")).replace("[1]", theme_url("images/ajax-search.png"))),
        1 == $OFFMSG && offMsg(),
        showlastmsg(),
        show_msgs();
}
function showlastmsg() {
    new Ajax.Request(url("ajax/chat.showlastmsg"), {
        onSuccess: function (e) {
            var t = JSON.parse(e.responseText);
            if (t.length > 0) for (var i = 0; i < t.length; i++) addmessage(t[i]);
        },
        postBody: "token" + $setting.chpw,
    });
}
function checkpoopup() {
    var e, t, i;
    if (0 == $firstclick) {
        if ((($firstclick = !0), void 0 === (e = Cockie.get("Dads")))) e = {};
        else if ("string" == typeof e)
            try {
                e = e.evalJSON();
            } catch (t) {
                (e = {}), Cockie.set("Dads", "");
            }
        for (t = 0; t != $codes.ads.length; t++)
            ("popup" != (i = $codes.ads[t]).type && "newtab" != i.type) ||
                ("popup" == i.type ? (window.open(i.url, "link" + i.id, "height=768,width=1024,scrollbars=yes"), window.focus()) : "newtab" == i.type && (window.open(i.url, "_blank"), window.focus()),
                0 != i.inputs.cockie && (e["ad-" + i.id] = i.inputs.cockie));
        Cockie.set("Dads", Object.toJSON(e));
    }
}
function registerbox_open() {
    var $temp;
    "object" != typeof $windows.registerbox
        ? (($temp = $("chatinhalt")),
          ($windows.registerbox = new Window({
              className: $win_style,
              width: 450,
              height: 250,
              top: eval($temp.offsetTop + Math.round(50 * Math.random())),
              left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
              resizable: !1,
              showEffect: Effect.Appear,
              hideEffect: Effect.DropOut,
              showEffectOptions: { duration: 0.5 },
              hideEffectOptions: { duration: 0.5 },
              draggable: !0,
              minimizable: !1,
              maximizable: !1,
              destroyOnClose: !1,
              opacity: 1,
          })),
          $windows.registerbox.setHTMLContent($template.registerbox),
          ($("activation_sms").onclick = function () {
              $("registermsg-0").innerHTML = "تلفن همراهي";
          }),
          ($("activation_mail").onclick = function () {
              $("registermsg-0").innerHTML = "ايميلي";
          }),
          ($("registerboxform").onsubmit = function () {
              var e = this.getElementsByTagName("button")[0];
              return (
                  e.setAttribute("disabled", "disabled"),
                  new Ajax.Request(url("ajax/register"), {
                      onSuccess: function (e) {
                          if (((data = e.responseJSON), data.status))
                              "valid" == data.action
                                  ? (registerbox_valid(), Cockie.set("activereg", "1"))
                                  : "chat" == data.action &&
                                    $windows.registerregisterboxuser.setHTMLContent(
                                        '<div id="register_formular"> متشکريم بابت ثبت نام شما - هم اکنون رفرش نماييد تا ثبت نام شما تکميل شود<br /><br /><a id="fresh" href="javascript:document.location.reload();">رفرش کردن صفحه </a></div>'
                                    );
                          else
                              switch (data.error) {
                                  case "testcockie":
                                      alert("لطفا صفحه خود را رفرش کنيد");
                                      break;
                                  case "proxyblock":
                                      alert("استفاده از فيلتر شکن مجاز نيست");
                                      break;
                                  case "username":
                                      alert("لطفا نام کاربري وارد کنيد");
                                      break;
                                  case "badname":
                                      alert("اين نام کاربري مجاز نيست");
                                      break;
                                  case "runningname":
                                      alert("اين نام کاربري متعلق به کاربر ديگري است");
                                      break;
                                  case "password":
                                      alert("لطفا کلمه عبور را وارد کنيد");
                                      break;
                                  case "repeatpassword":
                                      alert("تکرار کلمه عبور صحيح نميباشد");
                                      break;
                                  case "firstname":
                                      alert("لطفا نام کوچک خود را وارد کنيد");
                                      break;
                                  case "lastname":
                                      alert("لطفا نام خانوادگي خود را وارد کنيد");
                                      break;
                                  case "cellphone":
                                      alert("لطفا تلفن همراه خود را وارد کنيد");
                                      break;
                                  case "email":
                                      alert("لطفا ايميل خود را وارد کنيد");
                                      break;
                                  case "recellphone":
                                      alert("اين تلفن همراه متعلق به کاربر ديگري است");
                                      break;
                                  case "state":
                                      alert("لطفا استان خود را وارد کنيد");
                                      break;
                                  case "city":
                                      alert("لطفاشهر خود را وارد کنيد");
                                      break;
                                  case "gender":
                                      alert("جنسيت خود را مشخص کنيد");
                                      break;
                                  case "cannotsms":
                                      alert("درحال حاضر ما توان ارسال پيامک نداريم.لطفا از روش ايميل استفاده کنيد");
                                      break;
                                  case "cannotmail":
                                      alert("درحال حاضر ما توان ارسال ايميل نداريم.لطفا از روش پيامک استفاده کنيد");
                                      break;
                                  case "remail":
                                      alert("اين ايميل قبلا ثبت شده");
                                      break;
                                  case "every24":
                                      alert("ثبت نام هر 24 ساعت فقط يک بار امکان پذير است");
                              }
                      },
                      onComplete: function () {
                          e.removeAttribute("disabled");
                      },
                      postBody: $("registerboxform").serialize(),
                  }),
                  !1
              );
          }))
        : "none" == $($windows.registerbox.getId()).style.display &&
          (($temp = $("chatinhalt")), $windows.registerbox.setLocation(eval($temp.offsetTop + Math.round(50 * Math.random())), eval($temp.offsetLeft + Math.round(50 * Math.random())))),
        "1" == Cockie.get("activereg") ? registerbox_valid() : ($windows.registerbox.show(), $windows.registerbox.toFront());
}
function registerbox_valid() {
    var $temp, $code;
    "object" != typeof $windows.registervalid &&
        (($temp = $("chatinhalt")),
        ($windows.registervalid = new Window({
            className: $win_style,
            width: 450,
            height: 250,
            top: eval($temp.offsetTop + Math.round(50 * Math.random())),
            left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
            resizable: !1,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        })),
        (temp = "ايميلي"),
        $("activation_sms").checked ? (temp = "پيامکي") : $("activation_mail").checked && (temp = "ايميلي"),
        ($code = $template.registervalid),
        ($code = $code.replace(/\[0\]/gi, temp)),
        $windows.registervalid.setHTMLContent($code),
        ($("registervalidform").onsubmit = function () {
            var e = this.getElementsByTagName("button")[0];
            return (
                e.setAttribute("disabled", "disabled"),
                new Ajax.Request(url("ajax/register.confrim"), {
                    onSuccess: function (e) {
                        if (((data = e.responseJSON), data.status))
                            $windows.registervalid.setHTMLContent(
                                '<div id="register_formular"> متشکريم بابت ثبت نام شما - هم اکنون رفرش نماييد تا ثبت نام شما تکميل شود<br /><br /><a id="fresh" href="javascript:document.location.reload();">رفرش کردن صفحه </a></div>'
                            ),
                                Cockie.set("activereg", "0");
                        else
                            switch (data.error) {
                                case "invalid":
                                    alert("کد معتبر نيست");
                                    break;
                                case "code":
                                    alert("لطفا کد فعال سازي را وارد کنيد");
                                    break;
                                case "timeout":
                                    alert("زمان تائيد عضويت بيش از حد طول کشيدولطفا دوباره امتحان کنيد");
                                    break;
                                case "register":
                                    alert("لطفا ابتدا عضو بشويد");
                            }
                    },
                    onComplete: function () {
                        e.removeAttribute("disabled");
                    },
                    postBody: $("registervalidform").serialize(),
                }),
                !1
            );
        })),
        $windows.registerbox.hide(),
        $windows.registervalid.show(),
        $windows.registervalid.toFront();
}
function rmLastSmily() {
    Cockie.set("TarhPardaz", ""), (document.getElementById("TarhPardaz-smily").innerHTML = ""), ($windows.smileys_favorite = []);
}
function open_close_smileys_win(input_field_name) {
    "object" != typeof $windows.smileys
        ? (($windows.smileys = new Window({
              className: $win_style,
              width: 450,
              height: 250,
              top: eval($mouse.top - 195),
              left: eval($mouse.left - 120),
              resizable: !1,
              showEffect: Effect.Appear,
              hideEffect: Effect.DropOut,
              showEffectOptions: { duration: 0.5 },
              hideEffectOptions: { duration: 0.5 },
              draggable: !0,
              minimizable: !0,
              maximizable: !0,
              destroyOnClose: !1,
              opacity: 1,
          })),
          $windows.smileys.setHTMLContent($windows.smileys_groups +"<hr>"+
              '<div id="smileys_list"><center><button onclick="rmLastSmily();">پاک کردن آخرين شکلک هاي ارسال شده</button></center>'+
      
      '<div id="TarhPardaz-smily">' +
                  (Cockie.get("TarhPardaz").isJSON() ? Cockie.get("TarhPardaz").evalJSON().join(" ") : "") +
                  "</div><hr><div class=\"newgr\">" +
             
                  $windows.smileys_content +
                  "</div><hr><div style=\"display: grid;justify-content: center;\"><button class=\"moresmile\" onclick=\"moresmile();\">نمایش بیشتر</button></div></div>"
          ))
        : "none" == $($windows.smileys.getId()).style.display && $windows.smileys.setLocation(eval($mouse.top - 195), eval($mouse.left - 120));
    try {
        Event.stopObserving("smileys_list", "click");
    } catch (e) {}
    Event.observe("smileys_list", "click", function (e) {
        "" != Event.element(e).id &&
            "smileys_list" != Event.element(e).id &&
            "TarhPardaz-smily" != Event.element(e).id &&
            ($windows.smileys.close(),
            ($(input_field_name).value += Event.element(e).id),
            Cockie.get("TarhPardaz").isJSON() && ($windows.smileys_favorite = $windows.smileys_favorite.concat(Cockie.get("TarhPardaz").evalJSON())),
            $windows.smileys_favorite.push('<img src="' + Event.element(e).src + '" id="' + Event.element(e).id + '" style="cursor:pointer;" >'),
            $(input_field_name).focus()),
            (document.getElementById("TarhPardaz-smily").innerHTML = $windows.smileys_favorite.uniq().reverse().join(" ")),
            Cockie.set("TarhPardaz", Object.toJSON($windows.smileys_favorite.uniq().reverse()));
    }),
        "none" == $($windows.smileys.getId()).style.display ? ($windows.smileys.show(), $windows.smileys.toFront()) : $windows.smileys.close();
}
function close_info_win(e) {
    $windows.block_ids.each(function (t) {
        $($windows.block[t].getId()).visible() && $windows.block[t].getId() != e && $windows.block[t].close();
    });
}
function let_write() {
    ($("message").disabled = !1), ($("message").value = ""), $("message").focus(), ($repeatspeedwarn = 0);
}
function window_height() {
    var flag_innerHeight = !1;
    if (window.innerHeight)
        (flag_innerHeight = !0),
            $("chatinhalt").style.height != eval(window.innerHeight - 150) + "px" &&
                (($("chatinhalt").style.height = eval(window.innerHeight - 150) + "px"), ($("onlinelist").style.height = eval(window.innerHeight - 150) + "px"), ($("splitpane").style.height = eval(window.innerHeight - 150) + "px"));
    else {
        if (!document.documentElement || !document.documentElement.clientWidth) return 0;
        try {
            if ($("chatinhalt").style.height == eval(document.documentElement.clientHeight - 150) + "px") return 0;
            ($("chatinhalt").style.height = eval(document.documentElement.clientHeight - 150) + "px"),
                ($("onlinelist").style.height = eval(document.documentElement.clientHeight - 150) + "px"),
                ($("splitpane").style.height = eval(document.documentElement.clientHeight - 150) + "px");
        } catch (e) {
            return 0;
        }
    }
}
function in_array(e, t, i) {
    var s = "";
    if (i) {
        for (s in t) if (t[s] === e) return !0;
    } else for (s in t) if (t[s] == e) return !0;
    return !1;
}
function dec2hex(e) {
    var t = (e = parseInt(e)) / 16,
        i = e % 16;
    return (t = 0 <= (t -= i / 16) && t <= 9 ? t : "ABCDEF".charAt(t - 10)), 0 <= i && i <= 9 ? t + "" + i : t + "" + "ABCDEF".charAt(i - 10);
}
function hex2dec(e) {
    return parseInt(e, 16);
}
function parser(e) {
    return (e = e.replace(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />')).replace(/\[url(?:\=?)(.*?)\](.*?)\[\/url\]/gi, '<a href="$1" target="_blank"><b><font color=red>$2</font></b></a>');
}
function addmessage(params) {
    var $codemsg = "",
        gender_icon,
        temp,
        priv_icon,
        type,
        message,
        checkmsg,
        cfmsg_priv,
        timemsg,
        win_id2,
        privat_win_opponent,
        privat_win_opponent_id,
        $temp,
        int_id,
        status_public,
        $code,
        mod;
    if ("" == params.message) return !1;
  var reactionid=params.msgid;
  if($setting.pluginreaction){
  if(reactionid=="myself"){reactionid=0}else{var reactionid=params.msgid;}
  var reaction='<div onblur="reacthide('+reactionid+')" style="display:none;width: 320px;box-shadow: 0 0 5px 2px #dadada;height: 25px;border-radius: 25px;background: #f0ece7" id="'+reactionid+'"><span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'1)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/eyeg.gif">';
 reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'2)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f44d.gif"></span>';
 reaction+=' <span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'3)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f44f.gif"></span>';
  reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'4)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f4a9.gif"></span>';
  reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'5)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f601.gif"></span>';
 reaction+=' <span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'6)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f91d.gif"></span>';
 reaction+=' <span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'7)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f483.gif"></span>';
  reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'8)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f92c.gif"></span>';
  reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'9)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/1f92e.gif"></span>';
  reaction+='<span style="padding: 0px 5px;"><img onclick="reactmsg('+reactionid+','+'10)" style="width: 20px;height: 20px;padding-bottom: 5px;padding-top: 2px;" src="theme/images/emojyofreaction/2764-fe0f.gif"></span>';
  reaction+='</div>';
  var typereact='<span class="events '+params.reac+'" style="margin-left:10px;" id="reac_'+params.msgid+'">';
  typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/eyeg.gif"> </span>';
   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20x;height: 20px;" src="theme/images/emojyofreaction/1f44d.gif"> </span>';
  typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f44f.gif"> </span>';
   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f4a9.gif"> </span>';
   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f601.gif"> </span>';
  typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f91d.gif"> </span>';
   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f483.gif"> </span>';
   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f92c.gif"> </span>';
     typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/1f92e.gif"> </span>';

   typereact+='<span style="font-size:17px;color:red;display: none;background: beige;padding: 3px 3px;border-radius: 7px;margin-right: 5px;"><span>1</span><img  style="width: 20px;height: 20px;" src="theme/images/emojyofreaction/2764-fe0f.gif"> </span>';

  
  typereact+='</span>';}else{reaction="";typereact="";}
            var idreact=params.msgid;
          if(idreact=="myself"){idreact=0;}else{idreact=params.msgid;}
    var win_id1 = [],
        count_priv_win = 0,
        win_cf = [],
        count_cf_win = 0;
    if (-1 != params.user_id || "0" != params.privat || $setting.showmsgsys) {
        switch (
            (($numsmiles = 0),
            -1 != params.user_id && -1 == params.message.indexOf('<a id="nocheck" style="color:red;"') && (params.message = params.message.substr(0, $setting.maxlengthmsg)),
            (params.message = params.message.replace(/\(s(\d{1,4})\)/gi, numSmilies)),
            "" != params.id && (params.id = "" + $msgid),
            (gender_icon = ""),
            $setting.thumbavatar &&
                1 == $setting.showavatars &&
                "" != params.avatar &&
                (("null" != params.avatar && null != params.avatar) || (params.avatar = $setting.defaultavatar),
                (gender_icon += '<a target="_blank" href="' + url("profile/" + params.user_id) + '" /><img class="avatar" title="براي مشاهده پروفايل کليک کنيد" src="' + theme_url($setting.avatardir + "/" + params.avatar) + '" /></a>')),
            params.sex)
        ) {
            case "1":
            case 1:
                temp = theme_url("theme/images/chat/chat.user_m.png");
                break;
            case "2":
            case 2:
                temp = theme_url("theme/images/chat/chat.user_f.png");
                break;
            case "0":
            case 0:
                temp = theme_url("theme/images/chat/chat.user_n.png");
        }
        (gender_icon += '<img id="meeno" src="' + temp + '" />'),
            -1 == params.user_id && (gender_icon = ""),
            (status_public = ""),
            (status_public = void 0 !== $status_public[params.user_id] && $setting.show_status_public ? $status_public[params.user_id] : "");
        var msgreport = 1 == $setting.show_reporter_private ? params.message.replace(/<[^>]*>?/gm, "") : "",
            report_text = '<img id="' + params.tid + '" src="' + theme_url("theme/images/chat/untick.png") + '">',
            report_text_pm = "";
        if (
            ((checkHideIcons = $setting.hideIcons ? "display:none;" : ""),
            $me.id != params.user_id &&
                1 == $setting.show_reporter_private &&
                ((report_text =
                    '<img title="گزارش" class="reportcls" style="cursor:pointer;' +
                    checkHideIcons +
                    '" src="' +
                    theme_url("theme/images/chat/report.png") +
                    '" onclick="report_text_2admins(\'' +
                    params.user_id +
                    "','" +
                    msgreport +
                    "')\" />"),
                (report_text_pm = '<img src="' + theme_url("theme/images/chat/gozaresh.png") + '" onclick="report_text_2admins(\'' + params.user_id + "','" + msgreport + "','private')\" />")),
            (priv_icon = ""),
            (type = getType(params.priv)),
            "" != type.taj && (priv_icon = '<img id="meeno" src="' + type.taj + '" align="absbottom" title="' + type.title + '" alt="' + type.title + '" />'),
            "0" == params.privat)
        ) {
            var userstyle_clickable = "",
                timemsg = "",
                rndCode = getRandom(),
                DropDownWidth = 0,
                admin_user = "0" != $me.admin ? '<img title="مديريت" class="adminwand" style="cursor:pointer;' + checkHideIcons + '" src="' + theme_url("theme/images/chat/chat.wand.png") + '" id="adminu_' + params.user_id + '" /> <img title="سنجاق کردن" id="pinplg" height="15" class="adminwand" style="cursor:pointer;' + checkHideIcons + '" src="' + theme_url("theme/images/chat/pin.png") + '" onclick="pinmsg(\'' + rndCode + "');\" /> " : "";
            if (
                ("" != admin_user && params.user_id == $me.id && (admin_user = ' <img title="سنجاق کردن" id="pinplg" height="15" class="adminwand" style="cursor:pointer;' + checkHideIcons + '" src="' + theme_url("theme/images/chat/pin.png") + '" onclick="pinmsg(\'' + rndCode + '\');" />  <img style="display:none;" src="' + theme_url("theme/images/chat/chat.space.gif") + '" weight="16" height="16" /> '),
                "" != admin_user && -1 == params.user_id && (admin_user = ""),
                params.user_id != $me.id && (userstyle_clickable = 'id="inflblock_' + params.user_id + '" style="cursor:pointer"'),
                $setting.timemsg && (timemsg = "<i>(" + params.time + ")</i>"),
                (TsRemoveMsg = ""),
                "0" != $me.admin &&
                    $me.id != params.user_id &&
                    ((TsRemoveMsg = '<div class="dropdowns">'),
                    (TsRemoveMsg +=
                        '<img style="cursor:pointer;" onclick="showDropDowns(\'' +
                        rndCode +
                        '\')" src="/theme/images/chat/eraser_sn.png" height="15"/><div id="Dropdowns_' +
                        rndCode +
                        '" class="dropdown-contents"><div class="arrow"></div>'),
                    (TsRemoveMsg += '<a href="javascript:;" onclick="removeMsg(\'' + params.user_id + "','" + params.msgid + "','delone','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-trash'></i> حذف اين پيام</a>"),
                    (TsRemoveMsg +=
                        '<a href="javascript:;" onclick="removeMsg(\'' + params.user_id + "','" + params.msgid + "','delall','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-trash'></i> حذف پيام هاي اين کاربر</a>"),
                    (TsRemoveMsg += '<a href="javascript:;" onclick="SilentUser(\'' + params.user_id + "','" + rndCode + "','true')\" style='padding: 2px 5px;'><i class='fa fa-volume-down '></i> حذف پيام ها و ساکت کردن</a>"),
                    (TsRemoveMsg += '<a href="javascript:;" onclick="BennUser(\'' + params.user_id + "','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-sign-out '></i> حذف پيام ها و اخراج کردن</a>"),
                    (TsRemoveMsg += '<a href="javascript:;" onclick="SilentUser(\'' + params.user_id + "','" + rndCode + "','false')\" style='padding: 2px 5px;'><i class='fa fa-volume-down '></i> ساکت کردن کاربر در عمومي</a>"),
                    (TsRemoveMsg += "</div></div>")),
                (menu = ""),
                ($setting.reply || $setting.deletemessage || $setting.forward || $setting.edittext) &&
                    ((menu = '<div class="dropdown">'),
                    (menu +=
                        '<img style="cursor:pointer;' +
                        checkHideIcons +
                        '" onclick="showDropDown(\'' +
                        rndCode +
                        '\')" src="/theme/images/chat/replypm.png" class="replycls" /><div id="Dropdown_' +
                        rndCode +
                        '" class="dropdown-content" style="width:130px"><div class="arrow"></div>'),
                    $setting.reply &&
                        $me.reply &&
                        (menu += '<a href="javascript:;" style="width: 65px;" onclick="replymsg(\'' + rndCode + "','main','" + params.msgid + "')\"><i class='fa fa-reply-all' style='margin-right: 2px;'></i> پاسخ</a>"),
                    $setting.forward && $me.forward && (menu += '<a href="javascript:;" onclick="forwardmsg(\'' + rndCode + "','" + params.msgid + "')\"><i class='fa fa-mail-forward' style='margin-right: 2px;'></i> ارسال</a>"),
                    $setting.edittext &&
                        $me.edittext &&
                        (params.hasOwnProperty("forward") ||
                            ("myself" == params.msgid &&
                                (menu += '<a href="javascript:;" style="width: 65px;" onclick="editmsg(\'' + rndCode + "','main','" + params.msgid + "')\"><i class='fa fa-pencil-square-o' style='margin-right: 2px;'></i> ويرايش</a>"))),
                    $setting.deletemessage &&
                        $me.delmsg &&
                        "myself" == params.msgid &&
                        (menu += '<a href="javascript:;" onclick="delete_message(\'' + rndCode + "','" + params.msgid + "','main')\"><i class='fa fa-trash' style='margin-right: 2px;'></i> حذف</a>"),
                    (menu += "</div></div>")),
                (message = parser(params.message)),
                params.hasOwnProperty("forward"))
            ) {
                var $code = $template.forwardmsg,
                    $code = $code.replace(/{userid}/gi, params.user_id),
                    $code = $code.replace(/\[0\]/gi, timemsg),
                    $code = $code.replace(/\[1\]/gi, report_text + TsRemoveMsg + admin_user + status_public + gender_icon + priv_icon),
                    $code = $code.replace(/\[2\]/gi, UserClickable(params.user_id)),
                    $code = $code.replace(/\[3\]/gi, params.user),
                    $code = $code.replace(/\[4\]/gi, params.css),
                    $code = $code.replace(/\[5\]/gi, params.forward.replace(/\(s(\d{1,4})\)/gi, numSmilies)),
                    $code = $code.replace(/\[msgid\]/gi, params.msgid),
                    $code = $code.replace(/\[6\]/gi, params.name),
                    $code = $code.replace(/\[menu\]/gi, menu),
                    $code = $code.replace(/\[7\]/gi, rndCode);
                params.message = "Forwarded Message From '" + params.name + "'";
            } else if (params.hasOwnProperty("reply")) {
                $numsmiles = 0;
                 
             
                var $code = $template.replymsg,
                    $code = $code.replace(/{userid}/gi, params.user_id),
                    $code = $code.replace(/\[0\]/gi, timemsg),
                    $code = $code.replace(/\[1\]/gi, report_text + TsRemoveMsg + admin_user + status_public + gender_icon + priv_icon),
                    $code = $code.replace(/\[2\]/gi, UserClickable(params.user_id)),
                    $code = $code.replace(/\[3\]/gi, params.user),
                    $code = $code.replace(/\[4\]/gi, params.css),
                    $code = $code.replace(/\[5\]/gi, params.reply.replace(/\(s(\d{1,4})\)/gi, numSmilies)),
                    $code = $code.replace(/\[6\]/gi, message),
                    $code = $code.replace(/\[7\]/gi, params.name),
                    $code = $code.replace(/\[8\]/gi, rndCode),
                    $code = $code.replace(/\[menu\]/gi, menu),
                    $code = $code.replace(/\[msgid\]/gi, params.msgid),
                    $code = $code.replace(/\[typereact\]/gi, typereact),
                    $code = $code.replace(/\[reaction\]/gi, reaction),
                    $code = $code.replace(/\[react\]/gi,idreact),
                    $code = $code.replace(/\[9\]/gi, theme_url("theme/images/chat/replypm.png"));
            } else if (params.hasOwnProperty("sendfile")) {
             
               if($me.id != params.user_id && 1 == $setting.show_reporter_private ){report_text = '<img title="گزارش" class="reportcls" style="cursor:pointer;' +checkHideIcons + '" src="' + theme_url("theme/images/chat/report.png") + '" onclick="report_text_2admins(\'' +params.user_id + "','"+params.url + "')\" />";}
                else{report_text = '<img id="' + params.tid + '" src="' + theme_url("theme/images/chat/tick.png") + '">';}    
              var poption = params.user_id == $me.id ? '<img style="cursor:pointer;" onclick="delete_message(\'' + rndCode + "','myself','main','file')\" src=\"/theme/images/chat/eraser_sn.png\" height=\"15\"/>" : "",
                    oadmin = "";
              var rndcod1=getRandom();
                 var menusendfile = '<div class="dropdown"><img style="cursor:pointer;'+checkHideIcons +'" onclick="showDropDown(\'' +rndCode +'\')" src="/theme/images/chat/replypm.png" class="replycls" /><div id="Dropdown_' +rndCode +'" class="dropdown-content" style="width:130px"><div class="arrow"></div>';
            if( $setting.reply && $me.reply){
    menusendfile += '<a href="javascript:;" style="width: 65px;" onclick="replymsg(\'' + rndCode + "','main','" + params.msgid + "')\"><i class='fa fa-reply-all' style='margin-right: 2px;'></i> پاسخ</a></div></div>";

            }
              
              var rand=JSON.parse(params.message).rand;
                params.user_id != $me.id &&
                    "0" != $me.admin &&
                    ((oadmin = '<div class="dropdowns">'),
                    (oadmin +=
                        '<img style="cursor:pointer;" onclick="showDropDowns(\'' +
                        rndCode +
                        '\')" src="/theme/images/chat/eraser_sn.png" height="15"/><div id="Dropdowns_' +
                        rndCode +
                        '" class="dropdown-contents"><div class="arrow"></div>'),
                    (oadmin += '<a href="javascript:;" onclick="removeMsg(\'' + params.user_id + "','" + params.msgid + "','delone','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-trash'></i> حذف اين پيام</a>"),
                    (oadmin += '<a href="javascript:;" onclick="removeMsg(\'' + params.user_id + "','" + params.msgid + "','delall','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-trash'></i> حذف پيام هاي اين کاربر</a>"),
                    (oadmin += '<a href="javascript:;" onclick="SilentUser(\'' + params.user_id + "','" + rndCode + "','true')\" style='padding: 2px 5px;'><i class='fa fa-volume-down '></i> حذف پيام ها و ساکت کردن</a>"),
                    (oadmin += '<a href="javascript:;" onclick="BennUser(\'' + params.user_id + "','" + rndCode + "')\" style='padding: 2px 5px;'><i class='fa fa-sign-out '></i> حذف پيام ها و اخراج کردن</a>"),
                    (oadmin += '<a href="javascript:;" onclick="SilentUser(\'' + params.user_id + "','" + rndCode + "','false')\" style='padding: 2px 5px;'><i class='fa fa-volume-down '></i> ساکت کردن کاربر در عمومي</a>"),
                    (oadmin += "</div></div>"));
                var t =
                        "image" == params.type
                            ? '<a media="image" href="' + params.url + '" target="_blank" style="color:red;line-height: 0px;padding-left: 10px;font-size: 16px;font-weight: 300;" ><img style="width: 200px;filter: blur(4.5px);" src="'+params.url+'"></a>'
                            : "video" == params.type
                            ? '<a media="video" href="' + params.url + '" target="_blank" style="display: inline-flex;color:red;line-height: 60px;padding-left: 10px;font-size: 16px;font-weight: 300;" ><video width="320" height="240" controls src="' + params.url + '" type="video/mp4"></video></a>'
                            : "music" == params.type
                            ? '<div media="music" style="display: inline-block;"class="music-player"><audio id="audio' + rand + '" src="'+params.url+'"></audio><div class="player"><div class="buttons"><img onclick="musicrun('+rand+')"class="play-pause-btn" src="/theme/images/play icon.png" id="play'+rand+'"><img class="play-pause-btn" src="/theme/images/pause icon.png" id="pause'+rand+'" style="display: none;"></div><div class="under-time-line"><span id="time-past'+rand+'">0:00</span></div><div class="time-line" id="time-line'+rand+'"><div class="background"></div><div class="fill" id="fill'+rand+'" style="width: 100%;"></div><div class="fill-btn" id="fill-btn'+rand+'" style="left: 100%;"></div><div id="left-width-time-line'+rand+'"></div><div id="right-width-time-line'+rand+'"></div></div><div class="under-time-line"><span id="time-left'+rand+'" style="padding: 3px 3px 3px 10px;">0:00</span></div><div class="volume" id="volume'+rand+'"><div class="background"></div><div class="fill"></div><div class="fill-btn"></div><div id="left-width-volume'+rand+'"></div><div id="right-width-volume'+rand+'"></div></div><div id="download"><a  target="_blank" id="download-link" href="'+ params.url + '" dideo-checked="true"><img id="download-image" src="/theme/images/download.png"></a></div></div></div>'
                            : "voice" == params.type
                            ? '<div media="voice" style="display: inline-block; background-color: #809fff !important;"class="music-player "><audio id="audio' + rand + '" src="'+params.url+'"></audio><div class="player"><div class="buttons"><img onclick="musicrun('+rand+')"class="play-pause-btn" src="/theme/images/play icon.png" id="play'+rand+'"><img class="play-pause-btn" src="/theme/images/pause icon.png" id="pause'+rand+'" style="display: none;"></div><div class="under-time-line"><span id="time-past'+rand+'">0:00</span></div><div class="time-line" id="time-line'+rand+'"><div class="background"></div><div class="fill" id="fill'+rand+'" style="width: 100%;"></div><div class="fill-btn" id="fill-btn'+rand+'" style="left: 100%;"></div><div id="left-width-time-line'+rand+'"></div><div id="right-width-time-line'+rand+'"></div></div><div class="under-time-line"><span id="time-left'+rand+'" style="padding: 3px 3px 3px 10px;">0:00</span></div><div class="volume" id="volume'+rand+'"><div class="background"></div><div class="fill"></div><div class="fill-btn"></div><div id="left-width-volume'+rand+'"></div><div id="right-width-volume'+rand+'"></div></div><div id="download"><a  target="_blank" id="download-link" href="'+ params.url + '" dideo-checked="true"><img id="download-image" src="/theme/images/download.png"></a></div></div></div>'  
                : '<a media="file" href="' + params.url + '" target="_blank"><u><b><br><center><font color=red>یک فایل ارسال کرد برای مشاهده کلیک کنید</font></center></br></b></u></a>',
                    $code = $template.sendfile,
                    $code = $code.replace(/{userid}/gi, params.user_id),
                    $code = $code.replace(/\[0\]/gi, timemsg),
                    $code = $code.replace(/\[1\]/gi, report_text+poption + oadmin +status_public + gender_icon + priv_icon),
					$code = $code.replace(/\[2\]/gi, UserClickable(params.user_id)),
					$code = $code.replace(/\[4\]/gi, params.css),
                    $code = $code.replace(/\[m\]/gi, t),
                    $code = $code.replace(/\[n\]/gi, params.user),
                    $code = $code.replace(/\[r\]/gi, rndCode),
					$code = $code.replace(/\[menu\]/gi,menusendfile ),
                     $code = $code.replace(/\[react\]/gi,idreact),
                    $code = $code.replace(/\[8\]/gi, typereact),
                    $code = $code.replace(/\[9\]/gi, reaction),
                    $code = $code.replace(/\[msgid\]/gi, params.msgid);
            } else
    
                var $code = $template.generalmessage,
                    $code = $code.replace(/{userid}/gi, params.user_id),
                    $code = $code.replace(/\[0\]/gi, timemsg),
                    $code = $code.replace(/\[1\]/gi, report_text + TsRemoveMsg + admin_user + status_public + gender_icon + priv_icon),
                    $code = $code.replace(/\[2\]/gi, UserClickable(params.user_id)),
                    $code = $code.replace(/\[3\]/gi, params.user),
                    $code = $code.replace(/\[4\]/gi, params.css),
                    $code = $code.replace(/\[5\]/gi, message),
                    $code = $code.replace(/\[6\]/gi, rndCode),
                    $code = $code.replace(/\[9\]/gi, reaction),
                    $code = $code.replace(/\[8\]/gi, typereact),
                    $code = $code.replace(/\[menu\]/gi, menu),
                    $code = $code.replace(/\[hideIcons\]/gi, $setting.hideIcons ? "display:none;" : ""),
                    $code = $code.replace(/\[msgid\]/gi, params.msgid),
                    $code = $code.replace(/\[react\]/gi,idreact),
                    $code = $code.replace(/\[7\]/gi, theme_url("theme/images/chat/replypm.png"));
            $codemsg = $code;
           
        } else if ("1" == params.cf)
            (checkmsg = $me.id == params.user_id ? '<img id="' + params.tid + '" src="' + theme_url("theme/images/chat/untick.png") + '">' : ""),
                (rndCode = getRandom()),
                (menus = ""),
                ($setting.reply || $setting.forward) &&
                    ((menus = '<div class="dropdown">'),
                    (menus +=
                        '<img style="cursor:pointer;" onclick="showDropDown(\'' +
                        params.into +
                        "_" +
                        rndCode +
                        '\')" src="/theme/images/chat/replypm.png" class="dropbtn" /><div id="Dropdown_' +
                        params.into +
                        "_" +
                        rndCode +
                        '" class="dropdown-content" style="width:105px"><div class="arrow"></div>'),
                    $setting.reply &&
                        $me.reply &&
                        (menus += '<a href="javascript:;" onclick="replymsg(\'' + params.into + "_" + rndCode + "','cf','" + params.msgid + "','" + params.into + "')\"><i class='fa fa-reply-all' style='margin-right: 2px;'></i> پاسخ</a>"),
                    $setting.forward &&
                        $me.forward &&
                        (menus += '<a href="javascript:;" onclick="forwardmsg(\'' + params.into + "_" + rndCode + "','" + params.msgid + "')\" ><i class='fa fa-mail-forward' style='margin-right: 2px;'></i> ارسال</a>"),
                    (menus += "</div></div>"),
                    (menus = menus.replace(/\[width\]/gi, DropDownWidths))),
                (cfmsg_priv = params.hasOwnProperty("reply")
                    ? (($numsmiles = 0),
                      (cfmsg_priv = $template.replymsg_private),
                      (cfmsg_priv = cfmsg_priv.replace(/\[1\]/gi, checkmsg + gender_icon + priv_icon)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[3\]/gi, params.user)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[4\]/gi, params.css)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[5\]/gi, params.reply.replace(/\(s(\d{1,4})\)/gi, numSmilies))),
                      (cfmsg_priv = cfmsg_priv.replace(/\[6\]/gi, params.message)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[7\]/gi, params.name)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[menus\]/gi, menus)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[8\]/gi, theme_url("theme/images/chat/replypm.png"))),
                      (cfmsg_priv = cfmsg_priv.replace(/\[9\]/gi, params.into + "_" + rndCode)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[msgid\]/gi, params.msgid)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[10\]/gi, params.into)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[100\]/gi, UserClickable(params.user_id))),
                      cfmsg_priv.replace(/\[11\]/gi, "cf"))
                    : ((cfmsg_priv = $template.message_private_win),
                      (cfmsg_priv = cfmsg_priv.replace(/\[0\]/gi, "-2" != params.user_id ? checkmsg + gender_icon + priv_icon : "")),
                      (cfmsg_priv = cfmsg_priv.replace(/\[1\]/gi, params.user)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[2\]/gi, params.css)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[3\]/gi, params.message)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[4\]/gi, params.into + "_" + rndCode)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[msgid\]/gi, params.msgid)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[100\]/gi, UserClickable(params.user_id))),
                      (cfmsg_priv = cfmsg_priv.replace(/\[6\]/gi, params.into)),
                      (cfmsg_priv = cfmsg_priv.replace(/\[menus\]/gi, menus)),
                      cfmsg_priv.replace(/\[7\]/gi, "cf"))),
                _notify(params, "اتاق کنفرانس"),

                (cfmsg_priv = "-2" != params.user_id ? cfmsg_priv.replace(/\[5\]/gi, theme_url("theme/images/chat/replypm.png")) : cfmsg_priv.replace(/<img (.*?)><\/img>/gi, "")),
                (cfmsg_priv = "-2" == params.user_id ? '<div class="privat_ausg_an">' + cfmsg_priv + "</div>" : cfmsg_priv),
                (win_cf[count_cf_win] = params.into == $me.id ? $me.id : params.into),
                "object" != typeof $windows.cf[win_cf[count_cf_win]] &&
                    (($temp = $("chatinhalt")),
                    ($windows.cf[win_cf[count_cf_win]] = new Window({
                        className: $win_style,
                        title: "اتاق کنفرانس " + params.cfname,
                        width: 440,
                        height: 200,
                        top: eval($temp.offsetTop + Math.round(50 * Math.random())),
                        left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
                        resizable: !0,
                        showEffect: Effect.Appear,
                        hideEffect: Effect.DropOut,
                        showEffectOptions: { duration: 0.5 },
                        hideEffectOptions: { duration: 0.5 },
                        draggable: !0,
                        minimizable: !0,
                        maximizable: !1,
                        destroyOnClose: !1,
                        opacity: 1,
                    })),
                    ($code = $template.cf_window),
                    ($code = $code.replace(/\[0\]/gi, win_cf[count_cf_win])),
                    ($code = $code.replace(/\[1\]/gi, win_cf[count_cf_win])),
                    ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/Checked_small.png"))),
                    ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/Smiley_small.png"))),
                    ($code = $code.replace(/\[4\]/gi, theme_url("theme/images/chat/eraser.png"))),
                    ($code = $code.replace(/\[5\]/gi, theme_url("theme/images/chat/upload_images_private.png"))),
                    ($code = $code.replace(/\[6\]/gi, theme_url("theme/images/chat/chat.cfinfo.png"))),
                    ($code = $code.replace(/\[7\]/gi, theme_url("theme/images/chat/videochat_small.png"))),
                    $windows.cf[win_cf[count_cf_win]].setHTMLContent($code),
                    (myObserver = {
                        onEndResize: function (eventName, win) {
                            win == $windows.cf[win_cf[count_cf_win]] && ($("pivate_win_" + win_cf[count_cf_win]).style.height = eval(win.getSize().height - 33) + "px");
                        },
                        onClose: function () {
                            $("message").focus();
                        },
                    }),
                    Windows.addObserver(myObserver),
                    ($("win_form_" + win_cf[count_cf_win]).onsubmit = function () {
                        return send2cf("message_win_" + win_cf[count_cf_win], win_cf[count_cf_win], 0), !1;
                    }),
                    ($("submit_img_" + win_cf[count_cf_win]).onclick = function () {
                        return send2cf("message_win_" + win_cf[count_cf_win], win_cf[count_cf_win], 0), !1;
                    }),
                    ($("cls_" + win_cf[count_cf_win]).onclick = function () {
                        $("pivate_win_" + win_cf[count_cf_win]).innerHTML = "";
                    }),
                    ($("smileys_img_" + win_cf[count_cf_win]).onclick = function () {
                        open_close_smileys_win(this.id.replace("smileys_img_", "message_win_"));
                    }),
                    ($("upload_img_" + win_cf[count_cf_win]).onclick = function () {
                        var e = this.id.replace("upload_img_", "message_win_");
                        self.makeUploadAction1(e, win_cf[count_cf_win], "cf");
                    }),
                    ($("cf_videochat_" + win_cf[count_cf_win]).onclick = function () {
                        self.cfvideochat("invite", !1, !1, win_cf[count_cf_win], params.cfname);
                    }),
                    ($("cfinfo_" + win_cf[count_cf_win]).onclick = function () {
                        self.info_cf_private(win_cf[count_cf_win]);
                    }),
                    ($("message_win_" + win_cf[count_cf_win]).onfocus = function () {
                        (this.style.color = $("message").style.color),
                            (this.style.fontWeight = $("message").style.fontWeight),
                            (this.style.fontStyle = $("message").style.fontStyle),
                            (this.style.fontSize = $("message").style.fontSize),
                            (this.style.fontFamily = $("message").style.fontFamily);
                    })),
                $windows.cf[win_cf[count_cf_win]].show(),
                $("pivate_win_" + win_cf[count_cf_win]).insert({ bottom: cfmsg_priv }),
                setTimeout(function () {
                    $("pivate_win_" + win_cf[count_cf_win]).scrollTop = $("pivate_win_" + win_cf[count_cf_win]).scrollHeight;
                }, 100),
                setTimeout(function () {
                    $("pivate_win_" + win_cf[count_cf_win]).scrollTop = $("pivate_win_" + win_cf[count_cf_win]).scrollHeight;
                }, 300);
        else if ("-3" == params.user_id)
            ($code = $template.message_private_genetal_get),
                (timemsg = ""),
                $setting.timemsg && (timemsg = "<i>(" + params.time + ")</i>"),
                ($code = $code.replace(/\[0\]/gi, timemsg)),
                ($code = $code.replace(/\[1\]/gi, ("-1" != params.user_id ? report_text_pm : "") + gender_icon + priv_icon)),
                ($code = $code.replace(/\[2\]/gi, params.user)),
                ($code = $code.replace(/\[3\]/gi, params.css)),
                $code.replace(/\[4\]/gi, params.message),
                ($codemsg = $code);
        else if ("" != params.id)
            ($code =
                params.user_id == $me.id
                    ? (($code = $template.message_private_genetal_sent),
                      (timemsg = ""),
                      $setting.timemsg && (timemsg = "<i>(" + params.time + ")</i>"),
                      ($code = $code.replace(/\[0\]/gi, timemsg)),
                      ($code = $code.replace(/\[1\]/gi, ("-1" != params.user_id ? report_text_pm : "") + gender_icon + priv_icon)),
                      ($code = $code.replace(/\[2\]/gi, params.user)),
                      ($code = $code.replace(/\[3\]/gi, $privato)),
                      ($code = $code.replace(/\[4\]/gi, params.css)),
                      $code.replace(/\[5\]/gi, params.message))
                    : (($code = $template.message_private_genetal_get),
                      (timemsg = ""),
                      $setting.timemsg && (timemsg = "<i>(" + params.time + ")</i>"),
                      ($code = $code.replace(/\[0\]/gi, timemsg)),
                      ($code = $code.replace(/\[1\]/gi, ("-1" != params.user_id ? report_text_pm : "") + gender_icon + priv_icon)),
                      ($code = $code.replace(/\[2\]/gi, params.user)),
                      ($code = $code.replace(/\[3\]/gi, params.css)),
                      $code.replace(/\[4\]/gi, params.message))),
                ($codemsg = $code);
        else {
            if (
                ((win_id2 =
                    "get" == params.type
                        ? ((win_id1[count_priv_win] = params.user_id + "00000" + $me.id), $me.id + "00000" + params.user_id)
                        : ((win_id1[count_priv_win] = params.user_id + "00000" + params.privat), params.privat + "00000" + params.user_id)),
                "object" != typeof $windows.privat[win_id1[count_priv_win]] &&
                    "object" != typeof $windows.privat[win_id2] &&
                    ((privat_win_opponent_id = params.user_id == $me.id ? ((privat_win_opponent = $privato), params.privat) : ((privat_win_opponent = params.user), params.user_id)),
                    ($temp = $("chatinhalt")),
                    (privat_win_opponent = "-1" == params.user_id && "pm" == params.into ? "گزارشات سيستم" : "خصوص با " + privat_win_opponent),
                    ($windows.privat[win_id1[count_priv_win]] = new Window({
                        className: $win_style,
                        title: privat_win_opponent,
                        width: 470,
                        height: 205,
                        top: eval($temp.offsetTop + Math.round(50 * Math.random())),
                        left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
                        resizable: !0,
                        showEffect: Effect.Appear,
                        hideEffect: Effect.DropOut,
                        showEffectOptions: { duration: 0.5 },
                        hideEffectOptions: { duration: 0.5 },
                        draggable: !0,
                        minimizable: !0,
                        maximizable: !1,
                        destroyOnClose: !1,
                        opacity: 1,
                    })),
                    void 0 === $LoadHistory_HISTORY[params.user_id] && ($LoadHistory_HISTORY[params.user_id] = params.msgid),
                    ($code = $template.private_window),
                    ($code = $code.replace(/\[0\]/gi, win_id1[count_priv_win])),
                    ($code = $code.replace(/{to}/gi, params.user_id)),
                    ($code = $code.replace(/\[1\]/gi, $windows.privat[win_id1[count_priv_win]].getId())),
                    ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/Checked_small.png"))),
                    ($code = $code.replace(/\[STYLE\]/gi, 1 == $setting.chat_loadlastmsg ? "block" : "none")),
                    ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/Smiley_small.png"))),
                    ($code = $code.replace(/\[STYLE\]/gi, 1 == $setting.chat_loadlastmsg ? "block" : "none")),
                    ($code = in_array($me.type, $setting.useroptions.buzz)
                        ? $code.replace(
                              /\[4\]/gi,
                              '<img src="' + theme_url("theme/images/chat/buzz.png") + '" id="buzz_' + win_id1[count_priv_win] + '" title="تلنگر"  alt="تلنگر"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                          )
                        : $code.replace(/\[4\]/gi, '<span id="buzz_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
						 ($code = in_array($me.type, $setting.voicesetting.pm) && $setting.voicesetting.status == "true" ? $code.replace(/\[voice_chat\]/gi, '<img src="' + theme_url("theme/images/chat/voicechat.png") + '" id="voicechat_' +  win_id1[count_priv_win] + '" title="پیام صوتی" alt="پیام صوتی"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>') : $code.replace(/\[voice_chat\]/gi, '<span id="voicechat_' +  win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.private_eraser)
                        ? $code.replace(
                              /\[5\]/gi,
                              '<img src="' + theme_url("theme/images/chat/eraser.png") + '" id="cls_' + win_id1[count_priv_win] + '" title="پاک کن" alt="پاک کن"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                          )
                        : $code.replace(/\[5\]/gi, '<span id="cls_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.private_status_check)
                        ? $code.replace(
                              /\[6\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/status_check.png") +
                                  ' " id="idle_' +
                                  win_id1[count_priv_win] +
                                  '" title="برسي وضعيت" alt="برسي وضعيت"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                          )
                        : $code.replace(/\[6\]/gi, '<span id="idle_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.sendedimages)
                        ? $code.replace(
                              /\[7\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/upload_images_private.png") +
                                  '" id="upload_img_' +
                                  win_id1[count_priv_win] +
                                  '" title="ارسال تصوير" alt="ارسال تصوير"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                          )
                        : $code.replace(/\[7\]/gi, '<span id="upload_img_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.private_blocker)
                        ? $code.replace(
                              /\[8\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/blocker_small.png") +
                                  '" id="blocker_user_' +
                                  win_id1[count_priv_win] +
                                  '" title="مسدود سازي"  alt="مسدود سازي"  style="height:18px;width:48px;padding-left: 4px;cursor:pointer;">'
                          )
                        : $code.replace(/\[8\]/gi, '<span id="blocker_user_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.addreport)
                        ? $code.replace(
                              /\[9\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/gozaresh.png") +
                                  '" id="report_user_' +
                                  win_id1[count_priv_win] +
                                  '" title="گزارش" alt="گزارش"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                          )
                        : $code.replace(/\[9\]/gi, '<span id="report_user_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = in_array($me.type, $setting.useroptions.videochat)
                        ? $code.replace(
                              /\[12\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/videochat_small.png") +
                                  '" id="videochat_' +
                                  win_id1[count_priv_win] +
                                  '" title="چت تصويري" alt="جت تصويري"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                          )
                        : $code.replace(/\[12\]/gi, '<span id="videochat_' + win_id1[count_priv_win] + '" style="display:none;"></span>')),
                    ($code = $code.replace(/\[10\]/gi, theme_url("theme/images/chat/chat.cfinviter.png"))),
                    ($code = $code.replace(/\[11\]/gi, theme_url("theme/images/chat/chat.friend_add.png"))),
                    ($code =
                        "0" != $me.admin && $me.id != params.user_id
                            ? $code.replace(
                                  /\[e14\]/gi,
                                  '<img src="' +
                                      theme_url("theme/images/chat/chat.wand.png") +
                                      '" onclick=changeUserEvent("adminu_' +
                                      params.user_id +
                                      '") title="اخراج" alt="اخراج"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                              )
                            : $code.replace(/\[e14\]/gi, '<span id="report_user_" style="display:none;"></span>')),
                    $windows.privat[win_id1[count_priv_win]].setHTMLContent($code),
                    (myObserver = {
                        onEndResize: function (eventName, win) {
                            win == $windows.privat[win_id1] && ($("pivate_win_" + $F("this_win_" + win.getId())).style.height = eval(win.getSize().height - 33) + "px");
                        },
                        onClose: function () {
                            $("message").focus();
                        },
                    }),
                    Windows.addObserver(myObserver),
                    ($("win_form_" + win_id1[count_priv_win]).onsubmit = function () {
                        return $me.guest && $setting.advcreg ? registerbox_open() : send2privatwin(this.id.replace("win_form_", "message_win_"), params.user_id), !1;
                    }),
                    ($("submit_img_" + win_id1[count_priv_win]).onclick = function () {
                        return $me.guest && $setting.advcreg ? registerbox_open() : send2privatwin(this.id.replace("submit_img_", "message_win_"), params.user_id), !1;
                    }),
                    ($("videochat_" + win_id1[count_priv_win]).onclick = function () {
                        self.videochat("invite", params.user_id, !1, !1, !1);
                    }),
                    ($("submit_img_" + win_id1[count_priv_win]).onclick = function () {
                        return $me.guest && $setting.advcreg ? registerbox_open() : send2privatwin(this.id.replace("submit_img_", "message_win_"), params.user_id), !1;
                    }),
                    ($("smileys_img_" + win_id1[count_priv_win]).onclick = function () {
                        open_close_smileys_win(this.id.replace("smileys_img_", "message_win_"));
                    }),
                    ($("cls_" + win_id1[count_priv_win]).onclick = function () {
                        $("pivate_win_" + win_id1).innerHTML = "";
                    }),
                    ($("buzz_" + win_id1[count_priv_win]).onclick = function () {
                        new Ajax.Request("ajax/chat.buzz", {
                            onSuccess: function () {
                                Effect.Shake($windows.privat[win_id1].getId()),
                                    new Audio("theme/sound/buzz.wav").play(),
                                    ($("pivate_win_" + win_id1).innerHTML += '<div><span style="color:red;font-weight:bold;font-family: arial;direction:ltr;">BUZZ!!</span></div>'),
                                    ($("pivate_win_" + int_id).scrollTop = $("pivate_win_" + int_id).scrollHeight);
                            },
                            postBody: "user=" + params.user_id + "&token=" + $setting.chpw,
                        });
                    }),
                    ($("idle_" + win_id1[count_priv_win]).onclick = function (e) {
                        (e = this.id.replace("idle_", "message_win_")), self.info_user_private(e, params.user_id);
                    }),
					
                    $("voicechat_" + win_id1[count_priv_win]).onclick = function() {
                       var e = this.id.replace("voicechat_", "message_win_");
                       voicechat("pm", params.user_id, params.user);
                     },
                    ($("upload_img_" + win_id1[count_priv_win]).onclick = function () {
                        var e = this.id.replace("upload_img_", "message_win_");
                        self.makeUploadAction1(e, params.user_id, "pm");
                    }),
                    ($("blocker_user_" + win_id1[count_priv_win]).onclick = function () {
                        return (
                            new Ajax.Request(url("ajax/chat.block"), {
                                onSuccess: function (e) {
                                    alert(e.responseText), "مسدود شد" == e.responseText && $windows.privat[win_id1].close();
                                },
                                postBody: "block_priv=" + privat_win_opponent_id + "&token=" + $setting.chpw,
                            }),
                            !1
                        );
                    }),
                    ($("inviate2mycf_" + win_id1[count_priv_win]).onclick = function () {
                        1 == confirm("درخواست کنفرانس فرستاده شود؟") &&
                            new Ajax.Request(url("ajax/chat.conference"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "id=" + privat_win_opponent_id + "&action=invite&token=" + $setting.chpw,
                            });
                    }),
                    ($("priv_add2myfriends_" + win_id1[count_priv_win]).onclick = function () {
                        1 == confirm("درخواست دوستي فرستاده شود؟") &&
                            new Ajax.Request(url("ajax/chat.addme2friendlist"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "id=" + privat_win_opponent_id + "&token=" + $setting.chpw,
                            });
                    }),
                    ($("message_win_" + win_id1[count_priv_win]).onfocus = function () {
                        (this.style.color = $("message").style.color),
                            (this.style.fontWeight = $("message").style.fontWeight),
                            (this.style.fontStyle = $("message").style.fontStyle),
                            (this.style.fontSize = $("message").style.fontSize),
                            (this.style.fontFamily = $("message").style.fontFamily);
                    })),
                (int_id = "object" == typeof $windows.privat[win_id1[count_priv_win]] ? win_id1[count_priv_win] : win_id2),
                "allowchat" == params.into)
            )
                if ("request" == params.message) ($code = $template.allowchat), ($code = $code.replace(/\[0\]/gi, params.user_id)), ($code = $code.replace(/\[1\]/gi, params.user));
                else if ("allowed" == params.message)
                    ($code = ""),
                        new Ajax.Request(url("ajax/chat.allowchat"), {
                            onSuccess: function (e) {
                                if (in_array(params.user_id, $allowchat) || "ok" != e.responseText) alert(e.responseText);
                                else {
                                    $allowchat[$allowchat.length] = params.user_id;
                                    var t = $template.allowchatmessage;
                                    (t = (t = t.replace(/\[0\]/gi, "#17AD15")).replace(/\[1\]/gi, "اجازه چت خصوصي داده شد.")), $("pivate_win_" + int_id).insert(t);
                                }
                            },
                            postBody: "action=answering&id=" + params.user_id + "&answer=true",
                        });
                else {
                    var $code = $template.allowchatmessage,
                        messagea = "true" == params.message ? "اجازه چت خصوصي داده شد." : "اجازه چت خصوصي داده نشد.",
                        colora = "true" == params.message ? "#17AD15" : "red";
                    ($code = $code.replace(/\[0\]/gi, colora)), ($code = $code.replace(/\[1\]/gi, messagea)), "true" == params.message && ($allowchat[$allowchat.length] = params.user_id);
                }
            else {
                if ((($code = $template.message_private_win), "{BUZZ}" == params.message && 1 == $setting.buzz))
                    (params.message = " BUZZ!!!"), (params.css = "color:red;font-weight:bold;font-family: arial;direction:ltr;"), Effect.Shake($windows.privat[int_id].getId()), Sound.play("theme/sound/buzz.mp3");
                else {
                    if ("{BUZZ}" == params.message && 0 == $setting.buzz) return !1;
                    $code = $code.replace(/\[3\]/gi, params.message);
                }
                (timemsg = ""),
                    $setting.timemsgpv && (timemsg = "<i>(" + params.time + ")</i>"),
                    (status_public = ""),
                    (status_public = void 0 !== $status_public[params.user_id] && $setting.show_status_public ? $status_public[params.user_id] : "");
                var msgreport = 1 == $setting.show_reporter_private ? params.message.replace(/<[^>]*>?/gm, "") : "",
                    admin_user =
                        "0" != $me.admin && $me.id != params.user_id ? ' <img style="cursor:pointer;" src="' + theme_url("theme/images/chat/chat.wand.png") + '" onclick="changeUserEvent(\'adminu_' + params.user_id + "')\" /> " : "",
                    report_text =
                        $me.id != params.user_id && 1 == $setting.show_reporter_private
                            ? '<img style="cursor:pointer;" src="' + theme_url("theme/images/chat/gozaresh.png") + '" onclick="report_text_2admins(\'' + params.user_id + "','" + msgreport + "','private','" + params.msgid + "')\" />"
                            : "",
                    checkmsg = $me.id == params.user_id ? '<img id="' + params.tid + '" src="' + theme_url("theme/images/chat/untick.png") + '">' : "",
                    DropDownWidths = 0,
                    rndCode = getRandom(),
                    menus = "",
                    where = params.hasOwnProperty("reply") ? "replypv" : "pv";
                if (
                    (($setting.reply || $setting.forward || $setting.deletemessage) &&
                        ((menus = '<div class="dropdown">'),
                        (menus +=
                            '<img style="cursor:pointer;" onclick="showDropDown(\'' +
                            int_id +
                            "_" +
                            rndCode +
                            '\')" src="/theme/images/chat/replypm.png" class="dropbtn" /><div id="Dropdown_' +
                            int_id +
                            "_" +
                            rndCode +
                            '" class="dropdown-content" style="width:[width]px"><div class="arrow"></div>'),
                        $setting.reply &&
                            $me.reply &&
                            ((DropDownWidths += 50),
                            (menus += '<a href="javascript:;" onclick="replymsg(\'' + int_id + "_" + rndCode + "','pm','" + params.msgid + "','" + params.privat + "')\"><i class='fa fa-reply-all' style='margin-right: 4px;'></i> پاسخ</a>")),
                        $setting.forward &&
                            $me.forward &&
                            ((DropDownWidths += 50),
                            (menus += '<a href="javascript:;" onclick="forwardmsg(\'' + int_id + "_" + rndCode + "','" + params.msgid + "')\"><i class='fa fa-mail-forward' style='margin-right: 2px;'></i> ارسال</a>")),
                        $setting.edittext &&
                            $me.edittext &&
                            (params.hasOwnProperty("forward") ||
                                ((DropDownWidths += 40),
                                "myself" == params.msgid &&
                                    (menus +=
                                        '<a href="javascript:;" style="width: 56px;" onclick="EditTextPriv(\'' +
                                        int_id +
                                        "_" +
                                        rndCode +
                                        "','" +
                                        where +
                                        "','" +
                                        params.msgid +
                                        "')\"><i class='fa fa-pencil-square-o' style='margin-right: 2px;'></i> ویرایش</a>"))),
                        $setting.deletemessage &&
                            $me.delmsg &&
                            (params.hasOwnProperty("forward") ||
                                ("myself" == params.msgid &&
                                    ((DropDownWidth += 40),
                                    (menus += '<a href="javascript:;" onclick="delete_message(\'' + int_id + "_" + rndCode + "','" + params.msgid + "','" + where + "')\" style='width: 52px;'><i class='fa fa-trash'></i> حذف</a>")))),
                        (menus += "</div></div>"),
                        (menus = menus.replace(/\[width\]/gi, DropDownWidths))),
                    params.hasOwnProperty("forward"))
                ) {
                    var $code = $template.forwardmsg_private;
                    ($code = $code.replace(/\[1\]/gi, timemsg + checkmsg + admin_user + status_public + gender_icon + priv_icon)),
                        ($code = $code.replace(/\[2\]/gi, params.user)),
                        ($code = $code.replace(/\[3\]/gi, params.css)),
                        ($code = $code.replace(/\[4\]/gi, params.forward.replace(/\(s(\d{1,4})\)/gi, numSmilies))),
                        ($code = $code.replace(/\[5\]/gi, params.name)),
                        ($code = $code.replace(/\[6\]/gi, int_id + "_" + rndCode)),
                        ($code = $code.replace(/\[msgid\]/gi, params.msgid)),
                        ($code = $code.replace(/\[menus\]/gi, menus)),
                        ($code = $code.replace(/\[7\]/gi, UserClickable(params.user_id))),
                        (params.message = "Forwarded Message From '" + params.name + "'");
                } else
                    params.hasOwnProperty("reply")
                        ? (($numsmiles = 0),
                          ($code = $template.replymsg_private),
                          ($code = $code.replace(/\[1\]/gi, timemsg + checkmsg + report_text + admin_user + status_public + gender_icon + priv_icon)),
                          ($code = $code.replace(/\[3\]/gi, params.user)),
                          ($code = $code.replace(/\[4\]/gi, params.css)),
                          ($code = $code.replace(/\[5\]/gi, params.reply.replace(/\(s(\d{1,4})\)/gi, numSmilies))),
                          ($code = $code.replace(/\[6\]/gi, params.message)),
                          ($code = $code.replace(/\[7\]/gi, params.name)),
                          ($code = $code.replace(/\[8\]/gi, theme_url("theme/images/chat/replypm.png"))),
                          ($code = $code.replace(/\[9\]/gi, int_id + "_" + rndCode)),
                          ($code = $code.replace(/\[msgid\]/gi, params.msgid)),
                          ($code = $code.replace(/\[10\]/gi, params.privat)),
                          ($code = $code.replace(/\[menus\]/gi, menus)),
                          ($code = $code.replace(/\[11\]/gi, "pm")),
                          ($code = $code.replace(/\[100\]/gi, UserClickable(params.user_id))))
                        : (($code = $code.replace(/\[0\]/gi, "-1" != params.user_id ? timemsg + checkmsg + admin_user + report_text + status_public + gender_icon + priv_icon : "")),
                          ($code = $code.replace(/\[1\]/gi, params.user)),
                          ($code = $code.replace(/\[2\]/gi, params.css)),
                          ($code = $code.replace(/\[4\]/gi, int_id + "_" + rndCode)),
                          ($code = $code.replace(/\[msgid\]/gi, params.msgid)),
                          ($code = $code.replace(/\[6\]/gi, params.privat)),
                          ($code = $code.replace(/\[menus\]/gi, menus)),
                          ($code = $code.replace(/\[100\]/gi, UserClickable(params.user_id))),
                          ($code = $code.replace(/\[7\]/gi, "pm")),
                          ($code = "-1" != params.user_id ? $code.replace(/\[5\]/gi, theme_url("theme/images/chat/replypm.png")) : $code.replace(/<img (.*?)><\/img>/gi, "")),
                          ($code = $code.replace(/\[3\]/gi, params.message)),
                          "-1" != params.user_id && _notify(params, "پيام خصوصي از طرف"));
                        

      
                    		              

            }
            $("pivate_win_" + int_id).insert({ bottom: $code }),
            
                setTimeout(function () {
                    $("pivate_win_" + int_id).scrollTop = $("pivate_win_" + int_id).scrollHeight;
                }, 100),
                setTimeout(function () {
                    $("pivate_win_" + int_id).scrollTop = $("pivate_win_" + int_id).scrollHeight;
                }, 300),
                "allowchat" == params.into &&
                    "request" == params.message &&
                    (($("true_" + params.user_id).onclick = function () {
                        ($("true_" + params.user_id).disabled = "disabled"),
                            new Ajax.Request(url("ajax/chat.allowchat"), {
                                onSuccess: function (e) {
                                    if (in_array(params.user_id, $allowchat) || "ok" != e.responseText) alert(e.responseText);
                                    else {
                                        ($allowchat[$allowchat.length] = params.user_id), alert("موافقت شما ثبت شد");
                                        var t = $template.allowchatmessage;
                                        (t = (t = t.replace(/\[0\]/gi, "#17AD15")).replace(/\[1\]/gi, "اجازه چت خصوصي داده شد.")), $("pivate_win_" + int_id).insert(t);
                                    }
                                    $("true_" + params.user_id)
                                        .up(2)
                                        .remove();
                                },
                                postBody: "action=answering&id=" + params.user_id + "&answer=true",
                            });
                    }),
                    ($("false_" + params.user_id).onclick = function () {
                        ($("false_" + params.user_id).disabled = "disabled"),
                            new Ajax.Request(url("ajax/chat.allowchat"), {
                                onSuccess: function (e) {
                                    if ("ok" == e.responseText) {
                                        alert("مخالفت شما ثبت شد");
                                        var t = $template.allowchatmessage;
                                        (t = (t = t.replace(/\[0\]/gi, "red")).replace(/\[1\]/gi, "اجازه چت خصوصي داده نشد.")), $("pivate_win_" + int_id).insert(t);
                                    } else alert(e.responseText);
                                    $("true_" + params.user_id)
                                        .up(2)
                                        .remove();
                                },
                                postBody: "action=answering&id=" + params.user_id + "&answer&=true",
                            });
                    }));
            try {
                $windows.privat[int_id].show();
            } catch (e) {}
            count_priv_win++, count_cf_win++;
        }   var mesvara=document.createElement("div");mesvara.style.margin="0px 0px 10px 0px";mesvara.style.position='relative';mesvara.setAttribute("id",'meses'+ params.id);mesvara.innerHTML='<div  style="position:relative;" onmouseover="TarhPardazIcons(this,\'inline-block\');" onmouseout="TarhPardazIcons(this,\'none\');" class="msgnum_' + params.msgid + '" id="mes' + params.id + '">' + $codemsg + "</div>" ;


          if("" != params.id && "" != $codemsg){($("chatinhalt").insert({ bottom:mesvara}),
            $msgid++)}
        
            "0" == params.privat
                ? (params.id > $setting.numsgmain && ((mod = params.id - $setting.numsgmain), $("meses" + mod) && $("meses" + mod).remove()),
                  (!$CHECK_AUTO_SCROLL && "get" == params.type) || (setTimeout("$('chatinhalt').scrollTop = $('chatinhalt').scrollHeight;", 100), setTimeout("$('chatinhalt').scrollTop = $('chatinhalt').scrollHeight;", 300)))
                : "" != params.id &&
                  (params.id > $setting.numsgmain && ((mod = params.id - $setting.numsgmain), $("meses" + mod) && $("meses" + mod).remove()),
                  setTimeout("$('chatinhalt').scrollTop = $('chatinhalt').scrollHeight;", 100),
                  setTimeout("$('chatinhalt').scrollTop = $('chatinhalt').scrollHeight;", 300));
    }
}
function receiveResultJSON(e) {
    if(e.responseText == "verfiy") {
        document.getElementById("verfiyModal").style.display = "block";
        return;
    }
    var t,
        i,
        s = new Date(),
        n = Date.parse(s) / 1e3;
    if ((($time_last_req = n), ($get_message_req = !1), "blacklist" == (o = e.responseText))) window.location.href = url("benned");
    else if ("exit" == o) window.location.href = url("logout/" + $setting.chpw);
    else if ("" != o) {
        if ("0" != (p = o.evalJSON()).clear_s && null != p.clear_s) for (var a = 0; a < p.clear_s.length; a++) for (var o = JSON.parse(p.clear_s[a]), r = 0; r < o.length; r++) document.getElementsByClassName("msgnum_" + o[r])[0].remove();
        if ("0" != p.edit_s && null != p.edit_s)
            for (n = 0; n < p.edit_s.length; n++)
                ($numsmiles = 0),
                    (e = document.getElementsByClassName("msgnum_" + p.edit_s[n].id)),
                    "reply" == p.edit_s[n].act &&
                        (e[0].childElements()[0].childElements()[1].childElements()[1].childElements()[0].innerHTML = p.edit_s[n].message.replace(/\(s(\d{1,4})\)/gi, numSmilies) + ' <font color="green">[Edited]</font>'),
                    (e[0].childElements()[0].childElements()[3].innerHTML = p.edit_s[n].message.replace(/\(s(\d{1,4})\)/gi, numSmilies) + ' <font color="green">[Edited]</font>');
        if ("1" == p.refresh) return window.location.reload(), !1;
        if (
            ("null" != p.alert && 1 < p.alert.length && alert(p.alert),
            "true" == p.exit && (window.location.href = url("logout/" + $setting.chpw)),
            "1" == p.clear && ($("chatinhalt").innerHTML = ""),
            1 == p.cf && ((o = parseInt(document.getElementById("myrequest").innerHTML.replace("درخواست های شما ", "")) + parseInt(1)), (document.getElementById("myrequest").innerHTML = "درخواست های شما  " + o)),
            0 != p.addfriend &&
                null != p.addfriend &&
                ((o = parseInt(document.getElementById("myrequest").innerHTML.replace("درخواست های شما ", "")) + parseInt(1)), (document.getElementById("myrequest").innerHTML = "درخواست های شما  " + o)),
            0 != p.vc && null != p.vc && $setting.block_video_audio_chat)
        ) {
            for (var l, c = p.vc, d = p.vc_chid, m = p.vc_rid, p = 0; p < $usersObj.userOnline.length; p++)
                if ($usersObj.userOnline[p].ui == c) {
                    (l = $usersObj.userOnline[p].un), (n = $usersObj.userOnline[p].up), (o = $usersObj.userOnline[p].us);
                    break;
                }
            var u = getType(n);
            (r = 1 == (o = confirm("نام : " + l + "\nجنسيت: " + ("1" == o ? "مرد" : "زن") + "\nدرجه : " + u.title + "\nدرخواست چت تصويري کرده است قبول ميکنيد؟")) ? "false" : "true"),
                o && (changeUserEvent("privatwin_" + c), self.videochat("get", c, d, m, c)),
                new Ajax.Request("ajax/chat.videochat", {
                    onSuccess: function (e) {
                        e.responseText && alert(e.responseText);
                    },
                    postBody: "reject=" + r + "&to=" + c,
                });
        }
        if (0 != p.cvc && null != p.cvc) {
            for (t = p.cvc, s = 0; s < $usersObj.userOnline.length; s++)
                if ($usersObj.userOnline[s].ui == t) {
                    l = $usersObj.userOnline[s].un;
                    break;
                }
            var g = p.cvc_chid,
                _ = p.cvc_rid,
                f = p.cvc;
            self.cfvideochat("join", g, _, f, l);
        }
        for (
            0 != p.move &&
                null != p.move &&
                new Ajax.Request("ajax/chat.memove", {
                    onSuccess: function (e) {
                        alert(e.responseText), ($("chatinhalt").innerHTML = "");
                    },
                    postBody: "changeroom=" + p.move + "&key=" + p.move_key,
                }),
                $me.silent = p.silent,
                i = 0;
            i < p.data.length;
            i++
        )
            addmessage(p.data[i]);
    }
  if(p.reactmsg !==null){
 varareact(p.reactmsg);}
   var usertyping=(p.typing);
  var place = '';
if($setting.plugintyping && $me.typing){


  if(usertyping.length==0){
    document.getElementById("message").placeholder= $setting.omomi ;}

 
   else if(usertyping.length<4){document.getElementById("message").placeholder= usertyping+' در حال نوشتن ...';}
   
   
  else if (usertyping.length>=4){document.getElementById("message").placeholder= usertyping.length +'  نفر در حال نوشتن ...';}
 
}else{document.getElementById("message").placeholder= $setting.omomi ;}
  if($setting.pluginadsvideo){
if(p.numvid==true){
var tvid=p.tablighvideo;
  numbervid=tvid.length;
 
  
   var typevid=tvid[0].type;
    var closevid=tvid[0].close;
    var filevid=tvid[0].file;
    var urlvid=tvid[0].url;
     
    
        

  tablighvideo(typevid,filevid,urlvid,closevid,numbervid);
    
       

   
 
}}
 
}
function varareact(p){
               var reaction=(p);
              var idreact=reaction[1];
              var txreat='reac_';
  var resrec=document.getElementById(txreat+idreact);
  var arrreact=reaction[2];
  if(arrreact.length==0){resrec.style.display='none';}
  if(arrreact.length>0){

    for(var i=0;i<arrreact.length;i++){
     if(arrreact[i]==1){resrec.children[i].style.display='none';}
    }


   
    if(arrreact[0]>=2){resrec.children[0].style.display='inline-flex';resrec.children[0].children[0].innerHTML=arrreact[0]-1;}
     
    if(arrreact[1]>=2){resrec.children[1].style.display='inline-flex';resrec.children[1].children[0].innerHTML=arrreact[1]-1;}
      
    if(arrreact[2]>=2){resrec.children[2].style.display='inline-flex';resrec.children[2].children[0].innerHTML=arrreact[2]-1;}
    
    if(arrreact[3]>=2){resrec.children[3].style.display='inline-flex';resrec.children[3].children[0].innerHTML=arrreact[3]-1;}
      
    if(arrreact[4]>=2){resrec.children[4].style.display='inline-flex';resrec.children[4].children[0].innerHTML=arrreact[4]-1;}
     
    if(arrreact[5]>=2){resrec.children[5].style.display='inline-flex';resrec.children[5].children[0].innerHTML=arrreact[5]-1;}
      
    if(arrreact[6]>=2){resrec.children[6].style.display='inline-flex';resrec.children[6].children[0].innerHTML=arrreact[6]-1;}
      
    if(arrreact[7]>=2){resrec.children[7].style.display='inline-flex';resrec.children[7].children[0].innerHTML=arrreact[7]-1;}
      
    if(arrreact[8]>=2){resrec.children[8].style.display='inline-flex';resrec.children[8].children[0].innerHTML=arrreact[8]-1;}
     
if(arrreact[9]>=2){resrec.children[9].style.display='inline-flex';resrec.children[9].children[0].innerHTML=arrreact[9]-1;}

  }
}
function checkreload() {
    var e = new Date();
    (b = Date.parse(e) / 1e3), 10 < b - $time_last_req && (clearTimeout($timerget), ($get_message_req = !1), AjaxReadRequest());
}
function AjaxReadRequest(e = null) {
    null == typeof e && (e = !1);
    var t = !1,
        i = !1,
        s = !1;
    e ? (s = i = !(t = !0)) : $get_message_req || (s = i = t = !0),
        t &&
            (i && (clearTimeout($timerget), ($timerget = setTimeout(AjaxReadRequest, $setting.reload_interval))),
            s && ($get_message_req = !0),
            new Ajax.Request(url("ajax/get"), {
                method: "post",
                onSuccess: receiveResultJSON,
                onFailure: function () {
                    s && ($get_message_req = !1);
                },
                postBody: "token=" + $setting.chpw

            }));
}
function privat_msgs() {
    if (document.getElementById("privat_msgs")) {
        var e = !$("privat_msgs").checked;
        ($setting.status_private = e),
            new Ajax.Request(url("ajax/chat.user.settings"), {
                onSuccess: function (e) {
                    alert(e.responseText), ReloaderUserOnline(!0);
                },
                postBody: "message=" + e + "&token=" + $setting.chpw,
            });
    }
}
function ReloaderUserOnline(e) {
    var t = document.getElementById("autocomplete"),
        i = t ? t.value : 0;
    t = t ? i.length : 0;
    var s = !1,
        n = !1,
        a = !1;
    null == typeof e && (e = !1),
        e ? (a = n = !(s = !0)) : !$get_update_req && t < 1 && (n = a = s = !0),
        s &&
            (n && (clearTimeout($timeruser), ($timeruser = setTimeout(ReloaderUserOnline, 3e4))),
            a && ($get_update_req = !0),
            new Ajax.Request(url("ajax/getuser"), {
                method: "get",
                onSuccess: function (e) {
                    a && ($get_update_req = !1), updateUserOnlineAnzeige(e.responseJSON);
                },
                onFailure: function () {
                    a && ($get_update_req = !1), self.ajaxError();
                },
            }));
}
function send(e) {
    var t,
        i,
        s,
        n,
        a = $("message"),
        o = $("privat").value,
        r = a.value,
        c = o;
    if ((("" != o && "0" != o) || ((o = "-1"), (c = "0")), "" == r)) return !1;
    if (((t = new Date()), 2 == $me.silent || 1 == $me.silent)) return (a.value = "شما اجازه صحبت در چت روم را نداريد!"), a.blur(), setTimeout(let_write, 3e3), !1;
    if (0 != $setting.scoretosendmsg && $me.score < $setting.scoretosendmsg && "0" == c)
        return (a.value = "براي ارسال در عمومي بايد حداقل داراي " + $setting.scoretosendmsg + " امتياز باشيد"), a.blur(), a.setAttribute("disabled", !0), setTimeout(let_write, 3e3), !1;
    if (0 == $setting.sendmsguest && 1 == $me.guest && "0" == c) return (a.value = "براي ارسال در عمومي بايد عضو شويد"), a.blur(), a.setAttribute("disabled", !0), setTimeout(let_write, 3e3), !1;
    if (0 != $setting.speedtext) {
        if (3 == $repeatspeedwarn) return !1;
        if ((i = Math.round(t.getTime() / 1e3)) - $lastsend <= $setting.speedtext) {
            if (0 == $repeatspeedwarn) return (a.value = "لطفا آرام تر تايپ کنيد"), a.blur(), a.setAttribute("disabled", !0), ($repeatspeedwarn = 1), setTimeout(let_write, 3e3), !1;
            $repeatspeedwarn++, ($lastsend = i);
        } else ($repeatspeedwarn = 0), ($lastsend = i);
    } else if ($lsatmsgsent == a.value) {
        if (++$numrepeatmsg > $setting.repeatmsg) return (a.value = "از تکرار متون بپرهيزيد"), a.blur(), a.setAttribute("disabled", !0), setTimeout(let_write, 3e3), !1;
    } else ($lsatmsgsent = a.value), ($numrepeatmsg = 0);
    for (a.value = "", a.focus(), s = 0; s != $smilies.smilies.length; s++) $smilies.smilies[s].hasOwnProperty("name") && (r = str_replace($smilies.smilies[s].name, $smilies.smilies[s].code, r));
    return (
        (img = r.match(/\[img\](.*?)\[\/img\]/gi) && $setting.allow_image) && ($me.bank = $me.bank - $setting.image_score * img),
        (n = r.match(/\[url(?:\=?)(.*?)\](.*?)\[\/url\]/gi) && $setting.allow_url) && ($me.bank = $me.bank - $setting.url_score * n),
        (n = "font-weight:" + $("bold").value + ";font-style:" + $("italic").value + ";color:" + $("color").value),
        void 0 !== $("fontsize") && (n += ";font-size:" + $("fontsize").value),
        void 0 !== $("fontname") && (n += ";font-family:" + $("fontname").value),
        (l = []),
        (l.id = $msgid),
        (l.user = $me.username),
        (l.user_id = $me.id),
        (l.message = r),
        (l.time = t.getHours() + ":" + t.getMinutes()),
        (l.privat = c),
        (l.css = n),
        (l.priv = $me.type),
        (l.sex = $me.gender),
        (l.type = "send"),
        (l.msgid = "myself"),
        (l.tid = "public_" + getRandom()),
       (l.reac = "reac_" + getRandom()),
        (l.avatar = $me.avatar),
        void 0 !== e && "n" != e
            ? ($("message").clear(),
              (l.reply = e.msg),
               (l.tyreply=e.tytx),
               (l.tymedia=e.tymed),
              (l.name = e.name),
              new Ajax.Request(url("ajax/chat.reply"), {
                  onSuccess: function (e) {
                      var t = e.getAllHeaders();
                      void 0 !== e.responseText && ($(l.tid).parentNode.parentNode.parentNode.parentNode.addClassName("msgnum_" + e.responseText), $(l.tid).parentNode.parentNode.parentNode.parentNode.removeClassName("msgnum_myself")),
                          "" != t && ($(l.tid).src = theme_url("theme/images/chat/tick.png"));
                    if(0 !== e.responseText){var xv=document.getElementsByClassName(l.reac)[0];xv.setAttribute("id","reac_"+e.responseText)};
                  },
                  parameters: { uname: e.name, umsg: e.msg, msgid: e.msgid, mymsg: r,typemsg:e.tytx,typemedia:e.tymed, where: "main" },
              }),
              replyclose(),
              addmessage(l))
            : (addmessage(l),
              new Ajax.Request(url("ajax/get"), {
                  onSuccess: function (e) {
                      "" != e.getAllHeaders() && ($(l.tid).src = theme_url("theme/images/chat/tick.png")),
                          receiveResultJSON(e),
                          void 0 !== e.responseJSON.mid && ($(l.tid).parentNode.parentNode.parentNode.addClassName("msgnum_" + e.responseJSON.mid), $(l.tid).parentNode.parentNode.parentNode.removeClassName("msgnum_myself")),
                          clearTimeout($timerget),
                          ($get_message_req = !1),
                          ($timerget = setTimeout(AjaxReadRequest, $setting.reload_interval));
 if(0 !== e.responseJSON.mid){document.getElementsByClassName(l.reac)[0].setAttribute("id","reac_"+e.responseJSON.mid)};                  },
                  parameters: { text: r, to: o, into: "main",token:$setting.chpw },
              })),
        !1
    );
}
function send2privatwin(e, t, i) {
    var s,
        n,
        a,
        o,
        r = $(e);
    if ("" == r.value) return !1;
    if (1 == $me.silent || 3 == $me.silent)
        return (
            (r.value = "شما اجازه صحبت در خصوصي را نداريد !"),
            r.blur(),
            setTimeout(function () {
                ($(e).value = ""), $(e).focus();
            }, 3e3),
            !1
        );
    for (s = r.value, r.value = "", n = 0; n != $smilies.smilies.length; n++) $smilies.smilies[n].hasOwnProperty("name") && (s = str_replace($smilies.smilies[n].name, $smilies.smilies[n].code, s));
    return (
        (a = []),
        (o = "font-weight:" + $("bold").value + ";font-style:" + $("italic").value + ";color:" + $("color").value),
        void 0 !== $("fontsize") && (o += ";font-size:" + $("fontsize").value),
        void 0 !== $("fontname") && (o += ";font-family:" + $("fontname").value),
        (c = new Date()),
        (a.id = ""),
        (a.user = $me.username),
        (a.user_id = $me.id),
        (a.message = s),
        (a.time = c.getHours() + ":" + c.getMinutes()),
        (a.privat = t),
        (a.css = o),
        (a.priv = $me.type),
        (a.sex = $me.gender),
        (a.type = "send"),
        (a.tid = "private_" + getRandom()),
        (a.msgid = "myself"),
        (a.avatar = $me.avatar),
        void 0 !== i
            ? ((a.reply = i.msg),
              (a.name = i.name),
              new Ajax.Request(url("ajax/chat.reply"), {
                  onSuccess: function (e) {
                      var t = e.getAllHeaders();
                      void 0 !== e.responseText && ($(a.tid).parentNode.parentNode.parentNode.parentNode.addClassName("msgnum_" + e.responseText), $(a.tid).parentNode.parentNode.parentNode.parentNode.removeClassName("msgnum_myself")),
                          "" != t && ($(a.tid).src = theme_url("theme/images/chat/tick.png")),
                          receiveResultJSON(e),
                          clearTimeout($timerget),
                          ($get_message_req = !1),
                          ($timerget = setTimeout(AjaxReadRequest, $setting.reload_interval));
                  },
                  parameters: { uname: i.name, umsg: i.msg, msgid: i.msgid, mymsg: s, to: t, where: "private" },
              }),
              replyclose(),
              addmessage(a))
            : (addmessage(a),
              new Ajax.Request(url("ajax/get"), {
                  onSuccess: function (e) {
                      var t = e.getAllHeaders();
                      "" != t && ($(a.tid).parentNode.parentNode.parentNode.addClassName("msgnum_" + e.responseJSON.mid), $(a.tid).parentNode.parentNode.parentNode.removeClassName("msgnum_myself")),
                          "" != t && ($(a.tid).src = theme_url("theme/images/chat/tick.png")),
                          receiveResultJSON(e),
                          clearTimeout($timerget),
                          ($get_message_req = !1),
                          ($timerget = setTimeout(AjaxReadRequest, $setting.reload_interval));
                  },
                  postBody: "text=" + s + "&action=message&to=" + t + "&into=pm&token="+$setting.chpw,
              })),
        !1
    );
}
function send2cf(e, t, i, s) {
    var n, a, o, r;
    if (0 != i) return new Ajax.Request(url("ajax/get"), { onSuccess: function () {}, postBody: "text=" + i + "&action=message&to=" + t + "&into=" + t+"&token="+$setting.chpw,}), !1;
    if ("" == (n = $(e)).value && 0 == i) return !1;
    for (a = n.value, n.value = "", o = 0; o != $smilies.smilies.length; o++) $smilies.smilies[o].hasOwnProperty("name") && (a = str_replace($smilies.smilies[o].name, $smilies.smilies[o].code, a));
    return (
        (r = "font-weight:" + $("bold").value + ";font-style:" + $("italic").value + ";color:" + $("color").value),
        void 0 !== $("fontsize") && (r += ";font-size:" + $("fontsize").value),
        void 0 !== $("fontname") && (r += ";font-family:" + $("fontname").value),
        (c = new Date()),
        (l = []),
        (l.id = ""),
        (l.user = $me.username),
        (l.user_id = $me.id),
        (l.message = a),
        (l.time = c.getHours() + ":" + c.getMinutes()),
        (l.privat = t),
        (l.into = t),
        (l.msgid = "myself"),
        (l.tid = "cf_" + getRandom()),
        (l.css = r),
        (l.priv = $me.type),
        (l.sex = $me.gender),
        (l.type = "send"),
        (l.cf = "1"),
        (l.avatar = $me.avatar),
        void 0 !== s
            ? ((l.reply = s.msg),
              (l.name = s.name),
              new Ajax.Request(url("ajax/chat.reply"), {
                  onSuccess: function (e) {
                      "" != e.getAllHeaders() && ($(l.tid).src = theme_url("theme/images/chat/tick.png"));
                  },
                  parameters: { uname: s.name, umsg: s.msg, msgid: s.msgid, mymsg: a, to: t, where: "cf" },
              }),
              replyclose(),
              addmessage(l))
            : (addmessage(l),
              new Ajax.Request(url("ajax/get"), {
                  onSuccess: function (e) {
                      "" != e.getAllHeaders() && ($(l.tid).src = theme_url("theme/images/chat/tick.png")), receiveResultJSON(e);
                  },
                  postBody: "text=" + a + "&action=message&to=" + t + "&into=" + t+"&token="+$setting.chpw,
              })),
        !1
    );
}
function str_replace(e, t, i, s) {
    var n,
        a = 0,
        o = 0,
        r = "",
        l = "",
        c = 0,
        d = [].concat(e),
        m = [].concat(t),
        p = i,
        u = "[object Array]" === Object.prototype.toString.call(m),
        g = "[object Array]" === Object.prototype.toString.call(p);
    for (p = [].concat(p), s && (this.window[s] = 0), a = 0, n = p.length; a < n; a++)
        if ("" !== p[a]) for (o = 0, c = d.length; o < c; o++) (r = p[a] + ""), (l = u ? (void 0 !== m[o] ? m[o] : "") : m[0]), (p[a] = r.split(d[o]).join(l)), s && p[a] !== r && (this.window[s] += (r.length - p[a].length) / d[o].length);
    return g ? p : p[0];
}
function numSmilies(e) {
    return ++$numsmiles <= $setting.SmiliespMsg ? '<img src="' + theme_url("theme/images/smilies/" + e + ".gif") + '" alt="' + e + '" id="' + e + '" title="' + e + '">' : "";
}
function Search_userOnline() {
    new Ajax.Autocompleter("autocomplete", "autocompleter", url("ajax/chat.search.useronline"), {
        minChars: 2,
        afterUpdateElement: function (e, t) {
            changeUserEvent("privatwin_" + t.id), (document.getElementById("autocomplete").value = "");
        },
        indicator: "indicator1",
    });
}
function updateUserOnlineAnzeige(e) {
    var t, i, s, n, a, o, r, l, c, d, m, p, u, g, _, f, h, w;
    for ($activeajaxuser = !1, me_room_id = !1, me_array_online = [], me_array_empty = [], vipuser_transfer_on = [], vipuser_transfer_em = [], $status_public = {}, t = [], w = 0; w < e.rooms.length; w++) e.rooms[w].vu == $me.id && 1 == e.rooms[w].va && (me_room_id = e.rooms[w].ri), me_array_online.push({
        id: e.rooms[w].ri,
        name: e.rooms[w].rn
    }), t[e.rooms[w].ri] = e.rooms[w].rn;
    var v = e.userOnline.length + Number($setting.listplusonline);
    for (e.userOnline.length, w = 0; w < e.userOnline.length; w++)(i = e.userOnline[w]).ui == $me.id && ($me.type = i.up, $me.room = i.ri, $me.admin = getType($me.type).admin, $me.guest = getType($me.type).guest), e.userOnline[w].room = t[i.ri], i.hasOwnProperty("st") || (e.userOnline[w].st = ""), i.hasOwnProperty("si") || (e.userOnline[w].si = ""), i.hasOwnProperty("a") || (e.userOnline[w].a = $setting.defaultavatar);
    for ($usersObj = e, s = "", $setting.reg_btn && 1 == $me.guest && (s += $template.reg_btn), s += "<b>ليست اتاق ها و کاربران آنلاين</b><br><b>امتیاز شما:</b><strong>" + $me.score + "</strong><br><b>امتیاز بانکی شما:</b><strong>" + $me.bank + "</strong><br/><center>\n<div id='indicator1' style='display: none'><img src='" + theme_url("theme/images/chat/ajax-search.gif") + "' alt='Working...' /></div><input type='text' onclick='Search_userOnline();' name='search' id='autocomplete' class='searchcusr' placeholder='جستجوي کاربر در ليست آنلاين ها'/><div id='autocompleter' class='autocomplete'></div>\n</center>", s += "<center><b>کاربران حاضر در چت:</b><strong>" + v + "</strong><br>&nbsp;&nbsp;<img src='" + theme_url("theme/images/chat/chat.user_online.gif") + "' align='top'><br></center>", w = 0; w < e.userOnline.length; w++) {
        if ("" != e.userOnline[w].si && "status_away" != e.userOnline[w].si && "status_silent" != e.userOnline[w].si && ($status_public[e.userOnline[w].ui] = '<img src="' + theme_url("theme/images/status/" + e.userOnline[w].si + "_larg.png") + '" alt="' + e.userOnline[w].st + '" title="' + e.userOnline[w].st + '">'), 0 == $setting.show_admins_online && 0 == $setting.show_friends_online && 0 == $setting.view_status_usersonline) {
            if (0 == $setting.show_male_online && "1" == e.userOnline[w].us && $me.id != e.userOnline[w].ui) continue;
            if (0 == $setting.show_female_online && "2" == e.userOnline[w].us && $me.id != e.userOnline[w].ui) continue
        } else if (0 == $setting.show_admins_online && 1 == $setting.show_friends_online && 0 == $setting.view_status_usersonline) {
            if (0 == in_array(e.userOnline[w].ui, $setting.myFriends) && $me.id != e.userOnline[w].ui) continue
        } else if (0 == $setting.show_admins_online && 1 == $setting.view_status_usersonline) {
            if ("" == e.userOnline[w].si && $me.id != e.userOnline[w].ui) continue
        } else if (0 == getType(e.userOnline[w].up).admin && $me.id != e.userOnline[w].ui) continue;
        if ($me.id == e.userOnline[w].ui && ($me.username = e.userOnline[w].un, $me.type = e.userOnline[w].up, $me.gender = e.userOnline[w].us, $me.score = e.userOnline[w].sc, $me.avatar = e.userOnline[w].a), t != e.userOnline[w].ri) {
            switch (t = e.userOnline[w].ri, 1 != (n = e.userOnline[w].ra) && vipuser_transfer_on.push(t), n) {
                case "1":
                    f = 1 == e.userOnline[w].vip ? (f = (f = (f = (f = $template.rooms_allow_vip).replace(/\[0\]/gi, t)).replace(/\[1\]/gi, e.userOnline[w].room)).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[t].onlines : "")).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.vip.png")) : (f = (f = (f = $template.rooms_allow).replace(/\[0\]/gi, t)).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[t].onlines : "")).replace(/\[1\]/gi, e.userOnline[w].room);
                    break;
                case "2":
                    f = 1 == e.userOnline[w].vip ? (f = (f = (f = (f = $template.rooms_password_vip).replace(/\[0\]/gi, t)).replace(/\[1\]/gi, e.userOnline[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.keylayer.png"))).replace(/\[3\]/gi, theme_url("theme/images/chat/chat.vip.png")) : (f = (f = (f = (f = $template.rooms_password).replace(/\[0\]/gi, t)).replace(/\[1\]/gi, e.userOnline[w].room)).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[t].onlines : "")).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.keylayer.png"));
                    break;
                default:
                    f = (f = (f = (f = (f = $template.rooms_not_allowed).replace(/\[0\]/gi, t)).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[t].onlines : "")).replace(/\[1\]/gi, e.userOnline[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.locklayer.png"))
            }
            s += f
        }
        if ("" != (a = me_room_id == e.userOnline[w].ri || "0" != $me.admin ? ' <img style="cursor:pointer" src="' + theme_url("theme/images/chat/chat.wand.png") + '" id="adminu_' + e.userOnline[w].ui + '" /> ' : "") && e.userOnline[w].ui == $me.id && (a = ' <img src="' + theme_url("theme/images/chat/chat.space.gif") + '" weight="16" height="16" /> '), r = ' <img src="' + theme_url((o = getType(e.userOnline[w].up)).icon) + '" alt="' + o.title + '" title="' + o.title + '">', "photo.png" == e.userOnline[w].a) switch (e.userOnline[w].us) {
            case "1":
                e.userOnline[w].a = "maledefualt.png";
                break;
            case "2":
                e.userOnline[w].a = "femaledefualt.jpg"
        }
        1 == $setting.shoavataronlist ? 1 == $setting.profile_enable && (r += $setting.change_onlinelist ? "" : '<a' + (e.userOnline[w].story != true ? (' href="' + url("profile/" + e.userOnline[w].ui) + '"') : (' onclick="openStory(' + e.userOnline[w].ui) + ')"') + ' target="_blank" title="پروفايل"><img src="./' + $setting.avatardir + "/" + e.userOnline[w].a + '" class="avatar"' + (e.userOnline[w].story == true ? 'style="border: 3px solid #ee6400"' : "") + ' id="avataronline" border="0" /></a>') : 1 == $setting.profile_enable && (r += $setting.change_onlinelist ? "" : '<a href="' + url("profile/" + e.userOnline[w].ui) + '" target="_blank" title="پروفايل"><img src="' + theme_url("theme/images/chat/chat.pr.png") + '"  border="0" /></a>');
        var y = "",
            b = "nopm" == e.userOnline[w].spriv ? '<img style="height:15px;width:15px" src="' + theme_url("theme/images/status/status_private.png") + '" alt="کاربر مورد نظر خصوصي خود را بسته است" title="کاربر مورد نظر خصوصي خود را بسته است">' : "",
            k = "1" == e.userOnline[w].sidle ? '<img style="height:20px;width:20px" src="' + theme_url("theme/images/status/status_idle.png") + '" alt="' + e.userOnline[w].sidleTime + '" title="' + e.userOnline[w].sidleTime + '">' : "",
            x = "1" == e.userOnline[w].hid ? '<img src="' + theme_url("theme/images/status/status_invisible.png") + '" alt="به صورت مخفي وارد شده" title="به صورت مخفي وارد شده">' : "";
        if ("null" != e.userOnline[w].Os) switch (e.userOnline[w].Os) {
            case "pc":
                l = theme_url("theme/images/status/pc.png"), c = "رايانه";
                break;
            case "tablet":
                l = theme_url("theme/images/status/tablet.png"), c = "تبلت";
                break;
            case "phone":
                l = theme_url("theme/images/status/phone.png"), c = "موبايل";
                break;
            default:
                l = theme_url("theme/images/status/Unknown.png?ver=9"), c = "نامعلوم"
        }
        if (1 == $setting.showubrowseronlist && "null" != e.userOnline[w].ubrowser) switch (e.userOnline[w].ubrowser) {
            case "Unknown":
                d = theme_url("theme/images/browser/Unknown.png"), _ = "ناشناخته";
                break;
            case "IE":
                d = theme_url("theme/images/browser/IE.png"), _ = "اينترنت اکسپلورر";
                break;
            case "Firefox":
                d = theme_url("theme/images/browser/firefox.png"), _ = "فايرفاکس";
                break;
            case "Chrome":
                d = theme_url("theme/images/browser/Chrome.png"), _ = "کروم";
                break;
            case "Safari":
                d = theme_url("theme/images/browser/Safari.png"), _ = "سافاري";
                break;
            case "Opera":
                d = theme_url("theme/images/browser/Opera.png"), _ = "اُپرا";
                break;
            case "Netscape":
                d = theme_url("theme/images/browser/Netscape.png"), _ = "نت اسکيپ";
                break;
            case "Camino":
                d = theme_url("theme/images/browser/Camino.png"), _ = "کامينو";
                break;
            default:
                d = theme_url("theme/images/browser/Unknown.png"), _ = "ناشناخته"
        }
        if (m = 1 == $setting.showubrowseronlist && "null" != e.userOnline[w].ubrowser ? '<img style="width:18px;height:18px" src="' + d + '" alt="' + _ + '" title="' + _ + '">' : "", p = "null" != e.userOnline[w].Os ? '<img style="height:18px;width:18px" src="' + l + '" alt="' + c + '" title="' + c + '">' : "", "" != e.userOnline[w].si && (y = ' <img src="' + theme_url("theme/images/status/" + e.userOnline[w].si + ".png") + '" alt="' + e.userOnline[w].st + '" title="' + e.userOnline[w].st + '">'), $me.id == e.userOnline[w].ui && 0 == $setting.change_onlinelist) {
            switch (e.userOnline[w].us) {
                case "1":
                    g = "chat.user_comment_m_self.png";
                    break;
                case "2":
                    g = "chat.user_comment_w_self.png";
                    break;
                case "0":
                    g = "chat.user_comment_n_self.png"
            }
            f = $template.user_div_me, _ = $FONTLIST, $setting.colorlistonline && (_ += "font-weight:800;"), s += f = (f = (f = (f = (f = (f = f.replace(/\[0\]/gi, e.userOnline[w].ui)).replace(/\[1\]/gi, "")).replace(/\[2\]/gi, theme_url("theme/images/chat/" + g))).replace(/\[3\]/gi, a + ($setting.change_onlinelist ? '<a target="_blank" href="' + url("profile/" + e.userOnline[w].ui) + '" /><img class="avatar" title="براي مشاهده پروفايل کليک کنيد" style="height:20px;width:20px;" src="' + theme_url($setting.avatardir + "/" + e.userOnline[w].a) + '" /></a>' : "") + e.userOnline[w].un)).replace(/\[4\]/gi, r + y + b + k + x + m + p)).replace(/\[5\]/gi, _), u = "room_" + t
        } else {
            switch (e.userOnline[w].us) {
                case "1":
                    g = "chat.user_comment_m.png";
                    break;
                case "2":
                    g = "chat.user_comment_w.png";
                    break;
                case "0":
                    g = "chat.user_comment_n.png"
            }
            f = $template.user_div, _ = "color:" + o.color + ";" + $FONTLIST, $setting.colorlistonline && (_ += "font-weight:800;"), s += f = (f = (f = (f = (f = (f = f.replace(/\[0\]/gi, e.userOnline[w].ui)).replace(/\[1\]/gi, "")).replace(/\[2\]/gi, theme_url("theme/images/chat/" + g))).replace(/\[3\]/gi, _)).replace(/\[4\]/gi, a + ($setting.change_onlinelist ? '<a target="_blank" href="' + url("profile/" + e.userOnline[w].ui) + '" /><img class="avatar" title="براي مشاهده پروفايل کليک کنيد" style="height:25px;width:25px;" src="' + theme_url($setting.avatardir + "/" + e.userOnline[w].a) + '" /></a>' : "") + e.userOnline[w].un)).replace(/\[5\]/gi, r + y + b + k + x + m + p)
        }
    }
    try {
        for (w = 0; w < e.all_empty_rooms.length; w++) {
            switch (me_array_empty.push({
                    id: e.all_empty_rooms[w].room_id,
                    name: e.all_empty_rooms[w].room
                }), 1 != e.all_empty_rooms[w].room_allowed && vipuser_transfer_em.push(e.all_empty_rooms[w].room_id), e.all_empty_rooms[w].room_allowed) {
                case "1":
                    f = 1 == e.all_empty_rooms[w].vip ? (f = (f = (f = (f = $template.rooms_allow_vip).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[e.all_empty_rooms[w].room_id].onlines : "")).replace(/\[0\]/gi, e.all_empty_rooms[w].room_id)).replace(/\[1\]/gi, e.all_empty_rooms[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.vip.png")) : (f = (f = (f = $template.rooms_allow).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[e.all_empty_rooms[w].room_id].onlines : "")).replace(/\[0\]/gi, e.all_empty_rooms[w].room_id)).replace(/\[1\]/gi, e.all_empty_rooms[w].room);
                    break;
                case "2":
                    f = 1 == e.all_empty_rooms[w].vip ? (f = (f = (f = (f = (f = $template.rooms_password_vip).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[e.all_empty_rooms[w].room_id].onlines : "")).replace(/\[0\]/gi, e.all_empty_rooms[w].room_id)).replace(/\[1\]/gi, e.all_empty_rooms[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.keylayer.png"))).replace(/\[3\]/gi, theme_url("theme/images/chat/chat.vip.png")) : (f = (f = (f = (f = $template.rooms_password).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[e.all_empty_rooms[w].room_id].onlines : "")).replace(/\[0\]/gi, e.all_empty_rooms[w].room_id)).replace(/\[1\]/gi, e.all_empty_rooms[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.keylayer.png"));
                    break;
                default:
                    f = (f = (f = (f = (f = $template.rooms_not_allowed).replace(/\[0\]/gi, e.all_empty_rooms[w].room_id)).replace(/\[on\]/gi, $setting.roomstyle ? e.onlineroom[e.all_empty_rooms[w].room_id].onlines : "")).replace(/\[1\]/gi, e.all_empty_rooms[w].room)).replace(/\[2\]/gi, theme_url("theme/images/chat/chat.locklayer.png"))
            }
            s += f
        }
    } catch (e) {}
    for ($("onlinelist").innerHTML = s, $temp = $thememanager.chat.rooms, h = $$(".rooms,.rooms_b"), w = 0; w != h.length; w++) h[w].style.backgroundImage = "url(" + theme_url($temp["background-image"]) + ")", h[w].style.backgroundRepeat = $temp["background-repeat"], h[w].style.backgroundColor = $temp["background-color"], h[w].style.fontFamily = $temp["font-family"], h[w].style.fontSize = $temp["font-size"], h[w].style.fontWeight = $temp["font-weight"], h[w].style.color = $temp.color, h[w].style.boxShadow = $temp["box-shadow"], h[w].style.borderRadius = $temp["border-radius"], h[w].style.border = $temp.border;
    $(u).style.fontWeight = "bold"
}
function report_text_2admins(e, t, i, s) {
    return (
        (t = (t = (t = (t = t.replace("<b>", "")).replace("</b>", "")).replace("<i>", "")).replace("</i>", "")),
        0 != confirm(t + "\nآيا شما ميخواهيد اين متن را به مديران و ناظرين گزارش دهيد؟") &&
            void new Ajax.Request(url("ajax/chat.reportuser"), {
                onSuccess: function (e) {
                    switch (e.responseText) {
                        case "ok":
                            alert("گزارش شما ارسال شد");
                            break;
                        case "offline":
                            alert("اين بخش توس مدير غيرفعال شده است");
                            break;
                        default:
                            alert(e.responseText);
                    }
                },
                postBody: "userid=" + e + "&report=" + t + "&cp=true&location=" + i + "&token=" + $setting.chpw + "&rmsgid=" + s
            })
    );
}
function changeUserEvent(ereignis) {
    var user_name_p,
        temp_user_name,
        privat2id,
        privat2name,
        win_id1,
        win_id2,
        int_id,
        room,
        myAjaxObj,
        pos_top,
        pos_left,
        $id_user,
        user_priv,
        disabled_block,
        make_ajax_request_of_blocking,
        id,
        left,
        $code,
        $user_id,
        user_name,
        i,
        roomName;
    if ("create_cf" == ereignis && "1" != $me.type)
        return (
            new Ajax.Request("ajax/chat.conference", {
                onSuccess: function (e) {
                    alert(e.responseText);
                },
                postBody: "id=" + $me.id + "&action=create&token=" + $setting.chpw,
            }),
            !1
        );
    if ("privat_" == ereignis.slice(0, 7)) {
        if ($me.guest && $setting.advcreg) return registerbox_open(), !1;
        for ($("privat").value = ereignis.slice(7, ereignis.length), i = 0; i < $usersObj.userOnline.length; i++)
            if ($usersObj.userOnline[i].ui == ereignis.slice(7, ereignis.length)) {
                $privato = $usersObj.userOnline[i].un;
                break;
            }
        (user_name_p = 20 < $privato.length ? $privato.slice(0, 20) + "..." : $privato),
            ($("privat_anzeige").innerHTML = "خصوصي با <b>" + user_name_p + '</b>&nbsp;&nbsp;&nbsp;<span id="close_privat">پايان چت خصوصي</span>'),
            new Effect.Highlight("message", { startcolor: "#ff6666" }),
            $("message").focus();
    } else if ("regbtn" == ereignis.slice(0, 6)) {
        if ($me.guest && $setting.advcreg) return registerbox_open(), !1;
        (temp_user_name = 20 < $me.username.length ? $me.username.slice(0, 20) + "..." : $me.username),
            ($windows.register_user = new Window({
                className: $win_style,
                title: 'ثبت نام "' + temp_user_name + '"',
                width: 250,
                height: 130,
                top: eval($mouse.top),
                left: eval($mouse.left - 200),
                resizable: !1,
                showEffect: Effect.Appear,
                hideEffect: Effect.DropOut,
                showEffectOptions: {
                    duration: 0.3,
                    afterFinish: function () {
                        $windows.prop.close(), $("pw_register_field").focus();
                    },
                },
                hideEffectOptions: { duration: 0.3 },
                draggable: !0,
                minimizable: !1,
                maximizable: !1,
                destroyOnClose: !0,
                opacity: 1,
            })),
            $windows.register_user.setHTMLContent($template.register_win.replace("{username}", $me.username)),
            Event.observe("register_formular", "click", function (e) {
                "cancel_register" == Event.element(e).id && $windows.register_user.close(),
                    "make_register" == Event.element(e).id &&
                        ($("pw_register_field").value == $("pw_register_field2").value
                            ? new Ajax.Request(url("ajax/thisregister"), {
                                  onSuccess: function (e) {
                                      switch (e.responseText) {
                                          case "ok":
                                              $windows.register_user.setHTMLContent(
                                                  '<div id="register_formular"> متشکريم بابت ثبت نام شما - هم اکنون رفرش نماييد تا ثبت نام شما تکميل شود<br /><br /><a id="fresh" href="javascript:document.location.reload();">رفرش کردن صفحه </a></div>'
                                              );
                                              break;
                                          case "lastregister":
                                              alert("شما قبلا عضو شده ايد");
                                              break;
                                          case "nameexist":
                                              alert("اين نام کاربري قبلا توسط کاربر ديگري به ثبت رسيده است لطفا نام کاربري خود را عوض کنيد");
                                              break;
                                          case "lastemail":
                                              alert("اين ايميل قبلا در پايگاه داده ثبت شده.");
                                              break;
                                          case "email":
                                              alert("لطفا يک ايميل معتبر وارد کنيد.");
                                              break;
                                          default:
                                              alert(e.responseText);
                                      }
                                  },
                                  postBody: "user=" + $me.id + "&password=" + $("pw_register_field").value + "&username=" + $("user_register_field").value + "&token=" + $setting.chpw,
                              })
                            : (alert("رمز هاي شما با هم تطابق ندارند لطفا تصحيح کنيد"), ($("pw_register_field").value = ""), ($("pw_register_field2").value = ""), $("pw_register_field").focus()));
            }),
            $windows.register_user.show(),
            ($("register_form").onsubmit = function () {
                return !1;
            });
    } else if ("privatwin_" == ereignis.slice(0, 10)) {
        if ($me.guest && $setting.advcreg) return registerbox_open(), !1;
        for (privat2id = ereignis.slice(10, ereignis.length), i = 0; i < $usersObj.userOnline.length; i++)
            if ($usersObj.userOnline[i].ui == privat2id) {
                privat2name = $usersObj.userOnline[i].un;
                break;
            }
        if (((win_id1 = $me.id + "00000" + privat2id), (win_id2 = privat2id + "00000" + $me.id), "object" != typeof $windows.privat[win_id1] && "object" != typeof $windows.privat[win_id2])) {
            var privat_win_opponent = privat2name,
			    
                privat_win_opponent_id = privat2id,
                $temp = $("chatinhalt"),
                winsizes = $setting.winsize.split("*");
            $windows.privat[win_id1] = new Window({
                className: $win_style,
                title: "خصوصي با " + privat_win_opponent,
                width: winsizes[1],
                height: winsizes[0],
                top: eval($temp.offsetTop + Math.round(50 * Math.random())),
                left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
                resizable: !1,
                showEffect: Effect.Appear,
                hideEffect: Effect.DropOut,
                showEffectOptions: {
                    duration: 0.5,
                    afterFinish: function () {
                        $("pivate_win_" + int_id).scrollTop = $("pivate_win_" + int_id).scrollHeight;
                    },
                },
                hideEffectOptions: { duration: 0.5 },
                draggable: !0,
                minimizable: !1,
                maximizable: !1,
                destroyOnClose: !1,
                opacity: 1,
            });
            var $code = $template.private_window;
            ($code = $code.replace(/\[0\]/gi, win_id1)),
                ($code = $code.replace(/{to}/gi, privat2id)),
                ($code = $code.replace(/\[1\]/gi, $windows.privat[win_id1].getId())),
                ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/Checked_small.png"))),
                ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/Smiley_small.png"))),
				($code = in_array($me.type, $setting.voicesetting.pm) && $setting.voicesetting.status == "true" ? $code.replace(/\[voice_chat\]/gi, '<img src="' + theme_url("theme/images/chat/voicechat.png") + '" id="voicechat_' + win_id1 + '" title="پیام صوتی" alt="پیام صوتی"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>') : $code.replace(/\[voice_chat\]/gi, '<span id="voicechat_' + win_id1 + '" style="display:none;"></span>')), 
                ($code = in_array($me.type, $setting.useroptions.buzz)
                    ? $code.replace(/\[4\]/gi, '<img src="' + theme_url("theme/images/chat/buzz.png") + '" id="buzz_' + win_id1 + '" title="تلنگر"  alt="تلنگر"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">')
                    : $code.replace(/\[4\]/gi, '<span id="buzz_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.private_eraser)
                    ? $code.replace(/\[5\]/gi, '<img src="' + theme_url("theme/images/chat/eraser.png") + '" id="cls_' + win_id1 + '" title="پاک کن" alt="پاک کن"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">')
                    : $code.replace(/\[5\]/gi, '<span id="cls_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.private_status_check)
                    ? $code.replace(
                          /\[6\]/gi,
                          '<img src="' + theme_url("theme/images/chat/status_check.png") + ' " id="idle_' + win_id1 + '" title="برسي وضعيت" alt="برسي وضعيت"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                      )
                    : $code.replace(/\[6\]/gi, '<span id="idle_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.sendedimages)
                    ? $code.replace(
                          /\[7\]/gi,
                          '<img src="' + theme_url("theme/images/chat/upload_images_private.png") + '" id="upload_img_' + win_id1 + '" title="ارسال تصوير" alt="ارسال تصوير"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                      )
                    : $code.replace(/\[7\]/gi, '<span id="upload_img_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.private_blocker)
                    ? $code.replace(
                          /\[8\]/gi,
                          '<img src="' + theme_url("theme/images/chat/blocker_small.png") + '" id="blocker_user_' + win_id1 + '" title="مسدود سازي"  alt="مسدود سازي"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;">'
                      )
                    : $code.replace(/\[8\]/gi, '<span id="blocker_user_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.addreport)
                    ? $code.replace(
                          /\[9\]/gi,
                          '<img src="' + theme_url("theme/images/chat/report.png") + '" id="report_user_' + win_id1 + '" title="گزارش" alt="گزارش"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                      )
                    : $code.replace(/\[9\]/gi, '<span id="report_user_' + win_id1 + '" style="display:none;"></span>')),
                ($code = in_array($me.type, $setting.useroptions.videochat)
                    ? $code.replace(
                          /\[12\]/gi,
                          '<img src="' + theme_url("theme/images/chat/videochat_small.png") + '" id="videochat_' + win_id1 + '" title="چت تصويري" alt="جت تصويري"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                      )
                    : $code.replace(/\[12\]/gi, '<span id="videochat_' + win_id1 + '" style="display:none;"></span>')),
                ($code = $code.replace(/\[10\]/gi, theme_url("theme/images/chat/chat.cfinviter.png"))),
                ($code = $code.replace(/\[11\]/gi, theme_url("theme/images/chat/chat.friend_add.png"))),
                ($code =
                    "0" != $me.admin && $me.id != privat2id
                        ? $code.replace(
                              /\[e14\]/gi,
                              '<img src="' +
                                  theme_url("theme/images/chat/chat.wand.png") +
                                  '" onclick=changeUserEvent("adminu_' +
                                  privat2id +
                                  '") title="اخراج" alt="اخراج"  style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></span>'
                          )
                        : $code.replace(/\[e14\]/gi, '<span id="report_user_" style="display:none;"></span>')),
                $windows.privat[win_id1].setHTMLContent($code),
                (myObserver = {
                    onEndResize: function (eventName, win) {
                        win == $windows.privat[win_id1] && ($("pivate_win_" + win_id1).style.height = eval(win.getSize().height - 33) + "px");
                    },
                    onClose: function () {
                        $("message").focus();
                    },
                }),
                Windows.addObserver(myObserver),
                ($("win_form_" + win_id1).onsubmit = function () {
                    return send2privatwin("message_win_" + win_id1, privat2id), !1;
                }),
                ($("submit_img_" + win_id1).onclick = function () {
                    return send2privatwin("message_win_" + win_id1, privat2id), !1;
                }),
                ($("videochat_" + win_id1).onclick = function () {
                    self.videochat("invite", privat2id, !1, !1, !1);
                }),
                ($("smileys_img_" + win_id1).onclick = function () {
                    open_close_smileys_win("message_win_" + win_id1);
                }),
                ($("cls_" + win_id1).onclick = function () {
                    $("pivate_win_" + win_id1).innerHTML = "";
                }),
                ($("buzz_" + win_id1).onclick = function () {
                    new Ajax.Request("ajax/chat.buzz", {
                        onSuccess: function () {
                            Effect.Shake($windows.privat[win_id1].getId()),
                                new Audio("theme/sound/buzz.wav").play(),
                                ($("pivate_win_" + win_id1).innerHTML += '<div><span style="color:red;font-weight:bold;font-family: arial;direction:ltr;">BUZZ!!</span></div>'),
                                ($("pivate_win_" + int_id).scrollTop = $("pivate_win_" + int_id).scrollHeight);
                        },
                        postBody: "user=" + privat2id + "&token=" + $setting.chpw,
                    });
                }),
                ($("idle_" + win_id1).onclick = function () {
                    self.info_user_private("message_win_" + win_id1, privat2id);
                }),
                ($("inviate2mycf_" + win_id1).onclick = function () {
                    1 == confirm("درخواست کنفرانس فرستاده شود؟") &&
                        new Ajax.Request(url("ajax/chat.conference"), {
                            onSuccess: function (e) {
                                alert(e.responseText);
                            },
                            postBody: "id=" + privat2id + "&action=invite&token=" + $setting.chpw,
                        });
                }),
                ($("priv_add2myfriends_" + win_id1).onclick = function () {
                    1 == confirm("درخواست دوستي فرستاده شود؟") &&
                        new Ajax.Request(url("ajax/chat.addme2friendlist"), {
                            onSuccess: function (e) {
                                alert(e.responseText);
                            },
                            postBody: "id=" + privat2id + "&token=" + $setting.chpw,
                        });
                }),
				
            $("voicechat_" + win_id1).onclick = function() {
                voicechat("pm", privat2id, privat2name);
            },
                ($("upload_img_" + win_id1).onclick = function () {
                    self.makeUploadAction1("message_win_" + win_id1, privat2id, "pm");
                }),
                ($("blocker_user_" + win_id1).onclick = function () {
                    return (
                        new Ajax.Request(url("ajax/chat.block"), {
                            onSuccess: function (e) {
                                alert(e.responseText), "مسدود شد" == e.responseText && $windows.privat[win_id1].close();
                            },
                            postBody: "block_priv=" + privat_win_opponent_id + "&token=" + $setting.chpw,
                        }),
                        !1
                    );
                }),
                ($("message_win_" + win_id1).onfocus = function () {
                    ($("message_win_" + win_id1).style.color = $("message").style.color),
                        ($("message_win_" + win_id1).style.fontWeight = $("message").style.fontWeight),
                        ($("message_win_" + win_id1).style.fontStyle = $("message").style.fontStyle),
                        ($("message_win_" + win_id1).style.fontSize = $("message").style.fontSize),
                        ($("message_win_" + win_id1).style.fontFamily = $("message").style.fontFamily);
                });
        }
        int_id = "object" == typeof $windows.privat[win_id1] ? win_id1 : win_id2;
        try {
            $windows.privat[int_id].show();
        } catch (e) {}
        setTimeout(function () {
            try {
                $("message_win_" + win_id1).focus();
            } catch (e) {}
        }, 600);
    } else if ("room_" == ereignis.slice(0, 5)) {
        if ($me.room == ereignis.slice(5, ereignis.length)) return !1;
        (room = ereignis.slice(5, ereignis.length)),
            (myAjaxObj = new Ajax.Request(url("ajax/chengeroom"), {
                onSuccess: function (e) {
                    switch (e.responseText) {
                        case "no access":
                            return alert("درجه کاربري شما براي ورود به اين اتاق مجاز نمي باشد"), !1;
                        case "cap is full":
                            return alert("ظرفيت اين اتاق تکميل است لطفا اتاق ديگري انتخاب کنيد"), !1;
                        default:
                            ($("room").value = $me.room = room), AjaxReadRequest(!($("chatinhalt").innerHTML = "")), ReloaderUserOnline(!0);
                    }
                },
                postBody: "room_id=" + room + "&password=&token=" + $setting.chpw,
            }));
    }
    if ("infoblock_" == ereignis.slice(0, 10) || "inflblock_" == ereignis.slice(0, 10)) {
        for (
            "inflblock_" == ereignis.slice(0, 10) && ((pos_top = eval($mouse.top - 25)), (pos_left = eval($mouse.left + 10))),
                "infoblock_" == ereignis.slice(0, 10) && ((pos_top = eval($mouse.top - 10)), (pos_left = eval($mouse.left - 280))),
                $id_user = ereignis.slice(10, ereignis.length),
                i = 0;
            i < $usersObj.userOnline.length;
            i++
        )
            if ($usersObj.userOnline[i].ui == $id_user) {
                (user_name = $usersObj.userOnline[i].un), (user_priv = $usersObj.userOnline[i].up);
                break;
            }
        if (null == user_name) return !1;
        (id = ereignis.slice(10, ereignis.length)),
            "object" != typeof $windows.block[id]
                ? (20 < user_name.length && (user_name = user_name.slice(0, 20) + "..."),
                  ($windows.block[id] = new Window({
                      className: $win_style,
                      title: "کاربر: " + user_name,
                      width: 250,
                      height: 170,
                      top: pos_top,
                      left: pos_left,
                      resizable: !1,
                      showEffect: Effect.Appear,
                      hideEffect: Effect.DropOut,
                      showEffectOptions: {
                          duration: 0.4,
                          afterFinish: function () {
                              close_info_win($windows.block[id].getId());
                          },
                      },
                      hideEffectOptions: { duration: 0.4 },
                      draggable: !0,
                      minimizable: !1,
                      maximizable: !1,
                      destroyOnClose: !1,
                      opacity: 1,
                  })),
                  $me.admin,
                  (disabled_block = ""),
                  ($code = $template.user_win),
                  ($code = in_array(id, $allowchat) || 1 != $setting.allowchat ? $template.user_win : $template.na_user_win),
                  ($code = $code.replace(/\[0\]/gi, theme_url("theme/images/chat/chat.set_name.png"))),
                  ($code = $code.replace(/\[1\]/gi, id)),
                  ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/chat.privat_win.png"))),
                  ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/chat.privat_chat.png"))),
                  ($code = $code.replace(/\[4\]/gi, theme_url("theme/images/chat/chat.delete.png"))),
                  ($code = $code.replace(/\[cf\]/gi, theme_url("theme/images/chat/chat.cfinviter.png"))),
                  ($code = $code.replace(/\[addfriend\]/gi, theme_url("theme/images/chat/chat.friend_add.png"))),
                  ($code = $code.replace(/\[7\]/gi, url("theme/images/chat/n.gozaresh.png"))),
                  ($code = $code.replace(/\[5\]/gi, disabled_block)),
                  $windows.block[id].setHTMLContent($code),
                  (make_ajax_request_of_blocking = !0),
                  $windows.block_ids.push(id))
                : ($windows.block[id].setLocation(pos_top, pos_left),
                  (make_ajax_request_of_blocking = !1),
                  in_array(id, $allowchat) &&
                      ($("info_privatm_" + id) ||
                          (($code = $template.user_win),
                          ($code = $code.replace(/\[0\]/gi, theme_url("theme/images/chat/chat.set_name.png"))),
                          ($code = $code.replace(/\[1\]/gi, id)),
                          ($code = $code.replace(/\[2\]/gi, theme_url("theme/images/chat/chat.privat_win.png"))),
                          ($code = $code.replace(/\[3\]/gi, theme_url("theme/images/chat/chat.privat_chat.png"))),
                          ($code = $code.replace(/\[4\]/gi, theme_url("theme/images/chat/chat.delete.png"))),
                          ($code = $code.replace(/\[cf\]/gi, theme_url("theme/images/chat/chat.cfinviter.png"))),
                          ($code = $code.replace(/\[addfriend\]/gi, theme_url("theme/images/chat/chat.friend_add.png"))),
                          ($code = $code.replace(/\[5\]/gi, disabled_block)),
                          ($code = $code.replace(/\[6\]/gi, theme_url("theme/images/chat/chat.privat_chat.png"))),
                          ($code = $code.replace(/\[7\]/gi, url("theme/images/chat/n.report.png"))),
                          $windows.block[id].setHTMLContent($code)))),
            $windows.block[id].show(),
            $windows.block[id].toFront(),
            ($("info_reportname_" + id).onclick = function () {
                confirm("آيا ميخواهيد نام  '" + user_name + "'  را گزارش دهيد؟ ") &&
                    new Ajax.Request(url("ajax/chat.reportname"), {
                        onSuccess: function (e) {
                            alert(e.responseText);
                        },
                        postBody: "targetid=" + id + "&token=" + $setting.chpw,
                    });
            }),
            ($("info_set_name_" + id).onclick = function () {
                $("block_form_div_" + id).hide(), changeUserEvent("user_" + id), $windows.block[id].close();
            }),
            (in_array(id, $allowchat) && 1 == $setting.allowchat) || 0 == $setting.allowchat
                ? (($("info_privatm_" + id).onclick = function () {
                      $("block_form_div_" + id).hide(), changeUserEvent("privat_" + id), $windows.block[id].close();
                  }),
                  ($("info_privatm_" + id).onclick = function () {
                      $("block_form_div_" + id).hide(), changeUserEvent("privat_" + id), $windows.block[id].close();
                  }),
                  ($("inviate2mycf_" + id).onclick = function () {
                      1 == confirm("درخواست کنفرانس فرستاده شود؟") &&
                          new Ajax.Request(url("ajax/chat.conference"), {
                              onSuccess: function (e) {
                                  alert(e.responseText);
                              },
                              postBody: "id=" + id + "&action=invite&token=" + $setting.chpw,
                          }),
                          $windows.block[id].close();
                  }),
                  ($("add2myfriends_" + id).onclick = function () {
                      1 == confirm("درخواست دوستي فرستاده شود؟") &&
                          new Ajax.Request(url("ajax/chat.addme2friendlist"), {
                              onSuccess: function (e) {
                                  alert(e.responseText);
                              },
                              postBody: "id=" + id + "&token=" + $setting.chpw,
                          }),
                          $windows.block[id].close();
                  }),
                  ($("info_privatf_" + id).onclick = function () {
                      $("block_form_div_" + id).hide(), changeUserEvent("privatwin_" + id), $windows.block[id].close();
                  }))
                : ($("req_private_" + id).onclick = function () {
                      1 == confirm("درخواست چت خصوصي فرستاده شود؟") &&
                          new Ajax.Request(url("ajax/chat.allowchat"), {
                              onSuccess: function (e) {
                                  "ok" == e.responseText && alert("درخواست چت خصوصي فرستاده شد.");
                              },
                              postBody: "id=" + id + "&action=allowchat",
                          }),
                          $windows.block[id].close();
                  }),
            $setting.advcreg &&
                (($type = getType(user_priv)),
                $type.guest ? (($("info_privatm_" + id).style.display = "none"), ($("info_privatf_" + id).style.display = "none")) : (($("info_privatm_" + id).style.display = "block"), ($("info_privatf_" + id).style.display = "block"))),
            ($("info_blockform_" + id).onclick = function () {
                new Ajax.Request(url("ajax/chat.block"), {
                    onSuccess: function (e) {
                        alert(e.responseText), $windows.block[id].close();
                    },
                    postBody: "block_priv=" + id + "&token=" + $setting.chpw,
                });
            });
    } else if ("adminu_" == ereignis.slice(0, 7)) {
        for ($user_id = ereignis.slice(7, ereignis.length), i = 0; i < $usersObj.userOnline.length; i++)
            if ($usersObj.userOnline[i].ui == $user_id) {
                var user_ip = $usersObj.userOnline[i].uip,
                    user_name = $usersObj.userOnline[i].un,
                    user_name_tow = $usersObj.userOnline[i].unto,
                    user_countries = $usersObj.userOnline[i].adcountries,
                    user_countriesfull = $usersObj.userOnline[i].adcountriesfull,
                    Os = $usersObj.userOnline[i].adOs,
                    user_ubrowser = $usersObj.userOnline[i].adubrowser,
                    user_priv = $usersObj.userOnline[i].up;
                break;
            }
        if (((id = ereignis.slice(7, ereignis.length)), "object" != typeof $windows.admin_user[id])) {
            var left = $mouse.left;
            1 < eval(left - 390) && (left -= 390),
                ($windows.admin_user[id] = new Window({
                    className: $win_style,
                    width: 350,
                    height: 380,
                    top: eval($mouse.top - 10),
                    left: eval(left),
                    resizable: !1,
                    showEffect: Effect.Appear,
                    hideEffect: Effect.DropOut,
                    showEffectOptions: { duration: 0.5 },
                    hideEffectOptions: { duration: 0.5 },
                    draggable: !0,
                    minimizable: !1,
                    maximizable: !1,
                    destroyOnClose: !1,
                }));
        }
        var $code = "123",
            $type = getType(user_priv);
        if (
            (((parseInt($type.admin) <= parseInt($me.admin) && 0 != $type.admin) || me_room_id) &&
                (me_room_id
                    ? 0 != $type.admin && ($code = '<div class="into_admin_win"><p style="color:red">ما به شما اجازه نميدهيم اين کاربر را مديريت يا اخراج کنيد</p><div class="error-admins"></div>')
                    : ($code = '<div class="into_admin_win"><p style="color:red">ما به شما اجازه نميدهيم اين کاربر را مديريت يا اخراج کنيد</p><div class="error-admins"></div>')),
            "123" == $code)
        ) {
            $code = $template.admin_win;
            for (var add_to_admin = "", all_rooms = me_array_online.concat(me_array_empty), disable_vip = vipuser_transfer_on.concat(vipuser_transfer_em), n = 0; n < all_rooms.length; n++)
                if("0" != $me.admin){add_to_admin += '<option value="' + all_rooms[n].id + '">' + all_rooms[n].name + "</option>"};
          
            ($code = in_array($me.type, $setting.useroptions.modsaccess)
                ? (($code = $code.replace(
                      /\[mods\]/gi,
                      'ثبت امتياز مثبت يا منفي براي ناظرين<br><select id="mods_monitor" size="1"><option value="score">امتياز مثبت</option><option value="warning">امتياز منفي</option></select>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" id="mods_monitor_' +
                          id +
                          '">ثبت کن</a>'
                  )),
                  ($code = $code.replace(/\[4\]/gi, $template.admin_win_adminrows)),
                  ($code = $code.replace(/\[5\]/gi, url("admin/users/edit/" + id))),
                  $code.replace(/\[6\]/gi, url("admin/msgreader/" + id)))
                : $code.replace(/\[4\]/gi, "")),
                ($code = $code.replace(/\[select\]/gi, add_to_admin)),
                ($code = $code.replace(/\[0\]/gi, user_name)),
                ($code = $code.replace(/\[towname\]/gi, user_name_tow)),
                ($code = $code.replace(/\[1\]/gi, id)),
                ($code = $code.replace(/\[2\]/gi, user_ip)),
                ($code = $code.replace(/\[countries\]/gi, user_countriesfull)),
                ($code = $code.replace(/\[ubr\]/gi, '<img style="width:16px;height:16px" alt="' + Os + '" title="' + Os + '" src="' + url("theme/images/status/" + Os + ".png") + '" >')),
                ($code = $code.replace(/\[countriesimg\]/gi, '<img style="width:16px;height:16px" alt="' + user_countries + '" title="' + user_countries + '" src="' + url("theme/images/flags/" + user_countries + ".png") + '" >')),
                ($code = $code.replace(/\[user_ubrowser\]/gi, '<img style="width:16px;height:16px" alt="' + user_ubrowser + '" title="' + user_ubrowser + '" src="' + url("theme/images/browser/" + user_ubrowser + ".png") + '" >')),
                in_array($me.type, $setting.useroptions.modsaccess) || ($code = $code.replace(/\[mods\]/gi, ""));
        }
        $windows.admin_user[id].setHTMLContent($code), $windows.admin_user[id].show();
        try {
            $("sperre_user_" + id) &&
                ($("sperre_user_" + id).onclick = function () {
                    var e;
                    if ("exit" != $("blacklist_time").value) {
                        if (null == (e = prompt("دليل اخراج ؟")) || "" == e) return alert("دليل اخراج الزامي ميباشد !"), !1;
                    } else e = "exit";
                    new Ajax.Request(url("ajax/bann"), {
                        onSuccess: function (e) {
                            var t;
                            if ("pw" == e.responseText) {
                                if (null == (t = prompt("پسورد را وارد نماييد")) || "" == t) return !1;
                                new Ajax.Request(url("ajax/bann"), {
                                    onSuccess: function (e) {
                                        "ok" == e.responseText ? (alert("انجام شد"), getUser(), $windows.admin_user[id].close()) : alert(e.responseText);
                                    },
                                    postBody: "user=" + id + "&date=" + $("blacklist_time").value + "&password=" + t + "&reason=" + void 0 + "&token=" + $setting.chpw,
                                });
                            } else getUser(), "ok" == e.responseText ? (alert("انجام شد"), $windows.admin_user[id].close()) : alert(e.responseText);
                        },
                        postBody: "user=" + id + "&date=" + $("blacklist_time").value + "&reason=" + e + "&token=" + $setting.chpw,
                    });
                }),
                $("move_user_" + id) &&
                    ($("move_user_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/chat.moveuser"), {
                            onSuccess: function (e) {
                                getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                            },
                            postBody: "user=" + id + "&roomid=" + $("move_user").value + "&token=" + $setting.chpw,
                        });
                    }),
                $("refresh_user_" + id) &&
                    ($("refresh_user_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/refresh"), {
                            onSuccess: function () {
                                $windows.admin_user[id].close();
                            },
                            postBody: "user=" + id + "&token=" + $setting.chpw,
                        });
                    }),
                $("alert_user_" + id) &&
                    ($("alert_user_" + id).onclick = function () {
                        var e = window.prompt("متن اخطار:");
                        return (
                            null != e &&
                            "" != e &&
                            void new Ajax.Request(url("ajax/warning"), {
                                onSuccess: function () {
                                    $windows.admin_user[id].close();
                                },
                                postBody: "user=" + id + "&txt=" + e + "&token=" + $setting.chpw,
                            })
                        );
                    }),
                $("allow_talk_main_" + id) &&
                    ($("allow_talk_main_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/chat.user.talkinmain"), {
                            onSuccess: function (e) {
                                getUser(), alert(e.responseText);
                            },
                            postBody: "user=" + id + "&token=" + $setting.chpw,
                        });
                    }),
                $("disableduser_" + id) &&
                    ($("disableduser_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/chat.deleteuser"), {
                            onSuccess: function (e) {
                                getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                            },
                            postBody: "user=" + id + "&token=" + $setting.chpw,
                        });
                    }),
                $("report_pv_" + id) &&
                    ($("report_pv_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/chat.reportpv"), {
                            onSuccess: function (e) {
                                getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                            },
                            postBody: "user=" + id + "&token=" + $setting.chpw + "&act=rep",
                        });
                    }),
                $("unreport_pv_" + id) &&
                    ($("unreport_pv_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/chat.reportpv"), {
                            onSuccess: function (e) {
                                getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                            },
                            postBody: "user=" + id + "&token=" + $setting.chpw + "&act=unrep",
                        });
                    }),
                $("addscoretouser_" + id) &&
                    ($("addscoretouser_" + id).onclick = function () {
                        var e = window.prompt("مقدار امتياز جهت افزايش:");
                        return e
                            ? void new Ajax.Request(url("ajax/chat.scoreuser"), {
                                  onSuccess: function (e) {
                                      getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                                  },
                                  postBody: "action=add&user=" + id + "&score=" + e + "&token=" + $setting.chpw,
                              })
                            : alert("مقدار امتياز وارد نشده است");
                    }),
                $("delscoretouser_" + id) &&
                    ($("delscoretouser_" + id).onclick = function () {
                        var e = window.prompt("مقدار امتياز جهت کسر شدن:");
                        return e
                            ? void new Ajax.Request(url("ajax/chat.scoreuser"), {
                                  onSuccess: function (e) {
                                      getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                                  },
                                  postBody: "action=del&user=" + id + "&score=" + e + "&token=" + $setting.chpw,
                              })
                            : alert("مقدار امتياز وارد نشده است");
                    }),
                $("addbanktouser_" + id) &&
                    ($("addbanktouser_" + id).onclick = function () {
                        var e = window.prompt("مقدار امتياز بانکي جهت افزايش:");
                        return e
                            ? void new Ajax.Request(url("ajax/mod.addbank"), {
                                  onSuccess: function (e) {
                                      getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                                  },
                                  postBody: "action=add&user=" + id + "&bank=" + e + "&token=" + $setting.chpw,
                              })
                            : alert("مقدار امتياز بانکي وارد نشده است");
                    }),
                $("delbanktouser_" + id) &&
                    ($("delbanktouser_" + id).onclick = function () {
                        var e = window.prompt("مقدار امتياز بانکي جهت کسر شدن:");
                        return e
                            ? void new Ajax.Request(url("ajax/mod.addbank"), {
                                  onSuccess: function (e) {
                                      getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                                  },
                                  postBody: "action=del&user=" + id + "&bank=" + e + "&token=" + $setting.chpw,
                              })
                            : alert("مقدار امتياز بانکي وارد نشده است");
                    }),
                $("usershide_" + id) &&
                    ($("usershide_" + id).onclick = function () {
                        (rmj = confirm("مخفي شود؟")),
                            1 == rmj &&
                                new Ajax.Request(url("ajax/mod.usershide"), {
                                    onSuccess: function (e) {
                                        switch (e.responseText) {
                                            case "ok":
                                                alert("با موفقيت مخفي شد.");
                                                break;
                                            case "user":
                                                alert("اين کاربر وجود ندارد");
                                                break;
                                            case "permision":
                                                alert("شما دسترسي براي اين کار را ندارد.");
                                                break;
                                            default:
                                                alert(e.responseText);
                                        }
                                    },
                                    postBody: "user=" + id + "&token=" + $setting.chpw,
                                });
                    }),
                $("usersshow_" + id) &&
                    ($("usersshow_" + id).onclick = function () {
                        (rmj = confirm("نمايان شود؟")),
                            1 == rmj &&
                                new Ajax.Request(url("ajax/mod.usersshow"), {
                                    onSuccess: function (e) {
                                        switch (e.responseText) {
                                            case "ok":
                                                alert("با موفقيت نمايان شد.");
                                                break;
                                            case "user":
                                                alert("اين کاربر وجود ندارد");
                                                break;
                                            case "permision":
                                                alert("شما دسترسي براي اين کار را ندارد.");
                                                break;
                                            default:
                                                alert(e.responseText);
                                        }
                                    },
                                    postBody: "user=" + id + "&token=" + $setting.chpw,
                                });
                    }),
                $("user_resetprofile_" + id) &&
                    ($("user_resetprofile_" + id).onclick = function () {
                        return (
                            0 != confirm("آيا شما مطمئن هستيد ؟") &&
                            void new Ajax.Request(url("ajax/mods.profilereset"), {
                                onSuccess: function (e) {
                                    alert(e.responseText);
                                },
                                postBody: "uid=" + id + "&token=" + $setting.chpw,
                            })
                        );
                    }),
                $("allow_systems2user_" + id) &&
                    ($("allow_systems2user_" + id).onclick = function () {
                        var e = $("userpermission_action").value;
                        new Ajax.Request(url("ajax/chat.userpermission"), {
                            onSuccess: function (e) {
                                alert(e.responseText);
                            },
                            postBody: "user=" + id + "&action=" + e + "&token=" + $setting.chpw,
                        });
                    }),
                $("rename_user_" + id) &&
                    ($("rename_user_" + id).onclick = function () {
                        var e = prompt("نام جديد را وارد کنيد", "", "تغيير نام");
                        "" != e &&
                            0 != e &&
                            null != e &&
                            new Ajax.Request(url("ajax/rename"), {
                                onSuccess: function (t) {
                                    switch (t.responseText) {
                                        case "ok":
                                            getUser(), alert("با موفقيت تغيير يافت"), $windows.admin_user[id].close();
                                            break;
                                        case "running":
                                            alert("اين نام در انحصار شخص ديگري است");
                                            break;
                                        case "badname":
                                            alert("اين نام در ليست سياه قرار دارد");
                                            break;
                                        case "permission":
                                            alert("شما دسترسي لازم براي اين کار را نداريد");
                                            break;
                                        case "pw":
                                            var i = prompt("پسورد را وارد نماييد");
                                            new Ajax.Request(url("ajax/rename"), {
                                                onSuccess: function (e) {
                                                    "ok" == e.responseText ? (alert("با موفقيت تغيير يافت"), getUser(), $windows.admin_user[id].close()) : alert(e.responseText);
                                                },
                                                postBody: "id=" + id + "&newname=" + e + "&password=" + i + "&token=" + $setting.chpw,
                                            });
                                            break;
                                        default:
                                            alert(t.responseText);
                                    }
                                },
                                postBody: "id=" + id + "&newname=" + e + "&token=" + $setting.chpw,
                            });
                    }),
                $("rename_user_auto_" + id) &&
                    ($("rename_user_auto_" + id).onclick = function () {
                        new Ajax.Request(url("ajax/rename"), {
                            onSuccess: function (e) {
                                switch (e.responseText) {
                                    case "ok":
                                        getUser(), alert("با موفقيت تغيير يافت"), $windows.admin_user[id].close();
                                        break;
                                    case "running":
                                        alert("اين نام در انحصار شخص ديگري است");
                                        break;
                                    case "badname":
                                        alert("اين نام در ليست سياه قرار دارد");
                                        break;
                                    case "permission":
                                        alert("شما دسترسي لازم براي اين کار را نداريد");
                                        break;
                                    case "pw":
                                        var t = prompt("پسورد را وارد نماييد");
                                        new Ajax.Request(url("ajax/rename"), {
                                            onSuccess: function (e) {
                                                "ok" == e.responseText ? (alert("با موفقيت تغيير يافت"), getUser(), $windows.admin_user[id].close()) : alert(e.responseText);
                                            },
                                            postBody: "id=" + id + "&newname=random&password=" + t + "&token=" + $setting.chpw,
                                        });
                                        break;
                                    default:
                                        alert(e.responseText);
                                }
                            },
                            postBody: "id=" + id + "&newname=random&token=" + $setting.chpw,
                        });
                    }),
                $("silent_user_" + id) &&
                    ($("silent_user_" + id).onclick = function () {
                        var e = prompt("مدت خفه کردن ؟ جهت آزادسازي 0را وارد کنيد", "", "خفه کردن");
                        return (
                            (w = $("usersilent_method").value),
                            "" == e
                                ? (alert("مدت خفه شدن کاربر وارد نشده است"), !1)
                                : isNumeric(e)
                                ? void new Ajax.Request(url("ajax/chat.silent"), {
                                      onSuccess: function (t) {
                                          switch (t.responseText) {
                                              case "ok":
                                                  getUser(), $windows.admin_user[id].close();
                                                  break;
                                              case "pw":
                                                  var i = prompt("کلمه عبور خفه کردن ؟", "", "خفه کردن");
                                                  if ("" === i) return alert("کلمه عبور وارد نشده است"), !1;
                                                  new Ajax.Request(url("ajax/chat.silent"), {
                                                      onSuccess: function (e) {
                                                          switch (e.responseText) {
                                                              case "ok":
                                                                  getUser(), $windows.admin_user[id].close();
                                                                  break;
                                                              case "epw":
                                                                  alert("کلمه عبور صحيح وارد نشده است");
                                                                  break;
                                                              case "no number":
                                                                  alert("لطفا عدد وارد کنيد");
                                                                  break;
                                                              case "repeat":
                                                                  alert("اين کاربر قبلا خفه شده است");
                                                                  break;
                                                              case "permission":
                                                                  alert("شما دسترسي لازم براي اين کار را نداريد");
                                                                  break;
                                                              default:
                                                                  alert(e.responseText);
                                                          }
                                                      },
                                                      postBody: "user=" + id + "&password=" + i + "&time=" + e + "&where=" + w + "&token=" + $setting.chpw,
                                                  });
                                                  break;
                                              default:
                                                  alert(t.responseText);
                                          }
                                      },
                                      postBody: "user=" + id + "&time=" + e + "&where=" + w + "&token=" + $setting.chpw,
                                  })
                                : (alert("مدت خفه شدن صحيح وارد نشده است"), !1)
                        );
                    }),
                $("chengestatosuser_" + id) &&
                    ($("chengestatosuser_" + id).onclick = function () {
                        var e = window.prompt("متن استاتوس:");
                        return e
                            ? void new Ajax.Request(url("ajax/chat.chengestatosuser"), {
                                  onSuccess: function (e) {
                                      getUser(), $windows.admin_user[id].close(), alert(e.responseText);
                                  },
                                  postBody: "user=" + id + "&text=" + e + "&token=" + $setting.chpw,
                              })
                            : alert("استاتوس وارد نشده است");
                    }),
                $("deletestatosuser_" + id) &&
                    ($("deletestatosuser_" + id).onclick = function () {
                        return confirm("آیا از حذف استاتوس این کاربر مطمئن هستید؟")
                            ? void new Ajax.Request(url("ajax/chat.chengestatosuser"), {
                                  onSuccess: function (e) {
                                      alert(e.responseText), $windows.admin_user[id].close(), getUser();
                                  },
                                  postBody: "user=" + id + "&action=derestatus",
                              })
                            : alert("استاتوس وارد نشده است");
                    }),
                $("register_user_" + id) &&
                    ($("register_user_" + id).onclick = function () {
                        var e = window.prompt("کلمه عبور:");
                        return (
                            null != e &&
                            "" != e &&
                            void new Ajax.Request(url("ajax/thisregister"), {
                                onSuccess: function (e) {
                                    switch (e.responseText) {
                                        case "ok":
                                            alert("با موفقيت کاربر سيستم شديد.");
                                            break;
                                        case "lastregister":
                                            alert("شما قبلا عضو شده ايد");
                                            break;
                                        case "lastemail":
                                            alert("اين ايميل قبلا در پايگاه داده ثبت شده.");
                                            break;
                                        case "email":
                                            alert("لطفا يک ايميل معتبر وارد کنيد.");
                                            break;
                                        default:
                                            alert(e.responseText);
                                    }
                                },
                                postBody: "user=" + id + "&password=" + e + "&token=" + $setting.chpw,
                            })
                        );
                    }),
                $("mods_monitor_" + id) &&
                    ($("mods_monitor_" + id).onclick = function () {
                        var e = window.prompt("دليل:"),
                            t = $("mods_monitor").value;
                        return null == e || "" == e
                            ? (alert("دليل اجباريست !"), !1)
                            : null != e &&
                                  "" != e &&
                                  void new Ajax.Request(url("ajax/mods.monitor"), {
                                      onSuccess: function (e) {
                                          alert(e.responseText);
                                      },
                                      postBody: "id=" + id + "&reason=" + e + "&action=" + t + "&token=" + $setting.chpw,
                                  });
                    });
        } catch (e) {
            console.log(e);
        }
    } else if ("user_" == ereignis.slice(0, 5) || "usch_" == ereignis.slice(0, 5)) {
        for ($user_id = ereignis.slice(5, ereignis.length), i = 0; i < $usersObj.userOnline.length; i++)
            if ($usersObj.userOnline[i].ui == $user_id) {
                (user_name = $usersObj.userOnline[i].un), ($("message").value += user_name.unescapeHTML()), $("message").focus();
                break;
            }
    } else if ("notallowedroom_" == ereignis.slice(0, 15) || "notallowedroomimg_" == ereignis.slice(0, 18)) {
        ($windows.allowed = new Window({
            className: $win_style,
            width: 240,
            height: 80,
            top: eval($mouse.top - 10),
            left: eval($mouse.left - 280),
            resizable: !1,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !0,
            opacity: 1,
        })),
            $windows.allowed.setHTMLContent($template.win_notallowed),
            $windows.allowed.show();
        try {
            $("close_room_warning").onclick = function () {
                $windows.allowed.close();
            };
        } catch (e) {}
    } else if ("pwroom_" == ereignis.slice(0, 7) || "pwroomimg_" == ereignis.slice(0, 10)) {
        for (var room_id_now = "pwroom_" == ereignis.slice(0, 7) ? ereignis.slice(7, ereignis.length) : ereignis.slice(10, ereignis.length), rooms = [], roomName = "", i = 0; i < $usersObj.rooms.length; i++)
            rooms[$usersObj.rooms[i].ri] = $usersObj.rooms[i].rn;
        for (i = 0; i < $usersObj.userOnline.length; i++)
            if ($usersObj.userOnline[i].ri == room_id_now) {
                roomName = rooms[$usersObj.userOnline[i].ri];
                break;
            }
        if ("" == roomName)
            try {
                for (i = 0; i < $usersObj.all_empty_rooms.length; i++)
                    if ($usersObj.all_empty_rooms[i].room_id == room_id_now) {
                        roomName = $usersObj.all_empty_rooms[i].room;
                        break;
                    }
            } catch (e) {}
        ($windows.laypw = new Window({
            className: $win_style,
            title: roomName,
            width: 240,
            height: 100,
            top: eval($mouse.top - 10),
            left: eval($mouse.left - 280),
            resizable: !1,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: {
                duration: 0.5,
                afterFinish: function () {
                    $("layerpw").focus();
                },
            },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !0,
            opacity: 1,
        })),
            $windows.laypw.setHTMLContent($template.win_passroom),
            $windows.laypw.show(),
            ($("pwroom_error").innerHTML = "");
        try {
            ($("send_room_pw").onclick = function () {
                check_room_pw($windows.laypw, room_id_now, roomName);
            }),
                ($("layerpw_form").onsubmit = function () {
                    return check_room_pw($windows.laypw, room_id_now, roomName), !1;
                });
        } catch (e) {}
    }
}
function check_room_pw(e, t) {
    new Ajax.Request(url("ajax/chengeroom"), {
        onSuccess: function (t) {
            "ok" == t.responseText
                ? (($("room").value = $me.room = room), AjaxReadRequest(!($("chatinhalt").innerHTML = "")), ReloaderUserOnline(!0), e.hide())
                : "pass" == t.responseText && ($("pwroom_error").innerHTML = "<b>رمز شما اشتباه مي باشد</b>");
        },
        postBody: "room_id=" + t + "&password=" + $("layerpw").value + "&token=" + $setting.chpw,
    });
}
function SimpleSwap(e, t) {
    e.src = e.getAttribute(t || "origsrc");
}
function SimpleSwapSetup() {
    for (var e, t = document.getElementsByTagName("img"), i = 0; i < t.length; i++)
        (e = t[i].getAttribute("oversrc")) &&
            ((t[i].oversrc_img = new Image()), (t[i].oversrc_img.src = e), (t[i].onmouseover = new Function("SimpleSwap(this,'oversrc');")), (t[i].onmouseout = new Function("SimpleSwap(this);")), t[i].setAttribute("origsrc", t[i].src));
}
function fkeys(e) {
    return !(e = e || window.event).ctrlKey && !e.altKey && 123 != e.keyCode && void 0;
}
function isset_dom(e) {
    return null !== document.getElementById(e);
}
function windowframe(wf_id, wf_width, wf_height, wf_url, mtop, mleft) {
    $windows.wf || ($windows.wf = []),
        ("object" == typeof $windows.wf[wf_id] && $($windows.wf[wf_id].getId())) ||
            ($windows.wf[wf_id] = new Window({
                url: wf_url,
                title: wf_id,
                className: $win_style,
                width: wf_width,
                height: wf_height,
                top: eval($mouse.top - (0 < mtop ? mtop : Number(wf_height) - 40)),
                left: eval($mouse.left - (0 < mleft ? mleft : Number(wf_width) + 60)),
                resizable: !0,
                showEffect: Effect.Appear,
                hideEffect: Effect.DropOut,
                showEffectOptions: { duration: 0.5 },
                hideEffectOptions: { duration: 0.5 },
                draggable: !0,
                minimizable: !1,
                maximizable: !1,
                destroyOnClose: !0,
                opacity: 1,
            })),
        "none" == $($windows.wf[wf_id].getId()).style.display ? ($windows.wf[wf_id].show(), $windows.wf[wf_id].toFront()) : $windows.wf[wf_id].close();
}
var $thememanager, ready, PreSimpleSwapOnload, Cockie;
(this.makeUploadMain = function () {
    (win_uploadsimg = new Window({
        url: "sendfileo",
        title: "ارسال فايل",
        className: $win_style,
        width: 420,
        height: 300,
        top: eval($mouse.top - 245),
        left: eval($mouse.left - 140),
        resizable: !1,
        showEffect: Effect.Appear,
        hideEffect: Effect.DropOut,
        showEffectOptions: { duration: 0.5 },
        hideEffectOptions: { duration: 0.5 },
        draggable: !0,
        minimizable: !1,
        maximizable: !1,
        destroyOnClose: !1,
        opacity: 1,
    })),
        win_uploadsimg.show();
}),
    (this.makeUploadAction1 = function (message_input_field, privat, into) {
        (win_uploadsimg = new Window({
            url: "sendfile?targetid=" + privat + "&into=" + into,
            title: "ارسال فايل به دوستان",
            className: $win_style,
            width: 420,
            height: 300,
            top: eval($mouse.top - 245),
            left: eval($mouse.left - 140),
            resizable: !1,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        })),
            win_uploadsimg.show();
    }),
    (this.info_user_private = function (message_input_field, privat) {
        var winform_info_user_private = new Window({
            url: "ajax/chat.idle?targetid=" + privat,
            title: "مشخصات کاربر",
            className: $win_style,
            width: 300,
            height: 200,
            top: eval($mouse.top - 245),
            left: eval($mouse.left - 140),
            resizable: !1,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        });
        winform_info_user_private.show();
    }),
    (this.info_cf_private = function (cfid) {
        var winform_info_cf_private = new Window({
            url: "ajax/chat.cfinfo?cfid=" + cfid,
            title: "اطلاعات اتاق",
            className: $win_style,
            width: 400,
            height: 200,
            top: eval($mouse.top - 245),
            left: eval($mouse.left - 140),
            resizable: !0,
            showEffect: Effect.Appear,
            hideEffect: Effect.DropOut,
            showEffectOptions: { duration: 0.5 },
            hideEffectOptions: { duration: 0.5 },
            draggable: !0,
            minimizable: !1,
            maximizable: !1,
            destroyOnClose: !1,
            opacity: 1,
        });
        winform_info_cf_private.show();
    }),
    (this.videochat = function (action, rc, channelid, roomid, to) {
        var params = channelid && roomid && to ? "&channelid=" + channelid + "&roomid=" + roomid + "&to=" + to : "",
            videochat;
        ($temp = $("chatinhalt")),
            (videochat = new Window({
                className: $win_style,
                url: "videochat?action=" + action + "&rc=" + rc + params,
                title: "چت تصويري",
                width: 500,
                height: 400,
                top: eval($temp.offsetTop + Math.round(50 * Math.random())),
                left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
                resizable: !0,
                showEffect: Effect.Appear,
                hideEffect: Effect.DropOut,
                showEffectOptions: { duration: 0.5 },
                hideEffectOptions: { duration: 0.5 },
                draggable: !0,
                minimizable: !1,
                maximizable: !1,
                destroyOnClose: !0,
                opacity: 1,
            })),
            videochat.show(),
            videochat.toFront();
    }),
    (this.cfvideochat = function (action, channelid, roomid, cfid, username) {
        var params = channelid && roomid ? "&channelid=" + channelid + "&roomid=" + roomid : "",
            cfvideochat;
        ($temp = $("chatinhalt")),
            (cfvideochat = new Window({
                className: $win_style,
                url: "cfvideochat?action=" + action + "&cfid=" + cfid + params,
                title: "چت تصويري گروهي " + username,
                width: 700,
                height: 400,
                top: eval($temp.offsetTop + Math.round(50 * Math.random())),
                left: eval($temp.offsetLeft + Math.round(50 * Math.random())),
                resizable: !0,
                showEffect: Effect.Appear,
                hideEffect: Effect.DropOut,
                showEffectOptions: { duration: 0.5 },
                hideEffectOptions: { duration: 0.5 },
                draggable: !0,
                minimizable: !1,
                maximizable: !1,
                destroyOnClose: !0,
                opacity: 1,
            })),
            cfvideochat.show(),
            cfvideochat.toFront();
    });
var $time_last_req = 0,
    $get_message_req = !1,
    $get_update_req = !1,
    $win_style = "TarhPardaz_win",
    $setting = {
        reload_interval: 4e3,
        showmsgsys: !1,
        showavatars: !0,
        show_female_online: !0,
        show_male_online: !0,
        show_admins_online: !1,
        show_friends_online: !1,
        view_status_usersonline: !1,
        myFriends: [],
        show_reporter_private: !0,
        buzz: !0,
        show_status_public: !0,
        change_onlinelist: !1,
        window_status_s: !0,
        reply: !0,
        hideIcons: !1,
    },
    $me = { silent: 0, move: 0, reply: !1 },
    $msgid = 1,
    $mouse = { top: 0, left: 0 },
    $windows = { block: Array(), block_ids: Array(), privat: Array(), cf: Array(), voicechat: Array(), admin_user: Array(), smileys_favorite: Array() },
    $smilies = {},
    $codes = {},
    $usersObj,
    $Types,
    $status_public = {},
    $privato,
    $numrepeatmsg = 0,
    $repeatspeedwarn = 0,
    $lastsend = 0,
    $numsmiles = 0,
    $timerget,
    $timeruser,
    $lsatmsgsent,
    $template = {},
    $firstclick = !1,
    $topenpop = {},
    $REPLY_PRIVATE_DATA = [],
    $REPLY_CF_DATA = [],
    $REPLY_LAST_ID,
    $FONTLIST = "",
    $CHECK_AUTO_SCROLL = !0,
    $LoadHistory_HISTORY = new Array(),
    $OFFMSG = 0;
($allowchat = Array()),
    ($template.prop_list =
        '<div id="prop_list" style="direction: rtl;"><ul id="prop_ul"><li id="change_avatar"><img style="height:18px;width:18px" src="/theme/images/chat/av.png" />تغییر آواتار</li><li id="create_cf"><img style="height:18px;width:18px" src="[cf]" />ساخت اتاق کنفرانس</li><li id="chat_statusText"><img src="[23]" style="height:18px;width:18px" />ثبت دل نوشته (استاتوس)</li><li id="cls"><img style="height:18px;width:18px" src="[0]" />پاک کردن پيام ها</li><li id="delId"><img style="height:18px;width:18px" src="[di]" />حذف و آزاد سازي نام کاربري</li><li id="my_blacklists"><img style="height:18px;width:18px" src="[9]" />ليست مسدود شده ها</li><li id="my_smile"><img style="height:18px;width:18px" src="/theme/images/bg/bg1840.png" />لیست شکلک های شما</li><li id="link_showpv"><img style="height:18px;width:18px" src="[shp]" />ليست پيام هاي دريافتي</li><li id="link_showms"><img style="height:18px;width:18px" src="[shm]" />ليست پيام هاي ارسالي</li><li id="my_blacklists_profile"><img style="height:18px;width:18px" src="{blprofile}" />ليست قطع ارتباط شده ها در پروفايل</li><li id="myFriends"><img style="height:18px;width:18px" src="[myf]" />ليست دوستان من</li><li id="show_pending"><img style="height:18px;width:18px" src="[myf]" />درخواست هاي دوستي تاييد نشده</li><li id="history"><img style="height:18px;width:18px" src="[1]" />تاريخچه چت</li><li id="adminpanel"><img style="height:18px;width:18px" src="[22]" />پنل مديريت</li><li id="changepassword"><img src="[2]" />[6]</li><li id="changestatus"><img style="height:18px;width:18px" src="[3]" />تغيير وضعيت</li><li><input type="checkbox" id="set_hideIcons" [hideIcons] />مخفي کردن آيکون ها در عمومي</li><li><input type="checkbox" id="set_notify" [24] />سرويس نوتيفيکيشن</li><li><input type="checkbox" id="set_sys_messages" [4] />نمايش پيام هاي سيستم</li><li><input type="checkbox" id="show_avatars" [5] />مشاهده آواتار ها</li><li><input type="checkbox" id="privat_msgs" [7] />مشاهده پيام هاي خصوصي</li><li><input type="checkbox" id="buzz_status" [8] />فعال بودن بوز در خصوصي</li><li><input type="checkbox" id="status_cf" [10] />نمايش درخواست کنفرانس کاربران</li><li><input type="checkbox" id="show_reporter_private" [12] />نمايش ارسال گزارش کنار آواتار در خ و عمومي</li><li><input type="checkbox" id="block_request2addf" [11] />مشاهده درخواست دوستي کاربران</li><li><input type="checkbox" id="show_female_online" [13] />نمايش دختران در ليست آنلاين</li><li><input type="checkbox" id="show_male_online" [14] />نمايش پسران در ليست آنلاين</li><li><input type="checkbox" id="block_video_audio_chat" [15] />نمايش درخواست چت صوتي و تصويري</li><li><input type="checkbox" id="show_admins_online" [16] />نمايش مديران و ناظرين آنلاين</li><li><input type="checkbox" id="show_friends_online" [17] />مشاهده دوستان آنلاين</li><li><input type="checkbox" id="show_status_public" [18] />مشاهده حالت کاربران در عمومي</li><li><input type="checkbox" id="view_status_usersonline" [20] />مشاهده وضعيت کاربران آنلاين</li><li><input type="checkbox" id="change_onlinelist" [21] />تغيير ليست آنلاين</li></ul><form id="changepw" style="display:none"><p>کلمه عبور جديد:<input id="newpassinput" type="text"></p><p style="color: red;">نمونه رمز قوي : حداقل داراي 7 کاراکتر و ترکيب عدد و حروف يکي از کاراکتر هاي ( $ , @ , % ) مي باشد مانند : mostafa@92$1</p><p style="text-align: center;"><input type="submit" value="تغيير بده"> <input type="button" id="cancelreg" class="cancel" value="انصراف"></p></form></div>'),
    ($template.delId =
        '<div style="direction:rtl;"><p style="padding:0px 13px 0px 0px;">اگر از حذف ايدي خود مطمئن هستيد و ديگر نيازي به استفاده از آن نداريد مشخصات خود را برسي نماييد و رمز عبور و تاييد رمز عبور رو پر نماييد و روي حذف نام کاربري کليک نماييد</p><p align="center" style="font-weight:bold;">مشخصات شما :</p><table cellpadding="3" border="1" dir="rtl" align="center"><tr><td>نام کاربري : </td><td><font color="red">[un]</font></tr></td><td>شماره کاربري : </td><td><font color="red">[id]</font></tr></td><tr><td>امتياز : </td><td><font color="red">[sr]</font></tr></td><tr><td>امتياز بانک : </td><td><font color="red">[ba]</font></tr></td><tr><td>درجه : </td><td><font color="red">[ty]</font></tr></td><tr><td>جنسيت : </td><td><font color="red">[gr]</font></td></tr></table><br><div align="center"><input id="delidPass" type="text" placeholder="کلمه عبور"><br><input id="delidPass2" type="text" placeholder="تکرار کلمه عبور"><br><br><a href="javascript:;" id="link_deleteid">حذف نام کاربري</a></div></div>'),
    ($template.vip_list =
        '<div id="vip_list" style="direction: rtl;"><ul id="prop_ul1"><li id="upload_avatar"><img src="[3]" style="height:20px;width:20px"/>آپلود آواتار</li><li id="add_smile"><img style="height:20px;width:20px" src="/theme/images/bg/bg1840.png" /> افزودن شکلک شخصی</li><li id="sendVoice"><img src="[voicechat]" style="height:20px;weight:20px;" />ارسال پیام صوتی</li><li id="link_ranks"><img src="[01]" style="height:20px;width:20px"/>لیست امتیازات</li><li id="link_game"><img src="[02]" style="height:20px;width:20px"/>بازی آنلاین</li><li id="link_offlinemsg"><img src="[03]" style="height:20px;width:20px"/>پیام های افلاین</li><li id="link_chat_advertise"><img style="height:20px;width:20px" src="/theme/images/chat/target.png" />هزينه تبليغات </li><li id="link_chatadvertise"> </li><li id="link_offlinemsg"></li><li id="link_comment"><img src="[14]" style="height:20px;width:20px"/>سيستم نظرات</li><li id="add_image"><img style="height:20px;width:20px" src="[0]" />ارسال تصویر یا آهنگ در عمومی</li><li id="add_link"><img style="height:20px;width:20px" src="[1]" />افزودن لينک</li><li id="link_url"><img style="height:20px;width:20px" src="[15]" />افزودن لينک در خصوصـي</li><li id="add_music"><img style="height:20px;width:20px" src="[music]" />ارسال موزيک در عمومي</li><li id="add_film"><img style="height:20px;width:20px" src="[film]" />ارسال فيلم در عمومي</li><li id="buy_score"><img style="height:20px;width:20px" src="[2]" />خريدن امتياز بانکي</li><li onclick="add_banks();" id="add_bank"><img src="[11]" style="height:20px;width:20px" />مبدل امتياز به امتياز بانکي</li><li id="remove_images"><img style="height:20px;width:20px" src="[4]" />پاک کردن فايل هاي ارسال شده در خصوصي</li><br><li id="buy_room" ><a href="/kharid" target="_blank"><img style="height:20px;width:20px" src="[5]" />خريد اتاق</a></li><li id="buy_type"></li><li id="link_sendscore"><img style="height:20px;width:20px" src="[9]" />انتقال امتياز</li><li id="link_chat_cuteuser"><img style="height:20px;width:20px" src="[7]" />زيبا ساز نام کاربري</li><li id="link_chat_advertise"></li><li id="link_chat_fal"></li><li id="link_executecommand"><img style="height:20px;width:20px" src="[12]"/>اجراي دستورات</li><li id="me_info"><img style="height:20px;width:20px" src="[3]" />اطلاعات من</li></ul></div>'),
    ($template.me_info =
        '<div class="me_info"><div class="me_avatar"><img src="/theme/images/avatars/[0]"></div><div class="me_details"><li>نام نمايشي: <a>[1]</a></li><li>درجه کاربري: <a>[2]</a></li><li>امتياز کاربري: <a>[3]</a></li><li>امتياز بانک: <a>[4]</a></li></div></div>'),
    ($template.game_list = '<div id="game_list" style="direction: rtl;" class="user_win"><ul id="prop_ul"><li id="singleplayer"><img style="height:20px;width:20px" src="[0]" />بازي ها</li><li id="multiplayer"></li></ul></div>'),
    ($template.form_icons =
        '<img id="link_sagen" class="img_button" alt="ارسال پيام" title="ارسال پيام"/><img id="link_smileys" class="img_button" alt="شکلک ها" title="شکلک ها"/><img id="link_color" class="img_button" alt="رنگ و فونت نوشته" title="رنگ و فونت نوشته"/><img id="link_prop" class="img_button" alt="تنظيمات" title="تنظيمات"/><img id="link_vip" class="img_button" alt=امکانات ويژه" title="امکانات ويژه"/><img id="link_ranks" class="img_button" alt="امتيازات کاربران" title="امتيازات کاربران"/><img id="add_image" class="img_button" alt="ارسال تصویر یا آهنگ در عمومی" title="ارسال تصویر یا آهنگ در عمومی" /><img id="link_voice" class="img_button" alt="ارسال پیام صوتی" title="ارسال پیام صوتی"/><img id="link_game" class="img_button" alt="بازي آنلاين" title="بازي آنلاين"/><img id="link_eraser" class="img_button" alt="پاک کن" title="پاک کن"/><img id="link_admin" class="img_button" alt="مديريت" title="مديريت"/><img id="link_offlinemsg" class="img_button" alt="پيام افلاين" title="پيام افلاين"/><img id="link_logout" class="img_button" alt="خروج" title="خروج"/>'),
    ($template.generalmessage =
        '<div mid="[msgid]" class="mess_back" id="userid_{userid}"><span id="userAv_[6]">[0][1]</span><span id="userName_[6]"><b [2]>[3]</b></span>:[menu]&nbsp;<span onblur="reacthide([react]);" onclick="reactshow([react])" id="userText_[6]" class="tlg" style="[4]" >[5]</span>[8][9]</div><div id="msgcode_[6]"></div>'),
    ($template.sendfile = '<div mid="[msgid]" class="mess_back" id="userid_{userid}"><span id="userAv_[r]">[0][1]</span><span id="userName_[r]"><b [2]>[n]</b></span>:[menu]&nbsp;<span onblur="reacthide([react]);" onclick="reactshow([react])" type="Media" style="display: inline-block;" id="userText_[r]" class="tlg" style="[4]" >[m]</span>[8][9]</div><div id="msgcode_[r]"></div>'),
    ($template.message_private_genetal_sent = '<div class="privat_ausg_von">[0][1]<b>[2]</b><i>(خصوصي به [3])</i>:<span style="[4]">[5]</span></div>'),
    ($template.message_private_genetal_get = '<div class="privat_ausg_an">[0][1]<b>[2]</b><i>(خصوصي)</i>:<span style="[3]">[4]</span></div>'),
    ($template.private_window =
        '<div id="pivate_win_[0]" class="privat_mesages_window"><center><button style="background:#64B5F6; border:#2a84d3 solid 1px;color:#fff;border-radius:0px 0px 40px 40px;font-weight:700;text-shadow:#D890000 1px;cursor:pointer;padding:5px 10px" id="btn_loader_area_[0]" onclick="LoadHistory({to},\'[0]\');">پيام هاي اخير</button></center><div id="history_loader_area_[0]"></div><div id="history_pivate_area_[0]"></div></div><div><form style="display:inline" id="win_form_[0]"><table cellspacing="0" cellpadding="0"><tr><td><input type="hidden" id="this_win_[1]" value="[0]"><input type="text" class="private_message_field" id="message_win_[0]"></td><td><img src="[2]" id="submit_img_[0]" alt="ارسال پيام" title="ارسال پيام" style="padding-left: 4px;cursor:pointer;height:18px;width:18px;"></td><td><img src="[3]" id="smileys_img_[0]" title="شکلک ها" style="padding-left: 4px;cursor:pointer;height:18px;width:18px;"></td><td>[4]</td><td>[8]</td><td>[5]</td><td>[12]</td><td>[6]</td><td>[7]</td><td>[voice_chat]</td><td><img src="[10]" id="inviate2mycf_[0]" title="دعوت به اتاق کنفرانس" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[11]" id="priv_add2myfriends_[0]" title="درخواست دوستي" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td>[e14]</td></tr></table></form></div></div>'),
    ($template.cf_window =
        '<div id="pivate_win_[0]" class="privat_mesages_window"></div><div><form style="display:inline" id="win_form_[0]"><table cellspacing="0" cellpadding="0"><tr><td><input type="hidden" id="this_win_[1]" value="[0]"><input type="text"  class="private_message_field" id="message_win_[0]"></td><td><img src="[2]" id="submit_img_[0]" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[3]" id="smileys_img_[0]" title="شکلک ها"style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[4]" id="cls_[0]" title="پاک کن" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[7]" id="cf_videochat_[0]" title="چت تصويري" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[5]" id="upload_img_[0]" title="آپلود فايل و عکس" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td><td><img src="[6]" id="cfinfo_[0]" title="اطلاعات اتاق" style="height:18px;width:18px;padding-left: 4px;cursor:pointer;"></td></tr></table></form></div></div>'),
    ($template.message_private_win =
        '<div class="msgnum_[msgid]"><div class="mess_back"><span id="userAv_priv_[4]">[0]</span><span id="userName_priv_[4]"><b [100]>[1]</b></span>:[menus]&nbsp;<span id="userText_priv_[4]" class="tlg" style="[2]" >[3]</span></div><div id="msgcode_[4]"></div></div>'),
    ($template.rooms_allow = '<div class="rooms" id="room_[0]"><span id="room_[0]">[1]</span><w_on id="room_[0]">[on]</w_on></div>'),
    ($template.rooms_allow_vip =
        '<div class="rooms" id="room_[0]"><span id="room_[0]">[1]</span><b_on id="room_[0]">[on]</b_on><img title="اتاق ساخته شده توسط کاربر وي آي پي (VIP)" id="room_[0]" src="[2]" width="11" height="11" style="margin-left:5px;" /></div>'),
    ($template.rooms_password = '<div class="rooms_b" id="pwroom_[0]"><span id="pwroom_[0]">[1]</span><b_on id="pwroom_[0]">[on]</b_on><img id="pwroomimg_[0]" src="[2]" width="11" height="11" style="margin-left:5px;" /></div>'),
    ($template.rooms_password_vip =
        '<div class="rooms_b" id="pwroom_[0]"><span id="pwroom_[0]">[1]</span><b_on id="pwroom_[0]">[on]</b_on><img id="pwroomimg_[0]" src="[2]" width="11" height="11" style="margin-left:5px;" /><img title="اتاق ساخته شده توسط کاربر وي آي پي (VIP)" id="pwroomimg_[0]" src="[3]" width="11" height="11" style="margin-left:5px;" /></div>'),
    ($template.rooms_not_allowed =
        '<div class="rooms_b" id="notallowedroom_[0]"><span id="notallowedroom_[0]">[1]</span><b_on id="notallowedroom_[0]">[on]</b_on><img id="notallowedroomimg_[0]" src="[2]" width="11" height="10" style="margin-left:5px;" /></div>'),
    ($template.user_div_me =
        '<div id="user_div_[0]" style="[1]"><div style="float:left;"><img src="[2]" style="height:20px;width:20px"/><span style="[5]" id="user_[0]"><b>[3]</b></span></div><div style="float:right;margin-right: 2px;">[4]</div><div style="clear:both"></div></div>'),
    ($template.user_div =
        '<div id="user_div_[0]" style="[1]"><div style="float:left;"><img src="[2]" id="user_[0]" style="cursor:pointer" title="گرفتن نام کاربري" alt="گرفتن نام کاربري"/><span id="infoblock_[0]" style="[3]cursor:pointer" class="fontonline">[4]</span></div><div style="float:right;margin-right: 2px;">[5]</div><div style="clear:both"></div></div>'),
    ($template.register_win =
        '<div id="register_formular"><form id="register_form" style="display:inline;direction: rtl;"><div>با انتخاب يک کلمه رمز شما ميتوانيد از اسم خود به عنوان آيدي اختصاصي استفاده کنيد<hr size="1"/><table><tr><td>نام کاربري:</td><td><input type="text" id="user_register_field" size="15" value="{username}"/></td></tr><tr><td>کلمه عبور:</td><td><input type="password" id="pw_register_field" size="15"/></td></tr><tr><td>تکرار:</td><td><input type="password" id="pw_register_field2" size="15"/></td></tr><tr><td colspan="2"><br/><a href="javascript:void(0);" id="make_register">ذخيره</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" id="cancel_register">انصراف</a></td></tr></div></form></div>'),
    ($template.user_win =
        '<div class="user_win"><ul><li id="info_set_name_[1]"><img style="height:16px;width:16px" src="[0]"/>گرفتن نام کاربري</li><li id="info_privatm_[1]"><img style="height:16px;width:16px" src="[2]"/>چت خصوصي در پنجره اصلي</li><li id="info_privatf_[1]"><img style="height:16px;width:16px" src="[3]"/>چت خصوصي در پنجره جديد</li><li id="inviate2mycf_[1]"><img style="height:16px;width:16px" src="[cf]"/>دعوت به اتاق کنفرانس</li><li id="add2myfriends_[1]"><img style="height:16px;width:16px" src="[addfriend]"/>افزودن به ليست دوستان</li><li id="info_reportname_[1]"><img style="height:16px;width:16px" src="[7]" />گزارش نام اين کاربر</li><li id="info_blockform_[1]"><img style="height:16px;width:16px" src="[4]"/>مسدود/آزاد سازي پيام ها<div id="block_form_div_[1]" class="block_form"><form name="user_block_[1]" class="form_user_block"><input type="Checkbox" id="blokiere_user_all_[1]" [5]>همه پيام ها <input type="Checkbox" id="blokiere_user_priv_[1]" [5]>فقط خصوصي ها </form></div></li></ul></div>'),
    ($template.na_user_win =
        '<div class="user_win"><ul><li id="info_set_name_[1]"><img src="[0]"/>گرفتن نام کاربري</li><li id="req_private_[1]"><img src="[2]"/>درخواست اجازه چت خصوصي</li><li id="add2myfriends_[1]"><img src="[addfriend]"/>افزودن به ليست دوستان</li><li id="info_reportname_[1]"><img style="height:16px;width:16px" src="[7]" />گزارش نام اين کاربر</li><li id="info_blockform_[1]"><img src="[4]"/>مسدود/آزاد سازي پيام ها<div id="block_form_div_[1]" class="block_form"><form name="user_block_[1]" class="form_user_block"><input type="Checkbox" id="blokiere_user_all_[1]" [5]>همه پيام ها <input type="Checkbox" id="blokiere_user_priv_[1]" [5]>فقط خصوصي ها </form></div></li></ul></div>'),
    ($template.admin_win =
        '<div style="direction: rtl;" class="into_admin_win"><p>نام: <b>[0]</b></p><p>نام نمایشی کاربر: <b>[towname]</b></p><p>کد کاربري: <b>[1]</b></p><p>آي پي: <b>[2]</b></p><p>سيستم عامل کاربر : <b>[ubr]</b></p><p>کشور کاربر :<b>[countries][countriesimg]</b></p><p>مرورگر کاربر : <b>[user_ubrowser]</b></p>افزودن آي پي به ليست تحريم ها<form><select id="blacklist_time" size="1"><option value="1day">يک روز</option><option value="exit">لحظه اي</option><option value="1min">يک دقيقه</option><option value="10min">ده دقيقه</option><option value="30min">سي دقيقه</option><option value="1hour">يک ساعت</option><option value="12hour">دوازده ساعت</option><option value="3day">3 روز</option><option value="1week">1 هفته</option><option value="2week">2 هفته</option><option value="1month">يک ماه</option><option value="6month">شش ماه</option></select>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" id="sperre_user_[1]">اخراج کن</a><br><select id="usersilent_method" size="1"><option value="1">خفه کردن کلي</option><option value="2">خفه در عمومي</option><option value="3">خفه در خصوصي</option></select>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" id="silent_user_[1]">خفه کن</a><br>انتقال کاربر به يک اتاق ديگر<br><form><select id="move_user" size="1">[select]</select>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" id="move_user_[1]">انتقال کن</a><br>دادن دسترسي موقت به کاربر<br><form><select id="userpermission_action" size="1"><option value="profile">ويرايش پروفايل</option><option value="uploadfile">ارسال فايل در خصوصي</option><option value="c2c">چت صوتي و تصويري</option><option value="history">خواندن تاريخچه</option></select>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" id="allow_systems2user_[1]">دسترسي بده</a><br>[mods]<br><ul><li id="refresh_user_[1]">رفرش کردن صفحه</li><li id="alert_user_[1]">اخطار دادن</li><li id="rename_user_[1]">تغيير نام</li><li id="rename_user_auto_[1]">تغيير نام اتوماتيک</li><li id="allow_talk_main_[1]">دادن امتياز لازم براي حرف زدن در عمومي</li><li id="user_resetprofile_[1]">پاک کردن اطلاعات پروفايل</li> [4] </ul></form></div>'),
    ($template.admin_win_adminrows =
        '<li id="disableduser_[1]">حذف کامل اين کاربر</li><li onclick="reportuser(1,[1]);">ريپورت کردن کاربر در خصوصي</li><li onclick="reportuser(0,[1]);">ان ريپورت کردن کاربر در خصوصي</li><li id="addscoretouser_[1]">افزايش امتياز براي درجه دادن و يا صحبت در عمومي</li><li id="delscoretouser_[1]">کسر امتياز براي جلوگيري ازصحبت درعمومي و کسردرجه</li><li id="delbanktouser_[1]">حذف امتياز بانکي کاربر</li><li id="addbanktouser_[1]">افزايش امتياز بانکي کاربر</li><li id="chengestatosuser_[1]">تغير استاتوس کاربري</li><li id="deletestatosuser_[1]">حذف استاتوس کاربری</li><li id="register_user_[1]">عضو کردن</li><li id="usersshow_[1]">نمايان کردن</li><li id="usershide_[1]">مخفي کردن</li><li><a href="[5]" target="_blank">ويرايش اطلاعات شخصي</a></li><li><a href="[6]" target="_blank">خصوصي خوان</a></li>'),
    ($template.win_notallowed = '<p style="color: red;text-align: center;font-weight: bold;">شما مجاز به ورود به اين روم نيستيد</p><div class="close_room_warning" id="close_room_warning">بستن</div>'),
    ($template.win_passroom =
        '<form id="layerpw_form"><p>شما براي ورود به اين اتاق لازم به وارد کلمه عبور مربوط داريد</p><div id="pwroom_error"></div><br/><input type="password" name="layerpw" id="layerpw" style="float:left"/><div class="" id="send_room_pw">ورود</div></form>'),
    ($template.reg_btn = '<input type="button" id="regbtn" value="براي ثبت نام کليک کنيد "/><br/>'),
    ($template.registerbox =
        '<div id="registercontiner"><h1>عضويت در چتروم</h1><form id="registerboxform"><div class="row"><div class="half"><input name="firstname" value="" placeholder="نام کوچک" class="form-control" type="text"></div><div class="half"><input name="lastname" value="" placeholder="نام خانوادگي" class="form-control" type="text"></div></div><div class="row"><div class="half"><input name="pwd" value="" placeholder="کلمه عبور" class="form-control" type="password"></div><div class="half"><input name="repwd" value="" placeholder="تکرار کلمه عبور" class="form-control" type="password"></div></div><div class="row"><div class="half"><input name="cellphone" value="" placeholder="تلفن همراه" class="form-control" type="text"></div><div class="half"><input name="email" value="" placeholder="ايميل" class="form-control" type="text"></div></div><div class="row"><div class="half"><input name="state" value="" placeholder="استان محل زندگي" class="form-control" type="text"></div><div class="half"><input name="city" value="" placeholder="شهر محل زندگي" class="form-control" type="text"></div></div><div class="row"><div class="half">شيوه فعال سازي:</div><div class="half"><label>ايميل<input type="radio" name="activation" id="activation_mail" value="email" checked="checked"></label><label>پيامک<input id="activation_sms" type="radio" name="activation" value="sms"></label></div></div><div class="row">شما با کليک بر روي گزينه ثبت نام تمامي قوانين جمهوري اسلامي ايران و جرائم رايانه اي را پذيرفته ايد وما براي تائيد اطلاعاتتان،به <span id="registermsg-0">ايميلي</span> که در فرم بالا وارد نموديد پيامي ارسال ميکنيم که در مرحله بعدي از آن استفاده ميکنيم در طرف مقابل صاحبان اين پايگاه گفتگو به حقوق حريم خصوصي پايبندند و اطلاعات شمارا محفوظ نگه ميدارند و بدون حکم قضايي آن هارا در دسترسي شخص ثالثي قرار نخواهند داد.</div><div class="row"><button type="submit" class="btn">ثبت نام</button></div></form></div>'),
    ($template.overcolor = '<div id="overcolor"></div>'),
    ($template.registervalid =
        '<div id="registervalidcontiner"><h1>تاييد عضويت</h1><form id="registervalidform"><div class="row"><input name="code" value="" placeholder="کد فعال سازي" class="form-control" type="text"></div><div class="row">ما براي شما [0] ارسال کرديم و کدي براي فعال سازي نام کاربريتان در آن ذکر نموديم.لطفا آن کد را در اينجا وارد کنيد.درصورتي که [0] دريافت نکرديد 5 دقيقه صبر کنيد و بعد از 5 دقيقه شما مجاز به ثبت نام دوباره خواهيد شد.درصورتي که از روش فعال سازي ايميل استفاده کرديد لطفا پوشه اسپم ايميل خود را نيز چک کنيد</div><div class="row"><button type="submit" class="btn">فعال سازي</button></div></form></div>'),
    ($template.allowchat =
        '<div style="border: 2px solid #ccc; background: rgba(230, 230, 230, 0.5);"><b>System</b>: <div style="color:red; font-weight:bold; direction:rtl; display:inline;">کاربر [1] به شما درخواست چت خصوصي داده است.<div style="text-align:center; padding:15px;"><input type="button" value="موافقت" id="true_[0]"><input type="button" value="رد کردن" id="false_[0]"></div></div></div>'),
    ($template.allowchatmessage = '<div style="margin-bottom:2px;border: 2px solid #ccc; background: rgba(230, 230, 230, 0.5);"><b>System</b>: <span style="color:[0]; font-weight:bold">[1]</span></div>'),
    ($template.reply = '<div id="replybox"><div id="replyclose" onclick="replyclose();">X</div><div id="repAv"></div><div id="replysep"><div id="repName"></div><div id="repText"></div></div></div>'),
    ($template.replymsg =
        '<div class="pmbox"><div mid="[msgid]" class="mess_back" id="userid_{userid}"><span id="userAv_[8]">[0][1]</span><span id="userName_[8]"><b [2]>[3]</b></span>:[menu]&nbsp;</div><div id="box"><div id="khat"><div id="name">[7]</div><div id="text">[5]</div></div><div id="means"><span onblur="reacthide([react]);" onclick="reactshow([react])" style="[4]" class="tlg" id="userText_[8]">[6]</span>[typereact][reaction]</div></div></div><div id="msgcode_[8]"></div>'),
    ($template.replymsg_private =
        '<div class="msgnum_[msgid]"><div class="pmbox"><div class="mess_back"><span id="userAv_priv_[9]">[1]</span><span id="userName_priv_[9]"><b [100]>[3]</b></span>:[menus]&nbsp;</div><div id="box"><div id="khat"><div id="name">[7]</div><div id="text">[5]</div></div><div id="means"><span class="tlg" style="[4]" id="userText_priv_[9]">[6]</span></div></div></div><div id="msgcode_[9]"></div></div>'),
    ($template.forwardBox =
        '<div id="forwardBox"><input type="hidden" id="forwardBoxIdWindow" name="forwardBoxIdWindow" value="" /><input type="hidden" id="forwardBoxWindow" name="forwardBoxWindow" value="" /><div class="forwardClose" onClick="forwardBoxClose()">X</div><div class="forwardLoading"><img id="forwardBoxImageLoading" src="[0]" style="display: none;" /></div><div class="forwardSearch"><input id="forwardSearchInput" onkeyup="javacript:forwardBoxSearch()" placeholder="نام شخص مورد نظر جهت ارسال متن انتخابي" /></div><div id="forwardResult"></div></div>'),
    ($template.forwardUser = '<div class="forwardItem" onclick="forwardClickUser(\'[0]\')"><div align="center"><img src="[1]" /></div><div align="center" style="margin-top:-15px;">[2]</div></div>'),
    ($template.forwardmsg =
        '<div class="pmbox"><div mid="[msgid]" class="mess_back" id="userid_{userid}"><span id="userAv_[7]">[0][1]</span><span id="userName_[7]"><b [2]>[3]</b></span>:[menu]&nbsp;</div><div id="box"><div><div class="forwardTitle">پيام ارسال شده </div><div id="text" class="forwardTitle">توسط <strong style="direction: rtl;">[6]</strong></div></div><div id="means"><span style="[4]" id="userText_[7]">[5]</span></div></div></div><div id="msgcode_[7]"></div>'),
    ($template.forwardmsg_private =
        '<div class="msgnum_[msgid]"><div class="pmbox"><div class="mess_back"><span id="userAv_priv_[6]">[1]</span><span id="userName_priv_[6]"><b [7]>[2]</b></span>:[menus]&nbsp;</div><div id="boxforpv"><div><div class="forwardTitle">پيام ارسال شده </div><div class="forwardTitle">توسط <strong style="direction: rtl;">[5]</strong></div></div><div id="means"><span style="[3]" id="userText_priv_[6]">[4]</span></div></div></div><div id="msgcode_[6]"></div></div>'),
    (ready = (function () {
        function e(e) {
            s.bindReady(), s.type(e), t.done(e);
        }
        var t,
            i,
            s,
            n = {
                "[object Boolean]": "boolean",
                "[object Number]": "number",
                "[object String]": "string",
                "[object Function]": "function",
                "[object Array]": "array",
                "[object Date]": "date",
                "[object RegExp]": "regexp",
                "[object Object]": "object",
            };
        return (
            (s = {
                isReady: !1,
                readyWait: 1,
                holdReady: function (e) {
                    e ? s.readyWait++ : s.ready(!0);
                },
                ready: function (e) {
                    if ((!0 === e && !--s.readyWait) || (!0 !== e && !s.isReady)) {
                        if (!document.body) return setTimeout(s.ready, 1);
                        if ((s.isReady = !0) !== e && 0 < --s.readyWait) return;
                        t.resolveWith(document, [s]);
                    }
                },
                bindReady: function () {
                    if (!t) {
                        if (((t = s._Deferred()), "complete" === document.readyState)) return setTimeout(s.ready, 1);
                        if (document.addEventListener) document.addEventListener("DOMContentLoaded", i, !1), window.addEventListener("load", s.ready, !1);
                        else if (document.attachEvent) {
                            document.attachEvent("onreadystatechange", i), window.attachEvent("onload", s.ready);
                            var n = !1;
                            try {
                                n = null == window.frameElement;
                            } catch (n) {}
                            document.documentElement.doScroll && n && e();
                        }
                    }
                },
                _Deferred: function () {
                    var e,
                        t,
                        i,
                        n = [],
                        a = {
                            done: function () {
                                if (!i) {
                                    var t,
                                        o,
                                        r,
                                        l,
                                        c,
                                        d = arguments;
                                    for (e && ((c = e), (e = 0)), t = 0, o = d.length; t < o; t++) (r = d[t]), "array" === (l = s.type(r)) ? a.done.apply(a, r) : "function" === l && n.push(r);
                                    c && a.resolveWith(c[0], c[1]);
                                }
                                return this;
                            },
                            resolveWith: function (s, a) {
                                if (!i && !e && !t) {
                                    (a = a || []), (t = 1);
                                    try {
                                        for (; n[0]; ) n.shift().apply(s, a);
                                    } finally {
                                        (e = [s, a]), (t = 0);
                                    }
                                }
                                return this;
                            },
                            resolve: function () {
                                return a.resolveWith(this, arguments), this;
                            },
                            isResolved: function () {
                                return !(!t && !e);
                            },
                            cancel: function () {
                                return (i = 1), (n = []), this;
                            },
                        };
                    return a;
                },
                type: function (e) {
                    return null == e ? String(e) : n[Object.prototype.toString.call(e)] || "object";
                },
            }),
            document.addEventListener
                ? (i = function () {
                      document.removeEventListener("DOMContentLoaded", i, !1), s.ready();
                  })
                : document.attachEvent &&
                  (i = function () {
                      "complete" === document.readyState && (document.detachEvent("onreadystatechange", i), s.ready());
                  }),
            e
        );
    })()),
    (PreSimpleSwapOnload = window.onload ? window.onload : function () {}),
    (window.onload = function () {
        PreSimpleSwapOnload(), SimpleSwapSetup();
    }),
    (Cockie = {
        generalOptions: { expires: 0, path: "" },
        set: function (e, t, i) {
            var s,
                n,
                a,
                o = Cockie.generalOptions;
            void 0 !== i && o.concat(i),
                (n = s = ""),
                0 != o.expires && ((a = new Date()).setTime(a.getTime() + 864e5 * days), (s = "; expires=" + a.toGMTString())),
                "" != o.path && (n = "; path=" + o.path),
                (document.cookie = e + "=" + escape(t) + s + n);
        },
        get: function (e) {
            var t,
                i = document.cookie,
                s = i.indexOf(" " + e + "=");
            return -1 == s && (s = i.indexOf(e + "=")), -1 == s ? null : ((s = i.indexOf("=", s) + 1), -1 == (t = i.indexOf(";", s)) && (t = i.length), unescape(i.substring(s, t)));
        },
    }),
    (Cockie = {
        generalOptions: { expires: 0, path: "" },
        set: function (e, t, i) {
            var s,
                n,
                a,
                o = Cockie.generalOptions;
            void 0 !== i && o.concat(i),
                (n = s = ""),
                0 != o.expires && ((a = new Date()).setTime(a.getTime() + 864e5 * days), (s = "; expires=" + a.toGMTString())),
                "" != o.path && (n = "; path=" + o.path),
                (document.cookie = e + "=" + encodeURIComponent(t) + s + n);
        },
        get: function (e) {
            for (var t, i = e + "=", s = document.cookie.split(";"), n = 0; n < s.length; n++) if (0 == (t = s[n].trim()).indexOf(i)) return decodeURIComponent(t.substring(i.length, t.length));
            return "";
        },
    }),
    ready(function () {
        TarhPardaz_Js();
    });



function varatyping(place="general",senduser="general"){
    
	new Ajax.Request(url("ajax/chat.typinguser"), {
		onSuccess: function(e) {
        },
        postBody: "action=start&place="+place+"&room=" + $me.room+"&senduser="+senduser
    });
    document.getElementById("message").setAttribute("onkeyup","javascript:;");
    setTimeout(lettyping, 2000);    
}
  function lettyping(){
    $("message").setAttribute("onkeyup","javascript:varatyping();");
    
}



function omomifocus(){
document.getElementById('message').ClassName="focus";
}

var played = false;
function musicrun(e,vara){
 
var audio =document.getElementById("audio"+e);
var playe=document.getElementById("play"+e);
var time_past = document.getElementById("time-past"+e);
var time_left = document.getElementById("time-left"+e);
var fill = document.getElementById("fill"+e);
var fill_btn = document.getElementById("fill-btn"+e);

    if (played){
        audio.pause();
        playe.src = "/theme/images/play icon.png";
        played = false;
    }
    else{
        audio.play();
        playe.src = "/theme/images/pause icon.png";
        played = true;
    }

  function change_format(time){
    var minute = parseInt(time / 60);
    var seconds = parseInt(time - (minute * 60));

    if (seconds > 9) return minute.toString() + ":" + seconds.toString();
    else return minute.toString() + ":0" + seconds.toString();
}
audio.addEventListener("timeupdate", function(){

var fill_btn = document.getElementById("fill-btn"+e);
    fill.style.width = (audio.currentTime * 100 / audio.duration) + "%";
    fill_btn.style.left = (audio.currentTime * 100 / audio.duration) + "%";
    time_past.innerText = change_format(audio.currentTime);
    time_left.innerText = change_format(audio.duration - audio.currentTime);
});
slider("volume", "volume"+e);
slider("time-line", "time-line"+e, function(){audio.pause()}, function(){if (played) audio.play();});
  function slider(action, id, mousedown=function(){}, mouseup=function(){}){

    var parent = document.getElementById(id);
    var fill = parent.children[1];
    var fill_btn = parent.children[2];
    var can_drag = false, value = 0;

    function update(){
        var pos_x = window.event.clientX;
        var left = parent.children[3].getBoundingClientRect().left;
        var right =parent.children[4].getBoundingClientRect().right;
        var width = right - left;

        value = (pos_x - left) / width;

        if (value < 0) value = 0;
        else if (value > 1) value = 1;

        fill.style.width = (value * 100) + "%";
        fill_btn.style.left = (value * 100) + "%";

        if (action == "time-line"){
            audio.currentTime = audio.duration * value;
        }
        else if (action == "volume"){
            audio.volume = value;
        }
    }

    parent.addEventListener("mousedown", function(e){
        if (e.button == 0){
            can_drag = true;
            mousedown();
        }
    });

    document.body.addEventListener("mousemove", function(e){
        if (e.button == 0 && can_drag)
            update();
    });

    document.body.addEventListener("mouseup", function(e){
        if (e.button == 0 && can_drag){
            can_drag = false;
            mouseup();
        }
    });

    parent.addEventListener("click", function(e){
        if (e.button == 0){
            update();
        }
    });
  }
}
var tt=0;

function reactmsg(i,t){

if(i!==0 && t>=1 && t<11){
	new Ajax.Request(url("ajax/chat.reactmsg"), {
		onSuccess: function(e) {
              var resjson=e.responseText;
          var tx="msgnum_";
          var hh=document.getElementById(i);
         if(hh.hasClassName("showreact")){hh.removeClassName("showreact");}
        },
        postBody: "action=react&idmsg="+i+"&treact=" +t+"&react=ok"
    });
    
}  
}
function reactshow(i){
  if($setting.pluginreaction  && $me.reactmsg){
  if(i!==0){
var hh=document.getElementById(i);

    hh.toggleClassName("showreact");


  }}
}
function reacthide(i){
  
var hh=document.getElementById(i);
  hh.style.display='none !important';
  
}
var tekrar=0;
function tablighvideo(typevid,filevid,urlvid,closevid,numbervid){
  if(tekrar==0){
    
    setTimeout(function(){
  document.getElementById("vidModal").style.display='block';
if(typevid=='upvid'){
  if(closevid=='1'){var trans='<div><a href="'+urlvid+'" target="_blank"><button style="width: 150px;height: 35px;font-size: 15px;" >ورود به سایت مرجع</button> </div>'}else{var trans='';}
document.getElementById("contentvid").innerHTML='<div><video width="100%" height="400" controls><source src="'+filevid+'" type="video/mp4"></video>'+trans+'</div>';
}
      if(typevid=='aparat'){
          if(closevid=='1'){var trans='<div><a href="'+urlvid+'"  target="_blank"><button style="width: 150px;height: 35px;font-size: 15px;">ورود به سایت مرجع</button> </div>'}else{var trans='';}

        let urlaparat = filevid;
const aparatarr = urlaparat.split("https://www.aparat.com/v/");

      document.getElementById("contentvid").innerHTML='<div><iframe style="width: 100%;height: 400px;" src="https://www.aparat.com/video/video/embed/videohash/'+aparatarr [1]+'/vt/frame"  allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>'+trans+'</div>';

      }
    
    }, 10000);
      
      tekrar++;
  }
  
}
function closevid(){
 document.getElementById("contentvid").innerHTML=' ';

document.getElementById('vidModal').style.display='none';
}

function groupchange(){
var datagroup=document.getElementById("groupchange").value;
  
	new Ajax.Request(url("ajax/smile.changegroup"), {
		onSuccess: function(e) {
              var resjson=e.responseText;
         var resjson=JSON.parse(resjson);
          var reskey=Object.keys(resjson);
          var resval=Object.values(resjson);
           var mm=Object.keys(resjson);
          var total='';
          document.getElementsByClassName('newgr')[0].innerHTML='';

          var newgr=document.getElementsByClassName('newgr')[0];
          var len=reskey.length;
   
          for(var i=0;i<len;i++){ 
                  var xn=document.createElement('img');
                         xn.src='/theme/images/smilies/'+resval[i];
                if($setting.sizeofsmile){  xn.style.width='60px';}
                      xn.setAttribute("id",reskey[i]);
                       newgr.appendChild(xn);
          
          
          
         }
        },
        postBody: "idgroup="+datagroup
    });

}


var limit=1;
function moresmile(){
  if($setting.plugingroupsmile==true){
 var group=document.getElementById('groupchange').value;}
  if($setting.plugingroupsmile==false){var group=0;}
  
  	new Ajax.Request(url("ajax/smile.more"), {
		onSuccess: function(e) {
              var resjson=e.responseText;
                        var resjson=e.responseText;
         var resjson=JSON.parse(resjson);
          var reskey=Object.keys(resjson);
          var resval=Object.values(resjson);
           var mm=Object.keys(resjson);
          var total='';
          var newgr=document.getElementsByClassName('newgr')[0];
          var len=reskey.length;
   
          for(var i=0;i<len;i++){ 
                  var xn=document.createElement('img');
                         xn.src='/theme/images/smilies/'+resval[i];
                if($setting.sizeofsmile){  xn.style.width='60px';}
                      xn.setAttribute("id",reskey[i]);
                       newgr.appendChild(xn);
          
          
          
         }
limit++;
        },
        postBody: "groupid="+group+"&limit="+limit
    });

}