(function (a) {
    function oa(r, ea) {
        r = typeof r === "string" ? document.getElementById(r) : r;
        var O = r.cloneNode(false);
        O.innerHTML = ea;
        r.parentNode.replaceChild(O, r);
        return O
    }
    a.arrowchat = function () {
        function r(b, c, d) {
            a("#arrowchat_tooltip").length > 0 ? a("#arrowchat_tooltip .arrowchat_tooltip_content").html(c) : a("body").append('<div id="arrowchat_tooltip"><div class="arrowchat_tooltip_content">' + c + "</div></div>");
            c = a("#" + b).offset();
            b = a("#" + b).width();
            var i = a("#arrowchat_tooltip").width();
            d == 1 ? a("#arrowchat_tooltip").css("bottom", 29).css("left", c.left + b - 16).css("display", "block").addClass("arrowchat_tooltip_left") : a("#arrowchat_tooltip").css("bottom", 29).css("left", c.left + b - i + 18).css("background-position", i - 23 + "px -118px").css("display", "block").removeClass("arrowchat_tooltip_left");
            if (W) {
                a("#arrowchat_tooltip").css("position", "absolute");
                a("#arrowchat_tooltip").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_tooltip").css("bottom")) - parseInt(a("#arrowchat_tooltip").height()) + a(window).scrollTop() + "px")
            }
        }
        function ea(atid) {
            a.post(k + "includes/send_typing.php", {
                userid: q,
                typing: atid,
                untype: 1
            }, function () {});
            fa = -1
        }
        function O(b, c, d) {
            clearTimeout(pa);
            pa = setTimeout(function () {
                ea(d)
            }, 5E3);
            if (fa != d) {
                a.post(k + "includes/send_typing.php", {
                    userid: q,
                    typing: d
                }, function () {});
                fa = d
            }
            if (b.keyCode == 13 && b.shiftKey == 0) {
                var i = a(c).val();
                i = i.replace(/^\s+|\s+$/g, "");
                a(c).val("");
                a(c).css("height", "18px");
                a(c).css("overflow-y", "hidden");
                a(c).focus();
                i != "" && a.post(k + "includes/send_message.php", {
                    userid: q,
                    to: d,
                    message: i
                }, function (e) {
                    if (e) {
                        X(d, i, "1", "1", e, 1, Math.floor((new Date).getTime() / 1E3));
                        a("#arrowchat_user_" + d + "_popup .arrowchat_tabcontenttext").scrollTop(a("#arrowchat_user_" + d + "_popup .arrowchat_tabcontenttext")[0].scrollHeight)
                    }
                    K = 1;
                    if (D > E) {
                        D = E;
                        clearTimeout(Y);
                        Y = setTimeout(function () {
                            H()
                        }, E)
                    }
                });
                return false
            }
        }
        function Ba(b, c) {
            if (b.keyCode == 13 && b.shiftKey == 0) {
                b = a(c).val();
                b != "" && a.post(k + "includes/send_settings.php", {
                    userid: q,
                    statusmessage: b
                }, function () {
                    a(c).blur()
                });
                return false
            }
        }
        function Ca(b, c, d) {
            b = c.clientHeight;
            if (94 > b) {
                b = Math.max(c.scrollHeight, b);
                b = Math.min(94, b);
                if (b > c.clientHeight) {
                    a(c).css("height", b + 4 + "px")
                }
            } else a(c).css("overflow-y", "auto");
            a("#arrowchat_user_" + d + "_popup .arrowchat_tabcontenttext").scrollTop(a("#arrowchat_user_" + d + "_popup .arrowchat_tabcontenttext")[0].scrollHeight)
        }
        function F() {
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2");
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_busy2");
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_invisible2");
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_away2")
        }
        function v(b) {
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2");
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_busy2");
            a("#arrowchat_userstab_icon").removeClass("arrowchat_user_invisible2");
            a.post(k + "includes/send_status.php", {
                userid: q,
                status: b
            }, function () {})
        }
        function ga(b) {
            w = 1;
            F();
            a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
            b != 1 && v("offline");
            a("#arrowchat_userstab_popup").removeClass("arrowchat_tabopen");
            a("#arrowchat_buddy_list_tab").removeClass("arrowchat_userstabclick").removeClass("arrowchat_tabclick");
            a("#arrowchat_optionsbutton_popup").removeClass("arrowchat_tabopen");
            a("#arrowchat_optionsbutton").removeClass("arrowchat_tabclick");
            a("#arrowchat_userstab_text").html(g[7])
        }
        function Da() {
            a("<div/>").attr("id", "arrowchat_hide_bar_button").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html('<?php echo $file_bar_hide_tab; ?>').appendTo(a("#arrowchat_base"));
            a("#arrowchat_hide_bar_button").mouseover(function () {
                r("arrowchat_hide_bar_button", g[14]);
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_hide_bar_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a("#arrowchat_hide_bar_button").click(function () {
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    hide: "1"
                });
                ga();
                a("#arrowchat_applications_button_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_applications_button").removeClass("arrowchat_tabclick");
                if (m != "") {
                    a("#arrowchat_applications_button_" + m + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_applications_button_" + m).removeClass("arrowchat_trayclick");
                    m = ""
                }
                if (j != "") {
                    a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                    a("#arrowchat_user_" + j + " .arrowchat_closebox_bottom").removeClass("arrowchat_closebox_bottom_click");
                    j = ""
                }
                clearTimeout(Z);
                a.idleTimer("destroy");
                cancelJSONP();
                a("#arrowchat_base").hide();
                a("#arrowchat_show_bar_button").show()
            })
        }
        function Ea() {
            a("<div/>").attr("id", "arrowchat_show_bar_button").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html('<?php echo $file_bar_show_tab; ?>').appendTo(a("body"));
            a("#arrowchat_show_bar_button").mouseover(function () {
                r("arrowchat_show_bar_button", g[15]);
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_show_bar_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a("#arrowchat_show_bar_button").click(function () {
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    hide: "-1"
                });
                v("available");
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
                w = 0;
                P();
                H();
                a.idleTimer(60000 * <?php echo $idle_time; ?> );
                a("#arrowchat_show_bar_button").hide();
                a("#arrowchat_base").show()
            })
        }
        function Fa() {
            a("<div/>").attr("id", "arrowchat_chatrooms_button").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html('<div class="arrowchat_inner_button"><div id="arrowchat_chatrooms_icon"></div><div id="arrowchat_chatrooms_text" style="float:left">' + g[19] + "</div></div>").appendTo(a("#arrowchat_base"));
            a("#arrowchat_chatrooms_button").mouseover(function () {
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_chatrooms_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover")
            })
        }
        function Ga() {
            a("<div/>").attr("id", "arrowchat_popoutchatbutton").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html('<div class="arrowchat_inner_button"><i class="arrowchat_icons arrowchat_popin_icon" /></div>').appendTo(a("#arrowchat_base"));
            a("#arrowchat_popoutchatbutton").mouseover(function () {
                r("arrowchat_popoutchatbutton", g[11]);
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_popoutchatbutton").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a("#arrowchat_popoutchatbutton").click(function () {
                a(this).hide();
                a("#arrowchat_buddy_list_tab").show();
                a("#arrowchat_userstab_popup").toggleClass("arrowchat_tabopen");
                a("#arrowchat_chatboxes").show();
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    popoutchat: "99"
                }, function () {});
                P();
                H();
                a.idleTimer(60000 * <?php echo $idle_time; ?> )
            })
        }
        function Ha() {
            for (var b = 0; b < p.length; b++) {
                a("<div/>").attr("id", "arrowchat_applications_button_" + b).addClass("arrowchat_bar_left").addClass("arrowchat_apps_button").html('<?php echo $file_applications_bookmarks_tab; ?>').appendTo(a("#arrowchat_base"));
                p[b][6] == "" && a("<div/>").attr("id", "arrowchat_applications_button_" + b + "_popup").addClass("arrowchat_apppopup").css("display", "none").html('<?php echo $file_applications_bookmarks_window ?>').appendTo(a("body"))
            }
            a(".arrowchat_apps_button").mouseover(function () {
                var c = a(this).attr("id").substr(30);
                r("arrowchat_applications_button_" + c, p[c][1], 1);
                a(this).addClass("arrowchat_tabmouseover")
            });
            a(".arrowchat_apps_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a(".arrowchat_traytitle").click(function () {
                var e = a(this).parent().attr("id");
                e = e.substring(30, e.length - 6);
                a("#arrowchat_applications_button_" + e).click()
            });
            a(".arrowchat_apps_button").click(function () {
                var c = a(this).attr("id").substr(30);
                a("#arrowchat_applications_button_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_applications_button").removeClass("arrowchat_tabclick");
                if (p[c][6] == "") {
                    if (m != c) {
                        a("#arrowchat_applications_button_" + m + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_applications_button_" + m).removeClass("arrowchat_trayclick");
                        m = ""
                    }
                    if (m == "") {
                        a("#arrowchat_applications_button_" + c + "_popup").css("left", a("#arrowchat_applications_button_" + c).offset().left).css("bottom", "25px").css("width", p[c][4]);
                        a("#arrowchat_applications_button_" + c + "_popup").addClass("arrowchat_tabopen");
                        a("#arrowchat_applications_button_" + c).addClass("arrowchat_trayclick");
                        a.get(k + "applications/" + p[c][2] + "/index.php", function (d) {
                            a("#arrowchat_applications_button_" + c + "_content").html(d)
                        });
                        m = c
                    } else {
                        a("#arrowchat_applications_button_" + m + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_applications_button_" + m).removeClass("arrowchat_trayclick");
                        m = ""
                    }
                } else window.open(p[c][6], "self")
            })
        }
        function Ia() {
            a("<div/>").attr("id", "arrowchat_applications_button").addClass("arrowchat_bar_left").addClass("arrowchat_bar_button").html('<?php echo $file_applications_tab ?>').appendTo(a("#arrowchat_base"));
            a("<div/>").attr("id", "arrowchat_applications_button_popup").addClass("arrowchat_tabpopup").css("display", "none").html('<?php echo $file_applications_window ?>').appendTo(a("body"));
            _appslist = '<div style="border-bottom: 1px solid #e9e9e9; color: #808080; margin: 3px 2px 4px;">' + g[20] + '</div><ul id="arrowchat_applications" style="list-style-type: none; margin: 0px; padding: 0px;">';
            for (var b = 0; b < p.length; b++) _appslist += '<?php echo $file_applications_bookmarks_list ?>';
            _appslist += "</ul>";
            a("#arrowchat_bookmarks").append("<div>" + _appslist + "</div>");
            a("#arrowchat_applications").sortable({
                scroll: false,
                start: function () {
                    a(".arrowchat_app_link").unbind("click")
                },
                stop: function () {
                    a(".arrowchat_app_link").click()
                }
            });
            a(".arrowchat_app_link").click(function () {
                var c = a(this).attr("id").substr(19);
                a("#arrowchat_applications_button_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_applications_button").removeClass("arrowchat_tabclick");
                a("#arrowchat_applications_button_" + c).click()
            });
            a("#arrowchat_applications_button").mouseover(function () {
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_applications_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_applications_button_popup .arrowchat_traytitle").click(function () {
                a("#arrowchat_applications_button").click()
            });
            a("#arrowchat_applications_button").click(function () {
                if (m != "") {
                    a("#arrowchat_applications_button_" + m + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_applications_button_" + m).removeClass("arrowchat_trayclick");
                    m = ""
                }
                a("#arrowchat_applications_button_popup").css("left", a("#arrowchat_applications_button").position().left + 16).css("bottom", "25px");
                a(this).toggleClass("arrowchat_tabclick");
                a("#arrowchat_applications_button_popup").toggleClass("arrowchat_tabopen")
            })
        }
        function Ja() {
            a("<div/>").attr("id", "arrowchat_optionsbutton").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html('<?php echo $file_notifications_tab ?>').appendTo(a("#arrowchat_base"));
            a("<div/>").attr("id", "arrowchat_optionsbutton_popup").addClass("arrowchat_tabpopup").css("display", "none").html('<?php echo $file_notifications_window ?>').appendTo(a("body"));
            a("#arrowchat_optionsbutton_popup .available").click(function () {
                F();
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
                a(this).css("text-decoration", "underline");
                v("available")
            });
            a("#arrowchat_optionsbutton_popup .busy").click(function () {
                F();
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_busy2");
                a(this).css("text-decoration", "underline");
                v("busy")
            });
            a("#arrowchat_optionsbutton_popup .invisible").click(function () {
                F();
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
                a(this).css("text-decoration", "underline");
                v("invisible")
            });
            a("#arrowchat_optionsbutton_popup .arrowchat_statustextarea").keydown(function (b) {
                return Ba(b, this)
            });
            a("#arrowchat_optionsbutton").mouseover(function () {
                a("#arrowchat_optionsbutton_popup").hasClass("arrowchat_tabopen") || ($ == 0 ? r("arrowchat_optionsbutton", g[0]) : r("arrowchat_optionsbutton", g[0]));
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_optionsbutton").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a("#arrowchat_optionsbutton").click(function () {
                if (Q > 0) {
                    a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
                    a.post(k + "includes/send_notifications.php", {
                        userid: q
                    }, function () {});
                    Q = 0
                }
                if (m != "") {
                    a("#arrowchat_trayicon_" + m + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_trayicon_" + m).removeClass("arrowchat_trayclick");
                    m = ""
                }
                if ($ == 0) {
                    if (w == 1) {
                        w = 0;
                        a("#arrowchat_userstab_text").html(g[4] + " (<b>" + R + "</b>)");
                        H();
                        a("#arrowchat_optionsbutton_popup .available").click()
                    }
                    a("#arrowchat_tooltip").css("display", "none");
                    a("#arrowchat_optionsbutton_popup").css("left", a("#arrowchat_optionsbutton").position().left - 156).css("bottom", "25px");
                    a(this).toggleClass("arrowchat_tabclick");
                    a("#arrowchat_optionsbutton_popup").toggleClass("arrowchat_tabopen");
                    a("#arrowchat_optionsbutton").toggleClass("arrowchat_optionsimages_click");
                    a("#arrowchat_userstab_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_buddy_list_tab").removeClass("arrowchat_userstabclick").removeClass("arrowchat_tabclick")
                } else if (g[16] != "") location.href = g[16]
            });
            a("#arrowchat_optionsbutton_popup .arrowchat_userstabtitle").click(function () {
                a("#arrowchat_optionsbutton").click()
            });
            a("#arrowchat_optionsbutton_popup .arrowchat_userstabtitle").mouseenter(function () {
                a(this).addClass("arrowchat_chatboxtabtitlemouseover2")
            });
            a("#arrowchat_optionsbutton_popup .arrowchat_userstabtitle").mouseleave(function () {
                a(this).removeClass("arrowchat_chatboxtabtitlemouseover2")
            })
        }
        function S() {
            var b = "",
                c = 0;
            for (chatbox in y) if (y.hasOwnProperty(chatbox)) if (y[chatbox] != null) {
                b += chatbox + "|" + y[chatbox] + ",";
                if (y[chatbox] > 0) c = 1
            }
            Ka = c;
            b.slice(0, -1)
        }
        function I(b, c, d, i, e, l, f, h) {
            if (!(b == null || b == "")) if (n[b] == null || n[b] == "") if (aa[b] != 1) {
                aa[b] = 1;
                a.ajax({
                    url: k + "includes/receive_user.php",
                    data: {
                        userid: b
                    },
                    type: "post",
                    cache: false,
                    dataFilter: function (o) {
                        return typeof JSON !== "undefined" && typeof JSON.parse === "function" ? JSON.parse(o) : eval("(" + o + ")")
                    },
                    success: function (o) {
                        if (o) {
                            c = n[b] = o.n;
                            d = u[b] = o.s;
                            i = z[b] = o.m;
                            e = A[b] = o.a;
                            l = s[b] = o.l;
                            if (G[b] != null) {
                                a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom_status").removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").addClass("arrowchat_" + d);
                                a("#arrowchat_user_" + b).removeClass("arrowchat_tab_offline").addClass("arrowchat_tab_" + c);
                                a("#arrowchat_user_" + b + "_popup").length > 0 && a("#arrowchat_user_" + b + "_popup .arrowchat_tabsubtitle .arrowchat_message").html(i)
                            }
                            aa[b] = 0;
                            if (c != null) {
                                qa(b, c, d, i, e, l, f, h)
                            } else {
                                a.post(k + "includes/send_settings.php", {
                                    userid: q,
                                    unfocus_chat: b
                                }, function () {})
                            }
                        }
                    }
                })
            } else setTimeout(function () {
                I(b, n[b], u[b], z[b], A[b], s[b], f, h)
            }, 500);
            else qa(b, n[b], u[b], z[b], A[b], s[b], f, h)
        }
        function qa(b, c, d, i, e, l, f) {
            if (G[b] != null) {
                if (!a("#arrowchat_user_" + b).hasClass("arrowchat_tabclick") && f != 1) {
                    if (j != "") {
                        a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                        j = ""
                    }
                    if (a("#arrowchat_user_" + b).offset().left < a("#arrowchat_chatboxes").offset().left + a("#arrowchat_chatboxes").width() && a("#arrowchat_user_" + b).offset().left - a("#arrowchat_chatboxes").offset().left >= 0) a("#arrowchat_user_" + b).click();
                    else {
                        a(".arrowchat_tabalert").css("display", "none");
                        e = 800;
                        if (ra("initialize") == 1) e = 0;
                        a("#arrowchat_chatboxes").scrollTo("#arrowchat_user_" + b, e, function () {
                            a("#arrowchat_user_" + b).click();
                            L();
                            ba()
                        })
                    }
                }
                L()
            } else {
                a("#arrowchat_chatboxes_wide").width(a("#arrowchat_chatboxes_wide").width() + 148);
                M();
                shortname = c.length > 12 ? c.substr(0, 12) + "..." : c;
                longname = c.length > 24 ? c.substr(0, 24) + "..." : c;
                a("<div/>").attr("id", "arrowchat_user_" + b).addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").addClass("arrowchat_user_tab").html('<?php echo $file_chat_tab ?>').appendTo(a("#arrowchat_chatboxes_wide"));
                a("#arrowchat_user_" + b).append('<div class="arrowchat_closebox_bottom_status arrowchat_' + d + '"></div>');
                a("#arrowchat_user_" + b).addClass("arrowchat_tab_" + d);
                a("#arrowchat_user_" + b).append('<div class="arrowchat_closebox_bottom"></div>');
                a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom").mouseenter(function () {
                    a(this).addClass("arrowchat_closebox_bottomhover")
                });
                a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom").mouseleave(function () {
                    a(this).removeClass("arrowchat_closebox_bottomhover")
                });
                a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom").click(function () {
                    a.post(k + "includes/send_settings.php", {
                        userid: q,
                        close_chat: b,
                        tab_alert: 1
                    }, function () {});
                    a("#arrowchat_user_" + b + "_popup").remove();
                    a("#arrowchat_user_" + b).remove();
                    if (j == b) j = "";
                    a("#arrowchat_chatboxes_wide").width(a("#arrowchat_chatboxes_wide").width() - 148);
                    a("#arrowchat_chatboxes").scrollTo("-=148px");
                    M();
                    y[b] = null;
                    G[b] = null;
                    ca[b] = 0;
                    S()
                });
                d = "";
                if (T.length > 0) {
                    d += '<div class="arrowchat_plugins">';
                    for (i = 0; i < T.length; i++) if (T[i] == "divider") d += '<img src="' + k + "themes/" + x + '/images/divider.png" class="arrowchat_pluginsicon_divider">';
                    else {
                        c = "cc" + T[i];
                        d += '<img src="' + k + "plugins/" + T[i] + '/icon.png" class="arrowchat_pluginsicon" title="' + a[c].getTitle() + '" onclick="javascript:jqac.' + c + ".init(" + b + ');">'
                    }
                    d += "</div>"
                }
                i = c = "";
                if (l != "") {
                    c = '<a href="' + l + '">';
                    i = "</a>"
                }
                l = "";
                if (e != "") l = '<div class="arrowchat_avatarbox">' + c + '<img src="' + e + '" class="arrowchat_avatar" />' + i + "</div>";
                a("<div/>").attr("id", "arrowchat_user_" + b + "_popup").addClass("arrowchat_tabpopup").css("display", "none").html('<?php echo $file_chat_window ?>').appendTo(a("body"));
                a("#arrowchat_clear_" + b).click(function () {
                    a("#arrowchat_tabcontenttext_" + b).html("");
                    a.post(k + "includes/send_settings.php", {
                        userid: q,
                        clear_chat: b
                    }, function () {})
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_textarea").keydown(function (h) {
                    return O(h, this, b)
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_textarea").keyup(function (h) {
                    return Ca(h, this, b)
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").append('<div class="arrowchat_closebox"></div><br clear="all"/>');
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle .arrowchat_closebox").mouseenter(function () {
                    a(this).addClass("arrowchat_chatboxmouseoverclose");
                    a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").removeClass("arrowchat_chatboxtabtitlemouseover")
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle .arrowchat_closebox").mouseleave(function () {
                    a(this).removeClass("arrowchat_chatboxmouseoverclose");
                    a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").addClass("arrowchat_chatboxtabtitlemouseover")
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle .arrowchat_closebox").click(function () {
                    a.post(k + "includes/send_settings.php", {
                        userid: q,
                        close_chat: b,
                        tab_alert: 1
                    }, function () {});
                    a("#arrowchat_user_" + b + "_popup").remove();
                    a("#arrowchat_user_" + b).remove();
                    if (j == b) j = "";
                    a("#arrowchat_chatboxes_wide").width(a("#arrowchat_chatboxes_wide").width() - 148);
                    a("#arrowchat_chatboxes").scrollTo("-=148px");
                    M();
                    G[b] = null;
                    y[b] = null;
                    ca[b] = 0;
                    S()
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").click(function () {
                    a("#arrowchat_user_" + b).click()
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").mouseenter(function () {
                    a(this).addClass("arrowchat_chatboxtabtitlemouseover")
                });
                a("#arrowchat_user_" + b + "_popup .arrowchat_tabtitle").mouseleave(function () {
                    a(this).removeClass("arrowchat_chatboxtabtitlemouseover")
                });
                a("#arrowchat_user_" + b).mouseenter(function () {
                    a(this).addClass("arrowchat_tabmouseover");
                    a("#arrowchat_user_" + b + " div").addClass("arrowchat_tabmouseovertext")
                });
                a("#arrowchat_user_" + b).mouseleave(function () {
                    a(this).removeClass("arrowchat_tabmouseover");
                    a("#arrowchat_user_" + b + " div").removeClass("arrowchat_tabmouseovertext")
                });
                a("#arrowchat_user_" + b).click(function () {
                    var tba = 0;
                    if (m != "") {
                        a("#arrowchat_trayicon_" + m + "_popup .arrowchat_tabopen").removeClass("arrowchat_tabopen");
                        a("#arrowchat_trayicon_" + m).removeClass("arrowchat_trayclick");
                        m = ""
                    }
                    if (a("#arrowchat_user_" + b + " .arrowchat_tabalert").length > 0) {
                        tba = 1;
                        a("#arrowchat_user_" + b + " .arrowchat_tabalert").remove();
                        a("#arrowchat_user_" + b).removeClass("arrowchat_tab_new_message");
                        G[b] = 0;
                        y[b] = 0;
                        S()
                    }
                    if (a(this).hasClass("arrowchat_tabclick")) {
                        a(this).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                        a("#arrowchat_user_" + b + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom").removeClass("arrowchat_closebox_bottom_click");
                        j = "";
                        a.post(k + "includes/send_settings.php", {
                            userid: q,
                            unfocus_chat: b,
                            tab_alert: 1
                        }, function () {})
                    } else {
                        if (j != "") {
                            a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                            a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                            a("#arrowchat_user_" + j + " .arrowchat_closebox_bottom").removeClass("arrowchat_closebox_bottom_click");
                            j = ""
                        }
                        if (!(a("#arrowchat_user_" + b).offset().left < a("#arrowchat_chatboxes").offset().left + a("#arrowchat_chatboxes").width() && a("#arrowchat_user_" + b).offset().left - a("#arrowchat_chatboxes").offset().left >= 0)) {
                            a("#arrowchat_chatboxes").scrollTo("#arrowchat_user_" + b);
                            L()
                        }
                        a.post(k + "includes/send_settings.php", {
                            userid: q,
                            focus_chat: b,
                            tab_alert: tba
                        }, function () {});
                        a("#arrowchat_user_" + b + "_popup").css("left", a("#arrowchat_user_" + b).position().left - 66).css("bottom", "24px");
                        a(this).addClass("arrowchat_tabclick").addClass("arrowchat_usertabclick");
                        a("#arrowchat_user_" + b + "_popup").addClass("arrowchat_tabopen");
                        a("#arrowchat_user_" + b + " .arrowchat_closebox_bottom").addClass("arrowchat_closebox_bottom_click");
                        j = b;
                        if (ca[b] != 1) {
                            La(b);
                            ca[b] = 1
                        }
                        if (W) {
                            a("#arrowchat_user_" + j + "_popup").css("position", "absolute");
                            a("#arrowchat_user_" + j + "_popup").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_user_" + j + "_popup").css("bottom")) - parseInt(a("#arrowchat_user_" + j + "_popup").height()) + a(window).scrollTop() + "px")
                        }
                    }
                    a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").scrollTop(a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext")[0].scrollHeight);
                    Ma("updatingsession") != 1 && a("#arrowchat_user_" + b + "_popup .arrowchat_textarea").focus()
                });
                f != 1 && a("#arrowchat_user_" + b).click();
                y[b] = 0;
                G[b] = 0;
                S()
            }
        }
        function ha(b) {
            var c = "am",
                d = b.getHours(),
                i = b.getMinutes(),
                e = b.getDate();
            b = b.getMonth();
            if (d > 11) c = "pm";
            if (d > 12) d -= 12;
            if (d == 0) d = 12;
            if (d < 10) d = d;
            if (i < 10) i = "0" + i;
            var l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                f = "th";
            if (e == 1 || e == 21 || e == 31) f = "st";
            else if (e == 2 || e == 22) f = "nd";
            else if (e == 3 || e == 23) f = "rd";
            return e != Na ? '<span class="arrowchat_ts">' + d + ":" + i + c + " " + e + f + " " + l[b] + "</span>" : '<span class="arrowchat_ts">' + d + ":" + i + c + "</span>"
        }
        function La(b) {
            a.ajax({
                cache: false,
                url: k + "includes/receive_history.php",
                data: {
                    chatbox: b
                },
                type: "post",
                dataFilter: function (c) {
                    return typeof JSON !== "undefined" && typeof JSON.parse === "function" ? JSON.parse(c) : eval("(" + c + ")")
                },
                success: function (c) {
                    if (c) {
                        a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").html("");
                        B = null;
                        var d = "",
                            i = n[b];
                        a.each(c, function (e, l) {
                            e == "messages" && a.each(l, function (f, h) {
                                f = "";
                                if (h.self == 1) {
                                    fromname = ia;
                                    f = " arrowchat_self";
                                    _aa5 =
                                    _aa4 = ""
                                } else {
                                    fromname = i;
                                    _aa4 = '<a href="' + s[b] + '">';
                                    _aa5 = "</a>"
                                }
                                var o = new Date(h.sent * 1E3);
                                if (fromname.indexOf(" ") != -1) fromname = fromname.slice(0, fromname.indexOf(" "));
                                if (h.sent - B > 60 || B == null || N != fromname) {
                                    d += '<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + h.id + '"><div class="arrowchat_chatboxmessagefrom' + f + '"><div style="float:right;">' + ha(o) + "</div><strong>" + _aa4 + fromname + _aa5 + '</strong><br /></div><div class="arrowchat_chatboxmessagecontent' + f + '">' + h.message + "</div></div>";
                                    B = h.sent;
                                    N = fromname
                                } else d += '<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + h.id + '"><div class="arrowchat_chatboxmessagecontent' + f + '">' + h.message + "</div></div>"
                            })
                        });
                        if (a("arrowchat_tabcontenttext_" + b).length > 0) oa("arrowchat_tabcontenttext_" + b, "<div>" + d + "</div>" + document.getElementById("arrowchat_tabcontenttext_" + b).innerHTML);
                        else document.getElementById("arrowchat_tabcontenttext_" + b).innerHTML = "<div>" + d + "</div>";
                        a("#arrowchat_tabcontenttext_" + b).scrollTop(5E4)
                    }
                }
            })
        }
        function sa(b, c, d) {
            if (n[b] == null || n[b] == "") setTimeout(function () {
                sa(b, c, d)
            }, 500);
            else {
                Oa(b);
                if (d == 1) if (a("#arrowchat_user_" + b + " .arrowchat_tabalert").length > 0) c = parseInt(a("#arrowchat_user_" + b + " .arrowchat_tabalert").html()) + parseInt(c);
                if (c == 0) {
                    a("#arrowchat_user_" + b).removeClass("arrowchat_tab_new_message");
                    a("#arrowchat_user_" + b + " .arrowchat_tabalert").remove()
                } else {
                    if (a("#arrowchat_user_" + b + " .arrowchat_tabalert").length > 0) {
                        a("#arrowchat_user_" + b + " .arrowchat_tabalert").html(c);
                        if (bounce != 1) {
                            a("#arrowchat_user_" + b + " .arrowchat_tabalert").effect("bounce", {
                                times: 3
                            }, 200)
                        }
                        bounce = 1;
                    } else a("<div/>").css("top", "-7px").css("left", "112px").addClass("arrowchat_tabalert").html(c).appendTo(a("#arrowchat_user_" + b));
                    a("#arrowchat_user_" + b).removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message")
                }
                y[b] = c;
                S();
                ba()
            }
        }
        function ja(b) {
            b == 1 ? a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars") : a(".arrowchat_userlist_avatar").removeClass("arrowchat_hide_avatars")
        }
        function Pa() {
            function b() {
                a("#arrowchat_options_flyout").removeClass("arrowchat_options_flyout_display");
                a(".arrowchat_panel_item").removeClass("arrowchat_panel_flyout_open").removeClass("arrowchat_panel_item_flyout");
                a(".arrowchat_panel_icon").removeClass("arrowchat_panel_flyout_icon")
            }
            function c() {
                a("#arrowchat_status_flyout").removeClass("arrowchat_status_flyout_display");
                a(".arrowchat_panel_item2").removeClass("arrowchat_panel_flyout_open2").removeClass("arrowchat_panel_item_flyout2");
                a(".arrowchat_panel_icon2").removeClass("arrowchat_panel_flyout_icon2")
            }
            var d = "";
            if (Qa == 1) d = '<a id="arrowchat_popoutchat_link" href="' + k + 'popout/popout.php"><div id="arrowchat_popoutchat" class="arrowchat_options_padding"><div class="arrowchat_optionsdot arrowchat_popout_icon"></div><span class="arrowchat_flyout_span">' + g[10] + "</span></div></a>";
            a("<div/>").attr("id", "arrowchat_buddy_list_tab").addClass("arrowchat_bar_button").addClass("arrowchat_bar_right").html('<?php echo $file_buddylist_tab ?>').appendTo(a("#arrowchat_base"));
            a("<div/>").attr("id", "arrowchat_userstab_popup").addClass("arrowchat_tabpopup").css("display", "none").html('<?php echo $file_buddylist_window ?>').appendTo(a("body"));
            a(".arrowchat_search_friends_text").placeholder();
            da == 1 ? a("#arrowchat_setting_sound").attr("checked", true) : a("#arrowchat_setting_sound").attr("checked", false);
            ta == 1 ? a("#arrowchat_setting_window_open").attr("checked", true) : a("#arrowchat_setting_window_open").attr("checked", false);
            if (Ra == 1) {
                ja(1);
                a("#arrowchat_setting_names_only").attr("checked", true)
            } else a("#arrowchat_setting_names_only").attr("checked", false);
            a(".arrowchat_search_friends_text").keyup(function () {
                a(".arrowchat_search_not_found").remove();
                var i = 1,
                    e = true,
                    l = "",
                    f = a(this).val();
                if (f == "") {
                    a(".arrowchat_userlist").each(function () {
                        l =
                        a(this).attr("id").substr(19);
                        a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
                        a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight()
                    });
                    e = false
                } else a(".arrowchat_userlist").each(function () {
                    l = a(this).attr("id").substr(19);
                    if (a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").length > 0) {
                        a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
                        i == 1 && a("#arrowchat_userlist_" + l).addClass("arrowchat_userlist_hover2");
                        a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight();
                        a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").highlight(f);
                        e = false;
                        i++
                    } else a("#arrowchat_userlist_" + l).hide()
                });
                e && a("<div/>").attr("class", "arrowchat_search_not_found arrowchat_nofriends").html(g[26]).prependTo("#arrowchat_userscontent")
            });
            a(document).bind("idle.idleTimer", function () {
                if (w != 1) {
                    F();
                    a("#arrowchat_userstab_icon").addClass("arrowchat_user_away2");
                    v("away")
                }
            });
            a(document).bind("active.idleTimer", function () {
                if (w != 1) {
                    F();
                    a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
                    v("available")
                }
            });
            a.idleTimer(60000 * <?php echo $idle_time; ?> );
            a("#arrowchat_setting_sound").click(function () {
                a("#arrowchat_sound_box .arrowchat_hide_loading").hide();
                a("#arrowchat_sound_box .arrowchat_show_loading").show();
                if (document.getElementById("arrowchat_setting_sound").checked) da = _soundcheck = 1;
                else {
                    _soundcheck = -1;
                    da = 0
                }
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    sound: _soundcheck
                }, function () {
                    a("#arrowchat_sound_box .arrowchat_hide_loading").show();
                    a("#arrowchat_sound_box .arrowchat_show_loading").hide()
                })
            });
            a("#arrowchat_setting_window_open").click(function () {
                a("#arrowchat_window_box .arrowchat_hide_loading").hide();
                a("#arrowchat_window_box .arrowchat_show_loading").show();
                _windowcheck = document.getElementById("arrowchat_setting_window_open").checked ? 1 : -1;
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    window: _windowcheck
                }, function () {
                    a("#arrowchat_window_box .arrowchat_hide_loading").show();
                    a("#arrowchat_window_box .arrowchat_show_loading").hide()
                })
            });
            a("#arrowchat_setting_names_only").click(function () {
                a("#arrowchat_name_box .arrowchat_hide_loading").hide();
                a("#arrowchat_name_box .arrowchat_show_loading").show();
                if (document.getElementById("arrowchat_setting_names_only").checked) {
                    ja(1);
                    _namecheck = 1
                } else {
                    ja(0);
                    _namecheck = -1
                }
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    name: _namecheck
                }, function () {
                    a("#arrowchat_name_box .arrowchat_hide_loading").show();
                    a("#arrowchat_name_box .arrowchat_show_loading").hide()
                })
            });
            a("#arrowchat_popoutchat_link").popupWindow({
                height: 650,
                width: 900,
                top: 25,
                left: 25
            });
            a("#arrowchat_popoutchat").click(function () {
                cancelJSONP();
                a.idleTimer("destroy");
                clearTimeout(Z);
                a("#arrowchat_buddy_list_tab").hide();
                a("#arrowchat_userstab_popup").toggleClass("arrowchat_tabopen");
                a("#arrowchat_popoutchatbutton").show();
                a("#arrowchat_chatboxes").hide();
                a.post(k + "includes/send_settings.php", {
                    userid: q,
                    popoutchat: "1"
                }, function () {})
            });
            a("#wrapper").click(function () {
                b();
                c()
            });
            a("#arrowchat_goavailable").click(function () {
                v("available");
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2")
            });
            a("#arrowchat_gobusy").click(function () {
                v("busy");
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_busy2")
            });
            a("#arrowchat_goinvisible").click(function () {
                v("invisible");
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2")
            });
            a("#arrowchat_panel_options").mouseover(function () {
                a(this).addClass("arrowchat_panel_hover")
            });
            a("#arrowchat_panel_options").mouseout(function () {
                a(this).removeClass("arrowchat_panel_hover")
            });
            a("#arrowchat_panel_status").mouseover(function () {
                a(this).addClass("arrowchat_panel_hover")
            });
            a("#arrowchat_panel_status").mouseout(function () {
                a(this).removeClass("arrowchat_panel_hover")
            });
            a(".arrowchat_panel_item").click(function () {
                if (a("#arrowchat_status_flyout").hasClass("arrowchat_status_flyout_display")) {} else {
                    a(".arrowchat_userstabtitle").toggleClass("arrowchat_userstabtitle_button_click");
                }
                c();
                a("#arrowchat_userscontent").height() < 150 ? a("#arrowchat_options_flyout").addClass("flyout_reversed") : a("#arrowchat_options_flyout").removeClass("flyout_reversed");
                a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
                a(this).toggleClass("arrowchat_panel_flyout_open");
                a(".arrowchat_panel_item").toggleClass("arrowchat_panel_item_flyout");
                a(".arrowchat_panel_icon").toggleClass("arrowchat_panel_flyout_icon")
            });
            a(".arrowchat_panel_item2").click(function () {
                if (a("#arrowchat_options_flyout").hasClass("arrowchat_options_flyout_display")) {} else {
                    a(".arrowchat_userstabtitle").toggleClass("arrowchat_userstabtitle_button_click");
                }
                b();
                a("#arrowchat_userscontent").height() < 100 ? a("#arrowchat_status_flyout").addClass("flyout_reversed") : a("#arrowchat_status_flyout").removeClass("flyout_reversed");
                a("#arrowchat_status_flyout").toggleClass("arrowchat_status_flyout_display");
                a(this).toggleClass("arrowchat_panel_flyout_open2");
                a(".arrowchat_panel_item2").toggleClass("arrowchat_panel_item_flyout2");
                a(".arrowchat_panel_icon2").toggleClass("arrowchat_panel_flyout_icon2")
            });
            a(".arrowchat_options_padding").mouseover(function () {
                a(this).addClass("arrowchat_options_padding_hover")
            });
            a(".arrowchat_options_padding").mouseout(function () {
                a(this).removeClass("arrowchat_options_padding_hover")
            });
            a("#arrowchat_gooffline").click(function () {
                a(".arrowchat_userstabtitle").toggleClass("arrowchat_userstabtitle_button_click");
                b();
                cancelJSONP();
                a.idleTimer("destroy");
                clearTimeout(Z);
                if (j != "") {
                    a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                    a("#arrowchat_user_" + j + " .arrowchat_closebox_bottom").removeClass("arrowchat_closebox_bottom_click");
                    j = ""
                }
                a("#arrowchat_panel_options").removeClass("arrowchat_panel_hover");
                ga();
                a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
                a("#arrowchat_chatboxes").hide()
            });
            a("#arrowchat_userstab_popup .arrowchat_userstabtitle").click(function () {
                a("#arrowchat_buddy_list_tab").click()
            });
            a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseenter(function () {
                a(this).addClass("arrowchat_chatboxtabtitlemouseover2")
            });
            a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseleave(function () {
                a(this).removeClass("arrowchat_chatboxtabtitlemouseover2")
            });
            a("#arrowchat_buddy_list_tab").mouseover(function () {
                a(this).addClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_buddy_list_tab").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover")
            });
            a("#arrowchat_buddy_list_tab").click(function () {
                if (m != "") {
                    a("#arrowchat_trayicon_" + m + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_trayicon_" + m).removeClass("arrowchat_trayclick");
                    m = ""
                }
                if (w == 1 || bli == 1) {
                    clearTimeout(Z);
                    P();
                    bli = 0;
                }
                if (w == 1) {
                    w = 0;
                    a("#arrowchat_userstab_text").html("<b>" + g[4] + "</b> (<b>" + R + "</b>)");
                    H();
                    clearTimeout(Z);
                    P();
                    a.idleTimer(60000 * <?php echo $idle_time; ?> );
                    a("#arrowchat_goavailable").click();
                    a("#arrowchat_chatboxes").show()
                }
                a("#arrowchat_optionsbutton_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_optionsbutton").removeClass("arrowchat_tabclick");
                a("#arrowchat_userstab_popup").css("left", a("#arrowchat_buddy_list_tab").position().left + 16).css("bottom", "25px");
                a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
                a("#arrowchat_userstab_popup").toggleClass("arrowchat_tabopen");
                if ((a(window).height() - a("#arrowchat_userstab_popup").height()) < 80) {
                    a("#arrowchat_userscontent").css("height", a(window).height() - 135);
                } else {
                    a("#arrowchat_userscontent").css("height", "auto");
                }
            })
        }
        function M() {
            if ((a(window).height() - a("#arrowchat_userstab_popup").height()) < 80) {
                a("#arrowchat_userscontent").css("height", a(window).height() - 135);
            } else {
                a("#arrowchat_userscontent").css("height", "auto");
            }
            var b = a(window).width(),
                c = 0;
            a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_lr") || (c = 19);
            for (d = 0; d < t.length; d++) {
                c += a("#arrowchat_trayicon_" + d).width() + 10
            }
            if (a("#arrowchat_applications_button").width() != null) c += ((p.length - 1) * 30) + a("#arrowchat_applications_button").width() + 15;
            if (t.length > 0 && p.length > 0) c += 30;
            if (b < 520 + c) b = 520 + c;
            a("#arrowchat_base").css("width", b - 31);
            if (a("#arrowchat_chatboxes_wide").width() <= a("#arrowchat_base").width() - 250 - c - 75) {
                a("#arrowchat_chatboxes").css("width", a("#arrowchat_chatboxes_wide").width());
                a("#arrowchat_chatboxes").scrollTo("0px", 0)
            } else {
                b = a("#arrowchat_chatboxes").width();
                a("#arrowchat_chatboxes").css("width", Math.floor((a("#arrowchat_base").width() - 250 - c - 75) / 148) * 148);
                c = a("#arrowchat_chatboxes").width();
                b != c && a("#arrowchat_chatboxes").scrollTo("-=148px", 0)
            }
            ua != 0 && a("#arrowchat_optionsbutton_popup").css("left", a("#arrowchat_optionsbutton").position().left - 156).css("bottom", "25px");
            a("#arrowchat_userstab_popup").css("left", a("#arrowchat_buddy_list_tab").position().left + 16).css("bottom", "25px");
            if (j != "") if (a("#arrowchat_user_" + j).offset().left < a("#arrowchat_chatboxes").offset().left + a("#arrowchat_chatboxes").width() && a("#arrowchat_user_" + j).offset().left - a("#arrowchat_chatboxes").offset().left >= 0) a("#arrowchat_user_" + j + "_popup").css("left", a("#arrowchat_user_" + j).position().left - 66).css("bottom", "24px");
            else {
                a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                c = a("#arrowchat_user_" + j).offset().left - a("#arrowchat_chatboxes_wide").offset().left - (Math.floor(a("#arrowchat_chatboxes").width() / 148) - 1) * 148;
                a("#arrowchat_chatboxes").scrollTo(c, 0, function () {
                    a("#arrowchat_user_" + j).click()
                })
            }
            ba();
            L();
            W && va()
        }
        function ba() {
            a("#arrowchat_chatbox_left .arrowchat_tabalertlr").html("0");
            a("#arrowchat_chatbox_right .arrowchat_tabalertlr").html("0");
            a("#arrowchat_chatbox_left .arrowchat_tabalertlr").css("display", "none");
            a("#arrowchat_chatbox_right .arrowchat_tabalertlr").css("display", "none");
            a(".arrowchat_tabalert").each(function () {
                if (a(this).parent().offset().left < a("#arrowchat_chatboxes").offset().left + a("#arrowchat_chatboxes").width() && a(this).parent().offset().left - a("#arrowchat_chatboxes").offset().left >= 0) a(this).css("display", "block");
                else {
                    a(this).css("display", "none");
                    if (a(this).parent().offset().left - a("#arrowchat_chatboxes").offset().left >= 0) {
                        var b = a("#arrowchat_chatbox_right").offset().left + a("#arrowchat_chatbox_right").width() - 30;
                        a("#arrowchat_chatbox_right .arrowchat_tabalertlr").css("left", b);
                        a("#arrowchat_chatbox_right .arrowchat_tabalertlr").html(parseInt(a("#arrowchat_chatbox_right .arrowchat_tabalertlr").html()) + parseInt(a(this).html()));
                        a("#arrowchat_chatbox_right .arrowchat_tabalertlr").css("display", "block")
                    } else {
                        b = a("#arrowchat_chatbox_left").offset().left + a("#arrowchat_chatbox_left").width() - 22;
                        a("#arrowchat_chatbox_left .arrowchat_tabalertlr").css("left", b);
                        a("#arrowchat_chatbox_left .arrowchat_tabalertlr").html(parseInt(a("#arrowchat_chatbox_left .arrowchat_tabalertlr").html()) + parseInt(a(this).html()));
                        a("#arrowchat_chatbox_left .arrowchat_tabalertlr").css("display", "block")
                    }
                }
            })
        }
        function L() {
            var b = 0,
                c = 0,
                d = 0;
            if (a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_right_last")) c = 1;
            if (a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_lr")) d = 1;
            if (a("#arrowchat_chatboxes").scrollLeft() == 0) {
                a("#arrowchat_chatbox_left").unbind("click", ka);
                a("#arrowchat_chatbox_left .arrowchat_tabtext").html("0");
                a("#arrowchat_chatbox_left").addClass("arrowchat_chatbox_left_last");
                a(".arrowchat_previous_tab").addClass("arrowchat_previous_tab_last");
                b++
            } else {
                var i = Math.floor(a("#arrowchat_chatboxes").scrollLeft() / 148);
                a("#arrowchat_chatbox_left").bind("click", ka);
                a("#arrowchat_chatbox_left .arrowchat_tabtext").html(i);
                a("#arrowchat_chatbox_left").removeClass("arrowchat_chatbox_left_last");
                a(".arrowchat_previous_tab").removeClass("arrowchat_previous_tab_last")
            }
            if (a("#arrowchat_chatboxes").scrollLeft() + a("#arrowchat_chatboxes").width() == a("#arrowchat_chatboxes_wide").width()) {
                a("#arrowchat_chatbox_right").unbind("click", la);
                a("#arrowchat_chatbox_right .arrowchat_tabtext").html("0");
                a("#arrowchat_chatbox_right").addClass("arrowchat_chatbox_right_last");
                a(".arrowchat_next_tab").addClass("arrowchat_next_tab_last");
                b++
            } else {
                i = Math.floor((a("#arrowchat_chatboxes_wide").width() - (a("#arrowchat_chatboxes").scrollLeft() + a("#arrowchat_chatboxes").width())) / 148);
                a("#arrowchat_chatbox_right").bind("click", la);
                a("#arrowchat_chatbox_right .arrowchat_tabtext").html(i);
                a("#arrowchat_chatbox_right").removeClass("arrowchat_chatbox_right_last");
                a(".arrowchat_next_tab").removeClass("arrowchat_next_tab_last")
            }
            if (b == 2) {
                a("#arrowchat_chatbox_right").addClass("arrowchat_chatbox_lr");
                a("#arrowchat_chatbox_left").addClass("arrowchat_chatbox_lr")
            } else {
                a("#arrowchat_chatbox_right").removeClass("arrowchat_chatbox_lr");
                a("#arrowchat_chatbox_left").removeClass("arrowchat_chatbox_lr")
            }
            if (!a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_right_last") && c == 1 || a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_right_last") && c == 0 || !a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_lr") && d == 1 || a("#arrowchat_chatbox_right").hasClass("arrowchat_chatbox_lr") && d == 0) M()
        }
        function wa(b) {
            if (j != "") {
                a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick")
            }
            a(".arrowchat_tabalert").css("display", "none");
            var c = 200;
            if (ra("initialize") == 1) c = 0;
            a("#arrowchat_chatboxes").scrollTo(b, c, function () {
                if (j != "") if (a("#arrowchat_user_" + j).offset().left < a("#arrowchat_chatboxes").offset().left + a("#arrowchat_chatboxes").width() && a("#arrowchat_user_" + j).offset().left - a("#arrowchat_chatboxes").offset().left >= 0) a("#arrowchat_user_" + j).click();
                else j = "";
                ba();
                L()
            })
        }
        function ka() {
            wa("-=148px")
        }
        function la() {
            wa("+=148px")
        }
        function U(b, c) {
            V[b] = c
        }
        function ra(b) {
            return V[b] ? V[b] : ""
        }
        function Ma(b) {
            return xa[b] ? xa[b] : ""
        }
        function Sa(b) {
            var c = a(b).attr("id").substr(19);
            if (c == "") c = a(b).parent().attr("id").substr(19);
            I(c, n[c], u[c], z[c], A[c], s[c])
        }
        function Oa(b) {
            I(b, n[b], u[b], z[b], A[b], s[b], 1)
        }
        function X(b, c, d, i, e, l, f) {
            aa[b] != 1 && I(b, n[b], u[b], z[b], A[b], s[b], 1, 1);
            if (n[b] == null || n[b] == "") setTimeout(function () {
                X(b, c, d, i, e, l, f)
            }, 500);
            else {
                var h = "";
                if (parseInt(d) == 1) {
                    fromname = ia;
                    h = " arrowchat_self"
                } else fromname = n[b];
                if (parseInt(l) == 1) c = c.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/\"/g, "&quot;");
                d != 1 && da == 1 && Ua();
                separator = ":&nbsp;&nbsp;";
                if (a("#arrowchat_message_" + e).length > 0) a("#arrowchat_message_" + e + " .arrowchat_chatboxmessagecontent").html(c);
                else {
                    sentdata = "";
                    if (f != null) sentdata = ha(new Date(f * 1E3));
                    if (fromname.indexOf(" ") != -1) fromname = fromname.slice(0, fromname.indexOf(" "));
                    var o = n[b];
                    if (o.indexOf(" ") != -1) o = o.slice(0, o.indexOf(" "));
                    if (u[b] == "offline") a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").append('<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + e + '"><div class="arrowchat_chatboxmessagefrom' + h + '"><div style="float:right;">' + sentdata + "</div><strong>" + fromname + '</strong><br /></div><div class="arrowchat_chatboxmessagecontent_offline' + h + '"><div class="arrowchat_offline_send_text">' + o + g[13] + "</div>" + c + "</div></div>");
                    else if (f - B > 60 || B == null || N != fromname) {
                        a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").append('<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + e + '"><div class="arrowchat_chatboxmessagefrom' + h + '"><div style="float:right;">' + sentdata + "</div><strong>" + fromname + '</strong><br /></div><div class="arrowchat_chatboxmessagecontent' + h + '">' + c + "</div></div>");
                        B = f;
                        N = fromname
                    } else a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").append('<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + e + '"><div class="arrowchat_chatboxmessagecontent' + h + '">' + c + "</div></div>");
                    a("#arrowchat_tabcontenttext_" + b).scrollTop(5E4)
                }
                j != b && i != 1 && sa(b, 1, 1)
            }
        }
        function ya(b) {
            if (n[b] == null || n[b] == "") setTimeout(function () {
                ya(b)
            }, 500);
            else j != b && a("#arrowchat_user_" + b).click()
        }
        function za(b, c) {
            if (n[b] == null || n[b] == "") setTimeout(function () {
                za(b, c)
            }, 500);
            else {
                a("#arrowchat_tabcontenttext_" + b).append("<div>" + c + "</div>");
                a("#arrowchat_tabcontenttext_" + b).scrollTop(5E4);
                G[b] = 1
            }
        }
        function P() {
            a.ajax({
                url: k + "includes/receive_buddylist.php",
                cache: "false",
                type: "post",
                dataType: "json",
                dataFilter: function (b) {
                    return typeof JSON !== "undefined" && typeof JSON.parse === "function" ? JSON.parse(b) : eval("(" + b + ")")
                },
                success: function (b) {
                    Va(b);
                    if ((a(window).height() - a("#arrowchat_userstab_popup").height()) < 80) {
                        a("#arrowchat_userscontent").css("height", a(window).height() - 135);
                    } else {
                        a("#arrowchat_userscontent").css("height", "auto");
                    }
                }
            });
            Z = setTimeout(function () {
                P()
            }, 6E4)
        }
        function Va(b) {
            V.timestamp = ma;
            var c = {},
                d = "";
            c.available = "";
            c.busy = "";
            c.offline = "";
            c.away = "";
            onlineNumber = buddylistreceived = 0;
            b && a.each(b, function (i, e) {
                if (i == "buddylist") {
                    buddylistreceived = 1;
                    totalFriendsNumber = onlineNumber = 0;
                    a.each(e, function (l, f) {
                        longname = f.n.length > 16 ? f.n.substr(0, 16) + "..." : f.n;
                        if (G[f.id] != null) {
                            a("#arrowchat_user_" + f.id + " .arrowchat_closebox_bottom_status").removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + f.s);
                            a("#arrowchat_user_" + f.id).removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + f.s);
                            a("#arrowchat_user_" + f.id + "_popup").length > 0 && a("#arrowchat_user_" + f.id + "_popup .arrowchat_tabsubtitle .arrowchat_message").html(f.m)
                        }
                        if (f.s == "available" || f.s == "away" || f.s == "busy") onlineNumber++;
                        totalFriendsNumber++;
                        if (document.getElementById("arrowchat_setting_names_only").checked) d = "arrowchat_hide_avatars";
                        c[f.s] += '<div id="arrowchat_userlist_' + f.id + '" class="arrowchat_userlist" onmouseover="jqac(this).addClass(\'arrowchat_userlist_hover\');" onmouseout="jqac(this).removeClass(\'arrowchat_userlist_hover\');"><img class="arrowchat_userlist_avatar ' + d + '" src="' + f.a + '" /><span class="arrowchat_userscontentname">' + longname + '</span><span class="arrowchat_userscontentdot arrowchat_' + f.s + '"></span></div>';
                        u[f.id] = f.s;
                        z[f.id] = f.m;
                        n[f.id] = f.n;
                        A[f.id] = f.a;
                        s[f.id] = f.l
                    })
                }
                if (buddylistreceived == 1 && bli == 0) {
                    for (buddystatus in c) if (c.hasOwnProperty(buddystatus)) c[buddystatus] == "" ? a("#arrowchat_userslist_" + buddystatus).html("") : oa("arrowchat_userslist_" + buddystatus, "<div>" + c[buddystatus] + "</div>");
                    a(".arrowchat_userlist").click(function (l) {
                        Sa(l.target)
                    });
                    a("#arrowchat_userstab_text").html("<b>" + g[4] + "</b> (<b>" + onlineNumber + "</b>)");
                    R = onlineNumber;
                    totalFriendsNumber == 0 && a("#arrowchat_userslist_available").html('<div class="arrowchat_nofriends">' + g[8] + "</div>");
                    R == 0 && a("#arrowchat_userslist_available").html('<div class="arrowchat_nofriends">' + g[8] + "</div>");
                    R > 0 ? a("#arrowchat_search_friends").show() : a("#arrowchat_search_friends").hide();
                    buddylistreceived = 0
                } else {
                    a("#arrowchat_userstab_text").html("<b>" + g[4] + "</b> (<b>" + onlineNumber + "</b>)");
                }
            })
        }
        function cancelJSONP() {
            for (var jsonp in window) if (jsonp.substr(0, 5) == "jsonp") return window[jsonp] = function () {};
        };

        function H() {
            var url = "http://" + achan + "/receive_core.php?ah=" + Wa + "&hb=<?php echo $heart_beat; ?>&lp=" + Lpt + "&ai=" + acsi;
            a.getJSON(url + "&callback=?", function (b) {
                V.timestamp = ma;
                var c = "",
                    d = {};
                d.available = "";
                d.busy = "";
                d.offline = "";
                d.away = "";
                onlineNumber = buddylistreceived = 0;
                if (b && b != null) {
                    var i = 0;
                    a.each(b, function (e, l) {
                        if (e == "loggedout") {
                            a("#arrowchat_optionsbutton").addClass("arrowchat_optionsimages_exclamation");
                            a("#arrowchat_buddy_list_tab").hide();
                            a("#arrowchat_chatboxes").hide();
                            a("#arrowchat_chatbox_left").hide();
                            a("#arrowchat_chatbox_right").hide();
                            a("#arrowchat_optionsbutton_popup").hide();
                            a("#arrowchat_userstab_popup").hide();
                            a(".arrowchat_tabopen").css("cssText", "display: none !important;");
                            if (j != "") {
                                a("#arrowchat_user_" + j + "_popup").hide();
                                j = ""
                            }
                            $ = 1
                        }
                        e == "userstatus" && a.each(l, function (f, h) {
                            f == "message" && a("#arrowchat_optionsbutton_popup .arrowchat_statustextarea").val(h);
                            if (f == "status") if (h == "offline") ga(1);
                            else {
                                F();
                                a("#arrowchat_userstab_icon").addClass("arrowchat_user_" + h + "2");
                                a("#arrowchat_optionsbutton_popup ." + h).css("text-decoration", "underline")
                            }
                        });
                        if (e == "typing") {
                            a.each(l, function (f, h) {
                                if (h.is_typing == "1") {
                                    a("#arrowchat_user_" + h.typing_id + " .arrowchat_closebox_bottom_status").addClass("arrowchat_typing")
                                } else {
                                    a("#arrowchat_user_" + h.typing_id + " .arrowchat_closebox_bottom_status").removeClass("arrowchat_typing")
                                }
                            });
                        }
                        if (e == "notifications") {
                            a.each(l, function (f, h) {
                                a("<div/>").attr("id", "arrowchat_alert_" + h.alert_id).html(h.markup).appendTo(a("#arrowchat_notifications_content"));
                                Q++
                            });
                            if (Q > 0) {
                                a("#arrowchat_no_new_notifications").css("display", "none");
                            }
                            a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
                            a("<div/>").css("top", "-7px").css("left", "8px").addClass("arrowchat_tabalertnf").html(Q).prependTo(a("#arrowchat_optionsbutton"))
                        }
                        if (e == "messages") {
                            bounce = 0;
                            a.each(l, function (f, h) {
                                ma = h.id;
                                if (j == h.from && n[h.from] != "" && n[h.from] != null) {
                                    ++i;
                                    var o = n[h.from];
                                    f = "";
                                    if (h.self == 1) {
                                        fromname = ia;
                                        f = " arrowchat_self";
                                        _aa5 = _aa4 = ""
                                    } else {
                                        fromname = o;
                                        _aa4 = '<a href="' + s[h.from] + '">';
                                        _aa5 = "</a>"
                                    }
                                    if (a("#arrowchat_message_" + h.id).length > 0) a("#arrowchat_message_" + h.id + " .arrowchat_chatboxmessagecontent").html(h.message);
                                    else {
                                        o = new Date(h.sent * 1E3);
                                        if (fromname.indexOf(" ") != -1) fromname = fromname.slice(0, fromname.indexOf(" "));
                                        if (h.sent - B > 60 || B == null || N != fromname) {
                                            c += '<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + h.id + '"><div class="arrowchat_chatboxmessagefrom' + f + '"><div style="float:right;">' + ha(o) + "</div><strong>" + _aa4 + fromname + _aa5 + '</strong><br /></div><div class="arrowchat_chatboxmessagecontent' + f + '">' + h.message + "</div></div>";
                                            B = h.sent;
                                            N = fromname
                                        } else c += '<div class="arrowchat_chatboxmessage" id="arrowchat_message_' + h.id + '"><div class="arrowchat_chatboxmessagecontent' + f + '">' + h.message + "</div></div>"
                                    }
                                } else {
                                    f = 0;
                                    if (!(a("#arrowchat_user_" + h.from).length > 0)) {
                                        a.post(k + "includes/send_settings.php", {
                                            userid: q,
                                            unfocus_chat: h.from
                                        }, function () {});
                                        f = 1
                                    }
                                    X(h.from, h.message, h.self, h.old, h.id, 0, h.sent);
                                    j == "" && 0 && ya(h.from)
                                }
                            });
                            K = 1;
                            d != 1 && da == 1 && Ua();
                            D = E
                        }
                    });
                    j != "" && i > 0 && za(j, c)
                }
                U("initialize", "0");
                U("currenttime", "0");
                if ($ != 1 && w != 1) {
                    K++;
                    if (K > 4) {
                        D *= 2;
                        K = 1
                    }
                    if (D > 12E3) D = 12E3
                }
                acsi++;
                if (Lpt == 1) {
                    var CHT = <?php echo $heart_beat; ?> * 1000;
                } else {
                    var CHT = 20;
                }
                CHA = setTimeout(function () {
                    H()
                }, CHT);
            });
        }
        function Xa() {
            a("<div/>").attr("id", "arrowchat_base").appendTo(a("body"));
            if (Ya != 0) {
                Ea();
                Da()
            }
            Ga();
            ua != 0 && Ja();
            Za != 0 && Fa();
            Pa();
            for (var b = "", c = "", d = 0; d < t.length; d++) {
                var i = t[d];
                if (i[6] == "" || i[6] == 0) i[6] = 16;
                b += '<div id="arrowchat_trayicon_' + d + '" class="arrowchat_tray_button arrowchat_bar_left" style="width:' + i[6] + 'px;"><div class="arrowchat_inner_button"><img class="arrowchat_tray_icon" src=' + k + "themes/" + x + "/images/icons/" + i[0] + '><div class="arrowchat_tray_name">' + i[7] + "</div></div></div>";
                if (i[3] == "_popup") c += '<div id="arrowchat_trayicon_' + d + '_popup" class="arrowchat_traypopup" style="display:none"><div class="arrowchat_traytitle"><div class="arrowchat_name">' + i[1] + '</div><div class="arrowchat_minimizebox"></div><br clear="all"/></div><div class="arrowchat_traycontent"><div class="arrowchat_traycontenttext"><iframe allowtransparency="true" frameborder=0 width="' + i[4] + '" height="' + i[5] + '" id="arrowchat_trayicon_' + d + '_iframe"  ></iframe></div></div></div>'
            }
            a("#arrowchat_base").append("<div>" + b + "</div>");
            a("body").append("<div>" + c + "</div>");
            if ($a != 0) {
                Ia();
                Ha()
            }
            a("body").append('<div id="arrowchat_sound_player_holder"></div>');
            a(".arrowchat_tray_button").mouseover(function () {
                var e = a(this).attr("id").substr(19);
                if (t[e][6] <= 16 || t[e][6] == "") r("arrowchat_trayicon_" + e, t[e][1], 1);
                a(this).addClass("arrowchat_tabmouseover")
            });
            a(".arrowchat_tray_button").mouseout(function () {
                a(this).removeClass("arrowchat_tabmouseover");
                a("#arrowchat_tooltip").css("display", "none")
            });
            a(".arrowchat_traytitle").mouseenter(function () {
                var e = a(this).parent().attr("id");
                e = e.substring(19, e.length - 6);
                a("#arrowchat_trayicon_" + e + "_popup .arrowchat_traytitle .arrowchat_minimizebox").addClass("arrowchat_chatboxtraytitlemouseover")
            });
            a(".arrowchat_traytitle").mouseleave(function () {
                var e = a(this).parent().attr("id");
                e = e.substring(19, e.length - 6);
                a("#arrowchat_trayicon_" + e + "_popup .arrowchat_traytitle .arrowchat_minimizebox").removeClass("arrowchat_chatboxtraytitlemouseover")
            });
            a(".arrowchat_traytitle").click(function () {
                var e = a(this).parent().attr("id");
                e = e.substring(19, e.length - 6);
                a("#arrowchat_trayicon_" + e).click()
            });
            a(".arrowchat_tray_button").click(function () {
                var e = a(this).attr("id").substr(19);
                if (j != "") {
                    a("#arrowchat_user_" + j + "_popup").removeClass("arrowchat_tabopen");
                    a("#arrowchat_user_" + j).removeClass("arrowchat_tabclick").removeClass("arrowchat_usertabclick");
                    a("#arrowchat_user_" + j + " .arrowchat_closebox_bottom").removeClass("arrowchat_closebox_bottom_click");
                    j = ""
                }
                a("#arrowchat_userstab_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_buddy_list_tab").removeClass("arrowchat_userstabclick").removeClass("arrowchat_tabclick");
                a("#arrowchat_optionsbutton_popup").removeClass("arrowchat_tabopen");
                a("#arrowchat_optionsbutton").removeClass("arrowchat_tabclick");
                var l = "_self";
                if (t[e][3]) l = t[e][3];
                if (l == "_popup") {
                    if (m != e) {
                        a("#arrowchat_trayicon_" + m + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_trayicon_" + m).removeClass("arrowchat_trayclick");
                        m = ""
                    }
                    if (m == "") {
                        a("#arrowchat_trayicon_" + e + "_popup").css("left", a("#arrowchat_trayicon_" + e).offset().left).css("bottom", "25px").css("width", t[e][4]);
                        a("#arrowchat_trayicon_" + e + "_popup").addClass("arrowchat_tabopen");
                        a("#arrowchat_trayicon_" + e).addClass("arrowchat_trayclick");
                        if (a("#arrowchat_trayicon_" + e + "_iframe").attr("src") === undefined || a("#arrowchat_trayicon_" + e + "_iframe").attr("src") == "") a("#arrowchat_trayicon_" + e + "_iframe").attr("src", t[e][2]);
                        m = e
                    } else {
                        a("#arrowchat_trayicon_" + m + "_popup").removeClass("arrowchat_tabopen");
                        a("#arrowchat_trayicon_" + m).removeClass("arrowchat_trayclick");
                        m = ""
                    }
                } else window.open(t[e][2], l)
            });
            a("<div/>").attr("id", "arrowchat_chatbox_right").appendTo(a("#arrowchat_base"));
            a("<span/>").addClass("arrowchat_next_tab").appendTo(a("#arrowchat_chatbox_right"));
            a("<div/>").addClass("arrowchat_tabtext").appendTo(a("#arrowchat_chatbox_right"));
            a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo(a("#arrowchat_chatbox_right"));
            a("#arrowchat_chatbox_right").bind("click", la);
            a("<div/>").attr("id", "arrowchat_chatboxes").appendTo(a("#arrowchat_base"));
            a("<div/>").attr("id", "arrowchat_chatboxes_wide").appendTo(a("#arrowchat_chatboxes"));
            a("<div/>").attr("id", "arrowchat_chatbox_left").appendTo(a("#arrowchat_base"));
            a("<span/>").addClass("arrowchat_previous_tab").appendTo(a("#arrowchat_chatbox_left"));
            a("<div/>").addClass("arrowchat_tabtext").appendTo(a("#arrowchat_chatbox_left"));
            a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo(a("#arrowchat_chatbox_left"));
            a("#arrowchat_chatbox_left").bind("click", ka);
            M();
            L();
            a("#arrowchat_chatbox_right").mouseover(function () {
                a(this).addClass("arrowchat_chatbox_lr_mouseover")
            });
            a("#arrowchat_chatbox_right").mouseout(function () {
                a(this).removeClass("arrowchat_chatbox_lr_mouseover")
            });
            a("#arrowchat_chatbox_left").mouseover(function () {
                a(this).addClass("arrowchat_chatbox_lr_mouseover")
            });
            a("#arrowchat_chatbox_left").mouseout(function () {
                a(this).removeClass("arrowchat_chatbox_lr_mouseover")
            });
            a(window).bind("resize", M);
            U("buddylist", "1");
            U("initialize", "1");
            U("currenttime", ab);
            if (typeof document.body.style.maxHeight === "undefined") {
                W = true;
                a("#arrowchat_base").css("position", "absolute");
                a("#arrowchat_tooltip").css("position", "absolute");
                a("#arrowchat_userstab_popup").css("position", "absolute");
                a("#arrowchat_optionsbutton_popup").css("position", "absolute");
                a(window).bind("scroll", function () {
                    va()
                })
            }
            if (bb == 1 || na == "offline") {
                if (na == "offline" && bb != 1) a("#arrowchat_userstab_text").html("الدردشة (غير متصل)");
                else {
                    a("#arrowchat_base").hide();
                    a("#arrowchat_show_bar_button").show()
                }
                w = 1;
                a.idleTimer("destroy")
            } else {
                setTimeout(function () {
                    H()
                }, 700);
                a("#arrowchat_userslist_available").html('<div class="arrowchat_nofriends">' + g[25] + "</div>");
                P();
                ta == 1 && a("#arrowchat_buddy_list_tab").click();
                for (d = 0; d < C.length; d++) I(C[d], n[C[d]], u[C[d]], z[C[d]], A[C[d]], s[C[d]], "1");
                J != 0 && I(J, n[J], u[J], z[J], A[J], s[J])
            }
            F();
            a("#arrowchat_userstab_icon").addClass("arrowchat_user_" + na + "2")
        }
        function va() {
            a("#arrowchat_base").css("top", a(window).scrollTop() + a(window).height() - 25);
            a("#arrowchat_userstab_popup").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_userstab_popup").css("bottom")) - parseInt(a("#arrowchat_userstab_popup").height()) + a(window).scrollTop() + "px");
            a("#arrowchat_optionsbutton_popup").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_optionsbutton_popup").css("bottom")) - parseInt(a("#arrowchat_optionsbutton_popup").height()) + a(window).scrollTop() + "px");
            a("#arrowchat_tooltip").length > 0 && a("#arrowchat_tooltip").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_tooltip").css("bottom")) - parseInt(a("#arrowchat_tooltip").height()) + a(window).scrollTop() + "px");
            if (j != "") {
                a("#arrowchat_user_" + j + "_popup").css("position", "absolute");
                a("#arrowchat_user_" + j + "_popup").css("top", parseInt(a(window).height()) - parseInt(a("#arrowchat_user_" + j + "_popup").css("bottom")) - parseInt(a("#arrowchat_user_" + j + "_popup").height()) + a(window).scrollTop() + "px")
            }
        }
        function Ua() {
            swfobject.embedSWF(k + "themes/" + x + "/sounds/new%5Fmessage.player.swf?soundswf=" + k + "themes/" + x + "/sounds/new%5Fmessage.swf&autoplay=1&loops=0", "arrowchat_sound_player_holder", "1", "1", "9.0.0");
        }
        var bounce = 0,
            g = [],
            t = [],
            C = [],
            p = []; <?php echo $settings; ?> V = {},
        dtit = document.title,
        xa = {},
        j = "",
        $ = 0,
        w = 0,
        bli = 1,
        W = false,
        Y,
        Z,
        D = E,
        K = 1,
        ma = 0,
        R = 0,
        m = "",
        Ka = 0,
        n = {},
        z = {},
        u = {},
        A = {},
        s = {},
        y = {},
        G = {},
        aa = {},
        ca = {},
        Aa = new Date,
        Na = Aa.getDate(),
        ab = Math.floor(Aa.getTime() / 1E3),
        acsi = 1,
        Q = 0,
        fa = -1,
        acp = "",
        pa = 0,
        B,
        N;
        a.ajaxSetup({
            scriptCharset: "utf-8",
            cache: "false"
        });
        a.expr[":"].icontains = function (b, c, d) {
            return (b.textContent || b.innerText || jqac(b).text() || "").toLowerCase().indexOf(d[3].toLowerCase()) >= 0
        };
        arguments.callee.runarrowchat = function () {
            Xa()
        };
        arguments.callee.chatWith = function (b) {
            I(b, n[b], u[b], z[b], A[b], s[b])
        };
        arguments.callee.sendMessage =

        function (b, c) {
            c != "" && a.post(k + "includes/send_message.php", {
                userid: q,
                to: b,
                message: c
            }, function (d) {
                if (d) {
                    X(b, c, 1, 1, d, 1, 1);
                    a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext").scrollTop(a("#arrowchat_user_" + b + "_popup .arrowchat_tabcontenttext")[0].scrollHeight)
                }
                K = 1;
                if (D > E) {
                    D = E;
                    clearTimeout(Y);
                    Y = setTimeout(function () {
                        H()
                    }, E)
                }
            })
        };
        arguments.callee.getBaseUrl = function () {
            return k
        }
    }
})(jqac);
(jqac);
jqac(document).ready(function () {
    jqac.arrowchat();
    jqac.arrowchat.runarrowchat()
});