Guest User

Untitled

a guest
Mar 15th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery.ajax = (function(_ajax) {
  2.     var protocol = location.protocol,
  3.         hostname = location.hostname,
  4.         exRegex = RegExp(protocol + '//' + hostname),
  5.         YQL = 'http' + (/^https/.test(protocol) ? 's' : '') + '://query.yahooapis.com/v1/public/yql?callback=?',
  6.         query = 'select * from html where url="{URL}" and xpath="*"';
  7.  
  8.     function isExternal(url) {
  9.         return !exRegex.test(url) && /:\/\//.test(url);
  10.     }
  11.     return function(o) {
  12.         var url = o.url;
  13.         if (/get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url)) {
  14.             o.url = YQL;
  15.             o.dataType = 'json';
  16.             o.data = {
  17.                 q: query.replace('{URL}', url + (o.data ? (/\?/.test(url) ? '&' : '?') + jQuery.param(o.data) : '')),
  18.                 format: 'xml'
  19.             };
  20.             if (!o.success && o.complete) {
  21.                 o.success = o.complete;
  22.                 delete o.complete;
  23.             }
  24.             o.success = (function(_success) {
  25.                 return function(data) {
  26.                     if (_success) {
  27.                         _success.call(this, {
  28.                             responseText: (data.results[0] || '').replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
  29.                         }, 'success');
  30.                     }
  31.                 };
  32.             })(o.success);
  33.         }
  34.         return _ajax.apply(this, arguments);
  35.     };
  36. })(jQuery.ajax);
  37.  
  38. function fbackSubmission() {
  39.     $j("#fbackResponse").html("");
  40.     var pText = $j("#f_text");
  41.     var pReply = $j("#f_reply");
  42.     var pUrl = $j("#f_url");
  43.     if (pText.val() == "") {
  44.         $j("#fbackResponse").html("Please specify some feedback");
  45.         return false
  46.     } else {
  47.         var jQueryform = $j("#feedbackForm"),
  48.             url = 'form=feedback';
  49.         jQuery.post(url, {
  50.             f_text: pText.val(),
  51.             f_reply: pReply.val(),
  52.             f_url: pUrl.val()
  53.         }, function(data) {
  54.             var d = data.split(":");
  55.             if (d[0] == 1) {
  56.                 $j("#fBack").html("").html("<div align='center' style='color:#ccffff;'>" + d[1] + "</div>")
  57.             }
  58.             if (d[0] == 2) {
  59.                 $j("#fbackResponse").html(d[1])
  60.             }
  61.         })
  62.     }
  63. }
  64.  
  65. function qSearchUrl() {
  66.     switch (qsUrl) {
  67.         default:
  68.             case "both":
  69.             return "http://www.openwow.com/qsearch=";
  70.         break;
  71.         case "vanilla":
  72.                 case "tbc":
  73.                 case "wotlk":
  74.                 case "cata":
  75.                 case "mop":
  76.                 return "/qsearchSelf=";
  77.             break;
  78.     }
  79. }
  80.  
  81. function lformCheck() {
  82.     var user = $j("#userID");
  83.     var pass = $j("#userPW");
  84.     if (user.val() == "") {
  85.         alert("Please enter a valid username");
  86.         return false
  87.     } else if (pass.val() == "") {
  88.         alert("Please enter a valid password");
  89.         return false
  90.     }
  91. }
  92.  
  93. function $(c) {
  94.     if (arguments.length > 1) {
  95.         var b = [];
  96.         var a;
  97.         for (var d = 0, a = arguments.length; d < a; ++d) {
  98.             b.push($(arguments[d]))
  99.         }
  100.         return b
  101.     }
  102.     if (typeof c == "string") {
  103.         c = ge(c)
  104.     }
  105.     return c
  106. }
  107.  
  108. function $E(a) {
  109.     if (!a) {
  110.         if (typeof event != "undefined") {
  111.             a = event
  112.         } else {
  113.             return null
  114.         }
  115.     }
  116.     if (a.which) {
  117.         a._button = a.which
  118.     } else {
  119.         a._button = a.button;
  120.         if (Browser.ie) {
  121.             if (a._button & 4) {
  122.                 a._button = 2
  123.             } else {
  124.                 if (a._button & 2) {
  125.                     a._button = 3
  126.                 }
  127.             }
  128.         } else {
  129.             a._button = a.button + 1
  130.         }
  131.     }
  132.     a._target = a.target ? a.target : a.srcElement;
  133.     a._wheelDelta = a.wheelDelta ? a.wheelDelta : -a.detail;
  134.     return a
  135. }
  136.  
  137. function $A(c) {
  138.     var e = [];
  139.     for (var d = 0, b = c.length; d < b; ++d) {
  140.         e.push(c[d])
  141.     }
  142.     return e
  143. }
  144. Function.prototype.bind = function() {
  145.     var c = this,
  146.         a = $A(arguments),
  147.         b = a.shift();
  148.     return function() {
  149.         return c.apply(b, a.concat($A(arguments)))
  150.     }
  151. };
  152.  
  153. function strcmp(d, c) {
  154.     if (d == c) {
  155.         return 0
  156.     }
  157.     if (d == null) {
  158.         return -1
  159.     }
  160.     if (c == null) {
  161.         return 1
  162.     }
  163.     return d < c ? -1 : 1
  164. }
  165.  
  166. function trim(a) {
  167.     return a.replace(/(^\s*|\s*$)/g, "")
  168. }
  169.  
  170. function rtrim(c, d) {
  171.     var b = c.length;
  172.     while (--b > 0 && c.charAt(b) == d) {}
  173.     c = c.substring(0, b + 1);
  174.     if (c == d) {
  175.         c = ""
  176.     }
  177.     return c
  178. }
  179.  
  180. function sprintf(b) {
  181.     var a;
  182.     for (a = 1, len = arguments.length; a < len; ++a) {
  183.         b = b.replace("$" + a, arguments[a])
  184.     }
  185.     return b
  186. }
  187.  
  188. function sprintfa(b) {
  189.     var a;
  190.     for (a = 1, len = arguments.length; a < len; ++a) {
  191.         b = b.replace(new RegExp("\\$" + a, "g"), arguments[a])
  192.     }
  193.     return b
  194. }
  195.  
  196. function sprintfo(c) {
  197.     if (typeof c == "object" && c.length) {
  198.         var a = c;
  199.         c = a[0];
  200.         var b;
  201.         for (b = 1; b < a.length; ++b) {
  202.             c = c.replace("$" + b, a[b])
  203.         }
  204.         return c
  205.     }
  206. }
  207.  
  208. function str_replace(e, d, c) {
  209.     while (e.indexOf(d) != -1) {
  210.         e = e.replace(d, c)
  211.     }
  212.     return e
  213. }
  214.  
  215. function urlencode(a) {
  216.     a = encodeURIComponent(a);
  217.     a = str_replace(a, "+", "%2B");
  218.     return a
  219. }
  220.  
  221. function urlencode2(a) {
  222.     a = encodeURIComponent(a);
  223.     a = str_replace(a, "%20", "+");
  224.     return a
  225. }
  226.  
  227. function number_format(a) {
  228.     a = "" + parseInt(a);
  229.     if (a.length <= 3) {
  230.         return a
  231.     }
  232.     return number_format(a.substr(0, a.length - 3)) + "," + a.substr(a.length - 3)
  233. }
  234.  
  235. function in_array(c, g, h, e) {
  236.     if (c == null) {
  237.         return -1
  238.     }
  239.     if (h) {
  240.         return in_arrayf(c, g, h, e)
  241.     }
  242.     for (var d = e || 0, b = c.length; d < b; ++d) {
  243.         if (c[d] == g) {
  244.             return d
  245.         }
  246.     }
  247.     return -1
  248. }
  249.  
  250. function in_arrayf(c, g, h, e) {
  251.     for (var d = e || 0, b = c.length; d < b; ++d) {
  252.         if (h(c[d]) == g) {
  253.             return d
  254.         }
  255.     }
  256.     return -1
  257. }
  258.  
  259. function array_walk(d, h, c) {
  260.     var g;
  261.     for (var e = 0, b = d.length; e < b; ++e) {
  262.         g = h(d[e], c, d, e);
  263.         if (g != null) {
  264.             d[e] = g
  265.         }
  266.     }
  267. }
  268.  
  269. function array_apply(d, h, c) {
  270.     var g;
  271.     for (var e = 0, b = d.length; e < b; ++e) {
  272.         h(d[e], c, d, e)
  273.     }
  274. }
  275.  
  276. function ge(a) {
  277.     return document.getElementById(a)
  278. }
  279.  
  280. function gE(a, b) {
  281.     return a.getElementsByTagName(b)
  282. }
  283.  
  284. function ce(c, b) {
  285.     var a = document.createElement(c);
  286.     if (b) {
  287.         cOr(a, b)
  288.     }
  289.     return a
  290. }
  291.  
  292. function de(a) {
  293.     a.parentNode.removeChild(a)
  294. }
  295.  
  296. function ae(a, b) {
  297.     return a.appendChild(b)
  298. }
  299.  
  300. function aef(a, b) {
  301.     return a.insertBefore(b, a.firstChild)
  302. }
  303.  
  304. function ee(a, b) {
  305.     if (!b) {
  306.         b = 0
  307.     }
  308.     while (a.childNodes[b]) {
  309.         a.removeChild(a.childNodes[b])
  310.     }
  311. }
  312.  
  313. function ct(a) {
  314.     return document.createTextNode(a)
  315. }
  316.  
  317. function st(a, b) {
  318.     if (a.firstChild && a.firstChild.nodeType == 3) {
  319.         a.firstChild.nodeValue = b
  320.     } else {
  321.         aef(a, ct(b))
  322.     }
  323. }
  324.  
  325. function nw(a) {
  326.     a.style.whiteSpace = "nowrap"
  327. }
  328.  
  329. function rf() {
  330.     return false
  331. }
  332.  
  333. function rf2(a) {
  334.     a = $E(a);
  335.     if (a.ctrlKey || a.shiftKey || a.altKey || a.metaKey) {
  336.         return
  337.     }
  338.     return false
  339. }
  340.  
  341. function tb() {
  342.     this.blur()
  343. }
  344.  
  345. function ac(c, d) {
  346.     var a = 0,
  347.         g = 0,
  348.         b;
  349.     while (c) {
  350.         a += c.offsetLeft;
  351.         g += c.offsetTop;
  352.         b = c.parentNode;
  353.         while (b && b != c.offsetParent && b.offsetParent) {
  354.             if (b.scrollLeft || b.scrollTop) {
  355.                 a -= (b.scrollLeft | 0);
  356.                 g -= (b.scrollTop | 0);
  357.                 break
  358.             }
  359.             b = b.parentNode
  360.         }
  361.         c = c.offsetParent
  362.     }
  363.     if (Lightbox.isVisible()) {
  364.         d = true
  365.     }
  366.     if (d && !Browser.ie6) {
  367.         var f = openDB_getScroll();
  368.         a += f.x;
  369.         g += f.y
  370.     }
  371.     var e = [a, g];
  372.     e.x = a;
  373.     e.y = g;
  374.     return e
  375. }
  376.  
  377. function aE(b, c, a) {
  378.     if (Browser.ie) {
  379.         b.attachEvent("on" + c, a)
  380.     } else {
  381.         b.addEventListener(c, a, false)
  382.     }
  383. }
  384.  
  385. function dE(b, c, a) {
  386.     if (Browser.ie) {
  387.         b.detachEvent("on" + c, a)
  388.     } else {
  389.         b.removeEventListener(c, a, false)
  390.     }
  391. }
  392.  
  393. function sp(a) {
  394.     if (!a) {
  395.         a = event
  396.     }
  397.     if (Browser.ie) {
  398.         a.cancelBubble = true
  399.     } else {
  400.         a.stopPropagation()
  401.     }
  402. }
  403.  
  404. function sc(h, i, d, f, g) {
  405.     var e = new Date();
  406.     var c = h + "=" + escape(d) + "; ";
  407.     e.setDate(e.getDate() + i);
  408.     c += "expires=" + e.toUTCString() + "; ";
  409.     if (f) {
  410.         c += "path=" + f + "; "
  411.     }
  412.     if (g) {
  413.         c += "domain=" + g + "; "
  414.     }
  415.     document.cookie = c;
  416.     gc.C[h] = d
  417. }
  418.  
  419. function dc(a) {
  420.     sc(a, -1);
  421.     gc.C[a] = null
  422. }
  423.  
  424. function gc(f) {
  425.     if (gc.I == null) {
  426.         var e = unescape(document.cookie).split("; ");
  427.         gc.C = {};
  428.         for (var c = 0, a = e.length; c < a; ++c) {
  429.             var g = e[c].indexOf("="),
  430.                 b, d;
  431.             if (g != -1) {
  432.                 b = e[c].substr(0, g);
  433.                 d = e[c].substr(g + 1)
  434.             } else {
  435.                 b = e[c];
  436.                 d = ""
  437.             }
  438.             gc.C[b] = d
  439.         }
  440.         gc.I = 1
  441.     }
  442.     if (!f) {
  443.         return gc.C
  444.     } else {
  445.         return gc.C[f]
  446.     }
  447. }
  448.  
  449. function ns(a) {
  450.     if (Browser.ie) {
  451.         a.onfocus = tb;
  452.         a.onmousedown = a.onselectstart = a.ondragstart = rf
  453.     }
  454. }
  455.  
  456. function eO(b) {
  457.     for (var a in b) {
  458.         delete b[a]
  459.     }
  460. }
  461.  
  462. function dO(a) {
  463.     function b() {}
  464.     b.prototype = a;
  465.     return new b
  466. };
  467.  
  468. function cO(f, c, b) {
  469.     for (var e in c) {
  470.         if (b && typeof c[e] == "object" && c[e].length) {
  471.             f[e] = c[e].slice(0)
  472.         } else {
  473.             f[e] = c[e]
  474.         }
  475.     }
  476. }
  477.  
  478. function cOr(f, c, b) {
  479.     for (var e in c) {
  480.         if (typeof c[e] == "object") {
  481.             if (b && c[e].length) {
  482.                 f[e] = c[e].slice(0)
  483.             } else {
  484.                 if (!f[e]) {
  485.                     f[e] = {}
  486.                 }
  487.                 cOr(f[e], c[e], b)
  488.             }
  489.         } else {
  490.             f[e] = c[e]
  491.         }
  492.     }
  493. }
  494. var Browser = {
  495.     ie: !!(window.attachEvent && !window.opera),
  496.     opera: !!window.opera,
  497.     safari: navigator.userAgent.indexOf("Safari") != -1,
  498.     gecko: navigator.userAgent.indexOf("Gecko") != -1 && navigator.userAgent.indexOf("KHTML") == -1
  499. };
  500. Browser.ie8 = Browser.ie && navigator.userAgent.indexOf("MSIE 8.0") != -1;
  501. Browser.ie7 = Browser.ie && navigator.userAgent.indexOf("MSIE 7.0") != -1 && !Browser.ie8;
  502. Browser.ie6 = Browser.ie && navigator.userAgent.indexOf("MSIE 6.0") != -1 && !Browser.ie7;
  503. Browser.ie67 = Browser.ie6 || Browser.ie7;
  504. navigator.userAgent.match(/Gecko\/([0-9]+)/);
  505. Browser.geckoVersion = parseInt(RegExp.$1) | 0;
  506. var OS = {
  507.     windows: navigator.appVersion.indexOf("Windows") != -1,
  508.     mac: navigator.appVersion.indexOf("Macintosh") != -1,
  509.     linux: navigator.appVersion.indexOf("Linux") != -1
  510. };
  511. var DomContentLoaded = new function() {
  512.     var a = [];
  513.     this.now = function() {
  514.         array_apply(a, function(b) {
  515.             b()
  516.         });
  517.         DomContentLoaded = null
  518.     };
  519.     this.addEvent = function(b) {
  520.         a.push(b)
  521.     }
  522. };
  523.  
  524. function openDB_getWindowSize() {
  525.     var a = 0,
  526.         b = 0;
  527.     if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
  528.         a = document.documentElement.clientWidth;
  529.         b = document.documentElement.clientHeight
  530.     } else {
  531.         if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
  532.             a = document.body.clientWidth;
  533.             b = document.body.clientHeight
  534.         } else {
  535.             if (typeof window.innerWidth == "number") {
  536.                 a = window.innerWidth;
  537.                 b = window.innerHeight
  538.             }
  539.         }
  540.     }
  541.     return {
  542.         w: a,
  543.         h: b
  544.     }
  545. }
  546.  
  547. function openDB_getScroll() {
  548.     var a = 0,
  549.         b = 0;
  550.     if (typeof(window.pageYOffset) == "number") {
  551.         a = window.pageXOffset;
  552.         b = window.pageYOffset
  553.     } else {
  554.         if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
  555.             a = document.body.scrollLeft;
  556.             b = document.body.scrollTop
  557.         } else {
  558.             if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
  559.                 a = document.documentElement.scrollLeft;
  560.                 b = document.documentElement.scrollTop
  561.             }
  562.         }
  563.     }
  564.     return {
  565.         x: a,
  566.         y: b
  567.     }
  568. }
  569.  
  570. function openDB_getCursorPos(c) {
  571.     var a, d;
  572.     if (window.innerHeight) {
  573.         a = c.pageX;
  574.         d = c.pageY
  575.     } else {
  576.         var b = openDB_getScroll();
  577.         a = c.clientX + b.x;
  578.         d = c.clientY + b.y
  579.     }
  580.     return {
  581.         x: a,
  582.         y: d
  583.     }
  584. }
  585.  
  586. function openDB_scrollTo(c, b) {
  587.     var l, k = openDB_getWindowSize(),
  588.         m = openDB_getScroll(),
  589.         i = k.w,
  590.         e = k.h,
  591.         g = m.x,
  592.         d = m.y;
  593.     c = $(c);
  594.     if (b == null) {
  595.         b = []
  596.     } else {
  597.         if (typeof b == "number") {
  598.             b = [b]
  599.         }
  600.     }
  601.     l = b.length;
  602.     if (l == 0) {
  603.         b[0] = b[1] = b[2] = b[3] = 0
  604.     } else {
  605.         if (l == 1) {
  606.             b[1] = b[2] = b[3] = b[0]
  607.         } else {
  608.             if (l == 2) {
  609.                 b[2] = b[0];
  610.                 b[3] = b[1]
  611.             } else {
  612.                 if (l == 3) {
  613.                     b[3] = b[1]
  614.                 }
  615.             }
  616.         }
  617.     }
  618.     l = ac(c);
  619.     var a = l[0] - b[3],
  620.         h = l[1] - b[0],
  621.         j = l[0] + c.offsetWidth + b[1],
  622.         f = l[1] + c.offsetHeight + b[2];
  623.     if (j - a > i || a < g) {
  624.         g = a
  625.     } else {
  626.         if (j - i > g) {
  627.             g = j - i
  628.         }
  629.     }
  630.     if (f - h > e || h < d) {
  631.         d = h
  632.     } else {
  633.         if (f - e > d) {
  634.             d = f - e
  635.         }
  636.     }
  637.     scrollTo(g, d)
  638. }
  639.  
  640. function openDB_setTextNodes(c, b) {
  641.     if (c.nodeType == 3) {
  642.         c.nodeValue = b
  643.     } else {
  644.         for (var a = 0; a < c.childNodes.length; ++a) {
  645.             openDB_setTextNodes(c.childNodes[a], b)
  646.         }
  647.     }
  648. }
  649.  
  650. function openDB_setInnerHtml(e, d, b) {
  651.     if (e.nodeName.toLowerCase() == b) {
  652.         e.innerHTML = d
  653.     } else {
  654.         for (var c = 0; c < e.childNodes.length; ++c) {
  655.             openDB_setInnerHtml(e.childNodes[c], d, b)
  656.         }
  657.     }
  658. }
  659.  
  660. function openDB_getTextContent(c) {
  661.     var a = "";
  662.     for (var b = 0; b < c.childNodes.length; ++b) {
  663.         if (c.childNodes[b].nodeValue) {
  664.             a += c.childNodes[b].nodeValue
  665.         } else {
  666.             if (c.childNodes[b].nodeName == "BR") {
  667.                 if (Browser.ie) {
  668.                     a += "\r"
  669.                 } else {
  670.                     a += "\n"
  671.                 }
  672.             }
  673.         }
  674.         a += openDB_getTextContent(c.childNodes[b])
  675.     }
  676.     return a
  677. }
  678.  
  679. function openDB_setSelectedLink(c, b) {
  680.     if (!openDB_setSelectedLink.groups) {
  681.         openDB_setSelectedLink.groups = {}
  682.     }
  683.     var a = openDB_setSelectedLink.groups;
  684.     if (a[b]) {
  685.         a[b].className = a[b].className.replace("selected", "")
  686.     }
  687.     c.className += " selected";
  688.     a[b] = c
  689. }
  690.  
  691. function openDB_toggleDisplay(a) {
  692.     if (a.style.display == "none") {
  693.         a.style.display = "";
  694.         return true
  695.     } else {
  696.         a.style.display = "none";
  697.         return false
  698.     }
  699. }
  700.  
  701. function openDB_enableScroll(a) {
  702.     if (!a) {
  703.         aE(document, "mousewheel", openDB_enableScroll.F);
  704.         aE(window, "DOMMouseScroll", openDB_enableScroll.F)
  705.     } else {
  706.         dE(document, "mousewheel", openDB_enableScroll.F);
  707.         dE(window, "DOMMouseScroll", openDB_enableScroll.F)
  708.     }
  709. }
  710. openDB_enableScroll.F = function(a) {
  711.     if (a.stopPropagation) {
  712.         a.stopPropagation()
  713.     }
  714.     if (a.preventDefault) {
  715.         a.preventDefault()
  716.     }
  717.     a.returnValue = false;
  718.     a.cancelBubble = true;
  719.     return false
  720. };
  721.  
  722. function openDB_getGets() {
  723.     if (openDB_getGets.C != null) {
  724.         return openDB_getGets.C
  725.     }
  726.     var e = {};
  727.     if (location.search) {
  728.         var f = decodeURIComponent(location.search.substr(1)).split("&");
  729.         for (var c = 0, a = f.length; c < a; ++c) {
  730.             var g = f[c].indexOf("="),
  731.                 b, d;
  732.             if (g != -1) {
  733.                 b = f[c].substr(0, g);
  734.                 d = f[c].substr(g + 1)
  735.             } else {
  736.                 b = f[c];
  737.                 d = ""
  738.             }
  739.             e[b] = d
  740.         }
  741.     }
  742.     openDB_getGets.C = e;
  743.     return e
  744. }
  745.  
  746. function openDB_createRect(d, c, a, b) {
  747.     return {
  748.         l: d,
  749.         t: c,
  750.         r: d + a,
  751.         b: c + b
  752.     }
  753. }
  754.  
  755. function openDB_intersectRect(d, c) {
  756.     return !(d.l >= c.r || c.l >= d.r || d.t >= c.b || c.t >= d.b)
  757. }
  758.  
  759. function openDB_createRange(c, a) {
  760.     range = {};
  761.     for (var b = c; b <= a; ++b) {
  762.         range[b] = b
  763.     }
  764.     return range
  765. }
  766.  
  767. function openDB_sortIdArray(a, b, c) {
  768.     a.sort(c ? function(e, d) {
  769.         return strcmp(b[e][c], b[d][c])
  770.     } : function(e, d) {
  771.         return strcmp(b[e], b[d])
  772.     })
  773. }
  774.  
  775. function openDB_sortJsonArray(e, d, f, a) {
  776.     var c = [];
  777.     for (var b in e) {
  778.         if (d[b] && (a == null || a(d[b]))) {
  779.             c.push(b)
  780.         }
  781.     }
  782.     if (f != null) {
  783.         c.sort(f)
  784.     } else {
  785.         openDB_sortIdArray(c, d)
  786.     }
  787.     return c
  788. }
  789.  
  790. function openDB_urlize(a, b) {
  791.     a = str_replace(a, "'", "");
  792.     a = trim(a);
  793.     if (b) {
  794.         a = str_replace(a, " ", "-")
  795.     } else {
  796.         a = a.replace(/[^a-z0-9]/i, "-")
  797.     }
  798.     a = str_replace(a, "--", "-");
  799.     a = str_replace(a, "--", "-");
  800.     a = rtrim(a, "-");
  801.     a = a.toLowerCase();
  802.     return a
  803. }
  804.  
  805. function openDB_getLocale(a) {
  806.     if (a && openDB_locale.id == 25) {
  807.         return 0
  808.     }
  809.     return openDB_locale.id
  810. }
  811.  
  812. function openDB_createReverseLookupJson(b) {
  813.     var c = {};
  814.     for (var a in b) {
  815.         c[b[a]] = a
  816.     }
  817.     return c
  818. }
  819.  
  820. function openDB_initHeader(c) {
  821.     var l = ce("dl"),
  822.         p = (c == 5);
  823.     for (var k = 0, m = mn_path.length; k < m; ++k) {
  824.         var g = ce("dt");
  825.         var q = ce("a");
  826.         var n = ce("ins");
  827.         var h = ce("big");
  828.         var f = ce("span");
  829.         var o = mn_path[k][0];
  830.         var j = (o == c);
  831.         var e = (!j && mn_path[k][3]);
  832.         if (p && o == 5) {
  833.             e = true;
  834.             mn_path[k][3] = mn_profiles
  835.         }
  836.         if (e) {
  837.             q.menu = mn_path[k][3];
  838.             q.onmouseover = Menu.show;
  839.             q.onmouseout = Menu.hide
  840.         } else {
  841.             q.onmouseover = Menu._hide
  842.         }
  843.         if (mn_path[k][2]) {
  844.             q.href = mn_path[k][2]
  845.         } else {
  846.             q.href = "javascript:;";
  847.             ns(q);
  848.             q.style.cursor = "default"
  849.         }
  850.         if (j) {
  851.             q.className = "selected"
  852.         }
  853.         ae(h, ct(mn_path[k][1].charAt(0)));
  854.         ae(n, h);
  855.         ae(n, ct(mn_path[k][1].substr(1)));
  856.         ae(q, n);
  857.         ae(q, f);
  858.         ae(g, q);
  859.         ae(l, g)
  860.     }
  861.     ae(ge("ptewhjkst46"), l);
  862.     var b = ge("kbl34h6b43");
  863.     if (c != null && c >= 0 && c < mn_path.length) {
  864.         switch (c) {
  865.             case 0:
  866.                 Menu.addButtons(b, Menu.explode(mn_database));
  867.                 break;
  868.             case 1:
  869.                 Menu.addButtons(b, mn_tools);
  870.                 break;
  871.             case 2:
  872.                 Menu.addButtons(b, Menu.explode(mn_more));
  873.                 break;
  874.             case 3:
  875.                 Menu.addButtons(b, Menu.explode(mn_forums));
  876.                 break;
  877.             case 5:
  878.                 pr_initTopBarSearch();
  879.                 break
  880.         }
  881.     } else {
  882.         ae(b, ct(String.fromCharCode(160)))
  883.     }
  884.     var r = ge("oh2345v5ks");
  885.     var s = r.previousSibling;
  886.     var d = r.parentNode;
  887.     ns(s);
  888.     s.onclick = function() {
  889.         this.parentNode.onsubmit()
  890.     };
  891.     if (Browser.ie) {
  892.         setTimeout(function() {
  893.             r.value = ""
  894.         }, 1)
  895.     }
  896.     if (r.value == "") {
  897.         r.className = "search-database"
  898.     }
  899.     r.onmouseover = function() {
  900.         if (trim(this.value) != "") {
  901.             this.className = ""
  902.         }
  903.     };
  904.     r.onfocus = function() {
  905.         this.className = ""
  906.     };
  907.     r.onblur = function() {
  908.         if (trim(this.value) == "") {
  909.             this.className = "search-database";
  910.             this.value = ""
  911.         }
  912.     };
  913.     d.onsubmit = function() {
  914.         var a = this.elements[0].value;
  915.         if (trim(a) == "") {
  916.             return false
  917.         }
  918.         this.submit()
  919.     }
  920. }
  921.  
  922. function openDB_getLoc(p, f) {
  923.     var h = mn_path,
  924.         c = null,
  925.         k = null,
  926.         o = 0,
  927.         l = ge("locBox"),
  928.         n = ce("div");
  929.     ee(l);
  930.     if (openDB_getLoc.lastIt) {
  931.         openDB_getLoc.lastIt.checked = null
  932.     }
  933.     n.className = "path";
  934.     if (f != null) {
  935.         var m = ce("div");
  936.         m.className = "path-right";
  937.         var q = ce("a");
  938.         q.href = "javascript:;";
  939.         q.id = "fi_toggle";
  940.         ns(q);
  941.         q.onclick = fi_toggle;
  942.         if (f) {
  943.             q.className = "disclosure-on";
  944.             ae(q, ct(LANG.fihide))
  945.         } else {
  946.             q.className = "disclosure-off";
  947.             ae(q, ct(LANG.fishow))
  948.         }
  949.         ae(m, q);
  950.         ae(l, m)
  951.     }
  952.     for (var g = 0; g < p.length; ++g) {
  953.         var q, b, r = 0;
  954.         for (var e = 0; e < h.length; ++e) {
  955.             if (h[e][0] == p[g]) {
  956.                 r = 1;
  957.                 h = h[e];
  958.                 h.checked = 1;
  959.                 break
  960.             }
  961.         }
  962.         if (!r) {
  963.             o = 1;
  964.             break
  965.         }
  966.         q = ce("a");
  967.         b = ce("span");
  968.         if (h[2]) {
  969.             q.href = h[2];
  970.             q.style.paddingLeft = "10px"
  971.         } else {
  972.             q.href = "javascript:;";
  973.             ns(q);
  974.             q.style.textDecoration = "none";
  975.             q.style.color = "white";
  976.             q.style.cursor = "default"
  977.         }
  978.         if (g < p.length - 1 && h[3]) {
  979.             b.className = "locArrow"
  980.         }
  981.         ae(q, ct(h[4] == null ? h[1] : h[4]));
  982.         if (g == 0) {
  983.             q.menu = mn_path
  984.         } else {
  985.             q.menu = c[3]
  986.         }
  987.         q.onmouseover = Menu.show;
  988.         q.onmouseout = Menu.hide;
  989.         ae(b, q);
  990.         ae(n, b);
  991.         k = b;
  992.         c = h;
  993.         h = h[3];
  994.         if (!h) {
  995.             o = 1;
  996.             break
  997.         }
  998.     }
  999.     if (o && k) {
  1000.         k.className = ""
  1001.     } else {
  1002.         if (c && c[3]) {
  1003.             k.className = "locArrow";
  1004.             q = ce("a");
  1005.             b = ce("span");
  1006.             q.href = "javascript:;";
  1007.             ns(q);
  1008.             q.style.textDecoration = "none";
  1009.             q.style.paddingLeft = "4px";
  1010.             q.style.color = "white";
  1011.             q.style.cursor = "default";
  1012.             ae(q, ct("..."));
  1013.             q.menu = c[3];
  1014.             q.onmouseover = Menu.show;
  1015.             q.onmouseout = Menu.hide;
  1016.             ae(b, q);
  1017.             ae(n, b)
  1018.         }
  1019.     }
  1020.     var m = ce("div");
  1021.     m.className = "clear";
  1022.     ae(n, m);
  1023.     ae(l, n);
  1024.     openDB_getLoc.lastIt = c
  1025. }
  1026.  
  1027. function openDB_formatTimeElapsed(e) {
  1028.     function c(m, l, i) {
  1029.         if (i && LANG.timeunitsab[l] == "") {
  1030.             i = 0
  1031.         }
  1032.         if (i) {
  1033.             return m + " " + LANG.timeunitsab[l]
  1034.         } else {
  1035.             return m + " " + (m == 1 ? LANG.timeunitssg[l] : LANG.timeunitspl[l])
  1036.         }
  1037.     }
  1038.     var g = [31557600, 2629800, 604800, 86400, 3600, 60, 1];
  1039.     var a = [1, 3, 3, -1, 5, -1, -1];
  1040.     e = Math.max(e, 1);
  1041.     for (var f = 3, h = g.length; f < h; ++f) {
  1042.         if (e >= g[f]) {
  1043.             var d = f;
  1044.             var k = Math.floor(e / g[d]);
  1045.             if (a[d] != -1) {
  1046.                 var b = a[d];
  1047.                 e %= g[d];
  1048.                 var j = Math.floor(e / g[b]);
  1049.                 if (j > 0) {
  1050.                     return c(k, d, 1) + " " + c(j, b, 1)
  1051.                 }
  1052.             }
  1053.             return c(k, d, 0)
  1054.         }
  1055.     }
  1056.     return "(n/a)"
  1057. }
  1058.  
  1059. function openDB_formatDateSimple(g, c) {
  1060.     function a(b) {
  1061.         return (b < 10 ? "0" + b : b)
  1062.     }
  1063.     var i = "",
  1064.         j = g.getDate(),
  1065.         f = g.getMonth() + 1,
  1066.         h = g.getFullYear();
  1067.     i += sprintf(LANG.date_simple, a(j), a(f), h);
  1068.     if (c == 1) {
  1069.         var k = g.getHours() + 1,
  1070.             e = g.getMinutes() + 1;
  1071.         i += LANG.date_at + a(k) + ":" + a(e)
  1072.     }
  1073.     return i
  1074. }
  1075.  
  1076. function openDB_cleanCharacterName(e) {
  1077.     var d = "";
  1078.     for (var c = 0, a = e.length; c < a; ++c) {
  1079.         var b = e.charAt(c).toLowerCase();
  1080.         if (b >= "a" && b <= "z") {
  1081.             d += b
  1082.         } else {
  1083.             d += e.charAt(c)
  1084.         }
  1085.     }
  1086.     return d
  1087. }
  1088.  
  1089. function openDB_createGlow(a, h) {
  1090.     var e = ce("span");
  1091.     for (var c = -1; c <= 1; ++c) {
  1092.         for (var b = -1; b <= 1; ++b) {
  1093.             var g = ce("div");
  1094.             g.style.position = "absolute";
  1095.             g.style.whiteSpace = "nowrap";
  1096.             g.style.left = c + "px";
  1097.             g.style.top = b + "px";
  1098.             if (c == 0 && b == 0) {
  1099.                 g.style.zIndex = 4
  1100.             } else {
  1101.                 g.style.color = "black";
  1102.                 g.style.zIndex = 2
  1103.             }
  1104.             ae(g, ct(a));
  1105.             ae(e, g)
  1106.         }
  1107.     }
  1108.     e.style.position = "relative";
  1109.     e.className = "glow" + (h != null ? " " + h : "");
  1110.     var f = ce("span");
  1111.     f.style.visibility = "hidden";
  1112.     ae(f, ct(a));
  1113.     ae(e, f);
  1114.     return e
  1115. }
  1116.  
  1117. function openDB_createProgressBar(c) {
  1118.     if (c == null) {
  1119.         c = {}
  1120.     }
  1121.     if (!c.text) {
  1122.         c.text = " "
  1123.     }
  1124.     if (c.color == null) {
  1125.         c.color = "rep0"
  1126.     }
  1127.     if (c.width == null) {
  1128.         c.width = 100
  1129.     }
  1130.     var d, e;
  1131.     if (c.hoverText) {
  1132.         d = ce("a");
  1133.         d.href = "javascript:;"
  1134.     } else {
  1135.         d = ce("span")
  1136.     }
  1137.     d.className = "progressbar";
  1138.     if (c.text || c.hoverText) {
  1139.         e = ce("div");
  1140.         e.className = "progressbar-text";
  1141.         if (c.text) {
  1142.             var a = ce("del");
  1143.             ae(a, ct(c.text));
  1144.             ae(e, a)
  1145.         }
  1146.         if (c.hoverText) {
  1147.             var b = ce("ins");
  1148.             ae(b, ct(c.hoverText));
  1149.             ae(e, b)
  1150.         }
  1151.         ae(d, e)
  1152.     }
  1153.     e = ce("div");
  1154.     e.className = "progressbar-" + c.color;
  1155.     e.style.width = c.width + "%";
  1156.     ae(e, ct(String.fromCharCode(160)));
  1157.     ae(d, e);
  1158.     return d
  1159. }
  1160.  
  1161. function openDB_createReputationBar(g) {
  1162.     var f = openDB_createReputationBar.P;
  1163.     if (!g) {
  1164.         g = 0
  1165.     }
  1166.     g += 42000;
  1167.     if (g < 0) {
  1168.         g = 0
  1169.     } else {
  1170.         if (g > 84999) {
  1171.             g = 84999
  1172.         }
  1173.     }
  1174.     var e = g,
  1175.         h, b = 0;
  1176.     for (var d = 0, a = f.length; d < a; ++d) {
  1177.         if (f[d] > e) {
  1178.             break
  1179.         }
  1180.         if (d < a - 1) {
  1181.             e -= f[d];
  1182.             b = d + 1
  1183.         }
  1184.     }
  1185.     h = f[b];
  1186.     var c = {
  1187.         text: openDB_reputation_standings[b],
  1188.         hoverText: e + " / " + h,
  1189.         color: "rep" + b,
  1190.         width: parseInt(e / h * 100)
  1191.     };
  1192.     return openDB_createProgressBar(c)
  1193. }
  1194. openDB_createReputationBar.P = [36000, 3000, 3000, 3000, 6000, 12000, 21000, 999];
  1195.  
  1196. function openDB_createAchievementBar(a, c) {
  1197.     if (!a) {
  1198.         a = 0
  1199.     }
  1200.     var b = {
  1201.         text: a + (c > 0 ? " / " + c : ""),
  1202.         color: (c > 700 ? "rep7" : "ach" + (c > 0 ? 0 : 1)),
  1203.         width: (c > 0 ? parseInt(a / c * 100) : 100)
  1204.     };
  1205.     return openDB_createProgressBar(b)
  1206. }
  1207.  
  1208. function openDB_createCaptcha(c) {
  1209.     var b = ce("a");
  1210.     b.href = "javascript:;";
  1211.     b.className = "captcha";
  1212.     b.title = LANG.tooltip_captcha;
  1213.     if (c & 1) {
  1214.         b.style.marginLeft = b.style.marginRight = "auto"
  1215.     }
  1216.     if (Browser.ie6) {
  1217.         var d = ce("img");
  1218.         d.src = "captcha&foo=" + Math.random();
  1219.         ae(b, d);
  1220.         b.onclick = function() {
  1221.             de(this.firstChild);
  1222.             var a = ce("img");
  1223.             a.src = "captcha&foo=" + Math.random();
  1224.             ae(b, a);
  1225.             this.blur()
  1226.         }
  1227.     } else {
  1228.         b.style.backgroundImage = "url(captcha&foo=" + Math.random() + ")";
  1229.         b.onclick = function() {
  1230.             this.style.backgroundImage = "url(captcha&foo=" + Math.random() + ")"
  1231.         }
  1232.     }
  1233.     return b
  1234. }
  1235.  
  1236. function openDB_revealCaptcha(a) {}
  1237.  
  1238. function openDB_convertRatingToPercent(g, b, f, d) {
  1239.     var e = {
  1240.         12: 1.5,
  1241.         13: 12,
  1242.         14: 15,
  1243.         15: 5,
  1244.         16: 10,
  1245.         17: 10,
  1246.         18: 8,
  1247.         19: 14,
  1248.         20: 14,
  1249.         21: 14,
  1250.         22: 10,
  1251.         23: 10,
  1252.         24: 0,
  1253.         25: 0,
  1254.         26: 0,
  1255.         27: 0,
  1256.         28: 10,
  1257.         29: 10,
  1258.         30: 10,
  1259.         31: 10,
  1260.         32: 14,
  1261.         33: 0,
  1262.         34: 0,
  1263.         35: 25,
  1264.         36: 10,
  1265.         37: 2.5,
  1266.         44: 3.756097412109376
  1267.     };
  1268.     if (g < 0) {
  1269.         g = 1
  1270.     } else {
  1271.         if (g > 80) {
  1272.             g = 80
  1273.         }
  1274.     }
  1275.     if ((b == 14 || b == 12 || b == 15) && g < 34) {
  1276.         g = 34
  1277.     }
  1278.     if ((b == 28 || b == 36) && (d == 2 || d == 6 || d == 7 || d == 11)) {
  1279.         e[b] /= 1.3
  1280.     }
  1281.     if (f < 0) {
  1282.         f = 0
  1283.     }
  1284.     var a;
  1285.     if (e[b] == null) {
  1286.         a = 0
  1287.     } else {
  1288.         var c;
  1289.         if (g > 70) {
  1290.             c = (82 / 52) * Math.pow((131 / 63), ((g - 70) / 10))
  1291.         } else {
  1292.             if (g > 60) {
  1293.                 c = (82 / (262 - 3 * g))
  1294.             } else {
  1295.                 if (g > 10) {
  1296.                     c = ((g - 8) / 52)
  1297.                 } else {
  1298.                     c = 2 / 52
  1299.                 }
  1300.             }
  1301.         }
  1302.         a = f / e[b] / c
  1303.     }
  1304.     return a
  1305. }
  1306.  
  1307. function openDB_setRatingLevel(f, e, b, c) {
  1308.     var d = prompt(sprintf(LANG.prompt_ratinglevel, 1, 80), e);
  1309.     if (d != null) {
  1310.         d |= 0;
  1311.         if (d != e && d >= 1 && d <= 80) {
  1312.             e = d;
  1313.             var a = openDB_convertRatingToPercent(e, b, c);
  1314.             a = (Math.round(a * 100) / 100);
  1315.             if (b != 12 && b != 37) {
  1316.                 a += "%"
  1317.             }
  1318.             f.innerHTML = sprintf(LANG.tooltip_combatrating, a, e);
  1319.             f.onclick = openDB_setRatingLevel.bind(0, f, e, b, c)
  1320.         }
  1321.     }
  1322. }
  1323.  
  1324. function openDB_getMoneyHtml(c) {
  1325.     var b = 0,
  1326.         a = "";
  1327.     if (c >= 10000) {
  1328.         b = 1;
  1329.         a += '<span class="moneygold">' + Math.floor(c / 10000) + '</span>';
  1330.         c %= 10000
  1331.     }
  1332.     if (c >= 100) {
  1333.         if (b) {
  1334.             a += " "
  1335.         } else {
  1336.             b = 1
  1337.         }
  1338.         a += '<span class="moneysilver">' + Math.floor(c / 100) + "</span>";
  1339.         c %= 100
  1340.     }
  1341.     if (c >= 1) {
  1342.         if (b) {
  1343.             a += " "
  1344.         } else {
  1345.             b = 1
  1346.         }
  1347.         a += '<span class="moneycopper">' + c + "</span>"
  1348.     }
  1349.     return a
  1350. }
  1351.  
  1352. function openDB_getPatchVersion(e) {
  1353.     var d = openDB_getPatchVersion;
  1354.     var b = 0,
  1355.         c = d.T.length - 2,
  1356.         a;
  1357.     while (c > b) {
  1358.         a = Math.floor((c + b) / 2);
  1359.         if (e >= d.T[a] && e < d.T[a + 1]) {
  1360.             return d.V[a]
  1361.         }
  1362.         if (e >= d.T[a]) {
  1363.             b = a + 1
  1364.         } else {
  1365.             c = a - 1
  1366.         }
  1367.     }
  1368.     a = Math.ceil((c + b) / 2);
  1369.     return d.V[a]
  1370. }
  1371. openDB_getPatchVersion.V = ["1.12.0", "1.12.1", "1.12.2", "2.0.1", "2.0.3", "2.0.4", "2.0.5", "2.0.6", "2.0.7", "2.0.8", "2.0.10", "2.0.12", "2.1.0", "2.1.1", "2.1.2", "2.1.3", "2.2.0", "2.2.2", "2.2.3", "2.3.0", "2.3.2", "2.3.3", "2.4.0", "2.4.1", "2.4.2", "2.4.3", "3.0.2", "3.0.3", "3.0.8", "3.0.9", "3.1.0", "3.1.1", "3.1.2", "3.1.3", "???"];
  1372. openDB_getPatchVersion.T = [1153540800000, 1159243200000, 1160712000000, 1165294800000, 1168318800000, 1168578000000, 1168750800000, 1169528400000, 1171342800000, 1171602000000, 1173157200000, 1175572800000, 1179806400000, 1181016000000, 1182225600000, 1184040000000, 1190692800000, 1191297600000, 1191902400000, 1194930000000, 1199768400000, 1200978000000, 1206417600000, 1207022400000, 1210651200000, 1216094400000, 1223956800000, 1225774800000, 1232427600000, 1234242000000, 1239681600000, 1240286400000, 1242705600000, 1243915200000, 9999999999999];
  1373.  
  1374. function openDB_expandSite() {
  1375.     ge("wrapper").className = "nosidebar";
  1376.     var a = ge("topbar-expand");
  1377.     if (a) {
  1378.         de(a)
  1379.     }
  1380.     a = ge("sidebar");
  1381.     if (a) {
  1382.         de(a)
  1383.     }
  1384. }
  1385.  
  1386. function openDB_insertTag(d, a, i, j) {
  1387.     var b = $(d);
  1388.     b.focus();
  1389.     if (b.selectionStart != null) {
  1390.         var l = b.selectionStart,
  1391.             h = b.selectionEnd,
  1392.             k = b.scrollLeft,
  1393.             c = b.scrollTop;
  1394.         var g = b.value.substring(l, h);
  1395.         if (typeof j == "function") {
  1396.             g = j(g)
  1397.         }
  1398.         b.value = b.value.substr(0, l) + a + g + i + b.value.substr(h);
  1399.         b.selectionStart = b.selectionEnd = h + a.length;
  1400.         b.scrollLeft = k;
  1401.         b.scrollTop = c
  1402.     } else {
  1403.         if (document.selection && document.selection.createRange) {
  1404.             var f = document.selection.createRange();
  1405.             if (f.parentElement() != b) {
  1406.                 return
  1407.             }
  1408.             var g = f.text;
  1409.             if (typeof j == "function") {
  1410.                 g = j(g)
  1411.             }
  1412.             f.text = a + g + i
  1413.         }
  1414.     }
  1415.     if (b.onkeyup) {
  1416.         b.onkeyup()
  1417.     }
  1418. }
  1419.  
  1420. function openDB_getLocaleFromDomain(a) {
  1421.     var c = openDB_getLocaleFromDomain.L;
  1422.     if (a) {
  1423.         var b = a.indexOf(".");
  1424.         if (b != -1) {
  1425.             a = a.substring(0, b)
  1426.         }
  1427.     }
  1428.     return (c[a] ? c[a] : 0)
  1429. }
  1430. openDB_getLocaleFromDomain.L = {
  1431.     fr: 2,
  1432.     de: 3,
  1433.     es: 6,
  1434.     ru: 7,
  1435.     ptr: 25
  1436. };
  1437.  
  1438. function openDB_getDomainFromLocale(a) {
  1439.     var b;
  1440.     if (openDB_getDomainFromLocale.L) {
  1441.         b = openDB_getDomainFromLocale.L
  1442.     } else {
  1443.         b = openDB_getDomainFromLocale.L = openDB_createReverseLookupJson(openDB_getLocaleFromDomain.L)
  1444.     }
  1445.     return (b[a] ? b[a] : "www")
  1446. }
  1447.  
  1448. function openDB_getIdFromTypeName(a) {
  1449.     var b = openDB_getIdFromTypeName.L;
  1450.     return (b[a] ? b[a] : -1)
  1451. }
  1452. openDB_getIdFromTypeName.L = {
  1453.     npc: 1,
  1454.     object: 2,
  1455.     item: 3,
  1456.     itemset: 4,
  1457.     quest: 5,
  1458.     spell: 6,
  1459.     zone: 7,
  1460.     faction: 8,
  1461.     pet: 9,
  1462.     achievement: 10,
  1463.     profile: 100
  1464. };
  1465.  
  1466. function openDB_IngameLink(b, d, c) {
  1467.     prompt(LANG.message_ingamelink, '/script DEFAULT_CHAT_FRAME:AddMessage("\\124c' + b + "\\124H" + d + "\\124h[" + c + ']\\124h\\124r");')
  1468. }
  1469.  
  1470. function openDB_isEmailValid(a) {
  1471.     return a.match(/^([a-z0-9._-]+)(\+[a-z0-9._-]+)?(@[a-z0-9.-]+\.[a-z]{2,4})$/i) != null
  1472. }
  1473.  
  1474. function openDB_onAfterTyping(a, d, c) {
  1475.     var e;
  1476.     var b = function() {
  1477.         if (e) {
  1478.             clearTimeout(e);
  1479.             e = null
  1480.         }
  1481.         e = setTimeout(d, c)
  1482.     };
  1483.     a.onkeyup = b
  1484. }
  1485.  
  1486. function openDB_onClick(c, d) {
  1487.     var b = 0;
  1488.  
  1489.     function a(e) {
  1490.         if (b) {
  1491.             if (b != e) {
  1492.                 return
  1493.             }
  1494.         } else {
  1495.             b = e
  1496.         }
  1497.         d(true)
  1498.     }
  1499.     c.oncontextmenu = function() {
  1500.         a(1);
  1501.         return false
  1502.     };
  1503.     c.onmouseup = function(f) {
  1504.         f = $E(f);
  1505.         if (f._button == 3 || f.shiftKey || f.ctrlKey) {
  1506.             a(2)
  1507.         } else {
  1508.             if (f._button == 1) {
  1509.                 d(false)
  1510.             }
  1511.         }
  1512.         return false
  1513.     }
  1514. }
  1515.  
  1516. function openDB_createOrRegex(c) {
  1517.     var e = c.split(" "),
  1518.         d = "";
  1519.     for (var b = 0, a = e.length; b < a; ++b) {
  1520.         if (b > 0) {
  1521.             d += "|"
  1522.         }
  1523.         d += e[b]
  1524.     }
  1525.     return new RegExp("(" + d + ")", "gi")
  1526. }
  1527.  
  1528. function openDB_addPages(l, b) {
  1529.     function o(q, d) {
  1530.         var i;
  1531.         if (q == b.page) {
  1532.             i = ce("span");
  1533.             i.className = "selected"
  1534.         } else {
  1535.             i = ce("a");
  1536.             i.href = (q > 1 ? b.url + b.sep + q + b.pound : b.url + b.pound)
  1537.         }
  1538.         ae(i, ct(d != null ? d : q));
  1539.         return i
  1540.     }
  1541.     if (!b.pound) {
  1542.         b.pound = ""
  1543.     }
  1544.     if (!b.sep) {
  1545.         b.sep = "."
  1546.     }
  1547.     if (b.allOrNothing && b.nPages <= 1) {
  1548.         return
  1549.     }
  1550.     var c = (b.align && b.align == "left");
  1551.     var e = ce("div"),
  1552.         k, p = ce("var");
  1553.     e.className = "pages";
  1554.     if (c) {
  1555.         e.className += " pages-left"
  1556.     }
  1557.     if (b.nPages > 1) {
  1558.         k = ce("div");
  1559.         k.className = "pages-numbers";
  1560.         var n = Math.max(2, b.page - 3);
  1561.         var h = Math.min(b.nPages - 1, b.page + 3);
  1562.         var m = [];
  1563.         if (b.page != b.nPages) {
  1564.             m.push(o(b.page + 1, LANG.lvpage_next + String.fromCharCode(8250)))
  1565.         }
  1566.         m.push(o(b.nPages));
  1567.         if (h < b.nPages - 1) {
  1568.             var a = ce("span");
  1569.             ae(a, ct("..."));
  1570.             m.push(a)
  1571.         }
  1572.         for (var g = h; g >= n; --g) {
  1573.             m.push(o(g))
  1574.         }
  1575.         if (n > 2) {
  1576.             var a = ce("span");
  1577.             ae(a, ct("..."));
  1578.             m.push(a)
  1579.         }
  1580.         m.push(o(1));
  1581.         if (b.page != 1) {
  1582.             m.push(o(b.page - 1, String.fromCharCode(8249) + LANG.lvpage_previous))
  1583.         }
  1584.         if (c) {
  1585.             m.reverse()
  1586.         }
  1587.         for (var g = 0, j = m.length; g < j; ++g) {
  1588.             ae(k, m[g])
  1589.         }
  1590.         k.firstChild.style.marginRight = "0";
  1591.         k.lastChild.style.marginLeft = "0"
  1592.     }
  1593.     var p = ce("var");
  1594.     ae(p, ct(sprintf(LANG[b.wording[b.nItems == 1 ? 0 : 1]], b.nItems)));
  1595.     if (b.nPages > 1) {
  1596.         var a = ce("span");
  1597.         ae(a, ct(String.fromCharCode(8211)));
  1598.         ae(p, a);
  1599.         var f = ce("a");
  1600.         f.className = "gotopage";
  1601.         f.href = "javascript:;";
  1602.         ns(f);
  1603.         if (Browser.ie) {
  1604.             ae(f, ct(" "))
  1605.         }
  1606.         f.onclick = function() {
  1607.             var d = prompt(sprintf(LANG.prompt_gotopage, 1, b.nPages), b.page);
  1608.             if (d != null) {
  1609.                 d |= 0;
  1610.                 if (d != b.page && d >= 1 && d <= b.nPages) {
  1611.                     document.location.href = (d > 1 ? b.url + b.sep + d + b.pound : b.url + b.pound)
  1612.                 }
  1613.             }
  1614.         };
  1615.         f.onmouseover = function(d) {
  1616.             Tooltip.showAtCursor(d, LANG.tooltip_gotopage, 0, 0, "q")
  1617.         };
  1618.         f.onmousemove = Tooltip.cursorUpdate;
  1619.         f.onmouseout = Tooltip.hide;
  1620.         ae(p, f)
  1621.     }
  1622.     if (c) {
  1623.         ae(e, p);
  1624.         if (k) {
  1625.             ae(e, k)
  1626.         }
  1627.     } else {
  1628.         if (k) {
  1629.             ae(e, k)
  1630.         }
  1631.         ae(e, p)
  1632.     }
  1633.     ae(l, e)
  1634. }
  1635.  
  1636. function openDB_disclose(a, b) {
  1637.     b.className = "disclosure-" + (openDB_toggleDisplay(a) ? "on" : "off");
  1638.     return false
  1639. }
  1640.  
  1641. function co_addYourComment() {
  1642.     tabsContribute.focus(0);
  1643.     var a = gE(document.forms.addcomment, "textarea")[0];
  1644.     a.focus()
  1645. }
  1646.  
  1647. function co_cancelReply() {
  1648.     ge("replybox-generic").style.display = "none";
  1649.     document.forms.addcomment.elements.replyto.value = ""
  1650. }
  1651.  
  1652. function co_validateForm(b) {
  1653.     var a = gE(b, "textarea")[0];
  1654.     if (Listview.funcBox.coValidate(a)) {
  1655.         if (openDB_user.permissions & 1) {
  1656.             return true
  1657.         }
  1658.         return true
  1659.     }
  1660.     return false
  1661. }
  1662.  
  1663. function ss_submitAScreenshot() {
  1664.     tabsContribute.focus(1)
  1665. }
  1666.  
  1667. function ss_validateForm(a) {
  1668.     if (!a.elements.screenshotfile.value.length) {
  1669.         alert(LANG.message_noscreenshot);
  1670.         return false
  1671.     }
  1672.     return true
  1673. }
  1674.  
  1675. function ss_appendSticky() {
  1676.     var m = ge("infobox-sticky");
  1677.     var i = openDB_pageInfo.type;
  1678.     var h = openDB_pageInfo.typeId;
  1679.     var k = in_array(lv_screenshots, 1, function(a) {
  1680.         return a.sticky
  1681.     });
  1682.     if (k != -1) {
  1683.         var c = lv_screenshots[k];
  1684.         var l = ce("a");
  1685.         l.href = "#screenshots:id=" + c.id;
  1686.         l.onclick = function(a) {
  1687.             ScreenshotViewer.show({
  1688.                 screenshots: lv_screenshots,
  1689.                 pos: k
  1690.             });
  1691.             return rf2(a)
  1692.         };
  1693.         var f = ce("img"),
  1694.             e = Math.min(150 / c.width, 150 / c.height);
  1695.         f.src = "/upload/thumb/" + k.file;
  1696.         f.className = "border";
  1697.         ae(l, f);
  1698.         ae(m, l);
  1699.         var g = ce("div");
  1700.         var n = ce("small");
  1701.         l = ce("a");
  1702.         if (openDB_user.id > 0) {
  1703.             l.href = "javascript:;";
  1704.             l.onclick = ss_submitAScreenshot
  1705.         } else {
  1706.             l.href = "account=signin"
  1707.         }
  1708.         ae(l, ct(LANG.infobox_submitone));
  1709.         ae(n, l);
  1710.         ae(n, ct(" " + String.fromCharCode(160)));
  1711.         var j = ce("b");
  1712.         ae(j, ct("|"));
  1713.         ae(n, j);
  1714.         ae(n, ct(String.fromCharCode(160) + " "));
  1715.         l = ce("a");
  1716.         l.href = "javascript:;";
  1717.         l.onclick = function() {
  1718.             tabsRelated.focus(-1);
  1719.             return false
  1720.         };
  1721.         ae(l, ct(sprintf(LANG.infobox_showall, lv_screenshots.length)));
  1722.         ae(n, l);
  1723.         ae(g, n);
  1724.         ae(m, g)
  1725.     } else {
  1726.         var l;
  1727.         if (openDB_user.id > 0) {
  1728.             l = '<a href="javascript:;" onclick="ss_submitAScreenshot(); return false">'
  1729.         } else {
  1730.             l = '<a href="account=signin">'
  1731.         }
  1732.         m.innerHTML = sprintf(LANG.infobox_noneyet, l + LANG.infobox_submitone + "</a>")
  1733.     }
  1734. }
  1735.  
  1736. function su_addToSaved(b, a) {
  1737.     if (!b) {
  1738.         return
  1739.     }
  1740.     var d = gc("compare_groups"),
  1741.         c = "compare";
  1742.     if (!d || confirm(LANG.confirm_addtosaved)) {
  1743.         if (d) {
  1744.             b = d + ";" + b
  1745.         }
  1746.         sc("compare_groups", 20, b, "/", ".openwow.com")
  1747.     } else {
  1748.         c += "=" + b
  1749.     }
  1750.     if (a) {
  1751.         window.open(c)
  1752.     } else {
  1753.         location.href = c
  1754.     }
  1755. }
  1756.  
  1757. function Ajax(b, c) {
  1758.     if (!b) {
  1759.         return
  1760.     }
  1761.     var a;
  1762.     try {
  1763.         a = new XMLHttpRequest()
  1764.     } catch (d) {
  1765.         try {
  1766.             a = new ActiveXObject("Msxml2.XMLHTTP")
  1767.         } catch (d) {
  1768.             try {
  1769.                 a = new ActiveXObject("Microsoft.XMLHTTP")
  1770.             } catch (d) {
  1771.                 if (window.createRequest) {
  1772.                     a = window.createRequest()
  1773.                 } else {
  1774.                     alert(LANG.message_ajaxnotsupported);
  1775.                     return
  1776.                 }
  1777.             }
  1778.         }
  1779.     }
  1780.     this.request = a;
  1781.     cO(this, c);
  1782.     this.method = this.method || (this.params && "POST") || "GET";
  1783.     a.open(this.method, b, this.async == null ? true : this.async);
  1784.     a.onreadystatechange = Ajax.onReadyStateChange.bind(this);
  1785.     if (this.method.toUpperCase() == "POST") {
  1786.         a.setRequestHeader("Content-Type", (this.contentType || "application/x-www-form-urlencoded") + "; charset=" + (this.encoding || "UTF-8"))
  1787.     }
  1788.     a.send(this.params)
  1789. }
  1790. Ajax.onReadyStateChange = function() {
  1791.     if (this.request.readyState == 4) {
  1792.         if (this.request.status == 0 || (this.request.status >= 200 && this.request.status < 300)) {
  1793.             this.onSuccess != null && this.onSuccess(this.request, this)
  1794.         } else {
  1795.             this.onFailure != null && this.onFailure(this.request, this)
  1796.         }
  1797.         if (this.onComplete != null) {
  1798.             this.onComplete(this.request, this)
  1799.         }
  1800.     }
  1801. };
  1802.  
  1803. function openDB_ajaxIshRequest(b) {
  1804.     var c = document.getElementsByTagName("head")[0],
  1805.         a = openDB_getGets();
  1806.     if (a.refresh != null) {
  1807.         b += "&refresh"
  1808.     }
  1809.     ae(c, ce("script", {
  1810.         type: "text/javascript",
  1811.         src: b
  1812.     }))
  1813. }
  1814. var Menu = {
  1815.     iframes: [],
  1816.     divs: [],
  1817.     selection: [],
  1818.     show: function() {
  1819.         try {
  1820.             clearTimeout(Menu.timer);
  1821.             if (Menu.currentLink) {
  1822.                 Menu._show(this)
  1823.             } else {
  1824.                 if (this.className.indexOf("open") == -1) {
  1825.                     this.className += " open"
  1826.                 }
  1827.                 Menu.timer = setTimeout(Menu._show.bind(0, this), 100)
  1828.             }
  1829.         } catch (a) {}
  1830.     },
  1831.     _show: function(b) {
  1832.         if (Menu.currentLink != b) {
  1833.             var a = ac(b);
  1834.             Menu._hide();
  1835.             Menu.selection = [-1];
  1836.             Menu.currentLink = b;
  1837.             Menu.showDepth(0, b.menu, a[0], a[1] + b.offsetHeight + 1, b.offsetHeight + 8, b.offsetWidth, a[1], false);
  1838.             if (b.className.indexOf("open") == -1) {
  1839.                 b.className += " open"
  1840.             }
  1841.         } else {
  1842.             Menu.truncate(0);
  1843.             Menu.clean(0)
  1844.         }
  1845.     },
  1846.     showAtCursor: function(b, a, d) {
  1847.         clearTimeout(Menu.timer);
  1848.         Menu._hide();
  1849.         Menu.selection = [-1];
  1850.         Menu.currentLink = null;
  1851.         if (!(a && d)) {
  1852.             b = $E(b);
  1853.             var c = openDB_getCursorPos(b);
  1854.             a = c.x;
  1855.             d = c.y
  1856.         }
  1857.         if (Browser.ie6) {
  1858.             a -= 2;
  1859.             d -= 2
  1860.         }
  1861.         Menu.showDepth(0, this.menu, a, d, 0, 0, 0, true)
  1862.     },
  1863.     hide: function() {
  1864.         try {
  1865.             clearTimeout(Menu.timer);
  1866.             if (Menu.currentLink) {
  1867.                 Menu.timer = setTimeout(Menu._hide, 333)
  1868.             } else {
  1869.                 this.className = this.className.replace("open", "")
  1870.             }
  1871.         } catch (a) {}
  1872.     },
  1873.     _hide: function() {
  1874.         for (var b = 0, a = Menu.selection.length; b < a; ++b) {
  1875.             Menu.divs[b].style.display = "none";
  1876.             Menu.divs[b].style.visibility = "hidden";
  1877.             if (Browser.ie6) {
  1878.                 Menu.iframes[b].style.display = "none"
  1879.             }
  1880.         }
  1881.         Menu.selection = [];
  1882.         if (Menu.currentLink) {
  1883.             Menu.currentLink.className = Menu.currentLink.className.replace("open", "")
  1884.         }
  1885.         Menu.currentLink = null
  1886.     },
  1887.     sepOver: function() {
  1888.         var b = this.d;
  1889.         var a = b.i;
  1890.         Menu.truncate(a);
  1891.         Menu.clean(a);
  1892.         Menu.selection[a] = -1
  1893.     },
  1894.     elemOver: function() {
  1895.         var g = this.d;
  1896.         var f = g.i;
  1897.         var e = this.i;
  1898.         var a = this.k;
  1899.         var b = this.firstChild.className == "menusub";
  1900.         Menu.truncate(f + b);
  1901.         if (b && a != Menu.selection[f]) {
  1902.             var h = ac(this);
  1903.             Menu.selection[f + 1] = -1;
  1904.             Menu.showDepth(f + 1, g.menuArray[e][3], h[0], h[1] - 2, this.offsetHeight, this.offsetWidth - 3, 0, false)
  1905.         }
  1906.         Menu.clean(f);
  1907.         Menu.selection[f] = a;
  1908.         if (this.className.length) {
  1909.             this.className += " open"
  1910.         } else {
  1911.             this.className = "open"
  1912.         }
  1913.     },
  1914.     elemClick: function(a) {
  1915.         Menu._hide();
  1916.         a()
  1917.     },
  1918.     getIframe: function(a) {
  1919.         var b;
  1920.         if (Menu.iframes[a] == null) {
  1921.             b = ce("iframe");
  1922.             b.src = "javascript:0;";
  1923.             b.frameBorder = 0;
  1924.             ae(ge("layers"), b);
  1925.             Menu.iframes[a] = b
  1926.         } else {
  1927.             b = Menu.iframes[a]
  1928.         }
  1929.         return b
  1930.     },
  1931.     getDiv: function(a, b) {
  1932.         var c;
  1933.         if (Menu.divs[a] == null) {
  1934.             c = ce("div");
  1935.             c.className = "menu";
  1936.             ae(ge("layers"), c);
  1937.             Menu.divs[a] = c
  1938.         } else {
  1939.             c = Menu.divs[a]
  1940.         }
  1941.         c.i = a;
  1942.         c.menuArray = b;
  1943.         return c
  1944.     },
  1945.     showDepth: function(M, c, C, B, N, F, z, v) {
  1946.         var W, T = Menu.getDiv(M, c);
  1947.         while (T.firstChild) {
  1948.             de(T.firstChild)
  1949.         }
  1950.         var u = ce("table"),
  1951.             A = ce("tbody"),
  1952.             R = ce("tr"),
  1953.             e = ce("td"),
  1954.             P = ce("div"),
  1955.             J = ce("div");
  1956.         var I = 999;
  1957.         var b = openDB_getWindowSize(),
  1958.             l = openDB_getScroll(),
  1959.             f = b.w,
  1960.             n = b.h,
  1961.             V = l.x,
  1962.             O = l.y;
  1963.         if (N > 0 && (M > 0 || c.length > 20)) {
  1964.             if ((25 + 1) * c.length > n - 25 - z) {
  1965.                 for (var L = 2; L < 4; ++L) {
  1966.                     if (N / L * c.length + 30 < n - z) {
  1967.                         break
  1968.                     }
  1969.                 }
  1970.                 I = Math.floor(c.length / L)
  1971.             }
  1972.         }
  1973.         var r = 0;
  1974.         var K = 0;
  1975.         for (var L = 0, t = c.length; L < t; ++L) {
  1976.             var Q = c[L];
  1977.             if (Q[0] == null) {
  1978.                 var q = ce("span");
  1979.                 q.className = "separator";
  1980.                 ns(q);
  1981.                 ae(q, ct(Q[1]));
  1982.                 q.d = T;
  1983.                 q.onmouseover = Menu.sepOver;
  1984.                 ae(J, q)
  1985.             } else {
  1986.                 var U = ce("a");
  1987.                 U.d = T;
  1988.                 U.k = K++;
  1989.                 U.i = L;
  1990.                 if (Q[2]) {
  1991.                     if (Menu.currentLink && Menu.currentLink.menuappend) {
  1992.                         if (Q[2].indexOf(Menu.currentLink.menuappend) == -1) {
  1993.                             U.href = Q[2] + Menu.currentLink.menuappend
  1994.                         } else {
  1995.                             U.href = Q[2]
  1996.                         }
  1997.                     } else {
  1998.                         if (typeof Q[2] == "function") {
  1999.                             U.href = "javascript:;";
  2000.                             U.onclick = Menu.elemClick.bind(0, Q[2]);
  2001.                             ns(U)
  2002.                         } else {
  2003.                             U.href = Q[2]
  2004.                         }
  2005.                     }
  2006.                 } else {
  2007.                     U.href = "javascript:;";
  2008.                     U.style.cursor = "default";
  2009.                     ns(U)
  2010.                 }
  2011.                 U.onmouseover = Menu.elemOver;
  2012.                 var G = ce("span"),
  2013.                     S = ce("span");
  2014.                 if (Q[3] != null) {
  2015.                     G.className = "menusub"
  2016.                 }
  2017.                 if (Q.checked) {
  2018.                     S.className = "menucheck"
  2019.                 }
  2020.                 if (Q.newWindow) {
  2021.                     U.target = "_blank"
  2022.                 }
  2023.                 if (Q.className != null) {
  2024.                     G.className = Q.className
  2025.                 }
  2026.                 if (Q.tinyIcon) {
  2027.                     S.style.background = "url(http://cdn.openwow.com/" + qsUrl + "/icons/small/" + Q.tinyIcon.toLowerCase() + ".jpg) left center no-repeat"
  2028.                 } else {
  2029.                     if (Q.socketColor) {
  2030.                         S.className += " socket-" + openDB_file_gems[Q.socketColor]
  2031.                     } else {
  2032.                         if (Q.smallIcon) {
  2033.                             U.style.padding = 0;
  2034.                             S.style.padding = "4px 18px 4px 28px";
  2035.                             S.style.background = "url(http://cdn.openwow.com/images/icon_border_small.gif) left center no-repeat transparent";
  2036.                             G.style.background = "url(http://cdn.openwow.com/" + qsUrl + "/icons/small/" + Q.smallIcon.toLowerCase() + ".jpg) 4px 3px no-repeat transparent"
  2037.                         }
  2038.                     }
  2039.                 }
  2040.                 ae(S, ct(Q[1]));
  2041.                 ae(G, S);
  2042.                 ae(U, G);
  2043.                 ae(J, U)
  2044.             }
  2045.             if (r++ == I) {
  2046.                 P.onmouseover = Menu.divOver;
  2047.                 P.onmouseout = Menu.divOut;
  2048.                 ae(P, J);
  2049.                 if (!Browser.ie6) {
  2050.                     var H = ce("p");
  2051.                     ae(H, ce("em"));
  2052.                     ae(H, ce("var"));
  2053.                     ae(H, ce("strong"));
  2054.                     ae(H, P);
  2055.                     ae(e, H)
  2056.                 } else {
  2057.                     ae(e, P)
  2058.                 }
  2059.                 ae(R, e);
  2060.                 e = ce("td");
  2061.                 H = ce("p");
  2062.                 P = ce("div");
  2063.                 J = ce("div");
  2064.                 r = 0
  2065.             }
  2066.         }
  2067.         P.onmouseover = Menu.divOver;
  2068.         P.onmouseout = Menu.divOut;
  2069.         ae(P, J);
  2070.         if (!Browser.ie6) {
  2071.             if (I != 999) {
  2072.                 var H = ce("p");
  2073.                 ae(H, ce("em"));
  2074.                 ae(H, ce("var"));
  2075.                 ae(H, ce("strong"));
  2076.                 ae(H, P);
  2077.                 ae(e, H)
  2078.             } else {
  2079.                 ae(T, ce("em"));
  2080.                 ae(T, ce("var"));
  2081.                 ae(T, ce("strong"));
  2082.                 ae(e, P)
  2083.             }
  2084.         } else {
  2085.             ae(e, P)
  2086.         }
  2087.         ae(R, e);
  2088.         ae(A, R);
  2089.         ae(u, A);
  2090.         ae(T, u);
  2091.         T.style.left = T.style.top = "-2323px";
  2092.         T.style.display = "";
  2093.         var g = u.offsetWidth,
  2094.             o = u.offsetHeight,
  2095.             E = true,
  2096.             D = true;
  2097.         if (!Browser.ie6) {
  2098.             g += 5;
  2099.             o += 6
  2100.         }
  2101.         if (C + g > f + V || c.rightAligned) {
  2102.             E = false
  2103.         }
  2104.         if (E) {
  2105.             if (C + F + g > f) {
  2106.                 C = Math.max(0, C - g)
  2107.             } else {
  2108.                 if (M > 0) {
  2109.                     C += F
  2110.                 }
  2111.             }
  2112.         } else {
  2113.             C = C + F - g;
  2114.             if (Browser.ie) {
  2115.                 C -= 3
  2116.             }
  2117.         }
  2118.         if ((M > 0 || v) && B + o > n + O) {
  2119.             B = Math.max(O + 5, n + O - o)
  2120.         }
  2121.         T.style.left = C + "px";
  2122.         T.style.top = B + "px";
  2123.         if (Browser.ie6) {
  2124.             W = Menu.getIframe(M);
  2125.             W.style.left = C + "px";
  2126.             W.style.top = B + "px";
  2127.             W.style.width = g + "px";
  2128.             W.style.height = o + "px";
  2129.             W.style.display = "";
  2130.             W.style.visibility = "visible"
  2131.         }
  2132.         T.style.visibility = "visible";
  2133.         if (Browser.opera) {
  2134.             T.style.display = "none";
  2135.             T.style.display = ""
  2136.         }
  2137.     },
  2138.     divOver: function() {
  2139.         clearTimeout(Menu.timer)
  2140.     },
  2141.     divOut: function() {
  2142.         clearTimeout(Menu.timer);
  2143.         Menu.timer = setTimeout(Menu._hide, 333)
  2144.     },
  2145.     truncate: function(b) {
  2146.         var c;
  2147.         while (Menu.selection.length - 1 > b) {
  2148.             c = Menu.selection.length - 1;
  2149.             Menu.divs[c].style.display = "none";
  2150.             Menu.divs[c].style.visibility = "hidden";
  2151.             if (Browser.ie6) {
  2152.                 Menu.iframes[c].style.display = "none"
  2153.             }
  2154.             Menu.selection.pop()
  2155.         }
  2156.     },
  2157.     clean: function(b) {
  2158.         for (var c = b; c < Menu.selection.length; ++c) {
  2159.             if (Menu.selection[c] != -1) {
  2160.                 var e = gE(Menu.divs[c], "a")[Menu.selection[c]];
  2161.                 if (e.className.indexOf("sub") != -1) {
  2162.                     e.className = "sub"
  2163.                 } else {
  2164.                     e.className = ""
  2165.                 }
  2166.                 Menu.selection[c] = -1
  2167.             }
  2168.         }
  2169.     },
  2170.     append: function(b, c) {
  2171.         b[2] += c;
  2172.         if (b[3] != null) {
  2173.             Menu._append(b[3], c)
  2174.         }
  2175.     },
  2176.     _append: function(b, d) {
  2177.         var e, g = 0;
  2178.         for (var c = 0; c < b.length; ++c) {
  2179.             var f = b[c][2].indexOf("&filter=");
  2180.             if (f != -1 && d.indexOf("&filter=") == 0) {
  2181.                 d = Menu._fixCollision(b[c][2].substr(f), d)
  2182.             }
  2183.             b[c][2] += d;
  2184.             if (b[c][3]) {
  2185.                 Menu._append(b[c][3], d)
  2186.             }
  2187.         }
  2188.     },
  2189.     _splitFilter: function(b) {
  2190.         var g = b.substr(8).split(";"),
  2191.             c = {};
  2192.         for (var e = 0, a = g.length; e < a; ++e) {
  2193.             var h = g[e].indexOf("="),
  2194.                 d, f;
  2195.             if (h != -1) {
  2196.                 d = g[e].substr(0, h);
  2197.                 f = g[e].substr(h + 1)
  2198.             } else {
  2199.                 d = g[e];
  2200.                 f = ""
  2201.             }
  2202.             c[d] = f
  2203.         }
  2204.         return c
  2205.     },
  2206.     _fixCollision: function(d, a) {
  2207.         var b = Menu._splitFilter(d),
  2208.             c = Menu._splitFilter(a);
  2209.         a = "";
  2210.         for (var e in c) {
  2211.             if (!b[e] && e != "sl" && e != "cl") {
  2212.                 a += ";";
  2213.                 a += e + "=" + c[e]
  2214.             }
  2215.         }
  2216.         return a
  2217.     },
  2218.     fixUrls: function(g, c, e, b, f) {
  2219.         if (!f) {
  2220.             f = 0
  2221.         }
  2222.         for (var d = 0, a = g.length; d < a; ++d) {
  2223.             if (g[d][2] == null) {
  2224.                 g[d][2] = c + g[d][0] + (e ? e : "")
  2225.             }
  2226.             if (g[d][3]) {
  2227.                 if (b == true || (typeof b == "object" && b[f] == true)) {
  2228.                     Menu.fixUrls(g[d][3], c, e, b, f + 1)
  2229.                 } else {
  2230.                     Menu.fixUrls(g[d][3], c + g[d][0] + ".", e, b, f + 1)
  2231.                 }
  2232.             }
  2233.         }
  2234.     },
  2235.     addButtons: function(h, g) {
  2236.         for (var e = 0, b = g.length; e < b; ++e) {
  2237.             if (g[e][0] == null) {
  2238.                 continue
  2239.             }
  2240.             var c = ce("a"),
  2241.                 f = ce("span");
  2242.             if (g[e][2]) {
  2243.                 c.href = g[e][2]
  2244.             } else {
  2245.                 c.href = "javascript:;";
  2246.                 c.style.cursor = "default";
  2247.                 c.style.textDecoration = "none";
  2248.                 ns(c)
  2249.             }
  2250.             if (g[e][3] != null) {
  2251.                 c.menu = g[e][3];
  2252.                 c.onmouseover = Menu.show;
  2253.                 c.onmouseout = Menu.hide
  2254.             } else {
  2255.                 c.onmouseover = Menu._hide
  2256.             }
  2257.             ae(f, ct(g[e][1]));
  2258.             ae(c, f);
  2259.             ae(h, c)
  2260.         }
  2261.     },
  2262.     explode: function(f) {
  2263.         var d = [],
  2264.             e = null,
  2265.             c;
  2266.         for (var b = 0, a = f.length; b < a; ++b) {
  2267.             if (f[b][0] != null) {
  2268.                 if (e != null) {
  2269.                     c.push(f[b])
  2270.                 } else {
  2271.                     d.push(f[b])
  2272.                 }
  2273.             }
  2274.             if (e != null && (f[b][0] == null || b == a - 1)) {
  2275.                 d.push([0, e[1], , c])
  2276.             }
  2277.             if (f[b][0] == null) {
  2278.                 e = f[b];
  2279.                 c = []
  2280.             }
  2281.         }
  2282.         return d
  2283.     }
  2284. };
  2285.  
  2286. function Tabs(a) {
  2287.     cO(this, a);
  2288.     if (this.parent) {
  2289.         this.parent = $(this.parent)
  2290.     } else {
  2291.         return
  2292.     }
  2293.     this.oldMode = (Browser.geckoVersion > 20000000 && Browser.geckoVersion <= 20060414);
  2294.     this.selectedTab = -1;
  2295.     this.uls = [];
  2296.     this.tabs = [];
  2297.     this.nShows = 0;
  2298.     if (this.poundable == null) {
  2299.         this.poundable = 1
  2300.     }
  2301.     this.poundedTab = null;
  2302.     if (this.onLoad == null) {
  2303.         this.onLoad = Tabs.onLoad.bind(this)
  2304.     }
  2305.     if (this.onShow == null) {
  2306.         this.onShow = Tabs.onShow.bind(this)
  2307.     }
  2308.     if (this.onHide) {
  2309.         this.onHide = this.onHide.bind(this)
  2310.     }
  2311. }
  2312. Tabs.prototype = {
  2313.     add: function(a, d) {
  2314.         var c, b = this.tabs.length;
  2315.         c = {
  2316.             caption: a,
  2317.             index: b,
  2318.             owner: this
  2319.         };
  2320.         cO(c, d);
  2321.         this.tabs.push(c);
  2322.         return b
  2323.     },
  2324.     del: function(a) {
  2325.         if (this.tabs[a]) {
  2326.             ge("tab-" + this.tabs[a].id).style.display = "none";
  2327.             this.selectedTab = -1;
  2328.             this.uls = [];
  2329.             this.tabs.splice(a, 1);
  2330.             this.nShows = 0;
  2331.             while (this.parent.firstChild) {
  2332.                 de(this.parent.firstChild)
  2333.             }
  2334.             this.flush()
  2335.         }
  2336.     },
  2337.     focus: function(a) {
  2338.         if (a < 0) {
  2339.             a = this.tabs.length + a
  2340.         }
  2341.         this.forceScroll = 1;
  2342.         gE(this.uls[this.oldMode ? 0 : 2], "a")[a].onclick({}, true);
  2343.         this.forceScroll = null
  2344.     },
  2345.     show: function(c, e) {
  2346.         var b;
  2347.         if (isNaN(c) || c < 0) {
  2348.             c = 0
  2349.         } else {
  2350.             if (c >= this.tabs.length) {
  2351.                 c = this.tabs.length - 1
  2352.             }
  2353.         }
  2354.         if (e == null && c == this.selectedTab) {
  2355.             return
  2356.         }
  2357.         if (this.selectedTab != -1) {
  2358.             b = this.tabs[this.selectedTab];
  2359.             if (this.onHide && !this.onHide(b)) {
  2360.                 return
  2361.             }
  2362.             if (b.onHide && !b.onHide()) {
  2363.                 return
  2364.             }
  2365.         }++this.nShows;
  2366.         var a = this.oldMode ? 0 : 3;
  2367.         for (var d = 0; d <= a; ++d) {
  2368.             b = gE(this.uls[d], "a");
  2369.             if (this.selectedTab != -1) {
  2370.                 b[this.selectedTab].className = ""
  2371.             }
  2372.             if (b[c] != null && b[c] != undefined) {
  2373.                 b[c].className = "selected"
  2374.             } else {
  2375.                 $j(".iclistingW").hide();
  2376.                 break
  2377.             }
  2378.         }
  2379.         b = this.tabs[c];
  2380.         if (b.onLoad) {
  2381.             b.onLoad();
  2382.             b.onLoad = null
  2383.         }
  2384.         this.onShow(this.tabs[c], this.tabs[this.selectedTab]);
  2385.         if (b.onShow) {
  2386.             b.onShow(this.tabs[this.selectedTab])
  2387.         }
  2388.         this.selectedTab = c
  2389.     },
  2390.     flush: function(p) {
  2391.         if (this.oldMode) {
  2392.             var m, s, e, r;
  2393.             m = ce("ul");
  2394.             m.className = "old-tabs";
  2395.             for (var k = 0; k < this.tabs.length; ++k) {
  2396.                 var f = this.tabs[k];
  2397.                 s = ce("li");
  2398.                 e = ce("div");
  2399.                 r = ce("a");
  2400.                 if (this.poundable) {
  2401.                     r.href = "#" + f.id
  2402.                 } else {
  2403.                     r.href = "javascript:;"
  2404.                 }
  2405.                 ns(r);
  2406.                 r.onclick = Tabs.onClick.bind(f, r);
  2407.                 ae(r, ct(f.caption));
  2408.                 ae(s, e);
  2409.                 ae(s, r);
  2410.                 ae(m, s)
  2411.             }
  2412.             this.uls[0] = m;
  2413.             ae(this.parent, m);
  2414.             var t = ce("div");
  2415.             t.style.cssFloat = t.style.styleFloat = "left";
  2416.             ae(this.parent, t)
  2417.         } else {
  2418.             var t, g, r, q, o, c;
  2419.             var n = ce("div");
  2420.             n.className = "tabs-container";
  2421.             o = ce("div");
  2422.             o.style.visibility = "hidden";
  2423.             this.uls[0] = ce("ul");
  2424.             this.uls[0].className = "tabs";
  2425.             ae(o, this.uls[0]);
  2426.             ae(n, o);
  2427.             o = ce("div");
  2428.             o.className = "tabs-levels";
  2429.             for (var k = 1; k <= 3; ++k) {
  2430.                 c = ce("div");
  2431.                 c.className = "tabs-level";
  2432.                 this.uls[k] = ce("ul");
  2433.                 this.uls[k].className = "tabs";
  2434.                 this.uls[k].style.top = (-30 * (3 - k)) + "px";
  2435.                 ae(c, this.uls[k]);
  2436.                 ae(o, c)
  2437.             }
  2438.             ae(n, o);
  2439.             for (var k = 0; k < this.tabs.length; ++k) {
  2440.                 var f = this.tabs[k];
  2441.                 for (var h = 0; h <= 3; ++h) {
  2442.                     g = ce("li");
  2443.                     r = ce("a");
  2444.                     q = ce("b");
  2445.                     if (this.poundable) {
  2446.                         r.href = "#" + f.id
  2447.                     } else {
  2448.                         r.href = "javascript:;"
  2449.                     }
  2450.                     if (h > 0) {
  2451.                         ns(r);
  2452.                         r.onclick = Tabs.onClick.bind(f, r)
  2453.                     }
  2454.                     if (!Browser.ie6) {
  2455.                         o = ce("div");
  2456.                         ae(o, ct(f.caption));
  2457.                         ae(r, o)
  2458.                     }
  2459.                     ae(q, ct(f.caption));
  2460.                     ae(r, q);
  2461.                     ae(g, r);
  2462.                     ae(this.uls[h], g)
  2463.                 }
  2464.             }
  2465.             ae(this.parent, n)
  2466.         }
  2467.         if (this.onLoad) {
  2468.             t = this.onLoad();
  2469.             if (t != null) {
  2470.                 this.poundedTab = p = t
  2471.             }
  2472.         }
  2473.         this.show(p)
  2474.     },
  2475.     setTabName: function(d, c) {
  2476.         var a = this.oldMode ? 0 : 3;
  2477.         this.tabs[d].caption = c;
  2478.         for (var e = 0; e <= a; ++e) {
  2479.             var b = gE(this.uls[e], "a");
  2480.             openDB_setTextNodes(b[d], c)
  2481.         }
  2482.     },
  2483.     setTabPound: function(d, a) {
  2484.         if (!this.poundable) {
  2485.             return
  2486.         }
  2487.         var b = this.oldMode ? 0 : 3;
  2488.         for (var e = 0; e <= b; ++e) {
  2489.             var c = gE(this.uls[e], "a");
  2490.             c[d].href = "#" + this.tabs[d].id + ":" + a
  2491.         }
  2492.     },
  2493.     getSelectedTab: function() {
  2494.         return this.selectedTab
  2495.     }
  2496. };
  2497. Tabs.onClick = function(b, g, f) {
  2498.     if (f == null && this.index == this.owner.selectedTab) {
  2499.         return
  2500.     }
  2501.     var d = rf2(g);
  2502.     if (d == null) {
  2503.         return
  2504.     }
  2505.     this.owner.show(this.index, f);
  2506.     if (this.owner.poundable) {
  2507.         var c = b.href.indexOf("#");
  2508.         c != -1 && location.replace(b.href.substr(c))
  2509.     }
  2510.     return d
  2511. };
  2512. Tabs.onLoad = function() {
  2513.     if (!this.poundable || !location.hash.length) {
  2514.         return
  2515.     }
  2516.     var a = location.hash.substr(1).split(":")[0];
  2517.     if (a) {
  2518.         return in_array(this.tabs, a, function(b) {
  2519.             return b.id
  2520.         })
  2521.     }
  2522. };
  2523. Tabs.onShow = function(d, e) {
  2524.     var b;
  2525.     if (e) {
  2526.         ge("tab-" + e.id).style.display = "none"
  2527.     }
  2528.     b = ge("tab-" + d.id);
  2529.     b.style.display = "";
  2530.     if ((this.nShows == 1 && this.poundedTab != null && this.poundedTab >= 0) || this.forceScroll) {
  2531.         var c, a;
  2532.         if (this.__st) {
  2533.             c = this.__st;
  2534.             a = 15
  2535.         } else {
  2536.             c = b;
  2537.             a = this.parent.offsetHeight + 15
  2538.         }
  2539.         if (Browser.ie) {
  2540.             setTimeout(openDB_scrollTo.bind(this, c, a), 1)
  2541.         } else {
  2542.             openDB_scrollTo(c, a)
  2543.         }
  2544.     }
  2545. };
  2546. var Icon = {
  2547.     sizes: ["small", "medium", "large"],
  2548.     sizes2: [18, 36, 56],
  2549.     create: function(c, k, h, b, e, j) {
  2550.         var g = ce("div"),
  2551.             d = ce("ins"),
  2552.             f = ce("del");
  2553.         if (k == null) {
  2554.             k = 1
  2555.         }
  2556.         g.className = "icon" + Icon.sizes[k];
  2557.         ae(g, d);
  2558.         ae(g, f);
  2559.         Icon.setTexture(g, k, c);
  2560.         if (b) {
  2561.             var i = ce("a");
  2562.             i.href = b;
  2563.             ae(g, i)
  2564.         } else {
  2565.             g.ondblclick = Icon.onDblClick
  2566.         }
  2567.         Icon.setNumQty(g, e, j);
  2568.         return g
  2569.     },
  2570.     setTexture: function(d, c, b) {
  2571.         if (!b) {
  2572.             return
  2573.         }
  2574.         var a = d.firstChild.style;
  2575.         if (b.indexOf("?") != -1) {
  2576.             a.backgroundImage = "url(" + b + ")"
  2577.         } else {
  2578.             a.backgroundImage = "url(http://cdn.openwow.com/" + qsUrl + "/icons/" + Icon.sizes[c] + "/" + b.toLowerCase() + ".jpg)"
  2579.         }
  2580.         Icon.moveTexture(d, c, 0, 0)
  2581.     },
  2582.     moveTexture: function(d, c, a, e) {
  2583.         var b = d.firstChild.style;
  2584.         if (a || e) {
  2585.             b.backgroundPosition = (-a * Icon.sizes2[c]) + "px " + (-e * Icon.sizes2[c]) + "px"
  2586.         } else {
  2587.             if (b.backgroundPosition) {
  2588.                 b.backgroundPosition = ""
  2589.             }
  2590.         }
  2591.     },
  2592.     setNumQty: function(e, c, f) {
  2593.         var b = gE(e, "span");
  2594.         for (var d = 0, a = b.length; d < a; ++d) {
  2595.             if (b[d]) {
  2596.                 de(b[d])
  2597.             }
  2598.         }
  2599.         if (c != null && ((c > 1 && c < 2147483647) || c.length)) {
  2600.             b = openDB_createGlow(c, "q1");
  2601.             b.style.right = "0";
  2602.             b.style.bottom = "0";
  2603.             b.style.position = "absolute";
  2604.             ae(e, b)
  2605.         }
  2606.         if (f != null && f > 0) {
  2607.             b = openDB_createGlow("(" + f + ")", "q");
  2608.             b.style.left = "0";
  2609.             b.style.top = "0";
  2610.             b.style.position = "absolute";
  2611.             ae(e, b)
  2612.         }
  2613.     },
  2614.     getLink: function(a) {
  2615.         return gE(a, "a")[0]
  2616.     },
  2617.     onDblClick: function() {
  2618.         if (this.firstChild) {
  2619.             var b = this.firstChild.style;
  2620.             if (b.backgroundImage.length && b.backgroundImage.indexOf("url(http://openwow.com") == 0) {
  2621.                 var c = b.backgroundImage.lastIndexOf("/"),
  2622.                     a = b.backgroundImage.indexOf(".jpg");
  2623.                 if (c != -1 && a != -1) {
  2624.                     prompt("", b.backgroundImage.substring(c + 1, a))
  2625.                 }
  2626.             }
  2627.         }
  2628.     }
  2629. };
  2630. var Tooltip = {
  2631.     create: function(h) {
  2632.         var f = ce("div"),
  2633.             k = ce("table"),
  2634.             b = ce("tbody"),
  2635.             e = ce("tr"),
  2636.             c = ce("tr"),
  2637.             a = ce("td"),
  2638.             j = ce("th"),
  2639.             i = ce("th"),
  2640.             g = ce("th");
  2641.         f.className = "tooltip";
  2642.         j.style.backgroundPosition = "top right";
  2643.         i.style.backgroundPosition = "bottom left";
  2644.         g.style.backgroundPosition = "bottom right";
  2645.         if (h) {
  2646.             a.innerHTML = h
  2647.         }
  2648.         ae(e, a);
  2649.         ae(e, j);
  2650.         ae(b, e);
  2651.         ae(c, i);
  2652.         ae(c, g);
  2653.         ae(b, c);
  2654.         ae(k, b);
  2655.         Tooltip.icon = ce("p");
  2656.         Tooltip.icon.style.visibility = "hidden";
  2657.         ae(Tooltip.icon, ce("div"));
  2658.         ae(f, Tooltip.icon);
  2659.         ae(f, k);
  2660.         return f
  2661.     },
  2662.     fix: function(d, b, f) {
  2663.         var e = gE(d, "table")[0],
  2664.             h = gE(e, "td")[0],
  2665.             g = h.childNodes;
  2666.         if (g.length >= 2 && g[0].nodeName == "TABLE" && g[1].nodeName == "TABLE") {
  2667.             g[0].style.whiteSpace = "nowrap";
  2668.             var a;
  2669.             if (g[1].offsetWidth > 300) {
  2670.                 a = Math.max(300, g[0].offsetWidth) + 20
  2671.             } else {
  2672.                 a = Math.max(g[0].offsetWidth, g[1].offsetWidth) + 20
  2673.             }
  2674.             if (a > 20) {
  2675.                 d.style.width = a + "px";
  2676.                 g[0].style.width = g[1].style.width = "100%";
  2677.                 if (!b && d.offsetHeight > document.body.clientHeight) {
  2678.                     e.className = "shrink"
  2679.                 }
  2680.             }
  2681.         }
  2682.         if (f) {
  2683.             d.style.visibility = "visible"
  2684.         }
  2685.     },
  2686.     fixSafe: function(c, b, a) {
  2687.         if (Browser.ie) {
  2688.             setTimeout(Tooltip.fix.bind(this, c, b, a), 1)
  2689.         } else {
  2690.             Tooltip.fix(c, b, a)
  2691.         }
  2692.     },
  2693.     append: function(c, b) {
  2694.         var c = $(c);
  2695.         var a = Tooltip.create(b);
  2696.         ae(c, a);
  2697.         Tooltip.fixSafe(a, 1, 1)
  2698.     },
  2699.     prepare: function() {
  2700.         if (Tooltip.tooltip) {
  2701.             return
  2702.         }
  2703.         var b = Tooltip.create();
  2704.         b.style.position = "absolute";
  2705.         b.style.left = b.style.top = "-2323px";
  2706.         var a = ge("layers");
  2707.         ae(a, b);
  2708.         Tooltip.tooltip = b;
  2709.         Tooltip.tooltipTable = gE(b, "table")[0];
  2710.         Tooltip.tooltipTd = gE(b, "td")[0];
  2711.         if (Browser.ie6) {
  2712.             b = ce("iframe");
  2713.             b.src = "javascript:0;";
  2714.             b.frameBorder = 0;
  2715.             ae(a, b);
  2716.             Tooltip.iframe = b
  2717.         }
  2718.     },
  2719.     set: function(b) {
  2720.         var a = Tooltip.tooltip;
  2721.         a.style.width = "550px";
  2722.         a.style.left = "-2323px";
  2723.         a.style.top = "-2323px";
  2724.         Tooltip.tooltipTd.innerHTML = b;
  2725.         a.style.display = "";
  2726.         Tooltip.fix(a, 0, 0)
  2727.     },
  2728.     moveTests: [
  2729.         [null, null],
  2730.         [null, false],
  2731.         [false, null],
  2732.         [false, false]
  2733.     ],
  2734.     move: function(m, l, d, n, c, a) {
  2735.         if (!Tooltip.tooltipTable) {
  2736.             return
  2737.         }
  2738.         var k = Tooltip.tooltip,
  2739.             g = Tooltip.tooltipTable.offsetWidth,
  2740.             b = Tooltip.tooltipTable.offsetHeight,
  2741.             o;
  2742.         k.style.width = g + "px";
  2743.         var j, e;
  2744.         for (var f = 0, h = Tooltip.moveTests.length; f < h; ++f) {
  2745.             o = Tooltip.moveTests[f];
  2746.             j = Tooltip.moveTest(m, l, d, n, c, a, o[0], o[1]);
  2747.             e = true;
  2748.             break
  2749.         }
  2750.         k.style.left = j.l + "px";
  2751.         k.style.top = j.t + "px";
  2752.         k.style.visibility = "visible";
  2753.         if (Browser.ie6 && Tooltip.iframe) {
  2754.             var o = Tooltip.iframe;
  2755.             o.style.left = j.l + "px";
  2756.             o.style.top = j.t + "px";
  2757.             o.style.width = g + "px";
  2758.             o.style.height = b + "px";
  2759.             o.style.display = "";
  2760.             o.style.visibility = "visible"
  2761.         }
  2762.     },
  2763.     moveTest: function(e, l, n, w, c, a, m, b) {
  2764.         var k = e,
  2765.             v = l,
  2766.             f = Tooltip.tooltip,
  2767.             i = Tooltip.tooltipTable.offsetWidth,
  2768.             p = Tooltip.tooltipTable.offsetHeight,
  2769.             g = openDB_getWindowSize(),
  2770.             j = openDB_getScroll(),
  2771.             h = g.w,
  2772.             o = g.h,
  2773.             d = j.x,
  2774.             u = j.y,
  2775.             t = d,
  2776.             s = u,
  2777.             r = d + h,
  2778.             q = u + o;
  2779.         if (m == null) {
  2780.             m = (e + n + i <= r)
  2781.         }
  2782.         if (b == null) {
  2783.             b = (l - p >= s)
  2784.         }
  2785.         if (m) {
  2786.             e += n + c
  2787.         } else {
  2788.             e = Math.max(e - i, t) - c
  2789.         }
  2790.         if (b) {
  2791.             l -= p + a
  2792.         } else {
  2793.             l += w + a
  2794.         }
  2795.         if (e < t) {
  2796.             e = t
  2797.         } else {
  2798.             if (e + i > r) {
  2799.                 e = r - i
  2800.             }
  2801.         }
  2802.         if (l < s) {
  2803.             l = s
  2804.         } else {
  2805.             if (l + p > q) {
  2806.                 l = Math.max(u, q - p)
  2807.             }
  2808.         }
  2809.         if (Tooltip.iconVisible) {
  2810.             if (k >= e - 48 && k <= e && v >= l - 4 && v <= l + 48) {
  2811.                 l -= 48 - (v - l)
  2812.             }
  2813.         }
  2814.         return openDB_createRect(e, l, i, p)
  2815.     },
  2816.     show: function(f, e, d, b, c) {
  2817.         if (Tooltip.disabled) {
  2818.             return
  2819.         }
  2820.         if (!d || d < 1) {
  2821.             d = 1
  2822.         }
  2823.         if (!b || b < 1) {
  2824.             b = 1
  2825.         }
  2826.         if (c) {
  2827.             e = '<span class="' + c + '">' + e + "</span>"
  2828.         }
  2829.         var a = ac(f);
  2830.         Tooltip.prepare();
  2831.         Tooltip.set(e);
  2832.         Tooltip.move(a.x, a.y, f.offsetWidth, f.offsetHeight, d, b)
  2833.     },
  2834.     showAtCursor: function(d, f, c, a, b) {
  2835.         if (Tooltip.disabled) {
  2836.             return
  2837.         }
  2838.         if (!c || c < 10) {
  2839.             c = 10
  2840.         }
  2841.         if (!a || a < 10) {
  2842.             a = 10
  2843.         }
  2844.         if (b) {
  2845.             f = '<span class="' + b + '">' + f + "</span>"
  2846.         }
  2847.         d = $E(d);
  2848.         var g = openDB_getCursorPos(d);
  2849.         Tooltip.prepare();
  2850.         Tooltip.set(f);
  2851.         Tooltip.move(g.x, g.y, 0, 0, c, a)
  2852.     },
  2853.     showAtXY: function(d, a, e, c, b) {
  2854.         if (Tooltip.disabled) {
  2855.             return
  2856.         }
  2857.         Tooltip.prepare();
  2858.         Tooltip.set(d);
  2859.         Tooltip.move(a, e, 0, 0, c, b)
  2860.     },
  2861.     cursorUpdate: function(b, a, d) {
  2862.         if (Tooltip.disabled || !Tooltip.tooltip) {
  2863.             return
  2864.         }
  2865.         b = $E(b);
  2866.         if (!a || a < 10) {
  2867.             a = 10
  2868.         }
  2869.         if (!d || d < 10) {
  2870.             d = 10
  2871.         }
  2872.         var c = openDB_getCursorPos(b);
  2873.         Tooltip.move(c.x, c.y, 0, 0, a, d)
  2874.     },
  2875.     hide: function() {
  2876.         if (Tooltip.tooltip) {
  2877.             Tooltip.tooltip.style.display = "none";
  2878.             Tooltip.tooltip.visibility = "hidden";
  2879.             Tooltip.tooltipTable.className = "";
  2880.             if (Browser.ie6) {
  2881.                 Tooltip.iframe.style.display = "none"
  2882.             }
  2883.             Tooltip.setIcon(null)
  2884.         }
  2885.     },
  2886.     setIcon: function(a) {
  2887.         Tooltip.prepare();
  2888.         if (a) {
  2889.             Tooltip.icon.style.backgroundImage = "url(http://cdn.openwow.com/" + qsUrl + "/icons/medium/" + a.toLowerCase() + ".jpg)";
  2890.             Tooltip.icon.style.visibility = "visible"
  2891.         } else {
  2892.             Tooltip.icon.style.backgroundImage = "none";
  2893.             Tooltip.icon.style.visibility = "hidden"
  2894.         }
  2895.         Tooltip.iconVisible = a ? 1 : 0
  2896.     }
  2897. };
  2898. var openDB_listviews = {};
  2899.  
  2900. function Listview(a) {
  2901.     cO(this, a);
  2902.     if (this.id) {
  2903.         var m = (this.tabs ? "tab-" : "lv-") + this.id;
  2904.         if (this.parent) {
  2905.             var k = ce("div");
  2906.             k.id = m;
  2907.             ae($(this.parent), k);
  2908.             this.container = k
  2909.         } else {
  2910.             this.container = ge(m)
  2911.         }
  2912.     } else {
  2913.         return
  2914.     }
  2915.     if (this.template && Listview.templates[this.template]) {
  2916.         this.template = Listview.templates[this.template]
  2917.     } else {
  2918.         return
  2919.     }
  2920.     openDB_listviews[this.id] = this;
  2921.     if (this.data == null) {
  2922.         this.data = []
  2923.     }
  2924.     if (this.poundable == null) {
  2925.         if (this.template.poundable != null) {
  2926.             this.poundable = this.template.poundable
  2927.         } else {
  2928.             this.poundable = true
  2929.         }
  2930.     }
  2931.     if (this.searchable == null) {
  2932.         if (this.template.searchable != null) {
  2933.             this.searchable = this.template.searchable
  2934.         } else {
  2935.             this.searchable = false
  2936.         }
  2937.     }
  2938.     if (this.filtrable == null) {
  2939.         if (this.template.filtrable != null) {
  2940.             this.filtrable = this.template.filtrable
  2941.         } else {
  2942.             this.filtrable = false
  2943.         }
  2944.     }
  2945.     if (this.data.length == 1) {
  2946.         this.filtrable = false;
  2947.         this.searchable = false
  2948.     }
  2949.     if (this.searchable && this.searchDelay == null) {
  2950.         if (this.template.searchDelay != null) {
  2951.             this.searchDelay = this.template.searchDelay
  2952.         } else {
  2953.             this.searchDelay = 333
  2954.         }
  2955.     }
  2956.     if (this.hideBands == null) {
  2957.         this.hideBands = this.template.hideBands
  2958.     }
  2959.     if (this.hideNav == null) {
  2960.         this.hideNav = this.template.hideNav
  2961.     }
  2962.     if (this.hideHeader == null) {
  2963.         this.hideHeader = this.template.hideHeader
  2964.     }
  2965.     if (this.hideCount == null) {
  2966.         this.hideCount = this.template.hideCount
  2967.     }
  2968.     if (this.computeDataFunc == null && this.template.computeDataFunc != null) {
  2969.         this.computeDataFunc = this.template.computeDataFunc
  2970.     }
  2971.     if (this.createCbControls == null && this.template.createCbControls != null) {
  2972.         this.createCbControls = this.template.createCbControls
  2973.     }
  2974.     if (this.template.onBeforeCreate != null) {
  2975.         if (this.onBeforeCreate == null) {
  2976.             this.onBeforeCreate = this.template.onBeforeCreate
  2977.         } else {
  2978.             this.onBeforeCreate = [this.template.onBeforeCreate, this.onBeforeCreate]
  2979.         }
  2980.     }
  2981.     if (this.onAfterCreate == null && this.template.onAfterCreate != null) {
  2982.         this.onAfterCreate = this.template.onAfterCreate
  2983.     }
  2984.     if (this.createNote == null && this.template.createNote != null) {
  2985.         this.createNote = this.template.createNote
  2986.     }
  2987.     if (this.customFilter == null && this.template.customFilter != null) {
  2988.         this.customFilter = this.template.customFilter
  2989.     }
  2990.     if (this.customFilter) {
  2991.         this.customFilter = this.customFilter.bind(this)
  2992.     }
  2993.     if (this.clip == null && this.template.clip != null) {
  2994.         this.clip = this.template.clip
  2995.     }
  2996.     if (this.mode == null) {
  2997.         this.mode = this.template.mode
  2998.     }
  2999.     if (this.nItemsPerPage == null) {
  3000.         if (this.template.nItemsPerPage != null) {
  3001.             this.nItemsPerPage = this.template.nItemsPerPage
  3002.         } else {
  3003.             this.nItemsPerPage = 50
  3004.         }
  3005.     }
  3006.     this.nItemsPerPage |= 0;
  3007.     if (this.nItemsPerPage <= 0) {
  3008.         this.nItemsPerPage = 0
  3009.     }
  3010.     this.nFilters = 0;
  3011.     this.resetRowVisibility();
  3012.     if (this.mode == Listview.MODE_TILED) {
  3013.         if (this.nItemsPerRow == null) {
  3014.             var q = this.template.nItemsPerRow;
  3015.             this.nItemsPerRow = (q != null ? q : 4)
  3016.         }
  3017.         this.nItemsPerRow |= 0;
  3018.         if (this.nItemsPerRow <= 1) {
  3019.             this.nItemsPerRow = 1
  3020.         }
  3021.     } else {
  3022.         this.nItemsPerRow = 1
  3023.     }
  3024.     this.columns = [];
  3025.     for (var e = 0, j = this.template.columns.length; e < j; ++e) {
  3026.         var p = this.template.columns[e],
  3027.             c = {};
  3028.         cO(c, p);
  3029.         this.columns.push(c)
  3030.     }
  3031.     if (this.extraCols != null) {
  3032.         for (var e = 0, j = this.extraCols.length; e < j; ++e) {
  3033.             var l = null;
  3034.             var b = this.extraCols[e];
  3035.             if (b.after || b.before) {
  3036.                 var h = in_array(this.columns, (b.after ? b.after : b.before), function(d) {
  3037.                     return d.id
  3038.                 });
  3039.                 if (h != -1) {
  3040.                     l = (b.after ? h + 1 : h - 1)
  3041.                 }
  3042.             }
  3043.             if (l == null) {
  3044.                 l = this.columns.length
  3045.             }
  3046.             this.columns.splice(l, 0, b)
  3047.         }
  3048.     }
  3049.     this.visibility = [];
  3050.     var n = [],
  3051.         o = [];
  3052.     if (this.visibleCols != null) {
  3053.         array_walk(this.visibleCols, function(d) {
  3054.             n[d] = 1
  3055.         })
  3056.     }
  3057.     if (this.hiddenCols != null) {
  3058.         array_walk(this.hiddenCols, function(d) {
  3059.             o[d] = 1
  3060.         })
  3061.     }
  3062.     for (var e = 0, j = this.columns.length; e < j; ++e) {
  3063.         var b = this.columns[e];
  3064.         if (n[b.id] != null || (!b.hidden && o[b.id] == null)) {
  3065.             this.visibility.push(e)
  3066.         }
  3067.     }
  3068.     if (this.sort == null && this.template.sort) {
  3069.         this.sort = this.template.sort.slice(0)
  3070.     } else {
  3071.         if (this.sort != null) {
  3072.             var g = this.sort;
  3073.             this.sort = [];
  3074.             for (var e = 0, j = g.length; e < j; ++e) {
  3075.                 var b = parseInt(g[e]);
  3076.                 if (isNaN(b)) {
  3077.                     var f = 0;
  3078.                     if (g[e].charAt(0) == "-") {
  3079.                         f = 1;
  3080.                         g[e] = g[e].substring(1)
  3081.                     }
  3082.                     var h = in_array(this.columns, g[e], function(d) {
  3083.                         return d.id
  3084.                     });
  3085.                     if (h != -1) {
  3086.                         if (f) {
  3087.                             this.sort.push(-(h + 1))
  3088.                         } else {
  3089.                             this.sort.push(h + 1)
  3090.                         }
  3091.                     }
  3092.                 } else {
  3093.                     this.sort.push(b)
  3094.                 }
  3095.             }
  3096.         } else {
  3097.             this.sort = []
  3098.         }
  3099.     }
  3100.     if (this.tabs) {
  3101.         this.tabIndex = this.tabs.add(this.getTabName(), {
  3102.             id: this.id,
  3103.             onLoad: this.initialize.bind(this)
  3104.         })
  3105.     } else {
  3106.         this.initialize()
  3107.     }
  3108. }
  3109. Listview.MODE_DEFAULT = 0;
  3110. Listview.MODE_CHECKBOX = 99;
  3111. Listview.MODE_DIV = 2;
  3112. Listview.MODE_TILED = 3;
  3113. var nd = 1;
  3114. Listview.prototype = {
  3115.     initialize: function() {
  3116.         if (this.data.length) {
  3117.             if (this.computeDataFunc != null) {
  3118.                 for (var d = 0, a = this.data.length; d < a; ++d) {
  3119.                     this.computeDataFunc(this.data[d])
  3120.                 }
  3121.             }
  3122.         }
  3123.         if (this.tabs) {
  3124.             this.pounded = (this.tabs.poundedTab == this.tabIndex);
  3125.             if (this.pounded) {
  3126.                 this.readPound()
  3127.             }
  3128.         } else {
  3129.             this.readPound()
  3130.         }
  3131.         this.updateSortIndex();
  3132.         var b;
  3133.         if (this.onBeforeCreate != null) {
  3134.             if (typeof this.onBeforeCreate == "function") {
  3135.                 b = this.onBeforeCreate()
  3136.             } else {
  3137.                 for (var d = 0; d < this.onBeforeCreate.length; ++d) {
  3138.                     (this.onBeforeCreate[d].bind(this))()
  3139.                 }
  3140.             }
  3141.         }
  3142.         this.noData = ce("div");
  3143.         this.noData.className = "listview-nodata text";
  3144.         if (this.mode == Listview.MODE_DIV) {
  3145.             this.mainContainer = this.mainDiv = ce("div");
  3146.             this.mainContainer.className = "listview-mode-div"
  3147.         } else {
  3148.             this.mainContainer = this.table = ce("table");
  3149.             this.table.setAttribute("cellpadding", "0");
  3150.             this.table.setAttribute("cellspacing", "0");
  3151.             this.thead = ce("thead");
  3152.             this.tbody = ce("tbody");
  3153.             if (this.mode == Listview.MODE_TILED) {
  3154.                 this.table.className = "listview-mode-tiled";
  3155.                 var e = (100 / this.nItemsPerRow) + "%",
  3156.                     f = ce("colgroup"),
  3157.                     c;
  3158.                 for (var d = 0; d < this.nItemsPerRow; ++d) {
  3159.                     c = ce("col");
  3160.                     c.style.width = e;
  3161.                     ae(f, c)
  3162.                 }
  3163.                 ae(this.mainContainer, f)
  3164.             } else {
  3165.                 this.table.className = "listview-mode-default";
  3166.                 this.createHeader();
  3167.                 this.updateSortArrow()
  3168.             }
  3169.             ae(this.table, this.thead);
  3170.             ae(this.table, this.tbody);
  3171.             if (this.mode == Listview.MODE_CHECKBOX && Browser.ie) {
  3172.                 setTimeout(Listview.cbIeFix.bind(this), 1)
  3173.             }
  3174.         }
  3175.         this.createBands();
  3176.         if (this.customFilter != null) {
  3177.             this.updateFilters()
  3178.         }
  3179.         this.updateNav();
  3180.         this.applySort();
  3181.         this.refreshRows();
  3182.         if (this.onAfterCreate != null) {
  3183.             this.onAfterCreate(b)
  3184.         }
  3185.     },
  3186.     createHeader: function() {
  3187.         var h = ce("tr");
  3188.         if (this.mode == Listview.MODE_CHECKBOX) {
  3189.             var g = ce("th"),
  3190.                 j = ce("div"),
  3191.                 c = ce("a");
  3192.             g.style.width = "33px";
  3193.             c.href = "javascript:;";
  3194.             c.className = "listview-cb";
  3195.             ns(c);
  3196.             ae(c, ct(String.fromCharCode(160)));
  3197.             ae(j, c);
  3198.             ae(g, j);
  3199.             ae(h, g)
  3200.         }
  3201.         for (var f = 0, b = this.visibility.length; f < b; ++f) {
  3202.             var e = this.visibility[f],
  3203.                 d = this.columns[e],
  3204.                 g = ce("th");
  3205.             j = ce("div"), c = ce("a"), outerSpan = ce("span"), innerSpan = ce("span");
  3206.             d.__th = g;
  3207.             c.href = "javascript:;";
  3208.             if (this.filtrable && (d.filtrable == null || d.filtrable)) {
  3209.                 c.onmouseup = Listview.headerClick.bind(this, d, e);
  3210.                 c.onclick = c.oncontextmenu = rf
  3211.             } else {
  3212.                 c.onclick = this.sortBy.bind(this, e + 1)
  3213.             }
  3214.             c.onmouseover = Listview.headerOver.bind(this, c, d);
  3215.             c.onmouseout = Tooltip.hide;
  3216.             ns(c);
  3217.             if (d.width != null) {
  3218.                 g.style.width = d.width
  3219.             }
  3220.             if (d.align != null) {
  3221.                 g.style.textAlign = d.align
  3222.             }
  3223.             if (d.span != null) {
  3224.                 g.colSpan = d.span
  3225.             }
  3226.             ae(innerSpan, ct(d.name));
  3227.             ae(outerSpan, innerSpan);
  3228.             ae(c, outerSpan);
  3229.             ae(j, c);
  3230.             ae(g, j);
  3231.             ae(h, g)
  3232.         }
  3233.         if (this.hideHeader) {
  3234.             this.thead.style.display = "none"
  3235.         }
  3236.         ae(this.thead, h)
  3237.     },
  3238.     createBands: function() {
  3239.         var h = ce("div"),
  3240.             j = ce("div"),
  3241.             k = ce("div"),
  3242.             i = ce("div");
  3243.         this.bandTop = h;
  3244.         this.bandBot = j;
  3245.         this.noteTop = k;
  3246.         this.noteBot = i;
  3247.         h.className = "listview-band-top";
  3248.         j.className = "listview-band-bottom";
  3249.         this.navTop = this.createNav(true);
  3250.         this.navBot = this.createNav(false);
  3251.         k.className = i.className = "listview-note";
  3252.         if (this.note) {
  3253.             k.innerHTML = this.note
  3254.         } else {
  3255.             if (this.createNote) {
  3256.                 this.createNote(k, i)
  3257.             }
  3258.         }
  3259.         if (!k.firstChild && this.mode != Listview.MODE_CHECKBOX) {
  3260.             ae(k, ct(String.fromCharCode(160)))
  3261.         }
  3262.         if (this.mode != Listview.MODE_CHECKBOX) {
  3263.             ae(i, ct(String.fromCharCode(160)))
  3264.         }
  3265.         ae(h, this.navTop);
  3266.         if (this.searchable) {
  3267.             var l = this.updateFilters.bind(this, true),
  3268.                 d = (this._truncated ? "search-within-results2" : "search-within-results"),
  3269.                 c = ce("span"),
  3270.                 b = ce("em"),
  3271.                 g = ce("a"),
  3272.                 f = ce("input");
  3273.             c.className = "listview-qSearch";
  3274.             ae(c, b);
  3275.             g.href = "javascript:;";
  3276.             g.onclick = function() {
  3277.                 var a = this.nextSibling;
  3278.                 a.value = "";
  3279.                 a.className = d;
  3280.                 l()
  3281.             };
  3282.             g.style.display = "none";
  3283.             ae(g, ce("span"));
  3284.             ae(c, g);
  3285.             ns(g);
  3286.             f.setAttribute("type", "text");
  3287.             f.className = d;
  3288.             f.style.width = (this._truncated ? "19em" : "15em");
  3289.             openDB_onAfterTyping(f, l, this.searchDelay);
  3290.             f.onmouseover = function() {
  3291.                 if (trim(this.value) != "") {
  3292.                     this.className = ""
  3293.                 }
  3294.             };
  3295.             f.onfocus = function() {
  3296.                 this.className = ""
  3297.             };
  3298.             f.onblur = function() {
  3299.                 if (trim(this.value) == "") {
  3300.                     this.className = d;
  3301.                     this.value = ""
  3302.                 }
  3303.             };
  3304.             if (Browser.ie) {
  3305.                 setTimeout(function() {
  3306.                     f.value = ""
  3307.                 }, 1)
  3308.             }
  3309.             ae(c, f);
  3310.             this.qSearchBox = f;
  3311.             this.qSearchGlass = b;
  3312.             this.qSearchClear = g
  3313.         }
  3314.         ae(h, k);
  3315.         ae(j, this.navBot);
  3316.         ae(j, i);
  3317.         if (this.mode == Listview.MODE_CHECKBOX) {
  3318.             if (this.note) {
  3319.                 k.style.paddingBottom = "5px"
  3320.             }
  3321.             this.cbBarTop = this.createCbBar(true);
  3322.             this.cbBarBot = this.createCbBar(false);
  3323.             ae(h, this.cbBarTop);
  3324.             ae(j, this.cbBarBot);
  3325.             if (!this.noteTop.firstChild && !this.cbBarTop.firstChild) {
  3326.                 this.noteTop.innerHTML = "&nbsp;"
  3327.             }
  3328.             if (!this.noteBot.firstChild && !this.cbBarBot.firstChild) {
  3329.                 this.noteBot.innerHTML = "&nbsp;"
  3330.             }
  3331.             if (this.noteTop.firstChild && this.cbBarTop.firstChild) {
  3332.                 this.noteTop.style.paddingBottom = "6px"
  3333.             }
  3334.             if (this.noteBot.firstChild && this.cbBarBot.firstChild) {
  3335.                 this.noteBot.style.paddingBottom = "6px"
  3336.             }
  3337.         }
  3338.         if (this.hideBands & 1) {
  3339.             h.style.display = "none"
  3340.         }
  3341.         if (this.hideBands & 2) {
  3342.             j.style.display = "none"
  3343.         }
  3344.         $j(this.container).append(this.bandTop);
  3345.         if (this.clip) {
  3346.             var e = ce("div");
  3347.             e.className = "listview-clip";
  3348.             e.style.width = this.clip.w + "px";
  3349.             e.style.height = this.clip.h + "px";
  3350.             this.clipDiv = e;
  3351.             ae(e, this.mainContainer);
  3352.             ae(e, this.noData);
  3353.             ae(this.container, e)
  3354.         } else {
  3355.             ae(this.container, this.mainContainer);
  3356.             ae(this.container, this.noData)
  3357.         }
  3358.         ae(this.container, this.bandBot)
  3359.     },
  3360.     createNav: function(g) {
  3361.         var c = ce("div"),
  3362.             d = ce("a"),
  3363.             b = ce("a"),
  3364.             a = ce("a"),
  3365.             j = ce("a"),
  3366.             i = ce("span"),
  3367.             h = ce("b"),
  3368.             f = ce("b"),
  3369.             e = ce("b");
  3370.         c.className = "listview-nav";
  3371.         d.href = b.href = a.href = j.href = "javascript:;";
  3372.         ae(d, ct(String.fromCharCode(171) + LANG.lvpage_first));
  3373.         ae(b, ct(String.fromCharCode(8249) + LANG.lvpage_previous));
  3374.         ae(a, ct(LANG.lvpage_next + String.fromCharCode(8250)));
  3375.         ae(j, ct(LANG.lvpage_last + String.fromCharCode(187)));
  3376.         ns(d);
  3377.         ns(b);
  3378.         ns(a);
  3379.         ns(j);
  3380.         d.onclick = this.firstPage.bind(this);
  3381.         b.onclick = this.previousPage.bind(this);
  3382.         a.onclick = this.nextPage.bind(this);
  3383.         j.onclick = this.lastPage.bind(this);
  3384.         ae(h, ct("a"));
  3385.         ae(f, ct("a"));
  3386.         ae(e, ct("a"));
  3387.         ae(i, h);
  3388.         ae(i, ct(LANG.hyphen));
  3389.         ae(i, f);
  3390.         ae(i, ct(LANG.lvpage_of));
  3391.         ae(i, e);
  3392.         ae(c, d);
  3393.         ae(c, b);
  3394.         ae(c, i);
  3395.         ae(c, a);
  3396.         ae(c, j);
  3397.         if (g) {
  3398.             if (this.hideNav & 1) {
  3399.                 c.style.display = "none"
  3400.             }
  3401.         } else {
  3402.             if (this.hideNav & 2) {
  3403.                 c.style.display = "none"
  3404.             }
  3405.         }
  3406.         return c
  3407.     },
  3408.     createCbBar: function(a) {
  3409.         var b = ce("div");
  3410.         if (this.createCbControls) {
  3411.             this.createCbControls(b, a)
  3412.         }
  3413.         if (b.firstChild) {
  3414.             b.className = "listview-withselected" + (a ? "" : "2")
  3415.         }
  3416.         return b
  3417.     },
  3418.     refreshRows: function() {
  3419.         var a = (this.mode == Listview.MODE_DIV ? this.mainContainer : this.tbody);
  3420.         ee(a);
  3421.         if (this.nRowsVisible == 0) {
  3422.             if (!this.filtered) {
  3423.                 this.bandTop.style.display = this.bandBot.style.display = "none";
  3424.                 this.mainContainer.style.display = "none"
  3425.             }
  3426.             this.noData.style.display = "";
  3427.             this.showNoData();
  3428.             return
  3429.         }
  3430.         var n, b, c;
  3431.         if (!(this.hideBands & 1)) {
  3432.             this.bandTop.style.display = ""
  3433.         }
  3434.         if (!(this.hideBands & 2)) {
  3435.             this.bandBot.style.display = ""
  3436.         }
  3437.         if (this.nItemsPerPage > 0) {
  3438.             n = this.rowOffset;
  3439.             b = Math.min(n + this.nRowsVisible, n + this.nItemsPerPage);
  3440.             if (this.filtered && this.rowOffset > 0) {
  3441.                 for (var f = 0, g = 0; f < this.data.length && g < this.rowOffset; ++f) {
  3442.                     var o = this.data[f];
  3443.                     if (o.__hidden || o.__deleted) {
  3444.                         ++n
  3445.                     } else {
  3446.                         ++g
  3447.                     }
  3448.                 }
  3449.                 b += (n - this.rowOffset)
  3450.             }
  3451.         } else {
  3452.             n = 0;
  3453.             b = this.nRowsVisible
  3454.         }
  3455.         var h = b - n;
  3456.         if (this.mode == Listview.MODE_DIV) {
  3457.             for (var e = 0; e < h; ++e) {
  3458.                 var f = n + e,
  3459.                     o = this.data[f];
  3460.                 if (!o) {
  3461.                     break
  3462.                 }
  3463.                 if (o.__hidden || o.__deleted) {
  3464.                     ++h;
  3465.                     continue
  3466.                 }
  3467.                 ae(this.mainDiv, this.getDiv(f))
  3468.             }
  3469.         } else {
  3470.             if (this.mode == Listview.MODE_TILED) {
  3471.                 var d = 0,
  3472.                     l = ce("tr");
  3473.                 for (var e = 0; e < h; ++e) {
  3474.                     var f = n + e,
  3475.                         o = this.data[f];
  3476.                     if (!o) {
  3477.                         break
  3478.                     }
  3479.                     if (o.__hidden || o.__deleted) {
  3480.                         ++h;
  3481.                         continue
  3482.                     }
  3483.                     ae(l, this.getCell(f));
  3484.                     if (++d == this.nItemsPerRow) {
  3485.                         ae(this.tbody, l);
  3486.                         if (e + 1 < h) {
  3487.                             l = ce("tr")
  3488.                         }
  3489.                         d = 0
  3490.                     }
  3491.                 }
  3492.                 if (d != 0) {
  3493.                     for (; d < 4; ++d) {
  3494.                         var m = ce("td");
  3495.                         m.className = "empty-cell";
  3496.                         ae(l, m)
  3497.                     }
  3498.                     ae(this.tbody, l)
  3499.                 }
  3500.             } else {
  3501.                 for (var e = 0; e < h; ++e) {
  3502.                     var f = n + e,
  3503.                         o = this.data[f];
  3504.                     if (!o) {
  3505.                         break
  3506.                     }
  3507.                     if (o.__hidden || o.__deleted) {
  3508.                         ++h;
  3509.                         continue
  3510.                     }
  3511.                     ae(this.tbody, this.getRow(f))
  3512.                 }
  3513.             }
  3514.         }
  3515.         this.mainContainer.style.display = "";
  3516.         this.noData.style.display = "none"
  3517.     },
  3518.     showNoData: function() {
  3519.         var b = this.noData;
  3520.         ee(b);
  3521.         var a = -1;
  3522.         if (this.template.onNoData) {
  3523.             a = (this.template.onNoData.bind(this, b))()
  3524.         }
  3525.         if (a == -1) {
  3526.             ae(this.noData, ct(this.filtered ? LANG.lvnodata2 : LANG.lvnodata))
  3527.         }
  3528.     },
  3529.     getDiv: function(a) {
  3530.         var b = this.data[a];
  3531.         if (b.__div == null) {
  3532.             this.createDiv(b, a)
  3533.         }
  3534.         return b.__div
  3535.     },
  3536.     createDiv: function(b, a) {
  3537.         var c = ce("div");
  3538.         b.__div = c;
  3539.         (this.template.compute.bind(this, b, c, a))()
  3540.     },
  3541.     getCell: function(a) {
  3542.         var b = this.data[a];
  3543.         if (b.__div == null) {
  3544.             this.createCell(b, a)
  3545.         }
  3546.         return b.__td
  3547.     },
  3548.     createCell: function(b, a) {
  3549.         var c = ce("td");
  3550.         b.__td = c;
  3551.         (this.template.compute.bind(this, b, c, a))();
  3552.         if (this.template.getItemLink) {
  3553.             c.onclick = this.itemClick.bind(this, b)
  3554.         }
  3555.         if (Browser.ie6) {
  3556.             c.onmouseover = Listview.itemOver;
  3557.             c.onmouseout = Listview.itemOut
  3558.         }
  3559.     },
  3560.     getRow: function(a) {
  3561.         var b = this.data[a];
  3562.         if (b.__tr == null) {
  3563.             this.createRow(b)
  3564.         }
  3565.         return b.__tr
  3566.     },
  3567.     createRow: function(j) {
  3568.         var g = ce("tr");
  3569.         if (nd % 2) {
  3570.             g.className = "odd"
  3571.         } else {
  3572.             g.className = "even"
  3573.         }++nd;
  3574.         j.__tr = g;
  3575.         if (this.mode == Listview.MODE_CHECKBOX) {
  3576.             var c = ce("td");
  3577.             if (!j.__nochk) {
  3578.                 c.className = "listview-cb";
  3579.                 c.onclick = Listview.cbCellClick;
  3580.                 var b = ce("input");
  3581.                 ns(b);
  3582.                 b.type = "checkbox";
  3583.                 b.onclick = Listview.cbClick;
  3584.                 if (j.__chk) {
  3585.                     b.checked = true;
  3586.                     if (Browser.ie) {
  3587.                         b.defaultChecked = true
  3588.                     }
  3589.                 }
  3590.                 j.__cb = b;
  3591.                 ae(c, b)
  3592.             }
  3593.             ae(g, c)
  3594.         }
  3595.         for (var d = 0, e = this.visibility.length; d < e; ++d) {
  3596.             var f = this.visibility[d],
  3597.                 a = this.columns[f],
  3598.                 c = ce("td"),
  3599.                 h;
  3600.             if (a.align != null) {
  3601.                 c.style.textAlign = a.align
  3602.             }
  3603.             if (a.compute) {
  3604.                 h = (a.compute.bind(this, j, c, g, f))()
  3605.             } else {
  3606.                 if (j[a.value] != null) {
  3607.                     h = j[a.value]
  3608.                 } else {
  3609.                     h = -1
  3610.                 }
  3611.             }
  3612.             if (h != -1 && h != null) {
  3613.                 c.insertBefore(ct(h), c.firstChild)
  3614.             }
  3615.             ae(g, c)
  3616.         }
  3617.         if (this.mode == Listview.MODE_CHECKBOX && j.__chk) {
  3618.             g.className = "checked"
  3619.         }
  3620.         if (this.template.getItemLink) {
  3621.             g.onclick = this.itemClick.bind(this, j)
  3622.         }
  3623.         if (Browser.ie6) {
  3624.             g.onmouseover = Listview.itemOver;
  3625.             g.onmouseout = Listview.itemOut
  3626.         }
  3627.     },
  3628.     itemClick: function(d, c) {
  3629.         c = $E(c);
  3630.         var a = 0,
  3631.             b = c._target;
  3632.         while (b && a < 3) {
  3633.             if (b.nodeName == "A") {
  3634.                 return
  3635.             }
  3636.             b = b.parentNode
  3637.         }
  3638.         location.href = this.template.getItemLink(d)
  3639.     },
  3640.     validatePage: function() {
  3641.         var c = this.nItemsPerPage,
  3642.             b = this.rowOffset,
  3643.             a = this.nRowsVisible;
  3644.         if (b < 0) {
  3645.             this.rowOffset = 0
  3646.         } else {
  3647.             this.rowOffset = this.getRowOffset(b + c > a ? a - 1 : b)
  3648.         }
  3649.     },
  3650.     getRowOffset: function(b) {
  3651.         var a = this.nItemsPerPage;
  3652.         return (a > 0 && b > 0 ? Math.floor(b / a) * a : 0)
  3653.     },
  3654.     resetRowVisibility: function() {
  3655.         for (var b = 0, a = this.data.length; b < a; ++b) {
  3656.             this.data[b].__hidden = false
  3657.         }
  3658.         this.filtered = false;
  3659.         this.rowOffset = 0;
  3660.         this.nRowsVisible = this.data.length
  3661.     },
  3662.     getColText: function(b, a) {
  3663.         if (a.getVisibleText) {
  3664.             return a.getVisibleText(b)
  3665.         }
  3666.         if (a.getValue) {
  3667.             return a.getValue(b)
  3668.         }
  3669.         if (a.value) {
  3670.             return b[a.value]
  3671.         }
  3672.         if (a.compute) {
  3673.             return a.compute(b)
  3674.         }
  3675.         return ""
  3676.     },
  3677.     updateFilters: function(d) {
  3678.         Tooltip.hide();
  3679.         this.resetRowVisibility();
  3680.         var w, q, c;
  3681.         if (this.searchable) {
  3682.             w = trim(this.qSearchBox.value);
  3683.             if (w) {
  3684.                 this.qSearchGlass.style.display = "none";
  3685.                 this.qSearchClear.style.display = "";
  3686.                 w = w.toLowerCase().replace(/\s+/g, " ");
  3687.                 q = w.split(" ");
  3688.                 c = q.length
  3689.             } else {
  3690.                 this.qSearchGlass.style.display = "";
  3691.                 this.qSearchClear.style.display = "none"
  3692.             }
  3693.         }
  3694.         if (!w && this.nFilters == 0 && this.customFilter == null) {
  3695.             if (d) {
  3696.                 this.updateNav();
  3697.                 this.refreshRows()
  3698.             }
  3699.             return
  3700.         }
  3701.         var z = {
  3702.             1: function(i, j) {
  3703.                 return i > j
  3704.             },
  3705.             2: function(i, j) {
  3706.                 return i == j
  3707.             },
  3708.             3: function(i, j) {
  3709.                 return i < j
  3710.             },
  3711.             4: function(i, j) {
  3712.                 return i >= j
  3713.             },
  3714.             5: function(i, j) {
  3715.                 return i <= j
  3716.             },
  3717.             6: function(i, k, j) {
  3718.                 return k <= i && i <= j
  3719.             }
  3720.         };
  3721.         var p = {
  3722.             1: function(j, i, k) {
  3723.                 return i > k
  3724.             },
  3725.             2: function(j, i, k) {
  3726.                 return j <= k && k <= i
  3727.             },
  3728.             3: function(j, i, k) {
  3729.                 return j < k
  3730.             },
  3731.             4: function(j, i, k) {
  3732.                 return i >= k
  3733.             },
  3734.             5: function(j, i, k) {
  3735.                 return j <= k
  3736.             },
  3737.             6: function(j, i, B, k) {
  3738.                 return B <= i && j <= k
  3739.             }
  3740.         };
  3741.         var o = 0;
  3742.         for (var u = 0, v = this.data.length; u < v; ++u) {
  3743.             var g = this.data[u],
  3744.                 m = 0;
  3745.             nSearchMatches = 0, matches = [];
  3746.             g.__hidden = true;
  3747.             if (this.customFilter && !this.customFilter(g)) {
  3748.                 continue
  3749.             }
  3750.             for (var t = 0, h = this.visibility.length; t < h; ++t) {
  3751.                 var n = this.visibility[t];
  3752.                 var e = this.columns[n];
  3753.                 if (e.__filter) {
  3754.                     var a = e.__filter,
  3755.                         b = false;
  3756.                     if (e.type == null || e.type == "num") {
  3757.                         var r = null;
  3758.                         if (e.getValue) {
  3759.                             r = e.getValue(g)
  3760.                         } else {
  3761.                             if (e.value) {
  3762.                                 r = parseFloat(g[e.value])
  3763.                             }
  3764.                         }
  3765.                         if (!r) {
  3766.                             r = 0
  3767.                         }
  3768.                         b = (z[a.type])(r, a.value, a.value2)
  3769.                     } else {
  3770.                         if (e.type == "range") {
  3771.                             var A = e.getMinValue(g),
  3772.                                 y = e.getMaxValue(g);
  3773.                             b = (p[a.type])(A, y, a.value, a.value2)
  3774.                         } else {
  3775.                             var l = this.getColText(g, e);
  3776.                             if (l) {
  3777.                                 l = l.toString().toLowerCase();
  3778.                                 if (a.invert) {
  3779.                                     b = l.match(a.regex) != null
  3780.                                 } else {
  3781.                                     var x = 0;
  3782.                                     for (var s = 0, f = a.words.length; s < f; ++s) {
  3783.                                         if (l.indexOf(a.words[s]) != -1) {
  3784.                                             ++x
  3785.                                         } else {
  3786.                                             break
  3787.                                         }
  3788.                                     }
  3789.                                     b = (x == a.words.length)
  3790.                                 }
  3791.                             }
  3792.                         }
  3793.                     }
  3794.                     if (a.invert) {
  3795.                         b = !b
  3796.                     }
  3797.                     if (b) {
  3798.                         ++m
  3799.                     } else {
  3800.                         break
  3801.                     }
  3802.                 }
  3803.                 if (w) {
  3804.                     var l = this.getColText(g, e);
  3805.                     if (l) {
  3806.                         l = l.toString().toLowerCase();
  3807.                         for (var s = 0, f = q.length; s < f; ++s) {
  3808.                             if (!matches[s]) {
  3809.                                 if (l.indexOf(q[s]) != -1) {
  3810.                                     matches[s] = 1;
  3811.                                     ++nSearchMatches
  3812.                                 }
  3813.                             }
  3814.                         }
  3815.                     }
  3816.                 }
  3817.             }
  3818.             if ((this.nFilters == 0 || m == this.nFilters) && (!w || nSearchMatches == c)) {
  3819.                 g.__hidden = false;
  3820.                 ++o
  3821.             }
  3822.         }
  3823.         this.filtered = (o < this.data.length);
  3824.         this.nRowsVisible = o;
  3825.         if (d) {
  3826.             this.updateNav();
  3827.             this.refreshRows()
  3828.         }
  3829.     },
  3830.     changePage: function() {
  3831.         this.validatePage();
  3832.         this.refreshRows();
  3833.         this.updateNav();
  3834.         this.updatePound();
  3835.         var a = openDB_getScroll(),
  3836.             b = ac(this.container);
  3837.         if (a.y > b[1]) {
  3838.             scrollTo(a.x, b[1])
  3839.         }
  3840.     },
  3841.     firstPage: function() {
  3842.         this.rowOffset = 0;
  3843.         this.changePage();
  3844.         return false
  3845.     },
  3846.     previousPage: function() {
  3847.         this.rowOffset -= this.nItemsPerPage;
  3848.         this.changePage();
  3849.         return false
  3850.     },
  3851.     nextPage: function() {
  3852.         this.rowOffset += this.nItemsPerPage;
  3853.         this.changePage();
  3854.         return false
  3855.     },
  3856.     lastPage: function() {
  3857.         this.rowOffset = 99999999;
  3858.         this.changePage();
  3859.         return false
  3860.     },
  3861.     addSort: function(a, c) {
  3862.         var b = in_array(a, Math.abs(c), function(d) {
  3863.             return Math.abs(d)
  3864.         });
  3865.         if (b != -1) {
  3866.             c = a[b];
  3867.             a.splice(b, 1)
  3868.         }
  3869.         a.splice(0, 0, c)
  3870.     },
  3871.     sortBy: function(a) {
  3872.         if (a <= 0 || a > this.columns.length) {
  3873.             return
  3874.         }
  3875.         if (Math.abs(this.sort[0]) == a) {
  3876.             this.sort[0] = -this.sort[0]
  3877.         } else {
  3878.             var b = -1;
  3879.             if (this.columns[a - 1].type == "text") {
  3880.                 b = 1
  3881.             }
  3882.             this.addSort(this.sort, b * a)
  3883.         }
  3884.         this.applySort();
  3885.         this.refreshRows();
  3886.         this.updateSortArrow();
  3887.         this.updatePound()
  3888.     },
  3889.     applySort: function() {
  3890.         if (this.sort.length == 0) {
  3891.             return
  3892.         }
  3893.         Listview.sort = this.sort;
  3894.         Listview.columns = this.columns;
  3895.         if (this.indexCreated) {
  3896.             this.data.sort(Listview.sortIndexedRows)
  3897.         } else {
  3898.             this.data.sort(Listview.sortRows)
  3899.         }
  3900.         this.updateSortIndex()
  3901.     },
  3902.     setSort: function(b, c, a) {
  3903.         if (this.sort.toString() != b.toString()) {
  3904.             this.sort = b;
  3905.             this.applySort();
  3906.             if (c) {
  3907.                 this.refreshRows()
  3908.             }
  3909.             if (a) {
  3910.                 this.updatePound()
  3911.             }
  3912.         }
  3913.     },
  3914.     readPound: function() {
  3915.         if (!this.poundable || !location.hash.length) {
  3916.             return
  3917.         }
  3918.         var b = location.hash.substr(1);
  3919.         if (this.tabs) {
  3920.             var g = b.indexOf(":");
  3921.             if (g == -1) {
  3922.                 return
  3923.             }
  3924.             b = b.substr(g + 1)
  3925.         }
  3926.         var a = parseInt(b);
  3927.         if (!isNaN(a)) {
  3928.             this.rowOffset = a;
  3929.             this.validatePage();
  3930.             if (this.poundable != 2) {
  3931.                 var d = [];
  3932.                 var f = b.match(/(\+|\-)[0-9]+/g);
  3933.                 if (f != null) {
  3934.                     for (var c = f.length - 1; c >= 0; --c) {
  3935.                         var e = parseInt(f[c]) | 0;
  3936.                         var b = Math.abs(e);
  3937.                         if (b <= 0 || b > this.columns.length) {
  3938.                             break
  3939.                         }
  3940.                         this.addSort(d, e)
  3941.                     }
  3942.                     this.setSort(d, false, false)
  3943.                 }
  3944.             }
  3945.             if (this.tabs) {
  3946.                 this.tabs.setTabPound(this.tabIndex, this.getTabPound())
  3947.             }
  3948.         }
  3949.     },
  3950.     updateSortArrow: function() {
  3951.         if (!this.sort.length || !this.thead) {
  3952.             return
  3953.         }
  3954.         var a = in_array(this.visibility, Math.abs(this.sort[0]) - 1);
  3955.         if (a == -1) {
  3956.             return
  3957.         }
  3958.         if (this.mode == Listview.MODE_CHECKBOX) {
  3959.             a += 1
  3960.         }
  3961.         var b = this.thead.firstChild.childNodes[a].firstChild.firstChild.firstChild;
  3962.         if (this.lsa && this.lsa != b) {
  3963.             this.lsa.className = ""
  3964.         }
  3965.         b.className = (this.sort[0] < 0 ? "sortdesc" : "sortasc");
  3966.         this.lsa = b
  3967.     },
  3968.     updateSortIndex: function() {
  3969.         var b = this.data;
  3970.         for (var c = 0, a = b.length; c < a; ++c) {
  3971.             b[c].__si = c
  3972.         }
  3973.         this.indexCreated = true
  3974.     },
  3975.     updateTabName: function() {
  3976.         if (this.tabs && this.tabIndex != null) {
  3977.             this.tabs.setTabName(this.tabIndex, this.getTabName())
  3978.         }
  3979.     },
  3980.     updatePound: function() {
  3981.         if (!this.poundable) {
  3982.             return
  3983.         }
  3984.         var a = this.getTabPound();
  3985.         if (this.tabs) {
  3986.             this.tabs.setTabPound(this.tabIndex, a);
  3987.             location.replace("#" + this.id + ":" + a)
  3988.         } else {
  3989.             location.replace("#" + a)
  3990.         }
  3991.     },
  3992.     updateNav: function() {
  3993.         var e = [this.navTop, this.navBot],
  3994.             j = this.nItemsPerPage,
  3995.             h = this.rowOffset,
  3996.             d = this.nRowsVisible,
  3997.             g = 0,
  3998.             b = 0,
  3999.             f = 0,
  4000.             k = 0;
  4001.         if (d > 0) {
  4002.             if (!(this.hideNav & 1)) {
  4003.                 e[0].style.display = ""
  4004.             }
  4005.             if (!(this.hideNav & 2)) {
  4006.                 e[1].style.display = ""
  4007.             }
  4008.         } else {
  4009.             e[0].style.display = e[1].style.display = "none"
  4010.         }
  4011.         if (j) {
  4012.             if (h > 0) {
  4013.                 b = 1;
  4014.                 if (h >= j + j) {
  4015.                     g = 1
  4016.                 }
  4017.             }
  4018.             if (h + j < d) {
  4019.                 f = 1;
  4020.                 if (h + j + j < d) {
  4021.                     k = 1
  4022.                 }
  4023.             }
  4024.         }
  4025.         for (var c = 0; c < 2; ++c) {
  4026.             var a = e[c].childNodes;
  4027.             a[0].style.display = (g ? "" : "none");
  4028.             a[1].style.display = (b ? "" : "none");
  4029.             a[3].style.display = (f ? "" : "none");
  4030.             a[4].style.display = (k ? "" : "none");
  4031.             a = a[2].childNodes;
  4032.             a[0].firstChild.nodeValue = h + 1;
  4033.             a[2].firstChild.nodeValue = j ? Math.min(h + j, d) : d;
  4034.             a[4].firstChild.nodeValue = d
  4035.         }
  4036.     },
  4037.     getTabName: function() {
  4038.         var a = this.name,
  4039.             b = this.data.length;
  4040.         if (b > 0 && !this.hideCount) {
  4041.             a += sprintf(LANG.qty, b)
  4042.         }
  4043.         return a
  4044.     },
  4045.     getTabPound: function() {
  4046.         var a = "";
  4047.         a += this.rowOffset;
  4048.         if (this.poundable != 2 && this.sort.length) {
  4049.             a += ("+" + this.sort.join("+")).replace(/\+\-/g, "-")
  4050.         }
  4051.         return a
  4052.     },
  4053.     getCheckedRows: function() {
  4054.         var d = [];
  4055.         for (var c = 0, a = this.data.length; c < a; ++c) {
  4056.             var b = this.data[c];
  4057.             if ((b.__cb && b.__cb.checked) || (!b.__cb && b.__chk)) {
  4058.                 d.push(b)
  4059.             }
  4060.         }
  4061.         return d
  4062.     },
  4063.     deleteRows: function(c) {
  4064.         if (!c || !c.length) {
  4065.             return
  4066.         }
  4067.         for (var b = 0, a = c.length; b < a; ++b) {
  4068.             var d = c[b];
  4069.             if (!d.__hidden && !d.__hidden) {
  4070.                 this.nRowsVisible -= 1
  4071.             }
  4072.             d.__deleted = true
  4073.         }
  4074.         this.updateTabName();
  4075.         if (this.rowOffset >= this.nRowsVisible) {
  4076.             this.previousPage()
  4077.         } else {
  4078.             this.refreshRows();
  4079.             this.updateNav()
  4080.         }
  4081.     },
  4082.     setData: function(a) {
  4083.         this.data = a;
  4084.         this.indexCreated = false;
  4085.         this.resetRowVisibility();
  4086.         if (this.tabs) {
  4087.             this.pounded = (this.tabs.poundedTab == this.tabIndex);
  4088.             if (this.pounded) {
  4089.                 this.readPound()
  4090.             }
  4091.         } else {
  4092.             this.readPound()
  4093.         }
  4094.         this.applySort();
  4095.         this.updateSortArrow();
  4096.         if (this.customFilter != null) {
  4097.             this.updateFilters()
  4098.         }
  4099.         this.updateNav();
  4100.         this.refreshRows()
  4101.     },
  4102.     getClipDiv: function() {
  4103.         return this.clipDiv
  4104.     },
  4105.     getNoteTopDiv: function() {
  4106.         return this.noteTop
  4107.     },
  4108.     focusSearch: function() {
  4109.         this.qSearchBox.focus()
  4110.     },
  4111.     clearSearch: function() {
  4112.         this.qSearchBox.value = ""
  4113.     },
  4114.     createIndicator: function(b, e, g) {
  4115.         if (!this.noteIndicators) {
  4116.             this.noteIndicators = ce("div");
  4117.             this.noteIndicators.className = "listview-indicators";
  4118.             $j(this.noteIndicators).insertBefore($j(this.noteTop))
  4119.         }
  4120.         var d = this.tabClick;
  4121.         $j(this.noteIndicators).append($j('<span class="indicator"></span>').html(b).append(!e ? "" : $j('<a class="indicator-x" style="outline: none">[x]</a>').attr("href", (typeof e == "function" ? "javascript:;" : e)).click(function() {
  4122.             if (d) {
  4123.                 d()
  4124.             }
  4125.             if (typeof e == "function") {
  4126.                 e()
  4127.             }
  4128.         })).css("cursor", (typeof g == "function" ? "pointer" : null)).click(function() {
  4129.             if (d) {
  4130.                 d()
  4131.             }
  4132.             if (typeof g == "function") {
  4133.                 g()
  4134.             }
  4135.         }));
  4136.         $j(this.noteTop).css("padding-top", "7px")
  4137.     },
  4138.     removeIndicators: function() {
  4139.         if (this.noteIndicators) {
  4140.             $(this.noteIndicators).remove();
  4141.             this.noteIndicators = null
  4142.         }
  4143.         $j(this.noteTop).css("padding-top", "")
  4144.     }
  4145. };
  4146. Listview.sortRows = function(e, d) {
  4147.     var j = Listview.sort,
  4148.         k = Listview.columns;
  4149.     for (var h = 0, c = j.length; h < c; ++h) {
  4150.         var g, f = k[Math.abs(j[h]) - 1];
  4151.         if (f.sortFunc) {
  4152.             g = f.sortFunc(e, d, j[h])
  4153.         } else {
  4154.             g = strcmp(e[f.value], d[f.value])
  4155.         }
  4156.         if (g != 0) {
  4157.             return g * j[h]
  4158.         }
  4159.     }
  4160.     return 0
  4161. }, Listview.sortIndexedRows = function(d, c) {
  4162.     var g = Listview.sort,
  4163.         h = Listview.columns,
  4164.         e = h[Math.abs(g[0]) - 1],
  4165.         f;
  4166.     if (e.sortFunc) {
  4167.         f = e.sortFunc(d, c, g[0])
  4168.     } else {
  4169.         f = strcmp(d[e.value], c[e.value])
  4170.     }
  4171.     if (f != 0) {
  4172.         return f * g[0]
  4173.     }
  4174.     return (d.__si - c.__si)
  4175. }, Listview.cbSelect = function(b) {
  4176.     for (var d = 0, a = this.data.length; d < a; ++d) {
  4177.         var c = this.data[d];
  4178.         var f = b;
  4179.         if (!c.__nochk && c.__tr) {
  4180.             var e = c.__tr.firstChild.firstChild;
  4181.             if (f == null) {
  4182.                 f = !e.checked
  4183.             }
  4184.             if (e.checked != f) {
  4185.                 e.checked = f;
  4186.                 c.__tr.className = (e.checked ? "checked" : "");
  4187.                 if (Browser.ie) {
  4188.                     e.defaultChecked = f;
  4189.                     if (Browser.ie6) {
  4190.                         (Listview.itemOut.bind(c.__tr))()
  4191.                     }
  4192.                 }
  4193.             }
  4194.         } else {
  4195.             if (f == null) {
  4196.                 f = true
  4197.             }
  4198.         }
  4199.         c.__chk = f
  4200.     }
  4201. };
  4202. Listview.cbClick = function(a) {
  4203.     setTimeout(Listview.cbUpdate.bind(0, 0, this, this.parentNode.parentNode), 1);
  4204.     sp(a)
  4205. };
  4206. Listview.cbCellClick = function(a) {
  4207.     setTimeout(Listview.cbUpdate.bind(0, 1, this.firstChild, this.parentNode), 1);
  4208.     sp(a)
  4209. };
  4210. Listview.cbIeFix = function() {
  4211.     var d = gE(this.tbody, "tr");
  4212.     for (var c = 0, a = d.length; c < a; ++c) {
  4213.         var b = d[c].firstChild.firstChild;
  4214.         if (b) {
  4215.             b.checked = b.defaultChecked = false
  4216.         }
  4217.     }
  4218. };
  4219. Listview.cbUpdate = function(c, a, b) {
  4220.     if (c) {
  4221.         a.checked = !a.checked
  4222.     }
  4223.     b.className = (a.checked ? "checked" : "");
  4224.     if (Browser.ie) {
  4225.         a.defaultChecked = a.checked;
  4226.         if (Browser.ie6) {
  4227.             (Listview.itemOver.bind(b))()
  4228.         }
  4229.     }
  4230. };
  4231. Listview.itemOver = function() {
  4232.     this.style.backgroundColor = (this.className == "checked" ? "#2C2C2C" : "#202020")
  4233. };
  4234. Listview.itemOut = function() {
  4235.     this.style.backgroundColor = (this.className == "checked" ? "#242424" : "transparent")
  4236. };
  4237. Listview.headerClick = function(a, b, c) {
  4238.     c = $E(c);
  4239.     if (c._button == 3 || c.shiftKey || c.ctrlKey) {
  4240.         Tooltip.hide();
  4241.         setTimeout(Listview.headerFilter.bind(this, a, null), 1)
  4242.     } else {
  4243.         this.sortBy(b + 1)
  4244.     }
  4245.     return false
  4246. };
  4247. Listview.headerFilter = function(c, f) {
  4248.     var j = "";
  4249.     if (c.__filter) {
  4250.         if (c.__filter.invert) {
  4251.             j += "!"
  4252.         }
  4253.         j += c.__filter.text
  4254.     }
  4255.     if (f == null) {
  4256.         var f = prompt(sprintf(LANG.prompt_colfilter1 + (c.type == "text" ? LANG.prompt_colfilter2 : LANG.prompt_colfilter3), c.name), j)
  4257.     }
  4258.     if (f != null) {
  4259.         var e = {
  4260.             text: "",
  4261.             type: -1
  4262.         };
  4263.         f = trim(f.replace(/\s+/g, " "));
  4264.         if (f) {
  4265.             if (f.charAt(0) == "!" || f.charAt(0) == "-") {
  4266.                 e.invert = 1;
  4267.                 f = f.substr(1)
  4268.             }
  4269.             if (c.type == "text") {
  4270.                 e.type = 0;
  4271.                 e.text = f;
  4272.                 if (e.invert) {
  4273.                     e.regex = openDB_createOrRegex(f)
  4274.                 } else {
  4275.                     e.words = f.toLowerCase().split(" ")
  4276.                 }
  4277.             } else {
  4278.                 var i, b;
  4279.                 if (f.match(/(>|=|<|>=|<=)\s*([0-9\.]+)/)) {
  4280.                     i = parseFloat(RegExp.$2);
  4281.                     if (!isNaN(i)) {
  4282.                         switch (RegExp.$1) {
  4283.                             case ">":
  4284.                                 e.type = 1;
  4285.                                 break;
  4286.                             case "=":
  4287.                                 e.type = 2;
  4288.                                 break;
  4289.                             case "<":
  4290.                                 e.type = 3;
  4291.                                 break;
  4292.                             case ">=":
  4293.                                 e.type = 4;
  4294.                                 break;
  4295.                             case "<=":
  4296.                                 e.type = 5;
  4297.                                 break
  4298.                         }
  4299.                         e.value = i;
  4300.                         e.text = RegExp.$1 + " " + i
  4301.                     }
  4302.                 } else {
  4303.                     if (f.match(/([0-9\.]+)\s*\-\s*([0-9\.]+)/)) {
  4304.                         i = parseFloat(RegExp.$1);
  4305.                         b = parseFloat(RegExp.$2);
  4306.                         if (!isNaN(i) && !isNaN(b)) {
  4307.                             if (i > b) {
  4308.                                 var g = i;
  4309.                                 i = b;
  4310.                                 b = g
  4311.                             }
  4312.                             if (i == b) {
  4313.                                 e.type = 2;
  4314.                                 e.value = i;
  4315.                                 e.text = "= " + i
  4316.                             } else {
  4317.                                 e.type = 6;
  4318.                                 e.value = i;
  4319.                                 e.value2 = b;
  4320.                                 e.text = i + " - " + b
  4321.                             }
  4322.                         }
  4323.                     } else {
  4324.                         var d = f.toLowerCase().split(" ");
  4325.                         if (d.length == 1 && !isNaN(i = parseFloat(d[0]))) {
  4326.                             e.type = 2;
  4327.                             e.value = i;
  4328.                             e.text = "= " + i
  4329.                         } else {
  4330.                             if (c.type == "text") {
  4331.                                 e.type = 0;
  4332.                                 e.text = f;
  4333.                                 if (e.invert) {
  4334.                                     e.regex = openDB_createOrRegex(f)
  4335.                                 } else {
  4336.                                     e.words = d
  4337.                                 }
  4338.                             }
  4339.                         }
  4340.                     }
  4341.                 }
  4342.             }
  4343.             if (e.type == -1) {
  4344.                 alert(LANG.message_invalidfilter);
  4345.                 return
  4346.             }
  4347.         }
  4348.         if (!c.__filter || e.text != c.__filter.text || e.invert != c.__filter.invert) {
  4349.             var h = c.__th.firstChild.firstChild;
  4350.             if (f && e.text) {
  4351.                 if (!c.__filter) {
  4352.                     h.className = "q5";
  4353.                     ++(this.nFilters)
  4354.                 }
  4355.                 c.__filter = e
  4356.             } else {
  4357.                 if (c.__filter) {
  4358.                     h.className = "";
  4359.                     --(this.nFilters)
  4360.                 }
  4361.                 c.__filter = null
  4362.             }
  4363.             this.updateFilters(1)
  4364.         }
  4365.     }
  4366. };
  4367. Listview.headerOver = function(b, c, f) {
  4368.     var d = "";
  4369.     d += '<b class="q1">' + (c.tooltip ? c.tooltip : c.name) + "</b>";
  4370.     if (c.__filter) {
  4371.         d += "<br />" + sprintf((c.__filter.invert ? LANG.tooltip_colfilter2 : LANG.tooltip_colfilter1), c.__filter.text)
  4372.     }
  4373.     d += '<br /><span class="q2">' + LANG.tooltip_lvheader1 + "</span>";
  4374.     if (this.filtrable && (c.filtrable == null || c.filtrable)) {
  4375.         d += '<br /><span class="q2">' + (Browser.opera ? LANG.tooltip_lvheader3 : LANG.tooltip_lvheader2) + "</span>"
  4376.     }
  4377. };
  4378. Listview.extraCols = {
  4379.     cost: {
  4380.         id: "cost",
  4381.         name: LANG.cost,
  4382.         getValue: function(a) {
  4383.             return (a.cost[3] ? a.cost[3][0][1] : 0) || a.cost[2] || a.cost[1] || a.cost[0]
  4384.         },
  4385.         compute: function(a, b) {
  4386.             Listview.funcBox.appendMoney(b, a.cost[0], null, a.cost[1], a.cost[2], a.cost[3])
  4387.         },
  4388.         sortFunc: function(d, c, e) {
  4389.             var g = 0,
  4390.                 f = 0;
  4391.             if (d.cost[3] != null) {
  4392.                 array_walk(d.cost[3], function(a, b, j, h) {
  4393.                     g += Math.pow(10, h) + a[1]
  4394.                 })
  4395.             }
  4396.             if (c.cost[3] != null) {
  4397.                 array_walk(c.cost[3], function(a, b, j, h) {
  4398.                     f += Math.pow(10, h) + a[1]
  4399.                 })
  4400.             }
  4401.             return strcmp(g, f) || strcmp(d.cost[2], c.cost[2]) || strcmp(d.cost[1], c.cost[1]) || strcmp(d.cost[0], c.cost[0])
  4402.         }
  4403.     },
  4404.     count: {
  4405.         id: "count",
  4406.         name: LANG.count,
  4407.         width: "11%",
  4408.         value: "count",
  4409.         compute: function(b, c) {
  4410.             if (!(this._totalCount > 0 || b.outof > 0)) {
  4411.                 return
  4412.             }
  4413.             if (b.outof) {
  4414.                 var a = ce("div");
  4415.                 a.className = "small q0";
  4416.                 ae(a, ct(sprintf(LANG.lvdrop_outof, b.outof)));
  4417.                 ae(c, a)
  4418.             }
  4419.             return b.count
  4420.         },
  4421.         getVisibleText: function(a) {
  4422.             var b = a.count;
  4423.             if (a.outof) {
  4424.                 b += " " + a.outof
  4425.             }
  4426.             return b
  4427.         }
  4428.     },
  4429.     percent: {
  4430.         id: "percent",
  4431.         name: "%",
  4432.         width: "10%",
  4433.         value: "percent",
  4434.         compute: function(a, b) {
  4435.             if (a.count == -1) {
  4436.                 return "??"
  4437.             }
  4438.             if (a.percent >= 1.95) {
  4439.                 return a.percent.toFixed(0)
  4440.             } else if (a.percent < 0) {
  4441.                 return ((-1 * a.percent) + ' (' + LANG.types[5][0] + ')')
  4442.             } else {
  4443.                 return parseFloat(a.percent.toFixed(1))
  4444.             }
  4445.         },
  4446.         sortFunc: function(d, c, e) {
  4447.             return strcmp(Math.abs(d.percent), Math.abs(c.percent))
  4448.         },
  4449.         getVisibleText: function(a) {
  4450.             if (a.count == -1) {
  4451.                 return "??"
  4452.             }
  4453.             if (a.percent >= 1.95) {
  4454.                 return a.percent.toFixed(0)
  4455.             } else if (a.percent < 0) {
  4456.                 return ((-1 * a.percent) + ' (' + LANG.types[5][0] + ')')
  4457.             } else {
  4458.                 return parseFloat(a.percent.toFixed(1))
  4459.             }
  4460.         }
  4461.     },
  4462.     stock: {
  4463.         id: "stock",
  4464.         name: LANG.stock,
  4465.         width: "10%",
  4466.         value: "stock",
  4467.         compute: function(a, b) {
  4468.             if (a.stock > 0) {
  4469.                 return a.stock
  4470.             } else {
  4471.                 b.style.fontFamily = "Verdana, sans-serif";
  4472.                 return String.fromCharCode(8734)
  4473.             }
  4474.         },
  4475.         getVisibleText: function(a) {
  4476.             if (a.stock > 0) {
  4477.                 return a.stock
  4478.             } else {
  4479.                 return String.fromCharCode(8734) + " infinity"
  4480.             }
  4481.         }
  4482.     },
  4483.     mode: {
  4484.         id: "mode",
  4485.         name: "Mode",
  4486.         after: "name",
  4487.         type: "text",
  4488.         compute: function(b, c) {
  4489.             if (b.modes && b.modes.mode) {
  4490.                 if ((b.modes.mode & 120) == 120 || (b.modes.mode & 3) == 3) {
  4491.                     return LANG.pr_note_all
  4492.                 }
  4493.                 return Listview.extraCols.mode.getVisibleText(b)
  4494.             }
  4495.         },
  4496.         getVisibleText: function(g) {
  4497.             var b = !!(g.modes.mode & 26);
  4498.             var h = !!(g.modes.mode & 97);
  4499.             var f = !!(g.modes.mode & 40);
  4500.             var c = !!(g.modes.mode & 80);
  4501.             var e;
  4502.             if (f && !c) {
  4503.                 e = 10
  4504.             } else {
  4505.                 if (c && !f) {
  4506.                     e = 25
  4507.                 }
  4508.             }
  4509.             var d;
  4510.             if (b && !h) {
  4511.                 d = "normal"
  4512.             } else {
  4513.                 if (h && !b) {
  4514.                     d = "heroic"
  4515.                 }
  4516.             }
  4517.             if (d) {
  4518.                 if (e) {
  4519.                     return sprintf(LANG["tab_" + d + "X"], e)
  4520.                 } else {
  4521.                     return LANG["tab_" + d]
  4522.                 }
  4523.             }
  4524.             if (e) {
  4525.                 return sprintf(LANG.lvzone_xman, e)
  4526.             }
  4527.             return LANG.pr_note_all
  4528.         },
  4529.         sortFunc: function(d, c, e) {
  4530.             return -strcmp(d.modes.mode, c.modes.mode)
  4531.         }
  4532.     }
  4533. };
  4534. Listview.funcBox = {
  4535.     createSimpleCol: function(c, d, a, b) {
  4536.         return {
  4537.             id: c,
  4538.             name: LANG[d],
  4539.             width: a,
  4540.             value: b
  4541.         }
  4542.     },
  4543.     initLootTable: function(b) {
  4544.         var a;
  4545.         if (this._totalCount != null) {
  4546.             a = this._totalCount
  4547.         } else {
  4548.             a = b.outof
  4549.         }
  4550.         if (a == 0) {
  4551.             if (b.count != -1) {} else {}
  4552.         } else {}(Listview.funcBox.initModeFilter.bind(this, b))()
  4553.     },
  4554.     assocArrCmp: function(e, d, c) {
  4555.         if (e == null) {
  4556.             return -1
  4557.         } else {
  4558.             if (d == null) {
  4559.                 return 1
  4560.             }
  4561.         }
  4562.         var h = Math.max(e.length, d.length);
  4563.         for (var g = 0; g < h; ++g) {
  4564.             if (e[g] == null) {
  4565.                 return -1
  4566.             } else {
  4567.                 if (d[g] == null) {
  4568.                     return 1
  4569.                 }
  4570.             }
  4571.             var f = strcmp(c[e[g]], c[d[g]]);
  4572.             if (f != 0) {
  4573.                 return f
  4574.             }
  4575.         }
  4576.         return 0
  4577.     },
  4578.     assocBinFlags: function(d, a) {
  4579.         var c = [];
  4580.         for (var b in a) {
  4581.             if (!isNaN(b) && (d & 1 << b - 1)) {
  4582.                 c.push(b)
  4583.             }
  4584.         }
  4585.         c.sort(function(f, e) {
  4586.             return strcmp(a[f], a[e])
  4587.         });
  4588.         return c
  4589.     },
  4590.     location: function(f, g) {
  4591.         if (f.location == null) {
  4592.             return -1
  4593.         }
  4594.         for (var d = 0, b = f.location.length; d < b; ++d) {
  4595.             if (d > 0) {
  4596.                 ae(g, ct(LANG.comma))
  4597.             }
  4598.             var e = f.location[d];
  4599.             if (e == -1) {
  4600.                 ae(g, ct(LANG.ellipsis))
  4601.             } else {
  4602.                 var c = ce("a");
  4603.                 c.className = "q1";
  4604.                 c.href = "zone=" + e;
  4605.                 ae(c, ct(openDB_zones[e]));
  4606.                 ae(g, c)
  4607.             }
  4608.         }
  4609.     },
  4610.     arrayText: function(b, e) {
  4611.         if (b == null) {
  4612.             return
  4613.         }
  4614.         var d = "";
  4615.         for (var c = 0, a = b.length; c < a; ++c) {
  4616.             if (c > 0) {
  4617.                 d += " "
  4618.             }
  4619.             if (!e[b[c]]) {
  4620.                 continue
  4621.             }
  4622.             d += e[b[c]]
  4623.         }
  4624.         return d
  4625.     },
  4626.     createCenteredIcons: function(k, f, t, o) {
  4627.         if (k != null) {
  4628.             var n = ce("div"),
  4629.                 b = ce("div");
  4630.             ae(document.body, n);
  4631.             if (t && (k.length != 1 || o != 2)) {
  4632.                 var m = ce("div");
  4633.                 m.style.position = "relative";
  4634.                 m.style.width = "1px";
  4635.                 var p = ce("div");
  4636.                 p.className = "q0";
  4637.                 p.style.position = "absolute";
  4638.                 p.style.right = "2px";
  4639.                 p.style.lineHeight = "26px";
  4640.                 p.style.fontSize = "11px";
  4641.                 p.style.whiteSpace = "nowrap";
  4642.                 ae(p, ct(t));
  4643.                 ae(m, p);
  4644.                 ae(n, m);
  4645.                 n.style.paddingLeft = $j(p).width() + "px"
  4646.             }
  4647.             var j = openDB_items;
  4648.             if (o == 1) {
  4649.                 j = openDB_spells
  4650.             }
  4651.             for (var g = 0, l = k.length; g < l; ++g) {
  4652.                 var q;
  4653.                 if (k[g] == null) {
  4654.                     q = ce("div");
  4655.                     q.style.width = q.style.height = "26px"
  4656.                 } else {
  4657.                     var e, h;
  4658.                     if (typeof k[g] == "object") {
  4659.                         e = k[g][0];
  4660.                         h = k[g][1]
  4661.                     } else {
  4662.                         e = k[g]
  4663.                     }
  4664.                     if (e) {
  4665.                         q = j.createIcon(e, 0, h)
  4666.                     } else {
  4667.                         q = Icon.create("inventoryslot_empty", 0, null, "javascript:;")
  4668.                     }
  4669.                 }
  4670.                 if (k.length == 1 && o == 2) {
  4671.                     if (e && openDB_items[e]) {
  4672.                         ee(n);
  4673.                         var u = openDB_items[e],
  4674.                             r = ce("a"),
  4675.                             c = ce("span");
  4676.                         c.style.paddingTop = "4px";
  4677.                         r.href = "/item=" + e;
  4678.                         r.className = "q" + u.quality + " icontiny";
  4679.                         r.style.backgroundImage = "url(http://cdn.openwow.com/" + qsUrl + "/icons/tiny/" + u.icon.toLowerCase() + ".gif)";
  4680.                         r.style.whiteSpace = "nowrap";
  4681.                         st(r, u["name_enus"]);
  4682.                         ae(c, r);
  4683.                         if (h > 1) {
  4684.                             ae(c, ct(" (" + h + ")"))
  4685.                         }
  4686.                         if (t) {
  4687.                             var m = ce("span");
  4688.                             m.className = "q0";
  4689.                             m.style.fontSize = "11px";
  4690.                             m.style.whiteSpace = "nowrap";
  4691.                             ae(m, ct(t));
  4692.                             ae(n, m);
  4693.                             c.style.paddingLeft = $j(p).width() + "px"
  4694.                         }
  4695.                         ae(n, c)
  4696.                     }
  4697.                 } else {
  4698.                     q.style.cssFloat = q.style.styleFloat = "left";
  4699.                     ae(n, q);
  4700.                     n.style.margin = "0 auto";
  4701.                     n.style.textAlign = "left";
  4702.                     n.style.width = (26 * k.length) + "px"
  4703.                 }
  4704.             }
  4705.             b.className = "clear";
  4706.             ae(f, n);
  4707.             ae(f, b);
  4708.             return true
  4709.         }
  4710.     },
  4711.     createSocketedIcons: function(b, e, c, g, n) {
  4712.         var m = 0,
  4713.             k = ce("div"),
  4714.             a = ce("div");
  4715.         for (var f = 0, h = b.length; f < h; ++f) {
  4716.             var l, j = c[f];
  4717.             if (!c || !j) {
  4718.                 l = Icon.create(null, 0, null, "javascript:;")
  4719.             } else {
  4720.                 if (openDB_items[j]) {
  4721.                     l = openDB_items.createIcon(j, 0)
  4722.                 } else {
  4723.                     l = Icon.create(openDB_gems[j].icon, 0, null, "item=" + j)
  4724.                 }
  4725.             }
  4726.             l.className += " iconsmall-socket-" + openDB_file_gems[b[f]] + (!c || !j ? "-empty" : "");
  4727.             l.style.cssFloat = l.style.styleFloat = "left";
  4728.             if (g && g[f]) {
  4729.                 l.insertBefore(ce("var"), l.childNodes[1]);
  4730.                 ++m
  4731.             }
  4732.             ae(k, l)
  4733.         }
  4734.         k.style.margin = "0 auto";
  4735.         k.style.textAlign = "left";
  4736.         k.style.width = (26 * b.length) + "px";
  4737.         a.className = "clear";
  4738.         ae(e, k);
  4739.         ae(e, a);
  4740.         if (n && m == b.length) {
  4741.             k = ce("div");
  4742.             k.style.paddingTop = "4px";
  4743.             ae(k, ct(n));
  4744.             ae(e, k)
  4745.         }
  4746.     },
  4747.     getItemType: function(c, a, b) {
  4748.         if (b != null && openDB_item_subsubclasses[c] != null && openDB_item_subsubclasses[c][a] != null) {
  4749.             return {
  4750.                 url: "items=" + c + "." + a + "." + b,
  4751.                 text: openDB_item_subsubclasses[c][a][b]
  4752.             }
  4753.         }
  4754.         if (openDB_item_subclasses[c] != null) {
  4755.             return {
  4756.                 url: "items=" + c + "." + a,
  4757.                 text: openDB_item_subclasses[c][a]
  4758.             }
  4759.         } else {
  4760.             return {
  4761.                 url: "items=" + c,
  4762.                 text: openDB_item_classes[c]
  4763.             }
  4764.         }
  4765.     },
  4766.     getQuestCategory: function(a) {
  4767.         if (a > 0) {
  4768.             return openDB_zones[a]
  4769.         } else {
  4770.             return openDB_quest_sorts[a]
  4771.         }
  4772.     },
  4773.     getFactionCategory: function(b, a) {
  4774.         if (b) {
  4775.             return openDB_faction_categories[b]
  4776.         } else {
  4777.             return openDB_faction_categories[a]
  4778.         }
  4779.     },
  4780.     createTextRange: function(b, a) {
  4781.         b |= 0;
  4782.         a |= 0;
  4783.         if (b > 1 || a > 1) {
  4784.             if (b != a && a > 0) {
  4785.                 return b + "-" + a
  4786.             } else {
  4787.                 return b + ""
  4788.             }
  4789.         }
  4790.         return null
  4791.     },
  4792.     coReport: function(c, d, f) {
  4793.         if (!openDB_user.id || !openDB_report_reasons[f]) {
  4794.             return
  4795.         }
  4796.         var a = "";
  4797.         if (f == 4) {
  4798.             a = prompt(LANG.prompt_details, "")
  4799.         } else {
  4800.             if (!confirm(sprintf((c == 0 ? LANG.confirm_report : LANG.confirm_report2), openDB_report_reasons[f]))) {
  4801.                 return
  4802.             }
  4803.         }
  4804.         if (a != null) {
  4805.             var e = "report&type=" + c + "&typeid=" + d.id + "&reason=" + f;
  4806.             if (a) {
  4807.                 e += "&reasonmore=" + urlencode(a)
  4808.             }
  4809.             new Ajax(e);
  4810.             var b = ce("span");
  4811.             ae(b, ct(LANG.lvcomment_reported));
  4812.             this.parentNode.replaceChild(b, this)
  4813.         }
  4814.     },
  4815.     coReportClick: function(b, a, c) {
  4816.         this.menu = [
  4817.             [2, openDB_report_reasons[2], Listview.funcBox.coReport.bind(this, a, b, 2)],
  4818.             [1, openDB_report_reasons[1], Listview.funcBox.coReport.bind(this, a, b, 1)],
  4819.             [3, openDB_report_reasons[3], Listview.funcBox.coReport.bind(this, a, b, 3)],
  4820.             [4, openDB_report_reasons[4], Listview.funcBox.coReport.bind(this, a, b, 4)]
  4821.         ];
  4822.         if (a == 1 && b.op && typeof openDB_pageInfo != "undefined" && !openDB_pageInfo.sticky) {
  4823.             this.menu.splice(3, 0, [0, openDB_report_reasons[0], Listview.funcBox.coReport.bind(this, a, b, 0)])
  4824.         }(Menu.showAtCursor.bind(this, c))()
  4825.     },
  4826.     coGetColor: function(c, a) {
  4827.         if (c.user && openDB_customColors[c.user]) {
  4828.             return " comment-" + openDB_customColors[c.user]
  4829.         }
  4830.         switch (a) {
  4831.             case -1:
  4832.                 var b = c.divPost.childNodes[1].className.match(/comment-([a-z]+)/);
  4833.                 if (b != null) {
  4834.                     return " comment-" + b[1]
  4835.                 }
  4836.                 break;
  4837.             case 3:
  4838.             case 4:
  4839.                 if (c.roles & 56) {
  4840.                     return " comment-green"
  4841.                 } else {
  4842.                     if (c.roles & 64) {
  4843.                         return " comment-gold"
  4844.                     }
  4845.                 }
  4846.                 break
  4847.         }
  4848.         if (c.roles & 2) {
  4849.             return " comment-blue"
  4850.         } else {
  4851.             if (c.rating >= 10) {
  4852.                 return " comment-green"
  4853.             } else {
  4854.                 if (c.rating < 0) {
  4855.                     return " comment-bt"
  4856.                 }
  4857.             }
  4858.         }
  4859.         return ""
  4860.     },
  4861.     coToggleVis: function(b) {
  4862.         this.firstChild.nodeValue = (openDB_toggleDisplay(b.divBody) ? LANG.lvcomment_hide : LANG.lvcomment_show);
  4863.         var a = b.divHeader.firstChild.lastChild;
  4864.         if (b.ratable) {
  4865.             a.style.display = ""
  4866.         } else {
  4867.             if (b.deleted || b.purged) {
  4868.                 a.style.fontWeight = "normal";
  4869.                 a.className = "q10";
  4870.                 a.innerHTML = (b.deleted ? LANG.lvcomment_deleted : LANG.lvcomment_purged);
  4871.                 a.style.display = ""
  4872.             }
  4873.         }
  4874.         openDB_toggleDisplay(b.divLinks);
  4875.         if (b.lastEdit != null) {
  4876.             openDB_toggleDisplay(b.divLastEdit)
  4877.         }
  4878.     },
  4879.     coDisplayRating: function(d, c) {
  4880.         if (typeof(d._ratingMode) == "undefined") {
  4881.             d._ratingMode = 0
  4882.         }
  4883.         if (typeof(Listview._ratings) == "undefined") {
  4884.             Listview._ratings = {}
  4885.         }
  4886.         var a = $j(c);
  4887.         var e = d._ratingMode;
  4888.         if (e == 0) {
  4889.             if (d.rating < 0) {
  4890.                 a.text(d.rating)
  4891.             } else {
  4892.                 a.text("+" + d.rating)
  4893.             }
  4894.         }
  4895.         if (e == 1) {
  4896.             if (Listview._ratings[d.id] !== undefined) {
  4897.                 var b = Listview._ratings[d.id];
  4898.                 a.text("+" + b.up + " / -" + b.down)
  4899.             } else {
  4900.                 $.ajax({
  4901.                     url: "/form=comment&method=rating&id=" + d.id,
  4902.                     dataType: "json",
  4903.                     success: function(i, f, h, g) {
  4904.                         if (f.success) {
  4905.                             Listview._ratings[i] = f;
  4906.                             this.text("+" + f.up + " / -" + f.down)
  4907.                         } else {
  4908.                             this.text("Error!")
  4909.                         }
  4910.                     }.bind(a, d.id)
  4911.                 });
  4912.                 a.html('<img src="http://cdn.openwow.com/images/ajax.gif" />')
  4913.             }
  4914.         }
  4915.     },
  4916.     coToggleRating: function(b, a) {
  4917.         if (typeof(b._ratingMode) == "undefined") {
  4918.             b._ratingMode = 0
  4919.         }
  4920.         if (++b._ratingMode > 1) {
  4921.             b._ratingMode = 0
  4922.         }
  4923.         Listview.funcBox.coDisplayRating(b, a)
  4924.     },
  4925.     coRate: function(f, a) {
  4926.         if (a == 0) {
  4927.             var d = 5;
  4928.             if (openDB_user.roles & U_GROUP_ADMIN) {
  4929.                 d = 25
  4930.             } else {
  4931.                 if (openDB_user.roles & U_GROUP_BUREAU) {
  4932.                     d = 15
  4933.                 }
  4934.             }
  4935.             var e = prompt(sprintf(LANG.prompt_customrating, d, d), 0);
  4936.             if (e == null) {
  4937.                 return
  4938.             } else {
  4939.                 e |= 0;
  4940.                 if (e != 0 && Math.abs(e) <= d) {
  4941.                     a = e
  4942.                 }
  4943.             }
  4944.             if (a == 0) {
  4945.                 return
  4946.             }
  4947.         } else {
  4948.             if (openDB_user.roles & U_GROUP_COMMENTS_MODERATOR) {
  4949.                 a *= 5
  4950.             }
  4951.         }
  4952.         f.rating += a;
  4953.         f.raters.push([openDB_user.id, a]);
  4954.         var b = f.divHeader.firstChild;
  4955.         Tooltip.hide();
  4956.         b = b.childNodes[b.childNodes.length - 3];
  4957.         var c = ge("commentrating" + f.id);
  4958.         Listview.funcBox.coDisplayRating(f, c);
  4959.         de(b.nextSibling);
  4960.         de(b.nextSibling);
  4961.         $.post("/form=comment&method=rate", {
  4962.             id: f.id,
  4963.             rating: a
  4964.         }, function(g) {
  4965.             if (g == "0") {} else {
  4966.                 if (g == "1") {
  4967.                     $(b).html(LANG.tooltip_banned_rating)
  4968.                 } else {
  4969.                     if (g == "3") {
  4970.                         $(b).html(LANG.tooltip_too_many_votes)
  4971.                     } else {
  4972.                         $(b).html(LANG.genericerror)
  4973.                     }
  4974.                 }
  4975.             }
  4976.             AchievementCheck()
  4977.         })
  4978.     },
  4979.     coRate: function(e, a) {
  4980.         if (a == 0) {
  4981.             var c = 5;
  4982.             if (openDB_user.roles & 2) {
  4983.                 c = 25
  4984.             } else {
  4985.                 if (openDB_user.roles & 16) {
  4986.                     c = 15
  4987.                 }
  4988.             }
  4989.             var d = prompt(sprintf(LANG.prompt_customrating, c, c), 0);
  4990.             if (d == null) {
  4991.                 return
  4992.             } else {
  4993.                 d |= 0;
  4994.                 if (d != 0 && Math.abs(d) <= c) {
  4995.                     a = d
  4996.                 }
  4997.             }
  4998.             if (a == 0) {
  4999.                 return
  5000.             }
  5001.         } else {
  5002.             if (openDB_user.roles & 26) {
  5003.                 a *= 5
  5004.             }
  5005.         }
  5006.         new Ajax("/form=comment&method=rate&id=" + e.id + "&rating=" + a);
  5007.         e.rating += a;
  5008.         var b = e.divHeader.firstChild;
  5009.         b = b.childNodes[b.childNodes.length - 3];
  5010.         b.lastChild.firstChild.nodeValue = (e.rating > 0 ? "+" : "") + e.rating;
  5011.         Tooltip.hide();
  5012.         de(b.nextSibling);
  5013.         de(b.nextSibling)
  5014.     },
  5015.     coDelete: function(a) {
  5016.         if (a.purged) {
  5017.             alert(LANG.message_cantdeletecomment)
  5018.         } else {
  5019.             if (confirm(LANG.confirm_deletecomment)) {
  5020.                 new Ajax("form=comment&method=delete&id=" + a.id);
  5021.                 this.deleteRows([a])
  5022.             }
  5023.         }
  5024.     },
  5025.     coDetach: function(a) {
  5026.         if (a.replyTo == 0) {
  5027.             alert(LANG.message_cantdetachcomment)
  5028.         } else {
  5029.             if (confirm(LANG.confirm_detachcomment)) {
  5030.                 new Ajax("form=comment&method=detach&id=" + a.id);
  5031.                 a.replyTo = 0;
  5032.                 alert(LANG.message_commentdetached)
  5033.             }
  5034.         }
  5035.     },
  5036.     coEdit: function(g, e, c) {
  5037.         if (!c) {
  5038.             g.divBody.style.display = "none";
  5039.             g.divResponse.style.display = "none";
  5040.             g.divLinks.firstChild.style.display = "none"
  5041.         } else {
  5042.             g.divBody.hide();
  5043.             g.divResponse.hide()
  5044.         }
  5045.         var f = $j("<div/>");
  5046.         f.addClass("comment-edit");
  5047.         g.divEdit = f[0];
  5048.         if (e == -1) {
  5049.             if (openDB_users[g.user] != null) {
  5050.                 g.roles = openDB_users[g.user].roles
  5051.             }
  5052.         }
  5053.         var a = Listview.funcBox.coEditAppend(f, g, e, c);
  5054.         var b = $j("<div/>");
  5055.         b.addClass("comment-edit-buttons");
  5056.         var d = $j("<button/>", {
  5057.             text: LANG.compose_save
  5058.         });
  5059.         d.click(Listview.funcBox.coEditButton.bind(d[0], g, true, e, c));
  5060.         b.append(d);
  5061.         b.append(ct(" "));
  5062.         d = $j("<button/>", {
  5063.             text: LANG.compose_cancel
  5064.         });
  5065.         d.click(Listview.funcBox.coEditButton.bind(d[0], g, false, e, c));
  5066.         b.append(d);
  5067.         f.append(b);
  5068.         f.insertAfter(g.divBody);
  5069.         a.focus()
  5070.     },
  5071.     coEditAppend: function(u, d, t, G, g) {
  5072.         var l = Listview.funcBox.coGetCharLimit(t);
  5073.         if (t == 1 || t == 3 || t == 4) {
  5074.             d.user = openDB_user.name;
  5075.             d.roles = openDB_user.roles;
  5076.             d.rating = 1
  5077.         } else {
  5078.             if (t == 2) {
  5079.                 d.roles = openDB_user.roles;
  5080.                 d.rating = 1
  5081.             }
  5082.         }
  5083.         if (g) {
  5084.             d.roles &= ~U_GROUP_PENDING
  5085.         }
  5086.         if (t == -1 || t == 0) {
  5087.             var o = $j("<div/>", {
  5088.                 text: LANG.compose_mode
  5089.             });
  5090.             o.addClass("comment-edit-modes");
  5091.             var z = $j("<a/>", {
  5092.                 href: "javascript:;",
  5093.                 text: LANG.compose_edit
  5094.             });
  5095.             z.click(Listview.funcBox.coModeLink.bind(z[0], 1, t, d));
  5096.             z.addClass("selected");
  5097.             o.append(z);
  5098.             o.append(ct("|"));
  5099.             var I = $j("<a/>", {
  5100.                 href: "javascript:;",
  5101.                 text: LANG.compose_preview
  5102.             });
  5103.             I.click(Listview.funcBox.coModeLink.bind(I[0], 2, t, d));
  5104.             o.append(I);
  5105.             u.append(o)
  5106.         }
  5107.         var a = $j("<div/>", {
  5108.             css: {
  5109.                 display: "none"
  5110.             }
  5111.         });
  5112.         a.addClass("text comment-body" + Listview.funcBox.coGetColor(d, t, G));
  5113.         var n = $j("<div/>");
  5114.         n.addClass("comment-edit-body");
  5115.         var k = $j('<div style="float: left" />');
  5116.         k.addClass("toolbar");
  5117.         var e = $j('<div style="float: left" />');
  5118.         e.addClass("menu-buttons");
  5119.         var m = $j("<textarea/>", {
  5120.             val: d.body,
  5121.             rows: 10,
  5122.             css: {
  5123.                 clear: "left"
  5124.             }
  5125.         });
  5126.         m.addClass("comment-editbox");
  5127.         switch (t) {
  5128.             case 1:
  5129.                 m.attr("name", "commentbody");
  5130.                 break;
  5131.             case 2:
  5132.                 m.attr({
  5133.                     name: "desc",
  5134.                     originalValue: d.body
  5135.                 });
  5136.                 break;
  5137.             case 3:
  5138.                 m.attr("name", "body");
  5139.                 break;
  5140.             case 4:
  5141.                 m.attr({
  5142.                     name: "sig",
  5143.                     originalValue: d.body,
  5144.                     rows: 3
  5145.                 });
  5146.                 m.css("height", "auto");
  5147.                 break
  5148.         }
  5149.         if (t != -1 && t != 0) {
  5150.             var h = $j("<h3/>"),
  5151.                 J = $j("<a/>"),
  5152.                 F = $j("<div/>"),
  5153.                 E = $j("<div/>"),
  5154.                 j = screen.availWidth <= 480;
  5155.             var f = Listview.funcBox.coLivePreview.bind(m[0], d, t, F[0]);
  5156.             J.addClass("disclosure-" + (j ? "off" : "on"));
  5157.             J.text(LANG.compose_livepreview);
  5158.             h.append(J);
  5159.             J.attr("href", "javascript:;");
  5160.             h.addClass("first");
  5161.             E.addClass("pad");
  5162.             a.append(h);
  5163.             a.append(F);
  5164.             a.append(E);
  5165.             openDB_onAfterTyping(m[0], f, 50);
  5166.             m.focus(function() {
  5167.                 f();
  5168.                 a.css("display", (j ? "none" : ""));
  5169.                 if (t != 4) {
  5170.                     m.css("height", "14em")
  5171.                 }
  5172.             })
  5173.         } else {
  5174.             if (t != 4) {
  5175.                 m.focus(function() {
  5176.                     m.css("height", "14em")
  5177.                 })
  5178.             }
  5179.         }
  5180.         var D = [{
  5181.             id: "b",
  5182.             title: LANG.markup_b,
  5183.             pre: "[b]",
  5184.             post: "[/b]"
  5185.         }, {
  5186.             id: "i",
  5187.             title: LANG.markup_i,
  5188.             pre: "[i]",
  5189.             post: "[/i]"
  5190.         }, {
  5191.             id: "u",
  5192.             title: LANG.markup_u,
  5193.             pre: "[u]",
  5194.             post: "[/u]"
  5195.         }, {
  5196.             id: "s",
  5197.             title: LANG.markup_s,
  5198.             pre: "[s]",
  5199.             post: "[/s]"
  5200.         }, {
  5201.             id: "small",
  5202.             title: LANG.markup_small,
  5203.             pre: "[small]",
  5204.             post: "[/small]"
  5205.         }, {
  5206.             id: "url",
  5207.             title: LANG.markup_url,
  5208.             nopending: true,
  5209.             onclick: function() {
  5210.                 var i = prompt(LANG.prompt_linkurl, "http://");
  5211.                 if (i) {
  5212.                     openDB_insertTag(m[0], "[url=" + i + "]", "[/url]")
  5213.                 }
  5214.             }
  5215.         }, {
  5216.             id: "quote",
  5217.             title: LANG.markup_quote,
  5218.             pre: "[quote]",
  5219.             post: "[/quote]"
  5220.         }, {
  5221.             id: "code",
  5222.             title: LANG.markup_code,
  5223.             pre: "[code]",
  5224.             post: "[/code]"
  5225.         }, {
  5226.             id: "ul",
  5227.             title: LANG.markup_ul,
  5228.             pre: "[ul]\n[li]",
  5229.             post: "[/li]\n[/ul]",
  5230.             rep: function(i) {
  5231.                 return i.replace(/\n/g, "[/li]\n[li]")
  5232.             }
  5233.         }, {
  5234.             id: "ol",
  5235.             title: LANG.markup_ol,
  5236.             pre: "[ol]\n[li]",
  5237.             post: "[/li]\n[/ol]",
  5238.             rep: function(i) {
  5239.                 return i.replace(/\n/g, "[/li]\n[li]")
  5240.             }
  5241.         }, {
  5242.             id: "li",
  5243.             title: LANG.markup_li,
  5244.             pre: "[li]",
  5245.             post: "[/li]"
  5246.         }];
  5247.         if (!G) {
  5248.             for (var B = 0, C = D.length; B < C; ++B) {
  5249.                 var q = D[B];
  5250.                 if (t == 4 && q.id == "quote") {
  5251.                     break
  5252.                 }
  5253.                 if (q.nopending) {
  5254.                     continue
  5255.                 }
  5256.                 var v = $j("<button/>", {
  5257.                     click: function(i, L) {
  5258.                         L.preventDefault();
  5259.                         (i.onclick != null ? i.onclick : openDB_insertTag.bind(0, m[0], i.pre, i.post, i.rep))()
  5260.                     }.bind(null, q)
  5261.                 });
  5262.                 v[0].setAttribute("type", "button");
  5263.                 var K = $j("<img/>");
  5264.                 v.attr("title", q.title);
  5265.                 K.attr("src", "http://cdn.openwow.com/images/pixel.gif");
  5266.                 K.addClass("toolbar-" + q.id);
  5267.                 v.append(K);
  5268.                 k.append(v)
  5269.             }
  5270.         } else {
  5271.             for (var B = 0, C = D.length; B < C; ++B) {
  5272.                 var q = D[B];
  5273.                 if ((openDB_user.rolls & U_GROUP_PENDING) && q.nopending) {
  5274.                     continue
  5275.                 }
  5276.                 var H = "tb-" + q.id;
  5277.                 var v = $j("<button/>", {
  5278.                     click: function(i, L) {
  5279.                         L.preventDefault();
  5280.                         (i.onclick != null ? i.onclick : openDB_insertTag.bind(0, m[0], i.pre, i.post, i.rep))()
  5281.                     }.bind(null, q),
  5282.                     "class": H,
  5283.                     title: q.title
  5284.                 });
  5285.                 v[0].setAttribute("type", "button");
  5286.                 v.append("<ins/>");
  5287.                 k.append(v)
  5288.             }
  5289.             k.addClass("formatting button sm")
  5290.         }
  5291.         var r = function(L, i) {
  5292.             var M = prompt(sprintf(LANG.markup_prompt, L), "");
  5293.             if (M != null) {
  5294.                 openDB_insertTag(m[0], "[" + i + "=" + (parseInt(M) || 0) + "]", "")
  5295.             }
  5296.         };
  5297.         var c = [
  5298.             [0, LANG.markup_links, , [
  5299.                 [9, LANG.types[10][0] + "...", r.bind(null, LANG.types[10][1], "achievement")],
  5300.                 [7, LANG.types[8][0] + "...", r.bind(null, LANG.types[8][1], "faction")],
  5301.                 [0, LANG.types[3][0] + "...", r.bind(null, LANG.types[3][1], "item")],
  5302.                 [1, LANG.types[4][0] + "...", r.bind(null, LANG.types[4][1], "itemset")],
  5303.                 [2, LANG.types[1][0] + "...", r.bind(null, LANG.types[1][1], "npc")],
  5304.                 [3, LANG.types[2][0] + "...", r.bind(null, LANG.types[2][1], "object")],
  5305.                 [8, LANG.types[9][0] + "...", r.bind(null, LANG.types[9][1], "pet")],
  5306.                 [4, LANG.types[5][0] + "...", r.bind(null, LANG.types[5][1], "quest")],
  5307.                 [5, LANG.types[6][0] + "...", r.bind(null, LANG.types[6][1], "spell")],
  5308.                 [6, LANG.types[7][0] + "...", r.bind(null, LANG.types[7][1], "zone")]
  5309.             ]]
  5310.         ];
  5311.         n.append(k);
  5312.         n.append(e);
  5313.         n.append($j('<div style="clear: left" />'));
  5314.         n.append(m);
  5315.         n.append($j("<br/>"));
  5316.         if (t == 4) {
  5317.             n.append(ct(sprintf(LANG.compose_limit2, l, 3)))
  5318.         } else {
  5319.             n.append(ct(sprintf(LANG.compose_limit, l)))
  5320.         }
  5321.         var A = $j('<span class="comment-remaining"> ' + sprintf(LANG.compose_remaining, l - d.body.length) + "</span>");
  5322.         n.append(A);
  5323.         m.keyup(Listview.funcBox.coUpdateCharLimit.bind(0, m, A, l));
  5324.         m.keydown(Listview.funcBox.coUpdateCharLimit.bind(0, m, A, l));
  5325.         u.append(n);
  5326.         u.append($j("<br/>"));
  5327.         u.append(a);
  5328.         return m
  5329.     },
  5330.     coLivePreview: function(f, e, a, b) {
  5331.         if (b != 1 && a.style.display == "none") {
  5332.             return
  5333.         }
  5334.         var c = this,
  5335.             i = Listview.funcBox.coGetCharLimit(e),
  5336.             g = (c.value.length > i ? c.value.substring(0, i) : c.value);
  5337.         if (e == 4) {
  5338.             var h;
  5339.             if ((h = g.indexOf("\n")) != -1 && (h = g.indexOf("\n", h + 1)) != -1 && (h = g.indexOf("\n", h + 1)) != -1) {
  5340.                 g = g.substring(0, h)
  5341.             }
  5342.         }
  5343.         var d = Markup.toHtml(g, {
  5344.             mode: Markup.MODE_COMMENT,
  5345.             roles: f.roles
  5346.         });
  5347.         if (d) {
  5348.             a.innerHTML = d
  5349.         } else {
  5350.             a.innerHTML = '<span class="q6">...</span>'
  5351.         }
  5352.     },
  5353.     coEditButton: function(f, d, e) {
  5354.         if (d) {
  5355.             var a = gE(f.divEdit, "textarea")[0];
  5356.             if (!Listview.funcBox.coValidate(a, e)) {
  5357.                 return
  5358.             }
  5359.             if (a.value != f.body) {
  5360.                 var c = 0;
  5361.                 if (f.lastEdit != null) {
  5362.                     c = f.lastEdit[1]
  5363.                 }++c;
  5364.                 f.lastEdit = [openDB_serverTime, c, openDB_user.name];
  5365.                 Listview.funcBox.coUpdateLastEdit(f);
  5366.                 var b = Listview.funcBox.coGetCharLimit(e);
  5367.                 f.divBody.innerHTML = Markup.toHtml((a.value.length > b ? a.value.substring(0, b) : a.value), {
  5368.                     mode: Markup.MODE_COMMENT,
  5369.                     roles: f.roles
  5370.                 });
  5371.                 f.body = a.value;
  5372.                 if (e == -1) {} else {
  5373.                     new Ajax("/form=comment&method=edit&id=" + f.id, {
  5374.                         method: "POST",
  5375.                         params: "commentbody=" + urlencode(f.body)
  5376.                     })
  5377.                 }
  5378.             }
  5379.         }
  5380.         f.divBody.style.display = "";
  5381.         f.divLinks.firstChild.style.display = "";
  5382.         de(f.divEdit);
  5383.         f.divEdit = null
  5384.     },
  5385.     coGetCharLimit: function(a) {
  5386.         switch (a) {
  5387.             case 0:
  5388.             case 1:
  5389.             case 2:
  5390.                 return 7500;
  5391.             case 4:
  5392.                 return 250;
  5393.             default:
  5394.                 return 15000
  5395.         }
  5396.     },
  5397.     coModeLink: function(e, b, f) {
  5398.         var j = Listview.funcBox.coGetCharLimit(e);
  5399.         var c = Markup.MODE_COMMENT;
  5400.         array_walk(gE(this.parentNode, "a"), function(k) {
  5401.             k.className = ""
  5402.         });
  5403.         this.className = "selected";
  5404.         var d = gE(this.parentNode.parentNode, "textarea")[0],
  5405.             i = d.parentNode,
  5406.             a = i.previousSibling;
  5407.         if (b == 4) {
  5408.             c = Markup.MODE_SIGNATURE
  5409.         }
  5410.         switch (e) {
  5411.             case 1:
  5412.                 i.style.display = "";
  5413.                 a.style.display = "none";
  5414.                 i.firstChild.focus();
  5415.                 break;
  5416.             case 2:
  5417.                 i.style.display = "none";
  5418.                 var g = (d.value.length > j ? d.value.substring(0, j) : d.value);
  5419.                 if (b == 4) {
  5420.                     var h;
  5421.                     if ((h = g.indexOf("\n")) != -1 && (h = g.indexOf("\n", h + 1)) != -1 && (h = g.indexOf("\n", h + 1)) != -1) {
  5422.                         g = g.substring(0, h)
  5423.                     }
  5424.                 }
  5425.                 a.innerHTML = Markup.toHtml(g, {
  5426.                     mode: c,
  5427.                     roles: f.roles
  5428.                 });
  5429.                 a.style.display = "";
  5430.                 break
  5431.         }
  5432.     },
  5433.     coReply: function(b) {
  5434.         document.forms.addcomment.elements.replyto.value = b.replyTo;
  5435.         var a = ge("replybox-generic");
  5436.         gE(a, "span")[0].innerHTML = b.user;
  5437.         a.style.display = "";
  5438.         co_addYourComment()
  5439.     },
  5440.     coValidate: function(a, c) {
  5441.         c |= 0;
  5442.         if (c == 1 || c == -1) {
  5443.             if (trim(a.value).length < 1) {
  5444.                 alert(LANG.message_forumposttooshort);
  5445.                 return false
  5446.             }
  5447.         } else {
  5448.             if (trim(a.value).length < 10) {
  5449.                 alert(LANG.message_commenttooshort);
  5450.                 return false
  5451.             }
  5452.         }
  5453.         var b = Listview.funcBox.coGetCharLimit(c);
  5454.         if (a.value.length > b) {
  5455.             if (!confirm(sprintf(c == 1 ? LANG.confirm_forumposttoolong : LANG.confirm_commenttoolong, b, a.value.substring(b - 30, b)))) {
  5456.                 return false
  5457.             }
  5458.         }
  5459.         return true
  5460.     },
  5461.     coCustomRatingOver: function(a) {
  5462.         Tooltip.showAtCursor(a, LANG.tooltip_customrating, 0, 0, "q")
  5463.     },
  5464.     coPlusRatingOver: function(a) {
  5465.         Tooltip.showAtCursor(a, LANG.tooltip_uprate, 0, 0, "q2")
  5466.     },
  5467.     coMinusRatingOver: function(a) {
  5468.         Tooltip.showAtCursor(a, LANG.tooltip_downrate, 0, 0, "q10")
  5469.     },
  5470.     coSortDate: function(a) {
  5471.         a.nextSibling.nextSibling.className = "";
  5472.         a.className = "selected";
  5473.         this.mainDiv.className += " listview-aci";
  5474.         this.setSort([1], true, false)
  5475.     },
  5476.     coSortHighestRatedFirst: function(a) {
  5477.         a.previousSibling.previousSibling.className = "";
  5478.         a.className = "selected";
  5479.         this.mainDiv.className = this.mainDiv.className.replace("listview-aci", "");
  5480.         this.setSort([-3, 2], true, false)
  5481.     },
  5482.     coUpdateCharLimit: function(a, b, c) {
  5483.         var d = $(a).val();
  5484.         if (d.length > c) {
  5485.             $j(a).val(d.substring(0, c))
  5486.         } else {
  5487.             $j(b).html(" " + sprintf(LANG.compose_remaining, c - d.length)).removeClass("q10");
  5488.             if (d.length == c) {
  5489.                 $j(b).addClass("q10")
  5490.             }
  5491.         }
  5492.     },
  5493.     coUpdateLastEdit: function(f) {
  5494.         var b = f.divLastEdit;
  5495.         if (!b) {
  5496.             return
  5497.         }
  5498.         if (f.lastEdit != null) {
  5499.             var e = f.lastEdit;
  5500.             b.childNodes[1].firstChild.nodeValue = e[2];
  5501.             b.childNodes[1].href = "javscript:;";
  5502.             var c = new Date(e[0]);
  5503.             var d = (openDB_serverTime - c) / 1000;
  5504.             if (b.childNodes[3].firstChild) {
  5505.                 de(b.childNodes[3].firstChild)
  5506.             }
  5507.             Listview.funcBox.coFormatDate(b.childNodes[3], d, c);
  5508.             var a = "";
  5509.             if (f.rating != null) {}
  5510.             if (e[1] > 1) {
  5511.                 a += LANG.dash + sprintf(LANG.lvcomment_nedits, e[1])
  5512.             }
  5513.             b.childNodes[4].nodeValue = a;
  5514.             b.style.display = ""
  5515.         } else {
  5516.             b.style.display = "none"
  5517.         }
  5518.     },
  5519.     coFormatDate: function(f, e, b, g, h) {
  5520.         var d;
  5521.         if (e < 2592000) {
  5522.             var a = sprintf(LANG.date_ago, openDB_formatTimeElapsed(e));
  5523.             var c = new Date();
  5524.             c.setTime(b.getTime() + (openDB_localTime - openDB_serverTime));
  5525.             f.style.cursor = "help";
  5526.             f.title = c.toLocaleString()
  5527.         } else {
  5528.             a = LANG.date_on + openDB_formatDateSimple(b, g)
  5529.         }
  5530.         if (h == 1) {
  5531.             a = a.substr(0, 1).toUpperCase() + a.substr(1)
  5532.         }
  5533.         d = ct(a);
  5534.         ae(f, d)
  5535.     },
  5536.     ssCellOver: function() {
  5537.         this.className = "screenshot-caption-over"
  5538.     },
  5539.     ssCellOut: function() {
  5540.         this.className = "screenshot-caption"
  5541.     },
  5542.     ssCellClick: function(b, d) {
  5543.         d = $E(d);
  5544.         if (d.shiftKey || d.ctrlKey) {
  5545.             return
  5546.         }
  5547.         var a = 0,
  5548.             c = d._target;
  5549.         while (c && a < 3) {
  5550.             if (c.nodeName == "A") {
  5551.                 return
  5552.             }
  5553.             if (c.nodeName == "IMG") {
  5554.                 break
  5555.             }
  5556.             c = c.parentNode
  5557.         }
  5558.         ScreenshotViewer.show({
  5559.             screenshots: this.data,
  5560.             pos: b
  5561.         })
  5562.     },
  5563.     moneyHonorOver: function(a) {
  5564.         Tooltip.showAtCursor(a, LANG.tooltip_honorpoints, 0, 0, "q")
  5565.     },
  5566.     moneyArenaOver: function(a) {
  5567.         Tooltip.showAtCursor(a, LANG.tooltip_arenapoints, 0, 0, "q")
  5568.     },
  5569.     moneyAchievementOver: function(a) {
  5570.         Tooltip.showAtCursor(a, LANG.tooltip_achievementpoints, 0, 0, "q")
  5571.     },
  5572.     appendMoney: function(g, a, f, m, j, c, l) {
  5573.         var k, h = 0;
  5574.         if (a >= 10000) {
  5575.             h = 1;
  5576.             k = ce("span");
  5577.             k.className = "moneygold";
  5578.             ae(k, ct(Math.floor(a / 10000)));
  5579.             ae(g, k);
  5580.             a %= 10000
  5581.         }
  5582.         if (a >= 100) {
  5583.             if (h) {
  5584.                 ae(g, ct(" "))
  5585.             } else {
  5586.                 h = 1
  5587.             }
  5588.             k = ce("span");
  5589.             k.className = "moneysilver";
  5590.             ae(k, ct(Math.floor(a / 100)));
  5591.             ae(g, k);
  5592.             a %= 100
  5593.         }
  5594.         if (a >= 1 || f != null) {
  5595.             if (h) {
  5596.                 ae(g, ct(" "))
  5597.             } else {
  5598.                 h = 1
  5599.             }
  5600.             k = ce("span");
  5601.             k.className = "moneycopper";
  5602.             ae(k, ct(a));
  5603.             ae(g, k)
  5604.         }
  5605.         if (m != null && m != 0) {
  5606.             if (h) {
  5607.                 ae(g, ct(" "))
  5608.             } else {
  5609.                 h = 1
  5610.             }
  5611.             k = ce("span");
  5612.             k.className = "money" + (m < 0 ? "horde" : "alliance") + " tip";
  5613.             k.onmouseover = Listview.funcBox.moneyHonorOver;
  5614.             k.onmousemove = Tooltip.cursorUpdate;
  5615.             k.onmouseout = Tooltip.hide;
  5616.             ae(k, ct(number_format(Math.abs(m))));
  5617.             ae(g, k)
  5618.         }
  5619.         if (j >= 1) {
  5620.             if (h) {
  5621.                 ae(g, ct(" "))
  5622.             } else {
  5623.                 h = 1
  5624.             }
  5625.             k = ce("span");
  5626.             k.className = "moneyarena tip";
  5627.             k.onmouseover = Listview.funcBox.moneyArenaOver;
  5628.             k.onmousemove = Tooltip.cursorUpdate;
  5629.             k.onmouseout = Tooltip.hide;
  5630.             ae(k, ct(number_format(j)));
  5631.             ae(g, k)
  5632.         }
  5633.         if (c != null) {
  5634.             for (var b = 0; b < c.length; ++b) {
  5635.                 if (h) {
  5636.                     ae(g, ct(" "))
  5637.                 } else {
  5638.                     h = 1
  5639.                 }
  5640.                 var n = c[b][0];
  5641.                 var e = c[b][1];
  5642.                 k = ce("a");
  5643.                 k.href = "item=" + n;
  5644.                 k.className = "moneyitem";
  5645.                 k.style.backgroundImage = "url(http://cdn.openwow.com/" + qsUrl + "/icons/tiny/" + openDB_items.getIcon(n).toLowerCase() + ".gif)";
  5646.                 ae(k, ct(e));
  5647.                 ae(g, k)
  5648.             }
  5649.         }
  5650.         if (l != null) {
  5651.             if (h) {
  5652.                 ae(g, ct(" "))
  5653.             } else {
  5654.                 h = 1
  5655.             }
  5656.             k = ce("span");
  5657.             k.className = "moneyachievement tip";
  5658.             k.onmouseover = Listview.funcBox.moneyAchievementOver;
  5659.             k.onmousemove = Tooltip.cursorUpdate;
  5660.             k.onmouseout = Tooltip.hide;
  5661.             ae(k, ct(number_format(l)));
  5662.             ae(g, k)
  5663.         }
  5664.     },
  5665.     getUpperSource: function(a, b) {
  5666.         switch (a) {
  5667.             case 2:
  5668.                 if (b.z) {
  5669.                     return LANG.source_zonedrop
  5670.                 }
  5671.                 break;
  5672.             case 4:
  5673.                 return LANG.source_quests;
  5674.             case 5:
  5675.                 return LANG.source_vendors
  5676.         }
  5677.         return openDB_sources[a]
  5678.     },
  5679.     getLowerSource: function(a, d, c) {
  5680.         switch (a) {
  5681.             case 3:
  5682.                 if (d.p && openDB_sources_pvp[d.p]) {
  5683.                     return {
  5684.                         text: openDB_sources_pvp[d.p]
  5685.                     }
  5686.                 }
  5687.                 break
  5688.         }
  5689.         switch (c) {
  5690.             case 0:
  5691.             case 1:
  5692.             case 2:
  5693.                 if (d.z) {
  5694.                     var b = {
  5695.                         url: "zone=" + d.z,
  5696.                         text: openDB_zones[d.z]
  5697.                     };
  5698.                     if (d.t && a == 5) {
  5699.                         b.pretext = LANG.lvitem_vendorin
  5700.                     }
  5701.                     if (d.dd) {
  5702.                         if (d.dd == 1) {
  5703.                             b.posttext = LANG.lvitem_normal
  5704.                         } else {
  5705.                             if (d.dd == 2) {
  5706.                                 b.posttext = LANG.lvitem_heroic
  5707.                             }
  5708.                         }
  5709.                     }
  5710.                     return b
  5711.                 }
  5712.                 break;
  5713.             case 5:
  5714.                 return {
  5715.                     url: "quests=" + d.c2 + "." + d.c,
  5716.                     text: Listview.funcBox.getQuestCategory(d.c)
  5717.                 };
  5718.                 break;
  5719.             case 6:
  5720.                 if (d.c && d.s) {
  5721.                     return {
  5722.                         url: "spells=" + d.c + "." + d.s,
  5723.                         text: openDB_spell_skills[d.s]
  5724.                     }
  5725.                 } else {
  5726.                     return {
  5727.                         url: "spells=0",
  5728.                         text: "??"
  5729.                     }
  5730.                 }
  5731.                 break
  5732.         }
  5733.     },
  5734.     initModeFilter: function(c) {
  5735.         if (this._lootModes == null) {
  5736.             this._lootModes = {
  5737.                 99: 0
  5738.             }
  5739.         }
  5740.         if (this._distinctModes == null) {
  5741.             this._distinctModes = {
  5742.                 99: 0
  5743.             }
  5744.         }
  5745.         if ((!c.modes || c.modes.mode == 4) && c.classs != 12 && c.percent < 1) {
  5746.             this._lootModes[99]++;
  5747.             this._distinctModes[99]++
  5748.         } else {
  5749.             if (c.modes) {
  5750.                 for (var b = -2; b <= 4; ++b) {
  5751.                     if (this._lootModes[b] == null) {
  5752.                         this._lootModes[b] = 0
  5753.                     }
  5754.                     if (c.modes.mode & 1 << parseInt(b) + 2) {
  5755.                         this._lootModes[b]++
  5756.                     }
  5757.                 }
  5758.                 if (this._distinctModes[c.modes.mode] == null) {
  5759.                     this._distinctModes[c.modes.mode] = 0
  5760.                 }
  5761.                 this._distinctModes[c.modes.mode]++
  5762.             }
  5763.         }
  5764.     },
  5765.     addModeIndicator: function() {
  5766.         var b = 0;
  5767.         for (var l in this._distinctModes) {
  5768.             if (this._distinctModes[l]) {
  5769.                 b++
  5770.             }
  5771.         }
  5772.         if (b < 2) {
  5773.             return
  5774.         }
  5775.         var e = location.hash.match(/:mode=([^:]+)/),
  5776.             d = [0, -1, -2, 1, 3, 2, 4, 99],
  5777.             o = {
  5778.                 "-2": LANG.tab_heroic,
  5779.                 "-1": LANG.tab_normal,
  5780.                 0: LANG.tab_noteworthy,
  5781.                 1: sprintf(LANG.tab_normalX, 10),
  5782.                 2: sprintf(LANG.tab_normalX, 25),
  5783.                 3: sprintf(LANG.tab_heroicX, 10),
  5784.                 4: sprintf(LANG.tab_heroicX, 25),
  5785.                 99: ""
  5786.             };
  5787.         var n = function(j, i, f) {
  5788.             openDB_setSelectedLink(this, "lootmode");
  5789.             g.customPound = g.id + (i != null ? ":mode=" + openDB_urlize(o[i].replace(" ", "")) : "");
  5790.             g.customFilter = function(r) {
  5791.                 return Listview.funcBox.filterMode(r, g._totalCount, j)
  5792.             };
  5793.             g.updateFilters(1);
  5794.             g.applySort();
  5795.             g.refreshRows();
  5796.             if (f) {
  5797.                 g.updatePound(1)
  5798.             }
  5799.         };
  5800.         var g = this,
  5801.             c = [],
  5802.             p;
  5803.         p = $j("<a><span>" + LANG.pr_note_all + "</span></a>");
  5804.         p[0].f = n.bind(p[0], null, null, 1);
  5805.         p.click(p[0].f);
  5806.         var k = n.bind(p[0], null, null, 0);
  5807.         k();
  5808.         c.push($j('<span class="indicator-mode"></span>').append(p).append($j("<b>" + LANG.pr_note_all + "</b>")));
  5809.         for (var h = 0, m = d.length; h < m; ++h) {
  5810.             var l = d[h];
  5811.             if (!this._lootModes[l]) {
  5812.                 continue
  5813.             }
  5814.             p = $j("<a><span>" + o[l] + "</span> (" + this._lootModes[l] + ")</a>");
  5815.             p[0].f = n.bind(p[0], 1 << l + 2, l, 1);
  5816.             p.click(p[0].f);
  5817.             if (l == 0) {
  5818.                 k = n.bind(p[0], 1 << l + 2, l, 0)
  5819.             }
  5820.             if (l < -1 || l > 2) {
  5821.                 p.addClass("icon-heroic")
  5822.             }
  5823.             c.push($j('<span class="indicator-mode"></span>').append(p).append($("<b" + (l < -1 || l > 2 ? ' class="icon-heroic"' : "") + ">" + o[l] + " (" + this._lootModes[l] + ")</b>")));
  5824.             if (e && e[1] == openDB_urlize(o[l].replace(" ", ""))) {
  5825.                 (p[0].f)()
  5826.             }
  5827.         }
  5828.         var q = false;
  5829.         for (var l = 0, m = c.length; l < m; ++l) {
  5830.             p = $j("a", c[l]);
  5831.             if (!$j("span", p).html() && c.length == 3) {
  5832.                 q = true
  5833.             } else {
  5834.                 this.createIndicator(c[l], null, p[0].f)
  5835.             }
  5836.         }
  5837.         if (q) {
  5838.             k()
  5839.         }
  5840.         $j(this.noteTop).append($j('<div class="clear"></div>'))
  5841.     },
  5842.     filterMode: function(e, c, d) {
  5843.         if (c != null && e.count != null) {
  5844.             if (e._count == null) {
  5845.                 e._count = e.count
  5846.             }
  5847.             var b = e._count;
  5848.             if (d != null && e.modes[d]) {
  5849.                 b = e.modes[d].count;
  5850.                 c = e.modes[d].outof
  5851.             }
  5852.             e.__tr = null;
  5853.             e.count = b;
  5854.             e.outof = c;
  5855.             if (c) {
  5856.                 e.percent = b / c * 100
  5857.             } else {
  5858.                 e.percent = b
  5859.             }
  5860.         }
  5861.         return (d != null ? ((!e.modes || e.modes.mode == 4) && e.classs != 12 && e.percent < 1 ? (d == 32) : (e.modes && (e.modes.mode & d))) : true)
  5862.     },
  5863.     addSubclassIndicator: function() {
  5864.         var k = location.hash.match(/:type=([^:]+)/),
  5865.             b = [];
  5866.         for (var h in openDB_item_classes) {
  5867.             b.push({
  5868.                 i: h,
  5869.                 n: openDB_item_classes[h]
  5870.             })
  5871.         }
  5872.         b.sort(function(i, f) {
  5873.             return strcmp(i.n, f.n)
  5874.         });
  5875.         var m = function(i, f) {
  5876.             openDB_setSelectedLink(this, "itemclass");
  5877.             d.customPound = d.id + (i != null ? ":type=" + i : "");
  5878.             d.customFilter = function(j) {
  5879.                 return i == null || i == j.classs
  5880.             };
  5881.             d.updateFilters(1);
  5882.             d.applySort();
  5883.             d.refreshRows();
  5884.             if (f) {
  5885.                 d.updatePound(1)
  5886.             }
  5887.         };
  5888.         var d = this,
  5889.             c = [],
  5890.             n;
  5891.         n = $j("<a><span>" + LANG.pr_note_all + "</span></a>");
  5892.         n[0].f = m.bind(n[0], null, 1);
  5893.         n.click(n[0].f);
  5894.         var g = m.bind(n[0], null, 0);
  5895.         g();
  5896.         c.push($j('<span class="indicator-mode"></span>').append(n).append($j("<b>" + LANG.pr_note_all + "</b>")));
  5897.         for (var e = 0, l = b.length; e < l; ++e) {
  5898.             var h = b[e].i;
  5899.             if (!this._itemClasses[h]) {
  5900.                 continue
  5901.             }
  5902.             n = $j("<a><span>" + openDB_item_classes[h] + "</span> (" + this._itemClasses[h] + ")</a>");
  5903.             n[0].f = m.bind(n[0], h, 1);
  5904.             n.click(n[0].f);
  5905.             c.push($j('<span class="indicator-mode"></span>').append(n).append($j("<b>" + openDB_item_classes[h] + " (" + this._itemClasses[h] + ")</b>")));
  5906.             if (k && k[1] == openDB_urlize(h)) {
  5907.                 (n[0].f)()
  5908.             }
  5909.         }
  5910.         if (c.length > 2) {
  5911.             for (var h = 0, l = c.length; h < l; ++h) {
  5912.                 this.createIndicator(c[h], null, $j("a", c[h])[0].f)
  5913.             }
  5914.             $j(this.noteTop).css("padding-bottom", "12px");
  5915.             $j(this.noteIndicators).append($j('<div class="clear"></div>')).insertAfter($j(this.navTop))
  5916.         }
  5917.     },
  5918.     addStatisticIndicator: function() {
  5919.         var h = location.hash.match(/:type=([^:]+)/),
  5920.             b = [];
  5921.         for (var g in openDB_achievement_types) {
  5922.             b.push({
  5923.                 i: g,
  5924.                 n: openDB_achievement_types[g]
  5925.             })
  5926.         }
  5927.         b.sort(function(i, f) {
  5928.             return $WH.strcmp(i.n, f.n)
  5929.         });
  5930.         var m = function(i, f) {
  5931.             openDB_setSelectedLink(this, "achievType");
  5932.             c.customPound = c.id + (i != null ? ":type=" + i : "");
  5933.             c.customFilter = function(j) {
  5934.                 return i == null || i == j.type
  5935.             };
  5936.             c.updateFilters(1);
  5937.             c.applySort();
  5938.             c.refreshRows();
  5939.             if (f) {
  5940.                 c.updatePound(1)
  5941.             }
  5942.         };
  5943.         var c = this,
  5944.             l = [],
  5945.             n;
  5946.         n = $j("<a><span>" + LANG.pr_note_all + "</span></a>");
  5947.         n[0].f = m.bind(n[0], null, 1);
  5948.         n.click(n[0].f);
  5949.         var e = m.bind(n[0], null, 0);
  5950.         e();
  5951.         l.push($j('<span class="indicator-mode"></span>').append(n).append($j("<b>" + LANG.pr_note_all + "</b>")));
  5952.         for (var d = 0, k = b.length; d < k; ++d) {
  5953.             var g = b[d].i;
  5954.             if (!this._achievTypes[g]) {
  5955.                 continue
  5956.             }
  5957.             n = $j("<a><span>" + openDB_achievement_types[g] + "</span> (" + this._achievTypes[g] + ")</a>");
  5958.             n[0].f = m.bind(n[0], g, 1);
  5959.             n.click(n[0].f);
  5960.             l.push($j('<span class="indicator-mode"></span>').append(n).append($j("<b>" + openDB_achievement_types[g] + " (" + this._achievTypes[g] + ")</b>")));
  5961.             if (h && h[1] == g) {
  5962.                 (n[0].f)()
  5963.             }
  5964.         }
  5965.         if (l.length > 2) {
  5966.             for (var g = 0, k = l.length; g < k; ++g) {
  5967.                 this.createIndicator(l[g], null, $j("a", l[g])[0].f)
  5968.             }
  5969.             $j(this.noteTop).append($j('<div class="clear"></div>'))
  5970.         }
  5971.     },
  5972.     addQuestIndicator: function() {
  5973.         var g = location.hash.match(/:type=([^:]+)/);
  5974.         var j = function(i, f) {
  5975.             openDB_setSelectedLink(this, "questType");
  5976.             k.customPound = k.id + (i != null ? ":type=" + i : "");
  5977.             k.customFilter = function(l) {
  5978.                 return i == null || (l._type & 1 << i - 1)
  5979.             };
  5980.             k.updateFilters(1);
  5981.             k.applySort();
  5982.             k.refreshRows();
  5983.             if (f) {
  5984.                 k.updatePound(1)
  5985.             }
  5986.         };
  5987.         var k = this,
  5988.             e = [],
  5989.             c;
  5990.         c = $j("<a><span>" + LANG.pr_note_all + "</span></a>");
  5991.         c[0].f = j.bind(c[0], null, 1);
  5992.         c.click(c[0].f);
  5993.         var h = j.bind(c[0], null, 0);
  5994.         h();
  5995.         e.push($j('<span class="indicator-mode"></span>').append(c).append($j("<b>" + LANG.pr_note_all + "</b>")));
  5996.         for (var d = 1; d <= 4; ++d) {
  5997.             if (!this._questTypes[d]) {
  5998.                 continue
  5999.             }
  6000.             c = $j("<a><span>" + openDB_quest_indicators[d] + "</span> (" + this._questTypes[d] + ")</a>");
  6001.             c[0].f = j.bind(c[0], d, 1);
  6002.             c.click(c[0].f);
  6003.             e.push($j('<span class="indicator-mode"></span>').append(c).append($j("<b>" + openDB_quest_indicators[d] + " (" + this._questTypes[d] + ")</b>")));
  6004.             if (g && g[1] == d) {
  6005.                 (c[0].f)()
  6006.             }
  6007.         }
  6008.         if (e.length > 2) {
  6009.             for (var d = 0, b = e.length; d < b; ++d) {
  6010.                 this.createIndicator(e[d], null, $j("a", e[d])[0].f)
  6011.             }
  6012.             $j(this.noteTop).css("padding-bottom", "12px");
  6013.             $j(this.noteIndicators).append($j('<div class="clear"></div>')).insertAfter($(this.navTop))
  6014.         }
  6015.     }
  6016. };
  6017. Listview.templates = {
  6018.     faction: {
  6019.         sort: [1],
  6020.         nItemsPerPage: -1,
  6021.         searchable: 1,
  6022.         filtrable: 1,
  6023.         columns: [{
  6024.             id: "name",
  6025.             name: LANG.name,
  6026.             type: "text",
  6027.             align: "left",
  6028.             value: "name",
  6029.             compute: function(d, e) {
  6030.                 var b = ce("a");
  6031.                 b.style.fontFamily = "Verdana, sans-serif";
  6032.                 b.href = this.template.getItemLink(d);
  6033.                 ae(b, ct(d.name));
  6034.                 if (d.expansion) {
  6035.                     var c = ce("span");
  6036.                     c.className = (d.expansion == 1 ? "bc-icon" : "wotlk-icon");
  6037.                     ae(c, b);
  6038.                     ae(e, c)
  6039.                 } else {
  6040.                     ae(e, b)
  6041.                 }
  6042.             },
  6043.             getVisibleText: function(a) {
  6044.                 var b = a.name;
  6045.                 if (a.expansion == 1) {
  6046.                     b += " bc"
  6047.                 } else {
  6048.                     if (a.expansion == 2) {
  6049.                         b += "wotlk wrath"
  6050.                     }
  6051.                 }
  6052.                 return b
  6053.             }
  6054.         }, {
  6055.             id: "side",
  6056.             name: LANG.side,
  6057.             type: "text",
  6058.             width: "10%",
  6059.             compute: function(b, c) {
  6060.                 if (b.side) {
  6061.                     var a = ce("span");
  6062.                     a.className = (b.side == 1 ? "alliance-icon" : "horde-icon");
  6063.                     ae(a, ct(openDB_sides[b.side]));
  6064.                     ae(c, a)
  6065.                 }
  6066.             },
  6067.             getVisibleText: function(a) {
  6068.                 if (a.side) {
  6069.                     return openDB_sides[a.side]
  6070.                 }
  6071.             },
  6072.             sortFunc: function(d, c, e) {
  6073.                 return strcmp(openDB_sides[d.side], openDB_sides[c.side])
  6074.             }
  6075.         }, {
  6076.             id: "category",
  6077.             name: LANG.category,
  6078.             type: "text",
  6079.             width: "16%",
  6080.             compute: function(d, e) {
  6081.                 if (d.category2 != null) {
  6082.                     e.className = "small q1";
  6083.                     var b = ce("a"),
  6084.                         c = "factions=" + d.category2;
  6085.                     if (d.category) {
  6086.                         c += "." + d.category
  6087.                     }
  6088.                     b.href = c;
  6089.                     ae(b, ct(Listview.funcBox.getFactionCategory(d.category, d.category2)));
  6090.                     ae(e, b)
  6091.                 }
  6092.             },
  6093.             getVisibleText: function(a) {
  6094.                 return Listview.funcBox.getFactionCategory(a.category, a.category2)
  6095.             },
  6096.             sortFunc: function(d, c, f) {
  6097.                 var e = Listview.funcBox.getFactionCategory;
  6098.                 return strcmp(e(d.category, d.category2), e(c.category, c.category2))
  6099.             }
  6100.         }],
  6101.         getItemLink: function(a) {
  6102.             return "?faction=" + a.id
  6103.         }
  6104.     },
  6105.     item: {
  6106.         sort: [1],
  6107.         searchable: 1,
  6108.         filtrable: 1,
  6109.         columns: [{
  6110.             id: "name",
  6111.             name: LANG.name,
  6112.             type: "text",
  6113.             align: "left",
  6114.             span: 2,
  6115.             value: "name",
  6116.             compute: function(q, g, o) {
  6117.                 if (q.upgraded) {
  6118.                     o.className = "upgraded"
  6119.                 }
  6120.                 var j = ce("td");
  6121.                 j.style.width = "1px";
  6122.                 j.style.padding = "0";
  6123.                 j.style.borderRight = "none";
  6124.                 var k = null,
  6125.                     r = null;
  6126.                 if (q.stack != null) {
  6127.                     k = Listview.funcBox.createTextRange(q.stack[0], q.stack[1])
  6128.                 }
  6129.                 if (q.avail != null) {
  6130.                     r = q.avail
  6131.                 }
  6132.                 if (q.id) {
  6133.                     ae(j, openDB_items.createIcon(q.id, (this.iconSize == null ? 1 : this.iconSize), k, r))
  6134.                 }
  6135.                 ae(o, j);
  6136.                 g.style.borderLeft = "none";
  6137.                 var p = ce("a");
  6138.                 p.className = "q" + (7 - parseInt(q.name.charAt(0)));
  6139.                 p.style.fontFamily = "Verdana, sans-serif";
  6140.                 p.href = this.template.getItemLink(q);
  6141.                 if (q.rel) {
  6142.                     Icon.getLink(j.firstChild).rel = q.rel;
  6143.                     p.rel = q.rel
  6144.                 }
  6145.                 ae(p, ct(q.name.substring(1)));
  6146.                 var b = ce("div");
  6147.                 ae(b, p);
  6148.                 if (q.reqclass) {
  6149.                     var m = ce("div");
  6150.                     m.className = "small2";
  6151.                     var f = Listview.funcBox.assocBinFlags(q.reqclass, openDB_chr_classes);
  6152.                     for (var j = 0, l = f.length; j < l; ++j) {
  6153.                         if (j > 0) {
  6154.                             ae(m, ct(", "))
  6155.                         }
  6156.                         var p = ce("a");
  6157.                         p.href = "javascript:;";
  6158.                         p.className = "c" + f[j];
  6159.                         st(p, openDB_chr_classes[f[j]]);
  6160.                         ae(m, p)
  6161.                     }
  6162.                     ae(b, m)
  6163.                 }
  6164.                 if (typeof fi_nExtraCols == "number" && fi_nExtraCols >= 5) {
  6165.                     if (q.source != null && q.source.length == 1) {
  6166.                         if (q.reqclass) {
  6167.                             ae(m, ct(LANG.dash))
  6168.                         } else {
  6169.                             var m = ce("div");
  6170.                             m.className = "small2"
  6171.                         }
  6172.                         var e = (q.sourcemore ? q.sourcemore[0] : {});
  6173.                         var n = 0;
  6174.                         if (e.t) {
  6175.                             n = e.t;
  6176.                             var p = ce("a");
  6177.                             if (e.q != null) {
  6178.                                 p.className = "q" + e.q
  6179.                             } else {
  6180.                                 p.className = "q1"
  6181.                             }
  6182.                             p.href = "/" + openDB_types[e.t] + "=" + e.ti;
  6183.                             if (e.n.length <= 30) {
  6184.                                 ae(p, ct(e.n))
  6185.                             } else {
  6186.                                 p.title = e.n;
  6187.                                 ae(p, ct(trim(e.n.substr(0, 27)) + "..."))
  6188.                             }
  6189.                             ae(m, p)
  6190.                         } else {
  6191.                             ae(m, ct(Listview.funcBox.getUpperSource(q.source[0], e)))
  6192.                         }
  6193.                         var h = Listview.funcBox.getLowerSource(q.source[0], e, n);
  6194.                         if (h != null) {
  6195.                             ae(m, ct(LANG.hyphen));
  6196.                             if (h.pretext) {
  6197.                                 ae(m, ct(h.pretext))
  6198.                             }
  6199.                             if (h.url) {
  6200.                                 var p = ce("a");
  6201.                                 p.className = "q1";
  6202.                                 p.href = h.url;
  6203.                                 ae(p, ct(h.text));
  6204.                                 ae(m, p)
  6205.                             } else {
  6206.                                 ae(m, ct(h.text))
  6207.                             }
  6208.                             if (h.posttext) {
  6209.                                 ae(m, ct(h.posttext))
  6210.                             }
  6211.                         }
  6212.                         ae(b, m)
  6213.                     }
  6214.                 }
  6215.                 if (q.heroic || q.reqrace || q.eliteitem || q.raidfinder) {
  6216.                     b.style.position = "relative";
  6217.                     var m = ce("div");
  6218.                     m.className = "small";
  6219.                     m.style.fontStyle = "italic";
  6220.                     m.style.position = "absolute";
  6221.                     m.style.right = m.style.bottom = "3px";
  6222.                     if (q.heroic) {
  6223.                         var t = ce("span");
  6224.                         t.className = "q2";
  6225.                         ae(t, ct(LANG.lvitem_heroicitem));
  6226.                         ae(m, t)
  6227.                     }
  6228.                     if (q.raidfinder) {
  6229.                         var t = ce("span");
  6230.                         t.className = "q2";
  6231.                         ae(t, ct(LANG.lvitem_raidfinderitem));
  6232.                         ae(m, t)
  6233.                     }
  6234.                     if (q.eliteitem) {
  6235.                         var t = ce("span");
  6236.                         t.className = "q2";
  6237.                         ae(t, ct(LANG.lvitem_eliteitem));
  6238.                         ae(m, t)
  6239.                     }
  6240.                     if (q.reqrace) {
  6241.                         if ((q.reqrace & 1791) != 1101 && (q.reqrace & 1791) != 690) {
  6242.                             if (q.heroic) {
  6243.                                 ae(m, ce("br"));
  6244.                                 m.style.bottom = "-6px"
  6245.                             }
  6246.                             var c = Listview.funcBox.assocBinFlags(q.reqrace, openDB_chr_races);
  6247.                             for (var j = 0, l = c.length; j < l; ++j) {
  6248.                                 if (j > 0) {
  6249.                                     ae(m, ct(", "))
  6250.                                 }
  6251.                                 var p = ce("a");
  6252.                                 p.href = "/race=" + c[j];
  6253.                                 st(p, openDB_chr_races[c[j]]);
  6254.                                 ae(m, p)
  6255.                             }
  6256.                             m.className += "q1"
  6257.                         }
  6258.                     }
  6259.                     ae(b, m)
  6260.                 }
  6261.                 ae(g, b)
  6262.             },
  6263.             getVisibleText: function(c) {
  6264.                 var e = c.name.substring(1);
  6265.                 if (typeof fi_nExtraCols == "number" && fi_nExtraCols >= 5) {
  6266.                     if (c.source != null && c.source.length == 1) {
  6267.                         var d = (c.sourcemore ? c.sourcemore[0] : {});
  6268.                         var b = 0;
  6269.                         if (d.t) {
  6270.                             b = d.t;
  6271.                             e += " " + d.n
  6272.                         } else {
  6273.                             e += " " + Listview.funcBox.getUpperSource(c.source[0], d)
  6274.                         }
  6275.                         var a = Listview.funcBox.getLowerSource(c.source[0], d, b);
  6276.                         if (a != null) {
  6277.                             if (a.pretext) {
  6278.                                 e += " " + a.pretext
  6279.                             }
  6280.                             e += " " + a.text;
  6281.                             if (a.posttext) {
  6282.                                 e += " " + a.posttext
  6283.                             }
  6284.                         }
  6285.                     }
  6286.                 }
  6287.                 return e
  6288.             }
  6289.         }, {
  6290.             id: "level",
  6291.             name: LANG.level,
  6292.             value: "level"
  6293.         }, {
  6294.             id: "reqlevel",
  6295.             name: LANG.req,
  6296.             tooltip: LANG.tooltip_reqlevel,
  6297.             value: "reqlevel",
  6298.             compute: function(a, b) {
  6299.                 if (a.reqlevel > 1) {
  6300.                     return a.reqlevel
  6301.                 }
  6302.             }
  6303.         }, {
  6304.             id: "side",
  6305.             name: LANG.side,
  6306.             type: "text",
  6307.             compute: function(a, c) {
  6308.                 if (a.side && a.side != 3) {
  6309.                     var b = ce("span");
  6310.                     b.className = (a.side == 1 ? "alliance-icon" : "horde-icon");
  6311.                     b.onmouseover = function(d) {
  6312.                         Tooltip.showAtCursor(d, openDB_sides[a.side], 0, 0, "q")
  6313.                     };
  6314.                     b.onmousemove = Tooltip.cursorUpdate;
  6315.                     b.onmouseout = Tooltip.hide;
  6316.                     ae(c, b)
  6317.                 }
  6318.             },
  6319.             getVisibleText: function(a) {
  6320.                 if (a.side) {
  6321.                     return openDB_sides[a.side]
  6322.                 }
  6323.             },
  6324.             sortFunc: function(d, c, e) {
  6325.                 return strcmp(openDB_sides[d.side], openDB_sides[c.side])
  6326.             }
  6327.         }, {
  6328.             id: "dps",
  6329.             name: LANG.dps,
  6330.             value: "dps",
  6331.             compute: function(a, b) {
  6332.                 return (a.dps || 0).toFixed(1)
  6333.             },
  6334.             hidden: true
  6335.         }, {
  6336.             id: "speed",
  6337.             name: LANG.speed,
  6338.             value: "speed",
  6339.             compute: function(a, b) {
  6340.                 return (a.speed || 0).toFixed(2)
  6341.             },
  6342.             hidden: true
  6343.         }, {
  6344.             id: "armor",
  6345.             name: LANG.armor,
  6346.             value: "armor",
  6347.             compute: function(a, b) {
  6348.                 if (a.armor > 0) {
  6349.                     return a.armor
  6350.                 }
  6351.             },
  6352.             hidden: true
  6353.         }, {
  6354.             id: "slot",
  6355.             name: LANG.slot,
  6356.             type: "text",
  6357.             compute: function(a, b) {
  6358.                 nw(b);
  6359.                 return openDB_item_slots[a.slot]
  6360.             },
  6361.             getVisibleText: function(a) {
  6362.                 return openDB_item_slots[a.slot]
  6363.             },
  6364.             sortFunc: function(d, c, e) {
  6365.                 return strcmp(openDB_item_slots[d.slot], openDB_item_slots[c.slot])
  6366.             },
  6367.             hidden: true
  6368.         }, {
  6369.             id: "slots",
  6370.             name: LANG.slots,
  6371.             value: "nslots",
  6372.             hidden: true
  6373.         }, {
  6374.             id: "skill",
  6375.             name: LANG.skill,
  6376.             value: "skill",
  6377.             hidden: true
  6378.         }, {
  6379.             id: "glyph",
  6380.             name: LANG.glyphtype,
  6381.             type: "text",
  6382.             value: "glyph",
  6383.             compute: function(a, b) {
  6384.                 if (a.glyph) {
  6385.                     return openDB_item_glyphs[a.glyph]
  6386.                 }
  6387.             },
  6388.             getVisibleText: function(a) {
  6389.                 return openDB_item_glyphs[a.glyph]
  6390.             },
  6391.             sortFunc: function(d, c, e) {
  6392.                 return strcmp(openDB_item_glyphs[d.glyph], openDB_item_glyphs[c.glyph])
  6393.             },
  6394.             hidden: true
  6395.         }, {
  6396.             id: "source",
  6397.             name: LANG.source,
  6398.             type: "text",
  6399.             compute: function(k, d) {
  6400.                 if (this.iconSize == 0) {
  6401.                     d.className = "small"
  6402.                 }
  6403.                 if (k.source != null) {
  6404.                     if (k.source.length == 1) {
  6405.                         nw(d);
  6406.                         var c = (k.sourcemore ? k.sourcemore[0] : {});
  6407.                         var h = 0;
  6408.                         if (c.t) {
  6409.                             h = c.t;
  6410.                             var j = ce("a");
  6411.                             if (c.q != null) {
  6412.                                 j.className = "q" + c.q
  6413.                             } else {
  6414.                                 j.className = "q1"
  6415.                             }
  6416.                             j.href = openDB_types[c.t] + "=" + c.ti;
  6417.                             if (this.iconSize == 0 || c.n.length <= 20) {
  6418.                                 ae(j, ct(c.n))
  6419.                             } else {
  6420.                                 j.title = c.n;
  6421.                                 ae(j, ct(trim(c.n.substr(0, 17)) + "..."))
  6422.                             }
  6423.                             ae(d, j)
  6424.                         } else {
  6425.                             ae(d, ct(Listview.funcBox.getUpperSource(k.source[0], c)))
  6426.                         }
  6427.                         var f = Listview.funcBox.getLowerSource(k.source[0], c, h);
  6428.                         if (this.iconSize != 0 && f != null) {
  6429.                             var b = ce("div");
  6430.                             b.className = "small2";
  6431.                             if (f.pretext) {
  6432.                                 ae(b, ct(f.pretext))
  6433.                             }
  6434.                             if (f.url) {
  6435.                                 var j = ce("a");
  6436.                                 j.className = "q1";
  6437.                                 j.href = f.url;
  6438.                                 ae(j, ct(f.text));
  6439.                                 ae(b, j)
  6440.                             } else {
  6441.                                 ae(b, ct(f.text))
  6442.                             }
  6443.                             if (f.posttext) {
  6444.                                 ae(b, ct(f.posttext))
  6445.                             }
  6446.                             ae(d, b)
  6447.                         }
  6448.                     } else {
  6449.                         var l = "";
  6450.                         for (var e = 0, g = k.source.length; e < g; ++e) {
  6451.                             if (e > 0) {
  6452.                                 l += LANG.comma
  6453.                             }
  6454.                             l += openDB_sources[k.source[e]]
  6455.                         }
  6456.                         return l
  6457.                     }
  6458.                 }
  6459.             },
  6460.             getVisibleText: function(c) {
  6461.                 if (c.source != null) {
  6462.                     if (c.source.length == 1) {
  6463.                         var e = "";
  6464.                         var d = (c.sourcemore ? c.sourcemore[0] : {});
  6465.                         var b = 0;
  6466.                         if (d.t) {
  6467.                             b = d.t;
  6468.                             e += " " + d.n
  6469.                         } else {
  6470.                             e += " " + Listview.funcBox.getUpperSource(c.source[0], d)
  6471.                         }
  6472.                         var a = Listview.funcBox.getLowerSource(c.source[0], d, b);
  6473.                         if (a != null) {
  6474.                             if (a.pretext) {
  6475.                                 e += " " + a.pretext
  6476.                             }
  6477.                             e += " " + a.text;
  6478.                             if (a.posttext) {
  6479.                                 e += " " + a.posttext
  6480.                             }
  6481.                         }
  6482.                         return e
  6483.                     } else {
  6484.                         return Listview.funcBox.arrayText(c.source, openDB_sources)
  6485.                     }
  6486.                 }
  6487.             },
  6488.             sortFunc: function(f, d) {
  6489.                 var g = Listview.funcBox.assocArrCmp(f.source, d.source, openDB_sources);
  6490.                 if (g != 0) {
  6491.                     return g
  6492.                 }
  6493.                 var e = (f.sourcemore && f.source.length == 1 ? f.sourcemore[0].n : null),
  6494.                     c = (d.sourcemore && d.source.length == 1 ? d.sourcemore[0].n : null);
  6495.                 return strcmp(e, c)
  6496.             }
  6497.         }, {
  6498.             id: "type",
  6499.             name: LANG.type,
  6500.             type: "text",
  6501.             compute: function(d, e) {
  6502.                 e.className = "small q1";
  6503.                 nw(e);
  6504.                 var b = ce("a");
  6505.                 var c = Listview.funcBox.getItemType(d.classs, d.subclass, d.subsubclass);
  6506.                 b.href = c.url;
  6507.                 ae(b, ct(c.text));
  6508.                 ae(e, b)
  6509.             },
  6510.             getVisibleText: function(a) {
  6511.                 return Listview.funcBox.getItemType(a.classs, a.subclass, a.subsubclass).text
  6512.             },
  6513.             sortFunc: function(d, c, f) {
  6514.                 var e = Listview.funcBox.getItemType;
  6515.                 return strcmp(e(d.classs, d.subclass, d.subsubclass).text, e(c.classs, c.subclass, c.subsubclass).text)
  6516.             }
  6517.         }],
  6518.         getItemLink: function(a) {
  6519.             return "item=" + a.id
  6520.         },
  6521.         onBeforeCreate: function() {
  6522.             var b = false;
  6523.             for (var c = 0, a = this.data.length; c < a; ++c) {
  6524.                 var d = this.data[c];
  6525.                 if (d.slot > 0 && d.slot != 18) {
  6526.                     ++b
  6527.                 } else {
  6528.                     d.__nochk = 1
  6529.                 }
  6530.             }
  6531.             if (b > 0) {
  6532.                 this.mode = 1;
  6533.                 this._nComparable = b
  6534.             }
  6535.         },
  6536.         createCbControls: function(d, c) {
  6537.             if (!c && this._nComparable < 15) {
  6538.                 return
  6539.             }
  6540.             var b = ce("input"),
  6541.                 a = ce("input");
  6542.             b.type = a.type = "button";
  6543.             b.value = LANG.button_compare;
  6544.             a.value = LANG.button_deselect;
  6545.             b.onclick = this.template.compareItems.bind(this);
  6546.             a.onclick = Listview.cbSelect.bind(this, false);
  6547.             ae(d, b);
  6548.             ae(d, a)
  6549.         },
  6550.         compareItems: function() {
  6551.             var b = this.getCheckedRows();
  6552.             if (!b.length) {
  6553.                 return
  6554.             }
  6555.             var a = "";
  6556.             array_walk(b, function(c) {
  6557.                 a += c.id + ";"
  6558.             });
  6559.             su_addToSaved(rtrim(a, ";"))
  6560.         }
  6561.     },
  6562.     itemset: {
  6563.         sort: [1, 2],
  6564.         nItemsPerPage: 75,
  6565.         searchable: 1,
  6566.         filtrable: 1,
  6567.         columns: [{
  6568.             id: "name",
  6569.             name: LANG.name,
  6570.             type: "text",
  6571.             align: "left",
  6572.             value: "name",
  6573.             compute: function(c, g) {
  6574.                 var b = ce("a");
  6575.                 b.className = "q" + (7 - parseInt(c.name.charAt(0)));
  6576.                 b.style.fontFamily = "Verdana, sans-serif";
  6577.                 b.href = this.template.getItemLink(c);
  6578.                 ae(b, ct(c.name.substring(1)));
  6579.                 var f = ce("div");
  6580.                 f.style.position = "relative";
  6581.                 ae(f, b);
  6582.                 if (c.heroic) {
  6583.                     var e = ce("div");
  6584.                     e.className = "small q2";
  6585.                     e.style.fontStyle = "italic";
  6586.                     e.style.position = "absolute";
  6587.                     e.style.right = "3px";
  6588.                     e.style.bottom = "3px";
  6589.                     ae(e, ct(LANG.lvitem_heroicitem));
  6590.                     ae(f, e)
  6591.                 }
  6592.                 if (c.elite) {
  6593.                     var e = ce("div");
  6594.                     e.className = "small q2";
  6595.                     e.style.fontStyle = "italic";
  6596.                     e.style.position = "absolute";
  6597.                     e.style.right = "3px";
  6598.                     e.style.bottom = "3px";
  6599.                     ae(e, ct(LANG.lvitem_eliteitem));
  6600.                     ae(f, e)
  6601.                 }
  6602.                 if (c.raidfinder) {
  6603.                     var e = ce("div");
  6604.                     e.className = "small q2";
  6605.                     e.style.fontStyle = "italic";
  6606.                     e.style.position = "absolute";
  6607.                     e.style.right = "3px";
  6608.                     e.style.bottom = "3px";
  6609.                     ae(e, ct(LANG.lvitem_raidfinderitem));
  6610.                     ae(f, e)
  6611.                 }
  6612.                 ae(g, f);
  6613.                 if (c.note) {
  6614.                     var e = ce("div");
  6615.                     e.className = "small";
  6616.                     ae(e, ct(openDB_itemset_notes[c.note]));
  6617.                     ae(g, e)
  6618.                 }
  6619.             },
  6620.             getVisibleText: function(b) {
  6621.                 var c = b.name.substring(1);
  6622.                 if (b.note) {
  6623.                     c += " " + openDB_itemset_notes[b.note]
  6624.                 }
  6625.                 return c
  6626.             }
  6627.         }, {
  6628.             id: "level",
  6629.             name: LANG.level,
  6630.             type: "range",
  6631.             getMinValue: function(b) {
  6632.                 return b.minlevel
  6633.             },
  6634.             getMaxValue: function(b) {
  6635.                 return b.maxlevel
  6636.             },
  6637.             compute: function(b, c) {
  6638.                 if (b.minlevel > 0 && b.maxlevel > 0) {
  6639.                     if (b.minlevel != b.maxlevel) {
  6640.                         return b.minlevel + LANG.hyphen + b.maxlevel
  6641.                     } else {
  6642.                         return b.minlevel
  6643.                     }
  6644.                 } else {
  6645.                     return -1
  6646.                 }
  6647.             },
  6648.             sortFunc: function(d, c, e) {
  6649.                 if (e > 0) {
  6650.                     return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel)
  6651.                 } else {
  6652.                     return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel)
  6653.                 }
  6654.             }
  6655.         }, {
  6656.             id: "pieces",
  6657.             name: LANG.pieces,
  6658.             getValue: function(b) {
  6659.                 return b.pieces.length
  6660.             },
  6661.             compute: function(b, c) {
  6662.                 c.style.padding = "0";
  6663.                 Listview.funcBox.createCenteredIcons(b.pieces, c)
  6664.             },
  6665.             sortFunc: function(d, c) {
  6666.                 var f = (d.pieces != null ? d.pieces.length : 0);
  6667.                 var e = (c.pieces != null ? c.pieces.length : 0);
  6668.                 return strcmp(f, e)
  6669.             }
  6670.         }, {
  6671.             id: "type",
  6672.             name: LANG.type,
  6673.             type: "text",
  6674.             compute: function(b, c) {
  6675.                 return openDB_itemset_types[b.type]
  6676.             },
  6677.             sortFunc: function(d, c, e) {
  6678.                 return strcmp(openDB_itemset_types[d.type], openDB_itemset_types[c.type])
  6679.             }
  6680.         }, {
  6681.             id: "classes",
  6682.             name: LANG.classes,
  6683.             type: "text",
  6684.             width: "20%",
  6685.             getVisibleText: function(e) {
  6686.                 var f = "";
  6687.                 if (e.reqclass) {
  6688.                     var d = Listview.funcBox.assocBinFlags(e.reqclass, openDB_chr_classes);
  6689.                     for (var c = 0, b = d.length; c < b; ++c) {
  6690.                         if (c > 0) {
  6691.                             f += LANG.comma
  6692.                         }
  6693.                         f += openDB_chr_classes[d[c]]
  6694.                     }
  6695.                 }
  6696.                 return f
  6697.             },
  6698.             compute: function(h, k) {
  6699.                 if (h.reqclass) {
  6700.                     var f = Listview.funcBox.assocBinFlags(h.reqclass, openDB_chr_classes);
  6701.                     var j = ce("div");
  6702.                     j.style.width = (26 * f.length) + "px";
  6703.                     j.style.margin = "0 auto";
  6704.                     for (var e = 0, b = f.length; e < b; ++e) {
  6705.                         var g = Icon.create("class_" + openDB_file_classes[f[e]], 0, null, "javascript:;");
  6706.                         g.style.cssFloat = g.style.styleFloat = "left";
  6707.                         var c = openDB_chr_classes[f[e]];
  6708.                         $j(g).mouseover(function(d) {
  6709.                             Tooltip.showAtCursor(d, c, 0, 0, "q")
  6710.                         }).mousemove(function(d) {
  6711.                             Tooltip.cursorUpdate(d)
  6712.                         }).mouseout(function() {
  6713.                             Tooltip.hide()
  6714.                         });
  6715.                         ae(j, g)
  6716.                     }
  6717.                     ae(k, j)
  6718.                 }
  6719.             },
  6720.             sortFunc: function(d, c, e) {
  6721.                 return Listview.funcBox.assocArrCmp(Listview.funcBox.assocBinFlags(d.reqclass, openDB_chr_classes), Listview.funcBox.assocBinFlags(c.reqclass, openDB_chr_classes), openDB_chr_classes)
  6722.             }
  6723.         }],
  6724.         getItemLink: function(b) {
  6725.             return "/itemset=" + b.id
  6726.         }
  6727.     },
  6728.     npc: {
  6729.         sort: [1],
  6730.         nItemsPerPage: 100,
  6731.         searchable: 1,
  6732.         filtrable: 1,
  6733.         columns: [{
  6734.             id: "name",
  6735.             name: LANG.name,
  6736.             type: "text",
  6737.             align: "left",
  6738.             value: "name",
  6739.             compute: function(c, f) {
  6740.                 if (c.boss) {
  6741.                     f.className = "boss-padded-icon"
  6742.                 }
  6743.                 var b = ce("a");
  6744.                 b.style.fontFamily = "Verdana, sans-serif";
  6745.                 b.href = this.template.getItemLink(c);
  6746.                 ae(b, ct(c.name));
  6747.                 ae(f, b);
  6748.                 if (c.tag != null) {
  6749.                     var e = ce("div");
  6750.                     e.className = "small";
  6751.                     ae(e, ct("<" + c.tag + ">"));
  6752.                     ae(f, e)
  6753.                 }
  6754.             },
  6755.             getVisibleText: function(a) {
  6756.                 var b = a.name;
  6757.                 if (a.tag) {
  6758.                     b += " <" + a.tag + ">"
  6759.                 }
  6760.                 if (a.boss) {
  6761.                     b += " boss skull"
  6762.                 }
  6763.                 return b
  6764.             },
  6765.             sortFunc: function(d, c, e) {
  6766.                 return strcmp(c.boss, d.boss) || strcmp(d.name, c.name)
  6767.             }
  6768.         }, {
  6769.             id: "level",
  6770.             name: LANG.level,
  6771.             type: "range",
  6772.             width: "10%",
  6773.             getMinValue: function(a) {
  6774.                 return a.minlevel
  6775.             },
  6776.             getMaxValue: function(a) {
  6777.                 return a.maxlevel
  6778.             },
  6779.             compute: function(a, c) {
  6780.                 if (a.classification) {
  6781.                     var b = ce("div");
  6782.                     b.className = "small";
  6783.                     ae(b, ct(openDB_npc_classifications[a.classification]));
  6784.                     ae(c, b)
  6785.                 }
  6786.                 if (a.classification == 3 || a.maxlevel == 9999) {
  6787.                     return "??"
  6788.                 }
  6789.                 if (a.minlevel > 0 && a.maxlevel > 0) {
  6790.                     if (a.minlevel != a.maxlevel) {
  6791.                         return a.minlevel + LANG.hyphen + a.maxlevel
  6792.                     } else {
  6793.                         return a.minlevel
  6794.                     }
  6795.                 }
  6796.                 return -1
  6797.             },
  6798.             getVisibleText: function(a) {
  6799.                 var b = "";
  6800.                 if (a.classification) {
  6801.                     b += " " + openDB_npc_classifications[a.classification]
  6802.                 }
  6803.                 if (a.minlevel > 0 && a.maxlevel > 0) {
  6804.                     b += " ";
  6805.                     if (a.maxlevel == 9999) {
  6806.                         b += "??"
  6807.                     } else {
  6808.                         if (a.minlevel != a.maxlevel) {
  6809.                             b += a.minlevel + LANG.hyphen + a.maxlevel
  6810.                         } else {
  6811.                             b += a.minlevel
  6812.                         }
  6813.                     }
  6814.                 }
  6815.                 return b
  6816.             },
  6817.             sortFunc: function(d, c, e) {
  6818.                 if (e > 0) {
  6819.                     return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel) || strcmp(d.classification, c.classification)
  6820.                 } else {
  6821.                     return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel) || strcmp(d.classification, c.classification)
  6822.                 }
  6823.             }
  6824.         }, {
  6825.             id: "location",
  6826.             name: LANG.location,
  6827.             type: "text",
  6828.             compute: function(a, b) {
  6829.                 return Listview.funcBox.location(a, b)
  6830.             },
  6831.             getVisibleText: function(a) {
  6832.                 return Listview.funcBox.arrayText(a.location, openDB_zones)
  6833.             },
  6834.             sortFunc: function(d, c, e) {
  6835.                 return Listview.funcBox.assocArrCmp(d.location, c.location, openDB_zones)
  6836.             }
  6837.         }, {
  6838.             id: "react",
  6839.             name: LANG.react,
  6840.             type: "text",
  6841.             width: "10%",
  6842.             value: "react",
  6843.             filtrable: 0,
  6844.             compute: function(b, g) {
  6845.                 if (b.react == null) {
  6846.                     return -1
  6847.                 }
  6848.                 var d = [LANG.lvnpc_alliance, LANG.lvnpc_horde];
  6849.                 var f = 0;
  6850.                 for (var a = 0; a < 2; ++a) {
  6851.                     if (b.react[a] != null) {
  6852.                         if (f++ > 0) {
  6853.                             ae(g, ct(" "))
  6854.                         }
  6855.                         var e = ce("span");
  6856.                         e.className = (b.react[a] < 0 ? "q10" : (b.react[a] > 0 ? "q2" : "q"));
  6857.                         ae(e, ct(d[a]));
  6858.                         ae(g, e)
  6859.                     }
  6860.                 }
  6861.             }
  6862.         }, {
  6863.             id: "skin",
  6864.             name: LANG.skin,
  6865.             type: "text",
  6866.             value: "skin",
  6867.             compute: function(c, d) {
  6868.                 if (c.skin) {
  6869.                     var b = ce("a");
  6870.                     b.className = ((isset("openDB_thottbot") && openDB_thottbot) ? "q" : "q1");
  6871.                     b.href = "/npcs&filter=cr=35;crs=0;crv=" + c.skin;
  6872.                     ae(b, ct(c.skin));
  6873.                     ae(d, b)
  6874.                 }
  6875.             },
  6876.             hidden: 1
  6877.         }, {
  6878.             id: "petfamily",
  6879.             name: LANG.petfamily,
  6880.             type: "text",
  6881.             width: "12%",
  6882.             compute: function(c, d) {
  6883.                 d.className = "q1";
  6884.                 var b = ce("a");
  6885.                 b.href = "/pet=" + c.family;
  6886.                 ae(b, ct(openDB_pet_families[c.family]));
  6887.                 ae(d, b)
  6888.             },
  6889.             getVisibleText: function(a) {
  6890.                 return openDB_pet_families[a.family]
  6891.             },
  6892.             sortFunc: function(d, c, e) {
  6893.                 return strcmp(openDB_pet_families[d.family], openDB_pet_families[c.family])
  6894.             },
  6895.             hidden: 1
  6896.         }, {
  6897.             id: "type",
  6898.             name: LANG.type,
  6899.             type: "text",
  6900.             width: "12%",
  6901.             compute: function(c, d) {
  6902.                 d.className = "small q1";
  6903.                 var b = ce("a");
  6904.                 b.href = "/npcs=" + c.type;
  6905.                 ae(b, ct(openDB_npc_types[c.type]));
  6906.                 ae(d, b)
  6907.             },
  6908.             getVisibleText: function(a) {
  6909.                 return openDB_npc_types[a.type]
  6910.             },
  6911.             sortFunc: function(d, c, e) {
  6912.                 return strcmp(openDB_npc_types[d.type], openDB_npc_types[c.type])
  6913.             }
  6914.         }],
  6915.         getItemLink: function(a) {
  6916.             return "/npc=" + a.id
  6917.         }
  6918.     },
  6919.     object: {
  6920.         sort: [1],
  6921.         nItemsPerPage: 100,
  6922.         searchable: 1,
  6923.         filtrable: 1,
  6924.         columns: [{
  6925.             id: "name",
  6926.             name: LANG.name,
  6927.             type: "text",
  6928.             align: "left",
  6929.             value: "name",
  6930.             compute: function(c, d) {
  6931.                 var b = ce("a");
  6932.                 b.style.fontFamily = "Verdana, sans-serif";
  6933.                 b.href = this.template.getItemLink(c);
  6934.                 ae(b, ct(c.name));
  6935.                 ae(d, b)
  6936.             }
  6937.         }, {
  6938.             id: "location",
  6939.             name: LANG.location,
  6940.             type: "text",
  6941.             compute: function(a, b) {
  6942.                 return Listview.funcBox.location(a, b)
  6943.             },
  6944.             getVisibleText: function(a) {
  6945.                 return Listview.funcBox.arrayText(a.location, openDB_zones)
  6946.             },
  6947.             sortFunc: function(d, c, e) {
  6948.                 return Listview.funcBox.assocArrCmp(d.location, c.location, openDB_zones)
  6949.             }
  6950.         }, {
  6951.             id: "skill",
  6952.             name: LANG.skill,
  6953.             width: "10%",
  6954.             value: "skill",
  6955.             hidden: true
  6956.         }, {
  6957.             id: "type",
  6958.             name: LANG.type,
  6959.             type: "text",
  6960.             width: "12%",
  6961.             compute: function(c, d) {
  6962.                 d.className = "small q1";
  6963.                 var b = ce("a");
  6964.                 b.href = "objects=" + c.type;
  6965.                 ae(b, ct(openDB_object_types[c.type]));
  6966.                 ae(d, b)
  6967.             },
  6968.             getVisibleText: function(a) {
  6969.                 return openDB_object_types[a.type]
  6970.             },
  6971.             sortFunc: function(d, c, e) {
  6972.                 return strcmp(openDB_object_types[d.type], openDB_object_types[c.type])
  6973.             }
  6974.         }],
  6975.         getItemLink: function(a) {
  6976.             return "object=" + a.id
  6977.         }
  6978.     },
  6979.     quest: {
  6980.         sort: [1, 2],
  6981.         nItemsPerPage: 100,
  6982.         searchable: 1,
  6983.         filtrable: 1,
  6984.         columns: [{
  6985.             id: "name",
  6986.             name: LANG.name,
  6987.             type: "text",
  6988.             align: "left",
  6989.             value: "name",
  6990.             compute: function(j, f) {
  6991.                 var l = $j("<a/>", {
  6992.                     css: {
  6993.                         "font-family": "Verdana, sans serif"
  6994.                     },
  6995.                     href: this.template.getItemLink(j),
  6996.                     text: j.name
  6997.                 });
  6998.                 var b = $j("<div/>");
  6999.                 b.append(l);
  7000.                 if (j.reqclass) {
  7001.                     var k = $j("<div/>", {
  7002.                         "class": "small2"
  7003.                     });
  7004.                     var e = Listview.funcBox.assocBinFlags(j.reqclass, openDB_chr_classes);
  7005.                     for (var g = 0, h = e.length; g < h; ++g) {
  7006.                         if (g > 0) {
  7007.                             k.append(", ")
  7008.                         }
  7009.                         var l = $j("<a/>", {
  7010.                             href: "javascript:;",
  7011.                             "class": "c" + e[g],
  7012.                             text: openDB_chr_classes[e[g]]
  7013.                         });
  7014.                         k.append(l)
  7015.                     }
  7016.                     b.append(k)
  7017.                 }
  7018.                 if (j.historical || (j.wflags & 32) || (j.reqrace && j.reqrace != -1)) {
  7019.                     b.css("position", "relative");
  7020.                     var k = $j("<div/>", {
  7021.                         "class": "small",
  7022.                         css: {
  7023.                             "font-style": "italic",
  7024.                             position: "absolute",
  7025.                             right: "3px",
  7026.                             bottom: "3px",
  7027.                             "text-align": "right"
  7028.                         }
  7029.                     });
  7030.                     if (j.historical) {
  7031.                         var m = $j("<span/>", {
  7032.                             css: {
  7033.                                 color: "red"
  7034.                             },
  7035.                             text: LANG.lvquest_removed
  7036.                         });
  7037.                         k.append(m)
  7038.                     }
  7039.                     if (j.wflags & 32) {
  7040.                         if (j.historical) {
  7041.                             k.append($j("<br/>"));
  7042.                             b.css("height", "33px")
  7043.                         }
  7044.                         var m = $j("<span/>", {
  7045.                             text: LANG.lvquest_autoaccept
  7046.                         });
  7047.                         if (j.wflags & 64) {
  7048.                             m.css("color", "red").append(" " + LANG.lvquest_hostile)
  7049.                         }
  7050.                         k.append(m)
  7051.                     }
  7052.                     if (j.reqrace && j.reqrace != -1) {
  7053.                         var c = Listview.funcBox.assocBinFlags(j.reqrace, openDB_chr_races);
  7054.                         if (c.length && (j.historical || (j.wflags & 32))) {
  7055.                             k.append($j("<br/>"));
  7056.                             b.css("height", "33px")
  7057.                         }
  7058.                         for (var g = 0, h = c.length; g < h; ++g) {
  7059.                             if (g > 0) {
  7060.                                 k.append(", ")
  7061.                             }
  7062.                             var l = $j("<a/>", {
  7063.                                 "class": "q1",
  7064.                                 href: "javascript:;",
  7065.                                 text: openDB_chr_races[c[g]]
  7066.                             });
  7067.                             k.append(l)
  7068.                         }
  7069.                     }
  7070.                     b.append(k)
  7071.                 }
  7072.                 $j(f).append(b)
  7073.             }
  7074.         }, {
  7075.             id: "level",
  7076.             name: LANG.level,
  7077.             value: "level",
  7078.             compute: function(a, c) {
  7079.                 if (a.type || a.daily || a.weekly) {
  7080.                     var b = ce("div");
  7081.                     b.className = "small";
  7082.                     nw(b);
  7083.                     if (a.daily) {
  7084.                         if (a.type) {
  7085.                             ae(b, ct(sprintf(LANG.lvquest_daily, openDB_quest_types[a.type])))
  7086.                         } else {
  7087.                             ae(b, ct(LANG.daily))
  7088.                         }
  7089.                     } else {
  7090.                         if (a.weekly) {
  7091.                             if (a.type) {
  7092.                                 ae(b, ct(sprintf(LANG.lvquest_weekly, openDB_quest_types[a.type])))
  7093.                             } else {
  7094.                                 ae(b, ct(LANG.weekly))
  7095.                             }
  7096.                         } else {
  7097.                             if (a.type) {
  7098.                                 ae(b, ct(openDB_quest_types[a.type]))
  7099.                             }
  7100.                         }
  7101.                     }
  7102.                     ae(c, b)
  7103.                 }
  7104.                 return a.level
  7105.             },
  7106.             getVisibleText: function(a) {
  7107.                 var b = "";
  7108.                 if (a.type) {
  7109.                     b += " " + openDB_quest_types[a.type]
  7110.                 }
  7111.                 if (a.daily) {
  7112.                     b += " " + LANG.daily
  7113.                 } else {
  7114.                     if (a.weekly) {
  7115.                         b += " " + LANG.weekly
  7116.                     }
  7117.                 }
  7118.                 if (a.level) {
  7119.                     b += " " + a.level
  7120.                 }
  7121.                 return b
  7122.             },
  7123.             sortFunc: function(d, c, e) {
  7124.                 return strcmp(d.level, c.level) || strcmp(d.type, c.type)
  7125.             }
  7126.         }, {
  7127.             id: "reqlevel",
  7128.             name: LANG.req,
  7129.             tooltip: LANG.tooltip_reqlevel,
  7130.             value: "reqlevel"
  7131.         }, {
  7132.             id: "side",
  7133.             name: LANG.side,
  7134.             type: "text",
  7135.             compute: function(a, c) {
  7136.                 if (a.side && a.side != 3) {
  7137.                     var b = ce("span");
  7138.                     b.className = (a.side == 1 ? "alliance-icon" : "horde-icon");
  7139.                     b.onmouseover = function(d) {
  7140.                         Tooltip.showAtCursor(d, openDB_sides[a.side], 0, 0, "q")
  7141.                     };
  7142.                     b.onmousemove = Tooltip.cursorUpdate;
  7143.                     b.onmouseout = Tooltip.hide;
  7144.                     ae(c, b)
  7145.                 } else {
  7146.                     if (!a.side) {
  7147.                         ae(c, ct("??"))
  7148.                     }
  7149.                 }
  7150.             },
  7151.             getVisibleText: function(a) {
  7152.                 if (a.side) {
  7153.                     return openDB_sides[a.side]
  7154.                 }
  7155.             },
  7156.             sortFunc: function(d, c, e) {
  7157.                 return strcmp(openDB_sides[d.side], openDB_sides[c.side])
  7158.             }
  7159.         }, {
  7160.             id: "rewards",
  7161.             name: LANG.rewards,
  7162.             compute: function(b, g) {
  7163.                 var a = (b.itemchoices != null || b.itemrewards != null);
  7164.                 if (a) {
  7165.                     var f, e;
  7166.                     if (b.itemchoices && b.itemchoices.length > 1) {
  7167.                         f = LANG.lvquest_pickone;
  7168.                         if (b.itemrewards && b.itemrewards.length > 0) {
  7169.                             e = LANG.lvquest_alsoget
  7170.                         }
  7171.                     }
  7172.                     Listview.funcBox.createCenteredIcons(b.itemchoices, g, f, 2);
  7173.                     Listview.funcBox.createCenteredIcons(b.itemrewards, g, e, 2)
  7174.                 }
  7175.                 if (b.titlereward && openDB_titles[b.titlereward]) {
  7176.                     var d = openDB_titles[b.titlereward]["name_" + Locale.getName()];
  7177.                     d = d.replace("%s", '<span class="q0">&lt;' + LANG.name + "&gt;</span>");
  7178.                     var c = ce("a");
  7179.                     c.className = "q1";
  7180.                     c.href = "/title=" + b.titlereward;
  7181.                     c.innerHTML = d;
  7182.                     ae(g, c);
  7183.                     ae(g, ce("br"))
  7184.                 }
  7185.             },
  7186.             getVisibleText: function(a) {
  7187.                 var b = "";
  7188.                 if (a.itemchoices && a.itemchoices.length) {
  7189.                     b += " " + LANG.lvquest_pickone;
  7190.                     if (a.itemrewards && a.itemrewards.length) {
  7191.                         b += " " + LANG.lvquest_alsoget
  7192.                     }
  7193.                 }
  7194.                 if (a.titlereward && openDB_titles[a.titlereward]) {
  7195.                     b += " " + openDB_titles[a.titlereward]["name_" + Locale.getName()]
  7196.                 }
  7197.                 return b
  7198.             },
  7199.             sortFunc: function(d, c, f) {
  7200.                 var i = (d.itemchoices != null ? d.itemchoices.length : 0) + (d.itemrewards != null ? d.itemrewards.length : 0);
  7201.                 var h = (c.itemchoices != null ? c.itemchoices.length : 0) + (c.itemrewards != null ? c.itemrewards.length : 0);
  7202.                 var e = (d.titlereward && openDB_titles[d.titlereward] ? openDB_titles[d.titlereward]["name_" + Locale.getName()] : "");
  7203.                 var g = (c.titlereward && openDB_titles[c.titlereward] ? openDB_titles[c.titlereward]["name_" + Locale.getName()] : "");
  7204.                 return strcmp(i, h) || strcmp(e, g)
  7205.             }
  7206.         }, {
  7207.             id: "experience",
  7208.             name: "Exp",
  7209.             value: "xp"
  7210.         }, {
  7211.             id: "money",
  7212.             name: "Money",
  7213.             compute: function(a, b) {
  7214.                 if (a.money > 0 || a.currencyrewards != null) {
  7215.                     if (a.money > 0) {
  7216.                         Listview.funcBox.appendMoney(b, a.money);
  7217.                         if (a.currencyrewards != null) {
  7218.                             ae(b, ct(" + "))
  7219.                         }
  7220.                     }
  7221.                     if (a.currencyrewards != null) {
  7222.                         Listview.funcBox.appendMoney(b, null, a.side, null, a.currencyrewards)
  7223.                     }
  7224.                 }
  7225.             },
  7226.             getVisibleText: function(a) {
  7227.                 var c = "";
  7228.                 for (var b = 0; b < a.currencyrewards.length; ++b) {
  7229.                     if (openDB_gatheredcurrencies[a.currencyrewards[b][0]]) {
  7230.                         c += " " + openDB_gatheredcurrencies[a.currencyrewards[b][0]]["name_" + Locale.getName()]
  7231.                     }
  7232.                 }
  7233.                 return c
  7234.             },
  7235.             sortFunc: function(d, c, e) {
  7236.                 var g = 0,
  7237.                     f = 0;
  7238.                 if (d.currencyrewards && d.currencyrewards.length) {
  7239.                     $.each(d.currencyrewards, function(a, b) {
  7240.                         g += b[1]
  7241.                     })
  7242.                 }
  7243.                 if (c.currencyrewards && c.currencyrewards.length) {
  7244.                     $.each(c.currencyrewards, function(a, b) {
  7245.                         f += b[1]
  7246.                     })
  7247.                 }
  7248.                 return strcmp(g, f) || strcmp(d.money, c.money)
  7249.             }
  7250.         }, {
  7251.             id: "reputation",
  7252.             name: LANG.reputation,
  7253.             width: "14%",
  7254.             value: "id",
  7255.             hidden: true
  7256.         }, {
  7257.             id: "category",
  7258.             name: LANG.category,
  7259.             type: "text",
  7260.             compute: function(c, d) {
  7261.                 if (c.category != 0) {
  7262.                     d.className = "small q1";
  7263.                     var b = ce("a");
  7264.                     b.href = "/quests=" + c.category2 + "." + c.category;
  7265.                     ae(b, ct(Listview.funcBox.getQuestCategory(c.category)));
  7266.                     ae(d, b)
  7267.                 }
  7268.             },
  7269.             getVisibleText: function(a) {
  7270.                 return Listview.funcBox.getQuestCategory(a.category)
  7271.             },
  7272.             sortFunc: function(d, c, f) {
  7273.                 var e = Listview.funcBox.getQuestCategory;
  7274.                 return strcmp(e(d.category), e(c.category))
  7275.             }
  7276.         }],
  7277.         getItemLink: function(a) {
  7278.             return "/quest=" + a.id
  7279.         }
  7280.     },
  7281.     spell: {
  7282.         sort: ["name", "skill", "level"],
  7283.         searchable: 1,
  7284.         filtrable: 1,
  7285.         columns: [{
  7286.             id: "name",
  7287.             name: LANG.name,
  7288.             type: "text",
  7289.             align: "left",
  7290.             span: 2,
  7291.             value: "name",
  7292.             compute: function(j, g, m) {
  7293.                 var h = ce("td"),
  7294.                     p;
  7295.                 h.style.width = "44px";
  7296.                 h.style.padding = "0";
  7297.                 h.style.borderRight = "none";
  7298.                 if (j.creates != null) {
  7299.                     p = openDB_items.createIcon(j.creates[0], 1, Listview.funcBox.createTextRange(j.creates[1], j.creates[2]))
  7300.                 } else {
  7301.                     p = openDB_spells.createIcon(j.id, 1)
  7302.                 }
  7303.                 p.style.cssFloat = p.style.styleFloat = "left";
  7304.                 ae(h, p);
  7305.                 ae(m, h);
  7306.                 g.style.borderLeft = "none";
  7307.                 var b = ce("div");
  7308.                 var o = ce("a");
  7309.                 var n = j.name.charAt(0);
  7310.                 if (n != "@") {
  7311.                     o.className = "q" + (7 - parseInt(n))
  7312.                 }
  7313.                 o.style.fontFamily = "Verdana, sans-serif";
  7314.                 o.href = this.template.getItemLink(j);
  7315.                 ae(o, ct(j.name.substring(1)));
  7316.                 ae(b, o);
  7317.                 if (j.rank) {
  7318.                     var l = ce("div");
  7319.                     l.className = "small2";
  7320.                     ae(l, ct(j.rank));
  7321.                     ae(b, l)
  7322.                 }
  7323.                 if (this.showRecipeClass && j.reqclass) {
  7324.                     var l = ce("div");
  7325.                     l.className = "small2";
  7326.                     var f = Listview.funcBox.assocBinFlags(j.reqclass, openDB_chr_classes);
  7327.                     for (var h = 0, k = f.length; h < k; ++h) {
  7328.                         if (h > 0) {
  7329.                             ae(l, ct(", "))
  7330.                         }
  7331.                         var o = ce("a");
  7332.                         o.href = "javascript:;";
  7333.                         o.className = "c" + f[h];
  7334.                         st(o, openDB_chr_classes[f[h]]);
  7335.                         ae(l, o)
  7336.                     }
  7337.                     ae(b, l)
  7338.                 }
  7339.                 if (j.reqrace) {
  7340.                     b.style.position = "relative";
  7341.                     var l = ce("div");
  7342.                     l.className = "small";
  7343.                     l.style.fontStyle = "italic";
  7344.                     l.style.position = "absolute";
  7345.                     l.style.right = l.style.bottom = "3px";
  7346.                     if ((j.reqrace & 1791) == 1101) {
  7347.                         ae(l, ct(openDB_sides[1]))
  7348.                     } else {
  7349.                         if ((j.reqrace & 1791) == 690) {
  7350.                             ae(l, ct(openDB_sides[2]))
  7351.                         } else {
  7352.                             var e = Listview.funcBox.assocBinFlags(j.reqrace, openDB_chr_races);
  7353.                             l.className += "q1";
  7354.                             for (var h = 0, k = e.length; h < k; ++h) {
  7355.                                 if (h > 0) {
  7356.                                     ae(l, ct(LANG.comma))
  7357.                                 }
  7358.                                 var o = ce("a");
  7359.                                 o.href = "javascript:;";
  7360.                                 st(o, openDB_chr_races[e[h]]);
  7361.                                 ae(l, o)
  7362.                             }
  7363.                         }
  7364.                     }
  7365.                     ae(b, l)
  7366.                 }
  7367.                 ae(g, b)
  7368.             },
  7369.             getVisibleText: function(c) {
  7370.                 var f = c.name;
  7371.                 if (c.rank) {
  7372.                     f += " " + c.rank
  7373.                 }
  7374.                 if (c.reqclass) {
  7375.                     var e = Listview.funcBox.assocBinFlags(c.reqclass, openDB_chr_classes);
  7376.                     for (var d = 0, b = e.length; d < b; ++d) {
  7377.                         if (d > 0) {
  7378.                             f += LANG.comma
  7379.                         }
  7380.                         f += openDB_chr_classes[e[d]]
  7381.                     }
  7382.                 }
  7383.                 if (c.reqrace) {
  7384.                     f += " " + Listview.funcBox.arrayText(Listview.funcBox.assocBinFlags(c.reqrace, openDB_chr_races), openDB_chr_races)
  7385.                 }
  7386.                 return f
  7387.             }
  7388.         }, {
  7389.             id: "tier",
  7390.             name: LANG.tier,
  7391.             width: "10%",
  7392.             value: "level",
  7393.             compute: function(c, e) {
  7394.                 if (c.level > 0) {
  7395.                     var b = (!this._petTalents ? 10 : 20),
  7396.                         d = (!this._petTalents ? 5 : 12);
  7397.                     return Math.floor((c.level - b) / d) + 1
  7398.                 }
  7399.             },
  7400.             hidden: true
  7401.         }, {
  7402.             id: "level",
  7403.             name: LANG.level,
  7404.             width: "10%",
  7405.             value: "level",
  7406.             compute: function(b, c) {
  7407.                 if (b.level > 0) {
  7408.                     return b.level
  7409.                 }
  7410.             },
  7411.             hidden: true
  7412.         }, {
  7413.             id: "trainingcost",
  7414.             name: LANG.cost,
  7415.             width: "10%",
  7416.             hidden: true,
  7417.             getValue: function(b) {
  7418.                 if (b.trainingcost) {
  7419.                     return b.trainingcost
  7420.                 }
  7421.             },
  7422.             compute: function(b, c) {
  7423.                 if (b.trainingcost) {
  7424.                     Listview.funcBox.appendMoney(c, b.trainingcost)
  7425.                 }
  7426.             },
  7427.             sortFunc: function(d, c, e) {
  7428.                 if (d.trainingcost == null) {
  7429.                     return -1
  7430.                 } else {
  7431.                     if (c.trainingcost == null) {
  7432.                         return 1
  7433.                     }
  7434.                 }
  7435.                 if (d.trainingcost < c.trainingcost) {
  7436.                     return -1
  7437.                 } else {
  7438.                     if (d.trainingcost > c.trainingcost) {
  7439.                         return 1
  7440.                     }
  7441.                 }
  7442.                 return 0
  7443.             }
  7444.         }, {
  7445.             id: "classes",
  7446.             name: LANG.classes,
  7447.             type: "text",
  7448.             hidden: true,
  7449.             width: "20%",
  7450.             getVisibleText: function(c) {
  7451.                 var f = "";
  7452.                 if (c.reqclass) {
  7453.                     var e = Listview.funcBox.assocBinFlags(c.reqclass, openDB_chr_classes);
  7454.                     for (var d = 0, b = e.length; d < b; ++d) {
  7455.                         if (d > 0) {
  7456.                             f += LANG.comma
  7457.                         }
  7458.                         f += openDB_chr_classes[e[d]]
  7459.                     }
  7460.                 }
  7461.                 return f
  7462.             },
  7463.             compute: function(e, k) {
  7464.                 if (e.reqclass) {
  7465.                     var g = Listview.funcBox.assocBinFlags(e.reqclass, openDB_chr_classes);
  7466.                     var j = ce("div");
  7467.                     j.style.width = (26 * g.length) + "px";
  7468.                     j.style.margin = "0 auto";
  7469.                     for (var f = 0, b = g.length; f < b; ++f) {
  7470.                         var h = Icon.create("class_" + openDB_file_classes[g[f]], 0, null, "/class=" + g[f]);
  7471.                         h.style.cssFloat = h.style.styleFloat = "left";
  7472.                         var c = openDB_chr_classes[g[f]];
  7473.                         $(h).mouseover(function(d) {
  7474.                             Tooltip.showAtCursor(d, c, 0, 0, "q")
  7475.                         }).mousemove(function(d) {
  7476.                             Tooltip.cursorUpdate(d)
  7477.                         }).mouseout(function() {
  7478.                             Tooltip.hide()
  7479.                         });
  7480.                         ae(j, h)
  7481.                     }
  7482.                     ae(k, j)
  7483.                 }
  7484.             },
  7485.             sortFunc: function(d, c, e) {
  7486.                 return Listview.funcBox.assocArrCmp(Listview.funcBox.assocBinFlags(d.reqclass, openDB_chr_classes), Listview.funcBox.assocBinFlags(c.reqclass, openDB_chr_classes), openDB_chr_classes)
  7487.             }
  7488.         }, {
  7489.             id: "singleclass",
  7490.             name: LANG.classs,
  7491.             type: "text",
  7492.             hidden: true,
  7493.             width: "15%",
  7494.             compute: function(b, f) {
  7495.                 if (b.reqclass) {
  7496.                     var c = Listview.funcBox.assocBinFlags(b.reqclass, openDB_chr_classes);
  7497.                     var d = c[0];
  7498.                     var e = $("<a>").css("background-image", 'url(http://cdn.openwow.com/' + qsUrl + '/icons/tiny/class_' + openDB_file_classes[d] + '.gif")').addClass("icontiny tinyspecial").addClass("c" + d).attr("href", "/class=" + d).text(openDB_chr_classes[d]);
  7499.                     $(f).append(e)
  7500.                 }
  7501.             },
  7502.             sortFunc: function(d, c, e) {
  7503.                 return Listview.funcBox.assocArrCmp(Listview.funcBox.assocBinFlags(d.reqclass, openDB_chr_classes), Listview.funcBox.assocBinFlags(c.reqclass, openDB_chr_classes), openDB_chr_classes)
  7504.             }
  7505.         }, {
  7506.             id: "glyphtype",
  7507.             name: LANG.glyphtype,
  7508.             type: "text",
  7509.             hidden: true,
  7510.             width: "10%",
  7511.             compute: function(b, c) {
  7512.                 if (b.glyphtype) {
  7513.                     return openDB_item_glyphs[b.glyphtype]
  7514.                 }
  7515.             }
  7516.         }, {
  7517.             id: "guildlevel",
  7518.             name: LANG.guildlevel,
  7519.             width: "10%",
  7520.             value: "guildlevel",
  7521.             compute: function(b, c) {
  7522.                 if (b.guildlevel > 0) {
  7523.                     return b.guildlevel
  7524.                 }
  7525.             },
  7526.             hidden: true
  7527.         }, {
  7528.             id: "schools",
  7529.             name: LANG.school,
  7530.             type: "text",
  7531.             width: "10%",
  7532.             hidden: true,
  7533.             compute: function(b, f) {
  7534.                 var e = "";
  7535.                 var d = b.schools ? b.schools : b.school;
  7536.                 for (var c = 0; c < 32; ++c) {
  7537.                     if (!(d & (1 << c))) {
  7538.                         continue
  7539.                     }
  7540.                     if (e != "") {
  7541.                         e += ", "
  7542.                     }
  7543.                     e += openDB_spell_resistances[c]
  7544.                 }
  7545.                 return e
  7546.             },
  7547.             sortFunc: function(d, c, e) {
  7548.                 return strcmp(this.compute(d), this.compute(c))
  7549.             }
  7550.         }, {
  7551.             id: "type",
  7552.             name: LANG.type,
  7553.             type: "text",
  7554.             width: "10%",
  7555.             hidden: true,
  7556.             compute: function(b, c) {
  7557.                 if (openDB_spell_types[b.cat]) {
  7558.                     return openDB_spell_types[b.cat][b.type]
  7559.                 }
  7560.                 return b.type
  7561.             },
  7562.             sortFunc: function(d, c, e) {
  7563.                 var g = (openDB_spell_types[d.cat] ? openDB_spell_types[d.cat][d.type] : d.type),
  7564.                     f = (openDB_spell_types[c.cat] ? openDB_spell_types[c.cat][c.type] : d.type);
  7565.                 return strcmp(d.cat, c.cat) || strcmp(g, f)
  7566.             }
  7567.         }, {
  7568.             id: "reagents",
  7569.             name: LANG.reagents,
  7570.             width: "9%",
  7571.             getValue: function(b) {
  7572.                 return (b.reagents ? b.reagents.length : 0)
  7573.             },
  7574.             compute: function(h, e) {
  7575.                 var b = (h.reagents != null);
  7576.                 if (b) {
  7577.                     e.style.padding = "0";
  7578.                     var l = ce("div");
  7579.                     var k = h.reagents;
  7580.                     l.style.width = (44 * k.length) + "px";
  7581.                     l.style.margin = "0 auto";
  7582.                     for (var f = 0, j = k.length; f < j; ++f) {
  7583.                         var c = k[f][0];
  7584.                         var g = k[f][1];
  7585.                         var m = openDB_items.createIcon(c, 1, g);
  7586.                         m.style.cssFloat = m.style.styleFloat = "left";
  7587.                         ae(l, m)
  7588.                     }
  7589.                     ae(e, l)
  7590.                 }
  7591.             },
  7592.             sortFunc: function(d, c) {
  7593.                 var f = (d.reagents != null ? d.reagents.length : 0);
  7594.                 var e = (c.reagents != null ? c.reagents.length : 0);
  7595.                 if (f > 0 && f == e) {
  7596.                     return strcmp(d.reagents.toString(), c.reagents.toString())
  7597.                 } else {
  7598.                     return strcmp(f, e)
  7599.                 }
  7600.             }
  7601.         }, {
  7602.             id: "source",
  7603.             name: LANG.source,
  7604.             type: "text",
  7605.             width: "12%",
  7606.             hidden: true,
  7607.             compute: function(c, f) {
  7608.                 if (c.source != null) {
  7609.                     var e = "";
  7610.                     for (var d = 0, b = c.source.length; d < b; ++d) {
  7611.                         if (d > 0) {
  7612.                             e += LANG.comma
  7613.                         }
  7614.                         e += openDB_sources[c.source[d]]
  7615.                     }
  7616.                     return e
  7617.                 }
  7618.             },
  7619.             sortFunc: function(d, c, e) {
  7620.                 return Listview.funcBox.assocArrCmp(d.source, c.source, openDB_sources)
  7621.             }
  7622.         }, {
  7623.             id: "branch",
  7624.             name: LANG.branch,
  7625.             type: "text",
  7626.             width: "10%",
  7627.             hidden: true,
  7628.             compute: function(b, c) {
  7629.                 if (b.project) {
  7630.                     if (openDB_project_branches[b.project.branch]) {
  7631.                         $(c).append(openDB_project_branches[b.project.branch] + "<br />")
  7632.                     }
  7633.                     $(c).append("<small" + (!b.project.rarity ? ' class="q0"' : "") + ">" + openDB_project_rarity[b.project.rarity || 0] + "</small>")
  7634.                 }
  7635.             },
  7636.             getVisibleText: function(b) {
  7637.                 var c = "";
  7638.                 if (b.project) {
  7639.                     if (openDB_project_branches[b.project.branch]) {
  7640.                         c += openDB_project_branches[b.project.branch] + " "
  7641.                     }
  7642.                     c += openDB_project_rarity[b.project.rarity || 0]
  7643.                 }
  7644.                 return c
  7645.             },
  7646.             sortFunc: function(d, c, e) {
  7647.                 if (!d.project || !c.project) {
  7648.                     return (d.project ? 1 : (c.project ? -1 : 0))
  7649.                 }
  7650.                 return strcmp(openDB_project_branches[d.project.branch], openDB_project_branches[c.project.branch]) || -strcmp(d.project.rarity, c.project.rarity)
  7651.             }
  7652.         }, {
  7653.             id: "fragments",
  7654.             name: LANG.fragments,
  7655.             type: "text",
  7656.             width: "10%",
  7657.             hidden: true,
  7658.             compute: function(b, d) {
  7659.                 if (b.project) {
  7660.                     var c = $("<a/>", {
  7661.                         href: "javascript:;",
  7662.                         text: b.project.ncurrency
  7663.                     });
  7664.                     c.addClass("q1");
  7665.                     if (openDB_gatheredcurrencies[b.project.currency]) {
  7666.                         c.addClass("icontinyr tip");
  7667.                         c.css("background-image", "url(http://cdn.openwow.com/" + qsUrl + "/icons/tiny/" + openDB_gatheredcurrencies[b.project.currency].icon[0].toLowerCase() + ".gif)");
  7668.                         c.mouseover(function(f) {
  7669.                             Tooltip.showAtCursor(f, openDB_gatheredcurrencies[b.project.currency]["name_" + Locale.getName()], 0, 0, "q")
  7670.                         });
  7671.                         c.mousemove(Tooltip.cursorUpdate);
  7672.                         c.mouseout(Tooltip.hide)
  7673.                     }
  7674.                     $(d).append(c)
  7675.                 }
  7676.             },
  7677.             sortFunc: function(d, c, e) {
  7678.                 if (!d.project || !c.project) {
  7679.                     return (d.project ? 1 : (c.project ? -1 : 0))
  7680.                 }
  7681.                 return strcmp(d.project.ncurrency, c.project.ncurrency) || strcmp(d.project.currency, c.project.currency)
  7682.             }
  7683.         }, {
  7684.             id: "keystone",
  7685.             name: LANG.keystone,
  7686.             type: "text",
  7687.             width: "10%",
  7688.             hidden: true,
  7689.             compute: function(b, e) {
  7690.                 if (b.project && b.project.nkeystones && openDB_items[b.project.keystone]) {
  7691.                     e.style.padding = "0";
  7692.                     var c = ce("div");
  7693.                     c.style.width = "44px";
  7694.                     c.style.margin = "0 auto";
  7695.                     ae(c, openDB_items.createIcon(b.project.keystone, 1, b.project.nkeystones));
  7696.                     ae(e, c)
  7697.                 }
  7698.             },
  7699.             getVisibleText: function(b) {
  7700.                 if (b.project && b.project.nkeystones && openDB_items[b.project.keystone]) {
  7701.                     return openDB_items[b.project.keystone]["name_" + Locale.getName()]
  7702.                 }
  7703.             },
  7704.             sortFunc: function(d, c, g) {
  7705.                 if (!d.project || !c.project) {
  7706.                     return (d.project ? 1 : (c.project ? -1 : 0))
  7707.                 }
  7708.                 var f = d.project.nkeystones && openDB_items[d.project.keystone] ? openDB_items[d.project.keystone]["name_" + Locale.getName()] : "";
  7709.                 var e = c.project.nkeystones && openDB_items[c.project.keystone] ? openDB_items[c.project.keystone]["name_" + Locale.getName()] : "";
  7710.                 return strcmp(f, e) || strcmp(d.project.nkeystones, c.project.nkeystones)
  7711.             }
  7712.         }, {
  7713.             id: "skill",
  7714.             name: LANG.skill,
  7715.             type: "text",
  7716.             width: "16%",
  7717.             getValue: function(b) {
  7718.                 return b.learnedat
  7719.             },
  7720.             compute: function(j, g, m, r) {
  7721.                 if (j.skill != null) {
  7722.                     this.skillsColumn = r;
  7723.                     var c = ce("div");
  7724.                     c.className = "small";
  7725.                     if (j.cat == -7 && j.pettype != null) {
  7726.                         j.skill = [];
  7727.                         var q = {
  7728.                             0: 410,
  7729.                             1: 409,
  7730.                             2: 411
  7731.                         };
  7732.                         for (var h = 0, k = j.pettype.length; h < k; ++h) {
  7733.                             j.skill.push(q[j.pettype[h]])
  7734.                         }
  7735.                     }
  7736.                     for (var h = 0, k = j.skill.length; h < k; ++h) {
  7737.                         if (h > 0) {
  7738.                             ae(c, ct(LANG.comma))
  7739.                         }
  7740.                         if (j.skill[h] == -1) {
  7741.                             ae(c, ct(LANG.ellipsis))
  7742.                         } else {
  7743.                             if (in_array([7, -2, -3, -5, -6, -7, 11, 9], j.cat) != -1) {
  7744.                                 var o = ce("a");
  7745.                                 o.className = "q1";
  7746.                                 if (in_array([-5, -6], j.cat) != -1) {
  7747.                                     o.href = "/spells=" + j.cat
  7748.                                 } else {
  7749.                                     o.href = "/spells=" + j.cat + "." + ((j.reqclass && (j.cat == 7 || j.cat == -2)) ? (j.reqclass) + "." : "") + j.skill[h]
  7750.                                 }
  7751.                                 var e = openDB_getGets();
  7752.                                 var f = (e.spells ? e.spells.split(".") : [false, false]);
  7753.                                 if (j.reqclass && (j.cat == 7 || j.cat == -2)) {
  7754.                                     if (h < 1 && (j.reqclass != f[1])) {
  7755.                                         var b = ce("a");
  7756.                                         b.className = "q0";
  7757.                                         b.href = "/spells=" + j.cat + "." + j.reqclass;
  7758.                                         ae(b, ct(openDB_chr_classes[j.reqclass]));
  7759.                                         ae(c, b);
  7760.                                         ae(c, ce("br"))
  7761.                                     }
  7762.                                 }
  7763.                                 ae(o, ct(j.cat == -7 && j.pettype != null ? openDB_pet_types[j.pettype[h]] : openDB_spell_skills[j.skill[h]]));
  7764.                                 ae(c, o)
  7765.                             } else {
  7766.                                 ae(c, ct(openDB_spell_skills[j.skill[h]]))
  7767.                             }
  7768.                         }
  7769.                     }
  7770.                     if (j.learnedat > 0) {
  7771.                         ae(c, ct(" ("));
  7772.                         var d = ce("span");
  7773.                         if (j.learnedat == 9999) {
  7774.                             d.className = "q0";
  7775.                             ae(d, ct("??"))
  7776.                         } else {
  7777.                             if (j.learnedat > 0) {
  7778.                                 ae(d, ct(j.learnedat));
  7779.                                 d.style.fontWeight = "bold"
  7780.                             }
  7781.                         }
  7782.                         ae(c, d);
  7783.                         ae(c, ct(")"))
  7784.                     }
  7785.                     ae(g, c);
  7786.                     if (j.colors != null) {
  7787.                         this.columns[r].type = null;
  7788.                         var l = j.colors,
  7789.                             p = 0;
  7790.                         for (var h = 0; h < l.length; ++h) {
  7791.                             if (l[h] > 0) {
  7792.                                 ++p;
  7793.                                 break
  7794.                             }
  7795.                         }
  7796.                         if (p > 0) {
  7797.                             p = 0;
  7798.                             c = ce("div");
  7799.                             c.className = "small";
  7800.                             c.style.fontWeight = "bold";
  7801.                             for (var h = 0; h < l.length; ++h) {
  7802.                                 if (l[h] > 0) {
  7803.                                     if (p++ > 0) {
  7804.                                         ae(c, ct(" "))
  7805.                                     }
  7806.                                     var n = ce("span");
  7807.                                     n.className = "r" + (h + 1);
  7808.                                     ae(n, ct(l[h]));
  7809.                                     ae(c, n)
  7810.                                 }
  7811.                             }
  7812.                             ae(g, c)
  7813.                         }
  7814.                     }
  7815.                 }
  7816.             },
  7817.             getVisibleText: function(b) {
  7818.                 var c = Listview.funcBox.arrayText(b.skill, openDB_spell_skills);
  7819.                 if (b.learnedat > 0) {
  7820.                     c += " " + (b.learnedat == 9999 ? "??" : b.learnedat)
  7821.                 }
  7822.                 return c
  7823.             },
  7824.             sortFunc: function(e, c) {
  7825.                 if (e.reqclass && c.reqclass) {
  7826.                     var h = strcmp(openDB_chr_classes[(1 + Math.log(e.reqclass) / Math.LN2)], openDB_chr_classes[(1 + Math.log(c.reqclass) / Math.LN2)]);
  7827.                     if (h) {
  7828.                         return h
  7829.                     }
  7830.                 }
  7831.                 var d = [e.learnedat, c.learnedat];
  7832.                 for (var g = 0; g < 2; ++g) {
  7833.                     var j = (g == 0 ? e : c);
  7834.                     if (d[g] == 9999 && j.colors != null) {
  7835.                         var f = 0;
  7836.                         while (j.colors[f] == 0 && f < j.colors.length) {
  7837.                             f++
  7838.                         }
  7839.                         if (f < j.colors.length) {
  7840.                             d[g] = j.colors[f]
  7841.                         }
  7842.                     }
  7843.                 }
  7844.                 var k = strcmp(d[0], d[1]);
  7845.                 if (k != 0) {
  7846.                     return k
  7847.                 }
  7848.                 if (e.colors != null && c.colors != null) {
  7849.                     for (var f = 0; f < 4; ++f) {
  7850.                         k = strcmp(e.colors[f], c.colors[f]);
  7851.                         if (k != 0) {
  7852.                             return k
  7853.                         }
  7854.                     }
  7855.                 }
  7856.                 if (e.pettype != null & c.pettype != null) {
  7857.                     return Listview.funcBox.assocArrCmp(e.pettype, c.pettype, openDB_pet_types)
  7858.                 }
  7859.                 return Listview.funcBox.assocArrCmp(e.skill, c.skill, openDB_spell_skills)
  7860.             }
  7861.         }, {
  7862.             id: "skillup",
  7863.             name: LANG.skillpoints,
  7864.             width: "10%",
  7865.             value: "nskillup",
  7866.             compute: function(b, c) {
  7867.                 if (b.nskillup > 0) {
  7868.                     return b.nskillup
  7869.                 }
  7870.             },
  7871.             hidden: true
  7872.         }],
  7873.         getItemLink: function(b) {
  7874.             return "/spell=" + b.id
  7875.         }
  7876.     },
  7877.     zone: {
  7878.         sort: [1],
  7879.         nItemsPerPage: -1,
  7880.         searchable: 1,
  7881.         filtrable: 1,
  7882.         columns: [{
  7883.             id: "name",
  7884.             name: LANG.name,
  7885.             type: "text",
  7886.             align: "left",
  7887.             value: "name",
  7888.             compute: function(c, e) {
  7889.                 var b = ce("a");
  7890.                 b.style.fontFamily = "Verdana, sans-serif";
  7891.                 b.href = this.template.getItemLink(c);
  7892.                 ae(b, ct(c.name));
  7893.                 if (c.expansion) {
  7894.                     var d = ce("span");
  7895.                     d.className = (c.expansion == 1 ? "bc-icon" : "wotlk-icon");
  7896.                     ae(d, b);
  7897.                     ae(e, d)
  7898.                 } else {
  7899.                     ae(e, b)
  7900.                 }
  7901.             },
  7902.             getVisibleText: function(a) {
  7903.                 var b = a.name;
  7904.                 if (a.expansion == 1) {
  7905.                     b += " bc"
  7906.                 } else {
  7907.                     if (a.expansion == 2) {
  7908.                         b += "wotlk wrath"
  7909.                     }
  7910.                 }
  7911.                 return b
  7912.             }
  7913.         }, {
  7914.             id: "level",
  7915.             name: LANG.level,
  7916.             type: "range",
  7917.             width: "10%",
  7918.             getMinValue: function(a) {
  7919.                 return a.minlevel
  7920.             },
  7921.             getMaxValue: function(a) {
  7922.                 return a.maxlevel
  7923.             },
  7924.             compute: function(a, b) {
  7925.                 if (a.minlevel > 0 && a.maxlevel > 0) {
  7926.                     if (a.minlevel != a.maxlevel) {
  7927.                         return a.minlevel + LANG.hyphen + a.maxlevel
  7928.                     } else {
  7929.                         return a.minlevel
  7930.                     }
  7931.                 }
  7932.             },
  7933.             sortFunc: function(d, c, e) {
  7934.                 if (e > 0) {
  7935.                     return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel)
  7936.                 } else {
  7937.                     return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel)
  7938.                 }
  7939.             }
  7940.         }, {
  7941.             id: "territory",
  7942.             name: LANG.territory,
  7943.             type: "text",
  7944.             width: "13%",
  7945.             compute: function(a, c) {
  7946.                 var b = ce("span");
  7947.                 switch (a.territory) {
  7948.                     case 0:
  7949.                         b.className = "alliance-icon";
  7950.                         break;
  7951.                     case 1:
  7952.                         b.className = "horde-icon";
  7953.                         break;
  7954.                     case 4:
  7955.                         b.className = "ffapvp-icon";
  7956.                         break
  7957.                 }
  7958.                 ae(b, ct(openDB_zone_territories[a.territory]));
  7959.                 ae(c, b)
  7960.             },
  7961.             getVisibleText: function(a) {
  7962.                 return openDB_zone_territories[a.territory]
  7963.             },
  7964.             sortFunc: function(d, c, e) {
  7965.                 return strcmp(openDB_zone_territories[d.territory], openDB_zone_territories[c.territory])
  7966.             }
  7967.         }, {
  7968.             id: "instancetype",
  7969.             name: LANG.instancetype,
  7970.             type: "text",
  7971.             compute: function(a, d) {
  7972.                 if (a.instance > 0) {
  7973.                     var b = ce("span");
  7974.                     if ((a.instance >= 1 && a.instance <= 5) || a.instance == 7) {
  7975.                         b.className = "instance-icon" + a.instance
  7976.                     }
  7977.                     if (a.nplayers == -2) {
  7978.                         a.nplayers = "10/25"
  7979.                     }
  7980.                     var c = openDB_zone_instancetypes[a.instance];
  7981.                     if (a.nplayers && ((a.instance != 2 && a.instance != 5) || a.nplayers > 5)) {
  7982.                         c += " (";
  7983.                         if (a.instance == 4) {
  7984.                             c += sprintf(LANG.lvzone_xvx, a.nplayers, a.nplayers)
  7985.                         } else {
  7986.                             c += sprintf(LANG.lvzone_xman, a.nplayers)
  7987.                         }
  7988.                         c += ")"
  7989.                     }
  7990.                     ae(b, ct(c));
  7991.                     ae(d, b)
  7992.                 }
  7993.             },
  7994.             getVisibleText: function(a) {
  7995.                 if (a.instance > 0) {
  7996.                     var b = openDB_zone_instancetypes[a.instance];
  7997.                     if (a.nplayers && ((a.instance != 2 && a.instance != 5) || a.nplayers > 5)) {
  7998.                         if (a.instance == 4) {
  7999.                             b += " " + sprintf(LANG.lvzone_xvx, a.nplayers, a.nplayers)
  8000.                         } else {
  8001.                             b += " " + sprintf(LANG.lvzone_xman, a.nplayers)
  8002.                         }
  8003.                     }
  8004.                     return b
  8005.                 }
  8006.             },
  8007.             sortFunc: function(d, c, e) {
  8008.                 return strcmp(openDB_zone_instancetypes[d.instance], openDB_zone_instancetypes[c.instance]) || strcmp(d.instance, c.instance) || strcmp(d.nplayers, c.nplayers)
  8009.             }
  8010.         }, {
  8011.             id: "category",
  8012.             name: LANG.category,
  8013.             type: "text",
  8014.             width: "15%",
  8015.             compute: function(c, d) {
  8016.                 d.className = "small q1";
  8017.                 var b = ce("a");
  8018.                 b.href = "zones=" + c.category;
  8019.                 ae(b, ct(openDB_zone_categories[c.category]));
  8020.                 ae(d, b)
  8021.             },
  8022.             getVisibleText: function(a) {
  8023.                 return openDB_zone_categories[a.category]
  8024.             },
  8025.             sortFunc: function(d, c, e) {
  8026.                 return strcmp(openDB_zone_categories[d.category], openDB_zone_categories[c.category])
  8027.             }
  8028.         }],
  8029.         getItemLink: function(a) {
  8030.             return "zone=" + a.id
  8031.         }
  8032.     },
  8033.     holiday: {
  8034.         sort: [2],
  8035.         nItemsPerPage: -1,
  8036.         searchable: 1,
  8037.         filtrable: 1,
  8038.         columns: [{
  8039.             id: "name",
  8040.             name: LANG.name,
  8041.             type: "text",
  8042.             align: "left",
  8043.             value: "name",
  8044.             compute: function(c, d) {
  8045.                 var b = ce("a");
  8046.                 b.style.fontFamily = "Verdana, sans-serif";
  8047.                 b.href = this.template.getItemLink(c);
  8048.                 ae(b, ct(c.name));
  8049.                 ae(d, b)
  8050.             },
  8051.             getVisibleText: function(a) {
  8052.                 return a.name
  8053.             }
  8054.         }, {
  8055.             id: "date",
  8056.             name: LANG.date,
  8057.             type: "text",
  8058.             width: "16%",
  8059.             allText: true,
  8060.             compute: function(b, e) {
  8061.                 if (b.startDate && b.endDate) {
  8062.                     var c = ce("span");
  8063.                     if (b.today);
  8064.                     c.style.color = "#00bb00";
  8065.                     var d = b.startDate,
  8066.                         a = b.endDate;
  8067.                     if (d != a) {
  8068.                         ae(c, ct(d + LANG.hyphen + a))
  8069.                     } else {
  8070.                         ae(c, ct(d))
  8071.                     }
  8072.                     ae(e, c)
  8073.                 }
  8074.             },
  8075.             getVisibleText: function(b) {
  8076.                 if (b.startDate && b.endDate) {
  8077.                     var d = b.startDate,
  8078.                         a = b.endDate;
  8079.                     if (d != a) {
  8080.                         return d + LANG.hyphen + a
  8081.                     } else {
  8082.                         return d
  8083.                     }
  8084.                 }
  8085.                 return ""
  8086.             },
  8087.             sortFunc: function(e, c, g) {
  8088.                 if (e.startDate && c.startDate) {
  8089.                     return (e.startDate < c.startDate) ? -1 : (e.startDate > c.startDate) ? 1 : 0
  8090.                 } else {
  8091.                     return e.startDate ? -1 : c.startDate ? 1 : 0
  8092.                 }
  8093.             }
  8094.         }, {
  8095.             id: "category",
  8096.             name: LANG.category,
  8097.             type: "text",
  8098.             width: "16%",
  8099.             compute: function(d, e) {
  8100.                 e.className = "small q1";
  8101.                 var b = ce("a"),
  8102.                     c = "events=" + d.category;
  8103.                 b.href = c;
  8104.                 ae(b, ct(openDB_holiday_categories[d.category]));
  8105.                 ae(e, b)
  8106.             },
  8107.             getVisibleText: function(a) {
  8108.                 return openDB_holiday_categories[a.category]
  8109.             },
  8110.             sortFunc: function(d, c, e) {
  8111.                 return strcmp(openDB_holiday_categories[d.category], openDB_holiday_categories[c.category])
  8112.             },
  8113.             hidden: true
  8114.         }],
  8115.         getItemLink: function(a) {
  8116.             return "event=" + a.id
  8117.         }
  8118.     },
  8119.     comment: {
  8120.         sort: [1],
  8121.         mode: 2,
  8122.         nItemsPerPage: 40,
  8123.         poundable: 2,
  8124.         columns: [{
  8125.             value: "number"
  8126.         }, {
  8127.             value: "id"
  8128.         }, {
  8129.             value: "rating"
  8130.         }],
  8131.         compute: function(J, ac, ab) {
  8132.             var ag, I = new Date(J.date),
  8133.                 Y = (openDB_serverTime - I) / 1000,
  8134.                 h = (openDB_user.roles) != 0,
  8135.                 ad = J.rating < 0 || J.purged || J.deleted || (J.__minPatch && openDB_getPatchVersion.T[J.__minPatch] > I),
  8136.                 U = h || (J.user.toLowerCase() == openDB_user.name.toLowerCase() && !openDB_user.commentban),
  8137.                 L = U && J.deleted == 0,
  8138.                 d = U && J.replyTo != J.id,
  8139.                 W = J.purged == 0 && J.deleted == 0 && openDB_user.id && J.user.toLowerCase() != openDB_user.name.toLowerCase() && in_array(J.raters, openDB_user.id, function(i) {
  8140.                     return i[0]
  8141.                 }) == -1 && !openDB_user.ratingban,
  8142.                 p = J.rating >= 0 && (openDB_user.id == 0 || W || openDB_user.ratingban),
  8143.                 G = openDB_users[J.user];
  8144.             J.ratable = W;
  8145.             var aa = ac;
  8146.             var N = ce("div");
  8147.             var z = ce("div");
  8148.             var t = ce("em");
  8149.             J.divHeader = N;
  8150.             J.divBody = z;
  8151.             J.divLinks = t;
  8152.             aa.className = "comment-wrapper";
  8153.             if (J.indent) {
  8154.                 aa.className += " comment-indent"
  8155.             }
  8156.             if (ad) {
  8157.                 aa.className += " comment-collapsed"
  8158.             }
  8159.             ac = ce("div");
  8160.             ac.className = "comment comment" + (ab % 2);
  8161.             ae(aa, ac);
  8162.             N.className = "comment-header";
  8163.             ae(ac, N);
  8164.             var n = ce("em");
  8165.             n.className = "comment-rating";
  8166.             if (ad) {
  8167.                 var D = ce("a");
  8168.                 D.href = "javascript:;";
  8169.                 D.onclick = Listview.funcBox.coToggleVis.bind(D, J);
  8170.                 ae(D, ct(LANG.lvcomment_show));
  8171.                 ae(n, D);
  8172.                 ae(n, ct(" " + String.fromCharCode(160) + " "))
  8173.             }
  8174.             var A = ce("b");
  8175.             var v = ce("a");
  8176.             v.href = "javascript:;";
  8177.             ae(v, ct(LANG.lvcomment_rating));
  8178.             var E = ce("span");
  8179.             E.id = "commentrating" + J.id;
  8180.             Listview.funcBox.coDisplayRating(J, E);
  8181.             v.onclick = Listview.funcBox.coToggleRating.bind(this, J, E);
  8182.             ae(v, E);
  8183.             ae(A, v);
  8184.             ae(n, A);
  8185.             ae(n, ct(" "));
  8186.             var S = ce("span");
  8187.             var q = ce("a"),
  8188.                 af = ce("a");
  8189.             if (W) {
  8190.                 q.href = af.href = "javascript:;";
  8191.                 q.onclick = Listview.funcBox.coRate.bind(q, J, 1);
  8192.                 af.onclick = Listview.funcBox.coRate.bind(af, J, -1);
  8193.                 if (h) {
  8194.                     var R = ce("a");
  8195.                     R.href = "javascript:;";
  8196.                     R.onclick = Listview.funcBox.coRate.bind(R, J, 0);
  8197.                     R.onmouseover = Listview.funcBox.coCustomRatingOver;
  8198.                     R.onmousemove = Tooltip.cursorUpdate;
  8199.                     R.onmouseout = Tooltip.hide;
  8200.                     ae(R, ct("[~]"));
  8201.                     ae(S, R);
  8202.                     ae(S, ct(" "))
  8203.                 }
  8204.             } else {
  8205.                 if (openDB_user.ratingban) {
  8206.                     q.href = af.href = "javascript:;"
  8207.                 } else {
  8208.                     q.href = af.href = "/login=log"
  8209.                 }
  8210.             }
  8211.             ae(q, ct("[+]"));
  8212.             if (!openDB_user.ratingban) {
  8213.                 q.onmouseover = Listview.funcBox.coPlusRatingOver;
  8214.                 af.onmouseover = Listview.funcBox.coMinusRatingOver;
  8215.                 q.onmousemove = af.onmousemove = Tooltip.cursorUpdate;
  8216.                 q.onmouseout = af.onmouseout = Tooltip.hide
  8217.             } else {
  8218.                 openDB_addTooltip(q, LANG.tooltip_banned_rating, "q");
  8219.                 openDB_addTooltip(af, LANG.tooltip_banned_rating, "q")
  8220.             }
  8221.             ae(af, ct("[-]"));
  8222.             ae(S, af);
  8223.             ae(S, ct(" "));
  8224.             ae(S, q);
  8225.             ae(n, S);
  8226.             if (!p) {
  8227.                 S.style.display = "none"
  8228.             }
  8229.             ae(N, n);
  8230.             t.className = "comment-links";
  8231.             var c = false;
  8232.             if (U) {
  8233.                 var b = ce("span");
  8234.                 var Q = ce("a");
  8235.                 ae(Q, ct(LANG.lvcomment_edit));
  8236.                 Q.onclick = Listview.funcBox.coEdit.bind(this, J, 0, false);
  8237.                 ns(Q);
  8238.                 Q.href = "javascript:;";
  8239.                 ae(b, Q);
  8240.                 c = true;
  8241.                 ae(t, b)
  8242.             }
  8243.             if (L) {
  8244.                 var u = ce("span");
  8245.                 var F = ce("a");
  8246.                 if (c) {
  8247.                     ae(u, ct("|"))
  8248.                 }
  8249.                 ae(F, ct(LANG.lvcomment_delete));
  8250.                 F.onclick = Listview.funcBox.coDelete.bind(this, J);
  8251.                 ns(F);
  8252.                 F.href = "javascript:;";
  8253.                 ae(u, F);
  8254.                 c = true;
  8255.                 ae(t, u)
  8256.             }
  8257.             if (d) {
  8258.                 var P = ce("span");
  8259.                 var k = ce("a");
  8260.                 if (c) {
  8261.                     ae(P, ct("|"))
  8262.                 }
  8263.                 ae(k, ct(LANG.lvcomment_detach));
  8264.                 k.onclick = Listview.funcBox.coDetach.bind(this, J);
  8265.                 ns(k);
  8266.                 k.href = "javascript:;";
  8267.                 ae(P, k);
  8268.                 c = true;
  8269.                 ae(t, P)
  8270.             }
  8271.             if (ae) {
  8272.                 var K = ce("span");
  8273.                 var m = ce("a");
  8274.                 if (c) {
  8275.                     ae(K, ct("|"))
  8276.                 }
  8277.                 ae(m, ct(LANG.lvcomment_report));
  8278.                 m.className = ("icon-report");
  8279.                 m.href = "javascript:;";
  8280.                 ae(K, m);
  8281.                 c = true;
  8282.                 ae(t, K)
  8283.             }
  8284.             if (!openDB_user.commentban) {
  8285.                 var l = ce("span");
  8286.                 var o = ce("a");
  8287.                 if (c) {
  8288.                     ae(l, ct("|"))
  8289.                 }
  8290.                 ae(o, ct(LANG.lvcomment_reply));
  8291.                 if (openDB_user.id > 0) {
  8292.                     o.onclick = Listview.funcBox.coReply.bind(this, J);
  8293.                     o.href = "javascript:;"
  8294.                 } else {
  8295.                     o.href = "/login=log"
  8296.                 }
  8297.                 ae(l, o);
  8298.                 c = true;
  8299.                 ae(t, l)
  8300.             }
  8301.             if (ad) {
  8302.                 z.style.display = "none";
  8303.                 t.style.display = "none"
  8304.             }
  8305.             ae(N, t);
  8306.             var C = ce("var");
  8307.             ae(C, ct(LANG.lvcomment_by));
  8308.             aUser = ce("a");
  8309.             aUser.href = "javascript:;";
  8310.             ae(aUser, ct(J.user));
  8311.             ae(C, aUser);
  8312.             ae(C, ct(" "));
  8313.             var a = ce("a");
  8314.             a.className = "q0";
  8315.             a.id = "comments:id=" + J.id;
  8316.             a.href = "#" + a.id;
  8317.             Listview.funcBox.coFormatDate(a, Y, I, 0, 1);
  8318.             ae(C, a);
  8319.             if (G != null && G.avatar) {
  8320.                 var j = Icon.createUser(G.avatar, G.avatarmore, 0, null, ((G.roles) ? (G.border ? 2 : 1) : 0));
  8321.                 j.style.marginRight = "3px";
  8322.                 j.style.cssFloat = j.style.styleFloat = "left";
  8323.                 ae(N, j);
  8324.                 C.style.lineHeight = "26px"
  8325.             }
  8326.             ae(N, C);
  8327.             z.className = "text comment-body" + Listview.funcBox.coGetColor(J);
  8328.             if (J.indent) {
  8329.                 z.className += " comment-body-indent"
  8330.             }
  8331.             var V = 0,
  8332.                 B = (this.id == "english-comments" ? "www" : "");
  8333.             z.innerHTML = Markup.toHtml(J.body, {
  8334.                 allow: V,
  8335.                 mode: Markup.MODE_COMMENT,
  8336.                 roles: J.roles,
  8337.                 locale: B
  8338.             });
  8339.             ae(ac, z);
  8340.             var H = ce("div");
  8341.             H.className = "text comment-body";
  8342.             if (J.indent) {
  8343.                 H.className += " comment-body-indent"
  8344.             }
  8345.             if (J.response) {
  8346.                 H.innerHTML = Markup.toHtml("[div][/div][response=" + J.responseuser + " roles=" + J.responseroles + "]" + J.response + "[/response]", {
  8347.                     allow: Markup.CLASS_STAFF,
  8348.                     roles: J.responseroles,
  8349.                     uid: "resp-" + J.id
  8350.                 })
  8351.             }
  8352.             ae(ac, H);
  8353.             J.divResponse = H;
  8354.             if (J.roles == 0 || openDB_user.roles) {
  8355.                 var X = ce("div");
  8356.                 J.divLastEdit = X;
  8357.                 X.className = "comment-lastedit";
  8358.                 ae(X, ct(LANG.lvcomment_lastedit));
  8359.                 var w = ce("a");
  8360.                 ae(w, ct(" "));
  8361.                 ae(X, w);
  8362.                 ae(X, ct(" "));
  8363.                 var O = ce("span");
  8364.                 ae(X, O);
  8365.                 ae(X, ct(" "));
  8366.                 Listview.funcBox.coUpdateLastEdit(J);
  8367.                 if (ad) {
  8368.                     X.style.display = "none"
  8369.                 }
  8370.                 ae(ac, X)
  8371.             }
  8372.         },
  8373.         createNote: function(b) {
  8374.             var g = ce("small");
  8375.             if (!openDB_user.commentban) {
  8376.                 var m = ce("a");
  8377.                 if (openDB_user.id > 0) {
  8378.                     m.href = "javascript:;";
  8379.                     m.onclick = co_addYourComment
  8380.                 } else {
  8381.                     m.href = "/login=log"
  8382.                 }
  8383.                 ae(m, ct(LANG.lvcomment_add));
  8384.                 ae(g, m);
  8385.                 var e = ce("span");
  8386.                 e.style.padding = "0 5px";
  8387.                 e.style.color = "white";
  8388.                 ae(e, ct("|"));
  8389.                 ae(g, e)
  8390.             }
  8391.             ae(g, ct(LANG.lvcomment_sort));
  8392.             var n = ce("a");
  8393.             n.href = "javascript:;";
  8394.             ae(n, ct(LANG.lvcomment_sortdate));
  8395.             n.onclick = Listview.funcBox.coSortDate.bind(this, n);
  8396.             ae(g, n);
  8397.             ae(g, ct(LANG.comma));
  8398.             var o = ce("a");
  8399.             o.href = "javascript:;";
  8400.             ae(o, ct(LANG.lvcomment_sortrating));
  8401.             o.onclick = Listview.funcBox.coSortHighestRatedFirst.bind(this, o);
  8402.             ae(g, o);
  8403.             var h = 1;
  8404.             if (h == "2") {
  8405.                 o.onclick()
  8406.             } else {
  8407.                 n.onclick()
  8408.             }
  8409.             ae(b, g)
  8410.         },
  8411.         onNoData: function(c) {
  8412.             var a = "<b>" + LANG.lvnodata_co1 + '</b><div class="pad2"></div>';
  8413.             if (openDB_user.id > 0) {
  8414.                 var b = LANG.lvnodata_co2;
  8415.                 b = b.replace("<a>", '<a href="javascript:;" onclick="co_addYourComment()" onmousedown="return false">');
  8416.                 a += b
  8417.             } else {
  8418.                 var b = LANG.lvnodata_co3;
  8419.                 b = b.replace("<a>", '<a href="/login=log">');
  8420.                 b = b.replace("<a>", '<a href="/login=reg">');
  8421.                 a += b
  8422.             }
  8423.             c.style.padding = "1.5em 0";
  8424.             c.innerHTML = a
  8425.         },
  8426.         onBeforeCreate: function() {
  8427.             if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) {
  8428.                 var a = in_array(this.data, parseInt(RegExp.$1), function(b) {
  8429.                     return b.id
  8430.                 });
  8431.                 this.rowOffset = this.getRowOffset(a);
  8432.                 return this.data[a]
  8433.             }
  8434.         },
  8435.         onAfterCreate: function(a) {
  8436.             if (a != null) {
  8437.                 var b = a.__div;
  8438.                 this.tabs.__st = b;
  8439.                 b.firstChild.style.border = "1px solid #505050"
  8440.             }
  8441.         }
  8442.     },
  8443.     commentpreview: {
  8444.         sort: [4],
  8445.         nItemsPerPage: 75,
  8446.         columns: [{
  8447.             id: "subject",
  8448.             name: LANG.subject,
  8449.             align: "left",
  8450.             value: "subject",
  8451.             compute: function(f, e) {
  8452.                 var b = ce("a");
  8453.                 b.style.fontFamily = "Verdana, sans-serif";
  8454.                 b.href = this.getItemLink(f);
  8455.                 ae(b, ct(f.subject));
  8456.                 ae(e, b);
  8457.                 if (LANG.types[f.type]) {
  8458.                     var c = ce("div");
  8459.                     c.className = "small";
  8460.                     ae(c, ct(LANG.types[f.type][0]));
  8461.                     ae(e, c)
  8462.                 }
  8463.             }
  8464.         }, {
  8465.             id: "preview",
  8466.             name: LANG.preview,
  8467.             align: "left",
  8468.             width: "50%",
  8469.             value: "preview",
  8470.             compute: function(g, f, b) {
  8471.                 var c = ce("div");
  8472.                 c.className = "crop";
  8473.                 if (g.rating >= 10) {
  8474.                     c.className += " comment-green"
  8475.                 }
  8476.                 ae(c, ct(Markup.removeTags(g.preview, {
  8477.                     mode: Markup.MODE_ARTICLE
  8478.                 })));
  8479.                 ae(f, c);
  8480.                 if (g.rating || g.deleted || g.purged) {
  8481.                     c = ce("div");
  8482.                     c.className = "small3";
  8483.                     if (g.rating) {
  8484.                         ae(c, ct(LANG.lvcomment_rating + (g.rating > 0 ? "+" : "") + g.rating))
  8485.                     }
  8486.                     var a = ce("span"),
  8487.                         e = "";
  8488.                     a.className = "q10";
  8489.                     if (g.deleted) {
  8490.                         e = LANG.lvcomment_deleted
  8491.                     } else {
  8492.                         if (g.purged) {
  8493.                             e = LANG.lvcomment_purged
  8494.                         }
  8495.                     }
  8496.                     ae(a, ct(e));
  8497.                     ae(c, a);
  8498.                     b.__status = a;
  8499.                     ae(f, c)
  8500.                 }
  8501.             }
  8502.         }, {
  8503.             id: "author",
  8504.             name: LANG.author,
  8505.             value: "user",
  8506.             compute: function(d, c) {
  8507.                 c.className = "q1";
  8508.                 var b = ce("a");
  8509.                 b.href = "javascript:;";
  8510.                 ae(b, ct(d.user));
  8511.                 ae(c, b)
  8512.             }
  8513.         }, {
  8514.             id: "posted",
  8515.             name: LANG.posted,
  8516.             width: "16%",
  8517.             value: "elapsed",
  8518.             compute: function(e, d) {
  8519.                 var a = new Date(e.date),
  8520.                     c = (openDB_serverTime - a) / 1000;
  8521.                 var b = ce("span");
  8522.                 openDB_formatDate(b, c, a, 0, 1);
  8523.                 ae(d, b)
  8524.             }
  8525.         }],
  8526.         getItemLink: function(a) {
  8527.             return openDB_getCommentDomain(a.domain) + "/" + (a.url ? a.url : openDB_types[a.type] + "=" + a.typeId) + (a.id != null ? "#comments:id=" + a.id : "")
  8528.         }
  8529.     },
  8530.     screenshot: {
  8531.         sort: [],
  8532.         mode: 3,
  8533.         nItemsPerPage: 40,
  8534.         nItemsPerRow: 4,
  8535.         poundable: 2,
  8536.         columns: [],
  8537.         compute: function(k, e, l) {
  8538.             var u, o = new Date(k.date),
  8539.                 f = (openDB_serverTime - o) / 1000;
  8540.             e.className = "screenshot-cell";
  8541.             e.vAlign = "bottom";
  8542.             var q = ce("a");
  8543.             q.href = "#screenshots:id=" + k.id;
  8544.             q.onclick = rf2;
  8545.             var v = ce("img"),
  8546.                 t = Math.min(150 / k.width, 150 / k.height);
  8547.             v.src = "/upload/thumb/" + k.file;
  8548.             ae(q, v);
  8549.             ae(e, q);
  8550.             var p = ce("div");
  8551.             p.className = "screenshot-cell-user";
  8552.             var m = (k.user != null && k.user.length);
  8553.             if (m) {
  8554.                 q = ce("a");
  8555.                 q.href = "javascript:;";
  8556.                 ae(q, ct(k.user));
  8557.                 ae(p, ct(LANG.lvscreenshot_from));
  8558.                 ae(p, q);
  8559.                 ae(p, ct(" "))
  8560.             }
  8561.             var j = ce("span");
  8562.             if (m) {} else {}
  8563.             ae(p, j);
  8564.             ae(e, p);
  8565.             p = ce("div");
  8566.             p.style.position = "relative";
  8567.             p.style.height = "1em";
  8568.             if (openDB_getLocale(true) != 0 && k.caption) {
  8569.                 k.caption = ""
  8570.             }
  8571.             var h = (k.caption != null && k.caption.length);
  8572.             var g = (k.subject != null && k.subject.length);
  8573.             if (h || g) {
  8574.                 var r = ce("div");
  8575.                 r.className = "screenshot-caption";
  8576.                 if (g) {
  8577.                     var c = ce("small");
  8578.                     ae(c, ct(LANG.types[k.type][0] + LANG.colon));
  8579.                     var b = ce("a");
  8580.                     ae(b, ct(k.subject));
  8581.                     b.href = openDB_types[k.type] + "=" + k.typeId;
  8582.                     ae(c, b);
  8583.                     ae(r, c);
  8584.                     if (h && k.caption.length) {
  8585.                         ae(c, ct(" (...)"))
  8586.                     }
  8587.                     ae(c, ce("br"))
  8588.                 }
  8589.                 if (h) {
  8590.                     aE(e, "mouseover", Listview.funcBox.ssCellOver.bind(r));
  8591.                     aE(e, "mouseout", Listview.funcBox.ssCellOut.bind(r));
  8592.                     var n = ce("span");
  8593.                     n.innerHTML = k.caption;
  8594.                     ae(r, n)
  8595.                 }
  8596.                 ae(p, r)
  8597.             }
  8598.             aE(e, "click", Listview.funcBox.ssCellClick.bind(this, l));
  8599.             ae(e, p)
  8600.         },
  8601.         createNote: function(d) {
  8602.             if (typeof openDB_pageInfo == "object" && openDB_pageInfo.type > 0) {
  8603.                 var c = ce("small");
  8604.                 var b = ce("a");
  8605.                 if (openDB_user.id > 0) {
  8606.                     b.href = "javascript:;";
  8607.                     b.onclick = ss_submitAScreenshot
  8608.                 } else {
  8609.                     b.href = "account=signin"
  8610.                 }
  8611.                 ae(b, ct(LANG.lvscreenshot_submit));
  8612.                 ae(c, b);
  8613.                 ae(d, c)
  8614.             }
  8615.         },
  8616.         onNoData: function(c) {
  8617.             if (typeof openDB_pageInfo == "object" && openDB_pageInfo.type > 0) {
  8618.                 var a = "<b>" + LANG.lvnodata_ss1 + '</b><div class="pad2"></div>';
  8619.                 if (openDB_user.id > 0) {
  8620.                     var b = LANG.lvnodata_ss2;
  8621.                     b = b.replace("<a>", '<a href="javascript:;" onclick="ss_submitAScreenshot()" onmousedown="return false">');
  8622.                     a += b
  8623.                 } else {
  8624.                     var b = LANG.lvnodata_ss3;
  8625.                     b = b.replace("<a>", '<a href="/account=signin">');
  8626.                     b = b.replace("<a>", '<a href="/login=reg">');
  8627.                     a += b
  8628.                 }
  8629.                 c.style.padding = "1.5em 0";
  8630.                 c.innerHTML = a
  8631.             } else {
  8632.                 return -1
  8633.             }
  8634.         },
  8635.         onBeforeCreate: function() {
  8636.             if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) {
  8637.                 var a = in_array(this.data, parseInt(RegExp.$1), function(b) {
  8638.                     return b.id
  8639.                 });
  8640.                 this.rowOffset = this.getRowOffset(a);
  8641.                 return a
  8642.             }
  8643.         },
  8644.         onAfterCreate: function(a) {
  8645.             if (a != null) {
  8646.                 setTimeout((function() {
  8647.                     ScreenshotViewer.show({
  8648.                         screenshots: this.data,
  8649.                         pos: a
  8650.                     })
  8651.                 }).bind(this), 1)
  8652.             }
  8653.         }
  8654.     },
  8655.     pet: {
  8656.         sort: [1],
  8657.         nItemsPerPage: -1,
  8658.         searchable: 1,
  8659.         filtrable: 1,
  8660.         columns: [{
  8661.             id: "name",
  8662.             name: LANG.name,
  8663.             type: "text",
  8664.             align: "left",
  8665.             value: "name",
  8666.             span: 2,
  8667.             compute: function(b, k, g) {
  8668.                 var e = ce("td");
  8669.                 e.style.width = "1px";
  8670.                 e.style.padding = "0";
  8671.                 e.style.borderRight = "none";
  8672.                 ae(e, Icon.create(b.icon, 0));
  8673.                 ae(g, e);
  8674.                 k.style.borderLeft = "none";
  8675.                 var j = ce("div");
  8676.                 var c = ce("a");
  8677.                 c.style.fontFamily = "Verdana, sans-serif";
  8678.                 c.href = this.template.getItemLink(b);
  8679.                 ae(c, ct(b.name));
  8680.                 if (b.expansion) {
  8681.                     var f = ce("span");
  8682.                     f.className = (b.expansion == 1 ? "bc-icon" : "wotlk-icon");
  8683.                     ae(f, c);
  8684.                     ae(j, f)
  8685.                 } else {
  8686.                     ae(j, c)
  8687.                 }
  8688.                 if (b.exotic) {
  8689.                     j.style.position = "relative";
  8690.                     var h = ce("div");
  8691.                     h.className = "small";
  8692.                     h.style.fontStyle = "italic";
  8693.                     h.style.position = "absolute";
  8694.                     h.style.right = "3px";
  8695.                     h.style.bottom = "0px";
  8696.                     ae(h, ct(LANG.lvpet_exotic));
  8697.                     ae(j, h)
  8698.                 }
  8699.                 ae(k, j)
  8700.             },
  8701.             getVisibleText: function(a) {
  8702.                 var b = a.name;
  8703.                 if (a.expansion == 1) {
  8704.                     b += " bc"
  8705.                 } else {
  8706.                     if (a.expansion == 2) {
  8707.                         b += "wotlk wrath"
  8708.                     }
  8709.                 }
  8710.                 if (a.exotic) {
  8711.                     b += " " + LANG.lvpet_exotic
  8712.                 }
  8713.                 return b
  8714.             }
  8715.         }, {
  8716.             id: "level",
  8717.             name: LANG.level,
  8718.             type: "range",
  8719.             getMinValue: function(a) {
  8720.                 return a.minlevel
  8721.             },
  8722.             getMaxValue: function(a) {
  8723.                 return a.maxlevel
  8724.             },
  8725.             compute: function(a, b) {
  8726.                 if (a.minlevel > 0 && a.maxlevel > 0) {
  8727.                     if (a.minlevel != a.maxlevel) {
  8728.                         return a.minlevel + LANG.hyphen + a.maxlevel
  8729.                     } else {
  8730.                         return a.minlevel
  8731.                     }
  8732.                 } else {
  8733.                     return -1
  8734.                 }
  8735.             },
  8736.             sortFunc: function(d, c, e) {
  8737.                 if (e > 0) {
  8738.                     return strcmp(d.minlevel, c.minlevel) || strcmp(d.maxlevel, c.maxlevel)
  8739.                 } else {
  8740.                     return strcmp(d.maxlevel, c.maxlevel) || strcmp(d.minlevel, c.minlevel)
  8741.                 }
  8742.             }
  8743.         }, {
  8744.             id: "damage",
  8745.             name: LANG.damage,
  8746.             value: "damage",
  8747.             compute: function(a, b) {
  8748.                 ae(b, this.template.getStatPct(a.damage))
  8749.             }
  8750.         }, {
  8751.             id: "armor",
  8752.             name: LANG.armor,
  8753.             value: "armor",
  8754.             compute: function(a, b) {
  8755.                 ae(b, this.template.getStatPct(a.armor))
  8756.             }
  8757.         }, {
  8758.             id: "health",
  8759.             name: LANG.health,
  8760.             value: "health",
  8761.             compute: function(a, b) {
  8762.                 ae(b, this.template.getStatPct(a.health))
  8763.             }
  8764.         }, {
  8765.             id: "abilities",
  8766.             name: LANG.abilities,
  8767.             type: "text",
  8768.             getValue: function(b) {
  8769.                 if (!b.spells) {
  8770.                     return ""
  8771.                 }
  8772.                 if (b.spells.length > 0) {
  8773.                     var d = "";
  8774.                     for (var c = 0, a = b.spells.length; c < a; ++c) {
  8775.                         if (b.spells[c]) {
  8776.                             d += openDB_spells[b.spells[c]]["name_" + openDB_locale.name]
  8777.                         }
  8778.                     }
  8779.                     return d
  8780.                 }
  8781.             },
  8782.             compute: function(a, b) {
  8783.                 if (!a.spells) {
  8784.                     return ""
  8785.                 }
  8786.                 if (a.spells.length > 0) {
  8787.                     b.style.padding = "0";
  8788.                     Listview.funcBox.createCenteredIcons(a.spells, b, "", 1)
  8789.                 }
  8790.             },
  8791.             sortFunc: function(d, c) {
  8792.                 if (!d.spells || !c.spells) {
  8793.                     return 0
  8794.                 }
  8795.                 return strcmp(d.spellCount, c.spellCount) || strcmp(d.spells, c.spells)
  8796.             },
  8797.             hidden: true
  8798.         }, {
  8799.             id: "diet",
  8800.             name: LANG.diet,
  8801.             type: "text",
  8802.             compute: function(a, e) {
  8803.                 if (e) {
  8804.                     e.className = "small"
  8805.                 }
  8806.                 var b = 0,
  8807.                     c = "";
  8808.                 for (var d in openDB_pet_foods) {
  8809.                     if (a.diet & d) {
  8810.                         if (b++ > 0) {
  8811.                             c += LANG.comma
  8812.                         }
  8813.                         c += openDB_pet_foods[d]
  8814.                     }
  8815.                 }
  8816.                 return c
  8817.             },
  8818.             sortFunc: function(d, c) {
  8819.                 return strcmp(c.foodCount, d.foodCount) || Listview.funcBox.assocArrCmp(d.diet, c.diet, openDB_pet_foods)
  8820.             }
  8821.         }, {
  8822.             id: "type",
  8823.             name: LANG.type,
  8824.             type: "text",
  8825.             compute: function(b, d) {
  8826.                 if (b.type != null) {
  8827.                     d.className = "small q1";
  8828.                     var c = ce("a");
  8829.                     c.href = "pets=" + b.type;
  8830.                     ae(c, ct(openDB_pet_types[b.type]));
  8831.                     ae(d, c)
  8832.                 }
  8833.             },
  8834.             getVisibleText: function(a) {
  8835.                 if (a.type != null) {
  8836.                     return openDB_pet_types[a.type]
  8837.                 }
  8838.             },
  8839.             sortFunc: function(d, c, e) {
  8840.                 return strcmp(openDB_pet_types[d.type], openDB_pet_types[c.type])
  8841.             }
  8842.         }],
  8843.         getItemLink: function(a) {
  8844.             return "pet=" + a.id
  8845.         },
  8846.         getStatPct: function(b) {
  8847.             var a = ce("span");
  8848.             if (!isNaN(b) && b > 0) {
  8849.                 a.className = "q2";
  8850.                 ae(a, ct("+" + b + "%"))
  8851.             } else {
  8852.                 if (!isNaN(b) && b < 0) {
  8853.                     a.className = "q10";
  8854.                     ae(a, ct(b + "%"))
  8855.                 }
  8856.             }
  8857.             return a
  8858.         }
  8859.     },
  8860.     achievement: {
  8861.         sort: [1, 2],
  8862.         nItemsPerPage: 100,
  8863.         searchable: 1,
  8864.         filtrable: 1,
  8865.         columns: [{
  8866.             id: "name",
  8867.             name: LANG.name,
  8868.             type: "text",
  8869.             align: "left",
  8870.             value: "name",
  8871.             span: 2,
  8872.             compute: function(c, j, g) {
  8873.                 var b = null;
  8874.                 if (c.who && c.completed) {
  8875.                     b = "who=" + c.who + "&when=" + c.completed.getTime()
  8876.                 }
  8877.                 var f = ce("td");
  8878.                 f.style.width = "1px";
  8879.                 f.style.padding = "0";
  8880.                 f.style.borderRight = "none";
  8881.                 ae(f, openDB_achievements.createIcon(c.id, 1));
  8882.                 Icon.getLink(f.firstChild).rel = b;
  8883.                 ae(g, f);
  8884.                 j.style.borderLeft = "none";
  8885.                 var e = ce("a");
  8886.                 e.style.fontFamily = "Verdana, sans-serif";
  8887.                 e.href = this.template.getItemLink(c);
  8888.                 e.rel = b;
  8889.                 ae(e, ct(c.name));
  8890.                 ae(j, e);
  8891.                 if (c.description != null) {
  8892.                     var h = ce("div");
  8893.                     h.className = "small";
  8894.                     ae(h, ct(c.description));
  8895.                     ae(j, h)
  8896.                 }
  8897.             },
  8898.             getVisibleText: function(a) {
  8899.                 var b = a.name;
  8900.                 if (a.description) {
  8901.                     b += " " + a.description
  8902.                 }
  8903.                 return b
  8904.             }
  8905.         }, {
  8906.             id: "location",
  8907.             name: LANG.location,
  8908.             type: "text",
  8909.             width: "15%",
  8910.             compute: function(b, d) {
  8911.                 if (b.zone) {
  8912.                     var c = ce("a");
  8913.                     c.className = "q1";
  8914.                     c.href = "zone=" + b.zone;
  8915.                     ae(c, ct(openDB_zones[b.zone]));
  8916.                     ae(d, c)
  8917.                 }
  8918.             },
  8919.             getVisibleText: function(a) {
  8920.                 return Listview.funcBox.arrayText(a.zone, openDB_zones)
  8921.             },
  8922.             sortFunc: function(d, c, e) {
  8923.                 return Listview.funcBox.assocArrCmp(d.zone, c.zone, openDB_zones)
  8924.             }
  8925.         }, {
  8926.             id: "side",
  8927.             name: LANG.side,
  8928.             type: "text",
  8929.             width: "10%",
  8930.             compute: function(a, c) {
  8931.                 if (a.side) {
  8932.                     var b = ce("span");
  8933.                     if (a.side == 1) {
  8934.                         b.className = "alliance-icon"
  8935.                     } else {
  8936.                         if (a.side == 2) {
  8937.                             b.className = "horde-icon"
  8938.                         }
  8939.                     }
  8940.                     ae(b, ct(openDB_sides[a.side]));
  8941.                     ae(c, b)
  8942.                 } else {
  8943.                     return -1
  8944.                 }
  8945.             },
  8946.             getVisibleText: function(a) {
  8947.                 if (a.side) {
  8948.                     return openDB_sides[a.side]
  8949.                 }
  8950.             },
  8951.             sortFunc: function(d, c, e) {
  8952.                 return strcmp(openDB_sides[d.side], openDB_sides[c.side])
  8953.             }
  8954.         }, {
  8955.             id: "points",
  8956.             name: LANG.points,
  8957.             type: "number",
  8958.             width: "10%",
  8959.             value: "points",
  8960.             compute: function(a, b) {
  8961.                 if (a.points) {
  8962.                     Listview.funcBox.appendMoney(b, 0, null, 0, 0, 0, a.points)
  8963.                 }
  8964.             }
  8965.         }, {
  8966.             id: "category",
  8967.             name: LANG.category,
  8968.             type: "text",
  8969.             width: "15%",
  8970.             compute: function(b, d) {
  8971.                 d.className = "small q1";
  8972.                 var c = ce("a");
  8973.                 c.href = "achievements=" + b.category;
  8974.                 ae(c, ct(openDB_achievement_categories[b.category]));
  8975.                 ae(d, c)
  8976.             },
  8977.             getVisibleText: function(a) {
  8978.                 return openDB_achievement_categories[a.category]
  8979.             },
  8980.             sortFunc: function(d, c, e) {
  8981.                 return strcmp(openDB_achievement_categories[d.category], openDB_achievement_categories[c.category])
  8982.             },
  8983.             hidden: true
  8984.         }],
  8985.         getItemLink: function(a) {
  8986.             return "achievement=" + a.id
  8987.         }
  8988.     }
  8989. };
  8990. Menu.fixUrls(mn_items, "items=");
  8991. Menu.fixUrls(mn_itemSets, "itemsets=");
  8992. Menu.fixUrls(mn_npcs, "npcs=");
  8993. Menu.fixUrls(mn_objects, "objects=");
  8994. Menu.fixUrls(mn_quests, "quests=");
  8995. Menu.fixUrls(mn_spells, "spells=");
  8996. Menu.fixUrls(mn_zones, "zones=");
  8997. Menu.fixUrls(mn_pets, "pets=");
  8998. Menu.fixUrls(mn_factions, "factions=");
  8999. Menu.fixUrls(mn_achievements, "achievements=", null, true);
  9000. var openDB_dev = false;
  9001. var openDB_locale = {
  9002.     id: 0,
  9003.     name: "enus"
  9004. };
  9005. var openDB_localTime = new Date();
  9006. var openDB_items = {};
  9007. var openDB_quests = {};
  9008. var openDB_spells = {};
  9009. var openDB_achievements = {};
  9010. var openDB_users = {};
  9011. var openDB_types = {
  9012.     1: "npc",
  9013.     2: "object",
  9014.     3: "item",
  9015.     4: "itemset",
  9016.     5: "quest",
  9017.     6: "spell",
  9018.     7: "zone",
  9019.     8: "faction",
  9020.     9: "pet",
  9021.     10: "achievement"
  9022. };
  9023. var openDB_locales = {
  9024.     0: "enus",
  9025.     2: "frfr",
  9026.     3: "dede",
  9027.     6: "eses",
  9028.     8: "ruru",
  9029.     25: "ptr"
  9030. };
  9031. var openDB_file_races = {
  9032.     10: "bloodelf",
  9033.     11: "draenei",
  9034.     3: "dwarf",
  9035.     7: "gnome",
  9036.     1: "human",
  9037.     4: "nightelf",
  9038.     2: "orc",
  9039.     6: "tauren",
  9040.     8: "troll",
  9041.     5: "scourge"
  9042. };
  9043. var openDB_file_classes = {
  9044.     6: "deathknight",
  9045.     11: "druid",
  9046.     3: "hunter",
  9047.     8: "mage",
  9048.     2: "paladin",
  9049.     5: "priest",
  9050.     4: "rogue",
  9051.     7: "shaman",
  9052.     9: "warlock",
  9053.     1: "warrior"
  9054. };
  9055. var openDB_file_genders = {
  9056.     0: "male",
  9057.     1: "female"
  9058. };
  9059. var openDB_file_factions = {
  9060.     1: "alliance",
  9061.     2: "horde"
  9062. };
  9063. var openDB_file_gems = {
  9064.     1: "meta",
  9065.     2: "red",
  9066.     4: "yellow",
  9067.     6: "orange",
  9068.     8: "blue",
  9069.     10: "purple",
  9070.     12: "green",
  9071.     14: "prismatic"
  9072. };
  9073. var openDB_customColors = {
  9074.     Miyari: "pink"
  9075. };
  9076. openDB_items.add = function(b, a) {
  9077.     if (openDB_items[b] != null) {
  9078.         cO(openDB_items[b], a)
  9079.     } else {
  9080.         openDB_items[b] = a
  9081.     }
  9082. };
  9083. openDB_items.getIcon = function(a) {
  9084.     if (openDB_items[a] != null) {
  9085.         return openDB_items[a].icon
  9086.     } else {
  9087.         return "inv_misc_questionmark"
  9088.     }
  9089. };
  9090. openDB_items.createIcon = function(d, b, a, c) {
  9091.     return Icon.create(openDB_items.getIcon(d), b, null, "item=" + d, a, c)
  9092. };
  9093. openDB_spells.getIcon = function(a) {
  9094.     if (openDB_spells[a] != null) {
  9095.         return openDB_spells[a].icon
  9096.     } else {
  9097.         return "inv_misc_questionmark"
  9098.     }
  9099. };
  9100. openDB_spells.createIcon = function(d, b, a, c) {
  9101.     return Icon.create(openDB_spells.getIcon(d), b, null, "spell=" + d, a, c)
  9102. };
  9103. openDB_achievements.getIcon = function(a) {
  9104.     if (openDB_achievements[a] != null) {
  9105.         return openDB_achievements[a].icon
  9106.     } else {
  9107.         return "inv_misc_questionmark"
  9108.     }
  9109. };
  9110. openDB_achievements.createIcon = function(d, b, a, c) {
  9111.     return Icon.create(openDB_achievements.getIcon(d), b, null, "achievement=" + d, a, c)
  9112. };
  9113. var $utilGrp = new function() {
  9114.     var e, D, H, q, J, B, z, g = 0,
  9115.         C = {},
  9116.         f = {},
  9117.         c = {},
  9118.         G = 0,
  9119.         E = 1,
  9120.         h = 2,
  9121.         r = 3,
  9122.         F = 4,
  9123.         s = 1,
  9124.         j = 2,
  9125.         v = 3,
  9126.         y = 5,
  9127.         t = 6,
  9128.         m = 10,
  9129.         i = 100,
  9130.         o = 15,
  9131.         x = 15,
  9132.         p = {
  9133.             1: [C, "npc"],
  9134.             2: [f, "object"],
  9135.             3: [openDB_items, "item"],
  9136.             5: [openDB_quests, "quest"],
  9137.             6: [openDB_spells, "spell"],
  9138.             10: [openDB_achievements, "achievement"],
  9139.             100: [c, "profile"]
  9140.         };
  9141.  
  9142.     function K() {
  9143.         aE(document, "mouseover", u)
  9144.     }
  9145.  
  9146.     function n(O) {
  9147.         var P = openDB_getCursorPos(O);
  9148.         B = P.x;
  9149.         z = P.y
  9150.     }
  9151.  
  9152.     function M(aa, W) {
  9153.         if (aa.nodeName != "A" && aa.nodeName != "AREA") {
  9154.             return -2323
  9155.         }
  9156.         if (!aa.href.length) {
  9157.             return
  9158.         }
  9159.         if (aa.rel.indexOf("np") != -1) {
  9160.             return
  9161.         }
  9162.         var T, S, Q, P, U = {};
  9163.         q = U;
  9164.         var AB;
  9165.         var O = function(ab, af, ad) {
  9166.             if (af == "buff" || af == "sock") {
  9167.                 U[af] = true
  9168.             } else {
  9169.                 if (af == "rand" || af == "ench" || af == "lvl" || af == "c") {
  9170.                     U[af] = parseInt(ad)
  9171.                 } else {
  9172.                     if (af == "gems" || af == "pcs") {
  9173.                         U[af] = ad.split(":")
  9174.                     } else {
  9175.                         if (af == "who" || af == "domain") {
  9176.                             U[af] = ad
  9177.                         } else {
  9178.                             if (af == "when") {
  9179.                                 U[af] = new Date(parseInt(ad))
  9180.                             }
  9181.                         }
  9182.                     }
  9183.                 }
  9184.             }
  9185.         };
  9186.         S = 2;
  9187.         Q = 3;
  9188.         P = aa.href.match(/()(item|quest|spell|achievement|npc|object)=([^&#]+)/);
  9189.         AB = aa.href;
  9190.         if (P == null && aa.rel) {
  9191.             T = 0;
  9192.             S = 1;
  9193.             Q = 2;
  9194.             P = aa.rel.match(/(item|quest|spell|achievement|npc|object).?([^&#]+)/);
  9195.             AB = aa.href;
  9196.         }
  9197.         if (aa.rel) {
  9198.             aa.rel.replace(/([a-zA-Z]+)=?([a-zA-Z0-9:-]*)/g, O);
  9199.             if (U.gems && U.gems.length > 0) {
  9200.                 var V;
  9201.                 for (V = Math.min(3, U.gems.length - 1); V >= 0; --V) {
  9202.                     if (parseInt(U.gems[V])) {
  9203.                         break
  9204.                     }
  9205.                 }++V;
  9206.                 if (V == 0) {
  9207.                     delete U.gems
  9208.                 } else {
  9209.                     if (V < U.gems.length) {
  9210.                         U.gems = U.gems.slice(0, V)
  9211.                     }
  9212.                 }
  9213.             }
  9214.         }
  9215.         if (P) {
  9216.             var Z, R = "www";
  9217.             J = aa;
  9218.             if (U.domain) {
  9219.                 R = U.domain
  9220.             } else {
  9221.                 if (T && P[T]) {
  9222.                     R = P[T]
  9223.                 }
  9224.             }
  9225.             Z = openDB_locale.id;
  9226.             if (aa.href.indexOf("#") != -1 && document.location.href.indexOf(P[S] + "=" + P[Q]) != -1) {
  9227.                 return
  9228.             }
  9229.             g = (aa.parentNode.className.indexOf("icon") == 0 ? 1 : 0);
  9230.             if (!aa.onmouseout) {
  9231.                 if (g == 0) {
  9232.                     aa.onmousemove = a
  9233.                 }
  9234.                 aa.onmouseout = L
  9235.             }
  9236.             n(W);
  9237.             var Y = openDB_getIdFromTypeName(P[S]),
  9238.                 X = P[Q];
  9239.             if (Y == i && !openDB_dev) {
  9240.                 Z = 0
  9241.             }
  9242.             w(Y, X, Z, U, AB)
  9243.         }
  9244.     }
  9245.  
  9246.     function u(Q) {
  9247.         Q = $E(Q);
  9248.         var P = Q._target;
  9249.         var O = 0;
  9250.         while (P != null && O < 3 && M(P, Q) == -2323) {
  9251.             P = P.parentNode;
  9252.             ++O
  9253.         }
  9254.     }
  9255.  
  9256.     function a(O) {
  9257.         O = $E(O);
  9258.         n(O);
  9259.         Tooltip.move(B, z, 0, 0, o, x)
  9260.     }
  9261.  
  9262.     function L() {
  9263.         e = null;
  9264.         J = null;
  9265.         Tooltip.hide()
  9266.     }
  9267.  
  9268.     function I(O) {
  9269.         return (q.buff ? "buff_" : "tooltip_") + openDB_locales[O]
  9270.     }
  9271.  
  9272.     function k(P, R, Q) {
  9273.         var O = p[P][0];
  9274.         if (O[R] == null) {
  9275.             O[R] = {}
  9276.         }
  9277.         if (O[R].status == null) {
  9278.             O[R].status = {}
  9279.         }
  9280.         if (O[R].status[Q] == null) {
  9281.             O[R].status[Q] = G
  9282.         }
  9283.     }
  9284.  
  9285.     function w(P, T, R, S, AB) {
  9286.         if (!S) {
  9287.             S = {}
  9288.         }
  9289.         var Q = d(T, S);
  9290.         e = P;
  9291.         D = Q;
  9292.         H = R;
  9293.         q = S;
  9294.         k(P, Q, R);
  9295.         var O = p[P][0];
  9296.         if (O[Q].status[R] == F || O[Q].status[R] == r) {
  9297.             N(O[Q][I(R)], O[Q].icon)
  9298.         } else {
  9299.             if (O[Q].status[R] == E) {
  9300.                 N(LANG.tooltip_loading)
  9301.             } else {
  9302.                 b(P, T, R, null, S, AB)
  9303.             }
  9304.         }
  9305.     }
  9306.  
  9307.     function b(W, S, X, Q, T, AB) {
  9308.         var O = d(S, T);
  9309.         var V = p[W][0];
  9310.         if (V[O].status[X] != G && V[O].status[X] != h) {
  9311.             return
  9312.         }
  9313.         V[O].status[X] = E;
  9314.         if (!Q) {
  9315.             V[O].timer = setTimeout(function() {
  9316.                 l.apply(this, [W, O, X])
  9317.             }, 333)
  9318.         }
  9319.         var R = "";
  9320.         for (var U in T) {
  9321.             if (U != "rand" && U != "ench" && U != "gems" && U != "sock") {
  9322.                 continue
  9323.             }
  9324.             if (typeof T[U] == "object") {
  9325.                 R += "&" + U + "=" + T[U].join(":")
  9326.             } else {
  9327.                 if (U == "sock") {
  9328.                     R += "&sock"
  9329.                 } else {
  9330.                     R += "&" + U + "=" + T[U]
  9331.                 }
  9332.             }
  9333.         }
  9334.         var full = AB.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/i);
  9335.         var su = full[1];
  9336.         if (su == "www") {
  9337.             su = "wotlk";
  9338.         }
  9339.         var P = "//" + su + ".openwow.com/" + p[W][1] + "=" + S + "&power=true";
  9340.         openDB_ajaxIshRequest(P)
  9341.     }
  9342.  
  9343.     function N(R, S) {
  9344.         if (J._fixTooltip) {
  9345.             R = J._fixTooltip(R, e, D, J)
  9346.         }
  9347.         if (!R) {
  9348.             R = LANG["tooltip_" + openDB_types[e] + "notfound"];
  9349.             S = "inv_misc_questionmark"
  9350.         } else {
  9351.             if (q != null) {
  9352.                 if (q.pcs && q.pcs.length) {
  9353.                     var T = 0;
  9354.                     for (var Q = 0, P = q.pcs.length; Q < P; ++Q) {
  9355.                         var O;
  9356.                         if (O = R.match(new RegExp("<span><!--si([0-9]+:)*" + q.pcs[Q] + "(:[0-9]+)*-->"))) {
  9357.                             R = R.replace(O[0], '<span class="q8"><!--si' + q.pcs[Q] + "-->");
  9358.                             ++T
  9359.                         }
  9360.                     }
  9361.                     if (T > 0) {
  9362.                         R = R.replace("(0/", "(" + T + "/");
  9363.                         R = R.replace(new RegExp("<span>\\(([0-" + T + "])\\)", "g"), '<span class="q2">($1)')
  9364.                     }
  9365.                 }
  9366.                 if (q.c) {
  9367.                     R = R.replace(/<span class="c([0-9]+?)">(.+?)<\/span><br \/>/g, '<span class="c$1" style="display: none">$2</span>');
  9368.                     R = R.replace(new RegExp('<span class="c(' + q.c + ')" style="display: none">(.+?)</span>', "g"), '<span class="c$1">$2</span><br />')
  9369.                 }
  9370.                 if (q.lvl) {
  9371.                     R = R.replace(/\(<!--r([0-9]+):([0-9]+):([0-9]+)-->([0-9.%]+)(.+?)([0-9]+)\)/g, function(X, Z, Y, W, U, ab, V) {
  9372.                         var aa = openDB_convertRatingToPercent(q.lvl, Y, W);
  9373.                         aa = (Math.round(aa * 100) / 100);
  9374.                         if (Y != 12 && Y != 37) {
  9375.                             aa += "%"
  9376.                         }
  9377.                         return "(<!--r" + q.lvl + ":" + Y + ":" + W + "-->" + aa + ab + q.lvl + ")"
  9378.                     })
  9379.                 }
  9380.                 if (q.who && q.when) {
  9381.                     R = R.replace("<table><tr><td><br />", '<table><tr><td><br /><span class="q2">' + sprintf(LANG.tooltip_achievementcomplete, q.who, q.when.getMonth() + 1, q.when.getDate(), q.when.getFullYear()) + "</span><br /><br />");
  9382.                     R = R.replace(/class="q0"/g, 'class="r3"')
  9383.                 }
  9384.             }
  9385.         }
  9386.         if (g == 1) {
  9387.             Tooltip.setIcon(null);
  9388.             Tooltip.show(J, R)
  9389.         } else {
  9390.             Tooltip.setIcon(S);
  9391.             Tooltip.showAtXY(R, B, z, o, x)
  9392.         }
  9393.     }
  9394.  
  9395.     function l(P, R, Q) {
  9396.         if (e == P && D == R && H == Q) {
  9397.             N(LANG.tooltip_loading);
  9398.             var O = p[P][0];
  9399.             O[R].timer = setTimeout(function() {
  9400.                 A.apply(this, [P, R, Q])
  9401.             }, 3850)
  9402.         }
  9403.     }
  9404.  
  9405.     function A(P, R, Q) {
  9406.         var O = p[P][0];
  9407.         O[R].status[Q] = h;
  9408.         if (e == P && D == R && H == Q) {
  9409.             N(LANG.tooltip_noresponse)
  9410.         }
  9411.     }
  9412.  
  9413.     function d(P, O) {
  9414.         return P + (O.rand ? "r" + O.rand : "") + (O.ench ? "e" + O.ench : "") + (O.gems ? "g" + O.gems.join(",") : "") + (O.sock ? "s" : "")
  9415.     }
  9416.     this.reg = function(Q, S, R, P) {
  9417.         var O = p[Q][0];
  9418.         k(Q, S, R);
  9419.         if (O[S].timer) {
  9420.             clearTimeout(O[S].timer);
  9421.             O[S].timer = null
  9422.         }
  9423.         cO(O[S], P);
  9424.         if (O[S].status[R] == E) {
  9425.             if (O[S][I(R)]) {
  9426.                 O[S].status[R] = F
  9427.             } else {
  9428.                 O[S].status[R] = r
  9429.             }
  9430.         }
  9431.         if (e == Q && S == D && H == R) {
  9432.             N(O[S][I(R)], O[S].icon)
  9433.         }
  9434.     };
  9435.     this.regNpc = function(Q, P, O) {
  9436.         this.reg(s, Q, P, O)
  9437.     };
  9438.     this.regObject = function(Q, P, O) {
  9439.         this.reg(j, Q, P, O)
  9440.     };
  9441.     this.regItem = function(Q, P, O) {
  9442.         this.reg(v, Q, P, O)
  9443.     };
  9444.     this.regQuest = function(Q, P, O) {
  9445.         this.reg(y, Q, P, O)
  9446.     };
  9447.     this.regSpell = function(Q, P, O) {
  9448.         this.reg(t, Q, P, O)
  9449.     };
  9450.     this.regAchievement = function(Q, P, O) {
  9451.         this.reg(m, Q, P, O)
  9452.     };
  9453.     this.regProfile = function(Q, P, O) {
  9454.         this.reg(i, Q, P, O)
  9455.     };
  9456.     this.req = function(O, S, Q, R) {
  9457.         if (!R) {
  9458.             R = {}
  9459.         }
  9460.         var P = d(S, R);
  9461.         k(O, P, Q);
  9462.         b(O, S, Q, 1, R)
  9463.     };
  9464.     this.reqItem = function(P, O) {
  9465.         this.req(v, P, openDB_locale.id, O)
  9466.     };
  9467.     this.reqSpell = function(O) {
  9468.         this.req(t, O, openDB_locale.id)
  9469.     };
  9470.     this.getStatus = function(P, R, Q) {
  9471.         var O = p[P][0];
  9472.         if (O[R] != null) {
  9473.             return O[R].status[Q]
  9474.         } else {
  9475.             return G
  9476.         }
  9477.     };
  9478.     this.getItemStatus = function(P, O) {
  9479.         this.getStatus(v, P, O)
  9480.     };
  9481.     this.getSpellStatus = function(P, O) {
  9482.         this.getStatus(t, P, O)
  9483.     };
  9484.     K()
  9485. };
  9486. var qSearch = new function() {
  9487.     var currentTextbox, lastSearch = {},
  9488.         lastDiv, timer, prepared, container, cancelNext, hasData, summary, selection;
  9489.  
  9490.     function setText(textbox, txt) {
  9491.         textbox.value = txt;
  9492.         textbox.selectionStart = textbox.selectionEnd = txt.length
  9493.     }
  9494.  
  9495.     function colorDiv(div, fromOver) {
  9496.         if (lastDiv) {
  9497.             lastDiv.className = lastDiv.className.replace("qSearch-sel", "")
  9498.         }
  9499.         lastDiv = div;
  9500.         lastDiv.className += " qSearch-sel";
  9501.         selection = div.i;
  9502.         if (!fromOver) {
  9503.             show();
  9504.             setTimeout(setText.bind(0, currentTextbox, openDB_getTextContent(div.firstChild.firstChild.childNodes[1])), 1);
  9505.             cancelNext = 1
  9506.         }
  9507.     }
  9508.  
  9509.     function aOver() {
  9510.         colorDiv(this.parentNode.parentNode, 1)
  9511.     }
  9512.  
  9513.     function isVisible() {
  9514.         if (!container) {
  9515.             return false
  9516.         }
  9517.         return container.style.display != "none"
  9518.     }
  9519.  
  9520.     function adjust(fromResize) {
  9521.         if (fromResize == 1 && !isVisible()) {
  9522.             return
  9523.         }
  9524.         if (currentTextbox == null) {
  9525.             return
  9526.         }
  9527.         var c = ac(currentTextbox);
  9528.         container.style.left = (c[0] - 2 + 10) + "px";
  9529.         container.style.top = (c[1] + currentTextbox.offsetHeight + 1) + "px";
  9530.         container.style.width = currentTextbox.offsetWidth + 13 + "px"
  9531.     }
  9532.  
  9533.     function prepare() {
  9534.         if (prepared) {
  9535.             return
  9536.         }
  9537.         prepared = 1;
  9538.         container = ce("div");
  9539.         container.className = "qSearch";
  9540.         container.style.display = "none";
  9541.         ae(ge("layers"), container);
  9542.         aE(window, "resize", adjust.bind(0, 1));
  9543.         aE(document, "click", hide)
  9544.     }
  9545.  
  9546.     function show() {
  9547.         if (container && !isVisible()) {
  9548.             adjust();
  9549.             container.style.display = ""
  9550.         }
  9551.     }
  9552.  
  9553.     function hide() {
  9554.         if (container) {
  9555.             container.style.display = "none"
  9556.         }
  9557.     }
  9558.  
  9559.     function boldify(match) {
  9560.         return "<b>" + match + "</b>"
  9561.     }
  9562.  
  9563.     function display(textbox, search, suggz, dataz) {
  9564.         prepare();
  9565.         show();
  9566.         lastA = null;
  9567.         hasData = 1;
  9568.         selection = null;
  9569.         while (container.firstChild) {
  9570.             de(container.firstChild)
  9571.         }
  9572.         if (!Browser.ie6) {
  9573.             ae(container, ce("em"));
  9574.             ae(container, ce("var"));
  9575.             ae(container, ce("strong"))
  9576.         }
  9577.         var create = ce("div");
  9578.         create.className = "top";
  9579.         var tex = ce("p");
  9580.         tex.innerHTML = "Most relevent search results...";
  9581.         ae(create, tex);
  9582.         ae(container, create);
  9583.         search = search.replace(/[^a-z0-9\-]/i, " ");
  9584.         search = trim(search.replace(/\s+/g, " "));
  9585.         var regex = openDB_createOrRegex(search);
  9586.         for (var i = 0, len = suggz.length; i < len; ++i) {
  9587.             var pos = suggz[i].lastIndexOf("(");
  9588.             if (pos != -1) {
  9589.                 suggz[i] = suggz[i].substr(0, pos - 1)
  9590.             }
  9591.             var type = dataz[i][0],
  9592.                 typeId = dataz[i][1],
  9593.                 expan = dataz[i][2],
  9594.                 param1 = dataz[i][3],
  9595.                 param2 = dataz[i][4],
  9596.                 cont = ce("div"),
  9597.                 cont2 = ce("div"),
  9598.                 a = ce("a"),
  9599.                 sp = ce("i"),
  9600.                 sp2 = ce("span"),
  9601.                 div = ce("div"),
  9602.                 div2 = ce("div");
  9603.             div.i = i;
  9604.             a.onmouseover = aOver;
  9605.             if (textbox._summary) {
  9606.                 a.href = "javascript:;";
  9607.                 a.onmousedown = Summary.addGroupItem.bind(openDB_summaries[textbox._summary], textbox._type, typeId);
  9608.                 a.onclick = rf;
  9609.                 a.rel = openDB_types[type] + "=" + typeId
  9610.             } else {
  9611.                 if (textbox._profileslots) {
  9612.                     a.href = "javascript:;";
  9613.                     a.onmousedown = void(0);
  9614.                     a.onclick = rf;
  9615.                     a.rel = openDB_types[type] + "=" + typeId
  9616.                 } else {
  9617.                     if (expan.length > 2) {
  9618.                         a.href = "http://" + expan + ".openwow.com/" + openDB_types[type] + "=" + typeId
  9619.                     } else {
  9620.                         a.href = "http://" + qsUrl + ".openwow.com/" + openDB_types[type] + "=" + typeId
  9621.                     }
  9622.                 }
  9623.             }
  9624.             if (textbox._append) {
  9625.                 a.rel += textbox._append
  9626.             }
  9627.             if (type == 3 && param2 != null) {
  9628.                 a.className += " q" + param2
  9629.             }
  9630.             if ((type == 3 || type == 6 || type == 9 || type == 10) && param1) {
  9631.                 div.className += " qSearch-ico";
  9632.                 div.style.backgroundImage = "url(http://cdn.openwow.com/" + qsUrl + "/icons/small/" + param1.toLowerCase() + ".jpg)"
  9633.             } else {
  9634.                 if (type == 5 && param1 >= 1 && param1 <= 2) {
  9635.                     div.className += " qSearch-ico-" + (param1 == 1 ? "alliance" : "horde")
  9636.                 }
  9637.             }
  9638.             if (i % 2) {
  9639.                 cont.className += " odd"
  9640.             }
  9641.             if (!textbox._summary && !textbox._profileslots) {
  9642.                 ae(sp, ct(LANG.types[type][0]))
  9643.             }
  9644.             ae(a, sp);
  9645.             var buffer = suggz[i];
  9646.             buffer = buffer.replace(regex, boldify);
  9647.             sp2.innerHTML = buffer;
  9648.             ae(a, sp2);
  9649.             if (type == 6 && param2) {
  9650.                 ae(a, ct(" (" + param2 + ")"))
  9651.             }
  9652.             cont.className = "qSearch-ico-" + expan;
  9653.             if (expan.length > 2) {
  9654.                 cont2.className = "expcont";
  9655.             }
  9656.             ae(div2, a);
  9657.             ae(div, div2);
  9658.             ae(cont2, div);
  9659.             ae(cont, cont2);
  9660.             ae(container, cont);
  9661.         }
  9662.     }
  9663.  
  9664.     function receive(xhr, opt) {
  9665.         var text;
  9666.         if (typeof xhr.responseText == "string") {
  9667.             response = xhr.responseText;
  9668.             text = response.substring(response.indexOf('<p>') + 3, response.indexOf('</p>'));
  9669.         } else {
  9670.             text = xhr;
  9671.         }
  9672.         if (text.charAt(0) != "[" || text.charAt(text.length - 1) != "]") {
  9673.             return
  9674.         }
  9675.         var a = eval(text);
  9676.         var search = a[0];
  9677.         if (search == opt.search) {
  9678.             if ((opt.textbox._summary || opt.textbox._profileslots) && a.length == 9) {
  9679.                 for (var i = 0, len = a[8].length; i < len; ++i) {
  9680.                     if (opt.textbox._summary && in_array(openDB_summaries[opt.textbox._summary].data, a[8][i].id, function(x) {
  9681.                             return x.id
  9682.                         }) == -1) {
  9683.                         openDB_summaries[opt.textbox._summary].data.push(a[8][i]);
  9684.                         openDB_items.add(a[8][i].id, {
  9685.                             icon: a[8][i].icon
  9686.                         })
  9687.                     } else {
  9688.                         if (opt.textbox._profileslots) {
  9689.                             var _ = {};
  9690.                             _["name_" + openDB_locale.name] = a[8][i].name.substring(1);
  9691.                             cO(_, {
  9692.                                 quality: parseInt(a[8][i].name.charAt(0)),
  9693.                                 icon: a[8][i].icon,
  9694.                                 displayid: a[8][i].displayid,
  9695.                                 jsonequip: {},
  9696.                                 itemset: 0
  9697.                             });
  9698.                             cO(_.jsonequip, a[8][i]);
  9699.                             openDB_items.add(a[8][i].id, _)
  9700.                         }
  9701.                     }
  9702.                 }
  9703.                 a.splice(8, 1)
  9704.             }
  9705.             if (a.length == 8) {
  9706.                 display(opt.textbox, search, a[1], a[7])
  9707.             } else {
  9708.                 hide()
  9709.             }
  9710.         }
  9711.     }
  9712.  
  9713.     function fetch(textbox, search) {
  9714.         var url1 = qSearchUrl() + urlencode(search);
  9715.         if (textbox._type) {
  9716.             url1 += "&type=" + textbox._type
  9717.         }
  9718.         if (textbox._profileslots) {
  9719.             url1 += "&slots=" + textbox._profileslots.join(":")
  9720.         }
  9721.         jQuery.ajax({
  9722.             url: url1,
  9723.             type: 'GET',
  9724.             success: function(res) {
  9725.                 receive(res, {
  9726.                     textbox: textbox,
  9727.                     search: search
  9728.                 });
  9729.             }
  9730.         });
  9731.     }
  9732.  
  9733.     function preFetch(textbox, search) {
  9734.         if (cancelNext) {
  9735.             cancelNext = 0;
  9736.             return
  9737.         }
  9738.         hasData = 0;
  9739.         if (timer > 0) {
  9740.             clearTimeout(timer);
  9741.             timer = 0
  9742.         }
  9743.         timer = setTimeout(fetch.bind(0, textbox, search), 333)
  9744.     }
  9745.  
  9746.     function cycle(dir) {
  9747.         if (!isVisible()) {
  9748.             if (hasData) {
  9749.                 show()
  9750.             }
  9751.             return
  9752.         }
  9753.         var firstNode = (container.childNodes[0].nodeName == "EM" ? container.childNodes[3] : container.firstChild);
  9754.         var bakDiv = dir ? firstNode : container.lastChild;
  9755.         if (lastDiv == null) {
  9756.             colorDiv(bakDiv)
  9757.         } else {
  9758.             var div = dir ? lastDiv.nextSibling : lastDiv.previousSibling;
  9759.             if (div) {
  9760.                 if (div.nodeName == "STRONG") {
  9761.                     div = container.lastChild
  9762.                 }
  9763.                 colorDiv(div)
  9764.             } else {
  9765.                 colorDiv(bakDiv)
  9766.             }
  9767.         }
  9768.     }
  9769.  
  9770.     function onKeyUp(e) {
  9771.         e = $E(e);
  9772.         var textbox = e._target;
  9773.         switch (e.keyCode) {
  9774.             case 48:
  9775.             case 96:
  9776.             case 107:
  9777.             case 109:
  9778.                 if (Browser.gecko && e.ctrlKey) {
  9779.                     adjust(textbox);
  9780.                     break
  9781.                 }
  9782.                 break;
  9783.             case 13:
  9784.                 if ((textbox._summary || textbox._profileslots) && hasData && isVisible()) {
  9785.                     var div = container.childNodes[(Browser.ie6 ? 0 : 3) + (selection | 0)];
  9786.                     div.firstChild.firstChild.onmousedown();
  9787.                     hide();
  9788.                     if (textbox._summary) {
  9789.                         openDB_summaries.compare.toggleOptions()
  9790.                     }
  9791.                     return
  9792.                 }
  9793.                 break
  9794.         }
  9795.         var search = trim(textbox.value.replace(/\s+/g, " "));
  9796.         if (search == lastSearch[textbox.id]) {
  9797.             return
  9798.         }
  9799.         lastSearch[textbox.id] = search;
  9800.         if (search.length) {
  9801.             preFetch(textbox, search)
  9802.         } else {
  9803.             hide()
  9804.         }
  9805.     }
  9806.  
  9807.     function onKeyDown(e) {
  9808.         e = $E(e);
  9809.         var textbox = e._target;
  9810.         switch (e.keyCode) {
  9811.             case 27:
  9812.                 hide();
  9813.                 break;
  9814.             case 38:
  9815.                 cycle(0);
  9816.                 break;
  9817.             case 40:
  9818.                 cycle(1);
  9819.                 break
  9820.         }
  9821.     }
  9822.  
  9823.     function onFocus(e) {
  9824.         e = $E(e);
  9825.         var textbox = e._target;
  9826.         if (textbox != document) {
  9827.             currentTextbox = textbox
  9828.         }
  9829.     }
  9830.     this.attach = function(textbox) {
  9831.         if (textbox.getAttribute("autocomplete") == "off") {
  9832.             return
  9833.         }
  9834.         textbox.setAttribute("autocomplete", "off");
  9835.         aE(textbox, "focus", onFocus);
  9836.         aE(textbox, "keyup", onKeyUp);
  9837.         aE(textbox, Browser.opera ? "keypress" : "keydown", onKeyDown)
  9838.     };
  9839.     this.reset = function(textbox) {
  9840.         lastSearch[textbox.id] = null;
  9841.         textbox.value = "";
  9842.         hasData = 0;
  9843.         hide()
  9844.     };
  9845.     this.hide = function() {
  9846.         hide()
  9847.     }
  9848. };
  9849. var Lightbox = new function() {
  9850.     var d, m, n, h = {},
  9851.         c = {},
  9852.         i, f;
  9853.  
  9854.     function o() {
  9855.         aE(d, "click", e);
  9856.         aE(document, Browser.opera ? "keypress" : "keydown", g);
  9857.         aE(window, "resize", a);
  9858.         if (Browser.ie6) {
  9859.             aE(window, "scroll", j)
  9860.         }
  9861.     }
  9862.  
  9863.     function l() {
  9864.         dE(d, "click", e);
  9865.         dE(document, Browser.opera ? "keypress" : "keydown", g);
  9866.         dE(window, "resize", a);
  9867.         if (Browser.ie6) {
  9868.             dE(window, "scroll", j)
  9869.         }
  9870.     }
  9871.  
  9872.     function b() {
  9873.         if (i) {
  9874.             return
  9875.         }
  9876.         i = 1;
  9877.         var p = ge("layers");
  9878.         d = ce("div");
  9879.         d.className = "lightbox-overlay";
  9880.         m = ce("div");
  9881.         m.className = "lightbox-outer";
  9882.         n = ce("div");
  9883.         n.className = "lightbox-inner";
  9884.         d.style.display = m.style.display = "none";
  9885.         ae(p, d);
  9886.         ae(m, n);
  9887.         ae(p, m)
  9888.     }
  9889.  
  9890.     function g(p) {
  9891.         p = $E(p);
  9892.         switch (p.keyCode) {
  9893.             case 27:
  9894.                 e();
  9895.                 break
  9896.         }
  9897.     }
  9898.  
  9899.     function a(p) {
  9900.         if (p != 1234) {
  9901.             if (c.onResize) {
  9902.                 c.onResize()
  9903.             }
  9904.         }
  9905.         d.style.height = document.body.offsetHeight + "px";
  9906.         if (Browser.ie6) {
  9907.             j()
  9908.         }
  9909.     }
  9910.  
  9911.     function j() {
  9912.         var q = openDB_getScroll().y,
  9913.             p = openDB_getWindowSize().h;
  9914.         m.style.top = (q + p / 2) + "px"
  9915.     }
  9916.  
  9917.     function e() {
  9918.         l();
  9919.         if (c.onHide) {
  9920.             c.onHide()
  9921.         }
  9922.         d.style.display = m.style.display = "none";
  9923.         openDB_enableScroll(true)
  9924.     }
  9925.  
  9926.     function k() {
  9927.         d.style.display = m.style.display = h[f].style.display = ""
  9928.     }
  9929.     this.setSize = function(p, q) {
  9930.         n.style.visibility = "hidden";
  9931.         n.style.width = p + "px";
  9932.         n.style.height = q + "px";
  9933.         n.style.left = -parseInt(p / 2) + "px";
  9934.         n.style.top = -parseInt(q / 2) + "px";
  9935.         n.style.visibility = "visible"
  9936.     };
  9937.     this.show = function(t, s, p) {
  9938.         c = s || {};
  9939.         b();
  9940.         o();
  9941.         if (f != t && h[f] != null) {
  9942.             h[f].style.display = "none"
  9943.         }
  9944.         f = t;
  9945.         var r = 0,
  9946.             q;
  9947.         if (h[t] == null) {
  9948.             r = 1;
  9949.             q = ce("div");
  9950.             ae(n, q);
  9951.             h[t] = q
  9952.         } else {
  9953.             q = h[t]
  9954.         }
  9955.         if (c.onShow) {
  9956.             c.onShow(q, r, p)
  9957.         }
  9958.         a(1234);
  9959.         k();
  9960.         openDB_enableScroll(false)
  9961.     };
  9962.     this.reveal = function() {
  9963.         k()
  9964.     };
  9965.     this.hide = function() {
  9966.         e()
  9967.     };
  9968.     this.isVisible = function() {
  9969.         return (d && d.style.display != "none")
  9970.     }
  9971. };
  9972. var openDB_screenshots = {};
  9973. var ScreenshotViewer = new function() {
  9974.     var z, k, e, y, B, c, o, q = 0,
  9975.         u, b, n, i, w, x, t, h, v, j;
  9976.  
  9977.     function g(C) {
  9978.         var F = z[k];
  9979.         var D = Math.max(50, Math.min(618, openDB_getWindowSize().h - 72 - C));
  9980.         if (q != 1 || F.id || F.resize) {
  9981.             c = Math.min(772 / F.width, 618 / F.height);
  9982.             B = Math.min(772 / F.width, D / F.height)
  9983.         } else {
  9984.             c = B = 1
  9985.         }
  9986.         if (c > 1) {
  9987.             c = 1
  9988.         }
  9989.         if (B > 1) {
  9990.             B = 1
  9991.         }
  9992.         e = Math.round(B * F.width);
  9993.         y = Math.round(B * F.height);
  9994.         var E = Math.max(480, e);
  9995.         Lightbox.setSize(E + 20, y + 52 + C);
  9996.         if (Browser.ie6) {
  9997.             n.style.width = E + "px";
  9998.             if (z.length > 1) {
  9999.                 w.style.height = x.style.height = y + "px"
  10000.             } else {
  10001.                 t.style.height = y + "px"
  10002.             }
  10003.         }
  10004.         if (C) {
  10005.             i.firstChild.width = e;
  10006.             i.firstChild.height = y
  10007.         }
  10008.     }
  10009.  
  10010.     function d(E) {
  10011.         var D = z[E],
  10012.             C = "#screenshots:";
  10013.         if (q == 0) {
  10014.             C += "id=" + D.id
  10015.         } else {
  10016.             C += u + ":" + (E + 1)
  10017.         }
  10018.         return C
  10019.     }
  10020.  
  10021.     function s(F) {
  10022.         if (F && (B == c) && openDB_getWindowSize().h > b.offsetHeight) {
  10023.             return
  10024.         }
  10025.         b.style.visibility = "hidden";
  10026.         var C = z[k],
  10027.             I = (C.width > 772 || C.height > 618);
  10028.         g(0);
  10029.         var E = ("/upload/" + C.file);
  10030.         var J = '<img src="' + E + '" width="' + e + '" height="' + y + '"';
  10031.         if (Browser.ie6) {
  10032.             J += ' galleryimg="no"'
  10033.         }
  10034.         J += ">";
  10035.         i.innerHTML = J;
  10036.         if (!F) {
  10037.             h.href = "/upload/" + C.file
  10038.             if (!C.user && typeof openDB_pageInfo == "object") {
  10039.                 C.user = openDB_pageInfo.username
  10040.             }
  10041.             var L = (C.date && C.user),
  10042.                 K = (z.length > 1);
  10043.             if (L) {
  10044.                 var H = new Date(C.date),
  10045.                     N = (openDB_serverTime - H) / 1000;
  10046.                 var M = v.firstChild.childNodes[1];
  10047.                 M.href = "user=" + C.user;
  10048.                 M.innerHTML = C.user;
  10049.                 var P = v.firstChild.childNodes[3];
  10050.                 while (P.firstChild) {
  10051.                     de(P.firstChild)
  10052.                 }
  10053.                 v.firstChild.style.display = ""
  10054.             } else {
  10055.                 v.firstChild.style.display = "none"
  10056.             }
  10057.             var P = v.childNodes[1];
  10058.             if (K) {
  10059.                 var O = "";
  10060.                 if (L) {
  10061.                     O += LANG.dash
  10062.                 }
  10063.                 O += (k + 1) + LANG.lvpage_of + z.length;
  10064.                 P.innerHTML = O;
  10065.                 P.style.display = ""
  10066.             } else {
  10067.                 P.style.display = "none"
  10068.             }
  10069.             v.style.display = (L || K ? "" : "none");
  10070.             if (openDB_getLocale(true) != 0 && C.caption) {
  10071.                 C.caption = ""
  10072.             }
  10073.             var D = (C.caption != null && C.caption.length);
  10074.             var G = (C.subject != null && C.subject.length && C.type && C.typeId);
  10075.             if (D || G) {
  10076.                 var J = "";
  10077.                 if (G) {
  10078.                     J += LANG.types[C.type][0] + LANG.colon;
  10079.                     J += '<a href="' + openDB_types[C.type] + "=" + C.typeId + '">';
  10080.                     J += C.subject;
  10081.                     J += "</a>"
  10082.                 }
  10083.                 if (D) {
  10084.                     if (G) {
  10085.                         J += LANG.dash
  10086.                     }
  10087.                     J += C.caption
  10088.                 }
  10089.                 j.innerHTML = J;
  10090.                 j.style.display = ""
  10091.             } else {
  10092.                 j.style.display = "none"
  10093.             }
  10094.             if (z.length > 1) {
  10095.                 w.href = d(r(-1));
  10096.                 x.href = d(r(1));
  10097.                 w.style.display = x.style.display = "";
  10098.                 t.style.display = "none"
  10099.             } else {
  10100.                 w.style.display = x.style.display = "none";
  10101.                 t.style.display = ""
  10102.             }
  10103.             location.replace(d(k))
  10104.         }
  10105.         Lightbox.reveal();
  10106.         if (j.offsetHeight > 18) {
  10107.             g(j.offsetHeight - 18)
  10108.         }
  10109.         b.style.visibility = "visible"
  10110.     }
  10111.  
  10112.     function r(C) {
  10113.         var D = k;
  10114.         D += C;
  10115.         if (D < 0) {
  10116.             D = z.length - 1
  10117.         } else {
  10118.             if (D >= z.length) {
  10119.                 D = 0
  10120.             }
  10121.         }
  10122.         return D
  10123.     }
  10124.  
  10125.     function a() {
  10126.         k = r(-1);
  10127.         s();
  10128.         return false
  10129.     }
  10130.  
  10131.     function p() {
  10132.         k = r(1);
  10133.         s();
  10134.         return false
  10135.     }
  10136.  
  10137.     function m(C) {
  10138.         C = $E(C);
  10139.         switch (C.keyCode) {
  10140.             case 37:
  10141.                 a();
  10142.                 break;
  10143.             case 39:
  10144.                 p();
  10145.                 break
  10146.         }
  10147.     }
  10148.  
  10149.     function f() {
  10150.         s(1)
  10151.     }
  10152.  
  10153.     function l() {
  10154.         if (z.length > 1) {
  10155.             dE(document, "keyup", m)
  10156.         }
  10157.         if (o && q == 0) {
  10158.             if (o.indexOf(":id=") != -1) {
  10159.                 o = "#screenshots"
  10160.             }
  10161.             location.replace(o)
  10162.         } else {
  10163.             location.replace("#.")
  10164.         }
  10165.     }
  10166.  
  10167.     function A(C, G, D) {
  10168.         if (typeof D.screenshots == "string") {
  10169.             z = openDB_screenshots[D.screenshots];
  10170.             q = 1;
  10171.             u = D.screenshots
  10172.         } else {
  10173.             z = D.screenshots;
  10174.             q = 0;
  10175.             u = null
  10176.         }
  10177.         b = C;
  10178.         k = 0;
  10179.         if (D.pos && D.pos >= 0 && D.pos < z.length) {
  10180.             k = D.pos
  10181.         }
  10182.         if (G) {
  10183.             C.className = "screenshotviewer";
  10184.             n = ce("div");
  10185.             n.className = "screenshotviewer-screen";
  10186.             w = ce("a");
  10187.             x = ce("a");
  10188.             w.className = "screenshotviewer-prev";
  10189.             x.className = "screenshotviewer-next";
  10190.             w.href = "javascript:;";
  10191.             x.href = "javascript:;";
  10192.             var I = ce("span");
  10193.             ae(I, ce("b"));
  10194.             ae(w, I);
  10195.             var I = ce("span");
  10196.             ae(I, ce("b"));
  10197.             ae(x, I);
  10198.             w.onclick = a;
  10199.             x.onclick = p;
  10200.             t = ce("a");
  10201.             t.className = "screenshotviewer-cover";
  10202.             t.href = "javascript:;";
  10203.             t.onclick = Lightbox.hide;
  10204.             var I = ce("span");
  10205.             ae(I, ce("b"));
  10206.             ae(t, I);
  10207.             if (Browser.ie6) {
  10208.                 ns(w);
  10209.                 ns(x);
  10210.                 w.onmouseover = x.onmouseover = t.onmouseover = function() {
  10211.                     this.firstChild.style.display = "block"
  10212.                 };
  10213.                 w.onmouseout = x.onmouseout = t.onmouseout = function() {
  10214.                     this.firstChild.style.display = ""
  10215.                 }
  10216.             }
  10217.             ae(n, w);
  10218.             ae(n, x);
  10219.             ae(n, t);
  10220.             i = ce("div");
  10221.             ae(n, i);
  10222.             ae(C, n);
  10223.             var H = ce("a");
  10224.             H.className = "screenshotviewer-close";
  10225.             H.href = "javascript:;";
  10226.             H.onclick = Lightbox.hide;
  10227.             ae(H, ce("span"));
  10228.             ae(C, H);
  10229.             h = ce("a");
  10230.             h.className = "screenshotviewer-original";
  10231.             h.href = "javascript:;";
  10232.             h.target = "_blank";
  10233.             ae(h, ce("span"));
  10234.             ae(C, h);
  10235.             v = ce("div");
  10236.             v.className = "screenshotviewer-from";
  10237.             var E = ce("span");
  10238.             ae(E, ct(LANG.lvscreenshot_from));
  10239.             ae(E, ce("a"));
  10240.             ae(E, ct(" "));
  10241.             ae(E, ce("span"));
  10242.             ae(v, E);
  10243.             ae(v, ce("span"));
  10244.             ae(C, v);
  10245.             j = ce("div");
  10246.             j.className = "screenshotviewer-caption";
  10247.             ae(C, j);
  10248.             var F = ce("div");
  10249.             F.className = "clear";
  10250.             ae(C, F)
  10251.         }
  10252.         o = location.hash;
  10253.         if (z.length > 1) {
  10254.             aE(document, "keyup", m)
  10255.         }
  10256.         s()
  10257.     }
  10258.     this.checkPound = function() {
  10259.         if (location.hash && location.hash.indexOf("#screenshots") == 0) {
  10260.             if (!openDB_listviews.screenshots) {
  10261.                 var D = location.hash.split(":");
  10262.                 if (D.length == 3) {
  10263.                     var E = openDB_screenshots[D[1]],
  10264.                         C = parseInt(D[2]);
  10265.                     if (E && C >= 1 && C <= E.length) {
  10266.                         ScreenshotViewer.show({
  10267.                             screenshots: D[1],
  10268.                             pos: C - 1
  10269.                         })
  10270.                     }
  10271.                 }
  10272.             }
  10273.         }
  10274.     };
  10275.     this.show = function(C) {
  10276.         Lightbox.show("screenshotviewer", {
  10277.             onShow: A,
  10278.             onHide: l,
  10279.             onResize: f
  10280.         }, C)
  10281.     };
  10282.     DomContentLoaded.addEvent(this.checkPound)
  10283. };
  10284.  
  10285. function openBook(D) {
  10286.     if (!D.parent || !D.pages || D.pages.length == 0) {
  10287.         return
  10288.     }
  10289.     D.parent = $(D.parent);
  10290.     var E, A, B;
  10291.     this.nPages = D.pages.length;
  10292.     this.parent = $(D.parent);
  10293.     this.parent.className += " book";
  10294.     E = ce("div");
  10295.     E.className = "header";
  10296.     if (this.nPages == 1) {
  10297.         E.style.display = "none"
  10298.     }
  10299.     ns(E);
  10300.     B = ce("div");
  10301.     B.style.visibility = "hidden";
  10302.     B.className = "previous";
  10303.     A = ce("a");
  10304.     A.appendChild(ct(String.fromCharCode(8249) + LANG.book_previous));
  10305.     A.href = "javascript:;";
  10306.     A.onclick = this.previous.bind(this);
  10307.     B.appendChild(A);
  10308.     E.appendChild(B);
  10309.     B = ce("div");
  10310.     B.style.visibility = "hidden";
  10311.     B.className = "next";
  10312.     A = ce("a");
  10313.     A.appendChild(ct(LANG.book_next + String.fromCharCode(8250)));
  10314.     A.href = "javascript:;";
  10315.     A.onclick = this.next.bind(this);
  10316.     B.appendChild(A);
  10317.     E.appendChild(B);
  10318.     B = ce("b");
  10319.     B.appendChild(ct("1"));
  10320.     E.appendChild(B);
  10321.     E.appendChild(ct(LANG.book_of));
  10322.     B = ce("b");
  10323.     B.appendChild(ct(this.nPages));
  10324.     E.appendChild(B);
  10325.     D.parent.appendChild(E);
  10326.     for (var C = 0; C < this.nPages; ++C) {
  10327.         E = ce("div");
  10328.         E.className = "page";
  10329.         E.style.display = "none";
  10330.         E.innerHTML = D.pages[C];
  10331.         D.parent.appendChild(E)
  10332.     }
  10333.     this.page = 1;
  10334.     this.changePage(D.page || 1)
  10335. }
  10336. openBook.prototype = {
  10337.     changePage: function(B) {
  10338.         if (B < 1) {
  10339.             B = 1
  10340.         } else {
  10341.             if (B > this.nPages) {
  10342.                 B = this.nPages
  10343.             }
  10344.         }
  10345.         var A = this.parent.childNodes;
  10346.         A[this.page].style.display = "none";
  10347.         A[B].style.display = "";
  10348.         this.page = B;
  10349.         A = A[0].childNodes;
  10350.         A[0].style.visibility = (B == 1) ? "hidden" : "visible";
  10351.         A[1].style.visibility = (B == this.nPages) ? "hidden" : "visible";
  10352.         A[2].innerHTML = B
  10353.     },
  10354.     next: function() {
  10355.         this.changePage(this.page + 1)
  10356.     },
  10357.     previous: function() {
  10358.         this.changePage(this.page - 1)
  10359.     }
  10360. };
  10361. var Markup = {
  10362.     MODE_COMMENT: 1,
  10363.     MODE_ARTICLE: 2,
  10364.     MODE_QUICKFACTS: 3,
  10365.     MODE_SIGNATURE: 4,
  10366.     simpleTags: {
  10367.         img: 1,
  10368.         pad: 1,
  10369.         item: 1,
  10370.         spell: 1
  10371.     },
  10372.     _prepare: function(D, C) {
  10373.         Markup.tags = [];
  10374.         Markup.links = [];
  10375.         Markup.nTags = 0;
  10376.         Markup.nLinks = 0;
  10377.         D = D.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
  10378.         D = D.replace(/^(\s*)|\r|(\s*)$/g, "");
  10379.         D = D.replace(/\n(\s+)\n/g, "\n\n");
  10380.         var B = "b|i|u|s|small";
  10381.         var A = "b|i|u|s|small|url";
  10382.         switch (C) {
  10383.             case Markup.MODE_ARTICLE:
  10384.                 Markup.maps = [];
  10385.                 D = D.replace(/(.)?\[toggler\s*[\s+=:]\s*(.+?)\]/gi, function(F, E, H) {
  10386.                     if (E == "\\") {
  10387.                         return F.substr(1)
  10388.                     } else {
  10389.                         var G = Markup._yank(H, [
  10390.                             ["id", "[a-z0-9]+"]
  10391.                         ]);
  10392.                         Markup.tags.push({
  10393.                             name: "toggler",
  10394.                             close: false,
  10395.                             other: G
  10396.                         });
  10397.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10398.                     }
  10399.                 });
  10400.                 D = D.replace(/(.)?\[div\s*[\s+=:]\s*(.+?)\]/gi, function(F, E, H) {
  10401.                     if (E == "\\") {
  10402.                         return F.substr(1)
  10403.                     } else {
  10404.                         var G = Markup._yank(H, [
  10405.                             ["id", "[a-z0-9]+"],
  10406.                             ["hidden", ""]
  10407.                         ]);
  10408.                         Markup.tags.push({
  10409.                             name: "div",
  10410.                             close: false,
  10411.                             other: G
  10412.                         });
  10413.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10414.                     }
  10415.                 });
  10416.                 D = D.replace(/(.)?\[img\s*[\s+=:]\s*(.+?)\]/gi, function(F, E, H) {
  10417.                     if (E == "\\") {
  10418.                         return F.substr(1)
  10419.                     } else {
  10420.                         var G = Markup._yank(H, [
  10421.                             ["src", "\\S+"],
  10422.                             ["width", "[0-9]+"],
  10423.                             ["height", "[0-9]+"],
  10424.                             ["float", "left|right"]
  10425.                         ]);
  10426.                         Markup.tags.push({
  10427.                             name: "img",
  10428.                             close: false,
  10429.                             other: G
  10430.                         });
  10431.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10432.                     }
  10433.                 });
  10434.                 D = D.replace(/(.)?\[map\s*[\s+=:]\s*(.+?)\]/gi, function(F, E, H) {
  10435.                     if (E == "\\") {
  10436.                         return F.substr(1)
  10437.                     } else {
  10438.                         var G = Markup._yank(H, [
  10439.                             ["zone", "[0-9]+[a-z]?"],
  10440.                             ["source", "\\S+"]
  10441.                         ]);
  10442.                         Markup.tags.push({
  10443.                             name: "map",
  10444.                             close: false,
  10445.                             other: G
  10446.                         });
  10447.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10448.                     }
  10449.                 });
  10450.                 D = D.replace(/(.)?\[pin\s*[\s+=:]\s*(.+?)\]/gi, function(F, E, H) {
  10451.                     if (E == "\\") {
  10452.                         return F.substr(1)
  10453.                     } else {
  10454.                         var G = Markup._yank(H, [
  10455.                             ["x", "[0-9]{1,2}(\\.[0-9])?"],
  10456.                             ["y", "[0-9]{1,2}(\\.[0-9])?"],
  10457.                             ["url", "\\S+"],
  10458.                             ["type", "[0-9]+"]
  10459.                         ]);
  10460.                         Markup.tags.push({
  10461.                             name: "pin",
  10462.                             close: false,
  10463.                             other: G
  10464.                         });
  10465.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10466.                     }
  10467.                 });
  10468.                 B += "|h3|minibox";
  10469.                 A += "|h3|minibox|toggler|div|map|pin";
  10470.             case Markup.MODE_QUICKFACTS:
  10471.                 D = D.replace(/(.)?\[color\s*[\s+=:]\s*(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|q[0-8]?|#[a-f0-9]{6})\]/gi, function(F, E, G) {
  10472.                     if (E == "\\") {
  10473.                         return F.substr(1)
  10474.                     } else {
  10475.                         Markup.tags.push({
  10476.                             name: "color",
  10477.                             color: false,
  10478.                             other: (G).toLowerCase()
  10479.                         });
  10480.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10481.                     }
  10482.                 });
  10483.                 D = D.replace(/(.)?\[item\s*[\s+=:]\s*(\d+?)\]/gi, function(F, E, I, H) {
  10484.                     if (E == "\\") {
  10485.                         return F.substr(1)
  10486.                     } else {
  10487.                         var G = Markup.tags.push({
  10488.                             name: (I).toLowerCase(),
  10489.                             close: false,
  10490.                             other: H
  10491.                         });
  10492.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10493.                     }
  10494.                 });
  10495.                 B += "|pad";
  10496.                 A += "|color";
  10497.             case Markup.MODE_COMMENT:
  10498.                 D = D.replace(/(.)?\[quote(\s*[\s+=:]\s*([^\]]+?))?\]/gi, function(F, E, I, H) {
  10499.                     if (E == "\\") {
  10500.                         return F.substr(1)
  10501.                     } else {
  10502.                         var G = Markup.tags.push({
  10503.                             name: "quote",
  10504.                             close: false,
  10505.                             other: H
  10506.                         });
  10507.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10508.                     }
  10509.                 });
  10510.                 B += "|code|ul|ol|li";
  10511.                 A += "|code|quote|ul|ol|li";
  10512.             default:
  10513.                 D = D.replace(/(.)?\[url\s*[\s+=:]\s*([^\]]+?)\]/gi, function(F, E, G) {
  10514.                     if (E == "\\") {
  10515.                         return F.substr(1)
  10516.                     } else {
  10517.                         Markup.tags.push({
  10518.                             name: "url",
  10519.                             close: false,
  10520.                             other: G
  10521.                         });
  10522.                         return (E || "") + "<t" + (Markup.nTags++) + ">"
  10523.                     }
  10524.                 })
  10525.         }
  10526.         D = D.replace(new RegExp("(.)?\\[(" + B + ")\\]", "gi"), function(F, E, G) {
  10527.             if (E == "\\") {
  10528.                 return F.substr(1)
  10529.             } else {
  10530.                 Markup.tags.push({
  10531.                     name: (G).toLowerCase(),
  10532.                     close: false,
  10533.                     other: ""
  10534.                 });
  10535.                 return (E || "") + "<t" + (Markup.nTags++) + ">"
  10536.             }
  10537.         });
  10538.         D = D.replace(new RegExp("(.)?\\[/(" + A + ")\\]", "gi"), function(F, E, G) {
  10539.             if (E == "\\") {
  10540.                 return F.substr(1)
  10541.             } else {
  10542.                 Markup.tags.push({
  10543.                     name: (G).toLowerCase(),
  10544.                     close: true,
  10545.                     other: ""
  10546.                 });
  10547.                 return (E || "") + "<t" + (Markup.nTags++) + ">"
  10548.             }
  10549.         });
  10550.         D = D.replace(/(https?:\/\/|www\.)([\/_a-z0-9\%\?#@\-\+~&=;:'\(\)]|\.\S|,\S)+/gi, function(E) {
  10551.             Markup.links.push(E);
  10552.             return "<l" + (Markup.nLinks++) + ">"
  10553.         });
  10554.         return D
  10555.     },
  10556.     _parseCode: function(G, K, E) {
  10557.         var B = [],
  10558.             I = [],
  10559.             D = "",
  10560.             C;
  10561.         var F = G.length;
  10562.         while (E < F) {
  10563.             if (G.charAt(E) == "<" && G.charAt(E + 1) == "t") {
  10564.                 if (D.length) {
  10565.                     if (K == "ol" || K == "ul") {
  10566.                         if (trim(D).length) {
  10567.                             I.push(["<text>", D])
  10568.                         }
  10569.                     } else {
  10570.                         if (K != "map") {
  10571.                             B.push(["<text>", D])
  10572.                         }
  10573.                     }
  10574.                     D = ""
  10575.                 }
  10576.                 E += 2;
  10577.                 C = "";
  10578.                 while (G.charAt(E) != ">") {
  10579.                     C += G.charAt(E);
  10580.                     ++E
  10581.                 }++E;
  10582.                 var L = Markup.tags[parseInt(C)];
  10583.                 if (L.close) {
  10584.                     if (L.name == K) {
  10585.                         break
  10586.                     }
  10587.                 } else {
  10588.                     var H = Markup.simpleTags[L.name] != null;
  10589.                     var J = [];
  10590.                     if (!H) {
  10591.                         var A = Markup._parseCode(G, L.name, E);
  10592.                         J = A[0];
  10593.                         E = A[1]
  10594.                     }
  10595.                     if (J.length || H) {
  10596.                         if (L.name == "url" && !Markup._isUrlSafe(L.other)) {
  10597.                             L.name = "<node>"
  10598.                         }
  10599.                         if (K == "ol" || K == "ul") {
  10600.                             if (L.name == "li") {
  10601.                                 I = Markup._cleanNodes(I);
  10602.                                 if (I.length) {
  10603.                                     B.push(["li", I]);
  10604.                                     I = []
  10605.                                 }
  10606.                                 B.push(["li", J])
  10607.                             } else {
  10608.                                 I.push([L.name, J, L.other])
  10609.                             }
  10610.                         } else {
  10611.                             if (K == "map") {
  10612.                                 if (L.name == "pin") {
  10613.                                     B.push(["pin", J, L.other])
  10614.                                 }
  10615.                             } else {
  10616.                                 if (L.name == "li") {
  10617.                                     B.push(["<node>", J, L.other])
  10618.                                 } else {
  10619.                                     if (L.name != "pin") {
  10620.                                         B.push([L.name, J, L.other])
  10621.                                     }
  10622.                                 }
  10623.                             }
  10624.                         }
  10625.                     }
  10626.                 }
  10627.             } else {
  10628.                 D += G.charAt(E);
  10629.                 ++E
  10630.             }
  10631.         }
  10632.         if (D.length) {
  10633.             if (K == "ol" || K == "ul") {
  10634.                 if (trim(D).length) {
  10635.                     I.push(["<text>", D])
  10636.                 }
  10637.             } else {
  10638.                 if (K != "map") {
  10639.                     B.push(["<text>", D])
  10640.                 }
  10641.             }
  10642.         }
  10643.         I = Markup._cleanNodes(I);
  10644.         if (I.length) {
  10645.             B.push(["li", I]);
  10646.             I = []
  10647.         }
  10648.         return [B, E]
  10649.     },
  10650.     _cleanNodes: function(B) {
  10651.         var D = [];
  10652.         for (var C = 0, A = B.length; C < A; ++C) {
  10653.             if (B[C][0] == "<text>") {
  10654.                 if (C == 0) {
  10655.                     B[C][1] = B[C][1].replace(/^\n+/g, "")
  10656.                 }
  10657.                 if (C == B.length - 1) {
  10658.                     B[C][1] = B[C][1].replace(/\n+$/g, "")
  10659.                 }
  10660.                 if (B[C][1] != "") {
  10661.                     D.push(B[C])
  10662.                 }
  10663.             } else {
  10664.                 D.push(B[C])
  10665.             }
  10666.         }
  10667.         return D
  10668.     },
  10669.     _yank: function(D, C) {
  10670.         var E = {};
  10671.         D = " " + D + " ";
  10672.         for (var B = 0, A = C.length; B < A; ++B) {
  10673.             if (C[B][1] == "") {
  10674.                 D = D.replace(new RegExp("\\s" + C[B][0] + "\\s", "ig"), function(F) {
  10675.                     E[C[B][0]] = true;
  10676.                     return " "
  10677.                 })
  10678.             } else {
  10679.                 D = D.replace(new RegExp("\\s" + C[B][0] + "\\s*[\\s=:]\\s*(" + C[B][1] + ")\\s", "ig"), function(G, F) {
  10680.                     E[C[B][0]] = F;
  10681.                     return " "
  10682.                 })
  10683.             }
  10684.         }
  10685.         return E
  10686.     },
  10687.     _isUrlSafe: function(A) {
  10688.         if (!A) {
  10689.             return true
  10690.         }
  10691.         return !A.match(/^[a-z0-9]+?:/i) || A.match(/^https?:/i)
  10692.     },
  10693.     _htmlmize: function(B) {
  10694.         var G = "";
  10695.         for (var D = 0, A = B.length; D < A; ++D) {
  10696.             switch (B[D][0]) {
  10697.                 case "<text>":
  10698.                     G += B[D][1];
  10699.                     break;
  10700.                 case "<node>":
  10701.                     G += Markup._htmlmize(B[D][1]);
  10702.                     break;
  10703.                 case "minibox":
  10704.                     G += '<div class="minibox">' + Markup._htmlmize(B[D][1]) + "</div>";
  10705.                     break;
  10706.                 case "code":
  10707.                     G += '<pre class="code">' + Markup._htmlmize(B[D][1]) + "</pre>";
  10708.                     break;
  10709.                 case "quote":
  10710.                     G += '<div class="quote">';
  10711.                     if (B[D][2]) {
  10712.                         var H = trim(B[D][2]);
  10713.                         if (H.length > 0) {
  10714.                             G += "<small><b>";
  10715.                             if (H.match(/[^a-z0-9]/i) == null && H.length >= 4 && H.length <= 16) {
  10716.                                 G += '<a href="user=' + H + '">' + H + "</a>"
  10717.                             } else {
  10718.                                 G += H
  10719.                             }
  10720.                             G += "</b> " + LANG.markup_said + '</small><div class="pad"></div>'
  10721.                         }
  10722.                     }
  10723.                     G += Markup._htmlmize(B[D][1]) + "</div>";
  10724.                     break;
  10725.                 case "url":
  10726.                     G += '<a href="' + B[D][2] + '"';
  10727.                     if (B[D][2].indexOf("openwow.com") == -1 && B[D][2].substr(0, 5) == "http:") {
  10728.                         G += ' target="_blank"'
  10729.                     }
  10730.                     G += ">" + Markup._htmlmize(B[D][1]) + "</a>";
  10731.                     break;
  10732.                 case "li":
  10733.                     G += "<li><div>" + Markup._htmlmize(B[D][1]) + "</div></li>";
  10734.                     break;
  10735.                 case "u":
  10736.                     G += "<ins>" + Markup._htmlmize(B[D][1]) + "</ins>";
  10737.                     break;
  10738.                 case "s":
  10739.                     G += "<del>" + Markup._htmlmize(B[D][1]) + "</del>";
  10740.                     break;
  10741.                 case "pad":
  10742.                     G += '<div class="pad">' + Markup._htmlmize(B[D][1]) + "</div>";
  10743.                     break;
  10744.                 case "color":
  10745.                     G += "<span " + ((B[D][2].charAt(0) == "q") ? 'class="' : 'style="color: ') + B[D][2] + '">' + Markup._htmlmize(B[D][1]) + "</span>";
  10746.                     break;
  10747.                 case "toggler":
  10748.                     var F = B[D][2];
  10749.                     if (F.id != null) {
  10750.                         G += "<a href=\"javascript:;\" class=\"disclosure-" + (F.hidden ? "on" : "off") + " onmousedown=\"return false\" onclick=\"this.className=\"disclosure-" + (openDB_toggleDisplay(+"ge('ov4io23-" + F.id + "')") ? 'on' : 'off') + ">" + Markup._htmlmize(B[D][1]) + "</a>"
  10751.                     }
  10752.                     break;
  10753.                 case "div":
  10754.                     var F = B[D][2];
  10755.                     if (F.id != null) {
  10756.                         G += '<div id="ov4io23-' + F.id + '"';
  10757.                         if (F.hidden) {
  10758.                             G += ' style="display: none"'
  10759.                         }
  10760.                         G += ">" + Markup._htmlmize(B[D][1]) + "</div>"
  10761.                     }
  10762.                     break;
  10763.                 case "img":
  10764.                     var F = B[D][2];
  10765.                     if (F.src != "" && Markup._isUrlSafe(F.src)) {
  10766.                         G += '<img src="' + F.src + '" alt="" class="border"';
  10767.                         if (F.width) {
  10768.                             G += ' width="' + F.width + '"'
  10769.                         }
  10770.                         if (F.height) {
  10771.                             G += ' height="' + F.height + '"'
  10772.                         }
  10773.                         G += ' style="margin: 8px;';
  10774.                         if (F["float"]) {
  10775.                             G += " float: " + F["float"]
  10776.                         }
  10777.                         G += '" />'
  10778.                     }
  10779.                     break;
  10780.                 case "item":
  10781.                     G += '<a href="item=' + B[D][2] + '">(Item #' + B[D][2] + ")</a>";
  10782.                     break;
  10783.                 case "spell":
  10784.                     G += '<a href="spell=' + B[D][2] + '">(Spell #' + B[D][2] + ")</a>";
  10785.                     break;
  10786.                 case "map":
  10787.                     var F = B[D][2];
  10788.                     if (F.zone != null) {
  10789.                         var E = Markup._htmlmize(B[D][1]);
  10790.                         G += '<a href="javascript:;" onclick="Markup.mapperPreview(' + Markup.maps.length + ')">(Map: Zone #' + parseInt(F.zone) + ", " + E.length + " pin" + (E.length == 1 ? "" : "s") + ")</a>";
  10791.                         Markup.maps.push([F.zone, E])
  10792.                     }
  10793.                     break;
  10794.                 case "pin":
  10795.                     var F = B[D][2];
  10796.                     if (!Markup._isUrlSafe(F.url)) {
  10797.                         F.url = ""
  10798.                     }
  10799.                     if (G == "") {
  10800.                         G = []
  10801.                     }
  10802.                     var C = Markup._htmlmize(B[D][1]).replace(/\n/g, "<br />");
  10803.                     if (F.url && F.url.indexOf("npc=") != -1) {
  10804.                         C = '<b class="q">' + C + '</b><br/ ><span class="q2">Click to view this NPC</span>'
  10805.                     }
  10806.                     G.push([parseFloat(F.x || 0), parseFloat(F.y || 0), {
  10807.                         label: C,
  10808.                         url: F.url,
  10809.                         type: F.type
  10810.                     }]);
  10811.                     break;
  10812.                 default:
  10813.                     G += "<" + B[D][0] + ">" + Markup._htmlmize(B[D][1]) + "</" + B[D][0] + ">"
  10814.             }
  10815.         }
  10816.         return G
  10817.     },
  10818.     _tagless: function(B) {
  10819.         var E = "";
  10820.         for (var C = 0, A = B.length; C < A; ++C) {
  10821.             switch (B[C][0]) {
  10822.                 case "<text>":
  10823.                     E += B[C][1];
  10824.                     break;
  10825.                 case "img":
  10826.                     var D = B[C][2];
  10827.                     if (D.src != "" && Markup._isUrlSafe(D.src)) {
  10828.                         E += "(Image: " + D.src + ")"
  10829.                     }
  10830.                     break;
  10831.                 case "item":
  10832.                     E += "(Item #" + B[C][2] + ")";
  10833.                     break;
  10834.                 case "spell":
  10835.                     E += "(Spell #" + B[C][2] + ")";
  10836.                     break;
  10837.                 case "map":
  10838.                     E += "(Map)";
  10839.                     break;
  10840.                 case "pin":
  10841.                     break;
  10842.                 default:
  10843.                     E += Markup._tagless(B[C][1])
  10844.             }
  10845.         }
  10846.         return E
  10847.     },
  10848.     toHtml: function(D, C) {
  10849.         C = C || {};
  10850.         C.root = C.root || "";
  10851.         if (C.mode != null && C.mode != Markup.MODE_SIGNATURE) {
  10852.             D = D.replace(/\s*\[(ol|ul|h3)\]/ig, function(F, E) {
  10853.                 return "[" + E + "]"
  10854.             });
  10855.             D = D.replace(/\[\/(ol|ul|h3|minibox|code|quote)\]\s*/ig, function(F, E) {
  10856.                 return "[/" + E + "]"
  10857.             });
  10858.             D = D.replace(/\s*\[(pad)\]\s*/ig, function(F, E) {
  10859.                 return "[" + E + "]"
  10860.             })
  10861.         }
  10862.         D = Markup._prepare(D, C.mode);
  10863.         var A = Markup._parseCode(D, C.root, 0)[0];
  10864.         var B = Markup._htmlmize(A);
  10865.         B = B.replace(/<l([0-9]+)>/g, function(G, E) {
  10866.             var F = Markup.links[parseInt(E)];
  10867.             return '<a href="' + F.replace(/^www/, "http://www") + (F.indexOf("openwow.com") == -1 ? '" target="_blank">' : '">') + (F.length > 100 ? F.substr(0, 97) + "..." : F) + "</a>"
  10868.         });
  10869.         B = B.replace(/\n/g, "<br />");
  10870.         return B
  10871.     },
  10872.     removeTags: function(D, C) {
  10873.         C = C || {};
  10874.         C.root = C.root || "";
  10875.         if (C.mode != null && C.mode != Markup.MODE_SIGNATURE) {
  10876.             D = D.replace(/\s*\[(ol|ul|h3)\]\s?/ig, function(F, E) {
  10877.                 return " [" + E + "]"
  10878.             });
  10879.             D = D.replace(/\s?\[\/(ol|ul|h3|minibox|code|quote)\]\s*/ig, function(F, E) {
  10880.                 return "[/" + E + "]"
  10881.             });
  10882.             D = D.replace(/\s*\[(pad)\]\s*/ig, function(F, E) {
  10883.                 return "[" + E + "]"
  10884.             })
  10885.         }
  10886.         D = Markup._prepare(D, C.mode);
  10887.         var A = Markup._parseCode(D, C.root, 0)[0];
  10888.         var B = Markup._tagless(A);
  10889.         B = B.replace(/<l([0-9]+)>/g, function(G, E) {
  10890.             var F = Markup.links[parseInt(E)];
  10891.             return F
  10892.         });
  10893.         B = B.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"');
  10894.         return B
  10895.     },
  10896.     mapperPreview: function(C) {
  10897.         try {
  10898.             window.mapper = Markup.maps[C];
  10899.             var B = window.open("edit=mapperpreview", "mapperpreview", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=800,height=540");
  10900.             B.focus()
  10901.         } catch (A) {}
  10902.     }
  10903. };
Add Comment
Please, Sign In to add comment