Advertisement
Guest User

Untitled

a guest
Dec 24th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (typeof(jqac) === 'undefined') {
  2.     jqac = jQuery;
  3. }
  4. if (c_push_engine == "1") {
  5.     jqac("<div/>").attr("pub-key", c_push_publish).attr("sub-key", c_push_subscribe).attr("ssl", "off").attr("origin", "www.arrowpushengine.com").attr("id", "pubnub").appendTo(jqac('body'));
  6. }
  7. if (!jqac.placeholder) {
  8.     new function($) {
  9.         $.fn.placeholder = function(settings) {
  10.             settings = settings || {};
  11.             var key = settings.dataKey || "placeholderValue";
  12.             var attr = settings.attr || "placeholder";
  13.             var className = settings.className || "placeholder";
  14.             var values = settings.values || [];
  15.             var block = settings.blockSubmit || false;
  16.             var blank = settings.blankSubmit || false;
  17.             var submit = settings.onSubmit || false;
  18.             var value = settings.value || "";
  19.             var position = settings.cursor_position || 0;
  20.             return this.filter(":input").each(function(index) {
  21.                 $.data(this, key, values[index] || $(this).attr(attr));
  22.             }).each(function() {
  23.                 if ($.trim($(this).val()) === "") $(this).addClass(className).val($.data(this, key));
  24.             }).focus(function() {
  25.                 if ($.trim($(this).val()) === $.data(this, key)) $(this).removeClass(className).val(value);
  26.                 if ($.fn.setCursorPosition) {
  27.                     $(this).setCursorPosition(position);
  28.                 }
  29.             }).blur(function() {
  30.                 if ($.trim($(this).val()) === value) $(this).addClass(className).val($.data(this, key));
  31.             }).each(function(index, elem) {
  32.                 if (block) new function(e) {
  33.                     $(e.form).submit(function() {
  34.                         return $.trim($(e).val()) != $.data(e, key)
  35.                     });
  36.                 }(elem);
  37.                 else if (blank) new function(e) {
  38.                     $(e.form).submit(function() {
  39.                         if ($.trim($(e).val()) == $.data(e, key)) $(e).removeClass(className).val("");
  40.                         return true;
  41.                     });
  42.                 }(elem);
  43.                 else if (submit) new function(e) {
  44.                     $(e.form).submit(submit);
  45.                 }(elem);
  46.             });
  47.         };
  48.     }(jqac);
  49. }
  50. if (!jqac.highlight) {
  51.     jqac.fn.highlight = function(b) {
  52.         function a(e, j) {
  53.             var l = 0;
  54.             if (e.nodeType == 3) {
  55.                 var k = e.data.toUpperCase().indexOf(j);
  56.                 if (k >= 0) {
  57.                     var h = document.createElement("span");
  58.                     h.className = "highlight";
  59.                     var f = e.splitText(k);
  60.                     var c = f.splitText(j.length);
  61.                     var d = f.cloneNode(true);
  62.                     h.appendChild(d);
  63.                     f.parentNode.replaceChild(h, f);
  64.                     l = 1
  65.                 }
  66.             } else {
  67.                 if (e.nodeType == 1 && e.childNodes && !/(script|style)/i.test(e.tagName)) {
  68.                     for (var g = 0; g < e.childNodes.length; ++g) {
  69.                         g += a(e.childNodes[g], j)
  70.                     }
  71.                 }
  72.             }
  73.             return l
  74.         }
  75.         return this.each(function() {
  76.             a(this, b.toUpperCase())
  77.         })
  78.     };
  79.     jqac.fn.removeHighlight = function() {
  80.         return this.find("span.highlight").each(function() {
  81.             this.parentNode.firstChild.nodeName;
  82.             with(this.parentNode) {
  83.                 replaceChild(this.firstChild, this);
  84.                 normalize()
  85.             }
  86.         }).end()
  87.     };
  88. }
  89. if (!jqac.scrollTo) {
  90.     (function($) {
  91.         var h = $.scrollTo = function(a, b, c) {
  92.             $(window).scrollTo(a, b, c)
  93.         };
  94.         h.defaults = {
  95.             axis: 'xy',
  96.             duration: parseFloat($.fn.jqac) >= 1.3 ? 0 : 1
  97.         };
  98.         h.window = function(a) {
  99.             return $(window)._scrollable()
  100.         };
  101.         $.fn._scrollable = function() {
  102.             return this.map(function() {
  103.                 var a = this,
  104.                     isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;
  105.                 if (!isWin) return a;
  106.                 var b = (a.contentWindow || a).document || a.ownerDocument || a;
  107.                 return $.browser.safari || b.compatMode == 'BackCompat' ? b.body : b.documentElement
  108.             })
  109.         };
  110.         $.fn.scrollTo = function(e, f, g) {
  111.             if (typeof f == 'object') {
  112.                 g = f;
  113.                 f = 0
  114.             }
  115.             if (typeof g == 'function') g = {
  116.                 onAfter: g
  117.             };
  118.             if (e == 'max') e = 9e9;
  119.             g = $.extend({}, h.defaults, g);
  120.             f = f || g.speed || g.duration;
  121.             g.queue = g.queue && g.axis.length > 1;
  122.             if (g.queue) f /= 2;
  123.             g.offset = both(g.offset);
  124.             g.over = both(g.over);
  125.             return this._scrollable().each(function() {
  126.                 var d = this,
  127.                     $elem = $(d),
  128.                     targ = e,
  129.                     toff, attr = {},
  130.                     win = $elem.is('html,body');
  131.                 switch (typeof targ) {
  132.                     case 'number':
  133.                     case 'string':
  134.                         if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
  135.                             targ = both(targ);
  136.                             break
  137.                         }
  138.                         targ = $(targ, this);
  139.                     case 'object':
  140.                         if (targ.is || targ.style) toff = (targ = $(targ)).offset()
  141.                 }
  142.                 $.each(g.axis.split(''), function(i, a) {
  143.                     var b = a == 'x' ? 'Left' : 'Top',
  144.                         pos = b.toLowerCase(),
  145.                         key = 'scroll' + b,
  146.                         old = d[key],
  147.                         max = h.max(d, a);
  148.                     if (toff) {
  149.                         attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
  150.                         if (g.margin) {
  151.                             attr[key] -= parseInt(targ.css('margin' + b)) || 0;
  152.                             attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0
  153.                         }
  154.                         attr[key] += g.offset[pos] || 0;
  155.                         if (g.over[pos]) attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos]
  156.                     } else {
  157.                         var c = targ[pos];
  158.                         attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c
  159.                     }
  160.                     if (/^\d+$/.test(attr[key])) attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
  161.                     if (!i && g.queue) {
  162.                         if (old != attr[key]) animate(g.onAfterFirst);
  163.                         delete attr[key]
  164.                     }
  165.                 });
  166.                 animate(g.onAfter);
  167.  
  168.                 function animate(a) {
  169.                     $elem.animate(attr, f, g.easing, a && function() {
  170.                         a.call(this, e, g)
  171.                     })
  172.                 }
  173.             }).end()
  174.         };
  175.         h.max = function(a, b) {
  176.             var c = b == 'x' ? 'Width' : 'Height',
  177.                 scroll = 'scroll' + c;
  178.             if (!$(a).is('html,body')) return a[scroll] - $(a)[c.toLowerCase()]();
  179.             var d = 'client' + c,
  180.                 html = a.ownerDocument.documentElement,
  181.                 body = a.ownerDocument.body;
  182.             return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])
  183.         };
  184.  
  185.         function both(a) {
  186.             return typeof a == 'object' ? a : {
  187.                 top: a,
  188.                 left: a
  189.             }
  190.         }
  191.     })(jqac);
  192. }
  193. if (!jqac.idleTimer) {
  194.     (function($) {
  195.         $.idleTimer = function f(newTimeout) {
  196.             var idle = false,
  197.                 enabled = true,
  198.                 timeout = 30000,
  199.                 events = 'mousemove keydown DOMMouseScroll mousewheel mousedown',
  200.                 toggleIdleState = function() {
  201.                     idle = !idle;
  202.                     f.olddate = +new Date;
  203.                     $(document).trigger($.data(document, 'idleTimer', idle ? "idle" : "active") + '.idleTimer');
  204.                 },
  205.                 stop = function() {
  206.                     enabled = false;
  207.                     clearTimeout($.idleTimer.tId);
  208.                 },
  209.                 handleUserEvent = function() {
  210.                     clearTimeout($.idleTimer.tId);
  211.                     if (enabled) {
  212.                         if (idle) {
  213.                             toggleIdleState();
  214.                         }
  215.                         $.idleTimer.tId = setTimeout(toggleIdleState, timeout);
  216.                     }
  217.                 };
  218.             f.olddate = f.olddate || +new Date;
  219.             if (typeof newTimeout == "number") {
  220.                 timeout = newTimeout;
  221.             } else if (newTimeout === 'destroy') {
  222.                 stop();
  223.                 return this;
  224.             } else if (newTimeout === 'getElapsedTime') {
  225.                 return (+new Date) - f.olddate;
  226.             }
  227.             $(document).bind($.trim((events + ' ').split(' ').join('.idleTimer ')), handleUserEvent);
  228.             $.idleTimer.tId = setTimeout(toggleIdleState, timeout);
  229.             $.data(document, 'idleTimer', "active");
  230.         };
  231.     })(jqac);
  232. }
  233. if (!jqac.popupWindow) {
  234.     (function($) {
  235.         $.fn.popupWindow = function(instanceSettings) {
  236.             return this.each(function() {
  237.                 $(this).click(function() {
  238.                     $.fn.popupWindow.defaultSettings = {
  239.                         centerBrowser: 0,
  240.                         centerScreen: 0,
  241.                         height: 500,
  242.                         left: 0,
  243.                         location: 0,
  244.                         menubar: 0,
  245.                         resizable: 0,
  246.                         scrollbars: 0,
  247.                         status: 0,
  248.                         width: 500,
  249.                         windowName: null,
  250.                         windowURL: null,
  251.                         top: 0,
  252.                         toolbar: 0
  253.                     };
  254.                     settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
  255.                     var windowFeatures = 'height=' + settings.height + ',width=' + settings.width + ',toolbar=' + settings.toolbar + ',scrollbars=' + settings.scrollbars + ',status=' + settings.status + ',resizable=' + settings.resizable + ',location=' + settings.location + ',menuBar=' + settings.menubar;
  256.                     settings.windowName = this.name || settings.windowName;
  257.                     settings.windowURL = this.href || settings.windowURL;
  258.                     var centeredY, centeredX;
  259.                     if (settings.centerBrowser) {
  260.                         if ($.browser.msie) {
  261.                             centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (settings.height / 2)));
  262.                             centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (settings.width / 2)));
  263.                         } else {
  264.                             centeredY = window.screenY + (((window.outerHeight / 2) - (settings.height / 2)));
  265.                             centeredX = window.screenX + (((window.outerWidth / 2) - (settings.width / 2)));
  266.                         }
  267.                         window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus();
  268.                     } else if (settings.centerScreen) {
  269.                         centeredY = (screen.height - settings.height) / 2;
  270.                         centeredX = (screen.width - settings.width) / 2;
  271.                         window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus();
  272.                     } else {
  273.                         window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + settings.left + ',top=' + settings.top).focus();
  274.                     }
  275.                     return false;
  276.                 });
  277.             });
  278.         };
  279.     })(jqac);
  280. };
  281. var swfobject = function() {
  282.     var aq = "undefined",
  283.         aD = "object",
  284.         ab = "Shockwave Flash",
  285.         X = "ShockwaveFlash.ShockwaveFlash",
  286.         aE = "application/x-shockwave-flash",
  287.         ac = "SWFObjectExprInst",
  288.         ax = "onreadystatechange",
  289.         af = window,
  290.         aL = document,
  291.         aB = navigator,
  292.         aa = false,
  293.         Z = [aN],
  294.         aG = [],
  295.         ag = [],
  296.         al = [],
  297.         aJ, ad, ap, at, ak = false,
  298.         aU = false,
  299.         aH, an, aI = true,
  300.         ah = function() {
  301.             var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq,
  302.                 e = aB.userAgent.toLowerCase(),
  303.                 c = aB.platform.toLowerCase(),
  304.                 h = c ? /win/.test(c) : /win/.test(e),
  305.                 j = c ? /mac/.test(c) : /mac/.test(e),
  306.                 g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
  307.                 d = !+"\v1",
  308.                 f = [0, 0, 0],
  309.                 k = null;
  310.             if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) {
  311.                 k = aB.plugins[ab].description;
  312.                 if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) {
  313.                     aa = true;
  314.                     d = false;
  315.                     k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
  316.                     f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10);
  317.                     f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
  318.                     f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
  319.                 }
  320.             } else {
  321.                 if (typeof af.ActiveXObject != aq) {
  322.                     try {
  323.                         var i = new ActiveXObject(X);
  324.                         if (i) {
  325.                             k = i.GetVariable("$version");
  326.                             if (k) {
  327.                                 d = true;
  328.                                 k = k.split(" ")[1].split(",");
  329.                                 f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)];
  330.                             }
  331.                         }
  332.                     } catch (b) {}
  333.                 }
  334.             }
  335.             return {
  336.                 w3: a,
  337.                 pv: f,
  338.                 wk: g,
  339.                 ie: d,
  340.                 win: h,
  341.                 mac: j
  342.             };
  343.         }(),
  344.         aK = function() {
  345.             if (!ah.w3) {
  346.                 return;
  347.             }
  348.             if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) {
  349.                 aP();
  350.             }
  351.             if (!ak) {
  352.                 if (typeof aL.addEventListener != aq) {
  353.                     aL.addEventListener("DOMContentLoaded", aP, false);
  354.                 }
  355.                 if (ah.ie && ah.win) {
  356.                     aL.attachEvent(ax, function() {
  357.                         if (aL.readyState == "complete") {
  358.                             aL.detachEvent(ax, arguments.callee);
  359.                             aP();
  360.                         }
  361.                     });
  362.                     if (af == top) {
  363.                         (function() {
  364.                             if (ak) {
  365.                                 return;
  366.                             }
  367.                             try {
  368.                                 aL.documentElement.doScroll("left");
  369.                             } catch (a) {
  370.                                 setTimeout(arguments.callee, 0);
  371.                                 return;
  372.                             }
  373.                             aP();
  374.                         })();
  375.                     }
  376.                 }
  377.                 if (ah.wk) {
  378.                     (function() {
  379.                         if (ak) {
  380.                             return;
  381.                         }
  382.                         if (!/loaded|complete/.test(aL.readyState)) {
  383.                             setTimeout(arguments.callee, 0);
  384.                             return;
  385.                         }
  386.                         aP();
  387.                     })();
  388.                 }
  389.                 aC(aP);
  390.             }
  391.         }();
  392.  
  393.     function aP() {
  394.         if (ak) {
  395.             return;
  396.         }
  397.         try {
  398.             var b = aL.getElementsByTagName("body")[0].appendChild(ar("span"));
  399.             b.parentNode.removeChild(b);
  400.         } catch (a) {
  401.             return;
  402.         }
  403.         ak = true;
  404.         var d = Z.length;
  405.         for (var c = 0; c < d; c++) {
  406.             Z[c]();
  407.         }
  408.     }
  409.  
  410.     function aj(a) {
  411.         if (ak) {
  412.             a();
  413.         } else {
  414.             Z[Z.length] = a;
  415.         }
  416.     }
  417.  
  418.     function aC(a) {
  419.         if (typeof af.addEventListener != aq) {
  420.             af.addEventListener("load", a, false);
  421.         } else {
  422.             if (typeof aL.addEventListener != aq) {
  423.                 aL.addEventListener("load", a, false);
  424.             } else {
  425.                 if (typeof af.attachEvent != aq) {
  426.                     aM(af, "onload", a);
  427.                 } else {
  428.                     if (typeof af.onload == "function") {
  429.                         var b = af.onload;
  430.                         af.onload = function() {
  431.                             b();
  432.                             a();
  433.                         };
  434.                     } else {
  435.                         af.onload = a;
  436.                     }
  437.                 }
  438.             }
  439.         }
  440.     }
  441.  
  442.     function aN() {
  443.         if (aa) {
  444.             Y();
  445.         } else {
  446.             am();
  447.         }
  448.     }
  449.  
  450.     function Y() {
  451.         var d = aL.getElementsByTagName("body")[0];
  452.         var b = ar(aD);
  453.         b.setAttribute("type", aE);
  454.         var a = d.appendChild(b);
  455.         if (a) {
  456.             var c = 0;
  457.             (function() {
  458.                 if (typeof a.GetVariable != aq) {
  459.                     var e = a.GetVariable("$version");
  460.                     if (e) {
  461.                         e = e.split(" ")[1].split(",");
  462.                         ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)];
  463.                     }
  464.                 } else {
  465.                     if (c < 10) {
  466.                         c++;
  467.                         setTimeout(arguments.callee, 10);
  468.                         return;
  469.                     }
  470.                 }
  471.                 d.removeChild(b);
  472.                 a = null;
  473.                 am();
  474.             })();
  475.         } else {
  476.             am();
  477.         }
  478.     }
  479.  
  480.     function am() {
  481.         var g = aG.length;
  482.         if (g > 0) {
  483.             for (var h = 0; h < g; h++) {
  484.                 var c = aG[h].id;
  485.                 var l = aG[h].callbackFn;
  486.                 var a = {
  487.                     success: false,
  488.                     id: c
  489.                 };
  490.                 if (ah.pv[0] > 0) {
  491.                     var i = aS(c);
  492.                     if (i) {
  493.                         if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) {
  494.                             ay(c, true);
  495.                             if (l) {
  496.                                 a.success = true;
  497.                                 a.ref = av(c);
  498.                                 l(a);
  499.                             }
  500.                         } else {
  501.                             if (aG[h].expressInstall && au()) {
  502.                                 var e = {};
  503.                                 e.data = aG[h].expressInstall;
  504.                                 e.width = i.getAttribute("width") || "0";
  505.                                 e.height = i.getAttribute("height") || "0";
  506.                                 if (i.getAttribute("class")) {
  507.                                     e.styleclass = i.getAttribute("class");
  508.                                 }
  509.                                 if (i.getAttribute("align")) {
  510.                                     e.align = i.getAttribute("align");
  511.                                 }
  512.                                 var f = {};
  513.                                 var d = i.getElementsByTagName("param");
  514.                                 var k = d.length;
  515.                                 for (var j = 0; j < k; j++) {
  516.                                     if (d[j].getAttribute("name").toLowerCase() != "movie") {
  517.                                         f[d[j].getAttribute("name")] = d[j].getAttribute("value");
  518.                                     }
  519.                                 }
  520.                                 ae(e, f, c, l);
  521.                             } else {
  522.                                 aF(i);
  523.                                 if (l) {
  524.                                     l(a);
  525.                                 }
  526.                             }
  527.                         }
  528.                     }
  529.                 } else {
  530.                     ay(c, true);
  531.                     if (l) {
  532.                         var b = av(c);
  533.                         if (b && typeof b.SetVariable != aq) {
  534.                             a.success = true;
  535.                             a.ref = b;
  536.                         }
  537.                         l(a);
  538.                     }
  539.                 }
  540.             }
  541.         }
  542.     }
  543.  
  544.     function av(b) {
  545.         var d = null;
  546.         var c = aS(b);
  547.         if (c && c.nodeName == "OBJECT") {
  548.             if (typeof c.SetVariable != aq) {
  549.                 d = c;
  550.             } else {
  551.                 var a = c.getElementsByTagName(aD)[0];
  552.                 if (a) {
  553.                     d = a;
  554.                 }
  555.             }
  556.         }
  557.         return d;
  558.     }
  559.  
  560.     function au() {
  561.         return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312);
  562.     }
  563.  
  564.     function ae(f, d, h, e) {
  565.         aU = true;
  566.         ap = e || null;
  567.         at = {
  568.             success: false,
  569.             id: h
  570.         };
  571.         var a = aS(h);
  572.         if (a) {
  573.             if (a.nodeName == "OBJECT") {
  574.                 aJ = aO(a);
  575.                 ad = null;
  576.             } else {
  577.                 aJ = a;
  578.                 ad = h;
  579.             }
  580.             f.id = ac;
  581.             if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) {
  582.                 f.width = "310";
  583.             }
  584.             if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) {
  585.                 f.height = "137";
  586.             }
  587.             aL.title = aL.title.slice(0, 47) + " - Flash Player Installation";
  588.             var b = ah.ie && ah.win ? "ActiveX" : "PlugIn",
  589.                 c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title;
  590.             if (typeof d.flashvars != aq) {
  591.                 d.flashvars += "&" + c;
  592.             } else {
  593.                 d.flashvars = c;
  594.             }
  595.             if (ah.ie && ah.win && a.readyState != 4) {
  596.                 var g = ar("div");
  597.                 h += "SWFObjectNew";
  598.                 g.setAttribute("id", h);
  599.                 a.parentNode.insertBefore(g, a);
  600.                 a.style.display = "none";
  601.                 (function() {
  602.                     if (a.readyState == 4) {
  603.                         a.parentNode.removeChild(a);
  604.                     } else {
  605.                         setTimeout(arguments.callee, 10);
  606.                     }
  607.                 })();
  608.             }
  609.             aA(f, d, h);
  610.         }
  611.     }
  612.  
  613.     function aF(a) {
  614.         if (ah.ie && ah.win && a.readyState != 4) {
  615.             var b = ar("div");
  616.             a.parentNode.insertBefore(b, a);
  617.             b.parentNode.replaceChild(aO(a), b);
  618.             a.style.display = "none";
  619.             (function() {
  620.                 if (a.readyState == 4) {
  621.                     a.parentNode.removeChild(a);
  622.                 } else {
  623.                     setTimeout(arguments.callee, 10);
  624.                 }
  625.             })();
  626.         } else {
  627.             a.parentNode.replaceChild(aO(a), a);
  628.         }
  629.     }
  630.  
  631.     function aO(b) {
  632.         var d = ar("div");
  633.         if (ah.win && ah.ie) {
  634.             d.innerHTML = b.innerHTML;
  635.         } else {
  636.             var e = b.getElementsByTagName(aD)[0];
  637.             if (e) {
  638.                 var a = e.childNodes;
  639.                 if (a) {
  640.                     var f = a.length;
  641.                     for (var c = 0; c < f; c++) {
  642.                         if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) {
  643.                             d.appendChild(a[c].cloneNode(true));
  644.                         }
  645.                     }
  646.                 }
  647.             }
  648.         }
  649.         return d;
  650.     }
  651.  
  652.     function aA(e, g, c) {
  653.         var d, a = aS(c);
  654.         if (ah.wk && ah.wk < 312) {
  655.             return d;
  656.         }
  657.         if (a) {
  658.             if (typeof e.id == aq) {
  659.                 e.id = c;
  660.             }
  661.             if (ah.ie && ah.win) {
  662.                 var f = "";
  663.                 for (var i in e) {
  664.                     if (e[i] != Object.prototype[i]) {
  665.                         if (i.toLowerCase() == "data") {
  666.                             g.movie = e[i];
  667.                         } else {
  668.                             if (i.toLowerCase() == "styleclass") {
  669.                                 f += ' class="' + e[i] + '"';
  670.                             } else {
  671.                                 if (i.toLowerCase() != "classid") {
  672.                                     f += " " + i + '="' + e[i] + '"';
  673.                                 }
  674.                             }
  675.                         }
  676.                     }
  677.                 }
  678.                 var h = "";
  679.                 for (var j in g) {
  680.                     if (g[j] != Object.prototype[j]) {
  681.                         h += '<param name="' + j + '" value="' + g[j] + '" />';
  682.                     }
  683.                 }
  684.                 a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">" + h + "</object>";
  685.                 ag[ag.length] = e.id;
  686.                 d = aS(e.id);
  687.             } else {
  688.                 var b = ar(aD);
  689.                 b.setAttribute("type", aE);
  690.                 for (var k in e) {
  691.                     if (e[k] != Object.prototype[k]) {
  692.                         if (k.toLowerCase() == "styleclass") {
  693.                             b.setAttribute("class", e[k]);
  694.                         } else {
  695.                             if (k.toLowerCase() != "classid") {
  696.                                 b.setAttribute(k, e[k]);
  697.                             }
  698.                         }
  699.                     }
  700.                 }
  701.                 for (var l in g) {
  702.                     if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") {
  703.                         aQ(b, l, g[l]);
  704.                     }
  705.                 }
  706.                 a.parentNode.replaceChild(b, a);
  707.                 d = b;
  708.             }
  709.         }
  710.         return d;
  711.     }
  712.  
  713.     function aQ(b, d, c) {
  714.         var a = ar("param");
  715.         a.setAttribute("name", d);
  716.         a.setAttribute("value", c);
  717.         b.appendChild(a);
  718.     }
  719.  
  720.     function aw(a) {
  721.         var b = aS(a);
  722.         if (b && b.nodeName == "OBJECT") {
  723.             if (ah.ie && ah.win) {
  724.                 b.style.display = "none";
  725.                 (function() {
  726.                     if (b.readyState == 4) {
  727.                         aT(a);
  728.                     } else {
  729.                         setTimeout(arguments.callee, 10);
  730.                     }
  731.                 })();
  732.             } else {
  733.                 b.parentNode.removeChild(b);
  734.             }
  735.         }
  736.     }
  737.  
  738.     function aT(a) {
  739.         var b = aS(a);
  740.         if (b) {
  741.             for (var c in b) {
  742.                 if (typeof b[c] == "function") {
  743.                     b[c] = null;
  744.                 }
  745.             }
  746.             b.parentNode.removeChild(b);
  747.         }
  748.     }
  749.  
  750.     function aS(a) {
  751.         var c = null;
  752.         try {
  753.             c = aL.getElementById(a);
  754.         } catch (b) {}
  755.         return c;
  756.     }
  757.  
  758.     function ar(a) {
  759.         return aL.createElement(a);
  760.     }
  761.  
  762.     function aM(a, c, b) {
  763.         a.attachEvent(c, b);
  764.         al[al.length] = [a, c, b];
  765.     }
  766.  
  767.     function ao(a) {
  768.         var b = ah.pv,
  769.             c = a.split(".");
  770.         c[0] = parseInt(c[0], 10);
  771.         c[1] = parseInt(c[1], 10) || 0;
  772.         c[2] = parseInt(c[2], 10) || 0;
  773.         return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false;
  774.     }
  775.  
  776.     function az(b, f, a, c) {
  777.         if (ah.ie && ah.mac) {
  778.             return;
  779.         }
  780.         var e = aL.getElementsByTagName("head")[0];
  781.         if (!e) {
  782.             return;
  783.         }
  784.         var g = (a && typeof a == "string") ? a : "screen";
  785.         if (c) {
  786.             aH = null;
  787.             an = null;
  788.         }
  789.         if (!aH || an != g) {
  790.             var d = ar("style");
  791.             d.setAttribute("type", "text/css");
  792.             d.setAttribute("media", g);
  793.             aH = e.appendChild(d);
  794.             if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) {
  795.                 aH = aL.styleSheets[aL.styleSheets.length - 1];
  796.             }
  797.             an = g;
  798.         }
  799.         if (ah.ie && ah.win) {
  800.             if (aH && typeof aH.addRule == aD) {
  801.                 aH.addRule(b, f);
  802.             }
  803.         } else {
  804.             if (aH && typeof aL.createTextNode != aq) {
  805.                 aH.appendChild(aL.createTextNode(b + " {" + f + "}"));
  806.             }
  807.         }
  808.     }
  809.  
  810.     function ay(a, c) {
  811.         if (!aI) {
  812.             return;
  813.         }
  814.         var b = c ? "visible" : "hidden";
  815.         if (ak && aS(a)) {
  816.             aS(a).style.visibility = b;
  817.         } else {
  818.             az("#" + a, "visibility:" + b);
  819.         }
  820.     }
  821.  
  822.     function ai(b) {
  823.         var a = /[\\\"<>\.;]/;
  824.         var c = a.exec(b) != null;
  825.         return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b;
  826.     }
  827.     var aR = function() {
  828.         if (ah.ie && ah.win) {
  829.             window.attachEvent("onunload", function() {
  830.                 var a = al.length;
  831.                 for (var b = 0; b < a; b++) {
  832.                     al[b][0].detachEvent(al[b][1], al[b][2]);
  833.                 }
  834.                 var d = ag.length;
  835.                 for (var c = 0; c < d; c++) {
  836.                     aw(ag[c]);
  837.                 }
  838.                 for (var e in ah) {
  839.                     ah[e] = null;
  840.                 }
  841.                 ah = null;
  842.                 for (var f in swfobject) {
  843.                     swfobject[f] = null;
  844.                 }
  845.                 swfobject = null;
  846.             });
  847.         }
  848.     }();
  849.     return {
  850.         registerObject: function(a, e, c, b) {
  851.             if (ah.w3 && a && e) {
  852.                 var d = {};
  853.                 d.id = a;
  854.                 d.swfVersion = e;
  855.                 d.expressInstall = c;
  856.                 d.callbackFn = b;
  857.                 aG[aG.length] = d;
  858.                 ay(a, false);
  859.             } else {
  860.                 if (b) {
  861.                     b({
  862.                         success: false,
  863.                         id: a
  864.                     });
  865.                 }
  866.             }
  867.         },
  868.         getObjectById: function(a) {
  869.             if (ah.w3) {
  870.                 return av(a);
  871.             }
  872.         },
  873.         embedSWF: function(k, e, h, f, c, a, b, i, g, j) {
  874.             var d = {
  875.                 success: false,
  876.                 id: e
  877.             };
  878.             if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) {
  879.                 ay(e, false);
  880.                 aj(function() {
  881.                     h += "";
  882.                     f += "";
  883.                     var q = {};
  884.                     if (g && typeof g === aD) {
  885.                         for (var o in g) {
  886.                             q[o] = g[o];
  887.                         }
  888.                     }
  889.                     q.data = k;
  890.                     q.width = h;
  891.                     q.height = f;
  892.                     var n = {};
  893.                     if (i && typeof i === aD) {
  894.                         for (var p in i) {
  895.                             n[p] = i[p];
  896.                         }
  897.                     }
  898.                     if (b && typeof b === aD) {
  899.                         for (var l in b) {
  900.                             if (typeof n.flashvars != aq) {
  901.                                 n.flashvars += "&" + l + "=" + b[l];
  902.                             } else {
  903.                                 n.flashvars = l + "=" + b[l];
  904.                             }
  905.                         }
  906.                     }
  907.                     if (ao(c)) {
  908.                         var m = aA(q, n, e);
  909.                         if (q.id == e) {
  910.                             ay(e, true);
  911.                         }
  912.                         d.success = true;
  913.                         d.ref = m;
  914.                     } else {
  915.                         if (a && au()) {
  916.                             q.data = a;
  917.                             ae(q, n, e, j);
  918.                             return;
  919.                         } else {
  920.                             ay(e, true);
  921.                         }
  922.                     }
  923.                     if (j) {
  924.                         j(d);
  925.                     }
  926.                 });
  927.             } else {
  928.                 if (j) {
  929.                     j(d);
  930.                 }
  931.             }
  932.         },
  933.         switchOffAutoHideShow: function() {
  934.             aI = false;
  935.         },
  936.         ua: ah,
  937.         getFlashPlayerVersion: function() {
  938.             return {
  939.                 major: ah.pv[0],
  940.                 minor: ah.pv[1],
  941.                 release: ah.pv[2]
  942.             };
  943.         },
  944.         hasFlashPlayerVersion: ao,
  945.         createSWF: function(a, b, c) {
  946.             if (ah.w3) {
  947.                 return aA(a, b, c);
  948.             } else {
  949.                 return undefined;
  950.             }
  951.         },
  952.         showExpressInstall: function(b, a, d, c) {
  953.             if (ah.w3 && au()) {
  954.                 ae(b, a, d, c);
  955.             }
  956.         },
  957.         removeSWF: function(a) {
  958.             if (ah.w3) {
  959.                 aw(a);
  960.             }
  961.         },
  962.         createCSS: function(b, a, c, d) {
  963.             if (ah.w3) {
  964.                 az(b, a, c, d);
  965.             }
  966.         },
  967.         addDomLoadEvent: aj,
  968.         addLoadEvent: aC,
  969.         getQueryParamValue: function(b) {
  970.             var a = aL.location.search || aL.location.hash;
  971.             if (a) {
  972.                 if (/\?/.test(a)) {
  973.                     a = a.split("?")[1];
  974.                 }
  975.                 if (b == null) {
  976.                     return ai(a);
  977.                 }
  978.                 var c = a.split("&");
  979.                 for (var d = 0; d < c.length; d++) {
  980.                     if (c[d].substring(0, c[d].indexOf("=")) == b) {
  981.                         return ai(c[d].substring((c[d].indexOf("=") + 1)));
  982.                     }
  983.                 }
  984.             }
  985.             return "";
  986.         },
  987.         expressInstallCallback: function() {
  988.             if (aU) {
  989.                 var a = aS(ac);
  990.                 if (a && aJ) {
  991.                     a.parentNode.replaceChild(aJ, a);
  992.                     if (ad) {
  993.                         ay(ad, true);
  994.                         if (ah.ie && ah.win) {
  995.                             aJ.style.display = "block";
  996.                         }
  997.                     }
  998.                     if (ap) {
  999.                         ap(at);
  1000.                     }
  1001.                 }
  1002.                 aU = false;
  1003.             }
  1004.         }
  1005.     };
  1006. }();
  1007. var SWFUpload;
  1008. if (SWFUpload == undefined) {
  1009.     SWFUpload = function(b) {
  1010.         this.initSWFUpload(b);
  1011.     };
  1012. }
  1013. SWFUpload.prototype.initSWFUpload = function(c) {
  1014.     try {
  1015.         this.customSettings = {};
  1016.         this.settings = c;
  1017.         this.eventQueue = [];
  1018.         this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
  1019.         this.movieElement = null;
  1020.         SWFUpload.instances[this.movieName] = this;
  1021.         this.initSettings();
  1022.         this.loadFlash();
  1023.         this.displayDebugInfo();
  1024.     } catch (d) {
  1025.         delete SWFUpload.instances[this.movieName];
  1026.         throw d;
  1027.     }
  1028. };
  1029. SWFUpload.instances = {};
  1030. SWFUpload.movieCount = 0;
  1031. SWFUpload.version = "2.2.0 2009-03-25";
  1032. SWFUpload.QUEUE_ERROR = {
  1033.     QUEUE_LIMIT_EXCEEDED: -100,
  1034.     FILE_EXCEEDS_SIZE_LIMIT: -110,
  1035.     ZERO_BYTE_FILE: -120,
  1036.     INVALID_FILETYPE: -130
  1037. };
  1038. SWFUpload.UPLOAD_ERROR = {
  1039.     HTTP_ERROR: -200,
  1040.     MISSING_UPLOAD_URL: -210,
  1041.     IO_ERROR: -220,
  1042.     SECURITY_ERROR: -230,
  1043.     UPLOAD_LIMIT_EXCEEDED: -240,
  1044.     UPLOAD_FAILED: -250,
  1045.     SPECIFIED_FILE_ID_NOT_FOUND: -260,
  1046.     FILE_VALIDATION_FAILED: -270,
  1047.     FILE_CANCELLED: -280,
  1048.     UPLOAD_STOPPED: -290
  1049. };
  1050. SWFUpload.FILE_STATUS = {
  1051.     QUEUED: -1,
  1052.     IN_PROGRESS: -2,
  1053.     ERROR: -3,
  1054.     COMPLETE: -4,
  1055.     CANCELLED: -5
  1056. };
  1057. SWFUpload.BUTTON_ACTION = {
  1058.     SELECT_FILE: -100,
  1059.     SELECT_FILES: -110,
  1060.     START_UPLOAD: -120
  1061. };
  1062. SWFUpload.CURSOR = {
  1063.     ARROW: -1,
  1064.     HAND: -2
  1065. };
  1066. SWFUpload.WINDOW_MODE = {
  1067.     WINDOW: "window",
  1068.     TRANSPARENT: "transparent",
  1069.     OPAQUE: "opaque"
  1070. };
  1071. SWFUpload.completeURL = function(e) {
  1072.     if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) {
  1073.         return e;
  1074.     }
  1075.     var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
  1076.     var d = window.location.pathname.lastIndexOf("/");
  1077.     if (d <= 0) {
  1078.         path = "/";
  1079.     } else {
  1080.         path = window.location.pathname.substr(0, d) + "/";
  1081.     }
  1082.     return path + e;
  1083. };
  1084. SWFUpload.prototype.initSettings = function() {
  1085.     this.ensureDefault = function(c, d) {
  1086.         this.settings[c] = (this.settings[c] == undefined) ? d : this.settings[c];
  1087.     };
  1088.     this.ensureDefault("upload_url", "");
  1089.     this.ensureDefault("preserve_relative_urls", false);
  1090.     this.ensureDefault("file_post_name", "Filedata");
  1091.     this.ensureDefault("post_params", {});
  1092.     this.ensureDefault("use_query_string", false);
  1093.     this.ensureDefault("requeue_on_error", false);
  1094.     this.ensureDefault("http_success", []);
  1095.     this.ensureDefault("assume_success_timeout", 0);
  1096.     this.ensureDefault("file_types", "*.*");
  1097.     this.ensureDefault("file_types_description", "All Files");
  1098.     this.ensureDefault("file_size_limit", 0);
  1099.     this.ensureDefault("file_upload_limit", 0);
  1100.     this.ensureDefault("file_queue_limit", 0);
  1101.     this.ensureDefault("flash_url", "swfupload.swf");
  1102.     this.ensureDefault("prevent_swf_caching", true);
  1103.     this.ensureDefault("button_image_url", "");
  1104.     this.ensureDefault("button_width", 1);
  1105.     this.ensureDefault("button_height", 1);
  1106.     this.ensureDefault("button_text", "");
  1107.     this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
  1108.     this.ensureDefault("button_text_top_padding", 0);
  1109.     this.ensureDefault("button_text_left_padding", 0);
  1110.     this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
  1111.     this.ensureDefault("button_disabled", false);
  1112.     this.ensureDefault("button_placeholder_id", "");
  1113.     this.ensureDefault("button_placeholder", null);
  1114.     this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
  1115.     this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
  1116.     this.ensureDefault("debug", false);
  1117.     this.settings.debug_enabled = this.settings.debug;
  1118.     this.settings.return_upload_start_handler = this.returnUploadStart;
  1119.     this.ensureDefault("swfupload_loaded_handler", null);
  1120.     this.ensureDefault("file_dialog_start_handler", null);
  1121.     this.ensureDefault("file_queued_handler", null);
  1122.     this.ensureDefault("file_queue_error_handler", null);
  1123.     this.ensureDefault("file_dialog_complete_handler", null);
  1124.     this.ensureDefault("upload_start_handler", null);
  1125.     this.ensureDefault("upload_progress_handler", null);
  1126.     this.ensureDefault("upload_error_handler", null);
  1127.     this.ensureDefault("upload_success_handler", null);
  1128.     this.ensureDefault("upload_complete_handler", null);
  1129.     this.ensureDefault("debug_handler", this.debugMessage);
  1130.     this.ensureDefault("custom_settings", {});
  1131.     this.customSettings = this.settings.custom_settings;
  1132.     if (!!this.settings.prevent_swf_caching) {
  1133.         this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
  1134.     }
  1135.     if (!this.settings.preserve_relative_urls) {
  1136.         this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
  1137.         this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
  1138.     }
  1139.     delete this.ensureDefault;
  1140. };
  1141. SWFUpload.prototype.loadFlash = function() {
  1142.     var d, c;
  1143.     if (document.getElementById(this.movieName) !== null) {
  1144.         throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
  1145.     }
  1146.     d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
  1147.     if (d == undefined) {
  1148.         throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
  1149.     }
  1150.     c = document.createElement("div");
  1151.     c.innerHTML = this.getFlashHTML();
  1152.     d.parentNode.replaceChild(c.firstChild, d);
  1153.     if (window[this.movieName] == undefined) {
  1154.         window[this.movieName] = this.getMovieElement();
  1155.     }
  1156. };
  1157. SWFUpload.prototype.getFlashHTML = function() {
  1158.     return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', '<param name="wmode" value="', this.settings.button_window_mode, '" />', '<param name="movie" value="', this.settings.flash_url, '" />', '<param name="quality" value="high" />', '<param name="menu" value="false" />', '<param name="allowScriptAccess" value="always" />', '<param name="flashvars" value="' + this.getFlashVars() + '" />', "</object>"].join("");
  1159. };
  1160. SWFUpload.prototype.getFlashVars = function() {
  1161.     var c = this.buildParamString();
  1162.     var d = this.settings.http_success.join(",");
  1163.     return ["movieName=", encodeURIComponent(this.movieName), "&amp;uploadURL=", encodeURIComponent(this.settings.upload_url), "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string), "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&amp;httpSuccess=", encodeURIComponent(d), "&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&amp;params=", encodeURIComponent(c), "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name), "&amp;fileTypes=", encodeURIComponent(this.settings.file_types), "&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&amp;buttonWidth=", encodeURIComponent(this.settings.button_width), "&amp;buttonHeight=", encodeURIComponent(this.settings.button_height), "&amp;buttonText=", encodeURIComponent(this.settings.button_text), "&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&amp;buttonAction=", encodeURIComponent(this.settings.button_action), "&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join("");
  1164. };
  1165. SWFUpload.prototype.getMovieElement = function() {
  1166.     if (this.movieElement == undefined) {
  1167.         this.movieElement = document.getElementById(this.movieName);
  1168.     }
  1169.     if (this.movieElement === null) {
  1170.         throw "Could not find Flash element";
  1171.     }
  1172.     return this.movieElement;
  1173. };
  1174. SWFUpload.prototype.buildParamString = function() {
  1175.     var f = this.settings.post_params;
  1176.     var d = [];
  1177.     if (typeof(f) === "object") {
  1178.         for (var e in f) {
  1179.             if (f.hasOwnProperty(e)) {
  1180.                 d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString()));
  1181.             }
  1182.         }
  1183.     }
  1184.     return d.join("&amp;");
  1185. };
  1186. SWFUpload.prototype.destroy = function() {
  1187.     try {
  1188.         this.cancelUpload(null, false);
  1189.         var g = null;
  1190.         g = this.getMovieElement();
  1191.         if (g && typeof(g.CallFunction) === "unknown") {
  1192.             for (var j in g) {
  1193.                 try {
  1194.                     if (typeof(g[j]) === "function") {
  1195.                         g[j] = null;
  1196.                     }
  1197.                 } catch (h) {}
  1198.             }
  1199.             try {
  1200.                 g.parentNode.removeChild(g);
  1201.             } catch (f) {}
  1202.         }
  1203.         window[this.movieName] = null;
  1204.         SWFUpload.instances[this.movieName] = null;
  1205.         delete SWFUpload.instances[this.movieName];
  1206.         this.movieElement = null;
  1207.         this.settings = null;
  1208.         this.customSettings = null;
  1209.         this.eventQueue = null;
  1210.         this.movieName = null;
  1211.         return true;
  1212.     } catch (i) {
  1213.         return false;
  1214.     }
  1215. };
  1216. SWFUpload.prototype.displayDebugInfo = function() {
  1217.     this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url:               ", this.settings.upload_url, "\n", "\t", "flash_url:                ", this.settings.flash_url, "\n", "\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success:             ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name:           ", this.settings.file_post_name, "\n", "\t", "post_params:              ", this.settings.post_params.toString(), "\n", "\t", "file_types:               ", this.settings.file_types, "\n", "\t", "file_types_description:   ", this.settings.file_types_description, "\n", "\t", "file_size_limit:          ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n", "\t", "debug:                    ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n", "\t", "button_width:             ", this.settings.button_width.toString(), "\n", "\t", "button_height:            ", this.settings.button_height.toString(), "\n", "\t", "button_text:              ", this.settings.button_text.toString(), "\n", "\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action:            ", this.settings.button_action.toString(), "\n", "\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join(""));
  1218. };
  1219. SWFUpload.prototype.addSetting = function(d, f, e) {
  1220.     if (f == undefined) {
  1221.         return (this.settings[d] = e);
  1222.     } else {
  1223.         return (this.settings[d] = f);
  1224.     }
  1225. };
  1226. SWFUpload.prototype.getSetting = function(b) {
  1227.     if (this.settings[b] != undefined) {
  1228.         return this.settings[b];
  1229.     }
  1230.     return "";
  1231. };
  1232. SWFUpload.prototype.callFlash = function(functionName, argumentArray) {
  1233.     argumentArray = argumentArray || [];
  1234.     var movieElement = this.getMovieElement();
  1235.     var returnValue, returnString;
  1236.     try {
  1237.         returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + "</invoke>");
  1238.         returnValue = eval(returnString);
  1239.     } catch (ex) {
  1240.         throw "Call to " + functionName + " failed";
  1241.     }
  1242.     if (returnValue != undefined && typeof returnValue.post === "object") {
  1243.         returnValue = this.unescapeFilePostParams(returnValue);
  1244.     }
  1245.     return returnValue;
  1246. };
  1247. SWFUpload.prototype.selectFile = function() {
  1248.     this.callFlash("SelectFile");
  1249. };
  1250. SWFUpload.prototype.selectFiles = function() {
  1251.     this.callFlash("SelectFiles");
  1252. };
  1253. SWFUpload.prototype.startUpload = function(b) {
  1254.     this.callFlash("StartUpload", [b]);
  1255. };
  1256. SWFUpload.prototype.cancelUpload = function(d, c) {
  1257.     if (c !== false) {
  1258.         c = true;
  1259.     }
  1260.     this.callFlash("CancelUpload", [d, c]);
  1261. };
  1262. SWFUpload.prototype.stopUpload = function() {
  1263.     this.callFlash("StopUpload");
  1264. };
  1265. SWFUpload.prototype.getStats = function() {
  1266.     return this.callFlash("GetStats");
  1267. };
  1268. SWFUpload.prototype.setStats = function(b) {
  1269.     this.callFlash("SetStats", [b]);
  1270. };
  1271. SWFUpload.prototype.getFile = function(b) {
  1272.     if (typeof(b) === "number") {
  1273.         return this.callFlash("GetFileByIndex", [b]);
  1274.     } else {
  1275.         return this.callFlash("GetFile", [b]);
  1276.     }
  1277. };
  1278. SWFUpload.prototype.addFileParam = function(e, d, f) {
  1279.     return this.callFlash("AddFileParam", [e, d, f]);
  1280. };
  1281. SWFUpload.prototype.removeFileParam = function(d, c) {
  1282.     this.callFlash("RemoveFileParam", [d, c]);
  1283. };
  1284. SWFUpload.prototype.setUploadURL = function(b) {
  1285.     this.settings.upload_url = b.toString();
  1286.     this.callFlash("SetUploadURL", [b]);
  1287. };
  1288. SWFUpload.prototype.setPostParams = function(b) {
  1289.     this.settings.post_params = b;
  1290.     this.callFlash("SetPostParams", [b]);
  1291. };
  1292. SWFUpload.prototype.addPostParam = function(d, c) {
  1293.     this.settings.post_params[d] = c;
  1294.     this.callFlash("SetPostParams", [this.settings.post_params]);
  1295. };
  1296. SWFUpload.prototype.removePostParam = function(b) {
  1297.     delete this.settings.post_params[b];
  1298.     this.callFlash("SetPostParams", [this.settings.post_params]);
  1299. };
  1300. SWFUpload.prototype.setFileTypes = function(d, c) {
  1301.     this.settings.file_types = d;
  1302.     this.settings.file_types_description = c;
  1303.     this.callFlash("SetFileTypes", [d, c]);
  1304. };
  1305. SWFUpload.prototype.setFileSizeLimit = function(b) {
  1306.     this.settings.file_size_limit = b;
  1307.     this.callFlash("SetFileSizeLimit", [b]);
  1308. };
  1309. SWFUpload.prototype.setFileUploadLimit = function(b) {
  1310.     this.settings.file_upload_limit = b;
  1311.     this.callFlash("SetFileUploadLimit", [b]);
  1312. };
  1313. SWFUpload.prototype.setFileQueueLimit = function(b) {
  1314.     this.settings.file_queue_limit = b;
  1315.     this.callFlash("SetFileQueueLimit", [b]);
  1316. };
  1317. SWFUpload.prototype.setFilePostName = function(b) {
  1318.     this.settings.file_post_name = b;
  1319.     this.callFlash("SetFilePostName", [b]);
  1320. };
  1321. SWFUpload.prototype.setUseQueryString = function(b) {
  1322.     this.settings.use_query_string = b;
  1323.     this.callFlash("SetUseQueryString", [b]);
  1324. };
  1325. SWFUpload.prototype.setRequeueOnError = function(b) {
  1326.     this.settings.requeue_on_error = b;
  1327.     this.callFlash("SetRequeueOnError", [b]);
  1328. };
  1329. SWFUpload.prototype.setHTTPSuccess = function(b) {
  1330.     if (typeof b === "string") {
  1331.         b = b.replace(" ", "").split(",");
  1332.     }
  1333.     this.settings.http_success = b;
  1334.     this.callFlash("SetHTTPSuccess", [b]);
  1335. };
  1336. SWFUpload.prototype.setAssumeSuccessTimeout = function(b) {
  1337.     this.settings.assume_success_timeout = b;
  1338.     this.callFlash("SetAssumeSuccessTimeout", [b]);
  1339. };
  1340. SWFUpload.prototype.setDebugEnabled = function(b) {
  1341.     this.settings.debug_enabled = b;
  1342.     this.callFlash("SetDebugEnabled", [b]);
  1343. };
  1344. SWFUpload.prototype.setButtonImageURL = function(b) {
  1345.     if (b == undefined) {
  1346.         b = "";
  1347.     }
  1348.     this.settings.button_image_url = b;
  1349.     this.callFlash("SetButtonImageURL", [b]);
  1350. };
  1351. SWFUpload.prototype.setButtonDimensions = function(f, e) {
  1352.     this.settings.button_width = f;
  1353.     this.settings.button_height = e;
  1354.     var d = this.getMovieElement();
  1355.     if (d != undefined) {
  1356.         d.style.width = f + "px";
  1357.         d.style.height = e + "px";
  1358.     }
  1359.     this.callFlash("SetButtonDimensions", [f, e]);
  1360. };
  1361. SWFUpload.prototype.setButtonText = function(b) {
  1362.     this.settings.button_text = b;
  1363.     this.callFlash("SetButtonText", [b]);
  1364. };
  1365. SWFUpload.prototype.setButtonTextPadding = function(c, d) {
  1366.     this.settings.button_text_top_padding = d;
  1367.     this.settings.button_text_left_padding = c;
  1368.     this.callFlash("SetButtonTextPadding", [c, d]);
  1369. };
  1370. SWFUpload.prototype.setButtonTextStyle = function(b) {
  1371.     this.settings.button_text_style = b;
  1372.     this.callFlash("SetButtonTextStyle", [b]);
  1373. };
  1374. SWFUpload.prototype.setButtonDisabled = function(b) {
  1375.     this.settings.button_disabled = b;
  1376.     this.callFlash("SetButtonDisabled", [b]);
  1377. };
  1378. SWFUpload.prototype.setButtonAction = function(b) {
  1379.     this.settings.button_action = b;
  1380.     this.callFlash("SetButtonAction", [b]);
  1381. };
  1382. SWFUpload.prototype.setButtonCursor = function(b) {
  1383.     this.settings.button_cursor = b;
  1384.     this.callFlash("SetButtonCursor", [b]);
  1385. };
  1386. SWFUpload.prototype.queueEvent = function(d, f) {
  1387.     if (f == undefined) {
  1388.         f = [];
  1389.     } else {
  1390.         if (!(f instanceof Array)) {
  1391.             f = [f];
  1392.         }
  1393.     }
  1394.     var e = this;
  1395.     if (typeof this.settings[d] === "function") {
  1396.         this.eventQueue.push(function() {
  1397.             this.settings[d].apply(this, f);
  1398.         });
  1399.         setTimeout(function() {
  1400.             e.executeNextEvent();
  1401.         }, 0);
  1402.     } else {
  1403.         if (this.settings[d] !== null) {
  1404.             throw "Event handler " + d + " is unknown or is not a function";
  1405.         }
  1406.     }
  1407. };
  1408. SWFUpload.prototype.executeNextEvent = function() {
  1409.     var b = this.eventQueue ? this.eventQueue.shift() : null;
  1410.     if (typeof(b) === "function") {
  1411.         b.apply(this);
  1412.     }
  1413. };
  1414. SWFUpload.prototype.unescapeFilePostParams = function(l) {
  1415.     var j = /[$]([0-9a-f]{4})/i;
  1416.     var i = {};
  1417.     var k;
  1418.     if (l != undefined) {
  1419.         for (var h in l.post) {
  1420.             if (l.post.hasOwnProperty(h)) {
  1421.                 k = h;
  1422.                 var g;
  1423.                 while ((g = j.exec(k)) !== null) {
  1424.                     k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16)));
  1425.                 }
  1426.                 i[k] = l.post[h];
  1427.             }
  1428.         }
  1429.         l.post = i;
  1430.     }
  1431.     return l;
  1432. };
  1433. SWFUpload.prototype.testExternalInterface = function() {
  1434.     try {
  1435.         return this.callFlash("TestExternalInterface");
  1436.     } catch (b) {
  1437.         return false;
  1438.     }
  1439. };
  1440. SWFUpload.prototype.flashReady = function() {
  1441.     var b = this.getMovieElement();
  1442.     if (!b) {
  1443.         this.debug("Flash called back ready but the flash movie can't be found.");
  1444.         return;
  1445.     }
  1446.     this.cleanUp(b);
  1447.     this.queueEvent("swfupload_loaded_handler");
  1448. };
  1449. SWFUpload.prototype.cleanUp = function(f) {
  1450.     try {
  1451.         if (this.movieElement && typeof(f.CallFunction) === "unknown") {
  1452.             this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
  1453.             for (var h in f) {
  1454.                 try {
  1455.                     if (typeof(f[h]) === "function") {
  1456.                         f[h] = null;
  1457.                     }
  1458.                 } catch (e) {}
  1459.             }
  1460.         }
  1461.     } catch (g) {}
  1462.     window.__flash__removeCallback = function(c, b) {
  1463.         try {
  1464.             if (c) {
  1465.                 c[b] = null;
  1466.             }
  1467.         } catch (a) {}
  1468.     };
  1469. };
  1470. SWFUpload.prototype.fileDialogStart = function() {
  1471.     this.queueEvent("file_dialog_start_handler");
  1472. };
  1473. SWFUpload.prototype.fileQueued = function(b) {
  1474.     b = this.unescapeFilePostParams(b);
  1475.     this.queueEvent("file_queued_handler", b);
  1476. };
  1477. SWFUpload.prototype.fileQueueError = function(e, f, d) {
  1478.     e = this.unescapeFilePostParams(e);
  1479.     this.queueEvent("file_queue_error_handler", [e, f, d]);
  1480. };
  1481. SWFUpload.prototype.fileDialogComplete = function(d, f, e) {
  1482.     this.queueEvent("file_dialog_complete_handler", [d, f, e]);
  1483. };
  1484. SWFUpload.prototype.uploadStart = function(b) {
  1485.     b = this.unescapeFilePostParams(b);
  1486.     this.queueEvent("return_upload_start_handler", b);
  1487. };
  1488. SWFUpload.prototype.returnUploadStart = function(d) {
  1489.     var c;
  1490.     if (typeof this.settings.upload_start_handler === "function") {
  1491.         d = this.unescapeFilePostParams(d);
  1492.         c = this.settings.upload_start_handler.call(this, d);
  1493.     } else {
  1494.         if (this.settings.upload_start_handler != undefined) {
  1495.             throw "upload_start_handler must be a function";
  1496.         }
  1497.     }
  1498.     if (c === undefined) {
  1499.         c = true;
  1500.     }
  1501.     c = !!c;
  1502.     this.callFlash("ReturnUploadStart", [c]);
  1503. };
  1504. SWFUpload.prototype.uploadProgress = function(e, f, d) {
  1505.     e = this.unescapeFilePostParams(e);
  1506.     this.queueEvent("upload_progress_handler", [e, f, d]);
  1507. };
  1508. SWFUpload.prototype.uploadError = function(e, f, d) {
  1509.     e = this.unescapeFilePostParams(e);
  1510.     this.queueEvent("upload_error_handler", [e, f, d]);
  1511. };
  1512. SWFUpload.prototype.uploadSuccess = function(d, e, f) {
  1513.     d = this.unescapeFilePostParams(d);
  1514.     this.queueEvent("upload_success_handler", [d, e, f]);
  1515. };
  1516. SWFUpload.prototype.uploadComplete = function(b) {
  1517.     b = this.unescapeFilePostParams(b);
  1518.     this.queueEvent("upload_complete_handler", b);
  1519. };
  1520. SWFUpload.prototype.debug = function(b) {
  1521.     this.queueEvent("debug_handler", b);
  1522. };
  1523. SWFUpload.prototype.debugMessage = function(h) {
  1524.     if (this.settings.debug) {
  1525.         var f, g = [];
  1526.         if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") {
  1527.             for (var e in h) {
  1528.                 if (h.hasOwnProperty(e)) {
  1529.                     g.push(e + ": " + h[e]);
  1530.                 }
  1531.             }
  1532.             f = g.join("\n") || "";
  1533.             g = f.split("\n");
  1534.             f = "EXCEPTION: " + g.join("\nEXCEPTION: ");
  1535.             SWFUpload.Console.writeLine(f);
  1536.         } else {
  1537.             SWFUpload.Console.writeLine(h);
  1538.         }
  1539.     }
  1540. };
  1541. SWFUpload.Console = {};
  1542. SWFUpload.Console.writeLine = function(g) {
  1543.     var e, f;
  1544.     try {
  1545.         e = document.getElementById("SWFUpload_Console");
  1546.         if (!e) {
  1547.             f = document.createElement("form");
  1548.             document.getElementsByTagName("body")[0].appendChild(f);
  1549.             e = document.createElement("textarea");
  1550.             e.id = "SWFUpload_Console";
  1551.             e.style.fontFamily = "monospace";
  1552.             e.setAttribute("wrap", "off");
  1553.             e.wrap = "off";
  1554.             e.style.overflow = "auto";
  1555.             e.style.width = "700px";
  1556.             e.style.height = "350px";
  1557.             e.style.margin = "5px";
  1558.             f.appendChild(e);
  1559.         }
  1560.         e.value += g + "\n";
  1561.         e.scrollTop = e.scrollHeight - e.clientHeight;
  1562.     } catch (h) {
  1563.         alert("Exception: " + h.name + " Message: " + h.message);
  1564.     }
  1565. };
  1566. (function(c) {
  1567.     var b = {
  1568.         init: function(d, e) {
  1569.             return this.each(function() {
  1570.                 var n = c(this);
  1571.                 var m = n.clone();
  1572.                 var j = c.extend({
  1573.                     id: n.attr("id"),
  1574.                     swf: "uploadify.swf",
  1575.                     uploader: "uploadify.php",
  1576.                     auto: true,
  1577.                     buttonClass: "",
  1578.                     buttonCursor: "hand",
  1579.                     buttonImage: null,
  1580.                     buttonText: "SELECT FILES",
  1581.                     checkExisting: false,
  1582.                     debug: false,
  1583.                     fileObjName: "Filedata",
  1584.                     fileSizeLimit: 0,
  1585.                     fileTypeDesc: "All Files",
  1586.                     fileTypeExts: "*.*",
  1587.                     height: 30,
  1588.                     method: "post",
  1589.                     multi: true,
  1590.                     formData: {},
  1591.                     preventCaching: true,
  1592.                     progressData: "percentage",
  1593.                     queueID: false,
  1594.                     queueSizeLimit: 999,
  1595.                     removeCompleted: true,
  1596.                     removeTimeout: 3,
  1597.                     requeueErrors: false,
  1598.                     successTimeout: 30,
  1599.                     uploadLimit: 0,
  1600.                     width: 120,
  1601.                     overrideEvents: []
  1602.                 }, d);
  1603.                 var g = {
  1604.                     assume_success_timeout: j.successTimeout,
  1605.                     button_placeholder_id: j.id,
  1606.                     button_width: j.width,
  1607.                     button_height: j.height,
  1608.                     button_text: null,
  1609.                     button_text_style: null,
  1610.                     button_text_top_padding: 0,
  1611.                     button_text_left_padding: 0,
  1612.                     button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE),
  1613.                     button_disabled: false,
  1614.                     button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND),
  1615.                     button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
  1616.                     debug: j.debug,
  1617.                     requeue_on_error: j.requeueErrors,
  1618.                     file_post_name: j.fileObjName,
  1619.                     file_size_limit: j.fileSizeLimit,
  1620.                     file_types: j.fileTypeExts,
  1621.                     file_types_description: j.fileTypeDesc,
  1622.                     file_queue_limit: j.queueSizeLimit,
  1623.                     file_upload_limit: j.uploadLimit,
  1624.                     flash_url: j.swf,
  1625.                     prevent_swf_caching: j.preventCaching,
  1626.                     post_params: j.formData,
  1627.                     upload_url: j.uploader,
  1628.                     use_query_string: (j.method == "get"),
  1629.                     file_dialog_complete_handler: a.onDialogClose,
  1630.                     file_dialog_start_handler: a.onDialogOpen,
  1631.                     file_queued_handler: a.onSelect,
  1632.                     file_queue_error_handler: a.onSelectError,
  1633.                     swfupload_loaded_handler: j.onSWFReady,
  1634.                     upload_complete_handler: a.onUploadComplete,
  1635.                     upload_error_handler: a.onUploadError,
  1636.                     upload_progress_handler: a.onUploadProgress,
  1637.                     upload_start_handler: a.onUploadStart,
  1638.                     upload_success_handler: a.onUploadSuccess
  1639.                 };
  1640.                 if (e) {
  1641.                     g = c.extend(g, e);
  1642.                 }
  1643.                 g = c.extend(g, j);
  1644.                 var o = swfobject.getFlashPlayerVersion();
  1645.                 var h = (o.major >= 9);
  1646.                 if (h) {
  1647.                     window["uploadify_" + j.id] = new SWFUpload(g);
  1648.                     var i = window["uploadify_" + j.id];
  1649.                     n.data("uploadify", i);
  1650.                     var l = c("<div />", {
  1651.                         id: j.id,
  1652.                         "class": "uploadify",
  1653.                         css: {
  1654.                             height: j.height + "px",
  1655.                             width: j.width + "px"
  1656.                         }
  1657.                     });
  1658.                     c("#" + i.movieName).wrap(l);
  1659.                     l = c("#" + j.id);
  1660.                     l.data("uploadify", i);
  1661.                     var f = c("<div />", {
  1662.                         id: j.id + "-button",
  1663.                         "class": "uploadify-button " + j.buttonClass
  1664.                     });
  1665.                     if (j.buttonImage) {
  1666.                         f.css({
  1667.                             "background-image": "url('" + j.buttonImage + "')",
  1668.                             "text-indent": "-9999px"
  1669.                         });
  1670.                     }
  1671.                     f.html('<span class="uploadify-button-text">' + j.buttonText + "</span>").css({
  1672.                         height: j.height + "px",
  1673.                         "line-height": j.height + "px",
  1674.                         width: j.width + "px"
  1675.                     });
  1676.                     l.append(f);
  1677.                     c("#" + i.movieName).css({
  1678.                         position: "relative",
  1679.                         "z-index": 1
  1680.                     });
  1681.                     if (!j.queueID) {
  1682.                         var k = c("<div />", {
  1683.                             id: j.id + "-queue",
  1684.                             "class": "uploadify-queue"
  1685.                         });
  1686.                         l.after(k);
  1687.                         i.settings.queueID = j.id + "-queue";
  1688.                         i.settings.defaultQueue = true;
  1689.                     }
  1690.                     i.queueData = {
  1691.                         files: {},
  1692.                         filesSelected: 0,
  1693.                         filesQueued: 0,
  1694.                         filesReplaced: 0,
  1695.                         filesCancelled: 0,
  1696.                         filesErrored: 0,
  1697.                         uploadsSuccessful: 0,
  1698.                         uploadsErrored: 0,
  1699.                         averageSpeed: 0,
  1700.                         queueLength: 0,
  1701.                         queueSize: 0,
  1702.                         uploadSize: 0,
  1703.                         queueBytesUploaded: 0,
  1704.                         uploadQueue: [],
  1705.                         errorMsg: "Some files were not added to the queue:"
  1706.                     };
  1707.                     i.original = m;
  1708.                     i.wrapper = l;
  1709.                     i.button = f;
  1710.                     i.queue = k;
  1711.                     if (j.onInit) {
  1712.                         j.onInit.call(n, i);
  1713.                     }
  1714.                 } else {
  1715.                     if (j.onFallback) {
  1716.                         j.onFallback.call(n);
  1717.                     }
  1718.                 }
  1719.             });
  1720.         },
  1721.         cancel: function(d, f) {
  1722.             var e = arguments;
  1723.             this.each(function() {
  1724.                 var l = c(this),
  1725.                     i = l.data("uploadify"),
  1726.                     j = i.settings,
  1727.                     h = -1;
  1728.                 if (e[0]) {
  1729.                     if (e[0] == "*") {
  1730.                         var g = i.queueData.queueLength;
  1731.                         c("#" + j.queueID).find(".uploadify-queue-item").each(function() {
  1732.                             h++;
  1733.                             if (e[1] === true) {
  1734.                                 i.cancelUpload(c(this).attr("id"), false);
  1735.                             } else {
  1736.                                 i.cancelUpload(c(this).attr("id"));
  1737.                             }
  1738.                             c(this).find(".data").removeClass("data").html(" - Cancelled");
  1739.                             c(this).find(".uploadify-progress-bar").remove();
  1740.                             c(this).delay(1000 + 100 * h).fadeOut(500, function() {
  1741.                                 c(this).remove();
  1742.                             });
  1743.                         });
  1744.                         i.queueData.queueSize = 0;
  1745.                         i.queueData.queueLength = 0;
  1746.                         if (j.onClearQueue) {
  1747.                             j.onClearQueue.call(l, g);
  1748.                         }
  1749.                     } else {
  1750.                         for (var m = 0; m < e.length; m++) {
  1751.                             i.cancelUpload(e[m]);
  1752.                             c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled");
  1753.                             c("#" + e[m]).find(".uploadify-progress-bar").remove();
  1754.                             c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500, function() {
  1755.                                 c(this).remove();
  1756.                             });
  1757.                         }
  1758.                     }
  1759.                 } else {
  1760.                     var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0);
  1761.                     $item = c(k);
  1762.                     i.cancelUpload($item.attr("id"));
  1763.                     $item.find(".data").removeClass("data").html(" - Cancelled");
  1764.                     $item.find(".uploadify-progress-bar").remove();
  1765.                     $item.delay(1000).fadeOut(500, function() {
  1766.                         c(this).remove();
  1767.                     });
  1768.                 }
  1769.             });
  1770.         },
  1771.         destroy: function() {
  1772.             this.each(function() {
  1773.                 var f = c(this),
  1774.                     d = f.data("uploadify"),
  1775.                     e = d.settings;
  1776.                 d.destroy();
  1777.                 if (e.defaultQueue) {
  1778.                     c("#" + e.queueID).remove();
  1779.                 }
  1780.                 c("#" + e.id).replaceWith(d.original);
  1781.                 if (e.onDestroy) {
  1782.                     e.onDestroy.call(this);
  1783.                 }
  1784.                 delete d;
  1785.             });
  1786.         },
  1787.         disable: function(d) {
  1788.             this.each(function() {
  1789.                 var g = c(this),
  1790.                     e = g.data("uploadify"),
  1791.                     f = e.settings;
  1792.                 if (d) {
  1793.                     e.button.addClass("disabled");
  1794.                     if (f.onDisable) {
  1795.                         f.onDisable.call(this);
  1796.                     }
  1797.                 } else {
  1798.                     e.button.removeClass("disabled");
  1799.                     if (f.onEnable) {
  1800.                         f.onEnable.call(this);
  1801.                     }
  1802.                 }
  1803.                 e.setButtonDisabled(d);
  1804.             });
  1805.         },
  1806.         settings: function(e, g, h) {
  1807.             var d = arguments;
  1808.             var f = g;
  1809.             this.each(function() {
  1810.                 var k = c(this),
  1811.                     i = k.data("uploadify"),
  1812.                     j = i.settings;
  1813.                 if (typeof(d[0]) == "object") {
  1814.                     for (var l in g) {
  1815.                         setData(l, g[l]);
  1816.                     }
  1817.                 }
  1818.                 if (d.length === 1) {
  1819.                     f = j[e];
  1820.                 } else {
  1821.                     switch (e) {
  1822.                         case "uploader":
  1823.                             i.setUploadURL(g);
  1824.                             break;
  1825.                         case "formData":
  1826.                             if (!h) {
  1827.                                 g = c.extend(j.formData, g);
  1828.                             }
  1829.                             i.setPostParams(j.formData);
  1830.                             break;
  1831.                         case "method":
  1832.                             if (g == "get") {
  1833.                                 i.setUseQueryString(true);
  1834.                             } else {
  1835.                                 i.setUseQueryString(false);
  1836.                             }
  1837.                             break;
  1838.                         case "fileObjName":
  1839.                             i.setFilePostName(g);
  1840.                             break;
  1841.                         case "fileTypeExts":
  1842.                             i.setFileTypes(g, j.fileTypeDesc);
  1843.                             break;
  1844.                         case "fileTypeDesc":
  1845.                             i.setFileTypes(j.fileTypeExts, g);
  1846.                             break;
  1847.                         case "fileSizeLimit":
  1848.                             i.setFileSizeLimit(g);
  1849.                             break;
  1850.                         case "uploadLimit":
  1851.                             i.setFileUploadLimit(g);
  1852.                             break;
  1853.                         case "queueSizeLimit":
  1854.                             i.setFileQueueLimit(g);
  1855.                             break;
  1856.                         case "buttonImage":
  1857.                             i.button.css("background-image", settingValue);
  1858.                             break;
  1859.                         case "buttonCursor":
  1860.                             if (g == "arrow") {
  1861.                                 i.setButtonCursor(SWFUpload.CURSOR.ARROW);
  1862.                             } else {
  1863.                                 i.setButtonCursor(SWFUpload.CURSOR.HAND);
  1864.                             }
  1865.                             break;
  1866.                         case "buttonText":
  1867.                             c("#" + j.id + "-button").find(".uploadify-button-text").html(g);
  1868.                             break;
  1869.                         case "width":
  1870.                             i.setButtonDimensions(g, j.height);
  1871.                             break;
  1872.                         case "height":
  1873.                             i.setButtonDimensions(j.width, g);
  1874.                             break;
  1875.                         case "multi":
  1876.                             if (g) {
  1877.                                 i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES);
  1878.                             } else {
  1879.                                 i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE);
  1880.                             }
  1881.                             break;
  1882.                     }
  1883.                     j[e] = g;
  1884.                 }
  1885.             });
  1886.             if (d.length === 1) {
  1887.                 return f;
  1888.             }
  1889.         },
  1890.         stop: function() {
  1891.             this.each(function() {
  1892.                 var e = c(this),
  1893.                     d = e.data("uploadify");
  1894.                 d.queueData.averageSpeed = 0;
  1895.                 d.queueData.uploadSize = 0;
  1896.                 d.queueData.bytesUploaded = 0;
  1897.                 d.queueData.uploadQueue = [];
  1898.                 d.stopUpload();
  1899.             });
  1900.         },
  1901.         upload: function() {
  1902.             var d = arguments;
  1903.             this.each(function() {
  1904.                 var f = c(this),
  1905.                     e = f.data("uploadify");
  1906.                 e.queueData.averageSpeed = 0;
  1907.                 e.queueData.uploadSize = 0;
  1908.                 e.queueData.bytesUploaded = 0;
  1909.                 e.queueData.uploadQueue = [];
  1910.                 if (d[0]) {
  1911.                     if (d[0] == "*") {
  1912.                         e.queueData.uploadSize = e.queueData.queueSize;
  1913.                         e.queueData.uploadQueue.push("*");
  1914.                         e.startUpload();
  1915.                     } else {
  1916.                         for (var g = 0; g < d.length; g++) {
  1917.                             e.queueData.uploadSize += e.queueData.files[d[g]].size;
  1918.                             e.queueData.uploadQueue.push(d[g]);
  1919.                         }
  1920.                         e.startUpload(e.queueData.uploadQueue.shift());
  1921.                     }
  1922.                 } else {
  1923.                     e.startUpload();
  1924.                 }
  1925.             });
  1926.         }
  1927.     };
  1928.     var a = {
  1929.         onDialogOpen: function() {
  1930.             var d = this.settings;
  1931.             this.queueData.errorMsg = "Some files were not added to the queue:";
  1932.             this.queueData.filesReplaced = 0;
  1933.             this.queueData.filesCancelled = 0;
  1934.             if (d.onDialogOpen) {
  1935.                 d.onDialogOpen.call(this);
  1936.             }
  1937.         },
  1938.         onDialogClose: function(d, f, g) {
  1939.             var e = this.settings;
  1940.             this.queueData.filesErrored = d - f;
  1941.             this.queueData.filesSelected = d;
  1942.             this.queueData.filesQueued = f - this.queueData.filesCancelled;
  1943.             this.queueData.queueLength = g;
  1944.             if (c.inArray("onDialogClose", e.overrideEvents) < 0) {
  1945.                 if (this.queueData.filesErrored > 0) {
  1946.                     alert(this.queueData.errorMsg);
  1947.                 }
  1948.             }
  1949.             if (e.onDialogClose) {
  1950.                 e.onDialogClose.call(this, this.queueData);
  1951.             }
  1952.             if (e.auto) {
  1953.                 c("#" + e.id).uploadify("upload", "*");
  1954.             }
  1955.         },
  1956.         onSelect: function(g) {
  1957.             var h = this.settings;
  1958.             var e = {};
  1959.             for (var f in this.queueData.files) {
  1960.                 e = this.queueData.files[f];
  1961.                 if (e.uploaded != true && e.name == g.name) {
  1962.                     var d = confirm('The file named "' + g.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');
  1963.                     if (!d) {
  1964.                         this.cancelUpload(g.id);
  1965.                         this.queueData.filesCancelled++;
  1966.                         return false;
  1967.                     } else {
  1968.                         c("#" + e.id).remove();
  1969.                         this.cancelUpload(e.id);
  1970.                         this.queueData.filesReplaced++;
  1971.                     }
  1972.                 }
  1973.             }
  1974.             var i = Math.round(g.size / 1024);
  1975.             var l = "KB";
  1976.             if (i > 1000) {
  1977.                 i = Math.round(i / 1000);
  1978.                 l = "MB";
  1979.             }
  1980.             var k = i.toString().split(".");
  1981.             i = k[0];
  1982.             if (k.length > 1) {
  1983.                 i += "." + k[1].substr(0, 2);
  1984.             }
  1985.             i += l;
  1986.             var j = g.name;
  1987.             if (j.length > 25) {
  1988.                 j = j.substr(0, 25) + "...";
  1989.             }
  1990.             if (c.inArray("onSelect", h.overrideEvents) < 0) {
  1991.                 c("#" + h.queueID).append('<div id="' + g.id + '" class="uploadify-queue-item">                 <div class="cancel">                        <a href="javascript:$(\'#' + h.id + "').uploadify('cancel', '" + g.id + '\')">X</a>                 </div>                  <span class="fileName">' + j + " (" + i + ')</span><span class="data"></span>                   <div class="uploadify-progress">                        <div class="uploadify-progress-bar"><!--Progress Bar--></div>                   </div>              </div>');
  1992.             }
  1993.             this.queueData.queueSize += g.size;
  1994.             this.queueData.files[g.id] = g;
  1995.             if (h.onSelect) {
  1996.                 h.onSelect.apply(this, arguments);
  1997.             }
  1998.         },
  1999.         onSelectError: function(d, g, f) {
  2000.             var e = this.settings;
  2001.             if (c.inArray("onSelectError", e.overrideEvents) < 0) {
  2002.                 switch (g) {
  2003.                     case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
  2004.                         if (e.queueSizeLimit > f) {
  2005.                             this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ").";
  2006.                         } else {
  2007.                             this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ").";
  2008.                         }
  2009.                         break;
  2010.                     case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  2011.                         this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ").";
  2012.                         break;
  2013.                     case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
  2014.                         this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.';
  2015.                         break;
  2016.                     case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  2017.                         this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ").";
  2018.                         break;
  2019.                 }
  2020.             }
  2021.             if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
  2022.                 delete this.queueData.files[d.id];
  2023.             }
  2024.             if (e.onSelectError) {
  2025.                 e.onSelectError.apply(this, arguments);
  2026.             }
  2027.         },
  2028.         onQueueComplete: function() {
  2029.             if (this.settings.onQueueComplete) {
  2030.                 this.settings.onQueueComplete.call(this, this.settings.queueData);
  2031.             }
  2032.         },
  2033.         onUploadComplete: function(f) {
  2034.             var g = this.settings,
  2035.                 d = this;
  2036.             var e = this.getStats();
  2037.             this.queueData.queueLength = e.files_queued;
  2038.             if (this.queueData.uploadQueue[0] == "*") {
  2039.                 if (this.queueData.queueLength > 0) {
  2040.                     this.startUpload();
  2041.                 } else {
  2042.                     this.queueData.uploadQueue = [];
  2043.                     if (g.onQueueComplete) {
  2044.                         g.onQueueComplete.call(this, this.queueData);
  2045.                     }
  2046.                 }
  2047.             } else {
  2048.                 if (this.queueData.uploadQueue.length > 0) {
  2049.                     this.startUpload(this.queueData.uploadQueue.shift());
  2050.                 } else {
  2051.                     this.queueData.uploadQueue = [];
  2052.                     if (g.onQueueComplete) {
  2053.                         g.onQueueComplete.call(this, this.queueData);
  2054.                     }
  2055.                 }
  2056.             }
  2057.             if (c.inArray("onUploadComplete", g.overrideEvents) < 0) {
  2058.                 if (g.removeCompleted) {
  2059.                     switch (f.filestatus) {
  2060.                         case SWFUpload.FILE_STATUS.COMPLETE:
  2061.                             setTimeout(function() {
  2062.                                 if (c("#" + f.id)) {
  2063.                                     d.queueData.queueSize -= f.size;
  2064.                                     d.queueData.queueLength -= 1;
  2065.                                     delete d.queueData.files[f.id];
  2066.                                     c("#" + f.id).fadeOut(500, function() {
  2067.                                         c(this).remove();
  2068.                                     });
  2069.                                 }
  2070.                             }, g.removeTimeout * 1000);
  2071.                             break;
  2072.                         case SWFUpload.FILE_STATUS.ERROR:
  2073.                             if (!g.requeueErrors) {
  2074.                                 setTimeout(function() {
  2075.                                     if (c("#" + f.id)) {
  2076.                                         d.queueData.queueSize -= f.size;
  2077.                                         d.queueData.queueLength -= 1;
  2078.                                         delete d.queueData.files[f.id];
  2079.                                         c("#" + f.id).fadeOut(500, function() {
  2080.                                             c(this).remove();
  2081.                                         });
  2082.                                     }
  2083.                                 }, g.removeTimeout * 1000);
  2084.                             }
  2085.                             break;
  2086.                     }
  2087.                 } else {
  2088.                     f.uploaded = true;
  2089.                 }
  2090.             }
  2091.             if (g.onUploadComplete) {
  2092.                 g.onUploadComplete.call(this, f);
  2093.             }
  2094.         },
  2095.         onUploadError: function(e, i, h) {
  2096.             var f = this.settings;
  2097.             var g = "Error";
  2098.             switch (i) {
  2099.                 case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
  2100.                     g = "HTTP Error (" + h + ")";
  2101.                     break;
  2102.                 case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
  2103.                     g = "Missing Upload URL";
  2104.                     break;
  2105.                 case SWFUpload.UPLOAD_ERROR.IO_ERROR:
  2106.                     g = "IO Error";
  2107.                     break;
  2108.                 case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
  2109.                     g = "Security Error";
  2110.                     break;
  2111.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
  2112.                     alert("The upload limit has been reached (" + h + ").");
  2113.                     g = "Exceeds Upload Limit";
  2114.                     break;
  2115.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
  2116.                     g = "Failed";
  2117.                     break;
  2118.                 case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
  2119.                     break;
  2120.                 case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
  2121.                     g = "Validation Error";
  2122.                     break;
  2123.                 case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
  2124.                     g = "Cancelled";
  2125.                     this.queueData.queueSize -= e.size;
  2126.                     this.queueData.queueLength -= 1;
  2127.                     if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) {
  2128.                         this.queueData.uploadSize -= e.size;
  2129.                     }
  2130.                     if (f.onCancel) {
  2131.                         f.onCancel.call(this, e);
  2132.                     }
  2133.                     delete this.queueData.files[e.id];
  2134.                     break;
  2135.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
  2136.                     g = "Stopped";
  2137.                     break;
  2138.             }
  2139.             if (c.inArray("onUploadError", f.overrideEvents) < 0) {
  2140.                 if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {
  2141.                     c("#" + e.id).addClass("uploadify-error");
  2142.                 }
  2143.                 c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px");
  2144.                 if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) {
  2145.                     c("#" + e.id).find(".data").html(" - " + g);
  2146.                 }
  2147.             }
  2148.             var d = this.getStats();
  2149.             this.queueData.uploadsErrored = d.upload_errors;
  2150.             if (f.onUploadError) {
  2151.                 f.onUploadError.call(this, e, i, h, g);
  2152.             }
  2153.         },
  2154.         onUploadProgress: function(g, m, j) {
  2155.             var h = this.settings;
  2156.             var e = new Date();
  2157.             var n = e.getTime();
  2158.             var k = n - this.timer;
  2159.             if (k > 500) {
  2160.                 this.timer = n;
  2161.             }
  2162.             var i = m - this.bytesLoaded;
  2163.             this.bytesLoaded = m;
  2164.             var d = this.queueData.queueBytesUploaded + m;
  2165.             var p = Math.round(m / j * 100);
  2166.             var o = "KB/s";
  2167.             var l = 0;
  2168.             var f = (i / 1024) / (k / 1000);
  2169.             f = Math.floor(f * 10) / 10;
  2170.             if (this.queueData.averageSpeed > 0) {
  2171.                 this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2);
  2172.             } else {
  2173.                 this.queueData.averageSpeed = Math.floor(f);
  2174.             }
  2175.             if (f > 1000) {
  2176.                 l = (f * 0.001);
  2177.                 this.queueData.averageSpeed = Math.floor(l);
  2178.                 o = "MB/s";
  2179.             }
  2180.             if (c.inArray("onUploadProgress", h.overrideEvents) < 0) {
  2181.                 if (h.progressData == "percentage") {
  2182.                     c("#" + g.id).find(".data").html(" - " + p + "%");
  2183.                 } else {
  2184.                     if (h.progressData == "speed" && k > 500) {
  2185.                         c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o);
  2186.                     }
  2187.                 }
  2188.                 c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%");
  2189.             }
  2190.             if (h.onUploadProgress) {
  2191.                 h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize);
  2192.             }
  2193.         },
  2194.         onUploadStart: function(d) {
  2195.             var e = this.settings;
  2196.             var f = new Date();
  2197.             this.timer = f.getTime();
  2198.             this.bytesLoaded = 0;
  2199.             if (this.queueData.uploadQueue.length == 0) {
  2200.                 this.queueData.uploadSize = d.size;
  2201.             }
  2202.             if (e.checkExisting) {
  2203.                 c.ajax({
  2204.                     type: "POST",
  2205.                     async: false,
  2206.                     url: e.checkExisting,
  2207.                     data: {
  2208.                         filename: d.name
  2209.                     },
  2210.                     success: function(h) {
  2211.                         if (h == 1) {
  2212.                             var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?');
  2213.                             if (!g) {
  2214.                                 this.cancelUpload(d.id);
  2215.                                 c("#" + d.id).remove();
  2216.                                 if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) {
  2217.                                     if (this.queueData.uploadQueue[0] == "*") {
  2218.                                         this.startUpload();
  2219.                                     } else {
  2220.                                         this.startUpload(this.queueData.uploadQueue.shift());
  2221.                                     }
  2222.                                 }
  2223.                             }
  2224.                         }
  2225.                     }
  2226.                 });
  2227.             }
  2228.             if (e.onUploadStart) {
  2229.                 e.onUploadStart.call(this, d);
  2230.             }
  2231.         },
  2232.         onUploadSuccess: function(f, h, d) {
  2233.             var g = this.settings;
  2234.             var e = this.getStats();
  2235.             this.queueData.uploadsSuccessful = e.successful_uploads;
  2236.             this.queueData.queueBytesUploaded += f.size;
  2237.             if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) {
  2238.                 c("#" + f.id).find(".data").html(" - Complete");
  2239.             }
  2240.             if (g.onUploadSuccess) {
  2241.                 g.onUploadSuccess.call(this, f, h, d);
  2242.             }
  2243.         }
  2244.     };
  2245.     c.fn.uploadify = function(d) {
  2246.         if (b[d]) {
  2247.             return b[d].apply(this, Array.prototype.slice.call(arguments, 1));
  2248.         } else {
  2249.             if (typeof d === "object" || !d) {
  2250.                 return b.init.apply(this, arguments);
  2251.             } else {
  2252.                 c.error("The method " + d + " does not exist in $.uploadify");
  2253.             }
  2254.         }
  2255.     };
  2256. })(jqac);
  2257. (function(factory) {
  2258.     if (typeof define === 'function' && define.amd) {
  2259.         define(['jqac'], factory);
  2260.     } else {
  2261.         factory(jqac);
  2262.     }
  2263. }(function($) {
  2264.     var pluses = /\+/g;
  2265.  
  2266.     function encode(s) {
  2267.         return config.raw ? s : encodeURIComponent(s);
  2268.     }
  2269.  
  2270.     function decode(s) {
  2271.         return config.raw ? s : decodeURIComponent(s);
  2272.     }
  2273.  
  2274.     function stringifyCookieValue(value) {
  2275.         return encode(config.json ? JSON.stringify(value) : String(value));
  2276.     }
  2277.  
  2278.     function parseCookieValue(s) {
  2279.         if (s.indexOf('"') === 0) {
  2280.             s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  2281.         }
  2282.         try {
  2283.             s = decodeURIComponent(s.replace(pluses, ' '));
  2284.             return config.json ? JSON.parse(s) : s;
  2285.         } catch (e) {}
  2286.     }
  2287.  
  2288.     function read(s, converter) {
  2289.         var value = config.raw ? s : parseCookieValue(s);
  2290.         return $.isFunction(converter) ? converter(value) : value;
  2291.     }
  2292.     var config = $.cookie = function(key, value, options) {
  2293.         if (value !== undefined && !$.isFunction(value)) {
  2294.             options = $.extend({}, config.defaults, options);
  2295.             if (typeof options.expires === 'number') {
  2296.                 var days = options.expires,
  2297.                     t = options.expires = new Date();
  2298.                 t.setDate(t.getDate() + days);
  2299.             }
  2300.             return (document.cookie = [encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : ''].join(''));
  2301.         }
  2302.         var result = key ? undefined : {};
  2303.         var cookies = document.cookie ? document.cookie.split('; ') : [];
  2304.         for (var i = 0, l = cookies.length; i < l; i++) {
  2305.             var parts = cookies[i].split('=');
  2306.             var name = decode(parts.shift());
  2307.             var cookie = parts.join('=');
  2308.             if (key && key === name) {
  2309.                 result = read(cookie, value);
  2310.                 break;
  2311.             }
  2312.             if (!key && (cookie = read(cookie)) !== undefined) {
  2313.                 result[name] = cookie;
  2314.             }
  2315.         }
  2316.         return result;
  2317.     };
  2318.     config.defaults = {};
  2319.     $.removeCookie = function(key, options) {
  2320.         if ($.cookie(key) === undefined) {
  2321.             return false;
  2322.         }
  2323.         $.cookie(key, '', $.extend({}, options, {
  2324.             expires: -1
  2325.         }));
  2326.         return !$.cookie(key);
  2327.     };
  2328. }));
  2329. if (c_facebook_app_id != '' && c_disable_arrowchat != 1 && c_chat_maintenance != 1 && u_hash_id != '') {
  2330.     if (jqac.cookie('ac_facebook') == 1)
  2331.         var ac_fb_logged_in = true;
  2332.     else
  2333.         var ac_fb_logged_in = false;
  2334.     jqac('body').append('<div id="fb-root"></div>');
  2335.     (function() {
  2336.         var e = document.createElement('script');
  2337.         e.type = 'text/javascript';
  2338.         e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
  2339.         e.async = true;
  2340.         document.getElementsByTagName('head')[0].appendChild(e);
  2341.     }());
  2342.     window.fbAsyncInit = function() {
  2343.         FB.init({
  2344.             appId: c_facebook_app_id,
  2345.             cookie: true,
  2346.             status: true,
  2347.             xfbml: true
  2348.         });
  2349.         FB.getLoginStatus(function(response) {
  2350.             if (response.authResponse) {
  2351.                 if (ac_fb_logged_in) {
  2352.                     jqac.arrowchat.facebook(response);
  2353.                 } else {
  2354.                     ac_fb_logged_in = false;
  2355.                 }
  2356.             }
  2357.         });
  2358.     };
  2359.  
  2360.     function arrowchatdoLogin() {
  2361.         if (ac_fb_logged_in) {
  2362.             jqac.arrowchat.facebookLogout();
  2363.             ac_fb_logged_in = false;
  2364.         } else {
  2365.             FB.login(function(response) {
  2366.                 if (response.authResponse) {
  2367.                     FB.api('/me/permissions', function(response2) {
  2368.                         if (response2.data[0].xmpp_login == 1) {
  2369.                             jqac.arrowchat.facebook(response);
  2370.                             ac_fb_logged_in = true;
  2371.                         }
  2372.                     });
  2373.                 } else {}
  2374.             }, {
  2375.                 scope: 'xmpp_login,offline_access'
  2376.             });
  2377.         }
  2378.     }
  2379. }
  2380. if (c_push_engine == "1") {
  2381.     (function() {
  2382.         function r() {
  2383.             return function() {}
  2384.         }
  2385.         window.JSON && window.JSON.stringify || function() {
  2386.             function w(c) {
  2387.                 k.lastIndex = 0;
  2388.                 return k.test(c) ? '"' + c.replace(k, function(c) {
  2389.                     var e = g[c];
  2390.                     return "string" === typeof e ? e : "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4)
  2391.                 }) + '"' : '"' + c + '"'
  2392.             }
  2393.  
  2394.             function t(c, g) {
  2395.                 var e, h, o, n, k = i,
  2396.                     l, f = g[c];
  2397.                 f && "object" === typeof f && "function" === typeof f.toJSON && (f = f.toJSON(c));
  2398.                 "function" === typeof m && (f = m.call(g, c, f));
  2399.                 switch (typeof f) {
  2400.                     case "string":
  2401.                         return w(f);
  2402.                     case "number":
  2403.                         return isFinite(f) ? "" + f : "null";
  2404.                     case "boolean":
  2405.                     case "null":
  2406.                         return "" +
  2407.                             f;
  2408.                     case "object":
  2409.                         if (!f) return "null";
  2410.                         i += p;
  2411.                         l = [];
  2412.                         if ("[object Array]" === Object.prototype.toString.apply(f)) {
  2413.                             n = f.length;
  2414.                             for (e = 0; e < n; e += 1) l[e] = t(e, f) || "null";
  2415.                             o = 0 === l.length ? "[]" : i ? "[\n" + i + l.join(",\n" + i) + "\n" + k + "]" : "[" + l.join(",") + "]";
  2416.                             i = k;
  2417.                             return o
  2418.                         }
  2419.                         if (m && "object" === typeof m) {
  2420.                             n = m.length;
  2421.                             for (e = 0; e < n; e += 1) h = m[e], "string" === typeof h && (o = t(h, f)) && l.push(w(h) + (i ? ": " : ":") + o)
  2422.                         } else
  2423.                             for (h in f) Object.hasOwnProperty.call(f, h) && (o = t(h, f)) && l.push(w(h) + (i ? ": " : ":") + o);
  2424.                         o = 0 === l.length ? "{}" : i ? "{\n" + i + l.join(",\n" + i) + "\n" +
  2425.                             k + "}" : "{" + l.join(",") + "}";
  2426.                         i = k;
  2427.                         return o
  2428.                 }
  2429.             }
  2430.             window.JSON || (window.JSON = {});
  2431.             "function" !== typeof String.prototype.toJSON && (String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {
  2432.                 return this.valueOf()
  2433.             });
  2434.             var k = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  2435.                 i, p, g = {
  2436.                     "\u0008": "\\b",
  2437.                     "\t": "\\t",
  2438.                     "\n": "\\n",
  2439.                     "\u000c": "\\f",
  2440.                     "\r": "\\r",
  2441.                     '"': '\\"',
  2442.                     "\\": "\\\\"
  2443.                 },
  2444.                 m;
  2445.             "function" !== typeof JSON.stringify && (JSON.stringify = function(c, g, e) {
  2446.                 var h;
  2447.                 p = i = "";
  2448.                 if ("number" === typeof e)
  2449.                     for (h = 0; h < e; h += 1) p += " ";
  2450.                 else "string" === typeof e && (p = e);
  2451.                 if ((m = g) && "function" !== typeof g && ("object" !== typeof g || "number" !== typeof g.length)) throw Error("JSON.stringify");
  2452.                 return t("", {
  2453.                     "": c
  2454.                 })
  2455.             });
  2456.             "function" !== typeof JSON.parse && (JSON.parse = function(c) {
  2457.                 return eval("(" + c + ")")
  2458.             })
  2459.         }();
  2460.         window.PUBNUB || function() {
  2461.             function w(a) {
  2462.                 var b = {},
  2463.                     d = a.publish_key || "",
  2464.                     s = a.subscribe_key || "",
  2465.                     j = a.ssl ? "s" : "",
  2466.                     z = "http" + j + "://" + (a.origin || "www.arrowpushengine.com"),
  2467.                     q = {
  2468.                         history: function(a, b) {
  2469.                             var b = a.callback || b,
  2470.                                 d = a.limit || 100,
  2471.                                 c = a.channel,
  2472.                                 e = f();
  2473.                             if (!c) return g("Missing Channel");
  2474.                             if (!b) return g("Missing Callback");
  2475.                             u({
  2476.                                 c: e,
  2477.                                 url: [z, "history", s, A(c), e, d],
  2478.                                 b: function(a) {
  2479.                                     b(a)
  2480.                                 },
  2481.                                 a: function(a) {
  2482.                                     g(a)
  2483.                                 }
  2484.                             })
  2485.                         },
  2486.                         time: function(a) {
  2487.                             var b = f();
  2488.                             u({
  2489.                                 c: b,
  2490.                                 url: [z, "time", b],
  2491.                                 b: function(b) {
  2492.                                     a(b[0])
  2493.                                 },
  2494.                                 a: function() {
  2495.                                     a(0)
  2496.                                 }
  2497.                             })
  2498.                         },
  2499.                         uuid: function(a) {
  2500.                             var b = f();
  2501.                             u({
  2502.                                 c: b,
  2503.                                 url: ["http" + j + "://pubnub-prod.appspot.com/uuid?callback=" + b],
  2504.                                 b: function(b) {
  2505.                                     a(b[0])
  2506.                                 },
  2507.                                 a: function() {
  2508.                                     a(0)
  2509.                                 }
  2510.                             })
  2511.                         },
  2512.                         publish: function(a, b) {
  2513.                             var b = b || a.callback || r(),
  2514.                                 c = a.message,
  2515.                                 e = a.channel,
  2516.                                 j = f();
  2517.                             if (!c) return g("Missing Message");
  2518.                             if (!e) return g("Missing Channel");
  2519.                             if (!d) return g("Missing Publish Key");
  2520.                             c = JSON.stringify(c);
  2521.                             c = [z, "publish", d, s, 0, A(e), j, A(c)];
  2522.                             if (1800 < c.join().length) return g("Message Too Big");
  2523.                             u({
  2524.                                 c: j,
  2525.                                 b: function(a) {
  2526.                                     b(a)
  2527.                                 },
  2528.                                 a: function() {
  2529.                                     b([0, "Disconnected"])
  2530.                                 },
  2531.                                 url: c
  2532.                             })
  2533.                         },
  2534.                         unsubscribe: function(a) {
  2535.                             a = a.channel;
  2536.                             a in b && (b[a].d = 0, b[a].e && b[a].e(0))
  2537.                         },
  2538.                         subscribe: function(a, d) {
  2539.                             function e() {
  2540.                                 var a = f();
  2541.                                 b[j].d && (b[j].e = u({
  2542.                                     c: a,
  2543.                                     url: [t, "subscribe", s, A(j), a, i],
  2544.                                     a: function() {
  2545.                                         m || (m = 1, o());
  2546.                                         setTimeout(e, x);
  2547.                                         q.time(function(a) {
  2548.                                             a || k()
  2549.                                         })
  2550.                                     },
  2551.                                     b: function(a) {
  2552.                                         b[j].d && (p || (p = 1, l()), m && (m = 0, n()), h = B.set(s + j, i = h && B.get(s + j) || a[1]), c(a[0], function(b) {
  2553.                                             d(b, a)
  2554.                                         }), setTimeout(e, 10))
  2555.                                     }
  2556.                                 }))
  2557.                             }
  2558.                             var j = a.channel,
  2559.                                 d = d || a.callback,
  2560.                                 h = a.restore,
  2561.                                 i = 0,
  2562.                                 k = a.error || r(),
  2563.                                 l = a.connect || r(),
  2564.                                 n = a.reconnect || r(),
  2565.                                 o = a.disconnect || r(),
  2566.                                 m = 0,
  2567.                                 p = 0,
  2568.                                 t = M(z);
  2569.                             if (!C) return I.push([a, d, q]);
  2570.                             if (!j) return g("Missing Channel");
  2571.                             if (!d) return g("Missing Callback");
  2572.                             if (!s) return g("Missing Subscribe Key");
  2573.                             j in b || (b[j] = {});
  2574.                             if (b[j].d) return g("Already Connected");
  2575.                             b[j].d = 1;
  2576.                             e()
  2577.                         },
  2578.                         xdr: u,
  2579.                         ready: D,
  2580.                         db: B,
  2581.                         each: c,
  2582.                         map: G,
  2583.                         css: H,
  2584.                         $: p,
  2585.                         create: l,
  2586.                         bind: h,
  2587.                         supplant: e,
  2588.                         head: o,
  2589.                         search: m,
  2590.                         attr: n,
  2591.                         now: k,
  2592.                         unique: t,
  2593.                         events: y,
  2594.                         updater: i,
  2595.                         init: w
  2596.                     };
  2597.                 return q
  2598.             }
  2599.  
  2600.             function t() {
  2601.                 return "x" + ++N + "" + +new Date
  2602.             }
  2603.  
  2604.             function k() {
  2605.                 return +new Date
  2606.             }
  2607.  
  2608.             function i(a, b) {
  2609.                 function d() {
  2610.                     c + b > k() ? (clearTimeout(s), s = setTimeout(d, b)) : (c = k(), a())
  2611.                 }
  2612.                 var s, c = 0;
  2613.                 return d
  2614.             }
  2615.  
  2616.             function p(a) {
  2617.                 return document.getElementById(a)
  2618.             }
  2619.  
  2620.             function g(a) {
  2621.                 console.log(a)
  2622.             }
  2623.  
  2624.             function m(a, b) {
  2625.                 var d = [];
  2626.                 c(a.split(/\s+/), function(a) {
  2627.                     c((b || document).getElementsByTagName(a), function(a) {
  2628.                         d.push(a)
  2629.                     })
  2630.                 });
  2631.                 return d
  2632.             }
  2633.  
  2634.             function c(a, b) {
  2635.                 if (a && b)
  2636.                     if ("undefined" != typeof a[0])
  2637.                         for (var d = 0, s = a.length; d < s;) b.call(a[d], a[d], d++);
  2638.                     else
  2639.                         for (d in a) a.hasOwnProperty && a.hasOwnProperty(d) && b.call(a[d], d, a[d])
  2640.             }
  2641.  
  2642.             function G(a, b) {
  2643.                 var d = [];
  2644.                 c(a || [], function(a, c) {
  2645.                     d.push(b(a, c))
  2646.                 });
  2647.                 return d
  2648.             }
  2649.  
  2650.             function e(a, b) {
  2651.                 return a.replace(O, function(a, c) {
  2652.                     return b[c] || a
  2653.                 })
  2654.             }
  2655.  
  2656.             function h(a, b, d) {
  2657.                 c(a.split(","), function(a) {
  2658.                     function c(a) {
  2659.                         a || (a = window.event);
  2660.                         d(a) || (a.cancelBubble = !0, a.returnValue = !1, a.preventDefault && a.preventDefault(), a.stopPropagation && a.stopPropagation())
  2661.                     }
  2662.                     b.addEventListener ? b.addEventListener(a, c, !1) : b.attachEvent ? b.attachEvent("on" + a, c) : b["on" + a] = c
  2663.                 })
  2664.             }
  2665.  
  2666.             function o() {
  2667.                 return m("head")[0]
  2668.             }
  2669.  
  2670.             function n(a, b, d) {
  2671.                 if (d) a.setAttribute(b, d);
  2672.                 else return a && a.getAttribute && a.getAttribute(b)
  2673.             }
  2674.  
  2675.             function H(a, b) {
  2676.                 for (var d in b)
  2677.                     if (b.hasOwnProperty(d)) try {
  2678.                         a.style[d] = b[d] + (0 < "|width|height|top|left|".indexOf(d) && "number" == typeof b[d] ? "px" : "")
  2679.                     } catch (c) {}
  2680.             }
  2681.  
  2682.             function l(a) {
  2683.                 return document.createElement(a)
  2684.             }
  2685.  
  2686.             function f() {
  2687.                 return E || q() ? 0 : t()
  2688.             }
  2689.  
  2690.             function A(a) {
  2691.                 return G(encodeURIComponent(a).split(""), function(a) {
  2692.                     return 0 > "-_.!~*'()".indexOf(a) ? a : "%" + a.charCodeAt(0).toString(16).toUpperCase()
  2693.                 }).join("")
  2694.             }
  2695.  
  2696.             function u(a) {
  2697.                 function b(a, b) {
  2698.                     f || (f = 1, a || i(b), d.onerror = null, clearTimeout(g), setTimeout(function() {
  2699.                         a && h();
  2700.                         var b = p(e),
  2701.                             d = b && b.parentNode;
  2702.                         d && d.removeChild(b)
  2703.                     }, x))
  2704.                 }
  2705.                 if (E || q()) return P(a);
  2706.                 var d = l("script"),
  2707.                     c = a.c,
  2708.                     e = t(),
  2709.                     f = 0,
  2710.                     g = setTimeout(function() {
  2711.                         b(1)
  2712.                     }, F),
  2713.                     h = a.a || r(),
  2714.                     i = a.b || r();
  2715.                 window[c] = function(a) {
  2716.                     b(0, a)
  2717.                 };
  2718.                 d[J] = J;
  2719.                 d.onerror = function() {
  2720.                     b(1)
  2721.                 };
  2722.                 d.src = a.url.join(K);
  2723.                 n(d, "id", e);
  2724.                 o().appendChild(d);
  2725.                 return b
  2726.             }
  2727.  
  2728.             function P(a) {
  2729.                 function b(a) {
  2730.                     e || (e = 1, clearTimeout(g), c && (c.onerror = c.onload = null, c.abort && c.abort(), c = null), a && h())
  2731.                 }
  2732.  
  2733.                 function d() {
  2734.                     if (!f) {
  2735.                         f = 1;
  2736.                         clearTimeout(g);
  2737.                         try {
  2738.                             response = JSON.parse(c.responseText)
  2739.                         } catch (a) {
  2740.                             return b(1)
  2741.                         }
  2742.                         i(response)
  2743.                     }
  2744.                 }
  2745.                 var c, e = 0,
  2746.                     f = 0,
  2747.                     g = setTimeout(function() {
  2748.                         b(1)
  2749.                     }, F),
  2750.                     h = a.a || r(),
  2751.                     i = a.b || r();
  2752.                 try {
  2753.                     c = q() || window.XDomainRequest && new XDomainRequest || new XMLHttpRequest, c.onerror = c.onabort = function() {
  2754.                         b(1)
  2755.                     }, c.onload = c.onloadend = d, c.timeout = F, c.open("GET", a.url.join(K), !0), c.send()
  2756.                 } catch (k) {
  2757.                     return b(0), E = 0, u(a)
  2758.                 }
  2759.                 return b
  2760.             }
  2761.  
  2762.             function D() {
  2763.                 PUBNUB.time(k);
  2764.                 PUBNUB.time(function() {
  2765.                     setTimeout(function() {
  2766.                         C || (C = 1, c(I, function(a) {
  2767.                             a[2].subscribe(a[0], a[1])
  2768.                         }))
  2769.                     }, x)
  2770.                 })
  2771.             }
  2772.  
  2773.             function q() {
  2774.                 if (!L.get) return 0;
  2775.                 var a = {
  2776.                     id: q.id++,
  2777.                     send: r(),
  2778.                     abort: function() {
  2779.                         a.id = {}
  2780.                     },
  2781.                     open: function(b, c) {
  2782.                         q[a.id] = a;
  2783.                         L.get(a.id, c)
  2784.                     }
  2785.                 };
  2786.                 return a
  2787.             }
  2788.             window.console || (window.console = window.console || {});
  2789.             console.log || (console.log = (window.opera || {}).postError || r());
  2790.             var B = function() {
  2791.                     var a = window.localStorage;
  2792.                     return {
  2793.                         get: function(b) {
  2794.                             try {
  2795.                                 return a ? a.getItem(b) : -1 == document.cookie.indexOf(b) ? null : ((document.cookie || "").match(RegExp(b + "=([^;]+)")) || [])[1] || null
  2796.                             } catch (c) {}
  2797.                         },
  2798.                         set: function(b, c) {
  2799.                             try {
  2800.                                 if (a) return a.setItem(b, c) && 0;
  2801.                                 document.cookie = b + "=" + c + "; expires=Thu, 1 Aug 2030 20:00:00 UTC; path=/"
  2802.                             } catch (e) {}
  2803.                         }
  2804.                     }
  2805.                 }(),
  2806.                 N = 1,
  2807.                 O = /{([\w\-]+)}/g,
  2808.                 J = "async",
  2809.                 K = "/",
  2810.                 F = 14E4,
  2811.                 x = 1E3,
  2812.                 E = -1 == navigator.userAgent.indexOf("MSIE 6"),
  2813.                 M = function() {
  2814.                     var a = Math.floor(9 * Math.random()) + 1;
  2815.                     return function(b) {
  2816.                         return 0 < b.indexOf("pubsub") && b.replace("pubsub", "ps" + (10 > ++a ? a : a = 1)) || b
  2817.                     }
  2818.                 }(),
  2819.                 y = {
  2820.                     list: {},
  2821.                     unbind: function(a) {
  2822.                         y.list[a] = []
  2823.                     },
  2824.                     bind: function(a, b) {
  2825.                         (y.list[a] = y.list[a] || []).push(b)
  2826.                     },
  2827.                     fire: function(a, b) {
  2828.                         c(y.list[a] || [], function(a) {
  2829.                             a(b)
  2830.                         })
  2831.                     }
  2832.                 },
  2833.                 v = p("pubnub") || {},
  2834.                 C = 0,
  2835.                 I = [];
  2836.             PUBNUB = w({
  2837.                 publish_key: n(v, "pub-key"),
  2838.                 subscribe_key: n(v, "sub-key"),
  2839.                 ssl: "on" == n(v, "ssl"),
  2840.                 origin: n(v, "origin")
  2841.             });
  2842.             H(v, {
  2843.                 position: "absolute",
  2844.                 top: -x
  2845.             });
  2846.             if ("opera" in window || n(v, "flash")) v.innerHTML = "<object id=pubnubs data=https://dh15atwfs066y.cloudfront.net/pubnub.swf><param name=movie value=https://dh15atwfs066y.cloudfront.net/pubnub.swf><param name=allowscriptaccess value=always></object>";
  2847.             var L = p("pubnubs") || {};
  2848.             h("load", window, function() {
  2849.                 setTimeout(D, 0)
  2850.             });
  2851.             PUBNUB.rdx = function(a, b) {
  2852.                 if (!b) return q[a].onerror();
  2853.                 q[a].responseText = unescape(b);
  2854.                 q[a].onload()
  2855.             };
  2856.             q.id = x;
  2857.             window.jqac && (window.jqac.PUBNUB = PUBNUB);
  2858.             "undefined" !== typeof module && (module.f = PUBNUB) && D()
  2859.         }();
  2860.     })();
  2861. }
  2862. var ArrowChat = {};
  2863. ArrowChat.Templates = {
  2864.     bar_hide_tab: function() {
  2865.         return '<div id="arrowchat_hide_bar_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_hide_icon" /> </div></div>';
  2866.     },
  2867.     bar_show_tab: function() {
  2868.         return '<div id="arrowchat_show_bar_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_show_icon" /> </div></div>';
  2869.     },
  2870.     applications_bookmarks_tab: function(c_ac_path, apps, b) {
  2871.         return '<div class="arrowchat_inner_button"> <img class="arrowchat_tray_icon" src="' + c_ac_path + "applications/" + apps[b][2] + "/images/" + apps[b][3] + '" /><div class="arrowchat_app_button_name">' + apps[b][11] + '</div> </div>';
  2872.     },
  2873.     applications_bookmarks_window: function(c_ac_path, apps, b) {
  2874.         return '<div class="arrowchat_traytitle"> <div class="arrowchat_tab_name">' + apps[b][1] + '</div> <div class="arrowchat_more_button"> <a href="javascript:void(0)" class="arrowchat_more_anchor" id="arrowchat_apps_more_' + apps[b][0] + '"></a> <div id="arrowchat_apps_more_popout_' + apps[b][0] + '" class="arrowchat_more_popout"> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_app_keep_open_' + apps[b][0] + '" class="arrowchat_menu_anchor arrowchat_app_keep_open"> <input type="checkbox" checked="" /> <span>' + lang[104] + '</span> </a> </li> <!--<li class="arrowchat_menu_item"> <a id="arrowchat_app_load_' + apps[b][0] + '" class="arrowchat_menu_anchor arrowchat_app_load"> <input type="checkbox" checked="" /> <span>' + lang[105] + '</span> </a> </li>--> </ul> </div> </div> </div> <div class="arrowchat_traycontent"> <div class="arrowchat_traycontenttext"> <div id="arrowchat_applications_button_' + apps[b][0] + '_content" style="width: ' + apps[b][4] + 'px;"> <div class="arrowchat_loader"></div> </div> </div> </div>';
  2875.     },
  2876.     applications_bookmarks_list: function(c_ac_path, apps, b) {
  2877.         return '<li id="arrowchatapplist_' + apps[b][0] + '" style="line-height: 16px; overflow: hidden hidden; padding: 1px 0px; zoom: 1;"> <div> <a id="arrowchat_app_link_' + apps[b][0] + '" class="arrowchat_app_link" href="javascript:void(0);"> <div style="float: left; height: 16px; overflow: hidden hidden; padding: 2px 5px; width: 16px;"> <img style="height: 16px; width: 16px; border: 0px;" src="' + c_ac_path + "applications/" + apps[b][2] + "/images/" + apps[b][3] + '" /> </div> <div style="padding-top: 2px;">' + apps[b][1] + '</div> </a> </div> </li>';
  2878.     },
  2879.     applications_tab: function() {
  2880.         return '<div class="arrowchat_inner_button"> <img class="arrowchat_tray_icon" src="' + c_ac_path + 'themes/' + u_theme + '/images/icons/tray_arrowchat.png" /> <div class="arrowchat_tray_name">' + lang[16] + '</div> </div>';
  2881.     },
  2882.     applications_window: function() {
  2883.         return '<div class="arrowchat_traytitle"> <div class="arrowchat_tab_name">' + lang[16] + '</div> </div> <div class="arrowchat_apps_subtitle">' + lang[65] + '</div> <div class="arrowchat_traycontent"> <div style="height: auto; overflow: hidden hidden; position: relative;"> <div style="padding: 5px;"> <div id="arrowchat_bookmarks"></div> </div> </div> </div>';
  2884.     },
  2885.     notifications_tab: function() {
  2886.         return '<div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_notifications_icon" /> </div>';
  2887.     },
  2888.     notifications_window: function() {
  2889.         return '<div class="arrowchat_userstabtitle"> <div class="arrowchat_tab_name">' + lang[0] + '</div> <div class="arrowchat_see_all_button"> <a href="javascript:void(0);" class="arrowchat_see_all_link arrowchat_more_anchor"></a> </div> </div> <div class="arrowchat_tabcontent arrowchat_optionstyle"> <div id="arrowchat_notifications_content"> <div id="arrowchat_no_new_notifications">' + lang[9] + '</div> </div> </div>';
  2890.     },
  2891.     chat_tab: function(shortname) {
  2892.         return '<div class="arrowchat_bar_right arrowchat_bar_button arrowchat_user_tab"><div class="arrowchat_inner_button"> <div style="float:left" class="arrowchat_username_message">' + shortname + '</div> </div></div>';
  2893.     },
  2894.     chat_window: function(c, longname, i, l, b) {
  2895.         return '<div class="arrowchat_tabpopup"><div class="arrowchat_tabtitle"> <div class="arrowchat_tab_name">' + c + longname + i + '</div> <div class="arrowchat_closebox"></div> <div class="arrowchat_more_button"> <a href="javascript:void(0)" class="arrowchat_more_anchor" id="arrowchat_more_' + b + '"></a> <div id="arrowchat_more_popout_' + b + '" class="arrowchat_more_popout"> <div id="arrowchat_video_chat_' + b + '" class="arrowchat_video_chat"> ' + lang[60] + ' </div> <div id="arrowchat_file_transfer_' + b + '" class="arrowchat_video_chat"> ' + lang[66] + ' </div> <div id="arrowchat_clear_' + b + '" class="arrowchat_video_chat"> ' + lang[24] + ' </div> <hr class="arrowchat_options_divider" style="margin-top:5px" /> <div id="arrowchat_block_' + b + '" class="arrowchat_video_chat"> ' + lang[84] + ' </div> </div> </div> <div class="arrowchat_chat_popout"></div> </div> <div class="arrowchat_tabcontent"> <div id="arrowchat_file_upload_div_' + b + '" class="arrowchat_file_upload" style="display: none;"> <div class="arrowchat_file_upload_wrapper"> <div style="float: right;"> <div class="arrowchat_ui_button"> <input id="arrowchat_file_upload_' + b + '" name="file_upload" type="file" /> <div class="arrowchat_upload_text">' + lang[86] + '</div> </div> </div> <div class="arrowchat_upload_info_text" style="text-align: left; float: left; position: relative; width:150px"> ' + lang[87] + '<a href="javascript:void(0);" id="arrowchat_file_cancel_' + b + '">' + lang[67] + '</a> </div> <div style="clear: both;"></div> </div> </div> <div class="arrowchat_smiley_box"></div> <div id="arrowchat_chatbox_message_flyout_' + b + '" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text">' + lang[68] + '</span> </div> </div> </div> <div class="arrowchat_tabcontenttext" id="arrowchat_tabcontenttext_' + b + '"></div> <div class="arrowchat_tabcontentinput"><textarea class="arrowchat_textarea"></textarea><div class="arrowchat_smiley_button"></div></div> </div></div>';
  2896.     },
  2897.     buddylist_tab: function() {
  2898.         return '<div class="arrowchat_inner_button"> <div id="arrowchat_userstab_icon"></div> <div id="arrowchat_userstab_text" style="float:left"><b>' + lang[4] + '</b> (<b>0</b>)</div> </div>';
  2899.     },
  2900.     buddylist_window: function(d, _ts, acp) {
  2901.         return '<div class="arrowchat_userstabtitle"> <div class="arrowchat_tab_name">' + lang[4] + '</div> <div class="arrowchat_more_button"> <a href="javascript:void(0);" class="arrowchat_panel_item arrowchat_more_anchor"></a> <div id="arrowchat_options_flyout" class=""> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_sound" class="arrowchat_menu_anchor"> <span>' + lang[6] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_window_open" class="arrowchat_menu_anchor"> <span>' + lang[17] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_names_only" class="arrowchat_menu_anchor"> <span>' + lang[18] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_block_list" class="arrowchat_menu_anchor" style="background:none"> <span>' + lang[95] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_separator"></li> <li class="arrowchat_menu_item"> <a id="arrowchat_gooffline" class="arrowchat_menu_anchor"> <span>' + lang[5] + '</span> </a> </li> </ul> <div class="arrowchat_block_menu"> <div class="arrowchat_block_menu_text">' + lang[96] + '</div> <div style="float:left"> <select></select> </div> <div class="arrowchat_ui_button" id="arrowchat_unblock_button" style="float:right"> <div style="width:45px;height:18px;position:relative;top:2px;left:-1px;">' + lang[97] + '</div> </div> </div> </div> </div> <div class="arrowchat_theme_button"> <a href="javascript:void(0);" class="arrowchat_theme_link arrowchat_more_anchor"></a> <div id="arrowchat_theme_flyout" class=""> <div class="arrowchat_theme_menu"> <div class="arrowchat_theme_menu_text">' + lang[108] + '</div> <div style="float:left"> <select class="arrowchat_themeswitcher">' + _ts + '</select> </div> <div class="arrowchat_ui_button" id="arrowchat_theme_button" style="float:right"> <div style="width:45px;height:18px;position:relative;top:2px;left:-1px;">' + lang[109] + '</div> </div> </div> </div> </div> </div> <div class="arrowchat_powered_by">' + acp + '</div> <div class="arrowchat_facebook_connect"></div> <div class="arrowchat_tabcontent arrowchat_tabstyle"> <div id="arrowchat_buddylist_message_flyout" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text"></span> </div> </div> </div> <div class="arrowchat_enter_name_wrapper"> <input placeholder="' + lang[119] + '" type="text" id="arrowchat_guest_name_input" maxlength="25" /> </div> <div id="arrowchat_userscontent"> <div id="arrowchat_userslist_available"></div> <div id="arrowchat_userslist_busy"></div> <div id="arrowchat_userslist_away"></div> <div id="arrowchat_userslist_invisible"></div> <div id="arrowchat_userslist_offline"></div> </div> <div id="arrowchat_search_friends"> <input type="text" class="arrowchat_search_friends_text" placeholder="' + lang[12] + '" /> </div> </div>';
  2902.     },
  2903.     maintenance_tab: function(c_login_url) {
  2904.         if (c_login_url == "") c_login_url = "#";
  2905.         return '<div id="arrowchat_maintenance" class="arrowchat_bar_right arrowchat_bar_button"><a href="' + c_login_url + '"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_maintenance_icon" /> </div></a></div>';
  2906.     },
  2907.     announcements_display: function(h) {
  2908.         return '<div id="arrowchat_announcement"> <div class="arrowchat_announcement_content"> ' + h.data + ' <div class="arrowchat_announce_close_div"> <span class="arrowchat_announce_close"><a href="javascript:void(0);">' + lang[28] + '</a></span> </div> </div> <div class="arrowchat_announcement_tip_pos"></div> </div>';
  2909.     },
  2910.     chatrooms_tab: function() {
  2911.         return '<div id="arrowchat_chatrooms_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <div id="arrowchat_chatrooms_icon"></div> <div id="arrowchat_chatrooms_text" style="float:left">' + lang[19] + '</div> </div></div>';
  2912.     },
  2913.     chatrooms_window: function() {
  2914.         return '<div id="arrowchat_chatrooms_popup" class="arrowchat_tabpopup"><div class="arrowchat_chatrooms_title"> <div class="arrowchat_tab_name">' + lang[19] + '</div> <div class="arrowchat_more_button" id="arrowchat_chatroom_options"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item2"></a> <div id="arrowchat_chatroom_options_flyout"> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_window" class="arrowchat_menu_anchor"> <span>' + lang[36] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_stay" class="arrowchat_menu_anchor"> <span>' + lang[47] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_sound" class="arrowchat_menu_anchor"> <span>' + lang[101] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_separator"></li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_block" class="arrowchat_menu_anchor"> <span>' + lang[38] + '</span> <input type="checkbox" checked="" /> </a> </li> </div> </div> <div class="arrowchat_chatroom_create" id="arrowchat_chatroom_create"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item"></a> </div> <div class="arrowchat_chatroom_leave" id="arrowchat_chatroom_leave"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item3"></a> </div> <div class="arrowchat_chatroom_popout"></div> </div> <div class="arrowchat_clearfix"></div> <div class="arrowchat_chatroom_content"> <div id="arrowchat_chatroom_create_flyout" class="arrowchat_create_box"> <div class="arrowchat_create_box_wrapper"> <div style="float: right; position:relative; top:3px"> <div class="arrowchat_ui_button" id="arrowchat_create_button"> <div style="width:42px;height:18px;position:relative;top:2px;left:-1px;">' + lang[31] + '</div> </div> </div> <div style="text-align: left; float: left; position: relative; width:170px"> <span>' + lang[91] + '</span> </div> <div style="float:left;position:relative;width:125px;"> <input placeholder="' + lang[98] + '" type="text" id="arrowchat_chatroom_create_input" maxlength="50" /> </div> <div style="float:left;position:relative;width:110px;"> <input placeholder="' + lang[99] + '" type="text" id="arrowchat_chatroom_create_password_input" maxlength="50" /> </div> <div style="clear: both;"></div> </div> </div> <div id="arrowchat_chatroom_password_flyout" class="arrowchat_password_box"> <div class="arrowchat_password_box_wrapper"> <div style="float: right;position:relative; top:3px"> <div class="arrowchat_ui_button" id="arrowchat_password_button"> <div style="width:42px;height:18px;position:relative;top:2px;left:-1px;">' + lang[100] + '</div> </div> </div> <div style="text-align: left; float: left; position: relative; width:170px"> <span>' + lang[50] + '</span> </div> <div style="float:left;position:relative;width:125px;"> <input type="text" id="arrowchat_chatroom_password_input" maxlength="50" /> <input type="hidden" id="arrowchat_chatroom_password_id" value="" /> </div> <div style="clear: both;"></div> </div> </div> <div id="arrowchat_chatroom_message_flyout" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text">' + lang[49] + '</span> </div> </div> </div> <div class="arrowchat_smiley_box"></div> <div class="arrowchat_chatroom_full_content"> </div> </div></div>';
  2915.     },
  2916.     chatrooms_room: function() {
  2917.         return '<div id="arrowchat_chatroom_chat"> </div> <div id="arrowchat_chatroom_room_list"> </div> <div class="arrowchat_clearfix"></div> <div id="arrowchat_chatroom_message"> <div class="arrowchat_chatroom_message_area"> <textarea class="arrowchat_chatroom_message_input"></textarea> <div class="arrowchat_smiley_button"></div> </div> </div>';
  2918.     }
  2919. };
  2920. ArrowChat.IdleTime = 3;
  2921. (function(a) {
  2922.     a.arrowchat = function() {
  2923.         var $body = a("body");
  2924.         var $base;
  2925.         var $maintenance;
  2926.         var $show_bar_button;
  2927.         var $popout_chat_button;
  2928.         var $optionsbutton;
  2929.         var $optionsbutton_popup;
  2930.         var $chatrooms_button;
  2931.         var $buddy_list_tab;
  2932.         var $userstab_popup;
  2933.         var $tooltip = null;
  2934.         var $tooltip_content;
  2935.         var $chatroom_chat;
  2936.         var $chatroom_room_list;
  2937.         var $chatrooms_popup;
  2938.         var $chatroom_create;
  2939.         var $chatroom_create_flyout;
  2940.         var $application_buttons = {};
  2941.         var $application_button_popups = {};
  2942.         var $applications_button;
  2943.         var $applications_button_popup;
  2944.         var $applications_button_popups;
  2945.         var $users = [];
  2946.         var $user_popups = [];
  2947.         var $chatbox_right;
  2948.         var $chatboxes;
  2949.         var $chatboxes_wide;
  2950.         var $chatbox_left;
  2951.  
  2952.         function addHover($elements, classes) {
  2953.             $elements.each(function(i, element) {
  2954.                 a(element).hover(function() {
  2955.                     a(this).addClass(classes);
  2956.                 }, function() {
  2957.                     a(this).removeClass(classes);
  2958.                 });
  2959.             });
  2960.         }
  2961.  
  2962.         function showLoading($element) {
  2963.             a(".arrowchat_hide_loading", $element).hide();
  2964.             a(".arrowchat_show_loading", $element).show();
  2965.         }
  2966.  
  2967.         function hideLoading($element) {
  2968.             a(".arrowchat_hide_loading", $element).show();
  2969.             a(".arrowchat_show_loading", $element).hide();
  2970.         }
  2971.  
  2972.         function closePopup($popup, $button, hidden) {
  2973.             if ($popup !== undefined) {
  2974.                 if (hidden == 1) {
  2975.                     $popup.addClass("arrowchat_tabopen_hidden");
  2976.                 } else {
  2977.                     $popup.removeClass("arrowchat_tabopen");
  2978.                 }
  2979.             }
  2980.             if ($button !== undefined) {
  2981.                 $button.removeClass("arrowchat_tabclick arrowchat_userstabclick arrowchat_trayclick arrowchat_usertabclick");
  2982.             }
  2983.         }
  2984.  
  2985.         function hideTooltip() {
  2986.             if ($tooltip) {
  2987.                 $tooltip.hide();
  2988.             }
  2989.         }
  2990.  
  2991.         function showTooltip($target, text, is_left, custom_left, custom_top, is_sideways) {
  2992.             if ($tooltip === null) {
  2993.                 $tooltip = a("<div id=\"arrowchat_tooltip\"><div class=\"arrowchat_tooltip_content\"></div></div>").appendTo($body);
  2994.                 $tooltip_content = a(".arrowchat_tooltip_content", $tooltip);
  2995.             }
  2996.             $tooltip_content.html(text);
  2997.             var target_offset = $target.offset();
  2998.             var target_width = $target.width();
  2999.             var target_height = $target.height();
  3000.             var tooltip_width = $tooltip.width();
  3001.             if (!custom_left) {
  3002.                 custom_left = 0;
  3003.             }
  3004.             if (!custom_top) {
  3005.                 custom_top = 0;
  3006.             }
  3007.             if (is_left) {
  3008.                 $tooltip.css({
  3009.                     top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
  3010.                     left: target_offset.left + target_width - 16 - custom_left,
  3011.                     display: "block"
  3012.                 }).addClass("arrowchat_tooltip_left");
  3013.             } else if (is_sideways) {
  3014.                 $tooltip.css({
  3015.                     top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
  3016.                     left: target_offset.left + target_width - tooltip_width + 18 - custom_left,
  3017.                     display: "block",
  3018.                     'background-position': tooltip_width - 128 + "px -60px"
  3019.                 }).removeClass("arrowchat_tooltip_left");
  3020.             } else {
  3021.                 $tooltip.css({
  3022.                     top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
  3023.                     left: target_offset.left + target_width - tooltip_width + 18 - custom_left,
  3024.                     display: "block",
  3025.                     'background-position': tooltip_width - 23 + "px -118px"
  3026.                 }).removeClass("arrowchat_tooltip_left");
  3027.             }
  3028.             if (W) {
  3029.                 $tooltip.css("position", "absolute");
  3030.                 $tooltip.css("top", parseInt(a(window).height()) - parseInt($tooltip.css("bottom")) - parseInt($tooltip.height()) + a(window).scrollTop() + "px");
  3031.             }
  3032.         }
  3033.         var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;
  3034.  
  3035.         function replaceURLWithHTMLLinks(text) {
  3036.             return text.replace(exp, "<a href='$1' target='_blank'>$1</a>");
  3037.         }
  3038.         RegExp.escape = function(text) {
  3039.             return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  3040.         };
  3041.  
  3042.         function smileyreplace(mess) {
  3043.             if (c_disable_smilies != 1) {
  3044.                 for (i = 0; i < Smiley.length; i++) {
  3045.                     var smiley_test = Smiley[i][1].replace(/</g, "&lt;").replace(/>/g, "&gt;");
  3046.                     var check_emoticon = mess.lastIndexOf(smiley_test);
  3047.                     if (check_emoticon != -1) {
  3048.                         mess = mess.replace(new RegExp(RegExp.escape(smiley_test), "g"), "<img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" />");
  3049.                     }
  3050.                 }
  3051.             }
  3052.             return mess;
  3053.         }
  3054.  
  3055.         function chatroomKeydown(key, $element) {
  3056.             if (key.keyCode == 13 && key.shiftKey == 0) {
  3057.                 if (msgcount == 0) {
  3058.                     setTimeout(function() {
  3059.                         msgcount = 0;
  3060.                     }, 15000);
  3061.                 }
  3062.                 msgcount++;
  3063.                 if (msgcount > 4 && chatroom_admin != 1 && chatroom_mod != 1) {
  3064.                     displayMessage("arrowchat_chatroom_message_flyout", lang[51], "error");
  3065.                 } else {
  3066.                     var i = $element.val();
  3067.                     i = i.replace(/^\s+|\s+$/g, "");
  3068.                     $element.val("");
  3069.                     $element.css("height", "18px");
  3070.                     $element.css("overflow-y", "hidden");
  3071.                     $element.focus();
  3072.                     i != "" && a.ajax({
  3073.                         url: c_ac_path + "includes/json/send/send_message_chatroom.php",
  3074.                         type: "post",
  3075.                         cache: false,
  3076.                         dataType: "json",
  3077.                         data: {
  3078.                             userid: u_id,
  3079.                             username: u_name,
  3080.                             chatroomid: Ccr,
  3081.                             message: i
  3082.                         },
  3083.                         beforeSend: function() {
  3084.                             a(".arrowchat_chatroom_message_input").addClass("arrowchat_message_sending");
  3085.                         },
  3086.                         error: function() {
  3087.                             a(".arrowchat_chatroom_message_input").removeClass("arrowchat_message_sending");
  3088.                             displayMessage("arrowchat_chatroom_message_flyout", lang[135], "error");
  3089.                         },
  3090.                         success: function(e) {
  3091.                             a(".arrowchat_chatroom_message_input").removeClass("arrowchat_message_sending");
  3092.                             if (e) {
  3093.                                 addMessageToChatroom(e, u_name, i);
  3094.                                 $chatroom_chat.scrollTop($chatroom_chat[0].scrollHeight);
  3095.                             }
  3096.                         }
  3097.                     });
  3098.                     return false;
  3099.                 }
  3100.             }
  3101.         }
  3102.  
  3103.         function userchatKeydown(key, $element, typing, jabber) {
  3104.             if (jabber != 1) {
  3105.                 clearTimeout(pa);
  3106.                 pa = setTimeout(function() {
  3107.                     a.post(c_ac_path + "includes/json/send/send_typing.php", {
  3108.                         userid: u_id,
  3109.                         typing: typing,
  3110.                         untype: 1
  3111.                     }, function() {});
  3112.                     fa = -1;
  3113.                 }, 5000);
  3114.                 if (fa != typing) {
  3115.                     a.post(c_ac_path + "includes/json/send/send_typing.php", {
  3116.                         userid: u_id,
  3117.                         typing: typing
  3118.                     }, function() {});
  3119.                     fa = typing;
  3120.                 }
  3121.             }
  3122.             if (key.keyCode == 13 && key.shiftKey == 0) {
  3123.                 var i = $element.val();
  3124.                 i = i.replace(/^\s+|\s+$/g, "");
  3125.                 $element.val("").css({
  3126.                     height: "18px",
  3127.                     'overflow-y': "hidden"
  3128.                 }).focus();
  3129.                 if (jabber == 1 && i != "") {
  3130.                     sendJabberMessage(typing, i);
  3131.                 } else {
  3132.                     i != "" && a.ajax({
  3133.                         url: c_ac_path + "includes/json/send/send_message.php",
  3134.                         type: "post",
  3135.                         cache: false,
  3136.                         dataType: "json",
  3137.                         data: {
  3138.                             userid: u_id,
  3139.                             to: typing,
  3140.                             message: i
  3141.                         },
  3142.                         beforeSend: function() {
  3143.                             a(".arrowchat_textarea").addClass("arrowchat_message_sending");
  3144.                         },
  3145.                         error: function() {
  3146.                             a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
  3147.                             displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[135], "error");
  3148.                         },
  3149.                         success: function(e) {
  3150.                             a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
  3151.                             if (e) {
  3152.                                 if (e == "-1") {
  3153.                                     displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[102], "error");
  3154.                                 } else {
  3155.                                     addMessageToChatbox(typing, i, "1", "1", e, 1, Math.floor((new Date).getTime() / 1000));
  3156.                                 }
  3157.                             }
  3158.                             K = 1;
  3159.                         }
  3160.                     });
  3161.                 }
  3162.                 return false;
  3163.             }
  3164.         }
  3165.  
  3166.         function resizeChatfield($element) {
  3167.             var height = $element[0].clientHeight;
  3168.             if (height < 94) {
  3169.                 height = Math.max($element[0].scrollHeight, height);
  3170.                 height = Math.min(94, height);
  3171.                 if (height > $element[0].clientHeight) {
  3172.                     $element.css("height", height + 4 + "px");
  3173.                 }
  3174.             } else {
  3175.                 $element.css("overflow-y", "auto");
  3176.             }
  3177.         }
  3178.  
  3179.         function chatroomKeyup(b, $element) {
  3180.             resizeChatfield($element);
  3181.             $chatroom_chat.scrollTop($chatroom_chat[0].scrollHeight);
  3182.         }
  3183.  
  3184.         function userchatKeyup(key, $element, d) {
  3185.             resizeChatfield($element);
  3186.             a(".arrowchat_tabcontenttext", $user_popups[d]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[d])[0].scrollHeight);
  3187.         }
  3188.  
  3189.         function clearUserStatus() {
  3190.             a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2 arrowchat_user_busy2 arrowchat_user_invisible2 arrowchat_user_away2");
  3191.         }
  3192.  
  3193.         function setUserStatus(status) {
  3194.             a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2 arrowchat_user_busy2 arrowchat_user_invisible2");
  3195.             a.post(c_ac_path + "includes/json/send/send_status.php", {
  3196.                 userid: u_id,
  3197.                 status: status
  3198.             }, function() {});
  3199.         }
  3200.  
  3201.         function showUserOffline() {
  3202.             w = 1;
  3203.             clearUserStatus();
  3204.             a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
  3205.             setUserStatus("offline");
  3206.             closePopup($userstab_popup, $buddy_list_tab);
  3207.             closePopup($optionsbutton_popup, $optionsbutton);
  3208.             a("#arrowchat_userstab_text").html(lang[7]);
  3209.         }
  3210.  
  3211.         function buildMaintenance() {
  3212.             $maintenance = a(ArrowChat.Templates.maintenance_tab(c_login_url)).appendTo($base);
  3213.             $maintenance.mouseover(function() {
  3214.                 if (c_guests_login_msg == "1" && u_id == "") {
  3215.                     showTooltip($maintenance, lang[58]);
  3216.                 } else {
  3217.                     showTooltip($maintenance, lang[27]);
  3218.                 }
  3219.                 a(this).addClass("arrowchat_tabmouseover");
  3220.             });
  3221.             $maintenance.mouseout(function() {
  3222.                 a(this).removeClass("arrowchat_tabmouseover");
  3223.                 hideTooltip();
  3224.             });
  3225.         }
  3226.  
  3227.         function buildHideBarButton() {
  3228.             $hide_bar_button = a(ArrowChat.Templates.bar_hide_tab()).appendTo($base);
  3229.             $hide_bar_button.mouseover(function() {
  3230.                 showTooltip($hide_bar_button, lang[14]);
  3231.                 a(this).addClass("arrowchat_tabmouseover");
  3232.             });
  3233.             $hide_bar_button.mouseout(function() {
  3234.                 a(this).removeClass("arrowchat_tabmouseover");
  3235.                 hideTooltip();
  3236.             });
  3237.             $hide_bar_button.click(function() {
  3238.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3239.                     hide: "1"
  3240.                 });
  3241.                 showUserOffline();
  3242.                 closePopup($chatrooms_popup, $chatrooms_button);
  3243.                 closePopup($applications_button_popup, $applications_button);
  3244.                 if (m != "") {
  3245.                     closePopup($application_button_popups[m], $application_buttons[m]);
  3246.                     m = "";
  3247.                 }
  3248.                 if (j != "") {
  3249.                     closePopup($user_popups[j], $users[j]);
  3250.                     a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
  3251.                     j = "";
  3252.                 }
  3253.                 clearTimeout(Z);
  3254.                 a.idleTimer("destroy");
  3255.                 pushCancelAll();
  3256.                 cancelJSONP();
  3257.                 $base.hide();
  3258.                 $show_bar_button.show();
  3259.             });
  3260.         }
  3261.  
  3262.         function buildShowBarButton() {
  3263.             $show_bar_button = a(ArrowChat.Templates.bar_show_tab()).appendTo($body);
  3264.             $show_bar_button.mouseover(function() {
  3265.                 showTooltip($show_bar_button, lang[15]);
  3266.                 a(this).addClass("arrowchat_tabmouseover");
  3267.             });
  3268.             $show_bar_button.mouseout(function() {
  3269.                 a(this).removeClass("arrowchat_tabmouseover");
  3270.                 hideTooltip();
  3271.             });
  3272.             $show_bar_button.click(function() {
  3273.                 showBar();
  3274.             });
  3275.         }
  3276.  
  3277.         function showBar() {
  3278.             a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3279.                 hide: "-1"
  3280.             });
  3281.             setUserStatus("available");
  3282.             a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
  3283.             w = 0;
  3284.             loadBuddyList();
  3285.             pushSubscribe();
  3286.             receiveCore();
  3287.             a.idleTimer(60000 * ArrowChat.IdleTime);
  3288.             $show_bar_button.hide();
  3289.             $base.show();
  3290.         }
  3291.  
  3292.         function startCreateChatRoom() {
  3293.             var i = a("#arrowchat_chatroom_create_input").val();
  3294.             var passinput = a("#arrowchat_chatroom_create_password_input").val();
  3295.             a("#arrowchat_chatroom_create_input").val("");
  3296.             a("#arrowchat_chatroom_create_password_input").val("");
  3297.             i = i.replace(/^\s+|\s+$/g, "");
  3298.             i != "" && a.post(c_ac_path + "includes/json/send/send_chatroom_create.php", {
  3299.                 userid: u_id,
  3300.                 name: i,
  3301.                 password: passinput
  3302.             }, function(e) {
  3303.                 if (e) {
  3304.                     $chatroom_create_flyout.hide("slide", {
  3305.                         direction: "up"
  3306.                     }, 250);
  3307.                     a("#arrowchat_chatroom_options_flyout").removeClass("arrowchat_chatroom_options_flyout_display");
  3308.                     if (e == "-1") {
  3309.                         displayMessage("arrowchat_chatroom_message_flyout", lang[39], "error");
  3310.                     } else if (e == "-2") {
  3311.                         displayMessage("arrowchat_chatroom_message_flyout", lang[40], "error");
  3312.                     } else {
  3313.                         chatroomreceived = 0;
  3314.                         loadChatroomList();
  3315.                     }
  3316.                 }
  3317.             });
  3318.         }
  3319.  
  3320.         function buildChatroomsButton() {
  3321.             $chatrooms_button = a(ArrowChat.Templates.chatrooms_tab()).appendTo($base);
  3322.             $chatrooms_popup = a(ArrowChat.Templates.chatrooms_window()).css("display", "none").appendTo($body);
  3323.             $chatroom_create = a("#arrowchat_chatroom_create");
  3324.             $chatroom_create_flyout = a("#arrowchat_chatroom_create_flyout");
  3325.             $chatrooms_button.css("width", c_width_chatroom + "px");
  3326.             a("#arrowchat_chatroom_create_input").placeholder();
  3327.             a("#arrowchat_chatroom_create_password_input").placeholder();
  3328.             if (c_width_chatroom <= 25) {
  3329.                 a("#arrowchat_chatrooms_text", $chatrooms_button).hide();
  3330.             }
  3331.             if (u_chatroom_block_chats == 1) {
  3332.                 a("#arrowchat_chatroom_block :input").attr("checked", true);
  3333.             } else {
  3334.                 a("#arrowchat_chatroom_block").addClass("arrowchat_menu_unchecked");
  3335.                 a("#arrowchat_chatroom_block :input").attr("checked", false);
  3336.             }
  3337.             if (u_chatroom_sound == 1) {
  3338.                 a("#arrowchat_chatroom_sound :input").attr("checked", true);
  3339.             } else {
  3340.                 a("#arrowchat_chatroom_sound").addClass("arrowchat_menu_unchecked");
  3341.                 a("#arrowchat_chatroom_sound :input").attr("checked", false);
  3342.             }
  3343.             if (u_chatroom_stay != "-1") {
  3344.                 a("#arrowchat_chatroom_stay :input").attr("checked", true);
  3345.             } else {
  3346.                 a("#arrowchat_chatroom_stay").addClass("arrowchat_menu_unchecked");
  3347.                 a("#arrowchat_chatroom_stay :input").attr("checked", false);
  3348.             }
  3349.             if (u_chatroom_open != "-1") {
  3350.                 a("#arrowchat_chatroom_window :input").attr("checked", true);
  3351.             } else {
  3352.                 a("#arrowchat_chatroom_window").addClass("arrowchat_menu_unchecked");
  3353.                 a("#arrowchat_chatroom_window :input").attr("checked", false);
  3354.             }
  3355.             if (c_user_chatrooms == "0") {
  3356.                 $chatroom_create.hide();
  3357.             }
  3358.             $chatrooms_button.click(function() {
  3359.                 count = 0;
  3360.                 if (c_width_chatroom <= 25) {
  3361.                     hideTooltip();
  3362.                 }
  3363.                 if (a(".arrowchat_tabalert", $chatrooms_button).length > 0) {
  3364.                     a(".arrowchat_tabalert", $chatrooms_button).remove();
  3365.                     $chatrooms_button.removeClass("arrowchat_tab_new_message");
  3366.                 }
  3367.                 loadChatroomList();
  3368.                 closePopup($userstab_popup, $buddy_list_tab);
  3369.                 closePopup($optionsbutton_popup, $optionsbutton);
  3370.                 $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
  3371.                 a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
  3372.                 $chatrooms_popup.toggleClass("arrowchat_tabopen");
  3373.                 if ($chatroom_chat !== undefined) {
  3374.                     $chatroom_chat.scrollTop(50000);
  3375.                 }
  3376.                 a(".arrowchat_chatroom_message_input").focus();
  3377.             });
  3378.             $chatrooms_button.mouseover(function() {
  3379.                 if (c_width_chatroom <= 25) {
  3380.                     if ($chatrooms_button.hasClass("arrowchat_tabclick")) {} else {
  3381.                         showTooltip($chatrooms_button, lang[19]);
  3382.                     }
  3383.                 }
  3384.                 a(this).addClass("arrowchat_tabmouseover");
  3385.             });
  3386.             $chatrooms_button.mouseout(function() {
  3387.                 a(this).removeClass("arrowchat_tabmouseover");
  3388.                 hideTooltip();
  3389.             });
  3390.             a("#arrowchat_chatroom_password_input").keydown(function(h) {
  3391.                 if (h.keyCode == 13) {
  3392.                     c = a("#arrowchat_chatroom_password_id").val();
  3393.                     a("#arrowchat_chatroom_password_flyout").hide();
  3394.                     input_value = a("#arrowchat_chatroom_password_input").val();
  3395.                     a("#arrowchat_chatroom_password_input").val("");
  3396.                     input_value = input_value.replace(/^\s+|\s+$/g, "");
  3397.                     a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
  3398.                     $chatroom_create.hide();
  3399.                     Ccr = c;
  3400.                     loadChatroom(c, crt[c], input_value);
  3401.                 }
  3402.             });
  3403.             a("#arrowchat_password_button").click(function() {
  3404.                 c = a("#arrowchat_chatroom_password_id").val();
  3405.                 a("#arrowchat_chatroom_password_flyout").hide();
  3406.                 input_value = a("#arrowchat_chatroom_password_input").val();
  3407.                 a("#arrowchat_chatroom_password_input").val("");
  3408.                 input_value = input_value.replace(/^\s+|\s+$/g, "");
  3409.                 a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
  3410.                 $chatroom_create.hide();
  3411.                 Ccr = c;
  3412.                 loadChatroom(c, crt[c], input_value);
  3413.             });
  3414.             a("#arrowchat_chatroom_stay").click(function() {
  3415.                 a(this).toggleClass("arrowchat_menu_unchecked");
  3416.                 if (a("#arrowchat_chatroom_stay :input").is(":checked")) {
  3417.                     a("#arrowchat_chatroom_stay :input").attr("checked", false);
  3418.                     _chatroomstay = -1;
  3419.                 } else {
  3420.                     a("#arrowchat_chatroom_stay :input").attr("checked", true);
  3421.                     u_chatroom_stay = Ccr;
  3422.                     _chatroomstay = Ccr;
  3423.                 }
  3424.                 if (a("#arrowchat_chatroom_window :input").is(":checked")) {
  3425.                     a("#arrowchat_chatroom_window").toggleClass("arrowchat_menu_unchecked");
  3426.                     a("#arrowchat_chatroom_window :input").attr("checked", false);
  3427.                 }
  3428.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3429.                     chatroom_stay: _chatroomstay
  3430.                 }, function() {});
  3431.             });
  3432.             a("#arrowchat_chatroom_window").click(function() {
  3433.                 a(this).toggleClass("arrowchat_menu_unchecked");
  3434.                 if (a("#arrowchat_chatroom_window :input").is(":checked")) {
  3435.                     a("#arrowchat_chatroom_window :input").attr("checked", false);
  3436.                     _chatroomwindow = -1;
  3437.                 } else {
  3438.                     a("#arrowchat_chatroom_window :input").attr("checked", true);
  3439.                     u_chatroom_open = Ccr;
  3440.                     _chatroomwindow = Ccr;
  3441.                 }
  3442.                 if (a("#arrowchat_chatroom_stay :input").is(":checked")) {
  3443.                     a("#arrowchat_chatroom_stay").toggleClass("arrowchat_menu_unchecked");
  3444.                     a("#arrowchat_chatroom_stay :input").attr("checked", false);
  3445.                 }
  3446.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3447.                     chatroom_window: _chatroomwindow
  3448.                 }, function() {});
  3449.             });
  3450.             a("#arrowchat_chatroom_block").click(function() {
  3451.                 a(this).toggleClass("arrowchat_menu_unchecked");
  3452.                 if (a("#arrowchat_chatroom_block :input").is(":checked")) {
  3453.                     a("#arrowchat_chatroom_block :input").attr("checked", false);
  3454.                     _chatroomblock = -1;
  3455.                 } else {
  3456.                     a("#arrowchat_chatroom_block :input").attr("checked", true);
  3457.                     _chatroomblock = 1;
  3458.                 }
  3459.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3460.                     chatroom_block_chats: _chatroomblock
  3461.                 }, function() {});
  3462.             });
  3463.             a("#arrowchat_chatroom_sound").click(function() {
  3464.                 a(this).toggleClass("arrowchat_menu_unchecked");
  3465.                 if (a("#arrowchat_chatroom_sound :input").is(":checked")) {
  3466.                     a("#arrowchat_chatroom_sound :input").attr("checked", false);
  3467.                     _chatroomsound = -1;
  3468.                     u_chatroom_sound = 0;
  3469.                 } else {
  3470.                     a("#arrowchat_chatroom_sound :input").attr("checked", true);
  3471.                     _chatroomsound = 1;
  3472.                     u_chatroom_sound = 1;
  3473.                 }
  3474.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3475.                     chatroom_sound: _chatroomsound
  3476.                 }, function() {});
  3477.             });
  3478.             a(".arrowchat_chatrooms_title", $chatrooms_popup).click(function() {
  3479.                 $chatrooms_button.click();
  3480.             }).children().not(".arrowchat_tab_name").click(function() {
  3481.                 return false;
  3482.             });
  3483.             a(".arrowchat_chatrooms_title", $chatrooms_popup).mouseenter(function() {
  3484.                 a(this).addClass("arrowchat_chatboxtabtitlemouseover3");
  3485.             });
  3486.             a(".arrowchat_chatrooms_title", $chatrooms_popup).mouseleave(function() {
  3487.                 a(this).removeClass("arrowchat_chatboxtabtitlemouseover3");
  3488.             });
  3489.             a("#arrowchat_chatroom_create_input").keydown(function(h) {
  3490.                 if (h.keyCode == 13) {
  3491.                     startCreateChatRoom();
  3492.                 }
  3493.             });
  3494.             a("#arrowchat_create_button").click(function() {
  3495.                 startCreateChatRoom();
  3496.             });
  3497.             a("#arrowchat_chatroom_leave").click(function() {
  3498.                 if (a(".arrowchat_smiley_box", $chatrooms_popup).is(":visible")) {
  3499.                     a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
  3500.                         direction: "up"
  3501.                     }, 250, function() {});
  3502.                 }
  3503.                 clearTimeout(Crref2);
  3504.                 a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19]);
  3505.                 a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
  3506.                 a("#arrowchat_chatroom_leave").hide();
  3507.                 a(".arrowchat_chatroom_popout").hide();
  3508.                 if (c_user_chatrooms == "1") {
  3509.                     $chatroom_create.show();
  3510.                 }
  3511.                 chatroomreceived = 0;
  3512.                 loadChatroomList();
  3513.                 var retain_ccr = Ccr;
  3514.                 Ccr = 0;
  3515.                 if (c_push_engine != 1) {
  3516.                     cancelJSONP();
  3517.                     receiveCore();
  3518.                 } else {
  3519.                     changePushChannel("chatroom" + retain_ccr, 0);
  3520.                 }
  3521.             });
  3522.             a(".arrowchat_chatroom_leave").mouseenter(function() {
  3523.                 showTooltip(a(this), lang[92], 0, 10, 5);
  3524.                 a(this).addClass("arrowchat_chatroom_leave_hover");
  3525.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
  3526.             });
  3527.             a(".arrowchat_chatroom_leave").mouseleave(function() {
  3528.                 a(this).removeClass("arrowchat_chatroom_leave_hover");
  3529.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
  3530.                 hideTooltip();
  3531.             });
  3532.  
  3533.             function i() {
  3534.                 a("#arrowchat_chatroom_options_flyout").removeClass("arrowchat_chatroom_options_flyout_display");
  3535.             }
  3536.  
  3537.             function kal() {
  3538.                 if ($chatroom_create_flyout.is(":visible")) {
  3539.                     $chatroom_create_flyout.hide("slide", {
  3540.                         direction: "up"
  3541.                     }, 250);
  3542.                 }
  3543.             }
  3544.             a(".arrowchat_chatroom_item").click(function() {
  3545.                 i();
  3546.                 if (a(".arrowchat_chatroom_item2").hasClass("arrowchat_more_button_selected")) {
  3547.                     a(".arrowchat_chatroom_item2").toggleClass("arrowchat_more_button_selected");
  3548.                 }
  3549.                 if (!$chatroom_create_flyout.is(":visible")) {
  3550.                     $chatroom_create_flyout.show("slide", {
  3551.                         direction: "up"
  3552.                     }, 250);
  3553.                 } else {
  3554.                     $chatroom_create_flyout.hide("slide", {
  3555.                         direction: "up"
  3556.                     }, 250);
  3557.                 }
  3558.                 if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
  3559.                     a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
  3560.                     a("#arrowchat_chatroom_password_flyout").hide("slide", {
  3561.                         direction: "up"
  3562.                     }, 250);
  3563.                 }
  3564.             });
  3565.             a(".arrowchat_chatroom_item").mouseenter(function() {
  3566.                 showTooltip(a(this), lang[93], 0, 10, 5);
  3567.                 a(this).parent().addClass("arrowchat_chatroom_create_hover");
  3568.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
  3569.             });
  3570.             a(".arrowchat_chatroom_item").mouseleave(function() {
  3571.                 hideTooltip();
  3572.                 a(this).parent().removeClass("arrowchat_chatroom_create_hover");
  3573.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
  3574.             });
  3575.             a(".arrowchat_chatroom_item2").click(function() {
  3576.                 hideTooltip();
  3577.                 kal();
  3578.                 a("#arrowchat_chatroom_options_flyout").toggleClass("arrowchat_chatroom_options_flyout_display");
  3579.                 a(this).addClass("arrowchat_more_button_hover");
  3580.                 a(this).toggleClass("arrowchat_more_button_selected");
  3581.             });
  3582.             a(".arrowchat_chatroom_item2").mouseenter(function() {
  3583.                 showTooltip(a(this), lang[23], 0, 10, 5);
  3584.                 a(this).parent().addClass("arrowchat_more_button_hover");
  3585.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
  3586.             });
  3587.             a(".arrowchat_chatroom_item2").mouseleave(function() {
  3588.                 hideTooltip();
  3589.                 a(this).parent().removeClass("arrowchat_more_button_hover");
  3590.                 a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
  3591.             });
  3592.         }
  3593.  
  3594.         function buildPopoutChatButton() {
  3595.             $popout_chat_button = 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($base);
  3596.             $popout_chat_button.mouseover(function() {
  3597.                 showTooltip($popout_chat_button, lang[11]);
  3598.                 a(this).addClass("arrowchat_tabmouseover");
  3599.             });
  3600.             $popout_chat_button.mouseout(function() {
  3601.                 a(this).removeClass("arrowchat_tabmouseover");
  3602.                 hideTooltip();
  3603.             });
  3604.             $popout_chat_button.click(function() {
  3605.                 a(this).hide();
  3606.                 $buddy_list_tab.show();
  3607.                 $chatboxes.show();
  3608.                 $chatbox_right.show();
  3609.                 $chatbox_left.show();
  3610.                 if (j != "") {
  3611.                     $user_popups[j].show();
  3612.                 }
  3613.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3614.                     popoutchat: "99"
  3615.                 }, function() {});
  3616.                 loadBuddyList();
  3617.                 receiveCore();
  3618.                 pushSubscribe();
  3619.                 a.idleTimer(60000 * ArrowChat.IdleTime);
  3620.             });
  3621.         }
  3622.  
  3623.         function buildApplicationButtons() {
  3624.             var pold = apps.slice();
  3625.  
  3626.             function mysortfn(a, b) {
  3627.                 if (a[13] < b[13]) {
  3628.                     return -1;
  3629.                 }
  3630.                 if (a[13] > b[13]) {
  3631.                     return 1;
  3632.                 }
  3633.                 return 0;
  3634.             }
  3635.             apps.sort(mysortfn);
  3636.             for (b in apps) {
  3637.                 if (typeof apps[b][0] != "undefined") {
  3638.                     if (apps[b][10] == "" || apps[b][10] == 0) {
  3639.                         apps[b][10] = 16;
  3640.                     }
  3641.                     $application_buttons[apps[b][0]] = a("<div/>").attr("id", "arrowchat_applications_button_" + apps[b][0]).addClass("arrowchat_appname_" + apps[b][2]).addClass("arrowchat_bar_left").addClass("arrowchat_apps_button").css("width", apps[b][10] + "px").html(ArrowChat.Templates.applications_bookmarks_tab(c_ac_path, apps, b)).appendTo($base);
  3642.                     if ((apps[b][12] == "1" || apps[b][9] != "1" && u_id == "" || u_id != "" && apps[b][9] != "1" && u_is_guest == "1") && c_no_apps_menu != 1) {
  3643.                         $application_buttons[apps[b][0]].hide();
  3644.                     }
  3645.                     if (apps[b][6] == "") {
  3646.                         $application_button_popups[apps[b][0]] = a("<div/>").attr("id", "arrowchat_applications_button_" + apps[b][0] + "_popup").addClass("arrowchat_apppopup").css("display", "none").html(ArrowChat.Templates.applications_bookmarks_window(c_ac_path, apps, b)).appendTo($body);
  3647.                     }
  3648.                 }
  3649.             }
  3650.             apps = pold.slice();
  3651.             a(".arrowchat_app_keep_open").addClass("arrowchat_menu_unchecked");
  3652.             a(".arrowchat_app_keep_open :input").attr("checked", false);
  3653.             if (u_apps_open != "" && u_apps_open != "0") {
  3654.                 a("#arrowchat_app_keep_open_" + u_apps_open + " :input").attr("checked", true);
  3655.                 a("#arrowchat_app_keep_open_" + u_apps_open).removeClass("arrowchat_menu_unchecked");
  3656.             }
  3657.             a(".arrowchat_apps_button").mouseover(function() {
  3658.                 var c = a(this).attr("id").substr(30);
  3659.                 if ($application_buttons[c].hasClass("arrowchat_trayclick")) {} else {
  3660.                     if (apps[c][10] <= 16 || apps[c][10] == "") {
  3661.                         showTooltip($application_buttons[c], apps[c][1], true);
  3662.                     }
  3663.                 }
  3664.                 a(this).addClass("arrowchat_tabmouseover");
  3665.             });
  3666.             a(".arrowchat_apps_button").mouseout(function() {
  3667.                 a(this).removeClass("arrowchat_tabmouseover");
  3668.                 hideTooltip();
  3669.             });
  3670.             a(".arrowchat_traytitle").click(function() {
  3671.                 var e = a(this).parent().attr("id");
  3672.                 e = e.substring(30, e.length - 6);
  3673.                 if ($application_buttons[e]) {
  3674.                     $application_buttons[e].click();
  3675.                 }
  3676.             }).children().not(".arrowchat_tab_name").click(function() {
  3677.                 return false;
  3678.             });
  3679.             a(".arrowchat_traytitle").each(function(i, element) {
  3680.                 a(element).mouseenter(function() {
  3681.                     a(this).addClass("arrowchat_chatboxtabtitlemouseover");
  3682.                 });
  3683.                 a(element).mouseleave(function() {
  3684.                     a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
  3685.                 });
  3686.             });
  3687.             a(".arrowchat_traytitle .arrowchat_more_button").each(function(i, element) {
  3688.                 a(element).mouseenter(function() {
  3689.                     showTooltip(a(this), lang[23], 0, 10, 5);
  3690.                     a(this).addClass("arrowchat_more_button_hover");
  3691.                     a(".arrowchat_traytitle").removeClass("arrowchat_chatboxtabtitlemouseover");
  3692.                 });
  3693.                 a(element).mouseleave(function() {
  3694.                     hideTooltip();
  3695.                     a(this).removeClass("arrowchat_more_button_hover");
  3696.                     a(".arrowchat_traytitle").addClass("arrowchat_chatboxtabtitlemouseover");
  3697.                 });
  3698.             });
  3699.             a(".arrowchat_traytitle .arrowchat_more_anchor").click(function() {
  3700.                 hideTooltip();
  3701.                 var c = a(this).attr("id").substr(20);
  3702.                 a("#arrowchat_apps_more_popout_" + c).toggle();
  3703.                 a(this).addClass("arrowchat_more_button_hover");
  3704.                 a(this).toggleClass("arrowchat_more_button_selected");
  3705.             });
  3706.             addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
  3707.             a(".arrowchat_app_keep_open").click(function() {
  3708.                 var c = a(this).attr("id").substr(24);
  3709.                 a(".arrowchat_app_keep_open").addClass("arrowchat_menu_unchecked");
  3710.                 if (a("#arrowchat_app_keep_open_" + c + " :input").is(":checked")) {
  3711.                     a("#arrowchat_app_keep_open_" + c + " :input").attr("checked", false);
  3712.                     var keep_open_id = -1;
  3713.                     u_apps_open = "";
  3714.                 } else {
  3715.                     a(".arrowchat_app_keep_open :input").attr("checked", false);
  3716.                     a("#arrowchat_app_keep_open_" + c + " :input").attr("checked", true);
  3717.                     var keep_open_id = c;
  3718.                     u_apps_open = c;
  3719.                     a(this).removeClass("arrowchat_menu_unchecked");
  3720.                 }
  3721.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  3722.                     app_keep: keep_open_id
  3723.                 }, function() {});
  3724.             });
  3725.             a(".arrowchat_apps_button").click(function() {
  3726.                 var c = a(this).attr("id").substr(30);
  3727.                 closePopup($applications_button_popup, $applications_button);
  3728.                 a(this).children(".arrowchat_tabalert").remove();
  3729.                 if (apps[c][6] == "") {
  3730.                     if (m != c && m !== "") {
  3731.                         if (apps[m][7] == 1) {
  3732.                             closePopup($application_button_popups[m], $application_buttons[m], 1);
  3733.                         } else {
  3734.                             closePopup($application_button_popups[m], $application_buttons[m]);
  3735.                         }
  3736.                         m = "";
  3737.                     }
  3738.                     if (m == "") {
  3739.                         $application_button_popups[c].css("left", $application_buttons[c].offset().left).css("bottom", "25px").css("width", apps[c][4]);
  3740.                         $application_button_popups[c].removeClass("arrowchat_tabopen_hidden");
  3741.                         $application_button_popups[c].addClass("arrowchat_tabopen");
  3742.                         $application_buttons[c].addClass("arrowchat_trayclick");
  3743.                         if (apps[c][7] != "1" || apps[c][14] != "1") {
  3744.                             a.get(c_ac_path + "applications/" + apps[c][2] + "/index.php", function(d) {
  3745.                                 a("#arrowchat_applications_button_" + apps[c][0] + "_content").html(d);
  3746.                             });
  3747.                         }
  3748.                         apps[c][14] = 1;
  3749.                         m = c;
  3750.                     } else {
  3751.                         if (apps[m][7] == 1) {
  3752.                             closePopup($application_button_popups[m], $application_buttons[m], 1);
  3753.                         } else {
  3754.                             closePopup($application_button_popups[m], $application_buttons[m]);
  3755.                         }
  3756.                         var test = a("#arrowchatapplist_" + m).parent().attr("id");
  3757.                         if (test == "arrowchat_other_applications") {
  3758.                             $application_buttons[m].hide();
  3759.                         }
  3760.                         m = "";
  3761.                     }
  3762.                 } else {
  3763.                     window.open(apps[c][6], "self");
  3764.                 }
  3765.             });
  3766.         }
  3767.  
  3768.         function buildApplicationsButton() {
  3769.             $applications_button = a("<div/>").attr("id", "arrowchat_applications_button").addClass("arrowchat_bar_left").addClass("arrowchat_bar_button").html(ArrowChat.Templates.applications_tab()).appendTo($base);
  3770.             $applications_button_popup = a("<div/>").attr("id", "arrowchat_applications_button_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.applications_window()).appendTo($body);
  3771.             $applications_button.css("width", c_width_apps + "px");
  3772.             if (c_width_apps <= 25) {
  3773.                 a(".arrowchat_tray_name", $applications_button).hide();
  3774.             }
  3775.             var pold = apps.slice();
  3776.  
  3777.             function mysortfn(a, b) {
  3778.                 if (a[13] < b[13]) {
  3779.                     return -1;
  3780.                 }
  3781.                 if (a[13] > b[13]) {
  3782.                     return 1;
  3783.                 }
  3784.                 return 0;
  3785.             }
  3786.             apps.sort(mysortfn);
  3787.             _appslist = "<div style=\"border-bottom: 1px solid #e9e9e9; color: #808080; margin: 3px 2px 4px;\">" + lang[20] + "</div><ul id=\"arrowchat_applications\" class=\"arrowchat_connectedSortable\" style=\"list-style-type: none; margin: 0px; padding: 0px;min-height:20px;\">";
  3788.             for (b in apps) {
  3789.                 if (typeof apps[b][0] != "undefined") {
  3790.                     if (apps[b][12] != "1") {
  3791.                         if (apps[b][9] == "1" && u_id == "" || u_id != "" && u_is_guest == "1" && apps[b][9] == "1" || u_id != "" && u_is_guest != "1") {
  3792.                             _appslist += ArrowChat.Templates.applications_bookmarks_list(c_ac_path, apps, b);
  3793.                         }
  3794.                     }
  3795.                 }
  3796.             }
  3797.             _appslist += "</ul><div style=\"border-bottom: 1px solid #e9e9e9; color: #808080; margin: 8px 2px 4px;\">" + lang[64] + "</div><ul id=\"arrowchat_other_applications\" class=\"arrowchat_connectedSortable\" style=\"list-style-type: none; margin: 0px; padding: 0px;min-height:20px;\">";
  3798.             for (b in apps) {
  3799.                 if (typeof apps[b][0] != "undefined") {
  3800.                     if (apps[b][12] == "1") {
  3801.                         if (apps[b][9] == "1" && u_id == "" || u_id != "" && u_is_guest == "1" && apps[b][9] == "1" || u_id != "" && u_is_guest != "1") {
  3802.                             _appslist += ArrowChat.Templates.applications_bookmarks_list(c_ac_path, apps, b);
  3803.                         }
  3804.                     }
  3805.                 }
  3806.             }
  3807.             _appslist += "</ul>";
  3808.             apps = pold.slice();
  3809.             a("#arrowchat_bookmarks").append("<div>" + _appslist + "</div>");
  3810.             if (u_id != "") {
  3811.                 a("#arrowchat_applications, #arrowchat_other_applications").sortable({
  3812.                     delay: 50,
  3813.                     connectWith: ".arrowchat_connectedSortable",
  3814.                     scroll: false,
  3815.                     axis: "y",
  3816.                     containment: ".arrowchat_traycontent",
  3817.                     update: function() {
  3818.                         var result = a("#arrowchat_other_applications").sortable("toArray");
  3819.                         var result2 = a(this).sortable("serialize") + "&" + a(this).attr("id") + "=1";
  3820.                         a.post(c_ac_path + "includes/json/send/send_settings.php", result2, function() {});
  3821.                         for (var b = 0; b < result.length; b++) {
  3822.                             var c = result[b].substr(17);
  3823.                             $application_buttons[c].hide();
  3824.                             apps[c][12] = "1";
  3825.                         }
  3826.                         var result2 = a("#arrowchat_applications").sortable("toArray");
  3827.                         for (var b = 0; b < result2.length; b++) {
  3828.                             var d = result2[b].substr(17);
  3829.                             $application_buttons[d].show();
  3830.                             apps[d][12] = "";
  3831.                         }
  3832.                     }
  3833.                 });
  3834.             } else {
  3835.                 a(".arrowchat_apps_subtitle").hide();
  3836.             }
  3837.             a(".arrowchat_app_link:not(.ui-sortable-helper)").on("click", function() {
  3838.                 var c = a(this).attr("id").substr(19);
  3839.                 if (apps[c][6] == "") {
  3840.                     $application_buttons[c].show();
  3841.                     closePopup($applications_button_popup, $applications_button);
  3842.                 }
  3843.                 $application_buttons[c].click();
  3844.             });
  3845.             a(".arrowchat_traytitle", $applications_button_popup).mouseenter(function() {
  3846.                 a(this).addClass("arrowchat_chatboxtabtitlemouseover");
  3847.             });
  3848.             a(".arrowchat_traytitle", $applications_button_popup).mouseleave(function() {
  3849.                 a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
  3850.             });
  3851.             $applications_button.mouseover(function() {
  3852.                 if (c_width_apps <= 25) {
  3853.                     if ($applications_button.hasClass("arrowchat_tabclick")) {} else {
  3854.                         showTooltip($applications_button, lang[16], true);
  3855.                     }
  3856.                 }
  3857.                 a(this).addClass("arrowchat_tabmouseover");
  3858.             });
  3859.             $applications_button.mouseout(function() {
  3860.                 a(this).removeClass("arrowchat_tabmouseover");
  3861.                 if (c_width_apps <= 25) {
  3862.                     hideTooltip();
  3863.                 }
  3864.             });
  3865.             a(".arrowchat_traytitle", $applications_button_popup).click(function() {
  3866.                 $applications_button.click();
  3867.             });
  3868.             $applications_button.click(function() {
  3869.                 if (c_width_apps <= 25) {
  3870.                     hideTooltip();
  3871.                 }
  3872.                 if (m != "") {
  3873.                     $application_buttons[m].click();
  3874.                     m = "";
  3875.                 }
  3876.                 $applications_button_popup.css("left", $applications_button.offset().left).css("bottom", "25px");
  3877.                 a(this).toggleClass("arrowchat_tabclick");
  3878.                 $applications_button_popup.toggleClass("arrowchat_tabopen");
  3879.             });
  3880.         }
  3881.  
  3882.         function buildOptionsButton() {
  3883.             $optionsbutton = a("<div/>").attr("id", "arrowchat_optionsbutton").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html(ArrowChat.Templates.notifications_tab()).appendTo($base);
  3884.             $optionsbutton_popup = a("<div/>").attr("id", "arrowchat_optionsbutton_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.notifications_window()).appendTo($body);
  3885.             $optionsbutton.mouseover(function() {
  3886.                 $optionsbutton_popup.hasClass("arrowchat_tabopen") || ($ == 0 ? showTooltip($optionsbutton, lang[0]) : showTooltip($optionsbutton, lang[0]));
  3887.                 a(this).addClass("arrowchat_tabmouseover");
  3888.             });
  3889.             $optionsbutton.mouseout(function() {
  3890.                 a(this).removeClass("arrowchat_tabmouseover");
  3891.                 hideTooltip();
  3892.             });
  3893.             a(".arrowchat_see_all_link").mouseenter(function() {
  3894.                 showTooltip(a(this), lang[21], 0, 10, 5);
  3895.                 a(this).parent().addClass("arrowchat_see_all_button_hover");
  3896.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
  3897.             });
  3898.             a(".arrowchat_see_all_link").mouseleave(function() {
  3899.                 hideTooltip();
  3900.                 a(this).parent().removeClass("arrowchat_see_all_button_hover");
  3901.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
  3902.             });
  3903.             a(".arrowchat_see_all_link").click(function() {
  3904.                 a("#arrowchat_notifications_content").html(lang[25]);
  3905.                 var i = 0;
  3906.                 a.ajax({
  3907.                     url: c_ac_path + "includes/json/receive/receive_notifications.php",
  3908.                     type: "get",
  3909.                     cache: false,
  3910.                     dataType: "json",
  3911.                     success: function(b) {
  3912.                         if (b && b != null) {
  3913.                             a("#arrowchat_notifications_content").html("");
  3914.                             a.each(b, function(e, l) {
  3915.                                 a.each(l, function(f, h) {
  3916.                                     a("<div/>").attr("id", "arrowchat_alert_" + h.alert_id).attr("class", "arrowchat_notification_message_div").html(h.markup).appendTo(a("#arrowchat_notifications_content"));
  3917.                                     i++;
  3918.                                 });
  3919.                             });
  3920.                             if (i == 0) {
  3921.                                 a("#arrowchat_notifications_content").html(lang[9]);
  3922.                             }
  3923.                             if (a(window).height() - $optionsbutton_popup.height() < 80) {
  3924.                                 a("#arrowchat_notifications_content").css("height", a(window).height() - 135);
  3925.                             } else {
  3926.                                 a("#arrowchat_notifications_content").css("height", "auto");
  3927.                             }
  3928.                         }
  3929.                     }
  3930.                 });
  3931.             });
  3932.             $optionsbutton.click(function() {
  3933.                 if (a("#arrowchat_notification_alert").length > 0) {
  3934.                     a("#arrowchat_notification_alert").remove();
  3935.                     $optionsbutton.removeClass("arrowchat_tab_new_message");
  3936.                 }
  3937.                 closePopup($chatrooms_popup, $chatrooms_button);
  3938.                 if (Q > 0) {
  3939.                     a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
  3940.                     a.post(c_ac_path + "includes/json/send/send_notifications.php", {
  3941.                         userid: u_id
  3942.                     }, function() {});
  3943.                     Q = 0;
  3944.                 }
  3945.                 if ($ == 0) {
  3946.                     if (w == 1) {
  3947.                         w = 0;
  3948.                         a("#arrowchat_userstab_text").html(lang[4] + " (<b>" + (R + jabberOnlineNumber) + "</b>)");
  3949.                         receiveCore();
  3950.                         a(".available", $optionsbutton_popup).click();
  3951.                     }
  3952.                     hideTooltip();
  3953.                     $optionsbutton_popup.css("left", $optionsbutton.offset().left - $optionsbutton_popup.outerWidth() + $optionsbutton.outerWidth()).css("bottom", "25px");
  3954.                     a(this).toggleClass("arrowchat_tabclick");
  3955.                     $optionsbutton_popup.toggleClass("arrowchat_tabopen");
  3956.                     $optionsbutton.toggleClass("arrowchat_optionsimages_click");
  3957.                     closePopup($userstab_popup, $buddy_list_tab);
  3958.                 } else if (lang[16] != "") {
  3959.                     location.href = lang[16];
  3960.                 }
  3961.                 if (a(window).height() - $optionsbutton_popup.height() < 80) {
  3962.                     a("#arrowchat_notifications_content").css("height", a(window).height() - 135);
  3963.                 } else {
  3964.                     a("#arrowchat_notifications_content").css("height", "auto");
  3965.                 }
  3966.             });
  3967.             a(".arrowchat_userstabtitle", $optionsbutton_popup).click(function() {
  3968.                 $optionsbutton.click();
  3969.             }).children().not(".arrowchat_tab_name").click(function() {
  3970.                 return false;
  3971.             });
  3972.             a(".arrowchat_userstabtitle", $optionsbutton_popup).mouseenter(function() {
  3973.                 a(this).addClass("arrowchat_chatboxtabtitlemouseover2");
  3974.             });
  3975.             a(".arrowchat_userstabtitle", $optionsbutton_popup).mouseleave(function() {
  3976.                 a(this).removeClass("arrowchat_chatboxtabtitlemouseover2");
  3977.             });
  3978.         }
  3979.  
  3980.         function displayMessage(id, message, type) {
  3981.             clearTimeout(message_timeout);
  3982.             if (a("#" + id).is(":visible")) {
  3983.                 a("#" + id).hide("slide", {
  3984.                     direction: "up"
  3985.                 }, 250, function() {
  3986.                     a("#" + id + " .arrowchat_message_text").html(message);
  3987.                     type == "error" && a(".arrowchat_message_box").css("background-color", "#ffe2e2").css("border-bottom", "1px solid #ffbebe");
  3988.                     type == "notice" && a(".arrowchat_message_box").css("background-color", "#fffae2").css("border-bottom", "1px solid #ffecbe");
  3989.                     a("#" + id).show("slide", {
  3990.                         direction: "up"
  3991.                     }, 250);
  3992.                 });
  3993.             } else {
  3994.                 type == "error" && a(".arrowchat_message_box").css("background-color", "#ffe2e2").css("border-bottom", "1px solid #ffbebe");
  3995.                 type == "notice" && a(".arrowchat_message_box").css("background-color", "#fffae2").css("border-bottom", "1px solid #ffecbe");
  3996.                 a("#" + id + " .arrowchat_message_text").html(message);
  3997.                 a("#" + id).show("slide", {
  3998.                     direction: "up"
  3999.                 }, 250);
  4000.             }
  4001.             message_timeout = setTimeout(function() {
  4002.                 a("#" + id).hide("slide", {
  4003.                     direction: "up"
  4004.                 }, 250);
  4005.             }, 5000);
  4006.         }
  4007.  
  4008.         function loadChatroom(b, c, pass) {
  4009.             var global_mod = 0,
  4010.                 global_admin = 0,
  4011.                 admin_markup = "";
  4012.             chatroom_mod = 0;
  4013.             chatroom_admin = 0;
  4014.             chatroomreceived = 1;
  4015.             a.ajax({
  4016.                 url: c_ac_path + "includes/json/receive/receive_chatroom_room.php",
  4017.                 data: {
  4018.                     chatroomid: b,
  4019.                     chatroom_window: u_chatroom_open,
  4020.                     chatroom_stay: u_chatroom_stay,
  4021.                     chatroom_pw: pass
  4022.                 },
  4023.                 type: "post",
  4024.                 cache: false,
  4025.                 dataType: "json",
  4026.                 success: function(o) {
  4027.                     if (o) {
  4028.                         clearTimeout(Crref2);
  4029.                         var no_error = true;
  4030.                         o && a.each(o, function(i, e) {
  4031.                             if (i == "error") {
  4032.                                 a.each(e, function(l, f) {
  4033.                                     no_error = false;
  4034.                                     Ccr = 0;
  4035.                                     chatroomreceived = 0;
  4036.                                     loadChatroomList();
  4037.                                     displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
  4038.                                 });
  4039.                             }
  4040.                         });
  4041.                         if (no_error) {
  4042.                             setTimeout(function() {
  4043.                                 receiveChatroom(b);
  4044.                             }, 30000);
  4045.                             if (c_push_engine != 1) {
  4046.                                 cancelJSONP();
  4047.                                 receiveCore();
  4048.                             } else {
  4049.                                 changePushChannel("chatroom" + b, 1);
  4050.                             }
  4051.                             if (typeof crt2[b] != "undefined") {
  4052.                                 a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19] + "&nbsp;&nbsp;(" + crt2[b] + ")");
  4053.                             }
  4054.                             a("#arrowchat_chatroom_leave").show();
  4055.                             a(".arrowchat_chatroom_full_content").html(ArrowChat.Templates.chatrooms_room());
  4056.                             $chatroom_chat = a("#arrowchat_chatroom_chat");
  4057.                             $chatroom_room_list = a("#arrowchat_chatroom_room_list");
  4058.                             if (c_popout_on == 1) {
  4059.                                 a(".arrowchat_chatroom_popout", $chatrooms_popup).show();
  4060.                             }
  4061.                             a(".arrowchat_chatroom_popout", $chatrooms_popup).mouseenter(function() {
  4062.                                 showTooltip(a(this), lang[117], 0, 10, 5);
  4063.                                 a(this).addClass("arrowchat_chatroom_popout_hover");
  4064.                                 a(".arrowchat_chatrooms_title", $chatrooms_popup).removeClass("arrowchat_chatboxtabtitlemouseover3");
  4065.                             });
  4066.                             a(".arrowchat_chatroom_popout", $chatrooms_popup).mouseleave(function() {
  4067.                                 a(this).removeClass("arrowchat_chatroom_popout_hover");
  4068.                                 a(".arrowchat_chatrooms_title", $chatrooms_popup).addClass("arrowchat_chatboxtabtitlemouseover3");
  4069.                                 hideTooltip();
  4070.                             });
  4071.                             a(".arrowchat_chatroom_popout", $chatrooms_popup).unbind("click");
  4072.                             a(".arrowchat_chatroom_popout", $chatrooms_popup).click(function() {
  4073.                                 window.open(c_ac_path + "public/chatroom/?id=" + b, "chatroom", "menubar=0,resizable=0,width=900,height=650,top=25,left=25,scrollbars=0,status=0");
  4074.                             });
  4075.                             a(".arrowchat_chatroom_message_input", $chatrooms_popup).keydown(function(h) {
  4076.                                 return chatroomKeydown(h, a(this));
  4077.                             });
  4078.                             a(".arrowchat_chatroom_message_input", $chatrooms_popup).keyup(function(h) {
  4079.                                 return chatroomKeyup(h, a(this));
  4080.                             });
  4081.                             var smiley_exist = [];
  4082.                             a(".arrowchat_smiley_box", $chatrooms_popup).html("");
  4083.                             for (var i = 0; i < Smiley.length; i++) {
  4084.                                 if (a.inArray(Smiley[i][0], smiley_exist) > -1) {} else {
  4085.                                     a(".arrowchat_smiley_box", $chatrooms_popup).append("<div class=\"arrowchat_smiley_wrapper\" data-id=\"" + i + "\"><img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" /></div>");
  4086.                                     smiley_exist.push(Smiley[i][0]);
  4087.                                 }
  4088.                             }
  4089.                             a(".arrowchat_smiley_button", $chatrooms_popup).mouseenter(function() {
  4090.                                 a(this).addClass("arrowchat_smiley_button_hover");
  4091.                             });
  4092.                             a(".arrowchat_smiley_button", $chatrooms_popup).mouseleave(function() {
  4093.                                 a(this).removeClass("arrowchat_smiley_button_hover");
  4094.                             });
  4095.                             a(".arrowchat_smiley_wrapper", $chatrooms_popup).click(function() {
  4096.                                 var smiley_code = a(this).attr("data-id");
  4097.                                 var existing_text = a(".arrowchat_chatroom_message_input", $chatrooms_popup).val();
  4098.                                 a(".arrowchat_chatroom_message_input", $chatrooms_popup).focus().val("").val(existing_text + Smiley[smiley_code][1]);
  4099.                                 a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
  4100.                                     direction: "up"
  4101.                                 }, 250, function() {});
  4102.                             });
  4103.                             a(".arrowchat_smiley_button", $chatrooms_popup).click(function() {
  4104.                                 if (a(".arrowchat_smiley_box", $chatrooms_popup).is(":visible")) {
  4105.                                     a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
  4106.                                         direction: "up"
  4107.                                     }, 250, function() {});
  4108.                                 } else {
  4109.                                     a(".arrowchat_smiley_box", $chatrooms_popup).show("slide", {
  4110.                                         direction: "up"
  4111.                                     }, 250, function() {});
  4112.                                 }
  4113.                             });
  4114.                             if (c_disable_smilies == 1) {
  4115.                                 a(".arrowchat_smiley_button").hide();
  4116.                                 a(".arrowchat_chatroom_message_input").css("width", "99%");
  4117.                             }
  4118.                             o && a.each(o, function(i, e) {
  4119.                                 if (i == "user_title") {
  4120.                                     a.each(e, function(l, f) {
  4121.                                         if (f.admin == 1) {
  4122.                                             global_admin = 1;
  4123.                                             chatroom_admin = 1;
  4124.                                         }
  4125.                                         if (f.mod == 1) {
  4126.                                             global_mod = 1;
  4127.                                             chatroom_mod = 1;
  4128.                                         }
  4129.                                     });
  4130.                                 }
  4131.                                 if (i == "chat_name") {
  4132.                                     a.each(e, function(l, f) {
  4133.                                         if (typeof crt2[b] == "undefined") {
  4134.                                             crt2[b] = f.n;
  4135.                                             a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19] + "&nbsp;&nbsp;(" + crt2[b] + ")");
  4136.                                         }
  4137.                                     });
  4138.                                 }
  4139.                                 if (i == "chat_users") {
  4140.                                     var longname;
  4141.                                     a.each(e, function(l, f) {
  4142.                                         if ((global_admin == 1 || global_mod == 1) && f.t == 1) {
  4143.                                             admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_make_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[52] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_ban_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[53] + "</div></div>";
  4144.                                         }
  4145.                                         if (global_admin == 1 && f.t == 2) {
  4146.                                             admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_remove_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[54] + "</div></div>";
  4147.                                         }
  4148.                                         longname = renderHTMLString(f.n);
  4149.                                         f.n = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
  4150.                                         a("<div/>").attr("id", "arrowchat_chatroom_user_" + f.id).mouseover(function() {
  4151.                                             a(this).addClass("arrowchat_chatroom_list_hover");
  4152.                                         }).mouseout(function() {
  4153.                                             a(this).removeClass("arrowchat_chatroom_list_hover");
  4154.                                         }).addClass("arrowchat_chatroom_room_list").addClass("arrowchat_chatroom_admin_" + f.t).html("<img class=\"arrowchat_chatroom_avatar\" src=\"" + f.a + "\"/><span class=\"arrowchat_chatroom_room_name\">" + f.n + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + f.status + "\"></span>").appendTo($chatroom_room_list);
  4155.                                         a("<div/>").attr("id", "arrowchat_chatroom_users_flyout_" + f.id).addClass("arrowchat_chatroom_users_flyout").html("<div class=\"arrowchat_chatroom_title_padding\"><div id=\"arrowchat_chatroom_title_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + longname + "<br/>" + lang[43] + "</div></div><hr class=\"arrowchat_options_divider\"/><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_visit_profile_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[42] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_private_message_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[41] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_block_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[84] + "</div></div>" + admin_markup).appendTo(a("#arrowchat_chatroom_user_" + f.id));
  4156.                                         if (f.t == 2) {
  4157.                                             a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[44]);
  4158.                                         } else if (f.t == 3) {
  4159.                                             a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[45]);
  4160.                                         }
  4161.                                         addHover(a(".arrowchat_chatroom_options_padding"), "arrowchat_options_padding_hover");
  4162.                                         chatroomUserOptions(f, global_admin);
  4163.                                     });
  4164.                                     a(".arrowchat_chatroom_admin_3").css("background-color", "#" + c_admin_bg);
  4165.                                     a(".arrowchat_chatroom_admin_3").css("color", "#" + c_admin_txt);
  4166.                                 }
  4167.                                 if (i == "chat_history") {
  4168.                                     d = "";
  4169.                                     a.each(e, function(l, f) {
  4170.                                         if (typeof blockList[f.userid] == "undefined") {
  4171.                                             var title = "";
  4172.                                             if (f.mod == 1) {
  4173.                                                 title = lang[137];
  4174.                                             }
  4175.                                             if (f.admin == 1) {
  4176.                                                 title = lang[136];
  4177.                                             }
  4178.                                             l = "";
  4179.                                             fromname = f.n;
  4180.                                             if (f.n == u_name) {
  4181.                                                 l = " arrowchat_self";
  4182.                                             }
  4183.                                             var sent_time = new Date(f.t * 1000);
  4184.                                             if (f.global == 1) {
  4185.                                                 d += "<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + f.id + "\"><div class=\"arrowchat_chatroom_message_content" + l + " arrowchat_global_chatroom_message\">" + formatTimestamp(sent_time) + f.m + "</div></div>";
  4186.                                             } else {
  4187.                                                 d += "<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + f.id + "\"><img class=\"arrowchat_chatroom_message_avatar\" src=\"" + f.a + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + fromname + title + ":</div><div class=\"arrowchat_chatroom_message_content" + l + "\">" + formatTimestamp(sent_time) + f.m + "</div></div>";
  4188.                                             }
  4189.                                         }
  4190.                                     });
  4191.                                     $chatroom_chat.html("<div>" + d + "</div>");
  4192.                                     showChatroomTime();
  4193.                                     $chatroom_chat.scrollTop(50000);
  4194.                                 }
  4195.                             });
  4196.                             if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  4197.                                 a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
  4198.                                 a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
  4199.                             }
  4200.                             a(".arrowchat_chatroom_message_input").focus();
  4201.                         } else {
  4202.                             if (c_user_chatrooms == "1") {
  4203.                                 $chatroom_create.show();
  4204.                             }
  4205.                         }
  4206.                     }
  4207.                 }
  4208.             });
  4209.         }
  4210.  
  4211.         function receiveUser(b, c, d, e, l, f, h) {
  4212.             if (!(b == null || b == "")) {
  4213.                 if ((uc_name[b] == null || uc_name[b] == "") && b.toString().search("facebook") == "-1") {
  4214.                     if (aa[b] != 1) {
  4215.                         aa[b] = 1;
  4216.                         a.ajax({
  4217.                             url: c_ac_path + "includes/json/receive/receive_user.php",
  4218.                             data: {
  4219.                                 userid: b
  4220.                             },
  4221.                             type: "post",
  4222.                             cache: false,
  4223.                             dataType: "json",
  4224.                             success: function(o) {
  4225.                                 if (o) {
  4226.                                     c = uc_name[b] = o.n;
  4227.                                     d = uc_status[b] = o.s;
  4228.                                     e = uc_avatar[b] = o.a;
  4229.                                     l = uc_link[b] = o.l;
  4230.                                     if (G[b] != null) {
  4231.                                         a(".arrowchat_closebox_bottom_status", $user[b]).removeClass("arrowchat_available arrowchat_busy arrowchat_offline").addClass("arrowchat_" + d);
  4232.                                         $users[b].removeClass("arrowchat_tab_offline").addClass("arrowchat_tab_" + c);
  4233.                                         $user_popups[b].length > 0 && a(".arrowchat_tabsubtitle .arrowchat_message", $user_popups[b]).html(i);
  4234.                                     }
  4235.                                     aa[b] = 0;
  4236.                                     if (c != null) {
  4237.                                         toggleUserChatTab(b, c, d, e, l, f);
  4238.                                         if (c_mobile_device) {
  4239.                                             mobileSupport();
  4240.                                         }
  4241.                                     } else {
  4242.                                         a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4243.                                             unfocus_chat: b
  4244.                                         }, function() {});
  4245.                                     }
  4246.                                 }
  4247.                             }
  4248.                         });
  4249.                     } else {
  4250.                         setTimeout(function() {
  4251.                             receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f, h);
  4252.                         }, 500);
  4253.                     }
  4254.                 } else {
  4255.                     if (b.toString().search("facebook") == "-1") {
  4256.                         toggleUserChatTab(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f);
  4257.                     } else {
  4258.                         toggleUserChatTab(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f, 1);
  4259.                     }
  4260.                 }
  4261.             }
  4262.         }
  4263.  
  4264.         function toggleUserChatTab(b, c, d, e, l, f, jabber) {
  4265.             if (G[b] != null) {
  4266.                 if (!$users[b].hasClass("arrowchat_tabclick") && f != 1) {
  4267.                     if (j != "") {
  4268.                         closePopup($user_popups[j], $users[j]);
  4269.                         j = "";
  4270.                     }
  4271.                     if ($users[b].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[b].offset().left - $chatboxes.offset().left >= 0) {
  4272.                         $users[b].click();
  4273.                     } else {
  4274.                         a(".arrowchat_tabalert").css("display", "none");
  4275.                         e = 800;
  4276.                         if (get("initialize") == 1) {
  4277.                             e = 0;
  4278.                         }
  4279.                         $chatboxes.scrollTo($users[b], e, function() {
  4280.                             $users[b].click();
  4281.                             updateRightLastClasses();
  4282.                             positionTabAlerts();
  4283.                         });
  4284.                     }
  4285.                 }
  4286.                 updateRightLastClasses();
  4287.             } else {
  4288.                 $chatboxes_wide.width($chatboxes_wide.width() + 148);
  4289.                 adjustBarSize();
  4290.                 shortname = renderHTMLString(c).length > 12 ? renderHTMLString(c).substr(0, 12) + "..." : c;
  4291.                 longname = renderHTMLString(c).length > 17 ? renderHTMLString(c).substr(0, 17) + "..." : c;
  4292.                 $users[b] = a(ArrowChat.Templates.chat_tab(shortname)).attr("data-id", b).appendTo($chatboxes_wide);
  4293.                 $users[b].append("<div class=\"arrowchat_closebox_bottom_status arrowchat_" + d + "\"></div>");
  4294.                 $users[b].addClass("arrowchat_tab_" + d);
  4295.                 jabber == 1 && $users[b].addClass("arrowchat_jabber_user_tab");
  4296.                 $users[b].append("<div class=\"arrowchat_closebox_bottom\"></div>");
  4297.                 a(".arrowchat_closebox_bottom", $users[b]).mouseenter(function() {
  4298.                     a(this).addClass("arrowchat_closebox_bottomhover");
  4299.                 });
  4300.                 a(".arrowchat_closebox_bottom", $users[b]).mouseleave(function() {
  4301.                     a(this).removeClass("arrowchat_closebox_bottomhover");
  4302.                 });
  4303.                 a(".arrowchat_closebox_bottom", $users[b]).click(function() {
  4304.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4305.                         close_chat: b,
  4306.                         tab_alert: 1
  4307.                     }, function() {});
  4308.                     $user_popups[b].remove();
  4309.                     $users[b].remove();
  4310.                     if (j == b) {
  4311.                         j = "";
  4312.                     }
  4313.                     $chatboxes_wide.width($chatboxes_wide.width() - 148);
  4314.                     $chatboxes.scrollTo("-=148px");
  4315.                     adjustBarSize();
  4316.                     y[b] = null;
  4317.                     G[b] = null;
  4318.                     ca[b] = 0;
  4319.                 });
  4320.                 i = c = "";
  4321.                 if (l != "") {
  4322.                     c = "<a href=\"" + l + "\">";
  4323.                     i = "</a>";
  4324.                 }
  4325.                 l = "";
  4326.                 if (e != "") {
  4327.                     l = "<div class=\"arrowchat_avatarbox\">" + c + "<img src=\"" + e + "\" class=\"arrowchat_avatar\" />" + i + "</div>";
  4328.                 }
  4329.                 $user_popups[b] = a(ArrowChat.Templates.chat_window(c, longname, i, l, b)).css("display", "none").appendTo($body);
  4330.                 if (c_video_chat != 1) {
  4331.                     a("#arrowchat_video_chat_" + b).hide();
  4332.                 }
  4333.                 if (c_file_transfer != 1) {
  4334.                     a("#arrowchat_file_transfer_" + b).hide();
  4335.                 }
  4336.                 if (c_popout_on != 1) {
  4337.                     a(".arrowchat_chat_popout").hide();
  4338.                 }
  4339.                 addHover(a(".arrowchat_video_chat"), "arrowchat_more_hover");
  4340.                 a("#arrowchat_file_cancel_" + b).click(function() {
  4341.                     a("#arrowchat_file_upload_div_" + b).hide("slide", {
  4342.                         direction: "up"
  4343.                     }, 250);
  4344.                 });
  4345.                 a("#arrowchat_file_transfer_" + b).click(function() {
  4346.                     var ts67 = Math.round((new Date).getTime());
  4347.                     var path = c_ac_path.replace("../", "/");
  4348.                     a("#arrowchat_file_upload_" + b).uploadify({
  4349.                         swf: path + "includes/js/uploadify/uploadify.swf",
  4350.                         uploader: path + "includes/classes/class_uploads.php",
  4351.                         hideButton: true,
  4352.                         buttonText: " ",
  4353.                         wmode: "transparent",
  4354.                         formData: {
  4355.                             unixtime: ts67,
  4356.                             user: u_id
  4357.                         },
  4358.                         height: 17,
  4359.                         width: 42,
  4360.                         auto: true,
  4361.                         fileTypeExts: "*.jpg;*.gif;*.png;*.zip;*.rar;*.jpeg;*.txt;*.doc;*.mp3;*.wmv;*.avi;*.mp4;*.docx;*.wav",
  4362.                         fileTypeDesc: "Supported File Types (.JPG, .JPEG, .GIF, .PNG, .WMV, .AVI, .MP4, .ZIP, .RAR, .MP3, .WAV, .TXT, .DOC, .DOCX)",
  4363.                         onSelect: function() {
  4364.                             a(".arrowchat_upload_info_text").hide();
  4365.                             a(".arrowchat_upload_text").hide();
  4366.                             a(".arrowchat_ui_button").css("background", "none");
  4367.                             a(".arrowchat_ui_button").css("border", "none");
  4368.                         },
  4369.                         onCancel: function() {
  4370.                             a("#arrowchat_file_upload_div_" + b).hide("slide", {
  4371.                                 direction: "up"
  4372.                             }, 250);
  4373.                             a(".arrowchat_upload_info_text").show();
  4374.                             a(".arrowchat_upload_text").show();
  4375.                             a(".arrowchat_ui_button").css("background", "#5B74A8");
  4376.                             a(".arrowchat_ui_button").css("border", "1px solid #999");
  4377.                         },
  4378.                         onUploadComplete: function() {
  4379.                             a.post(c_ac_path + "includes/json/send/send_message.php", {
  4380.                                 userid: u_id,
  4381.                                 to: b,
  4382.                                 message: "file{" + ts67 + "}"
  4383.                             }, function(e) {
  4384.                                 if (e == "-1") {
  4385.                                     displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
  4386.                                 } else {
  4387.                                     displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[68], "notice");
  4388.                                 }
  4389.                                 a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
  4390.                             });
  4391.                             a("#arrowchat_file_upload_div_" + b).hide();
  4392.                             a(".arrowchat_upload_info_text").show();
  4393.                             a(".arrowchat_upload_text").show();
  4394.                             a(".arrowchat_ui_button").css("background", "#5B74A8");
  4395.                             a(".arrowchat_ui_button").css("border", "1px solid #999");
  4396.                         }
  4397.                     });
  4398.                     a("#arrowchat_more_popout_" + b).toggle();
  4399.                     a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
  4400.                     a("#arrowchat_file_upload_div_" + b).show("slide", {
  4401.                         direction: "up"
  4402.                     }, 250);
  4403.                 });
  4404.                 a("#arrowchat_video_chat_" + b).click(function() {
  4405.                     a("#arrowchat_more_popout_" + b).toggle();
  4406.                     a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
  4407.                     var RN = Math.floor(Math.random() * 9999999999);
  4408.                     while (String(RN).length < 10) {
  4409.                         RN = "0" + RN;
  4410.                     }
  4411.                     jqac.arrowchat.videoWith(RN);
  4412.                     a.post(c_ac_path + "includes/json/send/send_message.php", {
  4413.                         userid: u_id,
  4414.                         to: b,
  4415.                         message: "video{" + RN + "}"
  4416.                     }, function(e) {
  4417.                         if (e == "-1") {
  4418.                             displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
  4419.                         } else {
  4420.                             displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[63], "notice");
  4421.                         }
  4422.                         a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
  4423.                     });
  4424.                 });
  4425.                 var smiley_exist = [];
  4426.                 for (var i = 0; i < Smiley.length; i++) {
  4427.                     if (a.inArray(Smiley[i][0], smiley_exist) > -1) {} else {
  4428.                         a(".arrowchat_smiley_box", $user_popups[b]).append("<div class=\"arrowchat_smiley_wrapper\" data-id=\"" + i + "\"><img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" /></div>");
  4429.                         smiley_exist.push(Smiley[i][0]);
  4430.                     }
  4431.                 }
  4432.                 a(".arrowchat_smiley_button", $user_popups[b]).mouseenter(function() {
  4433.                     a(this).addClass("arrowchat_smiley_button_hover");
  4434.                 });
  4435.                 a(".arrowchat_smiley_button", $user_popups[b]).mouseleave(function() {
  4436.                     a(this).removeClass("arrowchat_smiley_button_hover");
  4437.                 });
  4438.                 a(".arrowchat_smiley_wrapper", $user_popups[b]).click(function() {
  4439.                     var smiley_code = a(this).attr("data-id");
  4440.                     var existing_text = a(".arrowchat_textarea", $user_popups[b]).val();
  4441.                     a(".arrowchat_textarea", $user_popups[b]).focus().val("").val(existing_text + Smiley[smiley_code][1]);
  4442.                     a(".arrowchat_smiley_box", $user_popups[b]).hide("slide", {
  4443.                         direction: "up"
  4444.                     }, 250, function() {});
  4445.                 });
  4446.                 a(".arrowchat_smiley_button", $user_popups[b]).click(function() {
  4447.                     if (a(".arrowchat_smiley_box", $user_popups[b]).is(":visible")) {
  4448.                         a(".arrowchat_smiley_box", $user_popups[b]).hide("slide", {
  4449.                             direction: "up"
  4450.                         }, 250, function() {});
  4451.                     } else {
  4452.                         a(".arrowchat_smiley_box", $user_popups[b]).show("slide", {
  4453.                             direction: "up"
  4454.                         }, 250, function() {});
  4455.                     }
  4456.                 });
  4457.                 if (c_disable_smilies == 1) {
  4458.                     a(".arrowchat_smiley_button").hide();
  4459.                     a(".arrowchat_textarea").css("width", "99%");
  4460.                 }
  4461.                 a(".arrowchat_tabtitle .arrowchat_more_button", $user_popups[b]).mouseenter(function() {
  4462.                     showTooltip(a(this), lang[23], 0, 10, 5);
  4463.                     a(this).addClass("arrowchat_more_button_hover");
  4464.                     a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
  4465.                 });
  4466.                 a(".arrowchat_tabtitle .arrowchat_more_button", $user_popups[b]).mouseleave(function() {
  4467.                     hideTooltip();
  4468.                     a(this).removeClass("arrowchat_more_button_hover");
  4469.                     a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
  4470.                 });
  4471.                 a("#arrowchat_more_" + b).click(function() {
  4472.                     hideTooltip();
  4473.                     a("#arrowchat_more_popout_" + b).toggle();
  4474.                     a(this).addClass("arrowchat_more_button_hover");
  4475.                     a(this).toggleClass("arrowchat_more_button_selected");
  4476.                 });
  4477.                 a("#arrowchat_block_" + b).click(function() {
  4478.                     a("#arrowchat_more_popout_" + b).toggle();
  4479.                     a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
  4480.                     a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).click();
  4481.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4482.                         block_chat: b
  4483.                     }, function() {
  4484.                         if (typeof blockList[b] == "undefined") {
  4485.                             blockList[b] = b;
  4486.                         }
  4487.                         loadBuddyList();
  4488.                     });
  4489.                 });
  4490.                 a("#arrowchat_clear_" + b).click(function() {
  4491.                     a("#arrowchat_more_popout_" + b).toggle();
  4492.                     a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
  4493.                     a("#arrowchat_tabcontenttext_" + b).html("");
  4494.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4495.                         clear_chat: b
  4496.                     }, function() {});
  4497.                 });
  4498.                 a(".arrowchat_textarea", $user_popups[b]).keydown(function(h) {
  4499.                     return userchatKeydown(h, a(this), b, jabber);
  4500.                 });
  4501.                 a(".arrowchat_textarea", $user_popups[b]).keyup(function(h) {
  4502.                     return userchatKeyup(h, a(this), b);
  4503.                 });
  4504.                 a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).mouseenter(function() {
  4505.                     showTooltip(a(this), lang[89], 0, 10, 5);
  4506.                     a(this).addClass("arrowchat_chatboxmouseoverclose");
  4507.                     a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
  4508.                 });
  4509.                 a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).mouseleave(function() {
  4510.                     a(this).removeClass("arrowchat_chatboxmouseoverclose");
  4511.                     a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
  4512.                     hideTooltip();
  4513.                 });
  4514.                 a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).click(function() {
  4515.                     hideTooltip();
  4516.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4517.                         close_chat: b,
  4518.                         tab_alert: 1
  4519.                     }, function() {});
  4520.                     $user_popups[b].remove();
  4521.                     $users[b].remove();
  4522.                     if (j == b) {
  4523.                         j = "";
  4524.                     }
  4525.                     $chatboxes_wide.width($chatboxes_wide.width() - 148);
  4526.                     $chatboxes.scrollTo("-=148px");
  4527.                     adjustBarSize();
  4528.                     G[b] = null;
  4529.                     y[b] = null;
  4530.                     ca[b] = 0;
  4531.                 });
  4532.                 a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).mouseenter(function() {
  4533.                     showTooltip(a(this), lang[88], 0, 10, 5);
  4534.                     a(this).addClass("arrowchat_chat_popout_hover");
  4535.                     a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
  4536.                 });
  4537.                 a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).mouseleave(function() {
  4538.                     a(this).removeClass("arrowchat_chat_popout_hover");
  4539.                     a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
  4540.                     hideTooltip();
  4541.                 });
  4542.                 a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).click(function() {
  4543.                     startPopoutChat();
  4544.                 });
  4545.                 a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).popupWindow({
  4546.                     windowURL: c_ac_path + "public/popout/",
  4547.                     height: 650,
  4548.                     width: 900,
  4549.                     top: 25,
  4550.                     left: 25
  4551.                 });
  4552.                 a(".arrowchat_tabtitle", $user_popups[b]).not(".arrowchat_chat_popout").click(function() {
  4553.                     $users[b].click();
  4554.                 }).children().not(".arrowchat_tab_name").click(function() {
  4555.                     return false;
  4556.                 });
  4557.                 a(".arrowchat_tabtitle", $user_popups[b]).mouseenter(function() {
  4558.                     a(this).addClass("arrowchat_chatboxtabtitlemouseover");
  4559.                 });
  4560.                 a(".arrowchat_tabtitle", $user_popups[b]).mouseleave(function() {
  4561.                     a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
  4562.                 });
  4563.                 $users[b].mouseenter(function() {
  4564.                     a(this).addClass("arrowchat_tabmouseover");
  4565.                     a("div", $users[b]).addClass("arrowchat_tabmouseovertext");
  4566.                 });
  4567.                 $users[b].mouseleave(function() {
  4568.                     a(this).removeClass("arrowchat_tabmouseover");
  4569.                     a("div", $users[b]).removeClass("arrowchat_tabmouseovertext");
  4570.                 });
  4571.                 $users[b].click(function() {
  4572.                     var tba = 0;
  4573.                     if (a(".arrowchat_tabalert", $users[b]).length > 0) {
  4574.                         tba = 1;
  4575.                         a(".arrowchat_tabalert", $users[b]).remove();
  4576.                         $users[b].removeClass("arrowchat_tab_new_message");
  4577.                         G[b] = 0;
  4578.                         y[b] = 0;
  4579.                     }
  4580.                     if (a(this).hasClass("arrowchat_tabclick")) {
  4581.                         closePopup($user_popups[b], a(this));
  4582.                         a(".arrowchat_closebox_bottom", $users[b]).removeClass("arrowchat_closebox_bottom_click");
  4583.                         j = "";
  4584.                         a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4585.                             unfocus_chat: b,
  4586.                             tab_alert: 1
  4587.                         }, function() {});
  4588.                     } else {
  4589.                         if (j != "") {
  4590.                             closePopup($user_popups[j], $users[j]);
  4591.                             a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
  4592.                             j = "";
  4593.                         }
  4594.                         if (!($users[b].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[b].offset().left - $chatboxes.offset().left >= 0)) {
  4595.                             $chatboxes.scrollTo($users[b]);
  4596.                             updateRightLastClasses();
  4597.                         }
  4598.                         if (ca[b] != 1) {
  4599.                             if (jabber == 1) {
  4600.                                 getJabberHistory(b);
  4601.                             } else {
  4602.                                 receiveHistory(b);
  4603.                             }
  4604.                             ca[b] = 1;
  4605.                         }
  4606.                         a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4607.                             focus_chat: b,
  4608.                             tab_alert: tba
  4609.                         }, function() {});
  4610.                         $user_popups[b].css("left", $users[b].offset().left - $user_popups[b].outerWidth() + $users[b].outerWidth()).css("bottom", "25px");
  4611.                         a(this).addClass("arrowchat_tabclick").addClass("arrowchat_usertabclick");
  4612.                         $user_popups[b].addClass("arrowchat_tabopen");
  4613.                         a(".arrowchat_closebox_bottom", $users[b]).addClass("arrowchat_closebox_bottom_click");
  4614.                         j = b;
  4615.                         if (W) {
  4616.                             $user_popups[j].css("position", "absolute").css("top", parseInt(a(window).height()) - parseInt($user_popups[j].css("bottom")) - parseInt($user_popups[j].height()) + a(window).scrollTop() + "px");
  4617.                         }
  4618.                     }
  4619.                     a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
  4620.                     getStatus("updatingsession") != 1 && a(".arrowchat_textarea", $user_popups[b]).focus();
  4621.                 });
  4622.                 f != 1 && $users[b].click();
  4623.                 y[b] = 0;
  4624.                 G[b] = 0;
  4625.                 if (c_disable_avatars == 1) {
  4626.                     a(".arrowchat_avatarbox").hide();
  4627.                     a("#arrowchat_setting_names_only").parent("li").hide();
  4628.                 }
  4629.                 if (jabber == 1) {
  4630.                     a(".arrowchat_more_button", $user_popups[b]).hide();
  4631.                     a(".arrowchat_chat_popout", $user_popups[b]).hide();
  4632.                 }
  4633.             }
  4634.         }
  4635.  
  4636.         function formatTimestamp(b) {
  4637.             var c = "am",
  4638.                 d = b.getHours(),
  4639.                 i = b.getMinutes(),
  4640.                 e = b.getDate();
  4641.             b = b.getMonth();
  4642.             var g = d;
  4643.             if (d > 11) {
  4644.                 c = "pm";
  4645.             }
  4646.             if (d > 12) {
  4647.                 d -= 12;
  4648.             }
  4649.             if (d == 0) {
  4650.                 d = 12;
  4651.             }
  4652.             if (d < 10) {
  4653.                 d = d;
  4654.             }
  4655.             if (i < 10) {
  4656.                 i = "0" + i;
  4657.             }
  4658.             var l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  4659.                 f = "th";
  4660.             if (e == 1 || e == 21 || e == 31) {
  4661.                 f = "st";
  4662.             } else if (e == 2 || e == 22) {
  4663.                 f = "nd";
  4664.             } else if (e == 3 || e == 23) {
  4665.                 f = "rd";
  4666.             }
  4667.             if (c_us_time != 1) {
  4668.                 return e != Na ? "<span class=\"arrowchat_ts\">" + g + ":" + i + " " + e + f + " " + l[b] + "</span>" : "<span class=\"arrowchat_ts\">" + g + ":" + i + "</span>";
  4669.             } else {
  4670.                 return e != Na ? "<span class=\"arrowchat_ts\">" + d + ":" + i + c + " " + e + f + " " + l[b] + "</span>" : "<span class=\"arrowchat_ts\">" + d + ":" + i + c + "</span>";
  4671.             }
  4672.         }
  4673.  
  4674.         function receiveHistory(b, times) {
  4675.             if (times) {} else {
  4676.                 times = 1;
  4677.             }
  4678.             if (times > 1) {
  4679.                 a("<div class=\"arrowchat_message_history_loading\" style=\"text-align:center;padding:5px 0;\"><img src=\"" + c_ac_path + "themes/" + u_theme + "/images/img-loading.gif\" alt=\"Loading\" /></div>").prependTo(a("#arrowchat_tabcontenttext_" + b));
  4680.             }
  4681.             a.ajax({
  4682.                 cache: false,
  4683.                 url: c_ac_path + "includes/json/receive/receive_history.php",
  4684.                 data: {
  4685.                     chatbox: b,
  4686.                     history: times
  4687.                 },
  4688.                 type: "post",
  4689.                 dataType: "json",
  4690.                 success: function(c) {
  4691.                     a(".arrowchat_message_history_loading").remove();
  4692.                     history_ids[b] = 0;
  4693.                     numMessages = 0;
  4694.                     if (c) {
  4695.                         if (times == 1) {
  4696.                             a(".arrowchat_tabcontenttext", $user_popups[b]).html("");
  4697.                         }
  4698.                         last_sent[b] = null;
  4699.                         var d = "",
  4700.                             i = uc_name[b],
  4701.                             init = false;
  4702.                         a.each(c, function(e, l) {
  4703.                             e == "messages" && a.each(l, function(f, h) {
  4704.                                 numMessages++;
  4705.                                 f = "";
  4706.                                 if (h.self == 1) {
  4707.                                     fromname = u_name;
  4708.                                     fromid = u_id;
  4709.                                     f = " arrowchat_self";
  4710.                                     _aa5 = _aa4 = "";
  4711.                                     avatar = u_avatar;
  4712.                                     tooltip = lang[90];
  4713.                                 } else {
  4714.                                     fromname = i;
  4715.                                     fromid = b;
  4716.                                     _aa4 = "<a href=\"" + uc_link[b] + "\">";
  4717.                                     _aa5 = "</a>";
  4718.                                     avatar = uc_avatar[h.from];
  4719.                                     tooltip = fromname;
  4720.                                 }
  4721.                                 var full_name = fromid;
  4722.                                 var o = new Date(h.sent * 1000);
  4723.                                 if (c_show_full_name != "1") {
  4724.                                     if (fromname.indexOf(" ") != -1) {
  4725.                                         fromname = fromname.slice(0, fromname.indexOf(" "));
  4726.                                     }
  4727.                                 }
  4728.                                 if (h.sent - last_sent[h.from] > 60 || last_sent[h.from] == null || last_name[h.from] != full_name) {
  4729.                                     if (init == true) {
  4730.                                         d += "</div>";
  4731.                                     }
  4732.                                     d += "<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + h.id + "\"><div class=\"arrowchat_chatboxmessagefrom" + f + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + f + "\">" + formatTimestamp(o) + h.message + "</div></div>";
  4733.                                     last_sent[h.from] = h.sent;
  4734.                                     last_name[h.from] = full_name;
  4735.                                     init = true;
  4736.                                     last_id[h.from] = h.id;
  4737.                                 } else {
  4738.                                     d += "<div id=\"arrowchat_message_" + h.id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + h.message + "</div>";
  4739.                                 }
  4740.                             });
  4741.                         });
  4742.                         var current_top_element = a("#arrowchat_tabcontenttext_" + b).children().children().first();
  4743.                         if (times > 1) {
  4744.                             a(d).prependTo(a("#arrowchat_tabcontenttext_" + b).children("div"));
  4745.                         } else {
  4746.                             a("#arrowchat_tabcontenttext_" + b).html("<div>" + d + "</div>");
  4747.                         }
  4748.                         showTimeAndTooltip();
  4749.                         if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  4750.                             setAvatarVisibility(1);
  4751.                         }
  4752.                         var previous_height = 0;
  4753.                         current_top_element.prevAll().each(function() {
  4754.                             previous_height += a(this).outerHeight();
  4755.                         });
  4756.                         if (times == 1) {
  4757.                             a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
  4758.                         } else {
  4759.                             a("#arrowchat_tabcontenttext_" + b).scrollTop(previous_height);
  4760.                         }
  4761.                         a("#arrowchat_tabcontenttext_" + b).scroll(function() {
  4762.                             if (a("#arrowchat_tabcontenttext_" + b).scrollTop() < 50 && history_ids[b] != 1) {
  4763.                                 history_ids[b] = 1;
  4764.                                 if (numMessages == 20) {
  4765.                                     times++;
  4766.                                     receiveHistory(b, times);
  4767.                                 }
  4768.                             }
  4769.                         });
  4770.                     }
  4771.                 }
  4772.             });
  4773.         }
  4774.  
  4775.         function showTimeAndTooltip() {
  4776.             a(".arrowchat_chatbox_avatar").mouseenter(function() {
  4777.                 showTooltip(a(this), a(this).attr("alt"), false, 55, -38, 1);
  4778.             });
  4779.             a(".arrowchat_chatbox_avatar").mouseleave(function() {
  4780.                 hideTooltip();
  4781.             });
  4782.             a(".arrowchat_chatboxmessage").mouseenter(function() {
  4783.                 a(this).children().children(".arrowchat_chatboxmessagecontent").children(".arrowchat_ts").show();
  4784.             });
  4785.             a(".arrowchat_chatboxmessage").mouseleave(function() {
  4786.                 a(this).children().children(".arrowchat_chatboxmessagecontent").children(".arrowchat_ts").hide();
  4787.             });
  4788.         }
  4789.  
  4790.         function showChatroomTime() {
  4791.             a(".arrowchat_chatroom_box_message").mouseenter(function() {
  4792.                 a(this).children(".arrowchat_chatroom_message_content").children(".arrowchat_ts").show();
  4793.             });
  4794.             a(".arrowchat_chatroom_box_message").mouseleave(function() {
  4795.                 a(this).children(".arrowchat_chatroom_message_content").children(".arrowchat_ts").hide();
  4796.             });
  4797.         }
  4798.  
  4799.         function notifyNewMessage(b, c, d) {
  4800.             if (uc_name[b] == null || uc_name[b] == "") {
  4801.                 setTimeout(function() {
  4802.                     notifyNewMessage(b, c, d);
  4803.                 }, 500);
  4804.             } else {
  4805.                 receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], 1);
  4806.                 if (d == 1) {
  4807.                     if (a(".arrowchat_tabalert", $users[b]).length > 0) {
  4808.                         c = parseInt(a(".arrowchat_tabalert", $users[b]).html()) + parseInt(c);
  4809.                     }
  4810.                 }
  4811.                 if (c == 0) {
  4812.                     $users[b].removeClass("arrowchat_tab_new_message");
  4813.                     a(".arrowchat_tabalert", $users[b]).remove();
  4814.                 } else {
  4815.                     if (a(".arrowchat_tabalert", $users[b]).length > 0) {
  4816.                         a(".arrowchat_tabalert", $users[b]).html(c);
  4817.                         if (bounce3 == 1) {
  4818.                             bounce3 = 0;
  4819.                             a(".arrowchat_tabalert", $users[b]).stop(true, true).effect("bounce", {
  4820.                                 times: 3,
  4821.                                 distance: 5
  4822.                             }, 200, function() {
  4823.                                 bounce3 = 1;
  4824.                             });
  4825.                         }
  4826.                     } else {
  4827.                         a("<div/>").css("top", "-11px").css("left", "112px").addClass("arrowchat_tabalert").html(c).appendTo($users[b]);
  4828.                     }
  4829.                     $users[b].removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message");
  4830.                 }
  4831.                 y[b] = c;
  4832.                 positionTabAlerts();
  4833.             }
  4834.         }
  4835.  
  4836.         function setAvatarVisibility(b) {
  4837.             if (b == 1) {
  4838.                 a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars");
  4839.                 a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
  4840.                 a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
  4841.                 a(".arrowchat_chatbox_avatar").hide();
  4842.                 a(".arrowchat_disable_avatars_name").show();
  4843.                 a(".arrowchat_chatboxmessage_wrapper").addClass("arrowchat_chatboxmessage_wrapper2");
  4844.                 a(".arrowchat_chatboxmessagecontent").addClass("arrowchat_chatboxmessagecontent2");
  4845.             } else {
  4846.                 a(".arrowchat_userlist_avatar").removeClass("arrowchat_hide_avatars");
  4847.                 a(".arrowchat_chatroom_avatar").removeClass("arrowchat_hide_avatars");
  4848.                 a(".arrowchat_chatroom_message_avatar").removeClass("arrowchat_hide_avatars");
  4849.                 a(".arrowchat_chatbox_avatar").show();
  4850.                 a(".arrowchat_disable_avatars_name").hide();
  4851.                 a(".arrowchat_chatboxmessage_wrapper").removeClass("arrowchat_chatboxmessage_wrapper2");
  4852.                 a(".arrowchat_chatboxmessagecontent").removeClass("arrowchat_chatboxmessagecontent2");
  4853.             }
  4854.         }
  4855.  
  4856.         function buildBuddyListTab() {
  4857.             var d = "";
  4858.             $buddy_list_tab = a("<div/>").attr("id", "arrowchat_buddy_list_tab").addClass("arrowchat_bar_button").addClass("arrowchat_bar_right").html(ArrowChat.Templates.buddylist_tab()).appendTo($base);
  4859.             $userstab_popup = a("<div/>").attr("id", "arrowchat_userstab_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.buddylist_window(d, _ts, acp)).appendTo($body);
  4860.             a(".arrowchat_facebook_connect").append("<img style=\"position:relative;left:2px;top:1px\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/img-facebook-icon.gif\" alt=\"Connect to Facebook\" /><span style=\"position:relative;top:-2px;left:5px;\"><a href=\"javascript:void(0);\">" + lang[140] + "</a></span>").mouseover(function() {
  4861.                 a(this).addClass("arrowchat_facebook_connect_hover");
  4862.             }).mouseout(function() {
  4863.                 a(this).removeClass("arrowchat_facebook_connect_hover");
  4864.             });
  4865.             a(".arrowchat_facebook_connect").click(function() {
  4866.                 arrowchatdoLogin();
  4867.                 return false;
  4868.             });
  4869.             if (c_disable_avatars == 1) {
  4870.                 a("#arrowchat_name_box").hide();
  4871.                 a("#arrowchat_setting_names_only").parent("li").hide();
  4872.             }
  4873.             $buddy_list_tab.css("width", c_width_blist + "px");
  4874.             if (c_width_blist <= 25) {
  4875.                 a("#arrowchat_userstab_text").hide();
  4876.             }
  4877.             if (c_theme_change != 1) {
  4878.                 a(".arrowchat_theme_button").hide();
  4879.             }
  4880.             a(".arrowchat_powered_by").css("display", "none");
  4881.             a(".arrowchat_search_friends_text").placeholder();
  4882.             if (u_sounds == 1) {
  4883.                 a("#arrowchat_setting_sound :input").attr("checked", true);
  4884.             } else {
  4885.                 a("#arrowchat_setting_sound").addClass("arrowchat_menu_unchecked");
  4886.                 a("#arrowchat_setting_sound :input").attr("checked", false);
  4887.             }
  4888.             if (u_blist_open == 1) {
  4889.                 a("#arrowchat_setting_window_open :input").attr("checked", true);
  4890.             } else {
  4891.                 a("#arrowchat_setting_window_open").addClass("arrowchat_menu_unchecked");
  4892.                 a("#arrowchat_setting_window_open :input").attr("checked", false);
  4893.             }
  4894.             if (u_no_avatars == 1) {
  4895.                 a("#arrowchat_setting_names_only :input").attr("checked", true);
  4896.             } else {
  4897.                 a("#arrowchat_setting_names_only").addClass("arrowchat_menu_unchecked");
  4898.                 a("#arrowchat_setting_names_only :input").attr("checked", false);
  4899.             }
  4900.             u_is_guest == 1 && c_guest_name_change == 1 && u_guest_name == "" && a(".arrowchat_enter_name_wrapper").show();
  4901.             a("#arrowchat_guest_name_input").placeholder();
  4902.             a("#arrowchat_guest_name_input").keydown(function(h) {
  4903.                 if (h.keyCode == 13) {
  4904.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4905.                         chat_name: a(this).val()
  4906.                     }, function(data) {
  4907.                         if (data != "1") {
  4908.                             displayMessage("arrowchat_buddylist_message_flyout", data, "error");
  4909.                         } else {
  4910.                             a(".arrowchat_enter_name_wrapper").slideUp("fast");
  4911.                             u_name = a(this).val();
  4912.                         }
  4913.                     });
  4914.                 }
  4915.             });
  4916.             a(".arrowchat_search_friends_text").keyup(function() {
  4917.                 a(".arrowchat_search_not_found").remove();
  4918.                 var i = 1,
  4919.                     e = true,
  4920.                     l = "",
  4921.                     f = a(this).val();
  4922.                 if (f == "") {
  4923.                     a(".arrowchat_userlist").each(function() {
  4924.                         l = a(this).attr("id").substr(19);
  4925.                         a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
  4926.                         a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight();
  4927.                     });
  4928.                     e = false;
  4929.                 } else {
  4930.                     a(".arrowchat_userlist").each(function() {
  4931.                         l = a(this).attr("id").substr(19);
  4932.                         if (a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").length > 0) {
  4933.                             a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
  4934.                             i == 1 && a("#arrowchat_userlist_" + l).addClass("arrowchat_userlist_hover2");
  4935.                             a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight();
  4936.                             a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").highlight(f);
  4937.                             e = false;
  4938.                             i++;
  4939.                         } else {
  4940.                             a("#arrowchat_userlist_" + l).hide();
  4941.                         }
  4942.                     });
  4943.                 }
  4944.                 e && a("<div/>").attr("class", "arrowchat_search_not_found arrowchat_nofriends").html(lang[26]).prependTo("#arrowchat_userscontent");
  4945.             });
  4946.             a(document).bind("idle.idleTimer", function() {
  4947.                 if (w != 1) {
  4948.                     clearUserStatus();
  4949.                     a("#arrowchat_userstab_icon").addClass("arrowchat_user_away2");
  4950.                     setUserStatus("away");
  4951.                     isAway = 1;
  4952.                 }
  4953.             });
  4954.             a(document).bind("active.idleTimer", function() {
  4955.                 if (w != 1) {
  4956.                     clearUserStatus();
  4957.                     setUserStatus("available");
  4958.                     a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
  4959.                     isAway = 0;
  4960.                 }
  4961.             });
  4962.             a.idleTimer(60000 * ArrowChat.IdleTime);
  4963.             a("#arrowchat_theme_button").click(function() {
  4964.                 a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
  4965.                 a(".arrowchat_theme_link").addClass("arrowchat_theme_button_hover");
  4966.                 a(".arrowchat_theme_link").toggleClass("arrowchat_more_button_selected");
  4967.                 var theme_switch = a(".arrowchat_themeswitcher").val();
  4968.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4969.                     theme: theme_switch
  4970.                 }, function(theme) {
  4971.                     a("#arrowchat_css").attr({
  4972.                         href: c_ac_path + "external.php?type=css&t=" + theme_switch
  4973.                     });
  4974.                     window.location.reload();
  4975.                 });
  4976.             });
  4977.             a("#arrowchat_setting_sound").click(function() {
  4978.                 a(this).toggleClass("arrowchat_menu_unchecked");
  4979.                 if (a("#arrowchat_setting_sound :input").is(":checked")) {
  4980.                     a("#arrowchat_setting_sound :input").attr("checked", false);
  4981.                     _soundcheck = -1;
  4982.                     u_sounds = 0;
  4983.                 } else {
  4984.                     a("#arrowchat_setting_sound :input").attr("checked", true);
  4985.                     _soundcheck = 1;
  4986.                     u_sounds = 1;
  4987.                 }
  4988.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  4989.                     sound: _soundcheck
  4990.                 }, function() {});
  4991.             });
  4992.             a("#arrowchat_setting_window_open").click(function() {
  4993.                 a(this).toggleClass("arrowchat_menu_unchecked");
  4994.                 if (a("#arrowchat_setting_window_open :input").is(":checked")) {
  4995.                     a("#arrowchat_setting_window_open :input").attr("checked", false);
  4996.                     _windowcheck = -1;
  4997.                 } else {
  4998.                     a("#arrowchat_setting_window_open :input").attr("checked", true);
  4999.                     _windowcheck = 1;
  5000.                 }
  5001.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5002.                     window: _windowcheck
  5003.                 }, function() {});
  5004.             });
  5005.             a("#arrowchat_setting_names_only").click(function() {
  5006.                 a(this).toggleClass("arrowchat_menu_unchecked");
  5007.                 if (a("#arrowchat_setting_names_only :input").is(":checked")) {
  5008.                     a("#arrowchat_setting_names_only :input").attr("checked", false);
  5009.                     setAvatarVisibility(0);
  5010.                     _namecheck = -1;
  5011.                 } else {
  5012.                     a("#arrowchat_setting_names_only :input").attr("checked", true);
  5013.                     setAvatarVisibility(1);
  5014.                     _namecheck = 1;
  5015.                 }
  5016.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5017.                     name: _namecheck
  5018.                 }, function() {});
  5019.             });
  5020.             a("#arrowchat_setting_block_list").click(function() {
  5021.                 a(this).parent().parent(".arrowchat_inner_menu").hide();
  5022.                 a(".arrowchat_block_menu").show();
  5023.                 a.ajax({
  5024.                     url: c_ac_path + "includes/json/receive/receive_block_list.php",
  5025.                     type: "get",
  5026.                     cache: false,
  5027.                     dataType: "json",
  5028.                     success: function(b) {
  5029.                         if (b && b != null) {
  5030.                             a(".arrowchat_block_menu select").html("");
  5031.                             a("<option/>").attr("value", "0").html(lang[118]).appendTo(a(".arrowchat_block_menu select"));
  5032.                             a.each(b, function(e, l) {
  5033.                                 a.each(l, function(f, h) {
  5034.                                     a("<option/>").attr("value", h.id).html(h.username).appendTo(a(".arrowchat_block_menu select"));
  5035.                                 });
  5036.                             });
  5037.                         }
  5038.                     }
  5039.                 });
  5040.             });
  5041.             a("#arrowchat_unblock_button").click(function() {
  5042.                 a(".arrowchat_panel_item").click();
  5043.                 var unblock_chat_user = a(".arrowchat_block_menu select").val();
  5044.                 if (unblock_chat_user != "0") {
  5045.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5046.                         unblock_chat: unblock_chat_user
  5047.                     }, function() {
  5048.                         if (typeof blockList[unblock_chat_user] != "undefined") {
  5049.                             blockList.splice(unblock_chat_user, 1);
  5050.                         }
  5051.                         loadBuddyList();
  5052.                     });
  5053.                 }
  5054.             });
  5055.             a(".arrowchat_theme_link").mouseenter(function() {
  5056.                 showTooltip(a(this), lang[94], 0, 10, 5);
  5057.                 a(this).parent().addClass("arrowchat_theme_button_hover");
  5058.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
  5059.             });
  5060.             a(".arrowchat_theme_link").mouseleave(function() {
  5061.                 hideTooltip();
  5062.                 a(this).parent().removeClass("arrowchat_theme_button_hover");
  5063.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
  5064.             });
  5065.             a(".arrowchat_theme_link").click(function() {
  5066.                 hideTooltip();
  5067.                 a("#arrowchat_userscontent").height() < 150 ? a("#arrowchat_theme_flyout").addClass("flyout_reversed") : a("#arrowchat_theme_flyout").removeClass("flyout_reversed");
  5068.                 a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
  5069.                 a(this).addClass("arrowchat_theme_button_hover");
  5070.                 a(this).toggleClass("arrowchat_more_button_selected");
  5071.                 if (a(".arrowchat_panel_item").hasClass("arrowchat_more_button_selected")) {
  5072.                     a(".arrowchat_panel_item").toggleClass("arrowchat_more_button_selected");
  5073.                     a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
  5074.                 }
  5075.             });
  5076.             a(".arrowchat_panel_item").mouseenter(function() {
  5077.                 showTooltip(a(this), lang[23], 0, 10, 5);
  5078.                 a(this).parent().addClass("arrowchat_more_button_hover");
  5079.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
  5080.             });
  5081.             a(".arrowchat_panel_item").mouseleave(function() {
  5082.                 hideTooltip();
  5083.                 a(this).parent().removeClass("arrowchat_more_button_hover");
  5084.                 a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
  5085.             });
  5086.             a(".arrowchat_panel_item").click(function() {
  5087.                 hideTooltip();
  5088.                 a("#arrowchat_userscontent").height() < 150 ? a("#arrowchat_options_flyout").addClass("flyout_reversed") : a("#arrowchat_options_flyout").removeClass("flyout_reversed");
  5089.                 a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
  5090.                 a(this).addClass("arrowchat_more_button_hover");
  5091.                 a(this).toggleClass("arrowchat_more_button_selected");
  5092.                 if (a(".arrowchat_theme_link").hasClass("arrowchat_more_button_selected")) {
  5093.                     a(".arrowchat_theme_link").toggleClass("arrowchat_more_button_selected");
  5094.                     a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
  5095.                 }
  5096.                 a(".arrowchat_inner_menu").show();
  5097.                 a(".arrowchat_block_menu").hide();
  5098.             });
  5099.             addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
  5100.             a("#arrowchat_gooffline").click(function() {
  5101.                 a(".arrowchat_panel_item").click();
  5102.                 a(".arrowchat_userstabtitle").toggleClass("arrowchat_userstabtitle_button_click");
  5103.                 pushCancelAll();
  5104.                 cancelJSONP();
  5105.                 a.idleTimer("destroy");
  5106.                 clearTimeout(Z);
  5107.                 if (j != "") {
  5108.                     closePopup($user_popups[j], $users[j]);
  5109.                     a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
  5110.                     j = "";
  5111.                 }
  5112.                 a("#arrowchat_panel_options").removeClass("arrowchat_panel_hover");
  5113.                 showUserOffline();
  5114.                 a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
  5115.                 $chatboxes.hide();
  5116.             });
  5117.             a("#arrowchat_userstab_popup .arrowchat_userstabtitle").click(function() {
  5118.                 $buddy_list_tab.click();
  5119.             }).children().not(".arrowchat_tab_name").click(function() {
  5120.                 return false;
  5121.             });
  5122.             a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseenter(function() {
  5123.                 a(this).addClass("arrowchat_chatboxtabtitlemouseover2");
  5124.             });
  5125.             a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseleave(function() {
  5126.                 a(this).removeClass("arrowchat_chatboxtabtitlemouseover2");
  5127.             });
  5128.             $buddy_list_tab.mouseover(function() {
  5129.                 if (c_width_blist <= 25) {
  5130.                     if ($buddy_list_tab.hasClass("arrowchat_tabclick")) {} else {
  5131.                         showTooltip($buddy_list_tab, lang[4]);
  5132.                     }
  5133.                 }
  5134.                 a(this).addClass("arrowchat_tabmouseover");
  5135.             });
  5136.             $buddy_list_tab.mouseout(function() {
  5137.                 a(this).removeClass("arrowchat_tabmouseover");
  5138.                 hideTooltip();
  5139.             });
  5140.             $buddy_list_tab.click(function() {
  5141.                 if (c_width_blist <= 25) {
  5142.                     hideTooltip();
  5143.                 }
  5144.                 closePopup($chatrooms_popup, $chatrooms_button);
  5145.                 if (w == 1 || bli == 1) {
  5146.                     clearTimeout(Z);
  5147.                     if (u_blist_open != 1) {
  5148.                         loadBuddyList();
  5149.                     }
  5150.                     bli = 0;
  5151.                 }
  5152.                 if (w == 1) {
  5153.                     w = 0;
  5154.                     a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (R + jabberOnlineNumber) + "</b>)");
  5155.                     receiveCore();
  5156.                     pushSubscribe();
  5157.                     a.idleTimer(60000 * ArrowChat.IdleTime);
  5158.                     setUserStatus("available");
  5159.                     a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
  5160.                     $chatboxes.show();
  5161.                 }
  5162.                 closePopup($optionsbutton_popup, $optionsbutton);
  5163.                 $userstab_popup.css("left", $buddy_list_tab.offset().left - $userstab_popup.outerWidth() + $buddy_list_tab.outerWidth()).css("bottom", "25px");
  5164.                 a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
  5165.                 $userstab_popup.toggleClass("arrowchat_tabopen");
  5166.                 adjustBuddyListSize();
  5167.             });
  5168.         }
  5169.  
  5170.         function startPopoutChat() {
  5171.             pushCancelAll();
  5172.             cancelJSONP();
  5173.             a.idleTimer("destroy");
  5174.             clearTimeout(Z);
  5175.             $buddy_list_tab.hide();
  5176.             $popout_chat_button.show();
  5177.             $chatboxes.hide();
  5178.             $chatbox_right.hide();
  5179.             $chatbox_left.hide();
  5180.             closePopup($userstab_popup, $buddy_list_tab);
  5181.             closePopup($optionsbutton_popup, $optionsbutton);
  5182.             closePopup($chatrooms_popup, $chatrooms_button);
  5183.             if (j != "") {
  5184.                 closePopup($user_popups[j], $users[j]);
  5185.                 a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
  5186.                 j = "";
  5187.             }
  5188.             a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5189.                 popoutchat: "1"
  5190.             }, function() {});
  5191.         }
  5192.  
  5193.         function adjustBuddyListSize() {
  5194.             var searchHeight = 0,
  5195.                 nameHeight = 0,
  5196.                 poweredHeight = 0;
  5197.             if (a("#arrowchat_search_friends").is(":visible")) {
  5198.                 searchHeight = a("#arrowchat_search_friends").outerHeight();
  5199.             }
  5200.             if (a(".arrowchat_enter_name_wrapper").is(":visible")) {
  5201.                 nameHeight = a(".arrowchat_enter_name_wrapper").outerHeight();
  5202.             }
  5203.             if (a(".arrowchat_powered_by").is(":visible")) {
  5204.                 poweredHeight = a(".arrowchat_powered_by").outerHeight();
  5205.             }
  5206.             if (a(".arrowchat_facebook_connect").is(":visible")) {
  5207.                 poweredHeight = poweredHeight + a(".arrowchat_facebook_connect").outerHeight();
  5208.             }
  5209.             if (a(window).outerHeight() - $userstab_popup.outerHeight() <= 70 && a("#arrowchat_userscontent").outerHeight() <= a("#arrowchat_userslist_available").outerHeight() + a("#arrowchat_userslist_away").outerHeight() + a("#arrowchat_facebook_friends").outerHeight(true) + a("#arrowchat_facebook_friends_list").outerHeight(true) + a("#arrowchat_site_users").outerHeight(true)) {
  5210.                 a("#arrowchat_userscontent").css("height", a(window).outerHeight() - (94 + searchHeight + nameHeight + poweredHeight) + "px");
  5211.             } else {
  5212.                 a("#arrowchat_userscontent").css("height", "auto");
  5213.             }
  5214.         }
  5215.  
  5216.         function adjustBarSize() {
  5217.             if (c_chat_maintenance != 1 && u_id != "") {
  5218.                 if ($optionsbutton_popup !== undefined) {
  5219.                     var d = 0;
  5220.                     a(".arrowchat_notification_message_div").each(function() {
  5221.                         d += parseInt(a(this).outerHeight()) + 5;
  5222.                     });
  5223.                     if (a(window).height() - $optionsbutton_popup.height() < 80 && a("#arrowchat_notifications_content").height() <= d) {
  5224.                         a("#arrowchat_notifications_content").css("height", a(window).height() - 110 + "px");
  5225.                     } else {
  5226.                         a("#arrowchat_notifications_content").css("height", "auto");
  5227.                     }
  5228.                 }
  5229.                 adjustBuddyListSize();
  5230.             }
  5231.             var b = a(window).width(),
  5232.                 c = 0;
  5233.             $chatbox_right.hasClass("arrowchat_chatbox_lr") || (c = 19);
  5234.             for (d = 0; d < barLinks.length; d++) {
  5235.                 c += a("#arrowchat_trayicon_" + d).outerWidth();
  5236.             }
  5237.             if ($optionsbutton !== undefined) {
  5238.                 c += $optionsbutton.outerWidth();
  5239.             }
  5240.             if ($chatrooms_button !== undefined) {
  5241.                 c += $chatrooms_button.outerWidth();
  5242.             }
  5243.             if (a("#arrowchat_hide_bar_button") !== undefined) {
  5244.                 c += a("#arrowchat_hide_bar_button").outerWidth();
  5245.             }
  5246.             var i = 0;
  5247.             for (bha in apps) {
  5248.                 if (apps[bha][12] != "1" && typeof $application_buttons[apps[bha][0]] != "undefined") {
  5249.                     c += $application_buttons[apps[bha][0]].outerWidth();
  5250.                 }
  5251.             }
  5252.             if ($applications_button !== undefined) {
  5253.                 c += $applications_button.outerWidth();
  5254.             }
  5255.             if (c_no_apps_menu == 1) {
  5256.                 c += 130;
  5257.             }
  5258.             if (barLinks.length > 0 && i > 0) {
  5259.                 c += 30;
  5260.             }
  5261.             positionBar(c);
  5262.             if (c_chat_maintenance != 1 && u_id != "") {
  5263.                 if ($chatboxes_wide.width() <= $base.width() - 250 - c) {
  5264.                     $chatboxes.css("width", $chatboxes_wide.width());
  5265.                     $chatboxes.scrollTo("0px", 0);
  5266.                 } else {
  5267.                     b = $chatboxes.width();
  5268.                     var chatboxes_width_value = Math.floor(($base.width() - 250 - c) / 148) * 148;
  5269.                     if (chatboxes_width_value < 148) {
  5270.                         chatboxes_width_value = 148;
  5271.                     }
  5272.                     $chatboxes.css("width", chatboxes_width_value + "px");
  5273.                     c = $chatboxes.width();
  5274.                     b != c && $chatboxes.scrollTo("-=148px", 0);
  5275.                 }
  5276.                 c_notifications != 0 && $optionsbutton_popup.css("left", $optionsbutton.offset().left - $optionsbutton_popup.outerWidth() + $optionsbutton.outerWidth()).css("bottom", "25px");
  5277.                 c_chatrooms != 0 && $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
  5278.                 if (typeof $applications_button_popup != "undefined") {
  5279.                     c_applications_on != 0 && $applications_button_popup.css("left", $applications_button.offset().left).css("bottom", "25px");
  5280.                 }
  5281.                 $userstab_popup.css("left", $buddy_list_tab.offset().left - $userstab_popup.outerWidth() + $buddy_list_tab.outerWidth()).css("bottom", "25px");
  5282.                 if (m != "") {
  5283.                     $application_button_popups[m].css("left", $application_buttons[m].offset().left).css("bottom", "25px");
  5284.                 }
  5285.                 if (j != "") {
  5286.                     if ($users[j].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[j].offset().left - $chatboxes.offset().left >= 0) {
  5287.                         $user_popups[j].css("left", $users[j].offset().left - $user_popups[j].outerWidth() + $users[j].outerWidth()).css("bottom", "25px");
  5288.                     } else {
  5289.                         closePopup($user_popups[j], $users[j]);
  5290.                         c = $users[j].offset().left - $chatboxes_wide.offset().left - (Math.floor($chatboxes.width() / 148) - 1) * 148;
  5291.                         $chatboxes.scrollTo(c, 0, function() {
  5292.                             if (typeof $users[j] != "undefined") {
  5293.                                 $users[j].click();
  5294.                             }
  5295.                         });
  5296.                     }
  5297.                 }
  5298.                 positionTabAlerts();
  5299.                 updateRightLastClasses();
  5300.                 W && positionArrowchat();
  5301.             }
  5302.             if (c_mobile_device == 1) {
  5303.                 mobileSupport();
  5304.             }
  5305.         }
  5306.  
  5307.         function positionBar(apps_tray_width) {
  5308.             var window_width = a(window).width();
  5309.             if (c_bar_fixed == 1) {
  5310.                 $base.css("width", c_bar_fixed_width);
  5311.                 if (c_bar_fixed_alignment == "left") {
  5312.                     $base.css("left", c_bar_padding);
  5313.                 }
  5314.                 if (c_bar_fixed_alignment == "center") {
  5315.                     var left_value = (window_width - c_bar_fixed_width) / 2;
  5316.                     $base.css("left", left_value);
  5317.                 }
  5318.                 if (c_bar_fixed_alignment == "right") {
  5319.                     var left_value = window_width - c_bar_fixed_width;
  5320.                     $base.css("left", left_value - c_bar_padding);
  5321.                 }
  5322.             } else {
  5323.                 var check_width = parseInt(450) + parseInt(apps_tray_width) + parseInt(c_bar_padding * 2);
  5324.                 if (window_width < check_width) {
  5325.                     window_width = check_width;
  5326.                 }
  5327.                 $base.css("left", c_bar_padding + "px");
  5328.                 $base.css("width", window_width - c_bar_padding * 2);
  5329.             }
  5330.         }
  5331.  
  5332.         function positionTabAlerts() {
  5333.             var $left = a(".arrowchat_tabalertlr", $chatbox_left);
  5334.             var $right = a(".arrowchat_tabalertlr", $chatbox_right);
  5335.             $left.html("0").css("display", "none");
  5336.             $right.html("0").css("display", "none");
  5337.             a(".arrowchat_tabalert").each(function() {
  5338.                 if (a(this).parent().attr("id") != "arrowchat_chatrooms_button" && !a(this).parent().hasClass("arrowchat_apps_button")) {
  5339.                     if (a(this).parent().offset().left < $chatboxes.offset().left + $chatboxes.width() && a(this).parent().offset().left - $chatboxes.offset().left >= 0) {
  5340.                         a(this).css("display", "block");
  5341.                     } else {
  5342.                         a(this).css("display", "none");
  5343.                         if (a(this).parent().offset().left - $chatboxes.offset().left >= 0) {
  5344.                             var b = $chatbox_right.offset().left + $chatbox_right.width() - 30;
  5345.                             $right.html(parseInt(a(".arrowchat_tabalertlr", $chatbox_right).html()) + parseInt(a(this).html())).css({
  5346.                                 display: "block",
  5347.                                 left: b
  5348.                             });
  5349.                         } else {
  5350.                             b = $chatbox_left.offset().left + $chatbox_left.width() - 22;
  5351.                             $left.html(parseInt(a(".arrowchat_tabalertlr", $chatbox_left).html()) + parseInt(a(this).html())).css({
  5352.                                 display: "block",
  5353.                                 left: b
  5354.                             });
  5355.                         }
  5356.                     }
  5357.                 }
  5358.             });
  5359.         }
  5360.  
  5361.         function updateRightLastClasses() {
  5362.             var b = 0,
  5363.                 right_last = false,
  5364.                 lr = false;
  5365.             if ($chatbox_right.hasClass("arrowchat_chatbox_right_last")) {
  5366.                 right_last = true;
  5367.             }
  5368.             if ($chatbox_right.hasClass("arrowchat_chatbox_lr")) {
  5369.                 lr = true;
  5370.             }
  5371.             if ($chatboxes.scrollLeft() == 0) {
  5372.                 a(".arrowchat_tabtext", $chatbox_left).html("0");
  5373.                 $chatbox_left.addClass("arrowchat_chatbox_left_last");
  5374.                 a(".arrowchat_previous_tab").addClass("arrowchat_previous_tab_last");
  5375.                 b++;
  5376.             } else {
  5377.                 var i = Math.floor($chatboxes.scrollLeft() / 148);
  5378.                 a(".arrowchat_tabtext", $chatbox_left).html(i);
  5379.                 $chatbox_left.removeClass("arrowchat_chatbox_left_last");
  5380.                 a(".arrowchat_previous_tab").removeClass("arrowchat_previous_tab_last");
  5381.             }
  5382.             if ($chatboxes.scrollLeft() + $chatboxes.width() == $chatboxes_wide.width()) {
  5383.                 a(".arrowchat_tabtext", $chatbox_right).html("0");
  5384.                 $chatbox_right.addClass("arrowchat_chatbox_right_last");
  5385.                 a(".arrowchat_next_tab").addClass("arrowchat_next_tab_last");
  5386.                 b++;
  5387.             } else {
  5388.                 i = Math.floor(($chatboxes_wide.width() - ($chatboxes.scrollLeft() + $chatboxes.width())) / 148);
  5389.                 a(".arrowchat_tabtext", $chatbox_right).html(i);
  5390.                 $chatbox_right.removeClass("arrowchat_chatbox_right_last");
  5391.                 a(".arrowchat_next_tab").removeClass("arrowchat_next_tab_last");
  5392.             }
  5393.             if (b == 2) {
  5394.                 $chatbox_right.addClass("arrowchat_chatbox_lr");
  5395.                 $chatbox_left.addClass("arrowchat_chatbox_lr");
  5396.             } else {
  5397.                 $chatbox_right.removeClass("arrowchat_chatbox_lr");
  5398.                 $chatbox_left.removeClass("arrowchat_chatbox_lr");
  5399.             }
  5400.             if (!$chatbox_right.hasClass("arrowchat_chatbox_right_last") && right_last || $chatbox_right.hasClass("arrowchat_chatbox_right_last") && !right_last || !$chatbox_right.hasClass("arrowchat_chatbox_lr") && lr || $chatbox_right.hasClass("arrowchat_chatbox_lr") && !lr) {
  5401.                 adjustBarSize();
  5402.             }
  5403.         }
  5404.  
  5405.         function scrollChatboxes(b) {
  5406.             if (j != "") {
  5407.                 closePopup($user_popups[j], $users[j]);
  5408.             }
  5409.             a(".arrowchat_tabalert").css("display", "none");
  5410.             var c = 100;
  5411.             if (get("initialize") == 1) {
  5412.                 c = 0;
  5413.             }
  5414.             $chatboxes.scrollTo(b, c, function() {
  5415.                 if (j != "") {
  5416.                     if ($users[j].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[j].offset().left - $chatboxes.offset().left >= 0) {
  5417.                         $users[j].click();
  5418.                     } else {
  5419.                         j = "";
  5420.                     }
  5421.                 }
  5422.                 positionTabAlerts();
  5423.                 updateRightLastClasses();
  5424.             });
  5425.         }
  5426.  
  5427.         function set(b, c) {
  5428.             V[b] = c;
  5429.         }
  5430.  
  5431.         function get(b) {
  5432.             return V[b] ? V[b] : "";
  5433.         }
  5434.  
  5435.         function getStatus(b) {
  5436.             return xa[b] ? xa[b] : "";
  5437.         }
  5438.  
  5439.         function receiveUserFromUserlist(b) {
  5440.             if (a(b).attr("id")) {
  5441.                 var c = a(b).attr("id").substr(19);
  5442.             } else {
  5443.                 var c = "";
  5444.             }
  5445.             if (c == "") {
  5446.                 c = a(b).parent().attr("id").substr(19);
  5447.             }
  5448.             receiveUser(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c]);
  5449.         }
  5450.  
  5451.         function chatroomListClicked(b) {
  5452.             if ($chatroom_create_flyout.is(":visible")) {
  5453.                 $chatroom_create_flyout.hide("slide", {
  5454.                     direction: "up"
  5455.                 }, 250);
  5456.             }
  5457.             c = "";
  5458.             if (a(b).attr("id")) {
  5459.                 c = a(b).attr("id").substr(19);
  5460.             }
  5461.             if (c == "") {
  5462.                 c = a(b).parent().attr("id").substr(19);
  5463.             }
  5464.             if (crt[c] == 2) {
  5465.                 a("#arrowchat_chatroom_password_id").val(c);
  5466.                 if (a("#arrowchat_chatroom_" + c).hasClass("arrowchat_chatroom_clicked")) {
  5467.                     a("#arrowchat_chatroom_password_flyout").hide("slide", {
  5468.                         direction: "up"
  5469.                     }, 250);
  5470.                     a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
  5471.                 } else {
  5472.                     a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
  5473.                     a("#arrowchat_chatroom_" + c).addClass("arrowchat_chatroom_clicked");
  5474.                     if (!a("#arrowchat_chatroom_password_flyout").is(":visible")) {
  5475.                         a("#arrowchat_chatroom_password_flyout").show("slide", {
  5476.                             direction: "up"
  5477.                         }, 250, function() {
  5478.                             a("#arrowchat_chatroom_password_input").focus();
  5479.                         });
  5480.                     } else {
  5481.                         a("#arrowchat_chatroom_password_flyout").hide("slide", {
  5482.                             direction: "up"
  5483.                         }, 250);
  5484.                         a("#arrowchat_chatroom_password_flyout").show("slide", {
  5485.                             direction: "up"
  5486.                         }, 250, function() {
  5487.                             a("#arrowchat_chatroom_password_input").focus();
  5488.                         });
  5489.                     }
  5490.                 }
  5491.             } else {
  5492.                 a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
  5493.                 if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
  5494.                     a("#arrowchat_chatroom_password_flyout").hide("slide", {
  5495.                         direction: "up"
  5496.                     }, 250);
  5497.                 }
  5498.                 $chatroom_create.hide();
  5499.                 Ccr = c;
  5500.                 loadChatroom(c, crt[c]);
  5501.             }
  5502.         }
  5503.  
  5504.         function addMessageToChatroom(b, c, d) {
  5505.             var title = "";
  5506.             if (chatroom_mod == 1) {
  5507.                 title = lang[137];
  5508.             }
  5509.             if (chatroom_admin == 1) {
  5510.                 title = lang[136];
  5511.             }
  5512.             d = d.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/\"/g, "&quot;");
  5513.             d = replaceURLWithHTMLLinks(d);
  5514.             d = smileyreplace(d);
  5515.             if (a("#arrowchat_chatroom_message_" + b).length > 0) {
  5516.                 a("#arrowchat_chatroom_message_" + b + " .arrowchat_chatroom_message_content").html(formatTimestamp(new Date(Math.floor((new Date).getTime() / 1000) * 1000)) + d);
  5517.             } else {
  5518.                 $chatroom_chat.append("<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + b + "\"><img class=\"arrowchat_chatroom_message_avatar\" src=\"" + u_avatar + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + c + title + ":</div><div class=\"arrowchat_chatroom_message_content  arrowchat_self\">" + formatTimestamp(new Date(Math.floor((new Date).getTime() / 1000) * 1000)) + d + "</div></div>");
  5519.                 $chatroom_chat.scrollTop(50000);
  5520.             }
  5521.             showChatroomTime();
  5522.         }
  5523.  
  5524.         function addMessageToChatbox(b, c, d, i, e, l, f) {
  5525.             aa[b] != 1 && receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], 1, 1);
  5526.             if (uc_name[b] == null || uc_name[b] == "") {
  5527.                 setTimeout(function() {
  5528.                     addMessageToChatbox(b, c, d, i, e, l, f);
  5529.                 }, 500);
  5530.             } else {
  5531.                 var h = "",
  5532.                     init = false;
  5533.                 if (parseInt(d) == 1) {
  5534.                     fromname = u_name;
  5535.                     fromid = u_id;
  5536.                     h = " arrowchat_self";
  5537.                     avatar = u_avatar;
  5538.                     tooltip = lang[90];
  5539.                 } else {
  5540.                     fromname = uc_name[b];
  5541.                     fromid = b;
  5542.                     avatar = uc_avatar[b];
  5543.                     tooltip = fromname;
  5544.                 }
  5545.                 var full_name = fromid;
  5546.                 if (parseInt(l) == 1) {
  5547.                     c = c.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/\"/g, "&quot;");
  5548.                 }
  5549.                 c = replaceURLWithHTMLLinks(c);
  5550.                 c = smileyreplace(c);
  5551.                 d != 1 && u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[b]).is(":focus") && playNewMessageSound();
  5552.                 separator = ":&nbsp;&nbsp;";
  5553.                 if (a("#arrowchat_message_" + e).length > 0) {
  5554.                     a("#arrowchat_message_" + e + " .arrowchat_chatboxmessagecontent").html(c);
  5555.                 } else {
  5556.                     if (c_show_full_name != "1") {
  5557.                         if (fromname.indexOf(" ") != -1) {
  5558.                             fromname = fromname.slice(0, fromname.indexOf(" "));
  5559.                         }
  5560.                     }
  5561.                     if (uc_status[b] == "offline" && d != 1) {
  5562.                         displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[13], "error");
  5563.                     }
  5564.                     if (f - last_sent[b] > 60 || last_sent[b] == null || last_name[b] != full_name || last_name[b] == null || last_name[b] == "") {
  5565.                         a(".arrowchat_tabcontenttext", $user_popups[b]).append("<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + e + "\"><div class=\"arrowchat_chatboxmessagefrom" + h + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + h + "\">" + formatTimestamp(new Date(f * 1000)) + c + "</div></div></div>");
  5566.                         last_sent[b] = f;
  5567.                         last_name[b] = full_name;
  5568.                         last_id[b] = e;
  5569.                     } else {
  5570.                         if (last_id[b] !== "undefined") {
  5571.                             a("#arrowchat_message_" + last_id[b]).append("<div id=\"arrowchat_message_" + e + "\" class=\"arrowchat_chatboxmessagecontent" + h + "\">" + c + "</div>");
  5572.                         } else {
  5573.                             a(".arrowchat_tabcontenttext", $user_popups[b]).append("<div id=\"arrowchat_message_" + e + "\" class=\"arrowchat_chatboxmessagecontent" + h + "\">" + c + "</div>");
  5574.                         }
  5575.                     }
  5576.                     if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  5577.                         setAvatarVisibility(1);
  5578.                     }
  5579.                     a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
  5580.                     showTimeAndTooltip();
  5581.                 }
  5582.                 j != b && d != 1 && i != 1 && notifyNewMessage(b, 1, 1);
  5583.                 d != 1 && showDesktopNotification(b, c, e);
  5584.             }
  5585.         }
  5586.  
  5587.         function activateUser(b) {
  5588.             if (uc_name[b] == null || uc_name[b] == "") {
  5589.                 setTimeout(function() {
  5590.                     activateUser(b);
  5591.                 }, 500);
  5592.             } else {
  5593.                 j != b && $users[b].click();
  5594.             }
  5595.         }
  5596.  
  5597.         function addMessageToContent(b, c) {
  5598.             if (uc_name[b] == null || uc_name[b] == "") {
  5599.                 setTimeout(function() {
  5600.                     addMessageToContent(b, c);
  5601.                 }, 500);
  5602.             } else {
  5603.                 a("#arrowchat_tabcontenttext_" + b).append("<div>" + c + "</div>");
  5604.                 a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
  5605.                 G[b] = 1;
  5606.             }
  5607.         }
  5608.  
  5609.         function loadChatroomList() {
  5610.             if (chatroomreceived == 0) {
  5611.                 a("#arrowchat_chatroom_leave").hide();
  5612.                 a(".arrowchat_chatroom_popout").hide();
  5613.                 a.ajax({
  5614.                     url: c_ac_path + "includes/json/receive/receive_chatroom_list.php",
  5615.                     cache: false,
  5616.                     data: {
  5617.                         chatroom_window: u_chatroom_open,
  5618.                         chatroom_stay: u_chatroom_stay
  5619.                     },
  5620.                     type: "post",
  5621.                     dataType: "json",
  5622.                     success: function(b) {
  5623.                         buildChatroomList(b);
  5624.                     }
  5625.                 });
  5626.             }
  5627.         }
  5628.  
  5629.         function buildChatroomList(b) {
  5630.             Ccr = 0;
  5631.             a(".arrowchat_chatroom_full_content").html("");
  5632.             var c = {};
  5633.             b && a.each(b, function(i, e) {
  5634.                 if (i == "chatrooms") {
  5635.                     a.each(e, function(l, f) {
  5636.                         a("<div/>").attr("id", "arrowchat_chatroom_" + f.id).mouseover(function() {
  5637.                             a(this).addClass("arrowchat_chatroom_list_hover");
  5638.                         }).mouseout(function() {
  5639.                             a(this).removeClass("arrowchat_chatroom_list_hover");
  5640.                         }).addClass("arrowchat_chatroom_list").html("<span class=\"arrowchat_chatroom_name\">" + f.n + "</span><span class=\"arrowchat_chatroom_status arrowchat_chatroom_" + f.t + "\"></span><span class=\"arrowchat_chatroom_count\">" + f.c + lang[35] + "</span>").appendTo(a(".arrowchat_chatroom_full_content"));
  5641.                         crt[f.id] = f.t;
  5642.                         crt2[f.id] = f.n;
  5643.                     });
  5644.                 }
  5645.             });
  5646.             chatroomreceived = 1;
  5647.             a(".arrowchat_chatroom_list").click(function(l) {
  5648.                 chatroomListClicked(l.target);
  5649.             });
  5650.         }
  5651.  
  5652.         function receiveChatroom(c) {
  5653.             var global_mod = 0,
  5654.                 global_admin = 0,
  5655.                 admin_markup = "";
  5656.             chatroom_mod = 0;
  5657.             chatroom_admin = 0;
  5658.             if (Ccr == c) {
  5659.                 a.ajax({
  5660.                     url: c_ac_path + "includes/json/receive/receive_chatroom.php",
  5661.                     cache: false,
  5662.                     type: "post",
  5663.                     data: {
  5664.                         chatroomid: c
  5665.                     },
  5666.                     dataType: "json",
  5667.                     success: function(b) {
  5668.                         if (b) {
  5669.                             var no_error = true;
  5670.                             b && a.each(b, function(i, e) {
  5671.                                 if (i == "error") {
  5672.                                     a.each(e, function(l, f) {
  5673.                                         no_error = false;
  5674.                                         Ccr = 0;
  5675.                                         chatroomreceived = 0;
  5676.                                         loadChatroomList();
  5677.                                         displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
  5678.                                     });
  5679.                                 }
  5680.                             });
  5681.                             if (no_error) {
  5682.                                 b && a.each(b, function(i, e) {
  5683.                                     if (i == "user_title") {
  5684.                                         a.each(e, function(l, f) {
  5685.                                             if (f.admin == 1) {
  5686.                                                 global_admin = 1;
  5687.                                                 chatroom_admin = 1;
  5688.                                             }
  5689.                                             if (f.mod == 1) {
  5690.                                                 global_mod = 1;
  5691.                                                 chatroom_mod = 1;
  5692.                                             }
  5693.                                         });
  5694.                                     }
  5695.                                     if (i == "chat_users") {
  5696.                                         var longname;
  5697.                                         $chatroom_room_list.html("");
  5698.                                         a.each(e, function(l, f) {
  5699.                                             if ((global_admin == 1 || global_mod == 1) && f.t == 1) {
  5700.                                                 admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_make_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[52] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_ban_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[53] + "</div></div>";
  5701.                                             }
  5702.                                             longname = renderHTMLString(f.n);
  5703.                                             f.n = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
  5704.                                             a("<div/>").attr("id", "arrowchat_chatroom_user_" + f.id).mouseover(function() {
  5705.                                                 a(this).addClass("arrowchat_chatroom_list_hover");
  5706.                                             }).mouseout(function() {
  5707.                                                 a(this).removeClass("arrowchat_chatroom_list_hover");
  5708.                                             }).addClass("arrowchat_chatroom_room_list").addClass("arrowchat_chatroom_admin_" + f.t).html("<img class=\"arrowchat_chatroom_avatar\" src=\"" + f.a + "\"/><span class=\"arrowchat_chatroom_room_name\">" + f.n + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + f.status + "\"></span>").appendTo($chatroom_room_list);
  5709.                                             a("<div/>").attr("id", "arrowchat_chatroom_users_flyout_" + f.id).addClass("arrowchat_chatroom_users_flyout").html("<div class=\"arrowchat_chatroom_title_padding\"><div id=\"arrowchat_chatroom_title_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + longname + "<br/>" + lang[43] + "</div></div><hr class=\"arrowchat_options_divider\"/><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_visit_profile_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[42] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_private_message_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[41] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_block_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[84] + "</div></div>" + admin_markup).appendTo(a("#arrowchat_chatroom_user_" + f.id));
  5710.                                             if (f.t == 2) {
  5711.                                                 a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[44]);
  5712.                                             } else if (f.t == 3) {
  5713.                                                 a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[45]);
  5714.                                             }
  5715.                                             addHover(a(".arrowchat_chatroom_options_padding"), "arrowchat_options_padding_hover");
  5716.                                             chatroomUserOptions(f, global_admin);
  5717.                                             uc_avatar[f.id] = f.a;
  5718.                                         });
  5719.                                         a(".arrowchat_chatroom_admin_3").css("background-color", "#" + c_admin_bg);
  5720.                                         a(".arrowchat_chatroom_admin_3").css("color", "#" + c_admin_txt);
  5721.                                     }
  5722.                                 });
  5723.                                 if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  5724.                                     a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
  5725.                                     a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
  5726.                                 }
  5727.                             }
  5728.                         }
  5729.                     }
  5730.                 });
  5731.                 clearTimeout(Crref2);
  5732.                 Crref2 = setTimeout(function() {
  5733.                     receiveChatroom(c);
  5734.                 }, 60000);
  5735.             }
  5736.         }
  5737.  
  5738.         function chatroomUserOptions(data, is_admin) {
  5739.             a("#arrowchat_chatroom_make_mod_" + data.id).click(function() {
  5740.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5741.                     chatroom_mod: data.id,
  5742.                     chatroom_id: Ccr
  5743.                 }, function() {});
  5744.             });
  5745.             a("#arrowchat_chatroom_remove_mod_" + data.id).click(function() {
  5746.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5747.                     chatroom_remove_mod: data.id,
  5748.                     chatroom_id: Ccr
  5749.                 }, function() {});
  5750.             });
  5751.             a("#arrowchat_chatroom_block_user_" + data.id).click(function() {
  5752.                 a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5753.                     block_chat: data.id
  5754.                 }, function(json_data) {
  5755.                     if (json_data != "-1") {
  5756.                         if (typeof blockList[data.id] == "undefined") {
  5757.                             blockList[data.id] = data.id;
  5758.                         }
  5759.                         loadBuddyList();
  5760.                         displayMessage("arrowchat_chatroom_message_flyout", lang[103], "error");
  5761.                     }
  5762.                 });
  5763.             });
  5764.             a("#arrowchat_chatroom_ban_user_" + data.id).click(function() {
  5765.                 var ban_length = prompt(lang[57]);
  5766.                 if (ban_length != null && ban_length != "" && !isNaN(ban_length)) {
  5767.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  5768.                         chatroom_ban: data.id,
  5769.                         chatroom_id: Ccr,
  5770.                         chatroom_ban_length: ban_length
  5771.                     }, function() {});
  5772.                 }
  5773.             });
  5774.             a("#arrowchat_chatroom_visit_profile_" + data.id).click(function() {
  5775.                 window.location = data.l;
  5776.             });
  5777.             a("#arrowchat_chatroom_private_message_" + data.id).click(function() {
  5778.                 if (data.b != 1 || is_admin == 1) {
  5779.                     if (u_id != data.id) {
  5780.                         jqac.arrowchat.chatWith(data.id);
  5781.                     }
  5782.                 } else {
  5783.                     displayMessage("arrowchat_chatroom_message_flyout", lang[46], "error");
  5784.                 }
  5785.             });
  5786.             a("#arrowchat_chatroom_user_" + data.id).click(function() {
  5787.                 if (crou != data.id) {
  5788.                     a("#arrowchat_chatroom_user_" + crou).removeClass("arrowchat_chatroom_clicked");
  5789.                     a("#arrowchat_chatroom_users_flyout_" + crou).removeClass("arrowchat_chatroom_create_flyout_display");
  5790.                 }
  5791.                 crou = data.id;
  5792.                 a(this).toggleClass("arrowchat_chatroom_clicked");
  5793.                 a("#arrowchat_chatroom_users_flyout_" + data.id).toggleClass("arrowchat_chatroom_create_flyout_display");
  5794.             });
  5795.         }
  5796.  
  5797.         function loadBuddyList() {
  5798.             clearTimeout(Z);
  5799.             a.ajax({
  5800.                 url: c_ac_path + "includes/json/receive/receive_buddylist.php",
  5801.                 cache: false,
  5802.                 type: "get",
  5803.                 dataType: "json",
  5804.                 success: function(b) {
  5805.                     buildBuddyList(b);
  5806.                     if (c_disable_avatars == 1) {
  5807.                         a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars");
  5808.                     }
  5809.                     adjustBuddyListSize();
  5810.                     adjustBarSize();
  5811.                 }
  5812.             });
  5813.             if (typeof c_list_heart_beat != "undefined") {
  5814.                 var BLHT = c_list_heart_beat * 1000;
  5815.             } else {
  5816.                 var BLHT = 60000;
  5817.             }
  5818.             Z = setTimeout(function() {
  5819.                 loadBuddyList();
  5820.             }, BLHT);
  5821.         }
  5822.  
  5823.         function buildBuddyList(b) {
  5824.             V.timestamp = ma;
  5825.             var c = {},
  5826.                 d = "";
  5827.             c.available = "";
  5828.             c.busy = "";
  5829.             c.offline = "";
  5830.             c.invisible = "";
  5831.             c.away = "";
  5832.             onlineNumber = buddylistreceived = 0;
  5833.             b && a.each(b, function(i, e) {
  5834.                 if (i == "buddylist") {
  5835.                     buddylistreceived = 1;
  5836.                     totalFriendsNumber = onlineNumber = 0;
  5837.                     a.each(e, function(l, f) {
  5838.                         longname = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
  5839.                         if (G[f.id] != null) {
  5840.                             a(".arrowchat_closebox_bottom_status", $users[f.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + f.s);
  5841.                             $users[f.id].removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + f.s);
  5842.                             $user_popups[f.id].length > 0 && a(".arrowchat_tabsubtitle .arrowchat_message", $user_popups[f.id]).html(f.m);
  5843.                         }
  5844.                         if (f.s == "available" || f.s == "away" || f.s == "busy") {
  5845.                             onlineNumber++;
  5846.                         }
  5847.                         totalFriendsNumber++;
  5848.                         if (a("#arrowchat_setting_names_only :input").is(":checked")) {
  5849.                             d = "arrowchat_hide_avatars";
  5850.                         }
  5851.                         c[f.s] += "<div id=\"arrowchat_userlist_" + f.id + "\" class=\"arrowchat_userlist arrowchat_buddylist_admin_" + f.admin + "\" 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>";
  5852.                         uc_status[f.id] = f.s;
  5853.                         uc_name[f.id] = f.n;
  5854.                         uc_avatar[f.id] = f.a;
  5855.                         uc_link[f.id] = f.l;
  5856.                     });
  5857.                 }
  5858.                 if (buddylistreceived == 1 && bli == 0) {
  5859.                     for (buddystatus in c) {
  5860.                         if (c.hasOwnProperty(buddystatus)) {
  5861.                             if (c[buddystatus] == "") {
  5862.                                 a("#arrowchat_userslist_" + buddystatus).html("");
  5863.                             } else {
  5864.                                 a("#arrowchat_userslist_" + buddystatus).html("<div>" + c[buddystatus] + "</div>");
  5865.                             }
  5866.                         }
  5867.                     }
  5868.                     a(".arrowchat_userlist").click(function(l) {
  5869.                         if (!a(this).hasClass("arrowchat_jabber_user")) {
  5870.                             receiveUserFromUserlist(l.target);
  5871.                         }
  5872.                     });
  5873.                     a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
  5874.                     R = onlineNumber;
  5875.                     totalFriendsNumber == 0 && a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
  5876.                     R == 0 && a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
  5877.                     R >= c_search_min ? a("#arrowchat_search_friends").show() : a("#arrowchat_search_friends").hide();
  5878.                     buddylistreceived = 0;
  5879.                 } else {
  5880.                     a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
  5881.                 }
  5882.                 a(".arrowchat_buddylist_admin_1").css("background-color", "#" + c_admin_bg);
  5883.                 a(".arrowchat_buddylist_admin_1").css("color", "#" + c_admin_txt);
  5884.             });
  5885.         }
  5886.  
  5887.         function cancelJSONP() {
  5888.             if (typeof CHA != "undefined") {
  5889.                 clearTimeout(CHA);
  5890.             }
  5891.             if (typeof xOptions != "undefined") {
  5892.                 xOptions.abort();
  5893.             }
  5894.         }
  5895.  
  5896.         function receiveCore() {
  5897.             cancelJSONP();
  5898.             var url = c_ac_path + "includes/json/receive/receive_core.php?hash=" + u_hash_id + "&init=" + acsi + "&room=" + Ccr;
  5899.             xOptions = a.ajax({
  5900.                 url: url,
  5901.                 dataType: "jsonp",
  5902.                 success: function(b) {
  5903.                     V.timestamp = ma;
  5904.                     var c = "",
  5905.                         d = {};
  5906.                     d.available = "";
  5907.                     d.busy = "";
  5908.                     d.offline = "";
  5909.                     d.away = "";
  5910.                     onlineNumber = buddylistreceived = 0;
  5911.                     if (b && b != null) {
  5912.                         var i = 0;
  5913.                         a.each(b, function(e, l) {
  5914.                             if (e == "typing") {
  5915.                                 a.each(l, function(f, h) {
  5916.                                     if (h.is_typing == "1") {
  5917.                                         receiveTyping(h.typing_id);
  5918.                                     } else {
  5919.                                         receiveNotTyping(h.typing_id);
  5920.                                     }
  5921.                                 });
  5922.                             }
  5923.                             if (e == "announcements") {
  5924.                                 a.each(l, function(f, h) {
  5925.                                     receiveAnnouncement(h);
  5926.                                 });
  5927.                             }
  5928.                             if (e == "chatroom") {
  5929.                                 var d1 = 0,
  5930.                                     d2 = "";
  5931.                                 a.each(l, function(f, h) {
  5932.                                     if (typeof blockList[h.userid] == "undefined") {
  5933.                                         addChatroomMessage(h.id, h.n, h.m, h.userid, h.t, h.global, h.mod, h.admin);
  5934.                                     }
  5935.                                     d2 = h;
  5936.                                     d1++;
  5937.                                 });
  5938.                                 if (typeof d2 != "undefined") {
  5939.                                     if (typeof blockList[d2.userid] == "undefined") {
  5940.                                         showChatroomTime();
  5941.                                         chatroomAlerts(d1);
  5942.                                         if (d2.userid != u_id) {
  5943.                                             u_chatroom_sound == 1 && !a(".arrowchat_chatroom_message_input").is(":focus") && playNewMessageSound();
  5944.                                         }
  5945.                                     }
  5946.                                 }
  5947.                             }
  5948.                             if (e == "notifications") {
  5949.                                 var markup2 = "";
  5950.                                 a.each(l, function(f, h) {
  5951.                                     addNotification(h.alert_id, h.markup);
  5952.                                     markup2 = h.markup;
  5953.                                 });
  5954.                                 notificationAlerts(markup2);
  5955.                             }
  5956.                             if (e == "messages") {
  5957.                                 var play_sound = 0;
  5958.                                 a.each(l, function(f, h) {
  5959.                                     receiveMessage(h.id, h.from, h.message, h.sent, h.self, h.old);
  5960.                                     if (!a(".arrowchat_textarea", $user_popups[h.from]).is(":focus")) {
  5961.                                         play_sound = 1;
  5962.                                     }
  5963.                                 });
  5964.                                 K = 1;
  5965.                                 D = E;
  5966.                                 j != "" && i > 0 && addMessageToContent(j, c);
  5967.                                 showTimeAndTooltip();
  5968.                                 d != 1 && u_sounds == 1 && play_sound == 1 && acsi != 1 && playNewMessageSound();
  5969.                             }
  5970.                         });
  5971.                     }
  5972.                     set("initialize", "0");
  5973.                     set("currenttime", "0");
  5974.                     if ($ != 1 && w != 1) {
  5975.                         K++;
  5976.                         if (K > 4) {
  5977.                             D *= 2;
  5978.                             K = 1;
  5979.                         }
  5980.                         if (D > 12000) {
  5981.                             D = 12000;
  5982.                         }
  5983.                     }
  5984.                     acsi++;
  5985.                 }
  5986.             });
  5987.             if (isAway == 1) {
  5988.                 var CHT = c_heart_beat * 1000 * 3;
  5989.             } else {
  5990.                 var CHT = c_heart_beat * 1000;
  5991.             }
  5992.             if (c_push_engine != 1) {
  5993.                 CHA = setTimeout(function() {
  5994.                     receiveCore();
  5995.                 }, CHT);
  5996.             }
  5997.         }
  5998.  
  5999.         function addChatroomMessage(id, name, message, userid, sent, global, mod, admin) {
  6000.             if (userid == u_id) {
  6001.                 uc_avatar[u_id] = u_avatar;
  6002.             }
  6003.             message = stripslashes(message);
  6004.             message = replaceURLWithHTMLLinks(message);
  6005.             var sent_time = new Date(sent * 1000);
  6006.             if (typeof uc_avatar[userid] == "undefined") {
  6007.                 a.ajax({
  6008.                     url: c_ac_path + "includes/json/receive/receive_user.php",
  6009.                     data: {
  6010.                         userid: userid
  6011.                     },
  6012.                     type: "post",
  6013.                     cache: false,
  6014.                     dataType: "json",
  6015.                     success: function(data) {
  6016.                         if (data) {
  6017.                             uc_avatar[userid] = data.a;
  6018.                             chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin);
  6019.                         }
  6020.                     }
  6021.                 });
  6022.             } else {
  6023.                 chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin);
  6024.             }
  6025.             count++;
  6026.         }
  6027.  
  6028.         function chatroomDiv(id, image, name, time, message, global, mod, admin) {
  6029.             var container = $chatroom_chat[0].scrollHeight - $chatroom_chat.scrollTop() - 10;
  6030.             var container2 = $chatroom_chat.outerHeight();
  6031.             var title = "";
  6032.             if (mod == 1) {
  6033.                 title = lang[137];
  6034.             }
  6035.             if (admin == 1) {
  6036.                 title = lang[136];
  6037.             }
  6038.             if (a("#arrowchat_chatroom_message_" + id).length > 0) {} else {
  6039.                 if (global == 1) {
  6040.                     a("<div/>").attr("id", "arrowchat_chatroom_message_" + id).addClass("arrowchat_chatroom_box_message").html("<div class=\"arrowchat_chatroom_message_content arrowchat_global_chatroom_message\">" + formatTimestamp(time) + message + "</div>").appendTo($chatroom_chat);
  6041.                 } else {
  6042.                     a("<div/>").attr("id", "arrowchat_chatroom_message_" + id).addClass("arrowchat_chatroom_box_message").html("<img class=\"arrowchat_chatroom_message_avatar\" src=\"" + image + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + name + title + ":</div><div class=\"arrowchat_chatroom_message_content\">" + formatTimestamp(time) + message + "</div>").appendTo($chatroom_chat);
  6043.                 }
  6044.             }
  6045.             if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  6046.                 a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
  6047.             }
  6048.             if (container <= container2) {
  6049.                 $chatroom_chat.scrollTop(50000);
  6050.             } else {
  6051.                 displayMessage("arrowchat_chatroom_message_flyout", lang[134], "notice");
  6052.             }
  6053.             showChatroomTime();
  6054.         }
  6055.  
  6056.         function chatroomAlerts(count) {
  6057.             if (a("#arrowchat_chatrooms_button .arrowchat_tabalert").length > 0 && count > 0) {
  6058.                 var count2 = parseInt(a("#arrowchat_chatrooms_button .arrowchat_tabalert").html()) + count;
  6059.                 a("#arrowchat_chatrooms_button .arrowchat_tabalert").html(count2);
  6060.                 if (bounce2 == 1) {
  6061.                     bounce2 = 0;
  6062.                     a("#arrowchat_chatrooms_button .arrowchat_tabalert").stop(true, true).effect("bounce", {
  6063.                         times: 3,
  6064.                         distance: 5
  6065.                     }, 200, function() {
  6066.                         bounce2 = 1;
  6067.                     });
  6068.                 }
  6069.             } else if (!$chatrooms_button.hasClass("arrowchat_tabclick")) {
  6070.                 $chatrooms_button.addClass("arrowchat_tab_new_message");
  6071.                 a("<div/>").css("top", "-11px").css("left", c_width_chatroom - 10 + "px").addClass("arrowchat_tabalert").html(count).appendTo($chatrooms_button);
  6072.             }
  6073.         }
  6074.  
  6075.         function receiveAnnouncement(h) {
  6076.             if (h.read == 0 && h.data != "") {
  6077.                 a("#arrowchat_announcement").remove();
  6078.                 $body.append(ArrowChat.Templates.announcements_display(h));
  6079.                 a("#arrowchat_announcement .arrowchat_announce_close").click(function() {
  6080.                     a("#arrowchat_announcement").remove();
  6081.                     a.post(c_ac_path + "includes/json/send/send_settings.php", {
  6082.                         announce: 1
  6083.                     }, function() {});
  6084.                 });
  6085.             } else {
  6086.                 a("#arrowchat_announcement").remove();
  6087.             }
  6088.         }
  6089.  
  6090.         function addNotification(alert_id, markup) {
  6091.             a("<div/>").attr("id", "arrowchat_alert_" + alert_id).attr("class", "arrowchat_notification_message_div").html(markup).appendTo(a("#arrowchat_notifications_content"));
  6092.             Q++;
  6093.         }
  6094.  
  6095.         function notificationAlerts(markup) {
  6096.             a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
  6097.             if (!$optionsbutton.hasClass("arrowchat_tabclick")) {
  6098.                 if (a("#arrowchat_notification_alert").length > 0) {
  6099.                     a("#arrowchat_notification_alert").remove();
  6100.                 }
  6101.                 $body.append("<div id=\"arrowchat_notification_alert\"><div class=\"arrowchat_notification_alert_content\">" + markup + "</div></div>");
  6102.                 a("#arrowchat_notification_alert .arrowchat_notifications_divider").hide();
  6103.                 setTimeout(function() {
  6104.                     a("#arrowchat_notification_alert").fadeOut("slow", function() {
  6105.                         a("#arrowchat_notification_alert").remove();
  6106.                     });
  6107.                 }, 7000);
  6108.                 $optionsbutton.addClass("arrowchat_tab_new_message");
  6109.                 a("<div/>").css("top", "-10px").css("left", "8px").addClass("arrowchat_tabalertnf").html(Q).prependTo($optionsbutton);
  6110.             }
  6111.             if (Q > 0) {
  6112.                 a("#arrowchat_no_new_notifications").css("display", "none");
  6113.             }
  6114.         }
  6115.  
  6116.         function stripslashes(str) {
  6117.             str = str.replace(/\\'/g, "'");
  6118.             str = str.replace(/\\"/g, "\"");
  6119.             str = str.replace(/\\0/g, "\x00");
  6120.             str = str.replace(/\\\\/g, "\\");
  6121.             return str;
  6122.         }
  6123.  
  6124.         function receiveMessage(id, from, message, sent, self, old) {
  6125.             ma = id;
  6126.             clearTimeout(dtit3);
  6127.             DTitChange(uc_name[from]);
  6128.             if (j == from && uc_name[from] != "" && uc_name[from] != null) {
  6129.                 var container = a("#arrowchat_tabcontenttext_" + from)[0].scrollHeight - a("#arrowchat_tabcontenttext_" + from).scrollTop() - 10;
  6130.                 var container2 = a("#arrowchat_tabcontenttext_" + from).outerHeight();
  6131.                 var o = uc_name[from];
  6132.                 if (uc_status[from] == "offline") {
  6133.                     loadBuddyList();
  6134.                 }
  6135.                 f = "";
  6136.                 if (self == 1) {
  6137.                     fromname = u_name;
  6138.                     fromid = u_id;
  6139.                     f = " arrowchat_self";
  6140.                     avatar = u_avatar;
  6141.                     tooltip = lang[90];
  6142.                 } else {
  6143.                     DTitChange(uc_name[from]);
  6144.                     fromname = o;
  6145.                     fromid = from;
  6146.                     avatar = uc_avatar[from];
  6147.                     tooltip = fromname;
  6148.                 }
  6149.                 var full_name = fromid;
  6150.                 message = stripslashes(message);
  6151.                 message = replaceURLWithHTMLLinks(message);
  6152.                 if (a("#arrowchat_message_" + id).length > 0) {
  6153.                     a("#arrowchat_message_" + id + " .arrowchat_chatboxmessagecontent").html(message);
  6154.                 } else {
  6155.                     if (c_show_full_name != 1) {
  6156.                         if (fromname.indexOf(" ") != -1) {
  6157.                             fromname = fromname.slice(0, fromname.indexOf(" "));
  6158.                         }
  6159.                     }
  6160.                     if (sent - last_sent[from] > 60 || last_sent[from] == null || last_name[from] != full_name) {
  6161.                         a(".arrowchat_tabcontenttext", $user_popups[from]).append("<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + id + "\" style=\"display:none\"><div class=\"arrowchat_chatboxmessagefrom" + f + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + f + "\">" + formatTimestamp(new Date(sent * 1000)) + message + "</div></div></div>");
  6162.                         if (c_chat_animations == 1 && old != 1) {
  6163.                             a("#arrowchat_message_" + id).show("slide", {
  6164.                                 direction: "left"
  6165.                             });
  6166.                         } else {
  6167.                             a("#arrowchat_message_" + id).show();
  6168.                         }
  6169.                         last_sent[from] = sent;
  6170.                         last_name[from] = full_name;
  6171.                         last_id[from] = id;
  6172.                     } else {
  6173.                         if (last_id[from] !== "undefined") {
  6174.                             a("#arrowchat_message_" + last_id[from]).append("<div id=\"arrowchat_message_" + id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + message + "</div>");
  6175.                         } else {
  6176.                             a(".arrowchat_tabcontenttext", $user_popups[from]).append("<div id=\"arrowchat_message_" + id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + message + "</div>");
  6177.                         }
  6178.                     }
  6179.                     if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
  6180.                         setAvatarVisibility(1);
  6181.                     }
  6182.                 }
  6183.                 if (container <= container2 || !$users[from].hasClass("arrowchat_tabclick")) {
  6184.                     a("#arrowchat_tabcontenttext_" + from).scrollTop(50000);
  6185.                 } else {
  6186.                     displayMessage("arrowchat_chatbox_message_flyout_" + from, lang[134], "notice");
  6187.                 }
  6188.                 self != 1 && old != 1 && showDesktopNotification(from, message, id);
  6189.             } else {
  6190.                 message = stripslashes(message);
  6191.                 addMessageToChatbox(from, message, self, old, id, 0, sent);
  6192.                 j == "" && 0 && activateUser(from);
  6193.             }
  6194.         }
  6195.  
  6196.         function receiveTyping(id) {
  6197.             if (typeof $users[id] != "undefined") {
  6198.                 a(".arrowchat_closebox_bottom_status", $users[id]).addClass("arrowchat_typing");
  6199.             }
  6200.         }
  6201.  
  6202.         function receiveNotTyping(id) {
  6203.             if (typeof $users[id] != "undefined") {
  6204.                 a(".arrowchat_closebox_bottom_status", $users[id]).removeClass("arrowchat_typing");
  6205.             }
  6206.         }
  6207.  
  6208.         function pushCancelAll() {
  6209.             if (c_push_engine == 1) {
  6210.                 push.unsubscribe({
  6211.                     channel: "u" + u_id
  6212.                 });
  6213.                 push.unsubscribe({
  6214.                     channel: "arrowchat"
  6215.                 });
  6216.                 if (Ccr > 0) {
  6217.                     push.unsubscribe({
  6218.                         channel: "chatroom" + Ccr
  6219.                     });
  6220.                 }
  6221.             }
  6222.         }
  6223.  
  6224.         function pushSubscribe() {
  6225.             if (c_push_engine == 1) {
  6226.                 push.subscribe({
  6227.                     channel: "u" + u_id,
  6228.                     callback: function(data) {
  6229.                         pushReceive(data);
  6230.                     }
  6231.                 });
  6232.                 push.subscribe({
  6233.                     channel: "arrowchat",
  6234.                     callback: function(data) {
  6235.                         pushReceive(data);
  6236.                     }
  6237.                 });
  6238.             }
  6239.         }
  6240.  
  6241.         function pushReceive(data) {
  6242.             if ("announcement" in data) {
  6243.                 receiveAnnouncement(data.announcement);
  6244.             }
  6245.             if ("notification" in data) {
  6246.                 var markup2;
  6247.                 addNotification(data.notification.alert_id, data.notification.markup);
  6248.                 notificationAlerts(markup2);
  6249.             }
  6250.             if ("chatroommessage" in data) {
  6251.                 if (typeof blockList[data.chatroommessage.userid] == "undefined") {
  6252.                     addChatroomMessage(data.chatroommessage.id, data.chatroommessage.name, data.chatroommessage.message, data.chatroommessage.userid, data.chatroommessage.sent, data.chatroommessage.global, data.chatroommessage.mod, data.chatroommessage.admin);
  6253.                     chatroomAlerts(1);
  6254.                     if (data.chatroommessage.userid != u_id) {
  6255.                         u_chatroom_sound == 1 && !a(".arrowchat_chatroom_message_input").is(":focus") && playNewMessageSound();
  6256.                     }
  6257.                 }
  6258.             }
  6259.             if ("typing" in data) {
  6260.                 receiveTyping(data.typing.id);
  6261.             }
  6262.             if ("nottyping" in data) {
  6263.                 receiveNotTyping(data.nottyping.id);
  6264.             }
  6265.             if ("messages" in data) {
  6266.                 receiveMessage(data.messages.id, data.messages.from, data.messages.message, data.messages.sent, data.messages.self, data.messages.old);
  6267.                 data.messages.self != 1 && u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[data.messages.from]).is(":focus") && playNewMessageSound();
  6268.                 showTimeAndTooltip();
  6269.                 K = 1;
  6270.                 D = E;
  6271.             }
  6272.             if ("chatroomban" in data) {
  6273.                 Ccr = 0;
  6274.                 chatroomreceived = 0;
  6275.                 loadChatroomList();
  6276.                 displayMessage("arrowchat_chatroom_message_flyout", data.error2, "error");
  6277.             }
  6278.         }
  6279.  
  6280.         function DTitChange(name) {
  6281.             name = renderHTMLString(name);
  6282.             if (dtit2 != 2) {
  6283.                 document.title = lang[30] + " " + name + "!";
  6284.                 dtit2 = 2;
  6285.             } else {
  6286.                 document.title = dtit;
  6287.                 dtit2 = 1;
  6288.             }
  6289.             if (window_focus == false) {
  6290.                 dtit3 = setTimeout(function() {
  6291.                     DTitChange(name);
  6292.                 }, 1000);
  6293.             } else {
  6294.                 document.title = dtit;
  6295.                 clearTimeout(dtit3);
  6296.             }
  6297.         }
  6298.  
  6299.         function changePushChannel(name, connect) {
  6300.             if (connect == 1) {
  6301.                 push.subscribe({
  6302.                     channel: name,
  6303.                     callback: function(data) {
  6304.                         pushReceive(data);
  6305.                     }
  6306.                 });
  6307.             } else {
  6308.                 push.unsubscribe({
  6309.                     channel: name
  6310.                 });
  6311.             }
  6312.         }
  6313.  
  6314.         function buildTrayButtons() {
  6315.             for (var b = "", c = "", arcb = "", d = 0; d < barLinks.length; d++) {
  6316.                 var i = barLinks[d];
  6317.                 if (i[6] == "" || i[6] == 0) {
  6318.                     i[6] = 16;
  6319.                 }
  6320.                 if (d == barLinks.length - 1) {
  6321.                     arcb = " arrowchat_right_border";
  6322.                 }
  6323.                 b += "<div id=\"arrowchat_trayicon_" + d + "\" class=\"arrowchat_tray_button arrowchat_bar_left" + arcb + "\" style=\"width:" + i[6] + "px;\"><div class=\"arrowchat_inner_button\"><img class=\"arrowchat_tray_icon\" src=" + c_ac_path + "themes/" + u_theme + "/images/icons/" + i[0] + "><div class=\"arrowchat_tray_name\">" + i[7] + "</div></div></div>";
  6324.                 if (i[3] == "_popup") {
  6325.                     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>";
  6326.                 }
  6327.             }
  6328.             $base.append("<div>" + b + "</div>");
  6329.             $body.append("<div>" + c + "</div>");
  6330.             a(".arrowchat_tray_button").mouseover(function() {
  6331.                 var e = a(this).attr("id").substr(19);
  6332.                 if (barLinks[e][6] <= 16 || barLinks[e][6] == "") {
  6333.                     showTooltip(a("#arrowchat_trayicon_" + e), barLinks[e][1], 1);
  6334.                 }
  6335.                 a(this).addClass("arrowchat_tabmouseover");
  6336.             });
  6337.             a(".arrowchat_tray_button").mouseout(function() {
  6338.                 a(this).removeClass("arrowchat_tabmouseover");
  6339.                 hideTooltip();
  6340.             });
  6341.             a(".arrowchat_traytitle").mouseenter(function() {
  6342.                 var e = a(this).parent().attr("id");
  6343.                 e = e.substring(19, e.length - 6);
  6344.                 a(this).addClass("arrowchat_chatboxtabtitlemouseover");
  6345.             });
  6346.             a(".arrowchat_traytitle").mouseleave(function() {
  6347.                 var e = a(this).parent().attr("id");
  6348.                 e = e.substring(19, e.length - 6);
  6349.                 a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
  6350.             });
  6351.             a(".arrowchat_traytitle").click(function() {
  6352.                 var e = a(this).parent().attr("id");
  6353.                 e = e.substring(19, e.length - 6);
  6354.                 a("#arrowchat_trayicon_" + e).click();
  6355.             });
  6356.             a(".arrowchat_tray_button").click(function() {
  6357.                 var e = a(this).attr("id").substr(19);
  6358.                 if (j != "") {
  6359.                     closePopup($user_popups[j], $users[j]);
  6360.                     a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
  6361.                     j = "";
  6362.                 }
  6363.                 closePopup($userstab_popup, $buddy_list_tab);
  6364.                 closePopup($optionsbutton_popup, $optionsbutton);
  6365.                 var l = "_self";
  6366.                 if (barLinks[e][3]) {
  6367.                     l = barLinks[e][3];
  6368.                 }
  6369.                 if (l == "_popup") {
  6370.                     if (m != e) {
  6371.                         closePopup(a("#arrowchat_trayicon_" + m + "_popup"), a("#arrowchat_trayicon_" + m));
  6372.                         m = "";
  6373.                     }
  6374.                     if (m == "") {
  6375.                         a("#arrowchat_trayicon_" + e + "_popup").css("left", a("#arrowchat_trayicon_" + e).offset().left).css("bottom", "25px").css("width", barLinks[e][4]);
  6376.                         a("#arrowchat_trayicon_" + e + "_popup").addClass("arrowchat_tabopen");
  6377.                         a("#arrowchat_trayicon_" + e).addClass("arrowchat_trayclick");
  6378.                         if (a("#arrowchat_trayicon_" + e + "_iframe").attr("src") === undefined || a("#arrowchat_trayicon_" + e + "_iframe").attr("src") == "") {
  6379.                             a("#arrowchat_trayicon_" + e + "_iframe").attr("src", barLinks[e][2]);
  6380.                         }
  6381.                         m = e;
  6382.                     } else {
  6383.                         closePopup(a("#arrowchat_trayicon_" + m + "_popup"), a("#arrowchat_trayicon_" + m));
  6384.                         m = "";
  6385.                     }
  6386.                 } else {
  6387.                     var bar_link_url = barLinks[e][2].replace("{USER_ID}", u_id);
  6388.                     bar_link_url = bar_link_url.replace("{USER_NAME}", u_name);
  6389.                     window.open(bar_link_url, l);
  6390.                 }
  6391.             });
  6392.         }
  6393.  
  6394.         function buildChatboxes() {
  6395.             $chatbox_left.click(function() {
  6396.                 if ($chatboxes.scrollLeft() == 0) {} else {
  6397.                     scrollChatboxes("-=148px");
  6398.                 }
  6399.             });
  6400.             $chatbox_right.click(function() {
  6401.                 if ($chatboxes.scrollLeft() + $chatboxes.width() == $chatboxes_wide.width()) {} else {
  6402.                     scrollChatboxes("+=148px");
  6403.                 }
  6404.             });
  6405.         }
  6406.  
  6407.         function mobileSupport() {
  6408.             if (c_mobile_device == 1) {
  6409.                 $base.css("bottom", "0px");
  6410.                 var position = $base.position();
  6411.                 a(".arrowchat_tabpopup").css("bottom", a(document).height() - position.top - 9 + "px !important");
  6412.                 a(".arrowchat_apppopup").css("bottom", a(document).height() - position.top - 9 + "px !important");
  6413.             }
  6414.         }
  6415.  
  6416.         function notificationPermission() {
  6417.             if (window.webkitNotifications && window.webkitNotifications.checkPermission) {
  6418.                 window.webkitNotifications.requestPermission();
  6419.             } else if (window.Notification && window.Notification.requestPermission) {
  6420.                 window.Notification.requestPermission();
  6421.             } else {
  6422.                 return;
  6423.             }
  6424.         }
  6425.  
  6426.         function showDesktopNotification(id, message, message_id) {
  6427.             var s_message = message.replace(/<(?:.|\n)*?>/gm, "").replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, "\"");
  6428.             if (s_message != "") {
  6429.                 if (window.Notification && !window_focus && c_desktop_notify == 1) {
  6430.                     var time = (new Date).getTime();
  6431.                     var notification = new window.Notification(lang[144] + renderHTMLString(uc_name[id]), {
  6432.                         icon: uc_avatar[id],
  6433.                         body: s_message,
  6434.                         tag: message_id
  6435.                     });
  6436.                     notification.ondisplay = function(event) {
  6437.                         setTimeout(function() {
  6438.                             event.currentTarget.cancel();
  6439.                         }, 5000);
  6440.                     };
  6441.                 }
  6442.             }
  6443.         }
  6444.  
  6445.         function runarrowchat() {
  6446.             $base = a("<div/>").attr("id", "arrowchat_base").appendTo($body);
  6447.             if (c_chat_maintenance != 0 || c_guests_login_msg != 0 && u_id == "") {
  6448.                 buildMaintenance();
  6449.             } else {
  6450.                 if (c_hide_bar_on != 0) {
  6451.                     buildShowBarButton();
  6452.                     buildHideBarButton();
  6453.                 }
  6454.                 buildPopoutChatButton();
  6455.                 c_notifications != 0 && buildOptionsButton();
  6456.                 c_chatrooms != 0 && buildChatroomsButton();
  6457.                 buildBuddyListTab();
  6458.             }
  6459.             if (c_links_right != 1) {
  6460.                 buildTrayButtons();
  6461.             }
  6462.             if (c_applications_on != 0) {
  6463.                 if (u_id == "" && c_guests_apps == "1" || u_id != "" && u_is_guest != 1 || u_id != "" && u_is_guest == 1 && c_guests_apps == 1) {
  6464.                     if (c_no_apps_menu != 1) {
  6465.                         buildApplicationsButton();
  6466.                     }
  6467.                     buildApplicationButtons();
  6468.                 }
  6469.             }
  6470.             if (c_links_right == 1) {
  6471.                 buildTrayButtons();
  6472.             }
  6473.             $body.append("<div id=\"arrowchat_sound_player_holder\"></div>");
  6474.             $chatbox_right = a("<div/>").attr("id", "arrowchat_chatbox_right").appendTo($base);
  6475.             a("<span/>").addClass("arrowchat_next_tab").appendTo($chatbox_right);
  6476.             a("<div/>").addClass("arrowchat_tabtext").appendTo($chatbox_right);
  6477.             a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo($chatbox_right);
  6478.             $chatboxes = a("<div/>").attr("id", "arrowchat_chatboxes").appendTo($base);
  6479.             $chatboxes_wide = a("<div/>").attr("id", "arrowchat_chatboxes_wide").appendTo($chatboxes);
  6480.             $chatbox_left = a("<div/>").attr("id", "arrowchat_chatbox_left").appendTo($base);
  6481.             a("<span/>").addClass("arrowchat_previous_tab").appendTo($chatbox_left);
  6482.             a("<div/>").addClass("arrowchat_tabtext").appendTo($chatbox_left);
  6483.             a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo($chatbox_left);
  6484.             buildChatboxes();
  6485.             updateRightLastClasses();
  6486.             $chatboxes_wide.css("width", "0px");
  6487.             addHover(a("#arrowchat_chatbox_left, #arrowchat_chatbox_right"), "arrowchat_chatbox_lr_mouseover");
  6488.             a(window).bind("resize", adjustBarSize);
  6489.             set("buddylist", "1");
  6490.             set("initialize", "1");
  6491.             set("currenttime", ab);
  6492.             c_facebook_app_id != "" && a(".arrowchat_facebook_connect").show();
  6493.             a(window).focus(function() {
  6494.                 window_focus = true;
  6495.             }).blur(function() {
  6496.                 window_focus = false;
  6497.             });
  6498.             if (c_desktop_notify == 1) {
  6499.                 a("#arrowchat_base").click(notificationPermission);
  6500.             }
  6501.             if (typeof document.body.style.maxHeight === "undefined") {
  6502.                 W = true;
  6503.                 $base.css("position", "absolute");
  6504.                 $tooltip.css("position", "absolute");
  6505.                 $userstab_popup.css("position", "absolute");
  6506.                 $optionsbutton_popup.css("position", "absolute");
  6507.                 a(window).bind("scroll", function() {
  6508.                     positionArrowchat();
  6509.                 });
  6510.             }
  6511.             if (c_push_engine == 1) {
  6512.                 push = PUBNUB.init({
  6513.                     publish_key: c_push_publish,
  6514.                     subscribe_key: c_push_subscribe
  6515.                 });
  6516.             }
  6517.             if (c_chat_maintenance != 1) {
  6518.                 for (var d = 0; d < unfocus_chat.length; d++) {
  6519.                     if (unfocus_chat[d].toString().search("facebook") == "-1") {
  6520.                         receiveUser(unfocus_chat[d], uc_name[unfocus_chat[d]], uc_status[unfocus_chat[d]], uc_avatar[unfocus_chat[d]], uc_link[unfocus_chat[d]], "1");
  6521.                     }
  6522.                 }
  6523.             }
  6524.             if (u_hide_bar == 1 || u_status == "offline") {
  6525.                 if (u_status == "offline" && u_hide_bar != 1) {
  6526.                     a("#arrowchat_userstab_text").html("Chat (Offline)");
  6527.                     $chatboxes.hide();
  6528.                     $chatbox_right.hide();
  6529.                     $chatbox_left.hide();
  6530.                 } else {
  6531.                     $base.hide();
  6532.                     $show_bar_button.css("display", "block");
  6533.                 }
  6534.                 w = 1;
  6535.                 a.idleTimer("destroy");
  6536.             } else if (c_chat_maintenance != 1 && u_id != "" && u_popout_time != "1") {
  6537.                 if (u_chat_open.toString().search("facebook") == "-1") {
  6538.                     u_chat_open != 0 && receiveUser(u_chat_open, uc_name[u_chat_open], uc_status[u_chat_open], uc_avatar[u_chat_open], uc_link[u_chat_open]);
  6539.                 }
  6540.                 if (c_push_engine == 1) {
  6541.                     pushSubscribe();
  6542.                 }
  6543.                 receiveCore();
  6544.                 a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
  6545.                 a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
  6546.                 loadBuddyList();
  6547.                 u_blist_open == 1 && $buddy_list_tab.click();
  6548.                 if (u_chatroom_open != -1) {
  6549.                     u_chatroom_open == 0 && $chatrooms_button.click();
  6550.                     if (u_chatroom_open != 0) {
  6551.                         Ccr = u_chatroom_open;
  6552.                         chatroomreceived = 1;
  6553.                         if (typeof $chatroom_create != "undefined") {
  6554.                             $chatroom_create.hide();
  6555.                         }
  6556.                         closePopup($userstab_popup, $buddy_list_tab);
  6557.                         closePopup($optionsbutton_popup, $optionsbutton);
  6558.                         $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
  6559.                         $chatrooms_button.toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
  6560.                         $chatrooms_popup.toggleClass("arrowchat_tabopen");
  6561.                         loadChatroom(u_chatroom_open, crt[u_chatroom_open]);
  6562.                     }
  6563.                 }
  6564.                 if (u_chatroom_stay > 0) {
  6565.                     Ccr = u_chatroom_stay;
  6566.                     chatroomreceived = 1;
  6567.                     if (typeof $chatroom_create != "undefined") {
  6568.                         $chatroom_create.hide();
  6569.                     }
  6570.                     loadChatroom(u_chatroom_stay, crt[u_chatroom_stay]);
  6571.                 }
  6572.                 if (u_chatroom_stay == -1 && u_chatroom_open == -1 && c_chatroom_auto_join != 0) {
  6573.                     Ccr = c_chatroom_auto_join;
  6574.                     chatroomreceived = 1;
  6575.                     if (typeof $chatroom_create != "undefined") {
  6576.                         $chatroom_create.hide();
  6577.                     }
  6578.                     loadChatroom(c_chatroom_auto_join, crt[c_chatroom_auto_join]);
  6579.                 }
  6580.                 if (u_apps_open != "" && u_apps_open != "0") {
  6581.                     a("#arrowchat_app_link_" + u_apps_open).click();
  6582.                 }
  6583.             } else if (u_popout_time == "1") {
  6584.                 a.idleTimer("destroy");
  6585.                 $buddy_list_tab.hide();
  6586.                 $popout_chat_button.show();
  6587.                 $chatboxes.hide();
  6588.                 $chatbox_right.hide();
  6589.                 $chatbox_left.hide();
  6590.             }
  6591.             clearUserStatus();
  6592.             adjustBarSize();
  6593.             if (c_mobile_device == 1) {
  6594.                 a(window).bind("scroll", mobileSupport);
  6595.                 mobileSupport();
  6596.             }
  6597.             a("#arrowchat_userstab_icon").addClass("arrowchat_user_" + u_status + "2");
  6598.         }
  6599.  
  6600.         function positionArrowchat() {
  6601.             $base.css("top", a(window).scrollTop() + a(window).height() - 25);
  6602.             $userstab_popup.css("top", parseInt(a(window).height()) - parseInt($userstab_popup.css("bottom")) - parseInt($userstab_popup.height()) + a(window).scrollTop() + "px");
  6603.             $optionsbutton_popup.css("top", parseInt(a(window).height()) - parseInt($optionsbutton_popup.css("bottom")) - parseInt($optionsbutton_popup.height()) + a(window).scrollTop() + "px");
  6604.             $tooltip.length > 0 && $tooltip.css("top", parseInt(a(window).height()) - parseInt($tooltip.css("bottom")) - parseInt($tooltip.height()) + a(window).scrollTop() + "px");
  6605.             if (j != "") {
  6606.                 $user_popups[j].css("position", "absolute");
  6607.                 $user_popups[j].css("top", parseInt(a(window).height()) - parseInt($user_popups[j].css("bottom")) - parseInt($user_popups[j].height()) + a(window).scrollTop() + "px");
  6608.             }
  6609.         }
  6610.  
  6611.         function playNewMessageSound() {
  6612.             swfobject.embedSWF(c_ac_path + "themes/" + u_theme + "/sounds/new%5Fmessage.player.swf?soundswf=" + c_ac_path + "themes/" + u_theme + "/sounds/new%5Fmessage.swf&autoplay=1&loops=0", "arrowchat_sound_player_holder", "1", "1", "9.0.0");
  6613.         }
  6614.  
  6615.         function getJabberUser(id, openChat, message) {
  6616.             var numericid = jabberDecodeID(id).split("@")[0].split("-")[1];
  6617.             a.ajax({
  6618.                 url: "http://graph.facebook.com/" + numericid,
  6619.                 dataType: "json",
  6620.                 type: "GET",
  6621.                 async: false,
  6622.                 success: function(output) {
  6623.                     uc_name[id] = output.name;
  6624.                     if (typeof output.status == "undefined") {
  6625.                         uc_status[id] = "offline";
  6626.                     } else {
  6627.                         uc_status[id] = output.status;
  6628.                     }
  6629.                     uc_avatar[id] = "http://graph.facebook.com/" + numericid + "/picture";
  6630.                     uc_link[id] = output.link;
  6631.                     if (openChat == 1) {
  6632.                         openJabberChat(id);
  6633.                     } else {
  6634.                         openJabberMinimizeChat(id, message);
  6635.                     }
  6636.                 }
  6637.             });
  6638.         }
  6639.  
  6640.         function openJabberChat(id) {
  6641.             toggleUserChatTab(id, uc_name[id], uc_status[id], uc_avatar[id], uc_link[id], 0, 1);
  6642.             j = id;
  6643.         }
  6644.  
  6645.         function openJabberMinimizeChat(id, message) {
  6646.             toggleUserChatTab(id, uc_name[id], uc_status[id], uc_avatar[id], uc_link[id], 1, 1);
  6647.             if (message != 0) {
  6648.                 receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 0);
  6649.             }
  6650.             adjustBarSize();
  6651.         }
  6652.  
  6653.         function getJabberList(data) {
  6654.             if (data != "") {
  6655.                 session_var = data[0].msg;
  6656.             }
  6657.             a.ajax({
  6658.                 url: "//arrowjabber.com/",
  6659.                 data: {
  6660.                     action: "getOnlineBuddies",
  6661.                     sid: session_var
  6662.                 },
  6663.                 dataType: "jsonp",
  6664.                 type: "GET",
  6665.                 beforeSend: function() {
  6666.                     jabberInitialize != 1 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
  6667.                 },
  6668.                 error: function() {
  6669.                     jqac.arrowchat.facebookLogout();
  6670.                 },
  6671.                 success: function(data) {
  6672.                     if (data[0] && data[0].error == "1") {
  6673.                         getJabberID(facebookResponse);
  6674.                     } else {
  6675.                         var md5updated = 0;
  6676.                         jabberOnlineNumber = 0;
  6677.                         var d = "";
  6678.                         var buddylisttemp = "";
  6679.                         var jabber_focus = 0;
  6680.                         a("#arrowchat_facebook_friends_list").html("");
  6681.                         a.each(data, function(id, user) {
  6682.                             if (user.id) {
  6683.                                 var numericid = user.id.split("@")[0].split("-")[1];
  6684.                                 user.id = jabberEncodeID(user.id);
  6685.                                 var longname = user.n.length > 16 ? user.n.substr(0, 16) + "..." : user.n;
  6686.                                 jabberOnlineNumber++;
  6687.                                 if (a("#arrowchat_setting_names_only :input").is(":checked")) {
  6688.                                     d = "arrowchat_hide_avatars";
  6689.                                 }
  6690.                                 if (user.s == "available") {
  6691.                                     buddylisttemp += "<div id=\"arrowchat_userlist_" + user.id + "\" class=\"arrowchat_userlist arrowchat_buddylist_admin_0 arrowchat_jabber_user\" onmouseover=\"jqac(this).addClass('arrowchat_userlist_hover');\" onmouseout=\"jqac(this).removeClass('arrowchat_userlist_hover');\"><img class=\"arrowchat_userlist_avatar " + d + "\" src=\"" + user.a + "\" /><span class=\"arrowchat_userscontentname\">" + longname + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + user.s + "\"></span></div>";
  6692.                                 }
  6693.                                 uc_name[user.id] = user.n;
  6694.                                 uc_status[user.id] = user.s;
  6695.                                 uc_avatar[user.id] = user.a;
  6696.                                 uc_link[user.id] = "http://www.facebook.com/" + numericid;
  6697.                                 if (G[user.id] != null) {
  6698.                                     a(".arrowchat_closebox_bottom_status", $users[user.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + user.s);
  6699.                                     $users[user.id].removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + user.s);
  6700.                                 }
  6701.                                 if (u_chat_open == user.id) {
  6702.                                     jabber_focus = user.id;
  6703.                                 }
  6704.                             }
  6705.                             if (user.md5) {
  6706.                                 jabber_hash = user.md5;
  6707.                                 md5updated = 1;
  6708.                             }
  6709.                         });
  6710.                         jabberOnlineNumber == 0 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
  6711.                         a("#arrowchat_facebook_friends_list").append("<div>" + buddylisttemp + "</div>");
  6712.                         if (u_hide_bar != 1 && u_status != "offline") {
  6713.                             a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
  6714.                         }
  6715.                         a(".arrowchat_jabber_user").click(function(l) {
  6716.                             if (a(l.target).attr("id")) {
  6717.                                 var c = a(l.target).attr("id").substr(19);
  6718.                             } else {
  6719.                                 var c = "";
  6720.                             }
  6721.                             if (c == "") {
  6722.                                 c = a(l.target).parent().attr("id").substr(19);
  6723.                             }
  6724.                             toggleUserChatTab(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c], 0, 1);
  6725.                         });
  6726.                         if (jabberInitialize2 != 1) {
  6727.                             if (jabberOnlineNumber == 1 || jabberOnlineNumber == 0) {
  6728.                                 jabberInitialize2 = 1;
  6729.                                 getJabberList("");
  6730.                                 return;
  6731.                             }
  6732.                         }
  6733.                         if (jabberInitialize != 1) {
  6734.                             for (var d = 0; d < unfocus_chat.length; d++) {
  6735.                                 if (unfocus_chat[d].toString().search("facebook") != "-1") {
  6736.                                     if (uc_name[unfocus_chat[d]] != "" && typeof uc_name[unfocus_chat[d]] != "undefined" && uc_link[unfocus_chat[d]].toString().search("facebook") != "-1") {
  6737.                                         toggleUserChatTab(unfocus_chat[d], uc_name[unfocus_chat[d]], uc_status[unfocus_chat[d]], uc_avatar[unfocus_chat[d]], uc_link[unfocus_chat[d]], 1, 1);
  6738.                                     } else {
  6739.                                         getJabberUser(unfocus_chat[d], 0, 0);
  6740.                                     }
  6741.                                 }
  6742.                             }
  6743.                             if (jabber_focus != 0) {
  6744.                                 a("#arrowchat_userlist_" + jabber_focus).click();
  6745.                                 j = jabber_focus;
  6746.                             } else if (u_chat_open.toString().search("facebook") != "-1") {
  6747.                                 getJabberUser(u_chat_open, 1, 0);
  6748.                             }
  6749.                         }
  6750.                         clearTimeout(jabberListTimer);
  6751.                         jabberListTimer = setTimeout(function() {
  6752.                             getJabberList("");
  6753.                         }, c_list_heart_beat * 1000);
  6754.                         adjustBuddyListSize();
  6755.                         getJabberMessages();
  6756.                         jabberInitialize = 1;
  6757.                     }
  6758.                 }
  6759.             });
  6760.         }
  6761.  
  6762.         function getJabberMessages() {
  6763.             clearTimeout(jabberMsgTimer);
  6764.             a.ajax({
  6765.                 url: "//arrowjabber.com/",
  6766.                 data: {
  6767.                     action: "getRecentMessages",
  6768.                     sid: session_var
  6769.                 },
  6770.                 dataType: "jsonp",
  6771.                 type: "GET",
  6772.                 success: function(data) {
  6773.                     if (data[0] && data[0].error == "1") {
  6774.                         getJabberID(facebookResponse);
  6775.                     } else {
  6776.                         a.each(data, function(id, message) {
  6777.                             message.from = jabberEncodeID(message.from);
  6778.                             if (typeof uc_name[message.from] == "undefined") {
  6779.                                 getJabberUser(message.from, 0, message);
  6780.                             } else {
  6781.                                 receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 0);
  6782.                             }
  6783.                             u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[message.from]).is(":focus") && playNewMessageSound();
  6784.                             showTimeAndTooltip();
  6785.                             K = 1;
  6786.                             D = E;
  6787.                         });
  6788.                         jabberMsgTimer = setTimeout(function() {
  6789.                             getJabberMessages();
  6790.                         }, c_heart_beat * 1000);
  6791.                     }
  6792.                 }
  6793.             });
  6794.         }
  6795.  
  6796.         function getJabberID(response) {
  6797.             var currenttime = new Date;
  6798.             currenttime = parseInt(currenttime.getTime() / 1000);
  6799.             if (errorCount == 0) {
  6800.                 setTimeout(function() {
  6801.                     errorCount = 0;
  6802.                 }, 10000);
  6803.             }
  6804.             errorCount++;
  6805.             if (errorCount < 4) {
  6806.                 a.ajax({
  6807.                     url: "//arrowjabber.com/",
  6808.                     data: {
  6809.                         action: "login",
  6810.                         access_key: response.authResponse.accessToken,
  6811.                         fb_app_id: c_facebook_app_id,
  6812.                         user: response.authResponse.userID
  6813.                     },
  6814.                     dataType: "jsonp",
  6815.                     type: "GET",
  6816.                     beforeSend: function() {
  6817.                         jabberInitialize != 1 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
  6818.                     },
  6819.                     error: function() {
  6820.                         jqac.arrowchat.facebookLogout();
  6821.                     },
  6822.                     success: function(data) {
  6823.                         a.cookie("ac_facebook_id", data[0].msg, {
  6824.                             expires: 365,
  6825.                             path: "/"
  6826.                         });
  6827.                         getJabberList(data);
  6828.                     }
  6829.                 });
  6830.             } else {
  6831.                 jqac.arrowchat.facebookLogout();
  6832.             }
  6833.         }
  6834.  
  6835.         function getJabberHistory(id) {
  6836.             a.ajax({
  6837.                 url: "//arrowjabber.com/",
  6838.                 data: {
  6839.                     action: "getAllMessages",
  6840.                     user: jabberDecodeID(id),
  6841.                     sid: session_var
  6842.                 },
  6843.                 dataType: "jsonp",
  6844.                 type: "GET",
  6845.                 success: function(data) {
  6846.                     if (data[0] && data[0].error == "1") {
  6847.                         getJabberID(facebookResponse);
  6848.                     } else {
  6849.                         a("#arrowchat_tabcontenttext_" + id).html("");
  6850.                         last_sent[id] = null;
  6851.                         a.each(data, function(id, message) {
  6852.                             message.from = jabberEncodeID(message.from);
  6853.                             if (message.type == "received") {
  6854.                                 receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 1);
  6855.                             } else {
  6856.                                 addMessageToChatbox(message.from, message.msg, "1", "1", "f" + message.time, 1, message.time / 1000);
  6857.                             }
  6858.                             showTimeAndTooltip();
  6859.                         });
  6860.                     }
  6861.                 }
  6862.             });
  6863.         }
  6864.  
  6865.         function jabberEncodeID(id) {
  6866.             id = id.toLowerCase();
  6867.             id = id.replace("-", "M");
  6868.             id = id.replace("@", "A");
  6869.             id = id.replace(/\./g, "D");
  6870.             return id;
  6871.         }
  6872.  
  6873.         function jabberDecodeID(id) {
  6874.             id = id.replace("M", "-");
  6875.             id = id.replace("A", "@");
  6876.             id = id.replace(/D/g, ".");
  6877.             return id;
  6878.         }
  6879.  
  6880.         function sendJabberMessage(id, message) {
  6881.             new_id = jabberDecodeID(id);
  6882.             a(".arrowchat_textarea").addClass("arrowchat_message_sending");
  6883.             a.getJSON("//arrowjabber.com/", {
  6884.                 action: "sendMessage",
  6885.                 to: new_id,
  6886.                 msg: message,
  6887.                 sid: session_var
  6888.             }, function(data) {
  6889.                 a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
  6890.                 if (data[0] && data[0].error == "1") {
  6891.                     displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[135], "error");
  6892.                 } else {
  6893.                     addMessageToChatbox(id, message, "1", "1", "f" + Math.floor((new Date).getTime()), 1, Math.floor((new Date).getTime() / 1000));
  6894.                 }
  6895.             });
  6896.         }
  6897.  
  6898.         function renderHTMLString(string) {
  6899.             var new_render = string;
  6900.             if (typeof string != "undefined") {
  6901.                 var render = a("<div/>").attr("id", "arrowchat_render").html(string).appendTo("body");
  6902.                 new_render = a("#arrowchat_render").html();
  6903.                 render.remove();
  6904.             }
  6905.             return new_render;
  6906.         }
  6907.         var bounce2 = 1,
  6908.             bounce3 = 1,
  6909.             chatroom_mod = 0,
  6910.             chatroom_admin = 0,
  6911.             count = 0,
  6912.             V = {},
  6913.             dtit = document.title,
  6914.             dtit2 = 1,
  6915.             dtit3 = 1,
  6916.             window_focus = true,
  6917.             xa = {},
  6918.             j = "",
  6919.             crou = "",
  6920.             $ = 0,
  6921.             w = 0,
  6922.             bli = 1,
  6923.             isAway = 0,
  6924.             chatroomreceived = 0,
  6925.             msgcount = 0,
  6926.             W = false,
  6927.             Y, Z, E = 3000,
  6928.             Crref2, Ccr = -1,
  6929.             message_timeout, D = E,
  6930.             K = 1,
  6931.             ma = 0,
  6932.             R = 0,
  6933.             m = "",
  6934.             Ka = 0,
  6935.             crt = {},
  6936.             crt2 = {},
  6937.             y = {},
  6938.             G = {},
  6939.             aa = {},
  6940.             ca = {},
  6941.             last_id = {},
  6942.             last_sent = {},
  6943.             last_name = {},
  6944.             history_ids = {},
  6945.             Aa = new Date,
  6946.             Na = Aa.getDate(),
  6947.             ab = Math.floor(Aa.getTime() / 1000),
  6948.             acsi = 1,
  6949.             Q = 0,
  6950.             fa = -1,
  6951.             acp = "Powered By <a href='http://www.arrowchat.com/' target='_blank'>ArrowChat</a>",
  6952.             pa = 0,
  6953.             B, push, jabberListTimer, facebookResponse, jabber_hash = "",
  6954.             session_var = "",
  6955.             jabberInitialize = 0,
  6956.             jabberInitialize2 = 0,
  6957.             jabberMsgTimer, onlineNumber = 0,
  6958.             jabberOnlineNumber = 0,
  6959.             errorCount = 0,
  6960.             N;
  6961.         var _ts = "",
  6962.             _ts2;
  6963.         for (d = 0; d < Themes.length; d++) {
  6964.             if (Themes[d][2] == u_theme) {
  6965.                 _ts2 = "selected";
  6966.             } else {
  6967.                 _ts2 = "";
  6968.             }
  6969.             _ts = _ts + "<option value=\"" + Themes[d][0] + "\" " + _ts2 + ">" + Themes[d][1] + "</option>";
  6970.         }
  6971.         a.ajaxSetup({
  6972.             scriptCharset: "utf-8",
  6973.             cache: false
  6974.         });
  6975.         a.expr[':'].icontains = function(b, c, d) {
  6976.             return (b.textContent || b.innerText || jqac(b).text() || "").toLowerCase().indexOf(d[3].toLowerCase()) >= 0;
  6977.         };
  6978.         arguments.callee.videoWith = function(b) {
  6979.             var win = window.open(c_ac_path + "public/video/?rid=" + b, "audiovideochat", "status=no,toolbar=no,menubar=no,directories=no,resizable=no,location=no,scrollbars=no,width=650,height=720");
  6980.             win.focus();
  6981.         };
  6982.         arguments.callee.runarrowchat = runarrowchat;
  6983.         arguments.callee.chatroom = function(b) {
  6984.             if (u_hide_bar == 1) {
  6985.                 showBar();
  6986.             }
  6987.             $chatrooms_button.click();
  6988.             setTimeout(function() {
  6989.                 Ccr = b;
  6990.                 loadChatroom(b, "1");
  6991.             }, 400);
  6992.         };
  6993.         arguments.callee.chatWith = function(b) {
  6994.             if (u_hide_bar == 1) {
  6995.                 showBar();
  6996.             }
  6997.             receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b]);
  6998.         };
  6999.         arguments.callee.openCloseApp = function(name) {
  7000.             a(".arrowchat_appname_" + name).click();
  7001.         };
  7002.         arguments.callee.changeAppImage = function(name, image) {
  7003.             a(".arrowchat_appname_" + name + " img").attr("src", c_ac_path + image);
  7004.         };
  7005.         arguments.callee.addAppAlert = function(name, number) {
  7006.             if (a(".arrowchat_appname_" + name + " .arrowchat_tabalert").length > 0 && number > 0) {
  7007.                 a(".arrowchat_appname_" + name + " .arrowchat_tabalert").html(number);
  7008.                 a(".arrowchat_appname_" + name + " .arrowchat_tabalert").effect("bounce", {
  7009.                     times: 3,
  7010.                     distance: 5
  7011.                 }, 200);
  7012.             } else if (!a(".arrowchat_appname_" + name).hasClass("arrowchat_trayclick")) {
  7013.                 a("<div/>").css("top", "-11px").css("left", "6px").addClass("arrowchat_tabalert").html(number).appendTo(".arrowchat_appname_" + name);
  7014.             }
  7015.         };
  7016.         arguments.callee.getUser = function(b, c) {
  7017.             a.ajax({
  7018.                 url: c_ac_path + "includes/json/receive/receive_user.php",
  7019.                 data: {
  7020.                     userid: b
  7021.                 },
  7022.                 type: "post",
  7023.                 cache: false,
  7024.                 dataType: "json",
  7025.                 success: function(o) {
  7026.                     if (o) {
  7027.                         window[c](o);
  7028.                     } else {
  7029.                         window[c](0);
  7030.                     }
  7031.                 }
  7032.             });
  7033.         };
  7034.         arguments.callee.sendMessage = function(b, c) {
  7035.             c != "" && a.post(c_ac_path + "includes/json/send/send_message.php", {
  7036.                 to: b,
  7037.                 message: c
  7038.             }, function(d) {
  7039.                 if (d) {
  7040.                     if (d == "-1") {
  7041.                         displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
  7042.                     } else {
  7043.                         addMessageToChatbox(b, c, 1, 1, d, 1, 1);
  7044.                     }
  7045.                     a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
  7046.                 }
  7047.                 K = 1;
  7048.             });
  7049.         };
  7050.         arguments.callee.getBaseUrl = function() {
  7051.             return k;
  7052.         };
  7053.         arguments.callee.facebook = function(response) {
  7054.             facebookResponse = response;
  7055.             a(".arrowchat_facebook_connect a").html(lang[141]);
  7056.             a.cookie("ac_facebook", "1", {
  7057.                 expires: 365,
  7058.                 path: "/"
  7059.             });
  7060.             a("#arrowchat_userscontent").append("<div id=\"arrowchat_facebook_friends\" class=\"arrowchat_group_container\"><span class=\"arrowchat_group_text\">" + lang[143] + "</span><div class=\"arrowchat_group_line_container\"><span class=\"arrowchat_group_line\"></span></div></div><div id=\"arrowchat_facebook_friends_list\"></div>");
  7061.             a("#arrowchat_userscontent").prepend("<div id=\"arrowchat_site_users\" class=\"arrowchat_group_container\"><span class=\"arrowchat_group_text\">" + lang[142] + "</span><div class=\"arrowchat_group_line_container\"><span class=\"arrowchat_group_line\"></span></div></div>");
  7062.             adjustBuddyListSize();
  7063.             var fb_id_cookie = a.cookie("ac_facebook_id");
  7064.             if (typeof fb_id_cookie != "undefined" && fb_id_cookie != "") {
  7065.                 session_var = fb_id_cookie;
  7066.                 getJabberList("");
  7067.             } else if (session_var != "") {
  7068.                 getJabberList("");
  7069.             } else {
  7070.                 getJabberID(response);
  7071.             }
  7072.         };
  7073.         arguments.callee.facebookLogout = function() {
  7074.             clearTimeout(jabberListTimer);
  7075.             clearTimeout(jabberMsgTimer);
  7076.             a(".arrowchat_facebook_connect a").html(lang[140]);
  7077.             a.removeCookie("ac_facebook", {
  7078.                 path: "/"
  7079.             });
  7080.             a(".arrowchat_group_container").remove();
  7081.             a("#arrowchat_facebook_friends_list").remove();
  7082.             adjustBuddyListSize();
  7083.             jabberOnlineNumber = 0;
  7084.             a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
  7085.             a(".arrowchat_jabber_user_tab .arrowchat_closebox_bottom").click();
  7086.         };
  7087.     };
  7088. })(jqac);
  7089. jqac(document).ready(function() {
  7090.     if (u_logged_in != 1 && c_disable_arrowchat != 1) {
  7091.         jqac.arrowchat();
  7092.         jqac.arrowchat.runarrowchat();
  7093.     }
  7094. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement