source: aowow/templates/wowhead/js/global.js

Last change on this file was 172, checked in by maron, 16 years ago

čeština do aowow

  • Property svn:executable set to *
File size: 126.4 KB
Line 
1function $(C) {
2 if (arguments.length > 1) {
3 var D = [];
4 for (var B = 0, A = arguments.length; B < A; ++B) {
5 D.push($(arguments[B]))
6 }
7 return D
8 }
9 if (typeof C == "string") {
10 C = ge(C)
11 }
12 return C
13}
14function $E(A) {
15 if (!A) {
16 A = event
17 }
18 A._button = A.which ? A.which: A.button;
19 A._target = A.target ? A.target: A.srcElement;
20 return A
21}
22function $A(B) {
23 var D = [];
24 for (var C = 0, A = B.length; C < A; ++C) {
25 D.push(B[C])
26 }
27 return D
28}
29Function.prototype.bind = function() {
30 var A = this,
31 C = $A(arguments),
32 B = C.shift();
33 return function() {
34 return A.apply(B, C.concat($A(arguments)))
35 }
36};
37function strcmp(B, A) {
38 if (B == A) {
39 return 0
40 }
41 if (B == null) {
42 return - 1
43 }
44 if (A == null) {
45 return 1
46 }
47 return B < A ? -1: 1
48}
49function trim(A) {
50 return A.replace(/(^\s*|\s*$)/g, "")
51}
52function rtrim(B, C) {
53 var A = B.length;
54 while (--A > 0 && B.charAt(A) == C) {}
55 B = B.substring(0, A + 1);
56 if (B == C) {
57 B = ""
58 }
59 return B
60}
61function sprintf(C) {
62 for (var B = 1, A = arguments.length; B < A; ++B) {
63 C = C.replace("$" + B, arguments[B])
64 }
65 return C
66}
67function str_replace(C, B, A) {
68 while (C.indexOf(B) != -1) {
69 C = C.replace(B, A)
70 }
71 return C
72}
73function urlencode(A) {
74 A = encodeURIComponent(A);
75 A = str_replace(A, "+", "%2B");
76 return A
77}
78function number_format(A) {
79 A = "" + parseInt(A);
80 if (A.length <= 3) {
81 return A
82 }
83 return number_format(A.substr(0, A.length - 3)) + "," + A.substr(A.length - 3)
84}
85function in_array(B, E, F, D) {
86 if (B == null) {
87 return - 1
88 }
89 if (F) {
90 return in_arrayf(B, E, F, D)
91 }
92 for (var C = D || 0, A = B.length; C < A; ++C) {
93 if (B[C] == E) {
94 return C
95 }
96 }
97 return - 1
98}
99function in_arrayf(B, E, F, D) {
100 for (var C = D || 0, A = B.length; C < A; ++C) {
101 if (F(B[C]) == E) {
102 return C
103 }
104 }
105 return - 1
106}
107function array_walk(C, F, B) {
108 var E;
109 for (var D = 0, A = C.length; D < A; ++D) {
110 E = F(C[D], B, C, D);
111 if (E != null) {
112 C[D] = E
113 }
114 }
115}
116function array_apply(C, F, B) {
117 var E;
118 for (var D = 0, A = C.length; D < A; ++D) {
119 F(C[D], B, C, D)
120 }
121}
122function ge(A) {
123 return document.getElementById(A)
124}
125function gE(A, B) {
126 return A.getElementsByTagName(B)
127}
128function ce(C, B) {
129 var A = document.createElement(C);
130 if (B) {
131 cOr(A, B)
132 }
133 return A
134}
135function de(A) {
136 A.parentNode.removeChild(A)
137}
138function ae(A, B) {
139 return A.appendChild(B)
140}
141function ct(A) {
142 return document.createTextNode(A)
143}
144function rf() {
145 return false
146}
147function rf2(A) {
148 A = $E(A);
149 if (A.ctrlKey || A.shiftKey || A.altKey || A.metaKey) {
150 return
151 }
152 return false
153}
154function tb() {
155 this.blur()
156}
157function ac(C) {
158 var B = 0,
159 A = 0;
160 while (C) {
161 B += C.offsetLeft;
162 A += C.offsetTop;
163 C = C.offsetParent
164 }
165 return [B, A]
166}
167function aE(B, C, A) {
168 if (Browser.ie) {
169 B.attachEvent("on" + C, A)
170 } else {
171 B.addEventListener(C, A, false)
172 }
173}
174function dE(B, C, A) {
175 if (Browser.ie) {
176 B.detachEvent("on" + C, A)
177 } else {
178 B.removeEventListener(C, A, false)
179 }
180}
181function sp(A) {
182 if (!A) {
183 A = event
184 }
185 if (Browser.ie) {
186 A.cancelBubble = true
187 } else {
188 A.stopPropagation()
189 }
190}
191function sc(F, G, B, D, E) {
192 var C = new Date();
193 var A = F + "=" + escape(B) + "; ";
194 C.setDate(C.getDate() + G);
195 A += "expires=" + C.toUTCString() + "; ";
196 if (D) {
197 A += "path=" + D + "; "
198 }
199 if (E) {
200 A += "domain=" + E + "; "
201 }
202 document.cookie = A
203}
204function dc(A) {
205 sc(A, -1)
206}
207function gc(D) {
208 var A,
209 E;
210 if (!D) {
211 var B = [];
212 E = document.cookie.split("; ");
213 for (var C = 0; C < E.length; ++C) {
214 A = E[C].split("=");
215 B[A[0]] = unescape(A[1])
216 }
217 return B
218 } else {
219 A = document.cookie.indexOf(D + "=");
220 if (A != -1) {
221 if (A == 0 || document.cookie.substring(A - 2, A) == "; ") {
222 A += D.length + 1;
223 E = document.cookie.indexOf("; ", A);
224 if (E == -1) {
225 E = document.cookie.length
226 }
227 return unescape(document.cookie.substring(A, E))
228 }
229 }
230 }
231 return null
232}
233function ns(A) {
234 A.onmousedown = A.onselectstart = A.ondragstart = rf;
235 if (Browser.ie) {
236 A.onfocus = tb
237 }
238}
239function cO(C, A) {
240 for (var B in A) {
241 C[B] = A[B]
242 }
243}
244function cOr(C, A) {
245 for (var B in A) {
246 if (typeof A[B] == "object") {
247 if (!C[B]) {
248 C[B] = {}
249 }
250 cOr(C[B], A[B])
251 } else {
252 C[B] = A[B]
253 }
254 }
255}
256var Browser = {
257 ie: !!(window.attachEvent && !window.opera),
258 opera: !!window.opera,
259 safari: navigator.userAgent.indexOf("Safari") != -1,
260 gecko: navigator.userAgent.indexOf("Gecko") != -1 && navigator.userAgent.indexOf("KHTML") == -1
261};
262Browser.ie7 = Browser.ie && navigator.userAgent.indexOf("MSIE 7.0") != -1;
263Browser.ie6 = Browser.ie && navigator.userAgent.indexOf("MSIE 6.0") != -1 && !Browser.ie7;
264navigator.userAgent.match(/Gecko\/([0-9]+)/);
265Browser.geckoVersion = parseInt(RegExp.$1) | 0;
266var OS = {
267 windows: navigator.appVersion.indexOf("Windows") != -1,
268 mac: navigator.appVersion.indexOf("Macintosh") != -1,
269 linux: navigator.appVersion.indexOf("Linux") != -1
270};
271function g_getWindowSize() {
272 var B = 0,
273 A = 0;
274 if (typeof window.innerWidth == "number") {
275 B = window.innerWidth;
276 A = window.innerHeight
277 } else {
278 if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
279 B = document.documentElement.clientWidth;
280 A = document.documentElement.clientHeight
281 } else {
282 if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
283 B = document.body.clientWidth;
284 A = document.body.clientHeight
285 }
286 }
287 }
288 return {
289 w: B,
290 h: A
291 }
292}
293function g_getScroll() {
294 var A = 0,
295 B = 0;
296 if (typeof(window.pageYOffset) == "number") {
297 A = window.pageXOffset;
298 B = window.pageYOffset
299 } else {
300 if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
301 A = document.body.scrollLeft;
302 B = document.body.scrollTop
303 } else {
304 if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
305 A = document.documentElement.scrollLeft;
306 B = document.documentElement.scrollTop
307 }
308 }
309 }
310 return {
311 x: A,
312 y: B
313 }
314}
315function g_getCursorPos(C) {
316 var B,
317 D;
318 if (window.innerHeight) {
319 B = C.pageX;
320 D = C.pageY
321 } else {
322 var A = g_getScroll();
323 B = C.clientX + A.x;
324 D = C.clientY + A.y
325 }
326 return {
327 x: B,
328 y: D
329 }
330}
331function g_scrollTo(C, B) {
332 var M,
333 K = g_getWindowSize(),
334 L = g_getScroll(),
335 I = K.w,
336 E = K.h,
337 G = L.x,
338 D = L.y;
339 C = $(C);
340 if (B == null) {
341 B = []
342 } else {
343 if (typeof B == "number") {
344 B = [B]
345 }
346 }
347 M = B.length;
348 if (M == 0) {
349 B[0] = B[1] = B[2] = B[3] = 0
350 } else {
351 if (M == 1) {
352 B[1] = B[2] = B[3] = B[0]
353 } else {
354 if (M == 2) {
355 B[2] = B[0];
356 B[3] = B[1]
357 } else {
358 if (M == 3) {
359 B[3] = B[1]
360 }
361 }
362 }
363 }
364 M = ac(C);
365 var A = M[0] - B[3];
366 var H = M[1] - B[0];
367 var J = M[0] + C.offsetWidth + B[1];
368 var F = M[1] + C.offsetHeight + B[2];
369 if (J - A > I || A < G) {
370 G = A
371 } else {
372 if (J - I > G) {
373 G = J - I
374 }
375 }
376 if (F - H > E || H < D) {
377 D = H
378 } else {
379 if (F - E > D) {
380 D = F - E
381 }
382 }
383 scrollTo(G, D)
384}
385function g_setTextNodes(C, B) {
386 if (C.nodeType == 3) {
387 C.nodeValue = B
388 } else {
389 for (var A = 0; A < C.childNodes.length; ++A) {
390 g_setTextNodes(C.childNodes[A], B)
391 }
392 }
393}
394function g_getTextContent(C) {
395 var A = "";
396 for (var B = 0; B < C.childNodes.length; ++B) {
397 if (C.childNodes[B].nodeValue) {
398 A += C.childNodes[B].nodeValue
399 } else {
400 if (C.childNodes[B].nodeName == "BR") {
401 if (Browser.ie) {
402 A += "\r"
403 } else {
404 A += "\n"
405 }
406 }
407 }
408 A += g_getTextContent(C.childNodes[B])
409 }
410 return A
411}
412function g_setSelectedLink(C, B) {
413 if (!g_setSelectedLink.groups) {
414 g_setSelectedLink.groups = {}
415 }
416 var A = g_setSelectedLink.groups;
417 if (A[B]) {
418 A[B].className = ""
419 }
420 C.className = "selected";
421 A[B] = C
422}
423function g_toggleDisplay(A) {
424 if (A.style.display == "none") {
425 A.style.display = "";
426 return true
427 } else {
428 A.style.display = "none";
429 return false
430 }
431}
432function g_initHeader(B) {
433 var H = ce("dl");
434 g_expandSite()
435 for (var G = 0, J = mn_path.length; G < J; ++G) {
436 var E = ce("dt");
437 var L = ce("a");
438 var I = ce("ins");
439 var F = ce("big");
440 var D = ce("span");
441 if (mn_path[G][0] != B) {
442 L.menu = mn_path[G][3];
443 L.onmouseover = Menu.show;
444 L.onmouseout = Menu.hide
445 }
446 if (mn_path[G][2]) {
447 L.href = mn_path[G][2]
448 } else {
449 L.href = "javascript:;";
450 ns(L);
451 L.style.cursor = "default"
452 }
453 if (B != null && mn_path[G][0] == B) {
454 L.className = "selected"
455 }
456 ae(F, ct(mn_path[G][1].charAt(0)));
457 ae(I, F);
458 ae(I, ct(mn_path[G][1].substr(1)));
459 ae(L, I);
460 ae(L, D);
461 ae(E, L);
462 ae(H, E)
463 }
464 ae(ge("toptabs-right-generic"), H);
465 var A = ge("menu-buttons-generic");
466 if (B != null && B >= 0 && B < mn_path.length) {
467 switch (B) {
468 case 0:
469 Menu.addButtons(A, Menu.explode(mn_database));
470 break;
471 case 1:
472 Menu.addButtons(A, mn_tools);
473 break;
474 case 2:
475 Menu.addButtons(A, Menu.explode(mn_more));
476 break;
477 case 3:
478 Menu.addButtons(A, Menu.explode(mn_forums));
479 break
480 }
481 } else {
482 ae(A, ct(String.fromCharCode(160)))
483 }
484 g_initLanguageChanger();
485 var M = ge("live-search-generic");
486 var K = M.previousSibling;
487 var C = M.parentNode;
488 ns(K);
489 K.onclick = function() {
490 this.parentNode.onsubmit()
491 };
492 if (M.value == "") {
493 M.className = "search-database"
494 }
495 M.onmousemove = function() {
496 if (trim(this.value) != "") {
497 M.className = ""
498 }
499 };
500 M.onfocus = function() {
501 M.className = ""
502 };
503 M.onblur = function() {
504 if (trim(this.value) == "") {
505 M.className = "search-database"
506 }
507 };
508 C.onsubmit = function() {
509 var N = this.elements[0].value;
510 if (trim(N) == "") {
511 return false
512 }
513 this.submit()
514 }
515}
516
517function g_initLanguageChanger() {
518 var A = ge("language-changer");
519 if (!A) {
520 return
521 }
522 A.menu = [[0, "English", (g_locale.id != 3 ? "?locale=0" : null)], [0, "Čeština", (g_locale.id != 8 ? "?locale=8" : null)]];
523 A.menu.rightAligned = 1;
524 if (g_locale.id != 25) {
525 A.menu[{
526 0: 0,
527 8: 1
528 } [g_locale.id]].checked = 1
529 }
530 A.onmouseover = Menu.show;
531 A.onmouseout = Menu.hide
532}
533function g_initPath(K, D) {
534 var G = mn_path,
535 H = null,
536 C = null,
537 L = 0,
538 I = ge("main-precontents"),
539 A = ce("div");
540 A.className = "path";
541 if (D != null) {
542 var J = ce("div");
543 J.className = "path-right";
544 var M = ce("a");
545 M.href = "javascript:;";
546 M.id = "fi_toggle";
547 ns(M);
548 M.onclick = fi_Toggle;
549 if (D) {
550 M.className = "disclosure-on";
551 ae(M, ct(LANG.fihide))
552 } else {
553 M.className = "disclosure-off";
554 ae(M, ct(LANG.fishow))
555 }
556 ae(J, M);
557 ae(I, J)
558 }
559 for (var F = 0; F < K.length; ++F) {
560 var M,
561 B,
562 N = 0;
563 for (var E = 0; E < G.length; ++E) {
564 if (G[E][0] == K[F]) {
565 N = 1;
566 G = G[E];
567 G.checked = 1;
568 break
569 }
570 }
571 if (!N) {
572 L = 1;
573 break
574 }
575 M = ce("a");
576 B = ce("span");
577 if (G[2]) {
578 M.href = G[2]
579 } else {
580 M.href = "javascript:;";
581 ns(M);
582 M.style.textDecoration = "none";
583 M.style.color = "white";
584 M.style.cursor = "default"
585 }
586 if (F < K.length - 1 && G[3]) {
587 B.className = "menuarrow"
588 }
589 ae(M, ct(G[4] == null ? G[1] : G[4]));
590 if (F == 0) {
591 M.menu = mn_path
592 } else {
593 M.menu = H[3]
594 }
595 M.onmouseover = Menu.show;
596 M.onmouseout = Menu.hide;
597 ae(B, M);
598 ae(A, B);
599 C = B;
600 H = G;
601 G = G[3];
602 if (!G) {
603 L = 1;
604 break
605 }
606 }
607 if (L && C) {
608 C.className = ""
609 }
610 var J = ce("div");
611 J.className = "clear";
612 ae(A, J);
613 ae(I, A);
614 g_initPath.lastIt = H
615}
616function g_formatTimeElapsed(D) {
617 function G(L, K, J) {
618 if (J && LANG.timeunitsab[K] == "") {
619 J = 0
620 }
621 if (J) {
622 return L + " " + LANG.timeunitsab[K]
623 } else {
624 return L + " " + (L == 1 ? LANG.timeunitssg[K] : LANG.timeunitspl[K])
625 }
626 }
627 var E = [31557600, 2629800, 604800, 86400, 3600, 60, 1];
628 var H = [1, 3, 3, -1, 5, -1, -1];
629 D = Math.max(D, 1);
630 for (var C = 3, F = E.length; C < F; ++C) {
631 if (D >= E[C]) {
632 var B = C;
633 var I = Math.floor(D / E[B]);
634 if (H[B] != -1) {
635 var A = H[B];
636 D %= E[B];
637 v2 = Math.floor(D / E[A]);
638 if (v2 > 0) {
639 return G(I, B, 1) + " " + G(v2, A, 1)
640 }
641 }
642 return G(I, B, 0)
643 }
644 }
645 return "(n/a)"
646}
647function g_formatDateSimple(E, A) {
648 function C(J) {
649 return (J < 10 ? "0" + J: J)
650 }
651 var H = "",
652 G = E.getDate(),
653 D = E.getMonth() + 1,
654 F = E.getFullYear();
655 H += sprintf(LANG.date_simple, C(G), C(D), F);
656 if (A == 1) {
657 var I = E.getHours() + 1,
658 B = E.getMinutes() + 1;
659 H += LANG.date_at + C(I) + ":" + C(B)
660 }
661 return H
662}
663function g_createGlow(A, G) {
664 var D = ce("span");
665 for (var C = -1; C <= 1; ++C) {
666 for (var B = -1; B <= 1; ++B) {
667 var F = ce("div");
668 F.style.position = "absolute";
669 F.style.whiteSpace = "nowrap";
670 F.style.left = C + "px";
671 F.style.top = B + "px";
672 if (C == 0 && B == 0) {
673 F.style.zIndex = 4
674 } else {
675 F.style.color = "black";
676 F.style.zIndex = 2
677 }
678 ae(F, ct(A));
679 ae(D, F)
680 }
681 }
682 D.style.position = "relative";
683 D.className = "glow" + (G != null ? " " + G: "");
684 var E = ce("span");
685 E.style.visibility = "hidden";
686 ae(E, ct(A));
687 ae(D, E);
688 return D
689}
690function g_appendReputation(G, F, D, E) {
691 G = $(G);
692 var B = ce("a");
693 B.href = "javascript:;";
694 B.className = "reputation";
695 var H = ce("div");
696 H.className = "reputation-text";
697 var A = ce("del");
698 ae(A, ct(g_reputation_standings[F]));
699 ae(H, A);
700 var C = ce("ins");
701 ae(C, ct(E));
702 ae(H, C);
703 ae(B, H);
704 H = ce("div");
705 H.className = "reputation-bar" + F;
706 if (D <= 0 || D > 100) {
707 H.style.visibility = "hidden"
708 }
709 H.style.width = D + "%";
710 ae(H, ct(String.fromCharCode(160)));
711 ae(B, H);
712 ae(G, B)
713}
714function g_convertRatingToPercent(E, A, D) {
715 var C = {
716 12: 1.5,
717 13: 12,
718 14: 15,
719 15: 5,
720 16: 10,
721 17: 10,
722 18: 8,
723 19: 14,
724 20: 14,
725 21: 14,
726 22: 0,
727 23: 0,
728 24: 0,
729 25: 0,
730 26: 0,
731 27: 0,
732 28: 10,
733 29: 10,
734 30: 10,
735 31: 10,
736 32: 14,
737 33: 0,
738 34: 0,
739 35: 25,
740 36: 10,
741 37: 2.5
742 };
743 if (E < 10) {
744 E = 10
745 } else {
746 if (E > 70) {
747 E = 70
748 }
749 }
750 if (D < 0) {
751 D = 0
752 }
753 var B;
754 if (C[A] == null) {
755 B = 0
756 } else {
757 f = C[A];
758 if (E >= 1 && E <= 59) {
759 B = D / f / ((1 / 52) * E - (8 / 52))
760 } else {
761 if (E >= 60 && E <= 70) {
762 B = D / f * (( - 3 / 82) * E + (131 / 41))
763 } else {
764 B = 0
765 }
766 }
767 }
768 return B
769}
770function g_setRatingLevel(F, E, A, C) {
771 var D = prompt(LANG.prompt_ratinglevel, E);
772 if (D != null) {
773 D |= 0;
774 if (D != E && D >= 1 && D <= 70) {
775 E = D;
776 var B = g_convertRatingToPercent(E, A, C);
777 B = (Math.round(B * 100) / 100);
778 if (A != 12 && A != 37) {
779 B += "%"
780 }
781 F.innerHTML = sprintf(LANG.tooltip_combatrating, B, E);
782 F.onclick = g_setRatingLevel.bind(0, F, E, A, C)
783 }
784 }
785}
786function g_getMoneyHtml(C) {
787 var B = 0,
788 A = "";
789 if (C >= 10000) {
790 B = 1;
791 A += '<span class="moneygold">' + Math.floor(C / 10000) + "</span>";
792 C %= 10000
793 }
794 if (C >= 100) {
795 if (B) {
796 A += " "
797 } else {
798 B = 1
799 }
800 A += '<span class="moneysilver">' + Math.floor(C / 100) + "</span>";
801 C %= 100
802 }
803 if (C >= 1) {
804 if (B) {
805 A += " "
806 } else {
807 B = 1
808 }
809 A += '<span class="moneycopper">' + C + "</span>"
810 }
811 return A
812}
813function g_getPatchVersion(E) {
814 var D = g_getPatchVersion;
815 var B = 0,
816 C = D.T.length - 2,
817 A;
818 while (C > B) {
819 A = Math.floor((C + B) / 2);
820 if (E >= D.T[A] && E < D.T[A + 1]) {
821 return D.V[A]
822 }
823 if (E >= D.T[A]) {
824 B = A + 1
825 } else {
826 C = A - 1
827 }
828 }
829 A = Math.ceil((C + B) / 2);
830 return D.V[A]
831}
832g_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", "???"];
833g_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, 9999999999999];
834function g_expandSite() {
835 de(ge("sidebar"));
836 de(ge("header-ad"));
837 ge("wrapper").className = "noads";
838 var A = ge("contribute-ad");
839 if (A) {
840 de(A)
841 }
842}
843function g_insertTag(E, H, A, J) {
844 var C = $(E);
845 C.focus();
846 if (C.selectionStart != null) {
847 var K = C.selectionStart,
848 G = C.selectionEnd,
849 I = C.scrollLeft,
850 D = C.scrollTop;
851 var B = C.value.substring(K, G);
852 if (typeof J == "function") {
853 B = J(B)
854 }
855 C.value = C.value.substr(0, K) + H + B + A + C.value.substr(G);
856 C.selectionStart = C.selectionEnd = G + H.length;
857 C.scrollLeft = I;
858 C.scrollTop = D
859 } else {
860 if (document.selection && document.selection.createRange) {
861 var F = document.selection.createRange();
862 if (F.parentElement() != C) {
863 return
864 }
865 var B = F.text;
866 if (typeof J == "function") {
867 B = J(B)
868 }
869 F.text = H + B + A
870 }
871 }
872 if (C.onkeyup) {
873 C.onkeyup()
874 }
875}
876function g_getLocaleFromDomain(B) {
877 var A = g_getLocaleFromDomain.L;
878 return (A[B] ? A[B] : 0)
879}
880g_getLocaleFromDomain.L = {
881 fr: 2,
882 de: 3,
883 es: 6,
884 wotlk: 25
885};
886function g_getIdFromTypeName(A) {
887 var B = g_getIdFromTypeName.L;
888 return (B[A] ? B[A] : -1)
889}
890g_getIdFromTypeName.L = {
891 npc: 1,
892 object: 2,
893 item: 3,
894 itemset: 4,
895 quest: 5,
896 spell: 6,
897 zone: 7,
898 faction: 8
899};
900function g_getIngameLink(A, C, B) {
901 prompt(LANG.prompt_ingamelink, '/script DEFAULT_CHAT_FRAME:AddMessage("' + sprintf(LANG.message_ingamelink, "\\124c" + A + "\\124H" + C + "\\124h[" + B + ']\\124h\\124r");'))
902}
903function g_isEmailValid(A) {
904 return A.match(/^[A-Z0-9._-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i) != null
905}
906function g_userDescription() {
907 var C = ge("description");
908 var D = (typeof g_pageInfo == "object" && g_user.name == g_pageInfo.username);
909 var B = (C.childNodes.length == 0);
910 if (B) {
911 if (D) {
912 ae(C, ct(LANG.user_nodescription2))
913 } else {
914 ae(C, ct(LANG.user_nodescription))
915 }
916 }
917 if (D) {
918 var A = ce("button"),
919 E = ce("div");
920 E.className = "pad";
921 A.onclick = function() {
922 location.href = "?account#public-description"
923 };
924 if (B) {
925 ae(A, ct(LANG.user_composeone))
926 } else {
927 ae(A, ct(LANG.user_editdescription))
928 }
929 ae(C, E);
930 ae(C, A)
931 }
932}
933function co_addYourComment() {
934 tabsContribute.focus(0);
935 var A = gE(document.forms.addcomment, "textarea")[0];
936 A.focus()
937}
938function co_cancelReply() {
939 ge("replybox-generic").style.display = "none";
940 document.forms.addcomment.elements.replyto.value = ""
941}
942function co_validateForm(B) {
943 var A = gE(B, "textarea")[0];
944 if (Listview.funcBox.coValidate(A)) {
945 if (g_user.permissions & 1) {
946 return true
947 }
948 }
949 return false
950}
951function ss_submitAScreenshot() {
952 tabsContribute.focus(1)
953}
954function ss_validateForm(A) {
955 if (!A.elements.screenshotfile.value.length) {
956 alert(LANG.message_noscreenshot);
957 return false
958 }
959 return true
960}
961function ss_appendSticky() {
962 var J = ge("infobox-sticky");
963 var F = g_pageInfo.type;
964 var A = g_pageInfo.typeId;
965}
966function Ajax(B, C) {
967 if (!B) {
968 return
969 }
970 var A;
971 try {
972 A = new XMLHttpRequest()
973 } catch(D) {
974 try {
975 A = new ActiveXObject("Msxml2.XMLHTTP")
976 } catch(D) {
977 try {
978 A = new ActiveXObject("Microsoft.XMLHTTP")
979 } catch(D) {
980 if (window.createRequest) {
981 A = window.createRequest()
982 } else {
983 alert(LANG.message_ajaxnotsupported);
984 return
985 }
986 }
987 }
988 }
989 this.request = A;
990 cO(this, C);
991 this.method = this.method || (this.params && "POST") || "GET";
992 A.open(this.method, B, this.async == null ? true: this.async);
993 A.onreadystatechange = Ajax.onReadyStateChange.bind(this);
994 if (this.method.toUpperCase() == "POST") {
995 A.setRequestHeader("Content-Type", (this.contentType || "application/x-www-form-urlencoded") + "; charset=" + (this.encoding || "UTF-8"))
996 }
997 A.send(this.params)
998}
999Ajax.onReadyStateChange = function() {
1000 if (this.request.readyState == 4) {
1001 if (this.request.status == 0 || (this.request.status >= 200 && this.request.status < 300)) {
1002 this.onSuccess != null && this.onSuccess(this.request, this)
1003 } else {
1004 this.onFailure != null && this.onFailure(this.request, this)
1005 }
1006 if (this.onComplete != null) {
1007 this.onComplete(this.request, this)
1008 }
1009 }
1010};
1011function g_ajaxIshRequest(A) {
1012 var B = document.getElementsByTagName("head")[0];
1013 ae(B, ce("script", {
1014 type: "text/javascript",
1015 src: A
1016 }))
1017}
1018var Menu = {
1019 iframes: [],
1020 divs: [],
1021 selection: [],
1022 show: function() {
1023 try {
1024 clearTimeout(Menu.timer);
1025 if (Menu.currentLink) {
1026 Menu._show(this)
1027 } else {
1028 this.className = "open";
1029 Menu.timer = setTimeout(Menu._show.bind(0, this), 100)
1030 }
1031 } catch(A) {}
1032 },
1033 _show: function(B) {
1034 if (Menu.currentLink != B) {
1035 var A = ac(B);
1036 Menu._hide();
1037 Menu.selection = [ - 1];
1038 Menu.currentLink = B;
1039 Menu.showDepth(0, B.menu, A[0], A[1] + B.offsetHeight + 1, B.offsetHeight + 8, B.offsetWidth, A[1]);
1040 B.className = "open"
1041 } else {
1042 Menu.truncate(0);
1043 Menu.clean(0)
1044 }
1045 },
1046 showAtCursor: function(A) {
1047 A = $E(A);
1048 clearTimeout(Menu.timer);
1049 Menu._hide();
1050 Menu.selection = [ - 1];
1051 Menu.currentLink = null;
1052 var B = g_getCursorPos(A);
1053 Menu.showDepth(0, this.menu, B.x, B.y, 0, 0, 0)
1054 },
1055 hide: function() {
1056 try {
1057 clearTimeout(Menu.timer);
1058 if (Menu.currentLink) {
1059 Menu.timer = setTimeout(Menu._hide, 333)
1060 } else {
1061 this.className = ""
1062 }
1063 } catch(A) {}
1064 },
1065 _hide: function() {
1066 for (var B = 0, A = Menu.selection.length; B < A; ++B) {
1067 Menu.divs[B].style.display = "none";
1068 Menu.divs[B].style.visibility = "hidden";
1069 if (Browser.ie6) {
1070 Menu.iframes[B].style.display = "none"
1071 }
1072 }
1073 Menu.selection = [];
1074 if (Menu.currentLink) {
1075 Menu.currentLink.className = ""
1076 }
1077 Menu.currentLink = null
1078 },
1079 sepOver: function() {
1080 var B = this.d;
1081 var A = B.i;
1082 Menu.truncate(A);
1083 Menu.clean(A);
1084 Menu.selection[A] = -1
1085 },
1086 elemOver: function() {
1087 var E = this.d;
1088 var D = E.i;
1089 var C = this.i;
1090 var A = this.k;
1091 var B = this.firstChild.className == "menusub";
1092 Menu.truncate(D + B);
1093 if (B && C != Menu.selection[D]) {
1094 var F = ac(this);
1095 Menu.selection[D + 1] = -1;
1096 Menu.showDepth(D + 1, E.menuArray[C][3], F[0], F[1] - 2, this.offsetHeight, this.offsetWidth - 3, 0)
1097 }
1098 Menu.clean(D);
1099 Menu.selection[D] = A;
1100 if (this.className.length) {
1101 this.className += " open"
1102 } else {
1103 this.className = "open"
1104 }
1105 },
1106 getIframe: function(A) {
1107 var B;
1108 if (Menu.iframes[A] == null) {
1109 B = ce("iframe");
1110 B.src = "javascript:0;";
1111 B.frameBorder = 0;
1112 ae(ge("layers"), B);
1113 Menu.iframes[A] = B
1114 } else {
1115 B = Menu.iframes[A]
1116 }
1117 return B
1118 },
1119 getDiv: function(B, A) {
1120 var C;
1121 if (Menu.divs[B] == null) {
1122 C = ce("div");
1123 C.className = "menu";
1124 ae(ge("layers"), C);
1125 Menu.divs[B] = C
1126 } else {
1127 C = Menu.divs[B]
1128 }
1129 C.i = B;
1130 C.menuArray = A;
1131 return C
1132 },
1133 showDepth: function(Z, V, M, L, g, N, D) {
1134 var r,
1135 n = Menu.getDiv(Z, V);
1136 while (n.firstChild) {
1137 de(n.firstChild)
1138 }
1139 var l = ce("table"),
1140 A = ce("tbody"),
1141 E = ce("tr"),
1142 I = ce("td"),
1143 Q = ce("div"),
1144 G = ce("div");
1145 var S = 999;
1146 var P = g_getWindowSize(),
1147 C = g_getScroll(),
1148 J = P.w,
1149 T = P.h,
1150 B = C.x,
1151 o = C.y;
1152 if (g > 0) {
1153 if ((25 + 1) * V.length > T - 25 - D) {
1154 for (var X = 2; X < 4; ++X) {
1155 if (g / X * V.length + 30 < T - D) {
1156 break
1157 }
1158 }
1159 S = Math.floor(V.length / X)
1160 }
1161 }
1162 var H = 0;
1163 var U = 0;
1164 for (var X = 0, e = V.length; X < e; ++X) {
1165 if (V[X][0] == null) {
1166 var Y = ce("span");
1167 Y.className = "separator";
1168 ns(Y);
1169 ae(Y, ct(V[X][1]));
1170 Y.d = n;
1171 Y.onmouseover = Menu.sepOver;
1172 ae(G, Y)
1173 } else {
1174 var q = ce("a");
1175 q.d = n;
1176 q.k = U++;
1177 q.i = X;
1178 if (V[X][2]) {
1179 if (Menu.currentLink && Menu.currentLink.menuappend) {
1180 if (V[X][2].indexOf(Menu.currentLink.menuappend) == -1) {
1181 q.href = V[X][2] + Menu.currentLink.menuappend
1182 } else {
1183 q.href = V[X][2]
1184 }
1185 } else {
1186 if (typeof V[X][2] == "function") {
1187 q.href = "javascript:;";
1188 q.onclick = V[X][2];
1189 ns(q)
1190 } else {
1191 q.href = V[X][2]
1192 }
1193 }
1194 } else {
1195 q.href = "javascript:;";
1196 q.style.cursor = "default";
1197 ns(q)
1198 }
1199 q.onmouseover = Menu.elemOver;
1200 var O = ce("span"),
1201 F = ce("span");
1202 if (V[X][3] != null) {
1203 O.className = "menusub"
1204 }
1205 if (V[X][5] != null) {
1206 F.className = "icontiny";
1207 F.style.backgroundImage = "url(images/icons/tiny/"+V[X][5]+".gif)";
1208 if (V[X].checked) {
1209 var K = ce("span");
1210 K.className = "menucheck";
1211 ae(K, ct(V[X][1]));
1212 ae(F, K);
1213 }
1214 else
1215 {
1216 ae(F, ct(V[X][1]));
1217 }
1218 }
1219 else
1220 {
1221 if (V[X].checked) {
1222 F.className = "menucheck"
1223 }
1224 ae(F, ct(V[X][1]));
1225 }
1226 ae(O, F);
1227 ae(q, O);
1228 ae(G, q)
1229 }
1230 if (H++==S) {
1231 Q.onmouseover = Menu.divOver;
1232 Q.onmouseout = Menu.divOut;
1233 ae(Q, G);
1234 if (!Browser.ie6) {
1235 var R = ce("p");
1236 ae(R, ce("em"));
1237 ae(R, ce("var"));
1238 ae(R, ce("strong"));
1239 ae(R, Q);
1240 ae(I, R)
1241 } else {
1242 ae(I, Q)
1243 }
1244 ae(E, I);
1245 I = ce("td");
1246 R = ce("p");
1247 Q = ce("div");
1248 G = ce("div");
1249 H = 0
1250 }
1251 }
1252 Q.onmouseover = Menu.divOver;
1253 Q.onmouseout = Menu.divOut;
1254 ae(Q, G);
1255 if (!Browser.ie6) {
1256 if (S != 999) {
1257 var R = ce("p");
1258 ae(R, ce("em"));
1259 ae(R, ce("var"));
1260 ae(R, ce("strong"));
1261 ae(R, Q);
1262 ae(I, R)
1263 } else {
1264 ae(n, ce("em"));
1265 ae(n, ce("var"));
1266 ae(n, ce("strong"));
1267 ae(I, Q)
1268 }
1269 } else {
1270 ae(I, Q)
1271 }
1272 ae(E, I);
1273 ae(A, E);
1274 ae(l, A);
1275 ae(n, l);
1276 n.style.left = n.style.top = "-2323px";
1277 n.style.display = "";
1278 var K = l.offsetWidth,
1279 W = l.offsetHeight;
1280 if (V.rightAligned) {
1281 M = M + N - K
1282 } else {
1283 if (M + N + K + 15 > J) {
1284 M = Math.max(0, M - K - 3)
1285 } else {
1286 if (Z > 0) {
1287 M += N
1288 }
1289 }
1290 }
1291 if (L + W > T + o) {
1292 L = Math.max(o + 5, T + o - W - 10)
1293 }
1294 n.style.left = M + "px";
1295 n.style.top = L + "px";
1296 if (Browser.ie6) {
1297 r = Menu.getIframe(Z);
1298 r.style.left = M + "px";
1299 r.style.top = L + "px";
1300 r.style.width = K + "px";
1301 r.style.height = W + "px";
1302 r.style.display = "";
1303 r.style.visibility = "visible"
1304 }
1305 n.style.visibility = "visible";
1306 if (Browser.opera) {
1307 n.style.display = "none";
1308 n.style.display = ""
1309 }
1310 },
1311 divOver: function() {
1312 clearTimeout(Menu.timer)
1313 },
1314 divOut: function() {
1315 clearTimeout(Menu.timer);
1316 Menu.timer = setTimeout(Menu._hide, 333)
1317 },
1318 truncate: function(A) {
1319 var B;
1320 while (Menu.selection.length - 1 > A) {
1321 B = Menu.selection.length - 1;
1322 Menu.divs[B].style.display = "none";
1323 Menu.divs[B].style.visibility = "hidden";
1324 if (Browser.ie6) {
1325 Menu.iframes[B].style.display = "none"
1326 }
1327 Menu.selection.pop()
1328 }
1329 },
1330 clean: function(A) {
1331 for (var B = A; B < Menu.selection.length; ++B) {
1332 if (Menu.selection[B] != -1) {
1333 d = gE(Menu.divs[B], "a")[Menu.selection[B]];
1334 if (d.className.indexOf("sub") != -1) {
1335 d.className = "sub"
1336 } else {
1337 d.className = ""
1338 }
1339 Menu.selection[B] = -1
1340 }
1341 }
1342 },
1343 append: function(A, B) {
1344 A[2] += B;
1345 if (A[3] != null) {
1346 Menu._append(A[3], B)
1347 }
1348 },
1349 _append: function(A, C) {
1350 var D,
1351 E = 0;
1352 for (var B = 0; B < A.length; ++B) {
1353 if (A[B][2].indexOf("sl=") != -1) {
1354 C = C.replace(/sl=([0-9]:?)+/, "");
1355 E = 1
1356 } else {
1357 if (A[B][2].indexOf("cl=") != -1) {
1358 C = C.replace(/cl=[0-9]+/, "");
1359 E = 1
1360 }
1361 }
1362 if (E) {
1363 C = C.replace("&filter=", ";");
1364 C = rtrim(C, ";");
1365 C = C.replace(";;", ";")
1366 }
1367 A[B][2] += C;
1368 if (A[B][3]) {
1369 Menu._append(A[B][3], C)
1370 }
1371 }
1372 },
1373 fixUrls: function(E, B, D) {
1374 for (var C = 0, A = E.length; C < A; ++C) {
1375 if (E[C][2] == null) {
1376 E[C][2] = B + E[C][0]
1377 }
1378 if (E[C][3]) {
1379 if (D) {
1380 Menu.fixUrls(E[C][3], B, D)
1381 } else {
1382 Menu.fixUrls(E[C][3], B + E[C][0] + ".", D)
1383 }
1384 }
1385 }
1386 },
1387 addButtons: function(F, E) {
1388 for (var C = 0, A = E.length; C < A; ++C) {
1389 if (E[C][0] == null) {
1390 continue
1391 }
1392 var B = ce("a"),
1393 D = ce("span");
1394 if (E[C][2]) {
1395 B.href = E[C][2]
1396 } else {
1397 B.href = "javascript:;";
1398 B.style.cursor = "default";
1399 B.style.textDecoration = "none";
1400 ns(B)
1401 }
1402 if (E[C][3] != null) {
1403 D.className = "menuarrowd";
1404 B.menu = E[C][3];
1405 B.onmouseover = Menu.show;
1406 B.onmouseout = Menu.hide
1407 }
1408 ae(D, ct(E[C][1]));
1409 ae(B, D);
1410 ae(F, B)
1411 }
1412 },
1413 explode: function(F) {
1414 var B = [],
1415 E = null,
1416 D;
1417 for (var C = 0, A = F.length; C < A; ++C) {
1418 if (F[C][0] != null) {
1419 if (E != null) {
1420 D.push(F[C])
1421 } else {
1422 B.push(F[C])
1423 }
1424 }
1425 if (E != null && (F[C][0] == null || C == A - 1)) {
1426 B.push([0, E[1], , D])
1427 }
1428 if (F[C][0] == null) {
1429 E = F[C];
1430 D = []
1431 }
1432 }
1433 return B
1434 }
1435};
1436function Tabs(A) {
1437 cO(this, A);
1438 if (this.parent) {
1439 this.parent = $(this.parent)
1440 } else {
1441 return
1442 }
1443 this.oldMode = (Browser.geckoVersion > 20000000 && Browser.geckoVersion <= 20060414);
1444 this.selectedTab = -1;
1445 this.uls = [];
1446 this.tabs = [];
1447 this.nShows = 0;
1448 if (this.poundable == null) {
1449 this.poundable = 1
1450 }
1451 this.poundedTab = null;
1452 if (this.onLoad == null) {
1453 this.onLoad = Tabs.onLoad.bind(this)
1454 }
1455 if (this.onShow == null) {
1456 this.onShow = Tabs.onShow.bind(this)
1457 }
1458 if (this.onHide) {
1459 this.onHide = this.onHide.bind(this)
1460 }
1461}
1462Tabs.prototype = {
1463 add: function(A, D) {
1464 var C,
1465 B = this.tabs.length;
1466 C = {
1467 caption: A,
1468 index: B,
1469 owner: this
1470 };
1471 cO(C, D);
1472 this.tabs.push(C);
1473 return B
1474 },
1475 focus: function(A) {
1476 if (A < 0) {
1477 A = this.tabs.length + A
1478 }
1479 this.forceScroll = 1;
1480 gE(this.uls[this.oldMode ? 0: 2], "a")[A].onclick({},
1481 true);
1482 this.forceScroll = null
1483 },
1484 show: function(C, E) {
1485 var B;
1486 if (isNaN(C) || C < 0) {
1487 C = 0
1488 } else {
1489 if (C >= this.tabs.length) {
1490 C = this.tabs.length - 1
1491 }
1492 }
1493 if (E == null && C == this.selectedTab) {
1494 return
1495 }
1496 if (this.selectedTab != -1) {
1497 B = this.tabs[this.selectedTab];
1498 if (this.onHide && !this.onHide(B)) {
1499 return
1500 }
1501 if (B.onHide && !B.onHide()) {
1502 return
1503 }
1504 }++this.nShows;
1505 var A = this.oldMode ? 0: 3;
1506 for (var D = 0; D <= A; ++D) {
1507 B = gE(this.uls[D], "a");
1508 if (this.selectedTab != -1) {
1509 B[this.selectedTab].className = ""
1510 }
1511 B[C].className = "selected"
1512 }
1513 B = this.tabs[C];
1514 if (B.onLoad) {
1515 B.onLoad();
1516 B.onLoad = null
1517 }
1518 this.onShow(this.tabs[C], this.tabs[this.selectedTab]);
1519 if (B.onShow) {
1520 B.onShow(this.tabs[this.selectedTab])
1521 }
1522 this.selectedTab = C
1523 },
1524 flush: function(J) {
1525 if (this.oldMode) {
1526 var H,
1527 M,
1528 C,
1529 K;
1530 H = ce("ul");
1531 H.className = "old-tabs";
1532 for (var G = 0; G < this.tabs.length; ++G) {
1533 var D = this.tabs[G];
1534 M = ce("li");
1535 C = ce("div");
1536 K = ce("a");
1537 if (this.poundable) {
1538 K.href = "#" + D.id
1539 } else {
1540 K.href = "javascript:;"
1541 }
1542 ns(K);
1543 K.onclick = Tabs.onClick.bind(D, K);
1544 ae(K, ct(D.caption));
1545 ae(M, C);
1546 ae(M, K);
1547 ae(H, M)
1548 }
1549 this.uls[0] = H;
1550 ae(this.parent, H)
1551 } else {
1552 var L,
1553 E,
1554 K,
1555 I,
1556 A;
1557 var B = ce("div");
1558 B.className = "tabs-container";
1559 I = ce("div");
1560 I.style.visibility = "hidden";
1561 this.uls[0] = ce("ul");
1562 this.uls[0].className = "tabs";
1563 ae(I, this.uls[0]);
1564 ae(B, I);
1565 I = ce("div");
1566 I.className = "tabs-levels";
1567 for (var G = 1; G <= 3; ++G) {
1568 A = ce("div");
1569 A.className = "tabs-level";
1570 this.uls[G] = ce("ul");
1571 this.uls[G].className = "tabs";
1572 this.uls[G].style.top = ( - 30 * (3 - G)) + "px";
1573 ae(A, this.uls[G]);
1574 ae(I, A)
1575 }
1576 ae(B, I);
1577 for (var G = 0; G < this.tabs.length; ++G) {
1578 var D = this.tabs[G];
1579 for (var F = 0; F <= 3; ++F) {
1580 E = ce("li");
1581 K = ce("a");
1582 b = ce("b");
1583 if (this.poundable) {
1584 K.href = "#" + D.id
1585 } else {
1586 K.href = "javascript:;"
1587 }
1588 if (F > 0) {
1589 ns(K);
1590 K.onclick = Tabs.onClick.bind(D, K)
1591 }
1592 if (!Browser.ie6) {
1593 I = ce("div");
1594 ae(I, ct(D.caption));
1595 ae(K, I)
1596 }
1597 ae(b, ct(D.caption));
1598 ae(K, b);
1599 ae(E, K);
1600 ae(this.uls[F], E)
1601 }
1602 }
1603 ae(this.parent, B)
1604 }
1605 if (this.onLoad) {
1606 L = this.onLoad();
1607 if (L != null) {
1608 this.poundedTab = J = L
1609 }
1610 }
1611 this.show(J)
1612 },
1613 setTabName: function(C, B) {
1614 var A = this.oldMode ? 0: 3;
1615 for (var D = 0; D <= A; ++D) {
1616 _ = gE(this.uls[D], "a");
1617 g_setTextNodes(_[C], B)
1618 }
1619 },
1620 setTabPound: function(C, A) {
1621 if (!this.poundable) {
1622 return
1623 }
1624 var B = this.oldMode ? 0: 3;
1625 for (var D = 0; D <= B; ++D) {
1626 _ = gE(this.uls[D], "a");
1627 _[C].href = "#" + this.tabs[C].id + ":" + A
1628 }
1629 }
1630};
1631Tabs.onClick = function(A, E, D) {
1632 if (D == null && this.index == this.owner.selectedTab) {
1633 return
1634 }
1635 var C = rf2(E);
1636 if (C == null) {
1637 return
1638 }
1639 this.owner.show(this.index, D);
1640 if (this.owner.poundable) {
1641 var B = A.href.indexOf("#");
1642 B != -1 && location.replace(A.href.substr(B))
1643 }
1644 return C
1645};
1646Tabs.onLoad = function() {
1647 if (!this.poundable || !location.hash.length) {
1648 return
1649 }
1650 var A = location.hash.substr(1).split(":")[0];
1651 if (A) {
1652 return in_array(this.tabs, A,
1653 function(B) {
1654 return B.id
1655 })
1656 }
1657};
1658Tabs.onShow = function(E, D) {
1659 var B;
1660 if (D) {
1661 ge("tab-" + D.id).style.display = "none"
1662 }
1663 B = ge("tab-" + E.id);
1664 B.style.display = "";
1665 if ((this.nShows == 1 && this.poundedTab != null && this.poundedTab >= 0) || this.forceScroll) {
1666 var C,
1667 A;
1668 if (this.__st) {
1669 C = this.__st;
1670 A = 15
1671 } else {
1672 C = B;
1673 A = this.parent.offsetHeight + 15
1674 }
1675 if (Browser.ie) {
1676 setTimeout(g_scrollTo.bind(this, C, A), 1)
1677 } else {
1678 g_scrollTo(C, A)
1679 }
1680 }
1681};
1682var Icon = {
1683 sizes: ["small", "medium", "large"],
1684 create: function(A, J, I, D, B, H) {
1685 var G;
1686 var E = ce("div"),
1687 C = ce("div");
1688 E.className = "icon" + Icon.sizes[J];
1689 if (A != null) {
1690 E.style.backgroundImage = "url(images/icons/" + Icon.sizes[J] + "/" + A.toLowerCase() + ".jpg)"
1691 }
1692 C.className = "tile";
1693 if (I || D) {
1694 var F = ce("a");
1695 if (I && I.length) {
1696 F.tooltip = I;
1697 F.onmouseover = Icon.over;
1698 F.onmouseout = Icon.out
1699 }
1700 if (D) {
1701 F.href = D
1702 } else {
1703 F.href = "javascript:;";
1704 ns(F)
1705 }
1706 ae(C, F)
1707 } else {
1708 if (J == 2) {
1709 E.ondblclick = function() {
1710 prompt("", A)
1711 }
1712 }
1713 }
1714 if (B != null && (B > 1 || B.length)) {
1715 G = g_createGlow(B, "q1");
1716 G.style.right = "0";
1717 G.style.bottom = "0";
1718 G.style.position = "absolute";
1719 ae(C, G)
1720 }
1721 if (H != null && H > 0) {
1722 G = g_createGlow("(" + H + ")", "q");
1723 G.style.left = "0";
1724 G.style.top = "0";
1725 G.style.position = "absolute";
1726 ae(C, G)
1727 }
1728 ae(E, C);
1729 return E
1730 },
1731 over: function() {
1732 if (this.tooltip != null) {
1733 Tooltip.show(this, this.tooltip, 0, 0)
1734 }
1735 },
1736 out: function() {
1737 Tooltip.hide()
1738 }
1739};
1740var Tooltip = {
1741 clip: "main-contents",
1742 create: function(G) {
1743 var E = ce("div"),
1744 J = ce("table"),
1745 C = ce("tbody"),
1746 D = ce("tr"),
1747 B = ce("tr"),
1748 A = ce("td"),
1749 I = ce("th"),
1750 H = ce("th"),
1751 F = ce("th");
1752 E.className = "tooltip";
1753 I.style.backgroundPosition = "top right";
1754 H.style.backgroundPosition = "bottom left";
1755 F.style.backgroundPosition = "bottom right";
1756 if (G) {
1757 A.innerHTML = G
1758 }
1759 ae(D, A);
1760 ae(D, I);
1761 ae(C, D);
1762 ae(B, H);
1763 ae(B, F);
1764 ae(C, B);
1765 ae(J, C);
1766 Tooltip.icon = ce("p");
1767 Tooltip.icon.style.visibility = "hidden";
1768 ae(Tooltip.icon, ce("div"));
1769 ae(E, Tooltip.icon);
1770 ae(E, J);
1771 return E
1772 },
1773 fix: function(D, B, E) {
1774 var C = gE(D, "table")[0],
1775 G = gE(C, "td")[0],
1776 F = G.childNodes;
1777 if (F.length >= 2 && F[0].nodeName == "TABLE" && F[1].nodeName == "TABLE") {
1778 var A;
1779 if (F[1].offsetWidth > 300) {
1780 A = Math.max(300, F[0].offsetWidth) + 20
1781 } else {
1782 A = Math.max(F[0].offsetWidth, F[1].offsetWidth) + 20
1783 }
1784 if (A > 20) {
1785 D.style.width = A + "px";
1786 F[0].style.width = F[1].style.width = "100%";
1787 if (!B && D.offsetHeight > document.body.clientHeight) {
1788 C.className = "shrink"
1789 }
1790 }
1791 }
1792 if (E) {
1793 D.style.visibility = "visible"
1794 }
1795 },
1796 fixSafe: function(C, B, A) {
1797 if (Browser.ie) {
1798 setTimeout(Tooltip.fix.bind(this, C, B, A), 1)
1799 } else {
1800 Tooltip.fix(C, B, A)
1801 }
1802 },
1803 append: function(B, A) {
1804 var B = $(B);
1805 var C = Tooltip.create(A);
1806 ae(B, C);
1807 Tooltip.fixSafe(C, 1, 1)
1808 },
1809 prepare: function() {
1810 if (!Tooltip.tooltip) {
1811 var B = Tooltip.create();
1812 B.style.position = "absolute";
1813 B.style.left = B.style.top = "-2323px";
1814 var A = ge("layers");
1815 ae(A, B);
1816 Tooltip.tooltip = B;
1817 Tooltip.tooltipTable = gE(B, "table")[0];
1818 Tooltip.tooltipTd = gE(B, "td")[0];
1819 if (Browser.ie6) {
1820 B = ce("iframe");
1821 B.src = "javascript:1;";
1822 B.frameBorder = 0;
1823 ae(A, B);
1824 Tooltip.iframe = B
1825 }
1826 }
1827 },
1828 move: function(O, M, P, K, B, A, U, H, N, T) {
1829 if (!Tooltip.tooltipTable) {
1830 return
1831 }
1832 var W,
1833 G = O,
1834 R = M,
1835 J = O,
1836 I = M,
1837 F = 0,
1838 E = 0,
1839 Q = g_getWindowSize(),
1840 D = g_getScroll(),
1841 L = Q.w,
1842 S = Q.h,
1843 C = D.x,
1844 V = D.y;
1845 if (U == null) {
1846 U = Tooltip.clip
1847 }
1848 if (H == null) {
1849 H = Tooltip.tooltip;
1850 N = Tooltip.tooltipTable.offsetWidth;
1851 T = Tooltip.tooltipTable.offsetHeight
1852 }
1853 H.style.width = N + "px";
1854 if (U) {
1855 W = ge(U);
1856 if (W) {
1857 c = ac(W);
1858 F = c[0];
1859 E = c[1];
1860 if (W.offsetWidth + F <= C + L) {
1861 L = W.offsetWidth + F - C
1862 }
1863 if (W.offsetHeight + E <= V + S) {
1864 S = W.offsetHeight + E - V
1865 }
1866 }
1867 }
1868 if (G + P + N > L) {
1869 G = Math.max(G - N, F) - B
1870 } else {
1871 G += P + B
1872 }
1873 if (G < F) {
1874 G = F
1875 } else {
1876 if (G + N > C + L) {
1877 G = C + L - N
1878 }
1879 }
1880 if (R - T > Math.max(V, E)) {
1881 R -= T + A
1882 } else {
1883 R += K + A
1884 }
1885 if (R < E) {
1886 R = E
1887 } else {
1888 if (R + T > V + S) {
1889 R = Math.max(V, V + S - T)
1890 }
1891 }
1892 if (Tooltip.iconVisible) {
1893 if (J >= G - 48 && J <= G && I >= R - 4 && I <= R + 48) {
1894 R -= 48 - (I - R)
1895 }
1896 }
1897 H.style.left = G + "px";
1898 H.style.top = R + "px";
1899 H.style.visibility = "visible";
1900 if (Browser.ie6 && Tooltip.iframe) {
1901 W = Tooltip.iframe;
1902 W.style.left = G + "px";
1903 W.style.top = R + "px";
1904 W.style.width = N + "px";
1905 W.style.height = T + "px";
1906 W.style.display = "";
1907 W.style.visibility = "visible"
1908 }
1909 },
1910 show: function(G, E, A, F, C) {
1911 if (Tooltip.disabled) {
1912 return
1913 }
1914 var B;
1915 Tooltip.prepare();
1916 if (C) {
1917 E = '<span class="' + C + '">' + E + "</span>"
1918 }
1919 B = Tooltip.tooltip;
1920 B.style.width = "550px";
1921 B.style.left = "-2323px";
1922 B.style.top = "-2323px";
1923 Tooltip.tooltipTd.innerHTML = E;
1924 B.style.display = "";
1925 var D = ac(G);
1926 Tooltip.fix(B, 0, 0);
1927 Tooltip.move(D[0], D[1], G.offsetWidth, G.offsetHeight, A, F)
1928 },
1929 showAtCursor: function(B, E, A, G, D) {
1930 if (Tooltip.disabled) {
1931 return
1932 }
1933 if (!A || A < 10) {
1934 A = 10
1935 }
1936 if (!G || G < 10) {
1937 G = 10
1938 }
1939 B = $E(B);
1940 Tooltip.prepare();
1941 if (D) {
1942 E = '<span class="' + D + '">' + E + "</span>"
1943 }
1944 var C;
1945 C = Tooltip.tooltip;
1946 C.style.width = "550px";
1947 C.style.left = "-2323px";
1948 C.style.top = "-2323px";
1949 Tooltip.tooltipTd.innerHTML = E;
1950 C.style.display = "";
1951 var F = g_getCursorPos(B);
1952 Tooltip.fix(C, 0, 0);
1953 Tooltip.move(F.x, F.y, 0, 0, A, G)
1954 },
1955 showAtXY: function(E, A, F, D, C) {
1956 if (Tooltip.disabled) {
1957 return
1958 }
1959 Tooltip.prepare();
1960 var B;
1961 B = Tooltip.tooltip;
1962 B.style.width = "550px";
1963 B.style.left = "-2323px";
1964 B.style.top = "-2323px";
1965 Tooltip.tooltipTd.innerHTML = E;
1966 B.style.display = "";
1967 Tooltip.fix(B, 0, 0);
1968 Tooltip.move(A, F, 0, 0, D, C, null, null, null, null)
1969 },
1970 cursorUpdate: function(B, A, D) {
1971 if (Tooltip.disabled || !Tooltip.tooltip) {
1972 return
1973 }
1974 B = $E(B);
1975 if (!A || A < 10) {
1976 A = 10
1977 }
1978 if (!D || D < 10) {
1979 D = 10
1980 }
1981 var C = g_getCursorPos(B);
1982 Tooltip.move(C.x, C.y, 0, 0, A, D)
1983 },
1984 hide: function() {
1985 if (Tooltip.tooltip) {
1986 Tooltip.tooltip.style.display = "none";
1987 Tooltip.tooltip.visibility = "hidden";
1988 Tooltip.tooltipTable.className = "";
1989 if (Browser.ie6) {
1990 Tooltip.iframe.style.display = "none"
1991 }
1992 Tooltip.setIcon(null)
1993 }
1994 },
1995 setIcon: function(A) {
1996 Tooltip.prepare();
1997 if (A) {
1998 Tooltip.icon.style.backgroundImage = "url(images/icons/medium/" + A.toLowerCase() + ".jpg)";
1999 Tooltip.icon.style.visibility = "visible"
2000 } else {
2001 Tooltip.icon.style.backgroundImage = "none";
2002 Tooltip.icon.style.visibility = "hidden"
2003 }
2004 Tooltip.iconVisible = A ? 1: 0
2005 }
2006};
2007var g_listviews = {};
2008function Listview(A) {
2009 cO(this, A);
2010 if (this.id) {
2011 var K = (this.tabs ? "tab-": "lv-") + this.id;
2012 if (this.parent) {
2013 var H = ce("div");
2014 H.id = K;
2015 ae($(this.parent), H);
2016 this.container = H
2017 } else {
2018 this.container = ge(K)
2019 }
2020 } else {
2021 return
2022 }
2023 if (this.template) {
2024 this.template = Listview.templates[this.template]
2025 } else {
2026 return
2027 }
2028 g_listviews[this.id] = this;
2029 if (this.poundable == null) {
2030 if (this.template.poundable != null) {
2031 this.poundable = this.template.poundable
2032 } else {
2033 this.poundable = 1
2034 }
2035 }
2036 if (this.hideBands == null) {
2037 this.hideBands = this.template.hideBands
2038 }
2039 if (this.computeDataFunc == null && this.template.computeDataFunc != null) {
2040 this.computeDataFunc = this.template.computeDataFunc
2041 }
2042 if (this.createCbControls == null && this.template.createCbControls != null) {
2043 this.createCbControls = this.template.createCbControls
2044 }
2045 if (this.onBeforeCreate == null && this.template.onBeforeCreate != null) {
2046 this.onBeforeCreate = this.template.onBeforeCreate
2047 }
2048 if (this.onAfterCreate == null && this.template.onAfterCreate != null) {
2049 this.onAfterCreate = this.template.onAfterCreate
2050 }
2051 if (this.createNote == null && this.template.createNote != null) {
2052 this.createNote = this.template.createNote
2053 }
2054 this.rowOffset = 0;
2055 if (this.mode == null) {
2056 this.mode = this.template.mode
2057 }
2058 this.mode |= 0;
2059 if (this.nItemsPerPage == null) {
2060 var N = this.template.nItemsPerPage;
2061 this.nItemsPerPage = (N != null ? N: 50)
2062 }
2063 this.nItemsPerPage |= 0;
2064 if (this.nItemsPerPage <= 0) {
2065 this.nItemsPerPage = 0
2066 }
2067 if (this.mode == 3) {
2068 if (this.nItemsPerRow == null) {
2069 var M = this.template.nItemsPerRow;
2070 this.nItemsPerRow = (M != null ? M: 4)
2071 }
2072 this.nItemsPerRow |= 0;
2073 if (this.nItemsPerRow <= 1) {
2074 this.nItemsPerRow = 1
2075 }
2076 } else {
2077 this.nItemsPerRow = 1
2078 }
2079 this.columns = this.template.columns.slice(0);
2080 if (this.extraCols != null) {
2081 for (var D = 0, G = this.extraCols.length; D < G; ++D) {
2082 var I = null;
2083 var C = this.extraCols[D];
2084 if (C.after != null) {
2085 var F = in_array(this.columns, C.after,
2086 function(O) {
2087 return O.id
2088 });
2089 if (F != -1) {
2090 I = F + 1
2091 }
2092 }
2093 if (I == null) {
2094 I = this.columns.length
2095 }
2096 this.columns.splice(I, 0, C)
2097 }
2098 }
2099 this.visibility = [];
2100 var L = [],
2101 J = [];
2102 if (this.visibleCols != null) {
2103 array_walk(this.visibleCols,
2104 function(O) {
2105 L[O] = 1
2106 })
2107 }
2108 if (this.hiddenCols != null) {
2109 array_walk(this.hiddenCols,
2110 function(O) {
2111 J[O] = 1
2112 })
2113 }
2114 for (var D = 0, G = this.columns.length; D < G; ++D) {
2115 var C = this.columns[D];
2116 if (L[C.id] != null || (!C.hidden && J[C.id] == null)) {
2117 this.visibility.push(D)
2118 }
2119 }
2120 if (this.sort == null && this.template.sort) {
2121 this.sort = this.template.sort.slice(0)
2122 } else {
2123 if (this.sort != null) {
2124 var B = this.sort;
2125 this.sort = [];
2126 for (var D = 0, G = B.length; D < G; ++D) {
2127 var C = parseInt(B[D]);
2128 if (isNaN(C)) {
2129 var E = 0;
2130 if (B[D].charAt(0) == "-") {
2131 E = 1;
2132 B[D] = B[D].substring(1)
2133 }
2134 var F = in_array(this.columns, B[D],
2135 function(O) {
2136 return O.id
2137 });
2138 if (F != -1) {
2139 if (E) {
2140 this.sort.push( - (F + 1))
2141 } else {
2142 this.sort.push(F + 1)
2143 }
2144 }
2145 } else {
2146 this.sort.push(C)
2147 }
2148 }
2149 }
2150 }
2151 if (this.tabs) {
2152 this.tabIndex = this.tabs.add(this.getTabName(), {
2153 id: this.id,
2154 onLoad: this.initialize.bind(this)
2155 })
2156 } else {
2157 this.initialize()
2158 }
2159}
2160Listview.prototype = {
2161 initialize: function() {
2162 if (!this.data.length) {
2163 this.showNoData();
2164 return
2165 }
2166 if (this.computeDataFunc != null) {
2167 for (var E = 0, C = this.data.length; E < C; ++E) {
2168 this.computeDataFunc(this.data[E])
2169 }
2170 }
2171 if (this.tabs) {
2172 this.pounded = (this.tabs.poundedTab == this.tabIndex);
2173 if (this.pounded) {
2174 this.readPound()
2175 }
2176 } else {
2177 this.readPound()
2178 }
2179 this.updateSortIndex();
2180 var B;
2181 if (this.onBeforeCreate != null) {
2182 B = this.onBeforeCreate()
2183 }
2184 if (this.mode == 2) {
2185 this.mainDiv = ce("div");
2186 this.mainDiv.className = "listview-mode2";
2187 this.refreshRows();
2188 this.createBands(this.mainDiv)
2189 } else {
2190 this.table = ce("table");
2191 this.thead = ce("thead");
2192 this.tbody = ce("tbody");
2193 if (this.mode == 3) {
2194 this.tbody.className = "listview-mode3";
2195 var A = ce("colgroup");
2196 var F = (100 / this.nItemsPerRow) + "%";
2197 for (var E = 0; E < this.nItemsPerRow; ++E) {
2198 var D = ce("col");
2199 D.style.width = F;
2200 ae(A, D)
2201 }
2202 ae(this.table, A)
2203 } else {
2204 this.tbody.className = "listview-std";
2205 this.createHeader();
2206 this.updateSortArrow()
2207 }
2208 ae(this.table, this.thead);
2209 ae(this.table, this.tbody);
2210 this.refreshRows();
2211 this.createBands(this.table);
2212 if (this.mode == 1 && Browser.ie) {
2213 setTimeout(Listview.cbIeFix.bind(this), 1)
2214 }
2215 }
2216
2217// Сортируем при загрузке, дабы снизить нагрузку с сервера
2218 this.applySort();
2219 this.refreshRows();
2220
2221 if (this.onAfterCreate != null) {
2222 this.onAfterCreate(B)
2223 }
2224 },
2225 createHeader: function() {
2226 var H = ce("tr");
2227 if (this.mode == 1) {
2228 var C = ce("th");
2229 var B = ce("div");
2230 var J = ce("a");
2231 C.style.width = "33px";
2232 if (this.poundable == 2) {
2233 J.style.cursor = "default";
2234 J.style.backgroundColor = "#585858"
2235 }
2236 J.href = "javascript:;";
2237 J.className = "listview-cb";
2238 ns(J);
2239 ae(J, ct(String.fromCharCode(160)));
2240 ae(B, J);
2241 ae(C, B);
2242 ae(H, C)
2243 }
2244 for (var E = 0, G = this.visibility.length; E < G; ++E) {
2245 var I = this.visibility[E];
2246 var D = this.columns[I];
2247 var C = ce("th");
2248 var B = ce("div");
2249 var J = ce("a");
2250 var A = ce("span");
2251 var F = ce("span");
2252 if (this.poundable == 2) {
2253 J.style.cursor = "default";
2254 J.style.backgroundColor = "#585858"
2255 }
2256 J.href = "javascript:;";
2257 J.onclick = this.sortBy.bind(this, I + 1);
2258 ns(J);
2259 if (D.tooltip != null) {
2260 J.onmouseover = Listview.headerOver.bind(J, D.tooltip);
2261 J.onmousemove = Tooltip.cursorUpdate;
2262 J.onmouseout = Tooltip.hide
2263 }
2264 if (D.width != null) {
2265 C.style.width = D.width
2266 }
2267 if (D.align != null) {
2268 C.style.textAlign = D.align
2269 }
2270 if (D.span != null) {
2271 C.colSpan = D.span
2272 }
2273 ae(F, ct(D.name));
2274 ae(A, F);
2275 ae(J, A);
2276 ae(B, J);
2277 ae(C, B);
2278 ae(H, C)
2279 }
2280 ae(this.thead, H)
2281 },
2282 createBands: function(E) {
2283 var C = ce("div"),
2284 D = ce("div");
2285 C.className = "listview-band-top";
2286 D.className = "listview-band-bottom";
2287 this.navTop = this.createNav();
2288 this.navBot = this.createNav();
2289 var A = ce("div"),
2290 B = ce("div");
2291 A.className = B.className = "listview-note";
2292 if (this.note) {
2293 A.innerHTML = this.note
2294 } else {
2295 if (this.createNote) {
2296 this.createNote(A, B)
2297 }
2298 }
2299 if (!A.firstChild && this.mode != 1) {
2300 ae(A, ct(String.fromCharCode(160)))
2301 }
2302 if (this.mode != 1) {
2303 ae(B, ct(String.fromCharCode(160)))
2304 }
2305 ae(C, this.navTop);
2306 ae(D, this.navBot);
2307 ae(C, A);
2308 ae(D, B);
2309 if (this.mode == 1) {
2310 ae(C, this.createCbBar());
2311 ae(D, this.createCbBar())
2312 }
2313 this.bandTop = C;
2314 this.bandBot = D;
2315 this.updateNav();
2316 if (this.hideBands != null) {
2317 C.style.display = D.style.display = "none"
2318 }
2319 ae(this.container, this.bandTop);
2320 ae(this.container, E);
2321 ae(this.container, this.bandBot)
2322 },
2323 createNav: function() {
2324 var B = ce("div");
2325 B.className = "listview-nav";
2326 var D = ce("a"),
2327 C = ce("a"),
2328 A = ce("a"),
2329 I = ce("a");
2330 D.href = C.href = A.href = I.href = "javascript:;";
2331 ae(D, ct(String.fromCharCode(171) + LANG.lvpage_first));
2332 ae(C, ct(String.fromCharCode(8249) + LANG.lvpage_previous));
2333 ae(A, ct(LANG.lvpage_next + String.fromCharCode(8250)));
2334 ae(I, ct(LANG.lvpage_last + String.fromCharCode(187)));
2335 ns(D);
2336 ns(C);
2337 ns(A);
2338 ns(I);
2339 D.onclick = this.firstPage.bind(this);
2340 C.onclick = this.previousPage.bind(this);
2341 A.onclick = this.nextPage.bind(this);
2342 I.onclick = this.lastPage.bind(this);
2343 var H = ce("span");
2344 var G = ce("b"),
2345 F = ce("b"),
2346 E = ce("b");
2347 ae(G, ct("a"));
2348 ae(F, ct("a"));
2349 ae(E, ct("a"));
2350 ae(H, G);
2351 ae(H, ct(LANG.hyphen));
2352 ae(H, F);
2353 ae(H, ct(LANG.lvpage_of));
2354 ae(H, E);
2355 ae(B, D);
2356 ae(B, C);
2357 ae(B, H);
2358 ae(B, A);
2359 ae(B, I);
2360 return B
2361 },
2362 createCbBar: function() {
2363 var F = ce("div");
2364 var C = ce("div");
2365 var B = ce("a"),
2366 A = ce("a"),
2367 E = ce("a");
2368 B.href = A.href = E.href = "javascript:;";
2369 ae(B, ct("All"));
2370 ae(A, ct("None"));
2371 ae(E, ct("Inverse"));
2372 B.onclick = Listview.cbSelect.bind(this, true);
2373 A.onclick = Listview.cbSelect.bind(this, false);
2374 E.onclick = Listview.cbSelect.bind(this, null);
2375 ns(B);
2376 ns(A);
2377 ns(E);
2378 ae(C, ct("Select: "));
2379 ae(C, B);
2380 ae(C, ct(LANG.comma));
2381 ae(C, A);
2382 ae(C, ct(LANG.comma));
2383 ae(C, E);
2384 if (this.createCbControls) {
2385 var D = ce("div");
2386 this.createCbControls(D, C);
2387 D.style.paddingBottom = "6px";
2388 ae(F, D)
2389 }
2390 ae(F, C);
2391 return F
2392 },
2393 refreshRows: function() {
2394 var B = this.data.length;
2395 var D = (this.mode == 2 ? this.mainDiv: this.tbody);
2396 while (D.firstChild) {
2397 D.removeChild(D.firstChild)
2398 }
2399 if (B > 0) {
2400 var G,
2401 A,
2402 F;
2403 if (this.nItemsPerPage > 0) {
2404 G = this.rowOffset;
2405 A = Math.min(B, this.rowOffset + this.nItemsPerPage)
2406 } else {
2407 G = 0;
2408 A = B
2409 }
2410 if (this.mode == 2) {
2411 for (var E = G; E < A; ++E) {
2412 ae(this.mainDiv, this.getDiv(E))
2413 }
2414 } else {
2415 if (this.mode == 3) {
2416 var C = 0,
2417 H = ce("tr");
2418 for (var E = G; E < A; ++E) {
2419 ae(H, this.getCell(E));
2420 if (++C == this.nItemsPerRow) {
2421 ae(this.tbody, H);
2422 if (E + 1 < A) {
2423 H = ce("tr")
2424 }
2425 C = 0
2426 }
2427 }
2428 if (C != 0) {
2429 for (; C < 4; ++C) {
2430 D = ce("td");
2431 D.className = "empty-cell";
2432 ae(H, D)
2433 }
2434 ae(this.tbody, H)
2435 }
2436 } else {
2437 for (var E = G; E < A; ++E) {
2438 ae(this.tbody, this.getRow(E))
2439 }
2440 }
2441 }
2442 } else {
2443 this.bandTop.style.display = this.bandBot.style.display = "none";
2444 if (this.mode == 2) {
2445 this.mainDiv.style.display = "none"
2446 } else {
2447 this.table.style.display = "none"
2448 }
2449 this.showNoData()
2450 }
2451 },
2452 showNoData: function() {
2453 var B = ce("div");
2454 B.className = "listview-nodata";
2455 var A = -1;
2456 if (this.template.onNoData) {
2457 A = (this.template.onNoData.bind(this, B))()
2458 }
2459 if (A == -1) {
2460 ae(B, ct(LANG.lvnodata))
2461 }
2462 ae(this.container, B)
2463 },
2464 getDiv: function(B) {
2465 var A = this.data[B];
2466 if (A.__div == null) {
2467 this.createDiv(A, B)
2468 }
2469 return A.__div
2470 },
2471 createDiv: function(A, B) {
2472 var C = ce("div");
2473 A.__div = C; (this.template.compute.bind(this, A, C, B))()
2474 },
2475 getCell: function(B) {
2476 var A = this.data[B];
2477 if (A.__div == null) {
2478 this.createCell(A, B)
2479 }
2480 return A.__td
2481 },
2482 createCell: function(A, B) {
2483 var C = ce("td");
2484 A.__td = C; (this.template.compute.bind(this, A, C, B))();
2485 if (this.template.getItemLink) {
2486 C.onclick = this.itemClick.bind(this, A)
2487 }
2488 if (Browser.ie6) {
2489 C.onmouseover = Listview.itemOver;
2490 C.onmouseout = Listview.itemOut
2491 }
2492 },
2493 getRow: function(A) {
2494 var B = this.data[A];
2495 if (B.__tr == null) {
2496 this.createRow(B)
2497 }
2498 return B.__tr
2499 },
2500 createRow: function(I) {
2501 var F = ce("tr");
2502 I.__tr = F;
2503 if (this.mode == 1) {
2504 var B = ce("td");
2505 B.className = "listview-cb";
2506 B.onclick = Listview.cbCellClick;
2507 var C = ce("input");
2508 ns(C);
2509 C.type = "checkbox";
2510 C.onclick = Listview.cbClick;
2511 if (I.__chk) {
2512 C.checked = true;
2513 if (Browser.ie) {
2514 C.defaultChecked = true
2515 }
2516 }
2517 I.__cb = C;
2518 ae(B, C);
2519 ae(F, B)
2520 }
2521 for (var D = 0, E = this.visibility.length; D < E; ++D) {
2522 var G = this.visibility[D];
2523 var A = this.columns[G];
2524 var B = ce("td");
2525 if (A.align != null) {
2526 B.style.textAlign = A.align
2527 }
2528 var H = null;
2529 if (A.compute) {
2530 H = (A.compute.bind(this, I, B, F, G))()
2531 } else {
2532 if (I[A.value] != null) {
2533 ae(B, ct(I[A.value]))
2534 } else {
2535 H = -1
2536 }
2537 }
2538 if (H != -1 && H != null) {
2539 B.insertBefore(ct(H), B.firstChild)
2540 }
2541 ae(F, B)
2542 }
2543 if (this.mode == 1 && I.__chk) {
2544 F.className = "checked"
2545 }
2546 if (this.template.getItemLink) {
2547 F.onclick = this.itemClick.bind(this, I)
2548 }
2549 if (Browser.ie6) {
2550 F.onmouseover = Listview.itemOver;
2551 F.onmouseout = Listview.itemOut
2552 }
2553 },
2554 itemClick: function(A, D) {
2555 D = $E(D);
2556 var B = 0,
2557 C = D._target;
2558 while (C && B < 3) {
2559 if (C.nodeName == "A") {
2560 return
2561 }
2562 C = C.parentNode
2563 }
2564 location.href = this.template.getItemLink(A)
2565 },
2566 validatePage: function() {
2567 var C = this.nItemsPerPage,
2568 B = this.rowOffset,
2569 A = this.data.length;
2570 if (B < 0) {
2571 this.rowOffset = 0
2572 } else {
2573 this.rowOffset = this.getRowOffset(B + C > A ? A - 1: B)
2574 }
2575 },
2576 getRowOffset: function(B) {
2577 var A = this.nItemsPerPage;
2578 return (A > 0 && B > 0 ? Math.floor(B / A) * A: 0)
2579 },
2580 changePage: function() {
2581 this.validatePage();
2582 this.refreshRows();
2583 this.updateNav();
2584 this.updatePound();
2585 var A = g_getScroll(),
2586 B = ac(this.container);
2587 if (A.y > B[1]) {
2588 scrollTo(A.x, B[1])
2589 }
2590 },
2591 firstPage: function() {
2592 this.rowOffset = 0;
2593 this.changePage();
2594 return false
2595 },
2596 previousPage: function() {
2597 this.rowOffset -= this.nItemsPerPage;
2598 this.changePage();
2599 return false
2600 },
2601 nextPage: function() {
2602 this.rowOffset += this.nItemsPerPage;
2603 this.changePage();
2604 return false
2605 },
2606 lastPage: function() {
2607 this.rowOffset = 99999999;
2608 this.changePage();
2609 return false
2610 },
2611 addSort: function(A, C) {
2612 var B = in_array(A, C,
2613 function(D) {
2614 return Math.abs(D)
2615 });
2616 if (B != -1) {
2617 C = A[B];
2618 A.splice(B, 1)
2619 }
2620 A.splice(0, 0, C)
2621 },
2622 sortBy: function(A) {
2623 if (this.poundable == 2 || A <= 0 || A > this.columns.length) {
2624 return
2625 }
2626 if (Math.abs(this.sort[0]) == A) {
2627 this.sort[0] = -this.sort[0]
2628 } else {
2629 this.addSort(this.sort, A)
2630 }
2631 this.applySort();
2632 if (this.template.onSort) { (this.template.onSort.bind(this))()
2633 }
2634 this.refreshRows();
2635 if (this.mode != 2) {
2636 this.updateSortArrow()
2637 }
2638 this.updatePound()
2639 },
2640 applySort: function() {
2641 Listview.sort = this.sort;
2642 Listview.columns = this.columns;
2643 if (this.indexCreated) {
2644 this.data.sort(Listview.sortIndexedRows)
2645 } else {
2646 this.data.sort(Listview.sortRows)
2647 }
2648 this.updateSortIndex()
2649 },
2650 setSort: function(B, A, C) {
2651 if (this.sort.toString() != B.toString()) {
2652 this.sort = B;
2653 this.applySort();
2654 if (A) {
2655 this.refreshRows()
2656 }
2657 if (C) {
2658 this.updatePound()
2659 }
2660 }
2661 },
2662 readPound: function() {
2663 if (!this.poundable || !location.hash.length) {
2664 return
2665 }
2666 var B = location.hash.substr(1);
2667 if (this.tabs) {
2668 var G = B.indexOf(":");
2669 if (G == -1) {
2670 return
2671 }
2672 B = B.substr(G + 1)
2673 }
2674 var A = parseInt(B);
2675 if (!isNaN(A)) {
2676 this.rowOffset = A;
2677 this.validatePage();
2678 if (this.poundable != 2) {
2679 var D = [];
2680 var F = B.match(/(\+|\-)[0-9]+/g);
2681 if (F != null) {
2682 for (var C = F.length - 1; C >= 0; --C) {
2683 var E = parseInt(F[C]) | 0;
2684 var B = Math.abs(E);
2685 if (B <= 0 || B > this.columns.length) {
2686 break
2687 }
2688 this.addSort(D, E)
2689 }
2690 this.setSort(D, false, false)
2691 }
2692 }
2693 if (this.tabs) {
2694 this.tabs.setTabPound(this.tabIndex, this.getTabPound())
2695 }
2696 }
2697 },
2698 updateSortArrow: function() {
2699 if (!this.sort.length) {
2700 return
2701 }
2702 var A = in_array(this.visibility, Math.abs(this.sort[0]) - 1);
2703 if (A == -1) {
2704 return
2705 }
2706 if (this.mode == 1) {++A
2707 }
2708 var B = this.thead.firstChild.childNodes[A].firstChild.firstChild.firstChild;
2709 if (this.lsa && this.lsa != B) {
2710 this.lsa.className = ""
2711 }
2712 B.className = (this.sort[0] < 0 ? "sortdesc": "sortasc");
2713 this.lsa = B
2714 },
2715 updateSortIndex: function() {
2716 var B = this.data;
2717 for (var C = 0, A = B.length; C < A; ++C) {
2718 B[C].__si = C
2719 }
2720 this.indexCreated = true
2721 },
2722 updateTabName: function() {
2723 if (this.tabIndex != null) {
2724 this.tabs.setTabName(this.tabIndex, this.getTabName())
2725 }
2726 },
2727 updatePound: function() {
2728 if (!this.poundable) {
2729 return
2730 }
2731 var A = this.getTabPound();
2732 if (this.tabs) {
2733 this.tabs.setTabPound(this.tabIndex, A);
2734 location.replace("#" + this.id + ":" + A)
2735 } else {
2736 location.replace("#" + A)
2737 }
2738 },
2739 updateNav: function() {
2740 var J = this.nItemsPerPage,
2741 H = this.rowOffset,
2742 D = this.data.length;
2743 var B = 0,
2744 F = 0,
2745 C = 0,
2746 I = 0;
2747 if (J) {
2748 if (H > 0) {
2749 F = 1;
2750 if (H >= J + J) {
2751 B = 1
2752 }
2753 }
2754 if (H + J < D) {
2755 C = 1;
2756 if (H + J + J < D) {
2757 I = 1
2758 }
2759 }
2760 }
2761 var E = [this.navTop, this.navBot];
2762 for (var A = 0; A < 2; ++A) {
2763 var G = E[A].childNodes;
2764 G[0].style.display = (B ? "": "none");
2765 G[1].style.display = (F ? "": "none");
2766 G[3].style.display = (C ? "": "none");
2767 G[4].style.display = (I ? "": "none");
2768 G = G[2].childNodes;
2769 G[0].firstChild.nodeValue = H + 1;
2770 G[2].firstChild.nodeValue = J ? Math.min(H + J, D) : D;
2771 G[4].firstChild.nodeValue = D
2772 }
2773 },
2774 getTabName: function() {
2775 var A = this.name;
2776 var B = this.data.length;
2777 if (B > 0) {
2778 A += sprintf(LANG.qty, B)
2779 }
2780 return A
2781 },
2782 getTabPound: function() {
2783 var A = "";
2784 A += this.rowOffset;
2785 if (this.poundable != 2 && this.sort.length) {
2786 A += ("+" + this.sort.join("+")).replace(/\+\-/g, "-")
2787 }
2788 return A
2789 },
2790 getCheckedRows: function() {
2791 var D = [];
2792 for (var C = 0, A = this.data.length; C < A; ++C) {
2793 var B = this.data[C];
2794 if ((B.__cb && B.__cb.checked) || (!B.__cb && B.__chk)) {
2795 D.push(B)
2796 }
2797 }
2798 return D
2799 },
2800 deleteRows: function(M) {
2801 if (!M.length) {
2802 return
2803 }
2804 var C = 0;
2805 var H = 0;
2806 for (var E = M.length - 1; E >= 0; --E) {
2807 var L = M[E];
2808 var G = -1;
2809 if (L.__tr && L.__tr.rowIndex > 0) {
2810 G = this.rowOffset + L.__tr.rowIndex - 1
2811 } else {
2812 G = in_array(this.data, L);
2813 H = 1
2814 }
2815 if (G == -1) {
2816 continue
2817 }++C;
2818 var K = this.nItemsPerPage;
2819 var F = this.rowOffset;
2820 var J = F + (K > 0 ? K: this.data.length) - 1;
2821 if (G >= F && G <= J) {
2822 if (this.mode == 2) {
2823 de(L.__div)
2824 } else {
2825 de(L.__tr)
2826 }
2827 }
2828 this.data.splice(G, 1)
2829 }
2830 if (C == 0) {
2831 return
2832 }
2833 this.updateTabName();
2834 if (this.rowOffset >= this.data.length) {
2835 this.previousPage()
2836 } else {
2837 if (this.data.length == 0 || H) {
2838 this.refreshRows()
2839 }
2840 this.updateNav();
2841 var K = this.nItemsPerPage;
2842 var A = (this.mode == 2 ? this.mainDiv: this.tbody);
2843 var B = (this.mode == 2 ? this.getDiv: this.getRow);
2844 var I = A.childNodes.length;
2845 if (K > 0 && this.rowOffset + I < this.data.length) {
2846 for (var E = this.rowOffset + I, D = E + K - I; E < D; ++E) {
2847 ae(A, B(E))
2848 }
2849 }
2850 }
2851 }
2852};
2853Listview.sortRows = function(C, B) {
2854 var G = Listview.sort,
2855 H = Listview.columns;
2856 for (var F = 0, A = G.length; F < A; ++F) {
2857 var E,
2858 D = H[Math.abs(G[F]) - 1];
2859 if (D.sortFunc) {
2860 E = D.sortFunc(C, B, G[F])
2861 } else {
2862 E = strcmp(C[D.value], B[D.value])
2863 }
2864 if (E != 0) {
2865 return E * G[F]
2866 }
2867 }
2868 return 0
2869},
2870Listview.sortIndexedRows = function(B, A) {
2871 var E = Listview.sort,
2872 F = Listview.columns;
2873 var D,
2874 C = F[Math.abs(E[0]) - 1];
2875 if (C.sortFunc) {
2876 D = C.sortFunc(B, A, E[0])
2877 } else {
2878 D = strcmp(B[C.value], A[C.value])
2879 }
2880 if (D != 0) {
2881 return D * E[0]
2882 }
2883 return B.__si - A.__si
2884},
2885Listview.cbSelect = function(B) {
2886 for (var D = 0, A = this.data.length; D < A; ++D) {
2887 var C = this.data[D];
2888 var F = B;
2889 if (C.__tr) {
2890 var E = C.__tr.firstChild.firstChild;
2891 if (F == null) {
2892 F = !E.checked
2893 }
2894 if (E.checked != F) {
2895 E.checked = F;
2896 C.__tr.className = (E.checked ? "checked": "");
2897 if (Browser.ie) {
2898 E.defaultChecked = F;
2899 if (Browser.ie6) { (Listview.itemOut.bind(C.__tr))()
2900 }
2901 }
2902 }
2903 } else {
2904 if (F == null) {
2905 F = true
2906 }
2907 }
2908 C.__chk = F
2909 }
2910};
2911Listview.cbClick = function(A) {
2912 setTimeout(Listview.cbUpdate.bind(0, 0, this, this.parentNode.parentNode), 1);
2913 sp(A)
2914};
2915Listview.cbCellClick = function(A) {
2916 setTimeout(Listview.cbUpdate.bind(0, 1, this.firstChild, this.parentNode), 1);
2917 sp(A)
2918};
2919Listview.cbIeFix = function() {
2920 var D = gE(this.tbody, "tr");
2921 for (var C = 0, A = D.length; C < A; ++C) {
2922 var B = D[C].firstChild.firstChild;
2923 B.checked = B.defaultChecked = false
2924 }
2925};
2926Listview.cbUpdate = function(B, A, C) {
2927 if (B) {
2928 A.checked = !A.checked
2929 }
2930 C.className = (A.checked ? "checked": "");
2931 if (Browser.ie) {
2932 A.defaultChecked = A.checked;
2933 if (Browser.ie6) { (Listview.itemOver.bind(C))()
2934 }
2935 }
2936};
2937Listview.itemOver = function() {
2938 this.style.backgroundColor = (this.className == "checked" ? "#2C2C2C": "#202020")
2939};
2940Listview.itemOut = function() {
2941 this.style.backgroundColor = (this.className == "checked" ? "#242424": "transparent")
2942};
2943Listview.headerOver = function(B, A) {
2944 Tooltip.showAtCursor(A, B, 0, 0, "q")
2945};
2946Listview.extraCols = {
2947 cost: {
2948 id: "cost",
2949 name: LANG.cost,
2950 compute: function(A, B) {
2951 Listview.funcBox.appendMoney(B, A.cost[0], null, A.cost[1], A.cost[2], A.cost[3])
2952 },
2953 sortFunc: function(B, A, C) {
2954 var E = 0,
2955 D = 0;
2956 if (B.cost[3] != null) {
2957 array_walk(B.cost[3],
2958 function(F, G, G, H) {
2959 E += Math.pow(10, H) + F[1]
2960 })
2961 }
2962 if (A.cost[3] != null) {
2963 array_walk(A.cost[3],
2964 function(F, G, G, H) {
2965 D += Math.pow(10, H) + F[1]
2966 })
2967 }
2968 return strcmp(E, D) || strcmp(B.cost[2], A.cost[2]) || strcmp(B.cost[1], A.cost[1]) || strcmp(B.cost[0], A.cost[0])
2969 }
2970 },
2971 count: {
2972 id: "count",
2973 name: LANG.count,
2974 width: "11%",
2975 value: "count",
2976 compute: function(B, C) {
2977 if (B.outof) {
2978 var A = ce("div");
2979 A.className = "small q0";
2980 ae(A, ct(sprintf(LANG.lvdrop_outof, B.outof)));
2981 ae(C, A)
2982 }
2983 return B.count
2984 }
2985 },
2986 percent: {
2987 id: "percent",
2988 name: "%",
2989 width: "10%",
2990 value: "percent",
2991 compute: function(A, B) {
2992 if (A.percent >= 1.95) {
2993 return A.percent.toFixed(0)
2994 } else if (A.percent < 0){
2995 return ((-1*A.percent) + ' (' + LANG.types[5][0] + ')')
2996 } else {
2997 return parseFloat(A.percent.toFixed(4))
2998 }
2999 }
3000 },
3001 stock: {
3002 id: "stock",
3003 name: LANG.stock,
3004 width: "10%",
3005 value: "stock",
3006 compute: function(A, B) {
3007 if (A.stock > 0) {
3008 return A.stock
3009 } else {
3010 B.style.fontFamily = "Verdana, sans-serif";
3011 return String.fromCharCode(8734)
3012 }
3013 }
3014 }
3015};
3016Listview.funcBox = {
3017 createSimpleCol: function(C, D, A, B) {
3018 return {
3019 id: C,
3020 name: LANG[D],
3021 width: A,
3022 value: B
3023 }
3024 },
3025 initLootTable: function(A) {
3026 if (this._totalCount != null) {
3027 A.percent = A.count / this._totalCount
3028 } else {
3029 A.percent = A.count / A.outof
3030 }
3031 A.percent *= 100
3032 },
3033 beforeUserComments: function() {
3034 if ((g_user.roles & 26) != 0) {
3035 this.mode = 1;
3036 this.createCbControls = function(B) {
3037 var A = ce("input");
3038 A.type = "button";
3039 A.value = "Delete";
3040 A.onclick = (function() {
3041 var E = this.getCheckedRows();
3042 if (!E.length) {
3043 alert("No comments selected.")
3044 } else {
3045 if (confirm("Are you sure that you want to delete " + (E.length == 1 ? "this comment": "these " + E.length + " comments") + "?")) {
3046 var C = "";
3047 var D = 0;
3048 array_walk(E,
3049 function(F) {
3050 if (F.purged == 0 && F.deleted == 0) {
3051 F.deleted = 1;
3052 if (F.__tr != null) {
3053 F.__tr.childNodes[2].lastChild.lastChild.firstChild.nodeValue = " (Deleted)"
3054 }
3055 C += F.id + ","
3056 } else {
3057 if (F.purged == 1) {++D
3058 }
3059 }
3060 });
3061 C = rtrim(C, ",");
3062 if (C != "")
3063 {
3064 new Ajax("?comment=delete&id=" + C + "&username=" + g_pageInfo.username)
3065 }
3066 (Listview.cbSelect.bind(this, false))();
3067 if (D > 0) {
3068 alert("Purged comments cannot be deleted.\n\nA purged comment is a comment that has been\nautomatically removed from the site due to a negative rating.")
3069 }
3070 }
3071 }
3072 }).bind(this);
3073 ae(B, A);
3074 if (g_user.roles & 26) {
3075 var A = ce("input");
3076 A.type = "button";
3077 A.value = "Undelete";
3078 A.onclick = (function() {
3079 var D = this.getCheckedRows();
3080 if (!D.length) {
3081 alert("No comments selected.")
3082 } else {
3083 var C = "";
3084 array_walk(D,
3085 function(E) {
3086 if (E.deleted == 1) {
3087 E.deleted = 0;
3088 if (E.__tr != null) {
3089 E.__tr.childNodes[2].lastChild.lastChild.firstChild.nodeValue = ""
3090 }
3091 C += E.id + ","
3092 }
3093 });
3094 C = rtrim(C, ",");
3095 if (C != "") {
3096 new Ajax("?comment=undelete&id=" + C + "&username=" + g_pageInfo.username)
3097 } (Listview.cbSelect.bind(this, false))()
3098 }
3099 }).bind(this);
3100 ae(B, A)
3101 }
3102 }
3103 }
3104 },
3105 assocArrCmp: function(C, B, A) {
3106 if (C == null) {
3107 return - 1
3108 } else {
3109 if (B == null) {
3110 return 1
3111 }
3112 }
3113 var F = Math.max(C.length, B.length);
3114 for (var E = 0; E < F; ++E) {
3115 if (C[E] == null) {
3116 return - 1
3117 } else {
3118 if (B[E] == null) {
3119 return 1
3120 }
3121 }
3122 var D = strcmp(A[C[E]], A[B[E]]);
3123 if (D != 0) {
3124 return D
3125 }
3126 }
3127 return 0
3128 },
3129 location: function(E, F) {
3130 if (E.location == null) {
3131 return - 1
3132 }
3133 for (var D = 0, B = E.location.length; D < B; ++D) {
3134 if (D > 0) {
3135 ae(F, ct(LANG.comma))
3136 }
3137 var A = E.location[D];
3138 if (A == -1) {
3139 ae(F, ct(LANG.ellipsis))
3140 } else {
3141 var C = ce("a");
3142 C.className = "q1";
3143 C.href = "?zone=" + A;
3144 ae(C, ct(g_zones[A]));
3145 ae(F, C)
3146 }
3147 }
3148 },
3149 createCenteredIcons: function(I, C, L) {
3150 if (I != null) {
3151 var H = ce("div"),
3152 A = ce("div");
3153 if (L) {
3154 var G = ce("div");
3155 G.style.position = "relative";
3156 G.style.width = "1px";
3157 var J = ce("div");
3158 J.className = "q0";
3159 J.style.position = "absolute";
3160 J.style.right = "2px";
3161 J.style.lineHeight = "26px";
3162 J.style.fontSize = "11px";
3163 J.style.whiteSpace = "nowrap";
3164 ae(J, ct(L));
3165 ae(G, J);
3166 ae(H, G)
3167 }
3168 for (var D = 0, F = I.length; D < F; ++D) {
3169 var B,
3170 E;
3171 if (typeof I[D] == "object") {
3172 B = I[D][0];
3173 E = I[D][1]
3174 } else {
3175 B = I[D]
3176 }
3177 var K = g_items.createIcon(B, 0, E);
3178 K.style.cssFloat = K.style.styleFloat = "left";
3179 ae(H, K)
3180 }
3181 H.style.margin = "0 auto";
3182 H.style.textAlign = "left";
3183 H.style.width = (26 * I.length) + "px";
3184 A.className = "clear";
3185 ae(C, H);
3186 ae(C, A);
3187 return true
3188 }
3189 },
3190 getItemType: function(C, B, A) {
3191 if (A != null && g_item_subsubclasses[C] != null && g_item_subsubclasses[C][B] != null) {
3192 return g_item_subsubclasses[C][B][A]
3193 }
3194 if (g_item_subclasses[C] != null) {
3195 return g_item_subclasses[C][B]
3196 } else {
3197 return g_item_classes[C]
3198 }
3199 },
3200 getQuestCategory: function(A) {
3201 if (A > 0) {
3202 return g_zones[A]
3203 } else {
3204 return g_quest_sorts[ - A]
3205 }
3206 },
3207 createTextRange: function(B, A) {
3208 B |= 0;
3209 A |= 0;
3210 if (B > 1 || A > 1) {
3211 if (B != A && A > 0) {
3212 return B + "-" + A
3213 } else {
3214 return B + ""
3215 }
3216 }
3217 return null
3218 },
3219 coGetColor: function(C, A) {
3220 if (C.user && g_customColors[C.user]) {
3221 return " comment-" + g_customColors[C.user]
3222 }
3223 switch (A) {
3224 case - 1: var B = C.divPost.childNodes[1].className.match(/comment-([a-z]+)/);
3225 if (B != null) {
3226 return " comment-" + B[1]
3227 }
3228 break;
3229 case 3:
3230 case 4:
3231 if (C.roles & 24) {
3232 return " comment-green"
3233 }
3234 break
3235 }
3236 if (C.roles & 2) {
3237 return " comment-blue"
3238 } else {
3239 if (C.rating >= 10) {
3240 return " comment-green"
3241 } else {
3242 if (C.rating < 0) {
3243 return " comment-bt"
3244 }
3245 }
3246 }
3247 return ""
3248 },
3249 coToggleVis: function(A) {
3250 this.firstChild.nodeValue = (g_toggleDisplay(A.divBody) ? LANG.lvcomment_hide: LANG.lvcomment_show);
3251 if (A.ratable) {
3252 A.divHeader.firstChild.lastChild.style.display = ""
3253 }
3254 g_toggleDisplay(A.divLinks);
3255 if (A.lastEdit != null) {
3256 g_toggleDisplay(A.divLastEdit)
3257 }
3258 },
3259 coRate: function(D, B) {
3260 if (B == 0) {
3261 var A = 5;
3262 if (g_user.roles & 2) {
3263 A = 25
3264 } else {
3265 if (g_user.roles & 16) {
3266 A = 15
3267 }
3268 }
3269 var C = prompt(sprintf(LANG.prompt_customrating, A, A), 0);
3270 if (C == null) {
3271 return
3272 } else {
3273 C |= 0;
3274 if (C != 0 && Math.abs(C) <= A) {
3275 B = C
3276 }
3277 }
3278 if (B == 0) {
3279 return
3280 }
3281 } else {
3282 if (g_user.roles & 26) {
3283 B *= 5
3284 }
3285 }
3286 new Ajax("?comment=rate&id=" + D.id + "&rating=" + B);
3287 D.rating += B;
3288 _ = D.divHeader.firstChild;
3289 _ = _.childNodes[_.childNodes.length - 3];
3290 _.lastChild.firstChild.nodeValue = (D.rating > 0 ? "+": "") + D.rating;
3291 Tooltip.hide();
3292 de(_.nextSibling);
3293 de(_.nextSibling)
3294 },
3295 coDelete: function(A) {
3296 if (A.purged) {
3297 alert(LANG.message_cantdeletecomment)
3298 } else {
3299 if (confirm(LANG.confirm_deletecomment)) {
3300 new Ajax("?comment=delete&id=" + A.id);
3301 this.deleteRows([A])
3302 }
3303 }
3304 },
3305 coDetach: function(A) {
3306 if (A.replyTo == 0) {
3307 alert(LANG.message_cantdetachcomment)
3308 } else {
3309 if (confirm(LANG.confirm_detachcomment)) {
3310 new Ajax("?comment=detach&id=" + A.id);
3311 A.replyTo = 0;
3312 alert(LANG.message_commentdetached)
3313 }
3314 }
3315 },
3316 coEdit: function(G, E) {
3317 G.divBody.style.display = "none";
3318 G.divLinks.firstChild.style.display = "none";
3319 var F = ce("div");
3320 F.className = "comment-edit";
3321 G.divEdit = F;
3322 if (E == -1) {
3323 if (g_users[G.user] != null) {
3324 G.roles = g_users[G.user].roles
3325 }
3326 }
3327 var C = Listview.funcBox.coEditAppend(F, G, E);
3328 var B = ce("div");
3329 B.className = "comment-edit-buttons";
3330 var D = ce("input");
3331 D.type = "button";
3332 D.value = LANG.compose_save;
3333 D.onclick = Listview.funcBox.coEditButton.bind(D, G, true, E);
3334 ae(B, D);
3335 ae(B, ct(" "));
3336 D = ce("input");
3337 D.type = "button";
3338 D.value = LANG.compose_cancel;
3339 D.onclick = Listview.funcBox.coEditButton.bind(D, G, false, E);
3340 ae(B, D);
3341 ae(F, B);
3342 var A = F;
3343 if (Browser.ie6) {
3344 A = ce("div");
3345 A.style.width = "99%";
3346 ae(A, F)
3347 }
3348 if (E == -1) {
3349 G.divPost.insertBefore(A, G.divBody.nextSibling)
3350 } else {
3351 G.__div.insertBefore(A, G.divBody.nextSibling)
3352 }
3353 C.focus()
3354 },
3355 coEditAppend: function(L, C, K) {
3356 var F = Listview.funcBox.coGetCharLimit(K);
3357 if (K == 1 || K == 3 || K == 4) {
3358 C.user = g_user.name;
3359 C.roles = g_user.roles;
3360 C.rating = 1
3361 } else {
3362 if (K >= 1) {
3363 C.roles = 0;
3364 C.rating = 1
3365 }
3366 }
3367 if (K == -1 || K == 0) {
3368 var J = ce("div");
3369 J.className = "comment-edit-modes";
3370 ae(J, ct(LANG.compose_mode));
3371 var P = ce("a");
3372 P.className = "selected";
3373 P.onclick = Listview.funcBox.coModeLink.bind(P, 1, K);
3374 P.href = "javascript:;";
3375 ae(P, ct(LANG.compose_edit));
3376 ae(J, P);
3377 ae(J, ct("|"));
3378 var N = ce("a");
3379 N.onclick = Listview.funcBox.coModeLink.bind(N, 2, K);
3380 N.href = "javascript:;";
3381 ae(N, ct(LANG.compose_preview));
3382 ae(J, N);
3383 ae(L, J)
3384 }
3385 var A = ce("div");
3386 A.style.display = "none";
3387 A.className = "comment-body" + Listview.funcBox.coGetColor(C, K);
3388 ae(L, A);
3389 var H = ce("div");
3390 H.className = "comment-edit-body";
3391 var G = ce("div");
3392 G.className = "toolbar";
3393 var I = ce("textarea");
3394 I.className = "comment-editbox";
3395 I.rows = 10;
3396 I.value = C.body;
3397 switch (K) {
3398 case 1:
3399 I.name = "commentbody";
3400 break;
3401 case 2:
3402 I.name = "desc";
3403 I.originalValue = C.body;
3404 break;
3405 case 3:
3406 I.name = "body";
3407 break;
3408 case 4:
3409 I.name = "sig";
3410 I.originalValue = C.body;
3411 I.rows = (Browser.gecko ? 2: 3);
3412 I.style.height = "auto";
3413 break
3414 }
3415 if (K != -1 && K != 0) {
3416 var E = ce("h3"),
3417 W = ce("a"),
3418 O = ce("div"),
3419 V = ce("div");
3420 var D = Listview.funcBox.coLivePreview.bind(I, C, K, O);
3421 if (C.body) {
3422 W.className = "disclosure-off";
3423 O.style.display = "none"
3424 } else {
3425 W.className = "disclosure-on"
3426 }
3427 ae(W, ct(LANG.compose_livepreview));
3428 ae(E, W);
3429 W.href = "javascript:;";
3430 W.onclick = function() {
3431 D(1);
3432 W.className = "disclosure-" + (g_toggleDisplay(O) ? "on": "off")
3433 };
3434 ns(W);
3435 E.className = "first";
3436 V.className = "pad";
3437 ae(A, E);
3438 ae(A, O);
3439 ae(A, V);
3440 var U;
3441 var T = function() {
3442 if (U) {
3443 clearTimeout(U);
3444 U = null
3445 }
3446 U = setTimeout(D, 50)
3447 };
3448 I.onchange = T;
3449 I.onkeyup = T;
3450 aE(I, "focus",
3451 function() {
3452 D();
3453 A.style.display = "";
3454 if (K != 4) {
3455 I.style.height = "22em"
3456 }
3457 })
3458 } else {
3459 if (K != 4) {
3460 aE(I, "focus",
3461 function() {
3462 I.style.height = "22em"
3463 })
3464 }
3465 }
3466 var S = [{
3467 id: "b",
3468 title: LANG.markup_b,
3469 pre: "[b]",
3470 post: "[/b]"
3471 },
3472 {
3473 id: "i",
3474 title: LANG.markup_i,
3475 pre: "[i]",
3476 post: "[/i]"
3477 },
3478 {
3479 id: "u",
3480 title: LANG.markup_u,
3481 pre: "[u]",
3482 post: "[/u]"
3483 },
3484 {
3485 id: "s",
3486 title: LANG.markup_s,
3487 pre: "[s]",
3488 post: "[/s]"
3489 },
3490 {
3491 id: "small",
3492 title: LANG.markup_small,
3493 pre: "[small]",
3494 post: "[/small]"
3495 },
3496 {
3497 id: "url",
3498 title: LANG.markup_url,
3499 onclick: function() {
3500 var Y = prompt(LANG.prompt_linkurl, "http://");
3501 if (Y) {
3502 g_insertTag(I, "[url=" + Y + "]", "[/url]")
3503 }
3504 }
3505 },
3506 {
3507 id: "quote",
3508 title: LANG.markup_quote,
3509 pre: "[quote]",
3510 post: "[/quote]"
3511 },
3512 {
3513 id: "code",
3514 title: LANG.markup_code,
3515 pre: "[code]",
3516 post: "[/code]"
3517 },
3518 {
3519 id: "ul",
3520 title: LANG.markup_ul,
3521 pre: "[ul]\n[li]",
3522 post: "[/li]\n[/ul]",
3523 rep: function(Y) {
3524 return Y.replace(/\n/g, "[/li]\n[li]")
3525 }
3526 },
3527 {
3528 id: "ol",
3529 title: LANG.markup_ol,
3530 pre: "[ol]\n[li]",
3531 post: "[/li]\n[/ol]",
3532 rep: function(Y) {
3533 return Y.replace(/\n/g, "[/li]\n[li]")
3534 }
3535 },
3536 {
3537 id: "li",
3538 title: LANG.markup_li,
3539 pre: "[li]",
3540 post: "[/li]"
3541 }];
3542 for (var Q = 0, R = S.length; Q < R; ++Q) {
3543 var B = S[Q];
3544 if (K == 4 && B.id == "quote") {
3545 break
3546 }
3547 var M = ce("button");
3548 var X = ce("img");
3549 M.setAttribute("type", "button");
3550 M.title = B.title;
3551 if (B.onclick != null) {
3552 M.onclick = B.onclick
3553 } else {
3554 M.onclick = g_insertTag.bind(0, I, B.pre, B.post, B.rep)
3555 }
3556 X.src = "templates/wowhead/images/pixel.gif";
3557 X.className = "toolbar-" + B.id;
3558 ae(M, X);
3559 ae(G, M)
3560 }
3561 ae(H, G);
3562 ae(H, I);
3563 ae(H, ce("br"));
3564 if (K == 4) {
3565 ae(H, ct(sprintf(LANG.compose_limit2, F)))
3566 } else {
3567 ae(H, ct(sprintf(LANG.compose_limit, F)))
3568 }
3569 ae(L, H);
3570 return I
3571 },
3572 coLivePreview: function(E, F, A, B) {
3573 if (B != 1 && A.style.display == "none") {
3574 return
3575 }
3576 var C = this,
3577 I = Listview.funcBox.coGetCharLimit(F),
3578 G = (C.value.length > I ? C.value.substring(0, I) : C.value);
3579 if (F == 4) {
3580 var H;
3581 if ((H = G.indexOf("\n")) != -1 && (H = G.indexOf("\n", H + 1)) != -1 && (H = G.indexOf("\n", H + 1)) != -1) {
3582 G = G.substring(0, H)
3583 }
3584 }
3585 var D = Markup.toHtml(G, {
3586 mode: Markup.MODE_COMMENT
3587 });
3588 if (D) {
3589 A.innerHTML = D
3590 } else {
3591 A.innerHTML = '<span class="q6">...</span>'
3592 }
3593 },
3594 coEditButton: function(E, D, B) {
3595 if (D) {
3596 var A = gE(E.divEdit, "textarea")[0];
3597 if (!Listview.funcBox.coValidate(A, B)) {
3598 return
3599 }
3600 if (A.value != E.body) {
3601 var C = 0;
3602 if (E.lastEdit != null) {
3603 C = E.lastEdit[1]
3604 }++C;
3605 E.lastEdit = [g_serverTime, C, g_user.name];
3606 Listview.funcBox.coUpdateLastEdit(E);
3607 E.divBody.innerHTML = Markup.toHtml((A.value.length > 7500 ? A.value.substring(0, 7500) : A.value), {
3608 mode: Markup.MODE_COMMENT
3609 });
3610 E.body = A.value;
3611 if (B == -1) {
3612 new Ajax("?forums=editpost&id=" + E.id, {
3613 method: "POST",
3614 params: "body=" + urlencode(E.body)
3615 })
3616 } else {
3617 new Ajax("?comment=edit&id=" + E.id, {
3618 method: "POST",
3619 params: "body=" + urlencode(E.body)
3620 })
3621 }
3622 }
3623 }
3624 E.divBody.style.display = "";
3625 E.divLinks.firstChild.style.display = "";
3626 de(E.divEdit);
3627 E.divEdit = null
3628 },
3629 coGetCharLimit: function(A) {
3630 if (A == 4) {
3631 return 250
3632 } else {
3633 return 7500
3634 }
3635 },
3636 coModeLink: function(D, A) {
3637 var I = Listview.funcBox.coGetCharLimit(D);
3638 var B = Markup.MODE_COMMENT;
3639 array_walk(gE(this.parentNode, "a"),
3640 function(J) {
3641 J.className = ""
3642 });
3643 this.className = "selected";
3644 var C = gE(this.parentNode.parentNode, "textarea")[0],
3645 H = C.parentNode,
3646 E = H.previousSibling;
3647 if (A == 4) {
3648 B = Markup.MODE_SIGNATURE
3649 }
3650 switch (D) {
3651 case 1:
3652 H.style.display = "";
3653 E.style.display = "none";
3654 H.firstChild.focus();
3655 break;
3656 case 2:
3657 H.style.display = "none";
3658 var F = (C.value.length > I ? C.value.substring(0, I) : C.value);
3659 if (A == 4) {
3660 var G;
3661 if ((G = F.indexOf("\n")) != -1 && (G = F.indexOf("\n", G + 1)) != -1 && (G = F.indexOf("\n", G + 1)) != -1) {
3662 F = F.substring(0, G)
3663 }
3664 }
3665 E.innerHTML = Markup.toHtml(F, {
3666 mode: B
3667 });
3668 E.style.display = "";
3669 break
3670 }
3671 },
3672 coReply: function(B) {
3673 document.forms.addcomment.elements.replyto.value = B.replyTo;
3674 var A = ge("replybox-generic");
3675 gE(A, "span")[0].innerHTML = B.user;
3676 A.style.display = "";
3677 co_addYourComment()
3678 },
3679 coValidate: function(A, B) {
3680 B |= 0;
3681 if (B == 1 || B == -1) {
3682 if (trim(A.value).length < 1) {
3683 alert(LANG.message_forumposttooshort);
3684 return false
3685 }
3686 } else {
3687 if (trim(A.value).length < 10) {
3688 alert(LANG.message_commenttooshort);
3689 return false
3690 }
3691 }
3692 if (A.value.length > 7500) {
3693 if (!confirm(sprintf((B == 1 ? LANG.confirm_forumposttoolong: LANG.confirm_commenttoolong), A.value.substring(7470, 7500)))) {
3694 return false
3695 }
3696 }
3697 return true
3698 },
3699 coCustomRatingOver: function(A) {
3700 Tooltip.showAtCursor(A, LANG.tooltip_customrating, 0, 0, "q")
3701 },
3702 coPlusRatingOver: function(A) {
3703 Tooltip.showAtCursor(A, LANG.tooltip_uprate, 0, 0, "q2")
3704 },
3705 coMinusRatingOver: function(A) {
3706 Tooltip.showAtCursor(A, LANG.tooltip_downrate, 0, 0, "q7")
3707 },
3708 coSortDate: function(A) {
3709 A.nextSibling.nextSibling.className = "";
3710 A.className = "selected";
3711 this.mainDiv.className = "listview-aci";
3712 this.setSort([1], true, false)
3713 },
3714 coSortHighestRatedFirst: function(A) {
3715 A.previousSibling.previousSibling.className = "";
3716 A.className = "selected";
3717 this.mainDiv.className = "";
3718 this.setSort([ - 3, 2], true, false)
3719 },
3720 coUpdateLastEdit: function(F) {
3721 var B = F.divLastEdit;
3722 if (!B) {
3723 return
3724 }
3725 if (F.lastEdit != null) {
3726 var E = F.lastEdit;
3727 B.childNodes[1].firstChild.nodeValue = E[2];
3728 B.childNodes[1].href = "?user=" + E[2];
3729 var D = new Date(E[0]);
3730 var A = (g_serverTime - D) / 1000;
3731 if (B.childNodes[3].firstChild) {
3732 de(B.childNodes[3].firstChild)
3733 }
3734 Listview.funcBox.coFormatDate(B.childNodes[3], A, D);
3735 var C = "";
3736 if (F.rating != null) {
3737 C += LANG.lvcomment_patch1 + g_getPatchVersion(D) + LANG.lvcomment_patch2
3738 }
3739 if (E[1] > 1) {
3740 C += LANG.dash + sprintf(LANG.lvcomment_nedits, E[1])
3741 }
3742 B.childNodes[4].nodeValue = C;
3743 B.style.display = ""
3744 } else {
3745 B.style.display = "none"
3746 }
3747 },
3748 coFormatDate: function(E, A, D, F, G) {
3749 var C;
3750 if (A < 2592000) {
3751 txt = sprintf(LANG.date_ago, g_formatTimeElapsed(A));
3752 var B = D;
3753 B.setTime(B.getTime() + (g_localTime - g_serverTime));
3754 E.style.cursor = "help";
3755 E.title = B.toLocaleString()
3756 } else {
3757 txt = LANG.date_on + g_formatDateSimple(D, F);
3758 E.style.cursor = E.title = ""
3759 }
3760 if (G == 1) {
3761 txt = txt.substr(0, 1).toUpperCase() + txt.substr(1)
3762 }
3763 C = ct(txt);
3764 ae(E, C)
3765 },
3766 ssCellOver: function() {
3767 this.className = "screenshot-caption-over"
3768 },
3769 ssCellOut: function() {
3770 this.className = "screenshot-caption"
3771 },
3772 ssCellClick: function(B, D) {
3773 D = $E(D);
3774 if (D.shiftKey || D.ctrlKey) {
3775 return
3776 }
3777 var A = 0,
3778 C = D._target;
3779 while (C && A < 3) {
3780 if (C.nodeName == "A") {
3781 return
3782 }
3783 if (C.nodeName == "IMG") {
3784 break
3785 }
3786 C = C.parentNode
3787 }
3788 ScreenshotViewer.show({
3789 screenshots: this.data,
3790 pos: B
3791 })
3792 },
3793 moneyHonorOver: function(A) {
3794 Tooltip.showAtCursor(A, "<b>" + LANG.tooltip_honorpoints + "</b>", 0, 0, "q")
3795 },
3796 moneyArenaOver: function(A) {
3797 Tooltip.showAtCursor(A, "<b>" + LANG.tooltip_arenapoints + "</b>", 0, 0, "q")
3798 },
3799 appendMoney: function(E, A, F, J, K, B) {
3800 var I,
3801 H = 0;
3802 if (A >= 10000) {
3803 H = 1;
3804 I = ce("span");
3805 I.className = "moneygold";
3806 ae(I, ct(Math.floor(A / 10000)));
3807 ae(E, I);
3808 A %= 10000
3809 }
3810 if (A >= 100) {
3811 if (H) {
3812 ae(E, ct(" "))
3813 } else {
3814 H = 1
3815 }
3816 I = ce("span");
3817 I.className = "moneysilver";
3818 ae(I, ct(Math.floor(A / 100)));
3819 ae(E, I);
3820 A %= 100
3821 }
3822 if (A >= 1 || F != null) {
3823 if (H) {
3824 ae(E, ct(" "))
3825 } else {
3826 H = 1
3827 }
3828 I = ce("span");
3829 I.className = "moneycopper";
3830 ae(I, ct(A));
3831 ae(E, I)
3832 }
3833 if (J != null && J != 0) {
3834 if (H) {
3835 ae(E, ct(" "))
3836 } else {
3837 H = 1
3838 }
3839 I = ce("span");
3840 I.className = "money" + (J < 0 ? "horde": "alliance") + " tip";
3841 I.onmouseover = Listview.funcBox.moneyHonorOver;
3842 I.onmousemove = Tooltip.cursorUpdate;
3843 I.onmouseout = Tooltip.hide;
3844 ae(I, ct(number_format(Math.abs(J))));
3845 ae(E, I)
3846 }
3847 if (K >= 1) {
3848 if (H) {
3849 ae(E, ct(" "))
3850 } else {
3851 H = 1
3852 }
3853 I = ce("span");
3854 I.className = "moneyarena tip";
3855 I.onmouseover = Listview.funcBox.moneyArenaOver;
3856 I.onmousemove = Tooltip.cursorUpdate;
3857 I.onmouseout = Tooltip.hide;
3858 ae(I, ct(number_format(K)));
3859 ae(E, I)
3860 }
3861 if (B != null) {
3862 for (var C = 0; C < B.length; ++C) {
3863 if (H) {
3864 ae(E, ct(" "))
3865 } else {
3866 H = 1
3867 }
3868 var G = B[C][0];
3869 var D = B[C][1];
3870 I = ce("a");
3871 I.href = "?item=" + G;
3872 I.className = "moneyitem";
3873 I.style.backgroundImage = "url(images/icons/small/" + g_items.getIcon(G).toLowerCase() + ".jpg)";
3874 ae(I, ct(D));
3875 ae(E, I)
3876 }
3877 }
3878 }
3879};
3880Listview.templates = {
3881 faction: {
3882 sort: [1],
3883 nItemsPerPage: -1,
3884 columns: [{
3885 id: "name",
3886 name: LANG.name,
3887 align: "left",
3888 value: "name",
3889 compute: function(C, D) {
3890 var A = ce("a");
3891 A.style.fontFamily = "Verdana, sans-serif";
3892 A.href = this.template.getItemLink(C);
3893 ae(A, ct(C.name));
3894 if (C.expansion == 1) {
3895 var B = ce("span");
3896 B.className = "bc-icon";
3897 ae(B, A);
3898 ae(D, B)
3899 } else {
3900 ae(D, A)
3901 }
3902 }
3903 },
3904 {
3905 id: "group",
3906 name: LANG.group,
3907 value: "group",
3908 compute: function(A, B) {
3909 if (A.group != null) {
3910 return A.group
3911 }
3912 }
3913 },
3914 {
3915 id: "side",
3916 name: LANG.side,
3917 width: "10%",
3918 compute: function(B, C) {
3919 if (B.side) {
3920 var A = ce("span");
3921 A.className = (B.side == 1 ? "alliance-icon": "horde-icon");
3922 ae(A, ct(g_sides[B.side]));
3923 ae(C, A)
3924 }
3925 },
3926 sortFunc: function(B, A, C) {
3927 return strcmp(g_sides[B.side], g_sides[A.side])
3928 }
3929 }],
3930 getItemLink: function(A) {
3931 return "?faction=" + A.id
3932 }
3933 },
3934 item: {
3935 sort: [1],
3936 columns: [{
3937 id: "name",
3938 name: LANG.name,
3939 align: "left",
3940 span: 2,
3941 value: "name",
3942 compute: function(D, G, E) {
3943 var C = ce("td");
3944 C.style.width = "1px";
3945 C.style.padding = "0";
3946 C.style.borderRight = "none";
3947 var B = null,
3948 F = null;
3949 if (D.stack != null) {
3950 B = Listview.funcBox.createTextRange(D.stack[0], D.stack[1])
3951 }
3952 if (D.avail != null) {
3953 F = D.avail
3954 }
3955 ae(C, g_items.createIcon(D.id, 1, B, F));
3956 ae(E, C);
3957 G.style.borderLeft = "none";
3958 var A = ce("a");
3959 A.className = "q" + (6 - parseInt(D.name.charAt(0)));
3960 A.style.fontFamily = "Verdana, sans-serif";
3961 A.href = this.template.getItemLink(D);
3962 ae(A, ct(D.name.substring(1)));
3963 ae(G, A)
3964 }
3965 },
3966 {
3967 id: "level",
3968 name: LANG.level,
3969 width: "7%",
3970 value: "level",
3971 sortFunc: function(B, A, C) {
3972 return strcmp(B.level, A.level) || strcmp(B.reqlevel, A.reqlevel)
3973 }
3974 },
3975 {
3976 id: "reqlevel",
3977 name: LANG.req,
3978 tooltip: LANG.tooltip_reqlevel,
3979 width: "7%",
3980 value: "reqlevel",
3981 compute: function(A, B) {
3982 if (A.reqlevel > 1) {
3983 return A.reqlevel
3984 }
3985 },
3986 sortFunc: function(B, A, C) {
3987 return strcmp(B.reqlevel, A.reqlevel) || strcmp(B.level, A.level)
3988 }
3989 },
3990 {
3991 id: "dps",
3992 name: LANG.dps,
3993 width: "10%",
3994 value: "dps",
3995 compute: function(A, B) {
3996 return (A.dps || 0).toFixed(1)
3997 },
3998 hidden: true
3999 },
4000 {
4001 id: "speed",
4002 name: LANG.speed,
4003 width: "10%",
4004 value: "speed",
4005 compute: function(A, B) {
4006 return (A.speed || 0).toFixed(2)
4007 },
4008 hidden: true
4009 },
4010 {
4011 id: "armor",
4012 name: LANG.armor,
4013 width: "10%",
4014 value: "armor",
4015 compute: function(A, B) {
4016 if (A.armor > 0) {
4017 return A.armor
4018 }
4019 },
4020 hidden: true
4021 },
4022 {
4023 id: "slot",
4024 name: LANG.slot,
4025 width: "10%",
4026 compute: function(A, B) {
4027 return g_item_slots[A.slot]
4028 },
4029 sortFunc: function(B, A, C) {
4030 return strcmp(g_item_slots[B.slot], g_item_slots[A.slot])
4031 },
4032 hidden: true
4033 },
4034 {
4035 id: "slots",
4036 name: LANG.slots,
4037 width: "10%",
4038 value: "nslots",
4039 hidden: true
4040 },
4041 {
4042 id: "skill",
4043 name: LANG.skill,
4044 width: "10%",
4045 value: "skill",
4046 hidden: true
4047 },
4048 {
4049 id: "source",
4050 name: LANG.source,
4051 width: "12%",
4052 compute: function(C, D) {
4053 if (C.source != null) {
4054 for (var B = 0, A = C.source.length; B < A; ++B) {
4055 if (B > 0) {
4056 ae(D, ct(LANG.comma))
4057 }
4058 ae(D, ct(g_sources[C.source[B]]))
4059 }
4060 }
4061 },
4062 sortFunc: function(B, A, C) {
4063 return Listview.funcBox.assocArrCmp(B.source, A.source, g_sources)
4064 }
4065 },
4066 {
4067 id: "type",
4068 name: LANG.type,
4069 width: "14%",
4070 compute: function(C, D) {
4071 D.className = "small q1";
4072 var A = ce("a");
4073 var B = "?items=" + C.classs;
4074 if (g_item_subclasses[C.classs] != null) {
4075 B += "." + C.subclass
4076 }
4077 if (C.subsubclass != null && g_item_subsubclasses[C.classs][C.subclass] != null) {
4078 B += "." + C.subsubclass
4079 }
4080 A.href = B;
4081 ae(A, ct(Listview.funcBox.getItemType(C.classs, C.subclass, C.subsubclass)));
4082 ae(D, A)
4083 },
4084 sortFunc: function(B, A, D) {
4085 var C = Listview.funcBox.getItemType;
4086 return strcmp(C(B.classs, B.subclass, B.subsubclass), C(A.classs, A.subclass, A.subsubclass))
4087 }
4088 }],
4089 getItemLink: function(A) {
4090 return "?item=" + A.id
4091 }
4092 },
4093 itemset: {
4094 sort: [1],
4095 nItemsPerPage: 75,
4096 columns: [{
4097 id: "name",
4098 name: LANG.name,
4099 align: "left",
4100 value: "name",
4101 compute: function(B, D) {
4102 var A = ce("a");
4103 A.className = "q" + (6 - parseInt(B.name.charAt(0)));
4104 A.style.fontFamily = "Verdana, sans-serif";
4105 A.href = this.template.getItemLink(B);
4106 ae(A, ct(B.name.substring(1)));
4107 ae(D, A);
4108 if (B.note) {
4109 var C = ce("div");
4110 C.className = "small";
4111 ae(C, ct(g_itemset_notes[B.note]));
4112 ae(D, C)
4113 }
4114 }
4115 },
4116 {
4117 id: "level",
4118 name: LANG.level,
4119 compute: function(A, B) {
4120 if (A.minlevel > 0 && A.maxlevel > 0) {
4121 if (A.minlevel != A.maxlevel) {
4122 return A.minlevel + LANG.hyphen + A.maxlevel
4123 } else {
4124 return A.minlevel
4125 }
4126 } else {
4127 return - 1
4128 }
4129 },
4130 sortFunc: function(B, A, C) {
4131 if (C > 0) {
4132 return strcmp(B.minlevel, A.minlevel) || strcmp(B.maxlevel, A.maxlevel)
4133 } else {
4134 return strcmp(B.maxlevel, A.maxlevel) || strcmp(B.minlevel, A.minlevel)
4135 }
4136 }
4137 },
4138 {
4139 id: "pieces",
4140 name: LANG.pieces,
4141 compute: function(A, B) {
4142 B.style.padding = "0";
4143 Listview.funcBox.createCenteredIcons(A.pieces, B)
4144 },
4145 sortFunc: function(B, A) {
4146 var D = (B.pieces != null ? B.pieces.length: 0);
4147 var C = (A.pieces != null ? A.pieces.length: 0);
4148 return strcmp(D, C)
4149 }
4150 },
4151 {
4152 id: "type",
4153 name: LANG.type,
4154 compute: function(A, B) {
4155 return g_itemset_types[A.type]
4156 },
4157 sortFunc: function(B, A, C) {
4158 return strcmp(g_itemset_types[B.type], g_itemset_types[A.type])
4159 }
4160 },
4161 {
4162 id: "classes",
4163 name: LANG.classes,
4164 compute: function(C, D) {
4165 if (C.classes != null) {
4166 for (var B = 0, A = C.classes.length; B < A; ++B) {
4167 if (B > 0) {
4168 ae(D, ct(LANG.comma))
4169 }
4170 ae(D, ct(g_chr_classes[C.classes[B]]))
4171 }
4172 }
4173 },
4174 sortFunc: function(B, A, C) {
4175 return Listview.funcBox.assocArrCmp(B.classes, A.classes, g_chr_classes)
4176 }
4177 }],
4178 getItemLink: function(A) {
4179 return "?itemset=" + A.id
4180 }
4181 },
4182 npc: {
4183 sort: [1],
4184 nItemsPerPage: 100,
4185 columns: [{
4186 id: "name",
4187 name: LANG.name,
4188 align: "left",
4189 value: "name",
4190 compute: function(B, D) {
4191 var A = ce("a");
4192 A.style.fontFamily = "Verdana, sans-serif";
4193 A.href = this.template.getItemLink(B);
4194 ae(A, ct(B.name));
4195 ae(D, A);
4196 if (B.tag != null) {
4197 var C = ce("div");
4198 C.className = "small";
4199 ae(C, ct("<" + B.tag + ">"));
4200 ae(D, C)
4201 }
4202 }
4203 },
4204 {
4205 id: "level",
4206 name: LANG.level,
4207 width: "10%",
4208 compute: function(A, C) {
4209 if (A.classification) {
4210 var B = ce("div");
4211 B.className = "small";
4212 ae(B, ct(g_npc_classifications[A.classification]));
4213 ae(C, B)
4214 }
4215 if (A.classification == 3) {
4216 return "??"
4217 }
4218 if (A.minlevel > 0 && A.maxlevel > 0) {
4219 if (A.minlevel != A.maxlevel) {
4220 return A.minlevel + LANG.hyphen + A.maxlevel
4221 } else {
4222 return A.minlevel
4223 }
4224 }
4225 return - 1
4226 },
4227 sortFunc: function(B, A, C) {
4228 if (C > 0) {
4229 return strcmp(B.minlevel, A.minlevel) || strcmp(B.maxlevel, A.maxlevel) || strcmp(B.classification, A.classification)
4230 } else {
4231 return strcmp(B.maxlevel, A.maxlevel) || strcmp(B.minlevel, A.minlevel) || strcmp(B.classification, A.classification)
4232 }
4233 }
4234 },
4235 {
4236 id: "location",
4237 name: LANG.location,
4238 compute: function(A, B) {
4239 return Listview.funcBox.location(A, B)
4240 },
4241 sortFunc: function(B, A, C) {
4242 return Listview.funcBox.assocArrCmp(B.location, A.location, g_zones)
4243 }
4244 },
4245 {
4246 id: "react",
4247 name: LANG.react,
4248 width: "10%",
4249 value: "react",
4250 compute: function(B, G) {
4251 if (B.react == null) {
4252 return - 1
4253 }
4254 var D = [LANG.lvnpc_alliance, LANG.lvnpc_horde];
4255 var C = "";
4256 var F = 0;
4257 for (var A = 0; A < 2; ++A) {
4258 if (B.react[A] != null) {
4259 if (F++>0) {
4260 ae(G, ct(" "))
4261 }
4262 var E = ce("span");
4263 E.className = (B.react[A] < 0 ? "q7": (B.react[A] > 0 ? "q2": "q"));
4264 ae(E, ct(D[A]));
4265 ae(G, E)
4266 }
4267 }
4268 }
4269 },
4270 {
4271 id: "petfamily",
4272 name: LANG.petfamily,
4273 width: "12%",
4274 compute: function(B, C) {
4275 C.className = "q1";
4276 var A = ce("a");
4277 A.href = "?spells=-3." + B.family;
4278 ae(A, ct(g_spell_skills[B.family]));
4279 ae(C, A)
4280 },
4281 sortFunc: function(B, A, C) {
4282 return strcmp(g_spell_skills[B.family], g_spell_skills[A.family])
4283 },
4284 hidden: 1
4285 },
4286 {
4287 id: "type",
4288 name: LANG.type,
4289 width: "12%",
4290 compute: function(B, C) {
4291 C.className = "small q1";
4292 var A = ce("a");
4293 A.href = "?npcs=" + B.type;
4294 ae(A, ct(g_npc_types[B.type]));
4295 ae(C, A)
4296 },
4297 sortFunc: function(B, A, C) {
4298 return strcmp(g_npc_types[B.type], g_npc_types[A.type])
4299 }
4300 }],
4301 getItemLink: function(A) {
4302 return "?npc=" + A.id
4303 }
4304 },
4305 object: {
4306 sort: [1],
4307 nItemsPerPage: 100,
4308 columns: [{
4309 id: "name",
4310 name: LANG.name,
4311 align: "left",
4312 value: "name",
4313 compute: function(B, C) {
4314 var A = ce("a");
4315 A.style.fontFamily = "Verdana, sans-serif";
4316 A.href = this.template.getItemLink(B);
4317 ae(A, ct(B.name));
4318 ae(C, A)
4319 }
4320 },
4321 {
4322 id: "location",
4323 name: LANG.location,
4324 compute: function(A, B) {
4325 return Listview.funcBox.location(A, B)
4326 },
4327 sortFunc: function(B, A, C) {
4328 return Listview.funcBox.assocArrCmp(B.location, A.location, g_zones)
4329 }
4330 },
4331 {
4332 id: "skill",
4333 name: LANG.skill,
4334 width: "10%",
4335 value: "skill",
4336 hidden: true
4337 },
4338 {
4339 id: "type",
4340 name: LANG.type,
4341 width: "12%",
4342 compute: function(B, C) {
4343 C.className = "small q1";
4344 var A = ce("a");
4345 A.href = "?objects=" + B.type;
4346 ae(A, ct(g_object_types[B.type]));
4347 ae(C, A)
4348 },
4349 sortFunc: function(B, A, C) {
4350 return strcmp(g_object_types[B.type], g_object_types[A.type])
4351 }
4352 }],
4353 getItemLink: function(A) {
4354 return "?object=" + A.id
4355 }
4356 },
4357 quest: {
4358 sort: [1, 2],
4359 nItemsPerPage: 100,
4360 columns: [{
4361 id: "name",
4362 name: LANG.name,
4363 align: "left",
4364 value: "name",
4365 compute: function(B, C) {
4366 var A = ce("a");
4367 A.style.fontFamily = "Verdana, sans-serif";
4368 A.href = this.template.getItemLink(B);
4369 ae(A, ct(B.name));
4370 ae(C, A)
4371 }
4372 },
4373 {
4374 id: "level",
4375 name: LANG.level,
4376 width: "7%",
4377 compute: function(A, C) {
4378 if (A.type || A.daily) {
4379 var B = ce("div");
4380 B.className = "small";
4381 B.style.whiteSpace = "nowrap";
4382 if (A.type && A.daily) {
4383 ae(B, ct(sprintf(LANG.lvquest_daily, g_quest_types[A.type])))
4384 } else {
4385 if (A.daily) {
4386 ae(B, ct(LANG.daily))
4387 } else {
4388 if (A.type) {
4389 ae(B, ct(g_quest_types[A.type]))
4390 }
4391 }
4392 }
4393 ae(C, B)
4394 }
4395 return A.level
4396 },
4397 sortFunc: function(B, A, C) {
4398 return strcmp(B.level, A.level) || strcmp(B.type, A.type) || strcmp(B.reqlevel, A.reqlevel)
4399 }
4400 },
4401 {
4402 id: "reqlevel",
4403 name: LANG.req,
4404 tooltip: LANG.tooltip_reqlevel,
4405 width: "7%",
4406 value: "reqlevel",
4407 sortFunc: function(B, A, C) {
4408 return strcmp(B.reqlevel, A.reqlevel) || strcmp(B.level, A.level)
4409 }
4410 },
4411 {
4412 id: "side",
4413 name: LANG.side,
4414 width: "10%",
4415 compute: function(A, C) {
4416 if (A.side) {
4417 var B = ce("span");
4418 if (A.side == 1) {
4419 B.className = "alliance-icon"
4420 } else {
4421 if (A.side == 2) {
4422 B.className = "horde-icon"
4423 }
4424 }
4425 ae(B, ct(g_sides[A.side]));
4426 ae(C, B)
4427 } else {
4428 return - 1
4429 }
4430 },
4431 sortFunc: function(B, A, C) {
4432 return strcmp(g_sides[B.side], g_sides[A.side])
4433 }
4434 },
4435 {
4436 id: "rewards",
4437 name: LANG.rewards,
4438 width: "25%",
4439 compute: function(B, F) {
4440 var A = (B.itemchoices != null || B.itemrewards != null);
4441 if (A) {
4442 F.style.padding = "0";
4443 var E,
4444 D;
4445 if (B.itemchoices && B.itemchoices.length > 1) {
4446 E = LANG.lvquest_pickone;
4447 if (B.itemrewards && B.itemrewards.length > 0) {
4448 D = LANG.lvquest_alsoget
4449 }
4450 }
4451 Listview.funcBox.createCenteredIcons(B.itemchoices, F, E);
4452 Listview.funcBox.createCenteredIcons(B.itemrewards, F, D)
4453 }
4454 if (B.xp > 0 || B.money > 0) {
4455 var C = ce("div");
4456 if (A) {
4457 C.style.padding = "4px"
4458 }
4459 if (B.xp > 0) {
4460 ae(C, ct(sprintf(LANG.lvquest_xp, B.xp) + (B.money > 0 ? " + ": "")))
4461 }
4462 if (B.money > 0) {
4463 Listview.funcBox.appendMoney(C, B.money)
4464 }
4465 ae(F, C)
4466 }
4467 },
4468 sortFunc: function(B, A, C) {
4469 var E = (B.itemchoices != null ? B.itemchoices.length: 0) + (B.itemrewards != null ? B.itemrewards.length: 0);
4470 var D = (A.itemchoices != null ? A.itemchoices.length: 0) + (A.itemrewards != null ? A.itemrewards.length: 0);
4471 return strcmp(E, D) || strcmp((B.xp | 0) + (B.money | 0), (A.xp | 0) + (A.money | 0))
4472 }
4473 },
4474 {
4475 id: "reputation",
4476 name: LANG.reputation,
4477 width: "14%",
4478 value: "id",
4479 hidden: true
4480 },
4481 {
4482 id: "category",
4483 name: LANG.category,
4484 width: "16%",
4485 compute: function(B, C) {
4486 if (B.category != 0) {
4487 C.className = "small q1";
4488 var A = ce("a");
4489 A.href = "?quests=" + B.category2 + "." + B.category;
4490 ae(A, ct(Listview.funcBox.getQuestCategory(B.category)));
4491 ae(C, A)
4492 }
4493 },
4494 sortFunc: function(B, A, D) {
4495 var C = Listview.funcBox.getQuestCategory;
4496 return strcmp(C(B.category), C(A.category))
4497 }
4498 }],
4499 getItemLink: function(A) {
4500 return "?quest=" + A.id
4501 }
4502 },
4503 spell: {
4504 sort: [1, 2],
4505 columns: [{
4506 id: "name",
4507 name: LANG.name,
4508 align: "left",
4509 span: 2,
4510 value: "name",
4511 compute: function(F, C, J) {
4512 var E = ce("td"),
4513 M;
4514 E.style.width = "44px";
4515 E.style.padding = "0";
4516 E.style.borderRight = "none";
4517 if (F.creates != null) {
4518 M = g_items.createIcon(F.creates[0], 1, Listview.funcBox.createTextRange(F.creates[1], F.creates[2]))
4519 } else {
4520 M = g_spells.createIcon(F.id, 1)
4521 }
4522 M.style.cssFloat = M.style.styleFloat = "left";
4523 ae(E, M);
4524 ae(J, E);
4525 C.style.borderLeft = "none";
4526 var A = ce("div");
4527 var L = ce("a");
4528 var I = F.name.charAt(0);
4529 if (I != "@") {
4530 L.className = "q" + (6 - parseInt(I))
4531 }
4532 L.style.fontFamily = "Verdana, sans-serif";
4533 L.href = this.template.getItemLink(F);
4534 ae(L, ct(F.name.substring(1)));
4535 ae(A, L);
4536 var B = F.talent != null && this._noTalents == null;
4537 if (F.rank != null || B) {
4538 var H = ce("div");
4539 H.className = "small2";
4540 var D = "";
4541 if (F.rank != null) {
4542 D += F.rank;
4543 if (B) {
4544 D += " "
4545 }
4546 }
4547 if (B) {
4548 D += "(Talent)"
4549 }
4550 ae(H, ct(D));
4551 ae(A, H)
4552 }
4553 if (F.races != null) {
4554 A.style.position = "relative";
4555 var H = ce("div");
4556 H.className = "small";
4557 H.style.fontStyle = "italic";
4558 H.style.position = "absolute";
4559 H.style.right = H.style.bottom = "3px";
4560 var K = F.races.toString();
4561 if (K == "1,3,4,7,11") {
4562 ae(H, ct(g_sides[1]))
4563 } else {
4564 if (K == "2,5,6,8,10") {
4565 ae(H, ct(g_sides[2]))
4566 } else {
4567 for (var E = 0, G = F.races.length; E < G; ++E) {
4568 if (E > 0) {
4569 ae(H, ct(LANG.comma))
4570 }
4571 ae(H, ct(g_chr_races[F.races[E]]))
4572 }
4573 }
4574 }
4575 ae(A, H)
4576 }
4577 ae(C, A)
4578 }
4579 },
4580 {
4581 id: "level",
4582 name: LANG.level,
4583 width: "10%",
4584 value: "level",
4585 compute: function(A, B) {
4586 if (A.level > 0) {
4587 return A.level
4588 }
4589 },
4590 hidden: true
4591 },
4592 {
4593 id: "school",
4594 name: LANG.school,
4595 width: "10%",
4596 hidden: true,
4597 compute: function(A, B) {
4598 return g_spell_resistances[A.school]
4599 },
4600 sortFunc: function(B, A, C) {
4601 return strcmp(g_spell_resistances[B.school], g_spell_resistances[A.school])
4602 }
4603 },
4604 {
4605 id: "reagents",
4606 name: LANG.reagents,
4607 align: "left",
4608 width: "15%",
4609 compute: function(F, C) {
4610 var A = (F.reagents != null);
4611 if (A) {
4612 C.style.padding = "0";
4613 var H = ce("div");
4614 var I = F.reagents;
4615 H.style.width = (44 * I.length) + "px";
4616 for (var D = 0, G = I.length; D < G; ++D) {
4617 var B = I[D][0];
4618 var E = I[D][1];
4619 var J = g_items.createIcon(B, 1, E);
4620 J.style.cssFloat = J.style.styleFloat = "left";
4621 ae(H, J)
4622 }
4623 ae(C, H)
4624 }
4625 },
4626 sortFunc: function(B, A) {
4627 var D = (B.reagents != null ? B.reagents.length: 0);
4628 var C = (A.reagents != null ? A.reagents.length: 0);
4629 if (D > 0 && D == C) {
4630 return strcmp(B.reagents.toString(), A.reagents.toString())
4631 } else {
4632 return strcmp(D, C)
4633 }
4634 }
4635 },
4636 {
4637 id: "tp",
4638 name: LANG.tp,
4639 tooltip: LANG.tooltip_trainingpoints,
4640 width: "7%",
4641 hidden: true,
4642 value: "tp",
4643 compute: function(A, B) {
4644 if (A.tp > 0) {
4645 return A.tp
4646 }
4647 }
4648 },
4649 {
4650 id: "source",
4651 name: LANG.source,
4652 width: "12%",
4653 hidden: true,
4654 compute: function(B, D) {
4655 if (B.source != null) {
4656 for (var C = 0, A = B.source.length; C < A; ++C) {
4657 if (C > 0) {
4658 ae(D, ct(LANG.comma))
4659 }
4660 ae(D, ct(g_sources[B.source[C]]))
4661 }
4662 }
4663 },
4664 sortFunc: function(B, A, C) {
4665 return Listview.funcBox.assocArrCmp(B.source, A.source, g_sources)
4666 }
4667 },
4668 {
4669 id: "skill",
4670 name: LANG.skill,
4671 width: "16%",
4672 compute: function(E, C) {
4673 if (E.skill != null) {
4674 var B = ce("div");
4675 B.className = "small";
4676 for (var D = 0, G = E.skill.length; D < G; ++D) {
4677 if (D > 0) {
4678 ae(B, ct(LANG.comma))
4679 }
4680 if (E.skill[D] == -1) {
4681 ae(B, ct(LANG.ellipsis))
4682 } else {
4683 if (in_array([7, -2, -3, 11, 9], E.cat) != -1) {
4684 var H = ce("a");
4685 H.className = "q1";
4686 H.href = "?spells=" + E.cat + "." + (E.chrclass ? E.chrclass + ".": "") + E.skill[D];
4687 ae(H, ct(g_spell_skills[E.skill[D]]));
4688 ae(B, H)
4689 } else {
4690 ae(B, ct(g_spell_skills[E.skill[D]]))
4691 }
4692 }
4693 }
4694 if (E.learnedat > 0) {
4695 ae(B, ct(" ("));
4696 var F = ce("span");
4697 if (E.learnedat == 9999) {
4698 F.className = "q0";
4699 ae(F, ct("??"))
4700 } else {
4701 if (E.learnedat > 0) {
4702 ae(F, ct(E.learnedat));
4703 F.style.fontWeight = "bold"
4704 }
4705 }
4706 ae(B, F);
4707 ae(B, ct(")"))
4708 }
4709 ae(C, B);
4710 if (E.colors != null) {
4711 var A = E.colors,
4712 I = 0;
4713 for (var D = 0; D < A.length; ++D) {
4714 if (A[D] > 0) {++I;
4715 break
4716 }
4717 }
4718 if (I > 0) {
4719 I = 0;
4720 B = ce("div");
4721 B.className = "small";
4722 B.style.fontWeight = "bold";
4723 for (var D = 0; D < A.length; ++D) {
4724 if (A[D] > 0) {
4725 if (I++>0) {
4726 ae(B, ct(" "))
4727 }
4728 var J = ce("span");
4729 J.className = "r" + (D + 1);
4730 ae(J, ct(A[D]));
4731 ae(B, J)
4732 }
4733 }
4734 ae(C, B)
4735 }
4736 }
4737 }
4738 },
4739 sortFunc: function(B, A) {
4740 var D = strcmp(B.learnedat, A.learnedat);
4741 if (D != 0) {
4742 return D
4743 }
4744 if (B.colors != null && A.colors != null) {
4745 for (var C = 0; C < 4; ++C) {
4746 D = strcmp(B.colors[C], A.colors[C]);
4747 if (D != 0) {
4748 return D
4749 }
4750 }
4751 }
4752 return Listview.funcBox.assocArrCmp(B.skill, A.skill, g_spell_skills)
4753 }
4754 }],
4755 getItemLink: function(A) {
4756 return "?spell=" + A.id
4757 }
4758 },
4759 zone: {
4760 sort: [1],
4761 nItemsPerPage: -1,
4762 columns: [{
4763 id: "name",
4764 name: LANG.name,
4765 align: "left",
4766 value: "name",
4767 compute: function(B, D) {
4768 var A = ce("a");
4769 A.style.fontFamily = "Verdana, sans-serif";
4770 A.href = this.template.getItemLink(B);
4771 ae(A, ct(B.name));
4772 if (B.expansion == 1) {
4773 var C = ce("span");
4774 C.className = "bc-icon";
4775 ae(C, A);
4776 ae(D, C)
4777 } else {
4778 ae(D, A)
4779 }
4780 }
4781 },
4782 {
4783 id: "level",
4784 name: LANG.level,
4785 width: "10%",
4786 compute: function(A, B) {
4787 if (A.minlevel > 0 && A.maxlevel > 0) {
4788 if (A.minlevel != A.maxlevel) {
4789 return A.minlevel + LANG.hyphen + A.maxlevel
4790 } else {
4791 return A.minlevel
4792 }
4793 }
4794 },
4795 sortFunc: function(B, A, C) {
4796 if (C > 0) {
4797 return strcmp(B.minlevel, A.minlevel) || strcmp(B.maxlevel, A.maxlevel)
4798 } else {
4799 return strcmp(B.maxlevel, A.maxlevel) || strcmp(B.minlevel, A.minlevel)
4800 }
4801 }
4802 },
4803 {
4804 id: "territory",
4805 name: LANG.territory,
4806 width: "13%",
4807 compute: function(A, C) {
4808 var B = ce("span");
4809 switch (A.territory) {
4810 case 0:
4811 B.className = "alliance-icon";
4812 break;
4813 case 1:
4814 B.className = "horde-icon";
4815 break;
4816 case 4:
4817 B.className = "ffapvp-icon";
4818 break
4819 }
4820 ae(B, ct(g_zone_territories[A.territory]));
4821 ae(C, B)
4822 },
4823 sortFunc: function(B, A, C) {
4824 return strcmp(g_zone_territories[B.territory], g_zone_territories[A.territory])
4825 }
4826 },
4827 {
4828 id: "instancetype",
4829 name: LANG.instancetype,
4830 compute: function(A, D) {
4831 if (A.instance > 0) {
4832 var B = ce("span");
4833 if (A.instance >= 1 && A.instance <= 5) {
4834 B.className = "instance-icon" + A.instance
4835 }
4836 var C = g_zone_instancetypes[A.instance];
4837 if (A.nplayers > 0 && ((A.instance != 2 && A.instance != 5) || A.nplayers > 5)) {
4838 C += " (";
4839 if (A.instance == 4) {
4840 C += sprintf(LANG.lvzone_xvx, A.nplayers, A.nplayers)
4841 } else {
4842 C += sprintf(LANG.lvzone_xman, A.nplayers)
4843 }
4844 C += ")"
4845 }
4846 ae(B, ct(C));
4847 ae(D, B)
4848 }
4849 },
4850 sortFunc: function(B, A, C) {
4851 return strcmp(g_zone_instancetypes[B.instance], g_zone_instancetypes[A.instance]) || strcmp(B.instance, A.instance) || strcmp(B.nplayers, A.nplayers)
4852 }
4853 },
4854 {
4855 id: "category",
4856 name: LANG.category,
4857 width: "15%",
4858 compute: function(B, C) {
4859 C.className = "small q1";
4860 var A = ce("a");
4861 A.href = "?zones=" + B.category;
4862 ae(A, ct(g_zone_categories[B.category]));
4863 ae(C, A)
4864 },
4865 sortFunc: function(B, A, C) {
4866 return strcmp(g_zone_categories[B.category], g_zone_categories[A.category])
4867 }
4868 }],
4869 getItemLink: function(A) {
4870 return "?zone=" + A.id
4871 }
4872 },
4873 comment: {
4874 sort: [1],
4875 mode: 2,
4876 nItemsPerPage: 40,
4877 poundable: 2,
4878 columns: [{
4879 value: "number"
4880 },
4881 {
4882 value: "id"
4883 },
4884 {
4885 value: "rating"
4886 }],
4887 compute: function(A, R) {
4888 var l,
4889 h = new Date(A.date),
4890 F = (g_serverTime - h) / 1000,
4891 j = (g_user.roles & 26) != 0,
4892 I = A.rating < 0 || A.purged || A.deleted,
4893 X = j || A.user.toLowerCase() == g_user.name.toLowerCase(),
4894 K = X && A.deleted == 0,
4895 G = X && A.replyTo != A.id,
4896 g = A.purged == 0 && A.deleted == 0 && g_user.id && A.user.toLowerCase() != g_user.name.toLowerCase() && in_array(A.raters, g_user.id,
4897 function(n) {
4898 return n[0]
4899 }) == -1,
4900 m = A.rating >= 0 && (g_user.id == 0 || g);
4901 A.ratable = g;
4902 R.className = "comment";
4903 if (A.indent) {
4904 R.className += " comment-indent"
4905 }
4906 var V = ce("div");
4907 var N = ce("div");
4908 var Q = ce("div");
4909 A.divHeader = V;
4910 A.divBody = N;
4911 A.divLinks = Q;
4912 V.className = (I ? "comment-header-bt": "comment-header");
4913 var L = ce("div");
4914 L.className = "comment-rating";
4915 if (I) {
4916 var J = ce("a");
4917 J.href = "javascript:;";
4918 J.onclick = Listview.funcBox.coToggleVis.bind(J, A);
4919 ae(J, ct(LANG.lvcomment_show));
4920 ae(L, J);
4921 ae(L, ct(" " + String.fromCharCode(160) + " "))
4922 }
4923 var C = ce("b");
4924 ae(C, ct(LANG.lvcomment_rating));
4925 var U = ce("span");
4926 ae(U, ct((A.rating > 0 ? "+": "") + A.rating));
4927 ae(C, U);
4928 ae(L, C);
4929 ae(L, ct(" "));
4930 var O = ce("span");
4931 var i = ce("a"),
4932 H = ce("a");
4933 if (g) {
4934 i.href = H.href = "javascript:;";
4935 i.onclick = Listview.funcBox.coRate.bind(i, A, 1);
4936 H.onclick = Listview.funcBox.coRate.bind(H, A, -1);
4937 if (j) {
4938 var W = ce("a");
4939 W.href = "javascript:;";
4940 W.onclick = Listview.funcBox.coRate.bind(W, A, 0);
4941 W.onmouseover = Listview.funcBox.coCustomRatingOver;
4942 W.onmousemove = Tooltip.cursorUpdate;
4943 W.onmouseout = Tooltip.hide;
4944 ae(W, ct("[~]"));
4945 ae(O, W);
4946 ae(O, ct(" "))
4947 }
4948 } else {
4949 i.href = H.href = "?account=signin"
4950 }
4951 ae(i, ct("[+]"));
4952 i.onmouseover = Listview.funcBox.coPlusRatingOver;
4953 H.onmouseover = Listview.funcBox.coMinusRatingOver;
4954 i.onmousemove = H.onmousemove = Tooltip.cursorUpdate;
4955 i.onmouseout = H.onmouseout = Tooltip.hide;
4956 ae(H, ct("[-]"));
4957 ae(O, H);
4958 ae(O, ct(" "));
4959 ae(O, i);
4960 ae(L, O);
4961 if (!m) {
4962 O.style.display = "none"
4963 }
4964 ae(V, L);
4965 ae(V, ct(LANG.lvcomment_by));
4966 var B = ce("a");
4967 B.href = "?user=" + A.user;
4968 ae(B, ct(A.user));
4969 ae(V, B);
4970 ae(V, ct(" "));
4971 var M = ce("a");
4972 M.className = "q0";
4973 M.href = "#comments:id=" + A.id;
4974 Listview.funcBox.coFormatDate(M, F, h);
4975 M.style.cursor = "pointer";
4976 ae(V, M);
4977 ae(V, ct(LANG.lvcomment_patch1 + g_getPatchVersion(h) + LANG.lvcomment_patch2));
4978 ae(R, V);
4979 N.className = "comment-body" + Listview.funcBox.coGetColor(A);
4980 if (A.indent) {
4981 N.className += " comment-body-indent"
4982 }
4983 N.innerHTML = Markup.toHtml(A.body, {
4984 mode: Markup.MODE_COMMENT
4985 });
4986 ae(R, N);
4987 if ((A.roles & 26) == 0 || g_user.roles & 26) {
4988 var e = ce("div");
4989 A.divLastEdit = e;
4990 e.className = "comment-lastedit";
4991 ae(e, ct(LANG.lvcomment_lastedit));
4992 var Z = ce("a");
4993 ae(Z, ct(" "));
4994 ae(e, Z);
4995 ae(e, ct(" "));
4996 var a = ce("span");
4997 ae(e, a);
4998 ae(e, ct(" "));
4999 Listview.funcBox.coUpdateLastEdit(A);
5000 if (I) {
5001 e.style.display = "none"
5002 }
5003 ae(R, e)
5004 }
5005 Q.className = "comment-links";
5006 if (X) {
5007 var E = ce("span");
5008 var Y = ce("a");
5009 ae(Y, ct(LANG.lvcomment_edit));
5010 Y.onclick = Listview.funcBox.coEdit.bind(this, A, 0);
5011 ns(Y);
5012 Y.href = "javascript:;";
5013 ae(E, Y);
5014 ae(E, ct("|"));
5015 ae(Q, E)
5016 }
5017 if (K) {
5018 var k = ce("span");
5019 var P = ce("a");
5020 ae(P, ct(LANG.lvcomment_delete));
5021 P.onclick = Listview.funcBox.coDelete.bind(this, A);
5022 ns(P);
5023 P.href = "javascript:;";
5024 ae(k, P);
5025 ae(k, ct("|"));
5026 ae(Q, k)
5027 }
5028 if (G) {
5029 var D = ce("span");
5030 var T = ce("a");
5031 ae(T, ct(LANG.lvcomment_detach));
5032 T.onclick = Listview.funcBox.coDetach.bind(this, A);
5033 ns(T);
5034 T.href = "javascript:;";
5035 ae(D, T);
5036 ae(D, ct("|"));
5037 ae(Q, D)
5038 }
5039 var S = ce("a");
5040 ae(S, ct(LANG.lvcomment_reply));
5041 if (g_user.id > 0) {
5042 S.onclick = Listview.funcBox.coReply.bind(this, A);
5043 S.href = "javascript:;"
5044 } else {
5045 S.href = "?account=signin"
5046 }
5047 ae(Q, S);
5048 if (I) {
5049 N.style.display = "none";
5050 Q.style.display = "none"
5051 }
5052 ae(R, Q)
5053 },
5054 createNote: function(F) {
5055 var E = ce("small");
5056 var A = ce("a");
5057 if (g_user.id > 0) {
5058 A.href = "javascript:;";
5059 A.onclick = co_addYourComment
5060 } else {
5061 A.href = "?account=signin"
5062 }
5063 ae(A, ct(LANG.lvcomment_add));
5064 ae(E, A);
5065 var D = ce("span");
5066 D.style.padding = "0 5px";
5067 D.style.color = "white";
5068 ae(D, ct("|"));
5069 ae(E, D);
5070 ae(E, ct(LANG.lvcomment_sort));
5071 var C = ce("a");
5072 C.href = "javascript:;";
5073 ae(C, ct(LANG.lvcomment_sortdate));
5074 C.onclick = Listview.funcBox.coSortDate.bind(this, C);
5075 ae(E, C);
5076 ae(E, ct(LANG.comma));
5077 var B = ce("a");
5078 B.href = "javascript:;";
5079 ae(B, ct(LANG.lvcomment_sortrating));
5080 B.onclick = Listview.funcBox.coSortHighestRatedFirst.bind(this, B);
5081 ae(E, B);
5082 C.onclick();
5083 ae(F, E)
5084 },
5085 onNoData: function(C) {
5086 if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) {
5087 var A = "<b>" + LANG.lvnodata_co1 + "</b><br /><br />";
5088 if (g_user.id > 0) {
5089 var B = LANG.lvnodata_co2;
5090 B = B.replace("<a>", '<a href="javascript:;" onclick="co_addYourComment()" onmousedown="return false">');
5091 A += B
5092 } else {
5093 var B = LANG.lvnodata_co3;
5094 B = B.replace("<a>", '<a href="?account=signin">');
5095 B = B.replace("<a>", '<a href="?account=signup">');
5096 A += B
5097 }
5098 C.style.padding = "1.5em 0";
5099 C.innerHTML = A
5100 }
5101 },
5102 onBeforeCreate: function() {
5103 if (location.hash.match(/:id=([0-9]+)/) != null) {
5104 var A = in_array(this.data, parseInt(RegExp.$1),
5105 function(B) {
5106 return B.id
5107 });
5108 this.rowOffset = this.getRowOffset(A);
5109 return this.data[A]
5110 }
5111 },
5112 onAfterCreate: function(A) {
5113 if (A != null) {
5114 var B = A.__div;
5115 this.tabs.__st = B;
5116 B.firstChild.style.border = "1px solid #505050"
5117 }
5118 }
5119 },
5120 commentpreview: {
5121 sort: [3],
5122 nItemsPerPage: 75,
5123 columns: [{
5124 id: "subject",
5125 name: LANG.subject,
5126 align: "left",
5127 value: "subject",
5128 compute: function(D, C) {
5129 var A = ce("a");
5130 A.style.fontFamily = "Verdana, sans-serif";
5131 A.href = this.template.getItemLink(D);
5132 ae(A, ct(D.subject));
5133 ae(C, A);
5134 var B = ce("div");
5135 B.className = "small";
5136 ae(B, ct(LANG.types[D.type][0]));
5137 ae(C, B)
5138 }
5139 },
5140 {
5141 id: "preview",
5142 name: LANG.preview,
5143 align: "left",
5144 width: "50%",
5145 value: "preview",
5146 compute: function(H, G) {
5147 var E = ce("div");
5148 E.className = "crop";
5149 if (H.rating >= 10) {
5150 E.className += " comment-green"
5151 }
5152 ae(E, ct(Markup.removeTags(H.preview, {
5153 mode: (H.rating != null ? Markup.MODE_COMMENT: Markup.MODE_ARTICLE)
5154 })));
5155 ae(G, E);
5156 var A = H.rating != null;
5157 var D = H.user != null;
5158 if (A || D) {
5159 E = ce("div");
5160 E.className = "small3";
5161 if (D) {
5162 ae(E, ct(LANG.lvcomment_by));
5163 var B = ce("a");
5164 B.href = "?user=" + H.user;
5165 ae(B, ct(H.user));
5166 ae(E, B);
5167 if (A) {
5168 ae(E, ct(LANG.hyphen))
5169 }
5170 }
5171 if (A) {
5172 ae(E, ct(LANG.lvcomment_rating + (H.rating > 0 ? "+": "") + H.rating));
5173 var C = ce("span"),
5174 F = "";
5175 C.className = "q7";
5176 if (H.deleted) {
5177 F = " (Deleted)"
5178 } else {
5179 if (H.purged) {
5180 F = " (Purged)"
5181 }
5182 }
5183 ae(C, ct(F));
5184 ae(E, C)
5185 }
5186 ae(G, E)
5187 }
5188 }
5189 },
5190 {
5191 id: "posted",
5192 name: LANG.posted,
5193 width: "16%",
5194 value: "elapsed",
5195 compute: function(E, D) {
5196 var B = new Date(E.date),
5197 A = (g_serverTime - B) / 1000;
5198 var C = ce("span");
5199 Listview.funcBox.coFormatDate(C, A, B, 0, 1);
5200 ae(D, C)
5201 }
5202 }],
5203 getItemLink: function(A) {
5204 return "?" + g_types[A.type] + "=" + A.typeId + (A.id != null ? "#comments:id=" + A.id: "")
5205 }
5206 },
5207 screenshot: {
5208 sort: [],
5209 mode: 3,
5210 nItemsPerPage: 40,
5211 nItemsPerRow: 4,
5212 poundable: 2,
5213 columns: [],
5214 compute: function(J, C, E) {
5215 var N,
5216 G = new Date(J.date),
5217 O = (g_serverTime - G) / 1000;
5218 C.className = "screenshot-cell";
5219 C.vAlign = "bottom";
5220 var M = ce("a");
5221 M.href = "#screenshots:id=" + J.id;
5222 M.onclick = rf2;
5223 var F = ce("img"),
5224 B = Math.min(150 / J.width, 150 / J.height);
5225 F.src = "http://upload.wowhead.com/images/screenshots/thumb/" + J.id + ".jpg";
5226 F.width = parseInt(B * J.width);
5227 F.height = parseInt(B * J.height);
5228 ae(M, F);
5229 ae(C, M);
5230 var I = ce("div");
5231 I.className = "screenshot-cell-user";
5232 var P = (J.user != null && J.user.length);
5233 if (P) {
5234 M = ce("a");
5235 M.href = "?user=" + J.user;
5236 ae(M, ct(J.user));
5237 ae(I, ct(LANG.lvscreenshot_from));
5238 ae(I, M);
5239 ae(I, ct(" "))
5240 }
5241 var Q = ce("span");
5242 if (P) {
5243 Listview.funcBox.coFormatDate(Q, O, G)
5244 } else {
5245 Listview.funcBox.coFormatDate(Q, O, G, 0, 1)
5246 }
5247 ae(I, Q);
5248 ae(C, I);
5249 I = ce("div");
5250 I.style.position = "relative";
5251 I.style.height = "1em";
5252 if (g_locale.id != 0 && g_locale.id != 25 && J.caption) {
5253 J.caption = ""
5254 }
5255 var H = (J.caption != null && J.caption.length);
5256 var D = (J.subject != null && J.subject.length);
5257 if (H || D) {
5258 var A = ce("div");
5259 A.className = "screenshot-caption";
5260 if (D) {
5261 var L = ce("small");
5262 ae(L, ct(LANG.types[J.type][0] + LANG.colon));
5263 var K = ce("a");
5264 ae(K, ct(J.subject));
5265 K.href = "?" + g_types[J.type] + "=" + J.typeId;
5266 ae(L, K);
5267 ae(A, L);
5268 if (H && J.caption.length) {
5269 ae(L, ct(" (...)"))
5270 }
5271 ae(L, ce("br"))
5272 }
5273 if (H) {
5274 aE(C, "mouseover", Listview.funcBox.ssCellOver.bind(A));
5275 aE(C, "mouseout", Listview.funcBox.ssCellOut.bind(A));
5276 ae(A, ct('"' + J.caption + '"'))
5277 }
5278 ae(I, A)
5279 }
5280 aE(C, "click", Listview.funcBox.ssCellClick.bind(this, E));
5281 ae(C, I)
5282 },
5283 createNote: function(C) {
5284 if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) {
5285 var B = ce("small");
5286 var A = ce("a");
5287 if (g_user.id > 0) {
5288 A.href = "javascript:;";
5289 A.onclick = ss_submitAScreenshot
5290 } else {
5291 A.href = "?account=signin"
5292 }
5293 ae(A, ct(LANG.lvscreenshot_submit));
5294 ae(B, A);
5295 ae(C, B)
5296 }
5297 },
5298 onNoData: function(C) {
5299 if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) {
5300 var A = "<b>" + LANG.lvnodata_ss1 + "</b><br /><br />";
5301 if (g_user.id > 0) {
5302 var B = LANG.lvnodata_ss2;
5303 B = B.replace("<a>", '<a href="javascript:;" onclick="ss_submitAScreenshot()" onmousedown="return false">');
5304 A += B
5305 } else {
5306 var B = LANG.lvnodata_ss3;
5307 B = B.replace("<a>", '<a href="?account=signin">');
5308 B = B.replace("<a>", '<a href="?account=signup">');
5309 A += B
5310 }
5311 C.style.padding = "1.5em 0";
5312 C.innerHTML = A
5313 } else {
5314 return - 1
5315 }
5316 },
5317 onBeforeCreate: function() {
5318 if (location.hash.match(/:id=([0-9]+)/) != null) {
5319 var A = in_array(this.data, parseInt(RegExp.$1),
5320 function(B) {
5321 return B.id
5322 });
5323 this.rowOffset = this.getRowOffset(A);
5324 return A
5325 }
5326 },
5327 onAfterCreate: function(A) {
5328 if (A != null) {
5329 setTimeout((function() {
5330 ScreenshotViewer.show({
5331 screenshots: this.data,
5332 pos: A
5333 })
5334 }).bind(this), 1)
5335 }
5336 }
5337 }
5338};
5339Menu.fixUrls(mn_items, "?items=");
5340Menu.fixUrls(mn_itemSets, "?itemsets&filter=cl=");
5341Menu.fixUrls(mn_npcs, "?npcs=");
5342Menu.fixUrls(mn_objects, "?objects=");
5343Menu.fixUrls(mn_quests, "?quests=");
5344Menu.fixUrls(mn_spells, "?spells=");
5345Menu.fixUrls(mn_zones, "?zones=");
5346Menu.fixUrls(mn_talentCalc, "?talent=");
5347Menu.fixUrls(mn_forums, "?forums&board=", true);
5348var g_locale = {
5349 id: 0,
5350 name: "enus"
5351};
5352var g_localTime = new Date();
5353var g_user = {
5354 id: 0,
5355 name: "",
5356 roles: 0
5357};
5358var g_items = [];
5359var g_quests = [];
5360var g_spells = [];
5361var g_users = [];
5362var g_types = {
5363 1: "npc",
5364 2: "object",
5365 3: "item",
5366 4: "itemset",
5367 5: "quest",
5368 6: "spell",
5369 7: "zone",
5370 8: "faction"
5371};
5372var g_locales = {
5373 0: "enus",
5374 2: "frfr",
5375 3: "dede",
5376 6: "eses",
5377 25: "wotlk"
5378};
5379var g_customColors = {
5380 Miyari: "pink"
5381};
5382g_items.getIcon = function(A) {
5383 if (g_items[A] != null) {
5384 return g_items[A].icon
5385 } else {
5386 return "temp"
5387 }
5388};
5389g_items.createIcon = function(D, B, A, C) {
5390 return Icon.create(g_items.getIcon(D), B, null, "?item=" + D, A, C)
5391};
5392g_spells.getIcon = function(A) {
5393 if (g_spells[A] != null) {
5394 return g_spells[A].icon
5395 } else {
5396 return "temp"
5397 }
5398};
5399g_spells.createIcon = function(D, B, A, C) {
5400 return Icon.create(g_spells.getIcon(D), B, null, "?spell=" + D, A, C)
5401};
5402var $WowheadPower = new
5403function() {
5404 var V,
5405 a,
5406 L, // language
5407 T,
5408 F,
5409 J,
5410 H,
5411 R = 0,
5412 i = 0,
5413 K = 1,
5414 E = 2,
5415 M = 3,
5416 N = 4,
5417 G = 3,
5418 O = 5,
5419 g = 6,
5420 j = 15,
5421 W = 15,
5422 S = {
5423 3: [g_items, "item"],
5424 5: [g_quests, "quest"],
5425 6: [g_spells, "spell"]
5426 };
5427 function Z() {
5428 aE(document, "mouseover", U)
5429 }
5430 function A(k) {
5431 var l = g_getCursorPos(k);
5432 J = l.x;
5433 H = l.y
5434 }
5435 function e(u, q) {
5436 if (u.nodeName != "A") {
5437 return - 2323
5438 }
5439 if (!u.href.length) {
5440 return
5441 }
5442 var o,
5443 n,
5444 l,
5445 k;
5446 n = 2;
5447 l = 3;
5448// if (u.href.indexOf("http://") == 0) {
5449// o = 1;
5450// k = u.href.match(/http:\/\/(www|dev|fr|es|de|wotlk)?\.?wowhead\.com\/\?(item|quest|spell)=([0-9]+)/)
5451// } else {
5452 k = u.href.match(/()\?(item|quest|spell)=([0-9]+)/)
5453// }
5454 if (k == null && u.rel) {
5455 o = 0;
5456 n = 1;
5457 l = 2;
5458 k = u.rel.match(/(item|quest|spell).?([0-9]+)/)
5459 }
5460 if (k) {
5461// var s,
5462// p = "www";
5463// if (o && k[o]) {
5464// p = k[o]
5465// } else {
5466// var r = location.hostname.match(/(www|dev|fr|es|de|wotlk)\.?wowhead\.com/);
5467// if (r != null) {
5468// p = r[1]
5469// }
5470// }
5471// s = g_getLocaleFromDomain(p);
5472// T = p;
5473 s = 0;
5474 F = u;
5475 if (u.href.indexOf("#") != -1 && document.location.href.indexOf(k[n] + "=" + k[l]) != -1) {
5476 return
5477 }
5478 R = (u.parentNode.className == "tile" ? 1: 0);
5479 if (!u.onmouseout) {
5480 if (R == 0) {
5481 u.onmousemove = Q
5482 }
5483 u.onmouseout = P
5484 }
5485 A(q);
5486 Y(g_getIdFromTypeName(k[n]), k[l], s)
5487 }
5488 }
5489 function U(m) {
5490 m = $E(m);
5491 var l = m._target;
5492 var k = 0;
5493 while (l != null && k < 3 && e(l, m) == -2323) {
5494 l = l.parentNode; ++k
5495 }
5496 }
5497 function Q(k) {
5498 k = $E(k);
5499 A(k);
5500 Tooltip.move(J, H, 0, 0, j, W)
5501 }
5502 function P() {
5503 V = null;
5504 F = null;
5505 Tooltip.hide()
5506 }
5507 function X(k) {
5508 return "tooltip"
5509 }
5510 function h(m, n, l) {
5511 var k = S[m][0];
5512 if (k[n] == null) {
5513 k[n] = {}
5514 }
5515 if (k[n].status == null) {
5516 k[n].status = {}
5517 }
5518 if (k[n].status[l] == null) {
5519 k[n].status[l] = i
5520 }
5521 }
5522 function Y(m, n, l) {
5523 // m - type ('item', etc)
5524 // n - id
5525 // l - language
5526 V = m;
5527 a = n;
5528 L = l;
5529 h(m, n, l);
5530 var k = S[m][0];
5531 if (k[n].status[l] == N || k[n].status[l] == M) {
5532 C(k[n][X(l)], k[n].icon)
5533 } else {
5534 if (k[n].status[l] == K) {
5535 C(LANG.tooltip_loading)
5536 } else {
5537 D(m, n, l)
5538 }
5539 }
5540 }
5541 function D(n, o, l, m) {
5542 var k = S[n][0];
5543 if (k[o].status[l] != i && k[o].status[l] != E) {
5544 return
5545 }
5546 k[o].status[l] = K;
5547 if (!m) {
5548 k[o].timer = setTimeout(function() {
5549 B.apply(this, [n, o, l])
5550 },
5551 333)
5552 }
5553 g_ajaxIshRequest("ajax.php?" + S[n][1] + "=" + o)
5554 }
5555 function C(k, l) {
5556 if (F._fixTooltip) {
5557 k = F._fixTooltip(k, V, a, F)
5558 }
5559// if (!k) {
5560// k = LANG["tooltip_" + g_types[V] + "notfound"];
5561// l = "Temp"
5562// }
5563 if (R == 1) {
5564 Tooltip.setIcon(null);
5565 Tooltip.show(F, k, 0, 0)
5566 } else {
5567 Tooltip.setIcon(l);
5568 Tooltip.showAtXY(k, J, H, j, W)
5569 }
5570 }
5571 function B(m, n, l) {
5572 if (V == m && a == n && L == l) {
5573 C(LANG.tooltip_loading);
5574 var k = S[m][0];
5575 k[n].timer = setTimeout(function() {
5576 I.apply(this, [m, n, l])
5577 },
5578 3850)
5579 }
5580 }
5581 function I(m, n, l) {
5582 var k = S[m][0];
5583 k[n].status[l] = E;
5584 if (V == m && a == n && L == l) {
5585 C(LANG.tooltip_noresponse)
5586 }
5587 }
5588 this.register = function(n, o, l, m) {
5589 var k = S[n][0];
5590 clearTimeout(k[o].timer);
5591 cO(k[o], m);
5592 if (k[o][X(l)]) {
5593 k[o].status[l] = N
5594 } else {
5595 k[o].status[l] = M
5596 }
5597 if (V == n && o == a && L == l) {
5598 C(k[o][X(l)], k[o].icon)
5599 }
5600 };
5601 this.registerItem = function(m, k, l) {
5602 this.register(G, m, k, l)
5603 };
5604 this.registerQuest = function(m, k, l) {
5605 this.register(O, m, k, l)
5606 };
5607 this.registerSpell = function(m, k, l) {
5608 this.register(g, m, k, l)
5609 };
5610 this.request = function(l, m, k) {
5611 h(l, m, k);
5612 D(l, m, k, 1)
5613 };
5614 this.requestItem = function(k) {
5615 this.request(G, g_locale.id, k)
5616 };
5617 this.requestSpell = function(k) {
5618 this.request(g, g_locale.id, k)
5619 };
5620 this.getStatus = function(m, n, l) {
5621 var k = S[m][0];
5622 if (k[n] != null) {
5623 return k[n].status[l]
5624 } else {
5625 return i
5626 }
5627 };
5628 this.getItemStatus = function(l, k) {
5629 this.getStatus(G, l, k)
5630 };
5631 this.requestSpell = function(l, k) {
5632 this.getStatus(g, l, k)
5633 };
5634 Z()
5635};
5636
5637LiveSearch = new
5638function() {
5639 var currentTextbox,
5640 lastSearch = {},
5641 lastDiv,
5642 timer,
5643 prepared,
5644 container,
5645 cancelNext,
5646 hasData;
5647 function setText(textbox, txt) {
5648 textbox.value = txt;
5649 textbox.selectionStart = textbox.selectionEnd = txt.length
5650 }
5651 function colorDiv(div, fromOver) {
5652 if (lastDiv) {
5653 lastDiv.className = lastDiv.className.replace("live-search-selected", "")
5654 }
5655 lastDiv = div;
5656 lastDiv.className += " live-search-selected";
5657 if (!fromOver) {
5658 show();
5659 setTimeout(setText.bind(0, currentTextbox, g_getTextContent(div.firstChild.firstChild.childNodes[1])), 1);
5660 cancelNext = 1
5661 }
5662 }
5663 function aOver() {
5664 colorDiv(this.parentNode.parentNode, 1)
5665 }
5666 function isVisible() {
5667 if (!container) {
5668 return false
5669 }
5670 return container.style.display != "none"
5671 }
5672 function adjust(fromResize) {
5673 if (fromResize == 1 && !isVisible()) {
5674 return
5675 }
5676 if (currentTextbox == null) {
5677 return
5678 }
5679 var c = ac(currentTextbox);
5680 container.style.left = (c[0] - 2) + "px";
5681 container.style.top = (c[1] + currentTextbox.offsetHeight + 1) + "px";
5682 container.style.width = currentTextbox.offsetWidth + "px"
5683 }
5684 function prepare() {
5685 if (prepared) {
5686 return
5687 }
5688 prepared = 1;
5689 container = ce("div");
5690 container.className = "live-search";
5691 container.style.display = "none";
5692 ae(ge("layers"), container);
5693 aE(window, "resize", adjust.bind(0, 1));
5694 aE(document, "click", hide)
5695 }
5696 function show() {
5697 if (container && !isVisible()) {
5698 adjust();
5699 container.style.display = ""
5700 }
5701 }
5702 function hide() {
5703 if (container) {
5704 container.style.display = "none"
5705 }
5706 }
5707 function boldify(match) {
5708 return "<b>" + match + "</b>"
5709 }
5710 function display(textbox, search, suggz, dataz) {
5711 prepare();
5712 show();
5713 lastA = null;
5714 hasData = 1;
5715 while (container.firstChild) {
5716 de(container.firstChild)
5717 }
5718 if (!Browser.ie6) {
5719 ae(container, ce("em"));
5720 ae(container, ce("var"));
5721 ae(container, ce("strong"))
5722 }
5723 search = search.replace(/[^a-z0-9'\-]/, " ");
5724 search = trim(search.replace(/\s+/g, " "));
5725 var parts = search.split(" "),
5726 strRegex = "";
5727 for (var j = 0, len = parts.length; j < len; ++j) {
5728 if (j > 0) {
5729 strRegex += "|"
5730 }
5731 strRegex += parts[j]
5732 }
5733 var regex = new RegExp("(" + strRegex + ")", "gi");
5734 for (var i = 0, len = suggz.length; i < len; ++i) {
5735 var pos = suggz[i].lastIndexOf("(");
5736 if (pos != -1) {
5737 suggz[i] = suggz[i].substr(0, pos - 1)
5738 }
5739 var type = dataz[i][0],
5740 typeId = dataz[i][1],
5741 param1 = dataz[i][2],
5742 param2 = dataz[i][3],
5743 a = ce("a"),
5744 sp = ce("i"),
5745 sp2 = ce("span"),
5746 div = ce("div"),
5747 div2 = ce("div");
5748 a.onmouseover = aOver;
5749 a.href = "?" + g_types[type] + "=" + typeId;
5750 if (type == 3 && param2) {
5751 a.className += " q" + param2
5752 }
5753 if ((type == 3 || type == 6) && param1) {
5754 div.className += " live-search-icon";
5755 div.style.backgroundImage = "url(images/icons/small/" + param1.toLowerCase() + ".jpg)"
5756 } else {
5757 if (type == 5 && param1 >= 1 && param1 <= 2) {
5758 div.className += " live-search-icon-quest-" + (param1 == 1 ? "alliance": "horde")
5759 }
5760 }
5761 ae(sp, ct(LANG.types[type][0]));
5762 ae(a, sp);
5763 var buffer = suggz[i];
5764 buffer = buffer.replace(regex, boldify);
5765 sp2.innerHTML = buffer;
5766 ae(a, sp2);
5767 if (type == 6 && param2) {
5768 ae(a, ct(" (" + param2 + ")"))
5769 }
5770 ae(div2, a);
5771 ae(div, div2);
5772 ae(container, div)
5773 }
5774 }
5775 function receive(xhr, opt) {
5776 var text = xhr.responseText;
5777 if (text.charAt(0) != "[" || text.charAt(text.length - 1) != "]") {
5778 return
5779 }
5780 var a = eval(text);
5781 var search = a[0];
5782 if (search == opt.search) {
5783 if (a.length == 8) {
5784 display(opt.textbox, search, a[1], a[7])
5785 } else {
5786 hide()
5787 }
5788 }
5789 }
5790 function fetch(textbox, search) {
5791 new Ajax("opensearch.php?search=" + urlencode(search), {
5792 onSuccess: receive,
5793 textbox: textbox,
5794 search: search
5795 })
5796 }
5797 function preFetch(textbox, search) {
5798 if (cancelNext) {
5799 cancelNext = 0;
5800 return
5801 }
5802 hasData = 0;
5803 if (timer > 0) {
5804 clearTimeout(timer);
5805 timer = 0
5806 }
5807 timer = setTimeout(fetch.bind(0, textbox, search), 200)
5808 }
5809 function cycle(dir) {
5810 if (!isVisible()) {
5811 if (hasData) {
5812 show()
5813 }
5814 return
5815 }
5816 var firstNode = (container.childNodes[0].nodeName == "EM" ? container.childNodes[3] : container.firstChild);
5817 var bakDiv = dir ? firstNode: container.lastChild;
5818 if (lastDiv == null) {
5819 colorDiv(bakDiv)
5820 } else {
5821 var div = dir ? lastDiv.nextSibling: lastDiv.previousSibling;
5822 if (div) {
5823 if (div.nodeName == "STRONG") {
5824 div = container.lastChild
5825 }
5826 colorDiv(div)
5827 } else {
5828 colorDiv(bakDiv)
5829 }
5830 }
5831 }
5832 function onKeyUp(e) {
5833 e = $E(e);
5834 var textbox = e._target;
5835 if (Browser.gecko && e.ctrlKey) {
5836 switch (e.keyCode) {
5837 case 48:
5838 case 96:
5839 case 107:
5840 case 109:
5841 adjust(textbox);
5842 break
5843 }
5844 }
5845 var search = trim(textbox.value.replace(/\s+/g, " "));
5846 if (search == lastSearch[textbox.id]) {
5847 return
5848 }
5849 lastSearch[textbox.id] = search;
5850 if (search.length) {
5851 preFetch(textbox, search)
5852 } else {
5853 hide()
5854 }
5855 }
5856 function onKeyDown(e) {
5857 e = $E(e);
5858 var textbox = e._target;
5859 switch (e.keyCode) {
5860 case 27:
5861 hide();
5862 break;
5863 case 38:
5864 cycle(0);
5865 break;
5866 case 40:
5867 cycle(1);
5868 break
5869 }
5870 }
5871 function onFocus(e) {
5872 e = $E(e);
5873 var textbox = e._target;
5874 if (textbox != document) {
5875 currentTextbox = textbox
5876 }
5877 }
5878 this.attach = function(textbox) {
5879 textbox.setAttribute("autocomplete", "off");
5880 aE(textbox, "focus", onFocus);
5881 aE(textbox, "keyup", onKeyUp);
5882 aE(textbox, Browser.opera ? "keypress": "keydown", onKeyDown)
5883 }
5884};
5885
5886Lightbox = new
5887function() {
5888 var F,
5889 N,
5890 Q,
5891 J = {},
5892 C = {},
5893 P,
5894 D,
5895 E;
5896 function O() {
5897 aE(F, "click", G);
5898 aE(N, "mousewheel", B);
5899 aE(document, Browser.opera ? "keypress": "keydown", H);
5900 aE(window, "resize", A);
5901 if (Browser.ie6) {
5902 aE(window, "scroll", M)
5903 }
5904 }
5905 function K() {
5906 dE(F, "click", G);
5907 dE(N, "mousewheel", B);
5908 dE(document, Browser.opera ? "keypress": "keydown", H);
5909 dE(window, "resize", A);
5910 if (Browser.ie6) {
5911 dE(window, "scroll", M)
5912 }
5913 }
5914 function I() {
5915 if (P) {
5916 return
5917 }
5918 P = 1;
5919 var R = ge("layers");
5920 F = ce("div");
5921 F.className = "lightbox-overlay";
5922 N = ce("div");
5923 N.className = "lightbox-outer";
5924 Q = ce("div");
5925 Q.className = "lightbox-inner";
5926 F.style.display = N.style.display = "none";
5927 ae(R, F);
5928 ae(N, Q);
5929 ae(R, N)
5930 }
5931 function B(R) {
5932 R = $E(R);
5933 R.returnValue = false
5934 }
5935 function H(R) {
5936 R = $E(R);
5937 switch (R.keyCode) {
5938 case 27:
5939 G();
5940 break
5941 }
5942 }
5943 function A(R) {
5944 if (R != 1234) {
5945 if (C.onResize) {
5946 C.onResize()
5947 }
5948 }
5949 F.style.height = document.body.offsetHeight + "px";
5950 if (Browser.ie6) {
5951 M()
5952 }
5953 }
5954 function M() {
5955 var S = g_getScroll().y,
5956 R = g_getWindowSize().h;
5957 N.style.top = (S + R / 2) + "px"
5958 }
5959 function G() {
5960 K();
5961 if (C.onHide) {
5962 C.onHide()
5963 }
5964 E = 0;
5965 F.style.display = N.style.display = "none";
5966 array_apply(gE(document, "iframe"),
5967 function(R) {
5968 R.style.display = ""
5969 })
5970 }
5971 function L() {
5972 F.style.display = N.style.display = J[D].style.display = ""
5973 }
5974 this.setSize = function(R, S) {
5975 Q.style.visibility = "hidden";
5976 Q.style.width = R + "px";
5977 Q.style.height = S + "px";
5978 Q.style.left = -parseInt(R / 2) + "px";
5979 Q.style.top = -parseInt(S / 2) + "px";
5980 Q.style.visibility = "visible"
5981 };
5982 this.show = function(V, S, R) {
5983 E = 1;
5984 C = S || {};
5985 array_apply(gE(document, "iframe"),
5986 function(W) {
5987 W.style.display = "none"
5988 });
5989 I();
5990 O();
5991 if (D != V && J[D] != null) {
5992 J[D].style.display = "none"
5993 }
5994 D = V;
5995 var U = 0,
5996 T;
5997 if (J[V] == null) {
5998 U = 1;
5999 T = ce("div");
6000 ae(Q, T);
6001 J[V] = T
6002 } else {
6003 T = J[V]
6004 }
6005 if (C.onShow) {
6006 C.onShow(T, U, R)
6007 }
6008 A(1234);
6009 L()
6010 };
6011 this.reveal = function() {
6012 L()
6013 };
6014 this.hide = function() {
6015 G()
6016 };
6017 this.isVisible = function() {
6018 return E
6019 }
6020};
Note: See TracBrowser for help on using the repository browser.