Guest User

Untitled

a guest
Sep 4th, 2011
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ua = navigator.userAgent.toLowerCase();
  2. var isGecko = (ua.indexOf("gecko") != -1);
  3. var isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));
  4. var isNS = (ua.indexOf("netscape") != -1);
  5. var activpanel = 0;
  6. var iframeanchor;
  7. var iframeperse;
  8.  
  9. function screenSize()
  10. {
  11.     var w, h;
  12.     w = (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth;
  13.     h = (window.innerHeight) ? window.innerHeight : window.document.body.clientHeight;
  14.     return {
  15.         w: w,
  16.         h: h
  17.     }
  18. }
  19. function userMenuShow(unamer, hostip, timew, _link, evt, short)
  20. {
  21.     evt = evt || window.event;
  22.     evt.cancelBubble = true;
  23.     var url;
  24.     if (short)
  25.     {
  26.         url = "http://netchat.ru/chat/menu.php?short=1&name="
  27.     }
  28.     else
  29.     {
  30.         url = "http://netchat.ru/chat/menu.php?short=0&name="
  31.     }
  32.     var mail = '';
  33.     iframeanchor = _link;
  34.     var iframe = document.getElementById(short ? "userDropDownIdshort" : "userDropDownId");
  35.     iframeperse = iframe;
  36.     iframe.src = url + unamer + '&hostip=' + hostip + '&timew=' + timew;
  37.     iframe.style.display = "";
  38.     dframe = "irc";
  39.     userframe = gebi(dframe);
  40.     mousey = absPosition(userframe).y;
  41.     y = evt.clientY;
  42.     pageyoff = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop;
  43.     iframe.style.top = mousey + y + pageyoff + 20;
  44.     if (mousey + y + pageyoff + iframe.offsetHeight > screenSize().h)
  45.     {
  46.         resoy = mousey + y + pageyoff + iframe.offsetHeight - screenSize().h;
  47.         iframe.style.top = mousey + y + pageyoff - resoy - 40
  48.     }
  49.     iframe.style.left = (screenSize().w - absPosition(_link).x - iframe.offsetWidth > 0) ? absPosition(_link).x : absPosition(_link).x - iframe.offsetWidth + _link.offsetWidth;
  50.     return false
  51. }
  52. function iframerepositiononresize()
  53. {
  54.     if (!iframeperse)
  55.     {
  56.         return
  57.     }
  58.     var _link = iframeanchor;
  59.     var iframe = iframeperse;
  60.     iframe.style.top = absPosition(_link).y + _link.offsetHeight;
  61.     iframe.style.left = (screenSize().w - absPosition(_link).x - iframe.offsetWidth > 0) ? absPosition(_link).x : absPosition(_link).x - iframe.offsetWidth + _link.offsetWidth
  62. }
  63. function userMenuHide()
  64. {
  65.     var iframe = document.getElementById("userDropDownId");
  66.     iframe.src = "http://netchat.ru/ajax/loading.html";
  67.     iframe.style.display = "none";
  68.     document.getElementById("userDropDownIdshort").style.display = "none"
  69. }
  70. function gebi(id)
  71. {
  72.     return document.getElementById(id)
  73. }
  74. function screenSize()
  75. {
  76.     var w, h;
  77.     w = (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth;
  78.     h = (window.innerHeight) ? window.innerHeight : window.document.body.clientHeight;
  79.     return {
  80.         w: w,
  81.         h: h
  82.     }
  83. }
  84. function absPosition(obj)
  85. {
  86.     var x = y = 0;
  87.     while (obj)
  88.     {
  89.         x += obj.offsetLeft;
  90.         y += obj.offsetTop;
  91.         obj = obj.offsetParent
  92.     }
  93.     return {
  94.         x: x,
  95.         y: y
  96.     }
  97. }
  98. function pageWidth()
  99. {
  100.     return (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth
  101. }
  102. function pageHeight()
  103. {
  104.     return (window.innerHeight) ? window.innerHeight : window.document.body.clientHeight
  105. }
  106. function ts(_link, e, id, dframe)
  107. {
  108.     if (!e) e = event;
  109.     if (typeof (dframe) == 'undefined') dframe = 0;
  110.     top.tss(e.clientX, e.clientY, dframe, id);
  111.     return false
  112. }
  113. function tss(x, y, dframe, text)
  114. {
  115.     var what = "tooltip";
  116.     var buftt = new Array();
  117.     buftt[1] = '1|Скрытие панели|При нажатии скрывается правая часть страницы, окно сообщений при этом увеличивается. Немного уменьшается расход трафика на обновлении списка пользователей.';
  118.     buftt[2] = '1|Показ панели|Показывает ранее скрытую часть страницы.';
  119.     buftt[3] = '1|Обратная связь|При нажатии Вас перекинет на страницу для связи с администрацией.';
  120.     buftt[4] = '1|Текущее время|Текущее время.';
  121.     buftt[5] = '1|Время в чате|Время проведенное Вами в чате.';
  122.     buftt[6] = '1|Сейчас в чате|Количество людей, которые сейчас находятся в чате.';
  123.     buftt[7] = '1|Обновить чат|При нажатии перезагружает окно сообщений и список пользователей. Очищает память браузера, рекомендуется использовать при частом зависании.';
  124.     buftt[8] = '1|Идникатор связи|Если значок зеленый - связь в норме. Если мигает красным - связь с сайтом потеряна и нужно, обновить сайт или проверить свое соединение с интернетом.';
  125.     buftt[9] = '1|Лаг|Показывает сколько прошло секунд с момента последней удачной проверки соединения.';
  126.     buftt[10] = '1|Сервис|<b>0</b> - Вкл/Выкл игнорирования пользователя. <b>&laquo;</b> - Вставляет ник пользователя в форму отправки сообщения.';
  127.     buftt[11] = '1|Действия с ником|Нажатие на ник пользователя позволяет отправить <b>приватное сообщение</b> пользователю. Кнопки <b>М</b>, <b>Ж</b> - Пол пользователя, при нажатии выводят информацию о нем.';
  128.     buftt[12] = '1|Статус|Персональный статус пользователя, устанавливается пользователем.';
  129.     buftt[13] = '1|Cкролл|Задействует скроллинг, который постоянно прокручивает окно сообщений вниз.';
  130.     buftt[14] = '1|Приват|При включенной галочке показываются только сообщения в вашем привате, а остальные обычные фразы скрываются.';
  131.     buftt[15] = '1|Транслит|Установливает перевод всех фраз с английской раскладки на русскую. Так, вы можете написать Vsem Privet!, а в чате появится Всем Привет!.';
  132.     buftt[16] = '1|Звук|Озвучивает звуковые команды в чате.';
  133.     buftt[17] = '1|Отправка|Форма для ввода сообщений и последующей их отправки.';
  134.     buftt[18] = '1|Приват|Если указан ник значит сообщение будет отправленно ему в приват.';
  135.     mousex = 0;
  136.     mousey = 0;
  137.     var outtt = buftt[text].split('|');
  138.     if (dframe != 0)
  139.     {
  140.         userframe = gebi(dframe);
  141.         mousex = absPosition(userframe).x;
  142.         mousey = absPosition(userframe).y
  143.     }
  144.     pagexoff = (window.pageXOffset) ? window.pageXOffset : document.body.scrollLeft;
  145.     pageyoff = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop;
  146.     digix = x;
  147.     if (gebi(what))
  148.     {
  149.         obj = gebi(what).style;
  150.         if (obj)
  151.         {
  152.             obj.display = 'block';
  153.             gebi(what).innerHTML = "<p style='FONT-SIZE: 10px'>" + outtt[2] + "</p>";
  154.             if (mousex + x + pagexoff + gebi(what).offsetWidth > pageWidth())
  155.             {
  156.                 rrraz = mousex + x + pagexoff + gebi(what).offsetWidth - pageWidth();
  157.                 obj.left = mousex + digix + pagexoff - rrraz - 10
  158.             }
  159.             else obj.left = (mousex + digix) + (pagexoff - 60);
  160.             obj.top = mousey + y + pageyoff + 20;
  161.             if (mousey + y + pageyoff + gebi(what).offsetHeight > pageHeight())
  162.             {
  163.                 resoy = mousey + y + pageyoff + gebi(what).offsetHeight - pageHeight();
  164.                 obj.top = mousey + y + pageyoff - resoy - 30
  165.             }
  166.         }
  167.     }
  168.     return true
  169. }
  170. function tc()
  171. {
  172.     obj = gebi("tooltip").style;
  173.     if (obj) obj.display = 'none';
  174.     return true
  175. }
  176. function kcode()
  177. {
  178.     if (navigator.appName == "Netscape" || navigator.appName == "Konqueror")
  179.     {
  180.         return true
  181.     }
  182.     else
  183.     {
  184.         if (window.event.ctrlKey && window.event.keyCode == 87) return false
  185.     }
  186. }
  187. document.oncontextmenu = function ()
  188. {
  189.     return false
  190. };
  191. if (document.layers)
  192. {
  193.     window.captureEvents(Event.MOUSEDOWN);
  194.     window.onmousedown = function (e)
  195.     {
  196.         if (e.target == document) return false
  197.     }
  198. }
  199. else
  200. {
  201.     document.onmousedown = function ()
  202.     {
  203.         return false
  204.     }
  205. }
  206. jsl_msg = "Не загружен чат, либо плохая связь с Интернетом. Попробуйте обновить чат.";
  207.  
  208. function Hex(B)
  209. {
  210.     Chars = "0123456789abcdef";
  211.     return Chars.charAt(B >> 4) + Chars.charAt(B & 0x0F)
  212. }
  213. function gradtext(C1, C2, C3, Str)
  214. {
  215.     function l(Str)
  216.     {
  217.         return Str.replace(/<[^>]+>?/g, "").replace(/&([a-z]{2,}|#\d+|#x[\da-f]{2});/gi, " ").length
  218.     }
  219.     function c(R, G, B, Str)
  220.     {
  221.         return "<font color=#" + Hex(R) + Hex(G) + Hex(B) + ">" + Str + "</font>"
  222.     }
  223.     function g(C1, C2, l, s)
  224.     {
  225.         C1 = parseInt("0x0" + C1.substr(1));
  226.         C2 = parseInt("0x0" + C2.substr(1));
  227.         var R1 = C1 >> 16,
  228.             G1 = (C1 >> 8) & 0xFF,
  229.             B1 = C1 & 0xFF;
  230.         var R2 = C2 >> 16,
  231.             G2 = (C2 >> 8) & 0xFF,
  232.             B2 = C2 & 0xFF;
  233.         var Res = "";
  234.         var d = l - s;
  235.         R2 -= R1;
  236.         G2 -= G1;
  237.         B2 -= B1;
  238.         for (var i = 0; iS < Str.length;)
  239.         {
  240.             if (Str.charAt(iS) == '<')
  241.             {
  242.                 for (var t = 0; iS < Str.length; iS++)
  243.                 {
  244.                     Res += Str.charAt(iS);
  245.                     if (Str.charAt(iS) == '>' && !t) break
  246.                 }
  247.                 iS++
  248.             }
  249.             else if (i != l)
  250.             {
  251.                 var S = (Str.charAt(iS) == '&' && /^(&([a-z]{2,}|#\d+|#x[\da-f]{2});)/i.test(Str.substr(iS))) ? RegExp.$1 : Str.charAt(iS);
  252.                 Res += d ? c(R1 + i * R2 / d, G1 + i * G2 / d, B1 + i * B2 / d, S) : c(R1, G1, B1, S);
  253.                 iS += S.length;
  254.                 i++
  255.             }
  256.             else break
  257.         }
  258.         return Res
  259.     }
  260.     Str = Str.replace(/^\s+|\s+$/g, "");
  261.     var iS = 0;
  262.     var Len = l(Str);
  263.     return C2 ? g(C1, C2, Math.floor(Len / 2), 0) + g(C2, C3, Math.round(Len / 2), 1) : g(C1, C3, Len, 1)
  264. }
  265. function gradmsg(gmnick, def)
  266. {
  267.     switch (gmnick.toLowerCase())
  268.     {
  269.     case "робот":
  270.         return "<span style=color:steelblue>" + def + "</span>";
  271.         break;
  272.     case "scumtron":
  273.         return gradtext('#CC3333', '#993300', '#000000', def);
  274.         break;
  275.     case "fresh":
  276.         return gradtext('#000066', '#bb0000', '#000077', def);
  277.         break;
  278.     case "плутовка":
  279.         return gradtext('#33FF00', '#33CC00', '#0000FF', def);
  280.         break;
  281.     case "банди":
  282.         return gradtext('#FF0033', '#0033FF', '#336633', def);
  283.         break;
  284.     default:
  285.         return def
  286.     }
  287. }
  288. function gradnick(gnick)
  289. {
  290.     switch (gnick.toLowerCase())
  291.     {
  292.     case "робот":
  293.         return "<img src=\"http://netchat.ru/i/chat/bot.gif\" width=16 height=16 border=0 alt=\"РОБОТ\"> <b style=color:steelblue>РОБОТ</b>";
  294.         break;
  295.     case "fresh":
  296.         return gradtext('#336600', '#55aa00', '#88ff00', gnick);
  297.         break;
  298.     case "scumtron":
  299.         return "<img src=\"http://netchat.ru/i/russia.gif\" width=15 height=10 border=0 alt=\"Россия матушка\"> <b style=color:black>Scumtron</b>";
  300.         break;
  301.     case "goldsteals":
  302.         return "<img src=http://netchat.ru/chat/im/graf/elite.gif border=0 width=24 heihgt=15><b><font color=black>GolD</font><font color=#ff631f>steals</font></b>";
  303.         break;
  304.     case "плутовка":
  305.         return gradtext('#0000FF', '#33CC00', '#33FF00', gnick);
  306.         break;
  307.     case "банди":
  308.         return gradtext('#336633', '#0033FF', '#FF0033', gnick);
  309.         break;
  310.     default:
  311.         return gnick
  312.     }
  313. }
  314. function joinfraz(fjnick, def)
  315. {
  316.     switch (fjnick.toLowerCase())
  317.     {
  318.     case "fresh":
  319.         return "<b><font color=black>{@nick}</font> <font color=red> входит в чат!</font></b>";
  320.         break;
  321.     case "scumtron":
  322.         return "<b><font color=black>{@nick}</font> <font color=red> входит в чат!</font></b>";
  323.         break;
  324.     default:
  325.         return def
  326.     }
  327. }
  328. function partfraz(fpnick, def)
  329. {
  330.     switch (fpnick.toLowerCase())
  331.     {
  332.     case "fresh":
  333.         return "<b><font color=black>{@nick}</font> <font color=red> покинул чат!</font></b>";
  334.         break;
  335.     case "scumtron":
  336.         return "<b><font color=black>{@nick}</font> <font color=red> покинул чат!</font></b>";
  337.         break;
  338.     default:
  339.         return def
  340.     }
  341. }
  342. function gradst(stnick, st)
  343. {
  344.     switch (stnick.toLowerCase())
  345.     {
  346.     case "fresh":
  347.         return "<font style='color:steelblue;font-weight:normal;'></font>";
  348.         break;
  349.     case "scumtron":
  350.         return "<font style='color:red;font-weight:normal;'>Наблюдатель ООН</font>";
  351.         break;
  352.     case "goldsteals":
  353.         return "<b><font color=black>o</font><font color=red>W</font><font color=black>ner</font></b>";
  354.         break;
  355.     default:
  356.         return st
  357.     }
  358. }
  359. function gradsuper(stnick, st)
  360. {
  361.     switch (stnick.toLowerCase())
  362.     {
  363.     case "fresh":
  364.         return "<font style='color:steelblue;font-weight:normal;'>админ</font>";
  365.         break;
  366.     case "goldsteals":
  367.         return "77777";
  368.         break;
  369.     default:
  370.         return st
  371.     }
  372. }
  373. function gradnil(linick)
  374. {
  375.     switch (linick.toLowerCase())
  376.     {
  377.     case "робот":
  378.         return "<b style=color:steelblue>РОБОТ</b>";
  379.         break;
  380.     default:
  381.         return linick
  382.     }
  383. }
  384. var runscrl = 1;
  385. var lastnick = '';
  386. var lastnicksend = 0;
  387. var onlyprivate = 0;
  388. var is_vik = 0;
  389. var tot_sm = 0;
  390. var tot_nicks = 0;
  391. var hidn = 0;
  392. var etmr = 0,
  393.     efocus = 0,
  394.     eall = 1;
  395.  
  396. function e_focus()
  397. {
  398.     efocus = 1
  399. }
  400. function e_blur()
  401. {
  402.     efocus = 0
  403. }
  404. function e_up()
  405. {
  406.     top.etmr = 0
  407. }
  408. function is_focus()
  409. {
  410.     if (!efocus && etmr > con_str1 || etmr > con_str2) return true;
  411.     return false
  412. }
  413. function try_focus()
  414. {
  415.     if (is_focus()) set_focus()
  416. }
  417. function zero2(i)
  418. {
  419.     if (i < 10) return "0" + i;
  420.     return i
  421. }
  422. function microtime()
  423. {
  424.     return (new Date()).getTime()
  425. }
  426. function unixtime()
  427. {
  428.     var s = ((new Date()).getTime()).toString();
  429.     return s.substr(0, s.length - 3)
  430. }
  431. function unset(arr, num)
  432. {
  433.     var buf = new Array();
  434.     var j = 0;
  435.     for (i = 0; i < arr.length; i++) if (i != num) buf[j++] = arr[i];
  436.     return buf
  437. }
  438. function getCookie(name)
  439. {
  440.     var prefix = name + "=";
  441.     var cookieStartIndex = document.cookie.indexOf(prefix);
  442.     if (cookieStartIndex == -1) return null;
  443.     var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
  444.     if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
  445.     return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
  446. }
  447. function putCookie(n, v)
  448. {
  449.     var exp = '';
  450.     var now = new Date();
  451.     then = now.getTime() + (365 * 24 * 60 * 60 * 1000);
  452.     now.setTime(then);
  453.     exp = '; expires=' + now.toGMTString();
  454.     document.cookie = n + "=" + v + '; path=/' + exp
  455. }
  456. function nickpriv(nick)
  457. {
  458.     if (nick == top.mynick) return top.chatalert("Самому себе писать запрещено.");
  459.     var p = parent.frames.kbd.document.kbd_form;
  460.     p.cmd.value = "N0";
  461.     p.t1.value = nick;
  462.     if (top.lastnick != "" && top.lastnicksend && p.msgname.value.substr(0, top.lastnick.length + 2) == top.lastnick + ": ") p.msgname.value = p.msgname.value.substr(top.lastnick.length + 2, p.msgname.value.length);
  463.     top.set_focus()
  464. }
  465. function nickcopy(nick)
  466. {
  467.     tot_nicks++;
  468.     if (tot_nicks > 4)
  469.     {
  470.         var p = parent.frames.kbd.document.kbd_form;
  471.         p.cmd.value = "N1";
  472.         p.t1.value = "";
  473.         p.msgname.value = "";
  474.         tot_nicks = tot_nicks - 2;
  475.         top.chatalert("Хватит по никам клацать!");
  476.         return
  477.     }
  478.     var p = parent.frames.kbd.document.kbd_form;
  479.     p.msgname.focus();
  480.     p.cmd.value = "N1";
  481.     p.t1.value = "";
  482.     if (p.msgname.value.substring(0, 1) == "/") p.msgname.value = p.msgname.value + " " + nick + " ";
  483.     else
  484.     {
  485.         if (top.lastnick != "" && top.lastnicksend && p.msgname.value == top.lastnick + ": ") p.msgname.value = "";
  486.         p.msgname.value = nick + ': ' + p.msgname.value;
  487.         top.lastnick = nick;
  488.         top.lastnicksend = 0
  489.     }
  490. }
  491. function set_focus()
  492. {
  493.     var p = parent.frames.kbd;
  494.     if (p && p.document.kbd_form)
  495.     {
  496.         p.focus();
  497.         p.document.kbd_form.msgname.focus();
  498.         p.document.kbd_form.msgname.value += ""
  499.     }
  500.     top.frazafocus = 1;
  501.     return false
  502. }
  503. function sm(evt, smile)
  504. {
  505.     var evt = parent.frames.irc.event || evt;
  506.     tot_sm++;
  507.     if (tot_sm > 4 && s3 < 300)
  508.     {
  509.         var p = parent.frames.kbd.document.kbd_form;
  510.         p.cmd.value = "N1";
  511.         p.t1.value = "";
  512.         p.msgname.value = "";
  513.         tot_sm = 0;
  514.         top.chatalert("Установлен лимит: 4 смайлика на сообщение!");
  515.         return
  516.     }
  517.     if (evt.shiftKey)
  518.     {
  519.         if (top.auth == 0)
  520.         {
  521.             top.chatalert("Вы не зарегистрированы и по этому не можете добавить смайлы в личную галерею!");
  522.             return
  523.         }
  524.         exts = smile.split('/');
  525.         if (exts[0] == "1")
  526.         {
  527.             top.chatalert("Смайлы из панели добавлять нельзя!");
  528.             return
  529.         }
  530.         parent.frames.more.location.href = 'http://' + wwwhost + '/' + wwp + 'mysmile.php?smile=' + smile + top.sess;
  531.         return
  532.     }
  533.     var p = parent.kbd.document.kbd_form;
  534.     p.msgname.value = p.msgname.value + " :" + smile + ": ";
  535.     p.msgname.focus()
  536. }
  537. var smmode = 0;
  538.  
  539. function sm2sh()
  540. {
  541.     pnshow();
  542.     top.smmode ^= 1;
  543.     if (top.smv == 0 || top.smv == null)
  544.     {
  545.         rrr = '32';
  546.         top.smv = 1
  547.     }
  548.     else
  549.     {
  550.         rrr = '0';
  551.         top.smv = 0
  552.     }
  553.     document.getElementById('main2').rows = '22,*,' + rrr;
  554.     s_main();
  555.     set_focus()
  556. }
  557. var _pnshow = 0;
  558.  
  559. function pnshow()
  560. {
  561.     if (_pnshow || !parent.frames.head.document.getElementById("pnsm")) return;
  562.     _pnshow = 1;
  563.     for (i = 0; i < smhl.length; i++) parent.frames.head.document.getElementById("pnsm").innerHTML += "<a href='javascript:top.sm(\"1/" + smhl[i] + "\")'><img src=im/sm1/" + smhl[i] + ".gif border=0></a>"
  564. }
  565. _fsc = 0;
  566.  
  567. function fsc()
  568. {
  569.     _fsc ^= 1;
  570.     document.getElementById('mainframe').rows = _fsc ? '14,*,' + top.height2 : top.height + ',*,' + top.height2;
  571.     parent.secondframe.cols = _fsc ? '*,0' : '*,300';
  572.     if (!_fsc) smmode = 0;
  573.     s_main();
  574.     set_focus()
  575. }
  576. function clms()
  577. {
  578.     tot_nicks = 0;
  579.     tot_sm = 0;
  580.     var p = parent.frames.kbd.document.kbd_form;
  581.     p.cmd.value = "N1";
  582.     p.t1.value = "";
  583.     p.msgname.value = "";
  584.     setTimeout("top.set_focus()", 10)
  585. }
  586. function scroll_switch()
  587. {
  588.     top.runscrl ^= 1;
  589.     var p = parent.frames.more.document.more_form;
  590.     if (p && p.scrl) p.scrl.checked = top.runscrl;
  591.     scroll_uservars()
  592. }
  593. function scroll_to(value)
  594. {
  595.     top.runscrl = value;
  596.     var p = parent.frames.more.document.more_form;
  597.     if (p && p.scrl) p.scrl.checked = top.runscrl;
  598.     scroll_uservars()
  599. }
  600. function scroll_uservars()
  601. {
  602.     if (top.runscrl == 1)
  603.     {
  604.         top.userflag = 0;
  605.         top.downflag = 0
  606.     }
  607.     else
  608.     {
  609.         top.userflag = 1;
  610.         top.downflag = 1
  611.     }
  612. }
  613. function set_quit()
  614. {
  615.     var p = parent.frames.kbd.document.kbd_form;
  616.     p.cmd.value = "N3";
  617.     p.msgname.value = "/quit";
  618.     p.target = 'kbdpost';
  619.     p.submit()
  620. }
  621. function setignore(nick)
  622. {
  623.     var p = parent.frames.kbd.document.cmdform;
  624.     if (nick == top.mynick)
  625.     {
  626.         top.chatalert("Невозможно игнорировать самого себя.");
  627.         return
  628.     }
  629.     p.cmd.value = "ignore";
  630.     p.cmd1.value = nick;
  631.     p.submit()
  632. }
  633. function wcopy()
  634. {
  635.     if (window.status.substring(0, top.copy.length) != top.copy)
  636.     {
  637.         window.status = top.copy
  638.     }
  639.     setTimeout("wcopy()", 5000)
  640. }
  641. setTimeout("wcopy()", 100);
  642.  
  643. function ln0()
  644. {
  645.     window.status = copy;
  646.     return true
  647. }
  648. function ln1(n)
  649. {
  650.     window.status = 'Написать сообщение пользователю ' + n;
  651.     return true
  652. }
  653. function ln2(n)
  654. {
  655.     window.status = 'Написать приватное сообщение пользователю ' + n;
  656.     return true
  657. }
  658. var ul_tid = 0,
  659.     ul_loaded = 0,
  660.     ul_tid2 = 0,
  661.     ul_last = 0,
  662.     ul_qty = 0;
  663. var user = new Array(),
  664.     userinfo = new Array();
  665.  
  666. function ul_cron()
  667. {
  668.     userlist_show();
  669.     if (ul_tid) clearTimeout(ul_tid);
  670.     ul_tid = 0;
  671.     if (!ul_loaded) ul_tid = setTimeout("ul_cron()", 1000)
  672. }
  673. function userlist_show()
  674. {
  675.     if (top.ul_tid2)
  676.     {
  677.         clearTimeout(top.ul_tid2);
  678.         top.ul_tid2 = setTimeout("userlist_show_go()", 1000);
  679.         return
  680.     }
  681.     top.ul_tid2 = setTimeout("userlist_show_go()", 1000)
  682. }
  683. function userlist_show_go()
  684. {
  685.     if (!parent.list.document.getElementById("htmllist") || !parent.list)
  686.     {
  687.         if (!ul_tid) ul_tid = setTimeout("ul_cron()", 2000);
  688.         ul_loaded = 0;
  689.         return
  690.     }
  691.     if (ul_tid) clearTimeout(ul_tid);
  692.     ul_loaded = 1;
  693.     ul_tid = 0;
  694.     var buf = "",
  695.         i, v, u, info, st, html, classlist, time1 = microtime(),
  696.         l = user.length,
  697.         classtlistend;
  698.     for (i = 0; i < l; i++)
  699.     {
  700.         v = user[i];
  701.         u = userinfo[i];
  702.         classlist = "class='statlist' href='#moder' onclick=\"return top.chatModer(this, '" + v[0] + "')\">";
  703.         if (!v[5] && v[1] == 0)
  704.         {
  705.             classlist = "class='statlist' style='text-decoration:none;color:#666699' onclick='return false;'>";
  706.             if (v[4] == 1) info = "(" + top.ul_male + ")";
  707.             else if (v[4] == 2) info = "(" + top.ul_female + ")";
  708.             else info = top.ul_noauth
  709.         }
  710.         else if (v[1] > 0) info = v[1];
  711.         else if (v[4] == 1) info = top.ul_male;
  712.         else if (v[4] == 2) info = top.ul_female;
  713.         else
  714.         {
  715.             classlist = "class='statlist' style='text-decoration:none;color:#666699' onclick='return false;'>";
  716.             if (v[4] == 1) info = "(" + top.ul_male + ")";
  717.             else if (v[4] == 2) info = "(" + top.ul_female + ")";
  718.             else info = top.ul_noauth
  719.         }
  720.         info = gradsuper(v[0], info);
  721.         if (u[1] == 0) st = "<font class=clistc0>" + top.ul_msg[1] + "</font>";
  722.         else if (u[1] == 2) st = "<font class=clistc2>" + top.ul_msg[0] + "</font>";
  723.         else if (v[10] != "")
  724.         {
  725.             st = "<a href='#' class=clistaway onMouseOver='window.status=\"Пользователь отсуствует, причина: \"+top.user[" + i + "][10]; return 1' onMouseOut='window.status=top.copy;return 1' title='" + v[10] + "'>" + top.ul_msg[2] + "</a>"
  726.         }
  727.         else if (u[3] != "") st = "<font class=clistaway>" + u[3] + "</font>";
  728.         else if (v[8].length < 16) st = v[8];
  729.         else
  730.         {
  731.             st = "<font class=clist onMouseOver='window.status=\"Пользователь отсуствует, причина: \"+top.user[" + i + "][8]; return 1' onMouseOut='window.status=top.copy;return 1' title='" + v[8] + "'>" + v[8].substr(0, 13) + "...</font>"
  732.         }
  733.         if (lite_version == 1)
  734.         {
  735.             st = gradst(v[0], st)
  736.         }
  737.         if (lite_version == 1)
  738.         {
  739.             nickita = gradnil(v[0])
  740.         }
  741.         if (v[0] == top.mynick)
  742.         {
  743.             html = top.ul_me(i % 2 ? top.userlist_c2 : top.userlist_c1, v[3] != "" ? " 'www ip: " + v[2] + "www host:" + v[3] + "Real host:" + u[2] + "UserNum:" + v[9] + "'" : "'Кнопка-игнора'", v[3] != "" ? "<td class=s8 width='1%'>&nbsp;<a onMouseOver='window.status=\"Забанить себя.\"; return 1' onMouseOut='window.status=top.copy;return 1' class=s8 href=javascript:top.ban('" + v[0] + "','" + v[3] + "')>[B]</a>&nbsp;</td>" : "", v[0], "&nbsp;<a onMouseOver='window.status=\"Информация о себе\"; return 1' onMouseOut='window.status=top.copy;return 1' " + classlist + "" + info + "</a>", st, nickita)
  744.         }
  745.         else
  746.         {
  747.             var lnewnicka;
  748.             if (nickita.length > top.userlist_long)
  749.             {
  750.                 if (v[4] == 1) lnewnicka = "nicklist_long_man";
  751.                 else if (v[4] == 2) lnewnicka = "nicklist_long_woman";
  752.                 else lnewnicka = "nicklist_long"
  753.             }
  754.             else
  755.             {
  756.                 if (v[4] == 1) lnewnicka = "nicklist_man";
  757.                 else if (v[4] == 2) lnewnicka = "nicklist_woman";
  758.                 else lnewnicka = "nicklist"
  759.             }
  760.             html = top.ul_all(i % 2 ? top.userlist_c2 : top.userlist_c1, i, v[0], u[4] ? "<span class=myignor style='color:#ee0000;text-decoration:none' onMouseOver='window.status=\"Снять игнор с пользователя " + v[0] + ".\"; return 1' onMouseOut='window.status=top.copy;return 1'>&#216;</span>&nbsp;" : "<span class=myignor style='color:#000000;text-decoration:none' onMouseOver='window.status=\"Поставить игнор на пользователя " + v[0] + ".\"; return 1' onMouseOut='window.status=top.copy;return 1'>&#927;</span>&nbsp;", v[3] != "" ? " 'www ip: " + v[2] + "www host:" + v[3] + "Real host:" + u[2] + "UserNum:" + v[9] + "'" : "'Кнопка-игнора'", v[3] != "" ? "<td class=s8 width='1%'>&nbsp;<a class=s8 href=javascript:top.ban('" + v[0] + "','" + v[3] + "') onMouseOver='window.status=\"Забанить пользователя " + v[0] + ".\"; return 1' onMouseOut='window.status=top.copy;return 1'>[B]</a>&nbsp;</td>" : "", lnewnicka, "&nbsp;<a onMouseOver='window.status=\"Информация о пользователе: " + v[0] + "\"; return 1' onMouseOut='window.status=top.copy;return 1'  " + classlist + "" + info + "</a>", st, nickita)
  761.         }
  762.         buf = buf + html
  763.     }
  764.     parent.list.document.getElementById("htmllist").innerHTML = "<table width=100% border=0 cellspacing=0 cellpadding=1><TBODY>" + buf + "</TBODY></table>";
  765.     parent.list.document.getElementById("htmlcount").innerHTML = user.length;
  766.     top.ul_qty++;
  767.     top.ul_last = top.unixtime()
  768. }
  769. var ul_idlefirst = 0;
  770.  
  771. function userlist_idle(checklast)
  772. {
  773.     var need = 0,
  774.         time = unixtime() - away_time,
  775.         now = unixtime(),
  776.         ofs, i;
  777.     if (away_time == 0) return;
  778.     if (user && (ul_idlefirst == 0 || !checklast || checklast && now - top.ul_last >= 60))
  779.     {
  780.         for (i = 0; i < user.length; i++)
  781.         {
  782.             if (user[i][11] < time)
  783.             {
  784.                 ofs = Math.floor((now - user[i][11]) / 60);
  785.                 if (away_show)
  786.                 {
  787.                     if (ofs < 60) userinfo[i][3] = ul_msg[3] + " " + zero2(ofs) + " " + ul_msg[4];
  788.                     else if (ofs < 600) userinfo[i][3] = ul_msg[3] + " " + Math.floor(ofs / 60) + ul_msg[6] + ":" + zero2(ofs % 60) + ul_msg[5];
  789.                     else if (ofs < 5940) userinfo[i][3] = ul_msg[3] + " " + Math.floor(ofs / 60) + ul_msg[7];
  790.                     else userinfo[i][3] = ul_msg[3] + " " + zero2(Math.floor(ofs / 1440)) + " " + ul_msg[8]
  791.                 }
  792.                 else userinfo[i][3] = ul_msg[3];
  793.                 need = 1
  794.             }
  795.             else userinfo[i][3] = ""
  796.         }
  797.         if (need)
  798.         {
  799.             if (sortnicks == 5) userlist_sort();
  800.             userlist_show();
  801.             ul_idlefirst = 1
  802.         }
  803.     }
  804.     setTimeout("userlist_idle(1)", 28000)
  805. }
  806. setTimeout("userlist_idle(0)", 15000);
  807.  
  808. function nick2num(nick)
  809. {
  810.     return user2num(nick)
  811. }
  812. function user2num(nick)
  813. {
  814.     for (var i = 0; i < top.user.length; i++) if (top.user[i][0] == nick) return i;
  815.     return -1
  816. }
  817. function userlist_sort()
  818. {
  819.     var tmp = new Array(),
  820.         user2 = new Array(),
  821.         userinfo2 = new Array(),
  822.         n, num, i, i2;
  823.     if (top.user.length == 0) return;
  824.     switch (top.sortnicks)
  825.     {
  826.     case 1:
  827.         for (i = 0; i < top.user.length; i++) tmp[i] = top.userinfo[i][0] + " :" + i;
  828.         break;
  829.     case 2:
  830.         for (i = 0; i < top.user.length; i++) tmp[i] = (top.user[i][4] == 0 ? "3" : top.user[i][4]) + top.userinfo[i][0] + " :" + i;
  831.         break;
  832.     case 3:
  833.         for (i = 0; i < top.user.length; i++)
  834.         {
  835.             if (top.user[i][5])
  836.             {
  837.                 switch (top.user[i][4])
  838.                 {
  839.                 case 0:
  840.                     tmp[i] = "2" + top.userinfo[i][0] + " :" + i;
  841.                     break;
  842.                 case 1:
  843.                     tmp[i] = "1" + top.userinfo[i][0] + " :" + i;
  844.                     break;
  845.                 case 2:
  846.                     tmp[i] = "0" + top.userinfo[i][0] + " :" + i;
  847.                     break
  848.                 }
  849.             }
  850.             else
  851.             {
  852.                 tmp[i] = "2" + top.userinfo[i][0] + " :" + i
  853.             }
  854.         }
  855.         break;
  856.     case 4:
  857.         for (i = 0; i < top.user.length; i++) tmp[i] = top.user[i][14] + " :" + i;
  858.         break;
  859.     case 5:
  860.         for (i = 0; i < top.user.length; i++)
  861.         {
  862.             tmp[i] = top.user[i][11] + " :" + i
  863.         }
  864.         break
  865.     }
  866.     tmp = tmp.sort();
  867.     for (i = 0; i < tmp.length; i++)
  868.     {
  869.         n = tmp[i].indexOf(" :");
  870.         if (n == -1)
  871.         {
  872.             return
  873.         }
  874.         num = tmp[i].substr(n + 2, 10);
  875.         if (top.sortnicks != 5) i2 = i;
  876.         else i2 = tmp.length - i - 1;
  877.         user2[i2] = top.user[num];
  878.         userinfo2[i2] = top.userinfo[num]
  879.     }
  880.     top.user = user2;
  881.     top.userinfo = userinfo2
  882. }
  883. var codepage1 = "абвгдежзийклмнопрстуфхцчшщъыьэюя";
  884. var codepage2 = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
  885. var engcode1 = "qwertyuiopasdfghjklzxcvbnm";
  886. var engcode2 = "QWERTYUIOPASDFGHJKLZXCVBNM";
  887.  
  888. function str2chr(str, maxlength)
  889. {
  890.     var i, v, n, c, buf = "";
  891.     if (!maxlength) maxlength = str.length;
  892.     for (i = 0; i < str.length && i < maxlength; i++)
  893.     {
  894.         v = str.substr(i, 1);
  895.         if (v == 'Ё' || v == 'ё') v = 'е';
  896.         n = codepage2.indexOf(v);
  897.         if (n != -1) v = codepage1.substr(n, 1);
  898.         n = codepage1.indexOf(v);
  899.         if (n == -1)
  900.         {
  901.             c = v.charCodeAt();
  902.             if (c > 255) c = 255
  903.         }
  904.         else c = 224 + n;
  905.         if (c >= 0x41 && c <= 0x5a) c += 0x20;
  906.         buf = buf + c.toString(16)
  907.     }
  908.     return buf
  909. }
  910. function st(nick)
  911. {
  912.     return 'Вставить ник ' + nick + ' в поле для ввода сообщений.'
  913. }
  914. function gocmd(a, b, c)
  915. {
  916.     var tt = parent.frames["kbd"].document;
  917.     if (tt && tt.cmdform.cmd)
  918.     {
  919.         tt.cmdform.cmd.value = a;
  920.         tt.cmdform.cmd1.value = b;
  921.         tt.cmdform.cmd2.value = c;
  922.         tt.cmdform.submit()
  923.     }
  924. }
  925. function url(urlgo, md5)
  926. {
  927.     var winname = "url_" + ((Math.round(Math.random() * 100000)).toString());
  928.     var ans = window.confirm("Открыть адресс?");
  929.     if (ans)
  930.     {
  931.         parent.frames.kbd.document.kbd_form.msgname.focus();
  932.         window.open("http://" + top.http_host + "/" + top.wwp + "redirect_from_cpsr.php?jsclose=1&url=" + escape(urlgo) + "&md5=" + md5, winname, "toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1")
  933.     }
  934. }
  935. function msgurl(urlgo, md5, urlshow)
  936. {
  937.     var xurl = urlgo;
  938.     var url = urlshow;
  939.     var urlshow1 = 'сайт';
  940.     if (urlgo.indexOf('.gif') > 10 || urlgo.indexOf('.jpg') > 10 || urlgo.indexOf('.jpeg') > 10 || urlgo.indexOf('.bmp') > 10 || urlgo.indexOf('.png') > 10) urlshow1 = 'картинка';
  941.     else if (urlgo.indexOf('.html') > 10 || urlgo.indexOf('.htm') > 10 || urlgo.indexOf('.php') > 10) urlshow1 = 'страница';
  942.     else if (urlgo.indexOf('.swf') > 10) urlshow1 = 'флешка';
  943.     if (urlgo.indexOf('http://netchat.ru/forum') >= 0) urlshow1 = 'форум';
  944.     else if (urlgo.indexOf('netchat.ru/forum') >= 0) urlshow1 = 'форум';
  945.     return "<nobr><a class=url title='Открыть ссылку в новом окне' href='" + urlgo + "' target=kbdpost onclick=\"top.url('" + xurl + "','" + md5 + "');return false;\">" + urlshow1 + "</a></nobr>"
  946. }
  947. function s_main()
  948. {
  949.     parent.frames.irc.scroll(1, 1000000)
  950. }
  951. function myinfo(ni)
  952. {
  953.     if (navigator.appName == "Netscape")
  954.     {
  955.         wopen("cmd.php?c=info&jsclose=1&focus=1&ni=" + ni + "&" + top.asess);
  956.         return false
  957.     }
  958.     if (parent.frames.list.event.shiftKey && s3 > 900) wopen("login.php?c=setup&ni=" + ni + "&jsclose=1" + top.asess);
  959.     else wopen("cmd.php?c=info&jsclose=1&focus=1&ni=" + ni + "&" + top.asess);
  960.     return false
  961. }
  962. function refresh(url)
  963. {
  964.     document.write("<head><META HTTP-EQUIV='Refresh' CONTENT='0;url=" + url + "'></head>")
  965. }
  966. function wopen(url, n, x, y)
  967. {
  968.     if (typeof (x) == 'undefined' || x == 0) x = 500;
  969.     if (typeof (y) == 'undefined' || y == 0) y = 600;
  970.     if (typeof (n) == 'undefined' || n == '') n = "rnd" + (Math.round(Math.random() * 100000)).toString();
  971.     return top.open(url, n, "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=" + x + ",height=" + y)
  972. }
  973. function mopen(url, x, y, xpos, ypos)
  974. {
  975.     if (typeof (x) == 'undefined') x = Math.round(screen.width / 1.3);
  976.     if (typeof (y) == 'undefined') y = Math.round(screen.height / 1.3);
  977.     if (typeof (xpos) == 'undefined') xpos = Math.round((screen.width - x) / 2);
  978.     if (typeof (ypos) == 'undefined') ypos = Math.round((screen.height - y) / 2);
  979.     var win = window.showModalDialog(url, "", "dialogHeight: " + y + "px; dialogWidth: " + x + "px; dialogTop: " + ypos + "px; dialogLeft: " + xpos + "px; edge: Raised; center: No; help: No; resizable: Yes; status: Yes;");
  980.     return win
  981. }
  982. var close_window = 1;
  983.  
  984. function browser_close()
  985. {
  986.     var w = window.open("", "brclose", "toolbar=0,location=0,directories=0,status=0,menubar=0," + "scrollbars=0,resizable=0,width=200,height=70");
  987.     w.document.write("<body bgcolor='#333366' text='#ffffff'><nobr><font face=arial>" + "<center><font style='font:19px Arial Black;color:#ffff77'>Выход из чата...</font><br>" + "Пожалуйста, подождите<br>несколько секунд")
  988. }
  989. function clicksmile(name)
  990. {
  991.     var url = "smile.php?name=" + name + top.asess;
  992.     gebi("more").src = url;
  993.     return false
  994. }
  995. top.ircconnetstatus = 0;
  996. top.ircconnettime = 0;
  997.  
  998. function lostircconnect()
  999. {
  1000.     top.ircconnetstatus = 2;
  1001.     top.ircconnettime = 0;
  1002.     lagcontrol2()
  1003. }
  1004. function lagcontrol()
  1005. {
  1006.     setTimeout("top.lagcontrol()", 1000);
  1007.     var l = parent.frames.list;
  1008.     if (l && l.document.getElementById("tdirc") && l.document.getElementById("laglamp"))
  1009.     {
  1010.         if (top.rirclist > -1) l.document.getElementById("tdirc").innerHTML = top.rirclist;
  1011.         else l.document.getElementById("tdirc").value = "?";
  1012.         if (top.rirclist > top.con_str4)
  1013.         {
  1014.             l.document.getElementById("tdirc").style.backgroundColor = (top.rirclist % 2 ? top.fhead_cblink1 : top.fhead_cblink2);
  1015.             l.document.getElementById("laglamp").style.color = (top.rirclist % 2 ? top.fhead_cblink1 : top.fhead_cblink2)
  1016.         }
  1017.         else
  1018.         {
  1019.             l.document.getElementById("tdirc").style.backgroundColor = '#ffe1ab';
  1020.             l.document.getElementById("laglamp").style.color = '#0c822d'
  1021.         }
  1022.     }
  1023. }
  1024. cook_swf = getCookie("swf_disable");
  1025. if (!cook_swf || cook_swf == '') cook_swf = 1;
  1026.  
  1027. function lagcontrol3()
  1028. {
  1029.     top.ircconnettime = top.ircconnettime + 1;
  1030.     setTimeout("top.lagcontrol3()", 1000)
  1031. }
  1032. top.lagcontrol3();
  1033. rirclist = -30;
  1034.  
  1035. function firclist()
  1036. {
  1037.     rirclist++;
  1038.     etmr++;
  1039.     var b = 'http://' + http_host + '/' + wwp + url_irc + '?' + asess;
  1040.     if (rirclist >= con_str5 && (rirclist - con_str5) % con_str6 == 0)
  1041.     {
  1042.         parent.frames.irc.location.href = b
  1043.     }
  1044.     if (rirclist >= con_str7 + 30)
  1045.     {
  1046.         top.chatalert("Связь с сайтом потеряна. Нужно, обновить сайт или проверить свое соединение с интернетом.");
  1047.         top.location.href = 'http://' + http_host + '/' + wwp + '?' + asess;
  1048.         return false
  1049.     }
  1050.     setTimeout("firclist()", 1000)
  1051. }
  1052. top.firclist();
  1053. nullframe = 0;
  1054.  
  1055. function fnullframe()
  1056. {
  1057.     nullframe++;
  1058.     if (nullframe >= top.tframe1 && (nullframe - top.tframe1) % top.tframe2 == 0)
  1059.     {
  1060.         parent.kbdnull.location.href = 'http://' + http_host + '/' + wwp + 'frame_kbdnull.php?' + asess + '&rnd=' + Math.random()
  1061.     }
  1062.     if (top.nullframe >= top.tframedie + 30)
  1063.     {
  1064.         top.chatalert("Связь с сайтом потеряна. Нужно, обновить сайт или проверить свое соединение с интернетом.");
  1065.         top.location.href = 'http://' + top.http_host + '/' + top.wwp + '?' + top.asess;
  1066.         return false
  1067.     }
  1068.     setTimeout("fnullframe()", 1000)
  1069. }
  1070. top.fnullframe();
  1071. var winban = 0;
  1072.  
  1073. function ban(nick, host)
  1074. {
  1075.     if (winban && !winban.closed)
  1076.     {
  1077.         winban.window.close()
  1078.     }
  1079.     winban = window.open("http://" + top.http_host + "/" + top.wwp + top.url_cmd + "?" + top.asess + "jsclose=1&c=banwindow&ni=" + nick + "&host=" + host, "winban", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=600,height=430")
  1080. }
  1081. var winbanlist = 0;
  1082.  
  1083. function banlist()
  1084. {
  1085.     if (winbanlist && !winbanlist.closed)
  1086.     {
  1087.         winbanlist.window.close()
  1088.     }
  1089.     winbanlist = window.open("http://" + top.http_host + "/" + top.wwp + top.url_cmd + "?" + top.asess + "jsclose=1&c=banlist", "banlist", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=500")
  1090. }
  1091. function sinit()
  1092. {
  1093.     userflag = 0;
  1094.     isdown = 0;
  1095.     downflag = 1;
  1096.     squickdown = 0;
  1097.     runscrl2 = 1;
  1098.     oldpostop = -1
  1099. }
  1100. sinit();
  1101. ignore_sevent = 0;
  1102. ignore_sone = 0;
  1103. tmr_scron = 0;
  1104. sevent_cnt = 0;
  1105. mousedown = 0;
  1106. startevent = 0;
  1107. emsg = [];
  1108. emsg1 = 0;
  1109. emsg2 = 0;
  1110. gcdx = 0;
  1111. setTimeout("top.squickdown=1;", 20000);
  1112.  
  1113. function irc_sevent()
  1114. {
  1115.     top.sevent_cnt++;
  1116.     var p = parent.frames.irc.document.body;
  1117.     var pos = p.scrollHeight - p.clientHeight - p.scrollTop;
  1118.     if (pos < 2)
  1119.     {
  1120.         top.downflag = 1;
  1121.         top.userflag = 0;
  1122.         top.oldpostop = p.scrollTop;
  1123.         return
  1124.     }
  1125.     if (pos < 300)
  1126.     {
  1127.         top.downflag = 0;
  1128.         top.userflag = 0;
  1129.         top.oldpostop = p.scrollTop;
  1130.         return
  1131.     }
  1132.     if (!top.ignore_sevent && top.oldpostop - 50 > p.scrollTop)
  1133.     {
  1134.         top.userflag = 1;
  1135.         top.downflag = 0
  1136.     }
  1137.     top.oldpostop = p.scrollTop
  1138. }
  1139. function irc_s()
  1140. {
  1141.     var p = parent.frames.irc.document.body;
  1142.     var pos = p.scrollHeight - p.clientHeight - p.scrollTop
  1143. }
  1144. function irc_scron()
  1145. {
  1146.     try
  1147.     {
  1148.         var p = parent.frames.irc.document.body;
  1149.         var pos = p.scrollHeight - p.clientHeight - p.scrollTop;
  1150.         if (pos < 2)
  1151.         {
  1152.             top.downflag = 1;
  1153.             top.userflag = 0
  1154.         }
  1155.         if (top.runscrl && top.runscrl2 && (top.userflag == 0 && top.downflag == 1 || pos < 300))
  1156.         {
  1157.             parent.frames.irc.scrollBy(-1, top.scrolldown)
  1158.         }
  1159.     }
  1160.     catch (_err)
  1161.     {}
  1162. }
  1163. function irc_mouseup()
  1164. {
  1165.     top.mousedown = 0;
  1166.     return true
  1167. }
  1168. function irc_mousedown()
  1169. {
  1170.     top.mousedown = 1;
  1171.     setTimeout("top.mousedown=0", 500);
  1172.     return true
  1173. }
  1174. ircconnettime = 0;
  1175. ircconnetstatus = 0;
  1176.  
  1177. function load_irc()
  1178. {
  1179.     top.ircconnettime = 0;
  1180.     top.ircconnetstatus = 1
  1181. }
  1182. function unload_irc()
  1183. {
  1184.     setTimeout("top.lostircconnect();", 2000)
  1185. }
  1186. function mydate(time)
  1187. {
  1188.     var str = "",
  1189.         d, m_hh, m_mm, m_ss;
  1190.     if (top.timeshow == 0) return "";
  1191.     if (!time)
  1192.     {
  1193.         str = "??:??:??"
  1194.     }
  1195.     else
  1196.     {
  1197.         if (parent.timetype == 1) d = new Date(time * 1000 - (parent.timezone * 1000));
  1198.         if (parent.timetype == 0) d = new Date(time * 1000 + new Date().getTimezoneOffset() - (parent.timezone * 1000));
  1199.         if (parent.timetype == 2) d = new Date(time * 1000 + new Date().getTimezoneOffset() - (parent.timezone * 1000) - parent.timediff * 1000);
  1200.         m_hh = (d.getHours() < 10 ? "0" + d.getHours() : d.getHours());
  1201.         m_mm = (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes());
  1202.         m_ss = (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds());
  1203.         if (parent.timeshow == 1) str = m_hh + ":" + m_mm + ":" + m_ss;
  1204.         if (parent.timeshow == 2) str = m_hh + ":" + m_mm + ":" + m_ss
  1205.     }
  1206.     return "<font class=time onclick=\"parent.cptime('" + str + "')\">[" + str + "] </font>"
  1207. }
  1208. function cptime(str)
  1209. {
  1210.     var p = parent.kbd.document.kbd_form.msgname;
  1211.     parent.kbd.document.kbd_form.msgname.focus();
  1212.     if (p.value.substr(p.value.length - 1, 1) != " ") p.value += " ";
  1213.     p.value += str;
  1214.     p.value += " "
  1215. }
  1216. function bye(msg)
  1217. {
  1218.     setTimeout("bye2()", 1000);
  1219.     parent.frames.irc.document.write("<hr size=1 noshade><center><font color=red><b>сервер завершает соединение</b></font></center><hr size=1 noshade>");
  1220.     top.rirclist = 0;
  1221.     parent.frames.irc.scroll(1, 1000000);
  1222.     top.byemsg = msg
  1223. }
  1224. var byemsg = new String("");
  1225.  
  1226. function bye2()
  1227. {
  1228.     top.chatalert(top.byemsg);
  1229.     setTimeout("top.location.href='http://'+top.http_host+':'+top.httpport+'/'+top.wwp+'?goodbye=1'+top.asess;", 5000)
  1230. }
  1231. function isset(x)
  1232. {
  1233.     if (!x) return 0;
  1234.     if (x.length == 0) return 0;
  1235.     return 1
  1236. }
  1237. function unixtime()
  1238. {
  1239.     var s = ((new Date()).getTime()).toString();
  1240.     return s.substr(0, s.length - 3)
  1241. }
  1242. function reloadfirc()
  1243. {
  1244.     gebi('irc').src = 'http://netchat.ru/chat/firc.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1245. }
  1246. function _in(func, time, host, nick, css, nickhtml, p1, p2, p3, p4, p5, p6)
  1247. {
  1248.     var nf, nw, ns, nct, ncf, tf, tw, ts, tct, tcf, foundnick = 0;
  1249.     top.gcdx++;
  1250.     if (top.gcdx > 1000)
  1251.     {
  1252.         top.chatalert("Внимание накопилось слишком большое количество сообщений в Вашем окне.<br>Это может повлечть лаги и торможение браузера.<br>Рекомендуется обновить окно сообщений.<br><br><center><a onclick='top.reloadfirc(); return false;'href='#'>Обновить окно</a> | <a onclick='top.hidechatalert(); return false;' href='#'>Закрыть</a></center>");
  1253.         top.gcdx = 0
  1254.     }
  1255.     if (css == "") css = "|||||||||";
  1256.     css = css.split("|");
  1257.     if (css.length != 10) css = "|||||||||".split("|");
  1258.     nf = (!isset(css[0]) ? top.defnick_f : top.listmain_f[css[0]]);
  1259.     nw = (!isset(css[1]) ? top.defnick_w : top.listmain_w[css[1]]);
  1260.     ns = (!isset(css[2]) ? top.defnick_s : css[2] + "pt");
  1261.     nct = (!isset(css[3]) ? top.defnick_ct : top.listnick_ct[css[3]]);
  1262.     ncf = (!isset(css[4]) ? top.defnick_cf : top.listnick_cf[css[4]]);
  1263.     tf = (!isset(css[5]) ? top.deftext_f : top.listmain_f[css[5]]);
  1264.     tw = (!isset(css[6]) ? top.deftext_w : top.listmain_w[css[6]]);
  1265.     ts = (!isset(css[7]) ? top.deftext_s : css[7] + "pt");
  1266.     tct = (!isset(css[8]) ? top.deftext_ct : top.listtext_ct[css[8]]);
  1267.     tcf = (!isset(css[9]) ? top.deftext_cf : top.listtext_cf[css[9]]);
  1268.     if (top.mynick != nick)
  1269.     {
  1270.         if (top.ignore_nicks)
  1271.         {
  1272.             nct = top.defnick_ct;
  1273.             ncf = top.defnick_cf
  1274.         }
  1275.         if (top.ignore_texts)
  1276.         {
  1277.             tct = top.deftext_ct;
  1278.             tcf = top.deftext_cf
  1279.         }
  1280.         if (top.ignore_fonts)
  1281.         {
  1282.             nf = top.defnick_f;
  1283.             nw = top.defnick_w;
  1284.             ns = top.defnick_s;
  1285.             tf = top.deftext_f;
  1286.             tw = top.deftext_w;
  1287.             ts = top.deftext_s
  1288.         }
  1289.     }
  1290.     css2 = nf + "|" + nw + "|" + ns + "|" + nct + "|" + ncf + "|" + tf + "|" + tw + "|" + ts + "|" + tct + "|" + tcf;
  1291.     css = css2.split("|");
  1292.     var x = p1.toLowerCase().replace(/<\/?.+?>/g, ' '),
  1293.         y = mynick.toLowerCase();
  1294.     if (nick != mynick && (x.indexOf(y + ":") > -1 || x.indexOf(" " + y) > -1 || x.indexOf(y + " ") > -1 || x.indexOf(y + ",") > -1 || x.indexOf(y + ".") > -1 || x.indexOf(y + "?") > -1 || x.indexOf('&lt;' + y + '&gt;') > -1 || x == y)) foundnick = 1;
  1295.     if (!eventsgo) startevent = 0;
  1296.     var time_wins = time;
  1297.     switch (func)
  1298.     {
  1299.     case "q_privpost":
  1300.         top.tot_nicks = 0;
  1301.         if (top.cook_swf == 1) p2 = p2.replace("embed ", "xembed ");
  1302.         if (lite_version == 1) p2 = gradmsg(nick, p2);
  1303.         _out('00B800', css, time, top.timeshow_priv, "<a style=\"cursor: pointer; cursor: hand;\" onClick=\"javascript:top.nickpriv('" + p1 + "')\" onMouseOver=\"window.status='Послать сообщение в приват, его получит только пользователь " + p1 + "'; top.mnick='" + p1 + "'; top.select=1; return true;\" onMouseClick=\"window.status='" + top.copy + "'; top.select=1; return true\" onMouseOut=\"window.status='" + top.copy + "'; top.select=2;\" target=kbdpost><font class=privpost1 color=black>&nbsp;Лично для <b><font class=privpost2>" + p1 + "</font>:</b>&nbsp;</font></a><a onclick=\"top.userMenuShow('" + nick + "','" + host + "','" + time_wins + "',this, event,0); return false;\" style=\"cursor: pointer; cursor: hand;\" target=\"_blank\"><img border=0 src=\"http://help.mail.ru/js/user_arrow_pas.gif\" width=\"13\" height=\"13\" alt=\"Меню пользователя\" title=\"Меню пользователя\" align=\"absbottom\"></a>" + nbsp() + "<span class=msg " + textcss(css) + " onMouseOver=\"top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; top.select=3; return true;\" onMouseClick=\"top.select=3; top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; return true;\" onMouseOut=\"top.select=2;\"> " + p2 + "</span>");
  1304.         updateidle(nick, time);
  1305.         break;
  1306.     case "q_privget":
  1307.         if (top.cook_swf == 1) p2 = p2.replace("embed ", "xembed ");
  1308.         if (lite_version == 1) p2 = gradmsg(nick, p2);
  1309.         _out('FF3300', css, time, top.timeshow_priv, "<a style=\"cursor: pointer; cursor: hand;\" onClick=\"javascript:top.nickpriv('" + p1 + "')\" onMouseOver=\"window.status='Послать сообщение в приват, его получит только пользователь " + p1 + "'; top.mnick='" + nick + "'; top.mhost='" + host + "'; top.select=1; return true;\" onMouseClick=\"window.status='" + top.copy + "'; top.select=1; return true\" onMouseOut=\"window.status='" + top.copy + "'; top.select=2;\" target=kbdpost><font class=privget1>&nbsp;Лично от <b><font class=privget2>" + nick + "</font>:</b>&nbsp;</font></a><a onclick=\"top.userMenuShow('" + nick + "','" + host + "','" + time_wins + "',this, event,0); return false;\" style=\"cursor: pointer; cursor: hand;\" target=\"_blank\"><img border=0 src=\"http://help.mail.ru/js/user_arrow_pas.gif\" width=\"13\" height=\"13\" alt=\"Меню пользователя\" title=\"Меню пользователя\" align=\"absbottom\"></a>" + nbsp() + "<span id=" + time_wins + " class=msg " + textcss(css) + " onMouseOver=\"top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; top.select=3; return true;\" onMouseClick=\"top.select=3; top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; return true;\" onMouseOut=\"top.select=2;\"> " + p2 + "</span>");
  1310.         updateidle(p1, time);
  1311.         break;
  1312.     case "q_allmsg":
  1313.         top.tot_nicks = 0;
  1314.         mcol = "AAAAAA";
  1315.         if (top.cook_swf == 1) p1 = p1.replace("embed ", "xembed ");
  1316.         if (nick == top.mynick)
  1317.         {
  1318.             css = replace_mymsg(css);
  1319.             mcol = "00B800"
  1320.         }
  1321.         else if (foundnick)
  1322.         {
  1323.             css = replace_msgforme(css);
  1324.             mcol = "FF3300"
  1325.         }
  1326.         if (top.onlyprivate && !foundnick && nick != top.mynick) break;
  1327.         if (lite_version == 1) p1 = gradmsg(nick, p1);
  1328.         _out(mcol, css, time, top.timeshow_msg, outnick(host, nick, nickhtml, "nick", css, 1) + nbsp() + "<a onclick=\"top.userMenuShow('" + nick + "','" + host + "','" + time_wins + "',this, event,0); return false;\" style=\"cursor: pointer; cursor: hand;\" target=\"_blank\"><img border=0 src=\"http://help.mail.ru/js/user_arrow_pas.gif\" width=\"13\" height=\"13\" alt=\"Меню пользователя\" title=\"Меню пользователя\" align=\"absbottom\"></a>" + nbsp() + "<span id=" + time_wins + " class=msg " + textcss(css) + " onMouseOver=\"top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; top.select=3; return true;\" onMouseClick=\"top.select=3; top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; return true;\" onMouseOut=\"top.select=2;\">" + p1 + "</span>");
  1329.         updateidle(nick, time);
  1330.         break;
  1331.     case "q_allmsgme":
  1332.         mcol = "AAAAAA";
  1333.         if (top.cook_swf == 1) p1 = p1.replace("embed ", "xembed ");
  1334.         if (nick == top.mynick)
  1335.         {
  1336.             css = replace_mymsg(css);
  1337.             mcol = "00B800"
  1338.         }
  1339.         else if (foundnick)
  1340.         {
  1341.             css = replace_msgforme(css);
  1342.             mcol = "FF3300"
  1343.         }
  1344.         if (top.onlyprivate && !foundnick && nick != top.mynick) break;
  1345.         css[4] = css[9];
  1346.         _out(mcol, css, time, top.timeshow_msg, outnickme(host, nick, nickhtml, "nickme", css, 1) + nbsp() + "<a onclick=\"top.userMenuShow('" + nick + "','" + host + "','" + time_wins + "',this, event,0); return false;\" style=\"cursor: pointer; cursor: hand;\" target=\"_blank\"><img border=0 src=\"http://help.mail.ru/js/user_arrow_pas.gif\" width=\"13\" height=\"13\" alt=\"Меню пользователя\" title=\"Меню пользователя\" align=\"absbottom\"></a>" + nbsp() + "<span id=" + time_wins + " class=msg " + textcss(css) + " onMouseOver=\"top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; top.select=3; return true;\" onMouseClick=\"top.select=3; top.mnick='" + nick + "'; top.timeids='" + time_wins + "'; return true;\" onMouseOut=\"top.select=2;\">" + p1 + "</span>");
  1347.         if (p2 != "<away>") updateidle(nick, time);
  1348.         break;
  1349.     case "q_allmsgbig":
  1350.         mcol = "AAAAAA";
  1351.         if (top.cook_swf == 1) p1 = p1.replace("embed ", "xembed ");
  1352.         if (nick == top.mynick)
  1353.         {
  1354.             css = replace_mymsg(css);
  1355.             mcol = "00B800"
  1356.         }
  1357.         else if (foundnick)
  1358.         {
  1359.             css = replace_msgforme(css);
  1360.             mcol = "FF3300"
  1361.         }
  1362.         _out(mcol, css, time, top.timeshow_msg, outnick(host, nick, nickhtml, "nick", css, 1) + nbsp() + "<font class=msgbig " + textcss(css) + "><font class=msgbig>" + p1 + "</font></font>");
  1363.         updateidle(nick, time);
  1364.         break;
  1365.     case "q_join":
  1366.         if (top.cook_swf == 1) p1 = p1.replace("embed ", "xembed ");
  1367.         if (lite_version == 1) p1 = joinfraz(nick, p1);
  1368.         if (p2 != "sdj239eyklfneruiwfuierih340rfmhomdfekejrh3rh34rf34ioru08y39riuerhuh489ry934ruo45tfhuibwf")
  1369.         {
  1370.             p1 = p1.replace(/{@nick}/, outnick(host, nick, "", "join_nick", css, 0));
  1371.             _out('FFC800', css, time, top.timeshow_join, "<font class=join><font face=Webdings>8</font> " + p1 + (host != "" ? "&nbsp;[<a href='http://netchat.ru/chat/whois.php?type=ripe&host=" + host + "' target=_blank><b>&nbsp;info&nbsp;</b></a>] - [" + host + "]" : "") + "</font>")
  1372.         }
  1373.         if (startevent && nick != mynick) js_e_join(time, 'join', nick, '');
  1374.         break;
  1375.     case "q_part":
  1376.         if (top.cook_swf == 1) p1 = p1.replace("embed ", "xembed ");
  1377.         if (lite_version == 1) p1 = partfraz(nick, p1);
  1378.         p1 = p1.replace(/{@nick}/, outnick(host, nick, "", "part_nick", css, 0));
  1379.         p7 = '';
  1380.         if (p2.indexOf('connection') > -1 || p2.indexOf('timeout') > -1) p2 = 'Связь была потеряна...';
  1381.         _out('FFC800', css, time, top.timeshow_join, p7 + " <font class=part><font face=Webdings>7</font>" + p1 + (p2 != "" ? " (" + p2 + ")" : "") + (host != "" ? "&nbsp;[<a href='http://netchat.ru/chat/whois.php?type=ripe&host=" + host + "' target=_blank><b>&nbsp;info&nbsp;</b></a>] - [" + host + "]" : "") + "</font>");
  1382.         break;
  1383.     case "q_notice":
  1384.         _out('3399CC', css, time, top.timeshow_notice, "<font class=notice><font face=fixedsys>*</font> " + p1 + "</font>");
  1385.         if (startevent) js_e_ntc(time, 'ntc', '', p1);
  1386.         break;
  1387.     case "q_modes":
  1388.         _out('3399CC', css, time, top.timeshow_notice, "<font class=modes>" + p1 + "</font>");
  1389.         if (startevent) js_e_ntc(time, 'ntc', '', p1);
  1390.         break;
  1391.     default:
  1392.         parent.frames.irc.document.write("<font color=red size=-1><b>Ошибка287: Неизвестный тип сообщения: " + func + "</b></font><br>")
  1393.     }
  1394.     if (startevent)
  1395.     {
  1396.         if ((func == 'q_allmsg' || func == 'q_allmsgme' || func == 'q_allmsgbig') && foundnick)
  1397.         {
  1398.             if (evbuf1.indexOf("<" + nick + ">") == -1)
  1399.             {
  1400.                 js_e_m1(time, 'm1', nick, p1);
  1401.                 evbuf1 = "<" + nick + ">" + evbuf1.substr(0, 4000)
  1402.             }
  1403.             else js_e_m2(time, 'm2', nick, p1)
  1404.         }
  1405.         if (func == 'q_privget')
  1406.         {
  1407.             if (evbuf2.indexOf("<" + nick + ">") == -1)
  1408.             {
  1409.                 js_e_pm1(time, 'pm1', nick, p2);
  1410.                 evbuf2 = "<" + nick + ">" + evbuf2.substr(0, 4000)
  1411.             }
  1412.             else js_e_pm2(time, 'pm2', nick, p2)
  1413.         }
  1414.     }
  1415.     top.rirclist = 0
  1416. }
  1417. var evbuf1 = "";
  1418. var evbuf2 = "";
  1419.  
  1420. function nbsp()
  1421. {
  1422.     return "<font class=nbsp>&nbsp;</font>"
  1423. }
  1424. function textcss(css)
  1425. {
  1426.     return " style='" + "font: " + css[7] + " " + css[5] + ";" + "font-weight: " + css[6] + ";" + "color: " + css[8] + ";" + "background: " + css[9] + ";" + "' "
  1427. }
  1428. function nickcss(css)
  1429. {
  1430.     return " style='" + "font: " + css[2] + " " + css[0] + ";" + "font-weight: " + css[1] + ";" + "color: " + css[3] + ";" + "background: " + css[4] + ";" + "' "
  1431. }
  1432. function replace_mymsg(css)
  1433. {
  1434.     if (!top.mymsg_blink) return css;
  1435.     css[5] = (top.mymsg_f == "" ? css[5] : top.mymsg_f);
  1436.     css[6] = (top.mymsg_w == "" ? css[6] : top.mymsg_w);
  1437.     css[7] = (top.mymsg_f == "" ? css[7] : top.mymsg_f);
  1438.     css[8] = (top.mymsg_ct == "" ? css[8] : top.mymsg_ct);
  1439.     css[9] = (top.mymsg_cf == "" ? css[9] : top.mymsg_cf);
  1440.     return css
  1441. }
  1442. function replace_msgforme(css)
  1443. {
  1444.     if (!top.msgforme_blink) return css;
  1445.     css[5] = (top.msgforme_f == "" ? css[5] : top.msgforme_f);
  1446.     css[6] = (top.msgforme_w == "" ? css[6] : top.msgforme_w);
  1447.     css[7] = (top.msgforme_f == "" ? css[7] : top.msgforme_f);
  1448.     css[8] = (top.msgforme_ct == "" ? css[8] : top.msgforme_ct);
  1449.     css[9] = (top.msgforme_cf == "" ? css[9] : top.msgforme_cf);
  1450.     if (top.msgforme_frep) css[4] = css[9];
  1451.     return css
  1452. }
  1453. var tmr_sevent = 0;
  1454.  
  1455. function _out(m_col, css, time, show, html)
  1456. {
  1457.     top.ignore_sevent = 1;
  1458.     if (top.tmr_sevent) clearTimeout(top.tmr_sevent);
  1459.     top.tmr_sevent = setTimeout("top.ignore_sevent=0; ", 500);
  1460.     parent.frames.irc.document.write("<table width='100%' border=0 style='margin-top:1px;margin-bottom:1px;' cellspacing=0 cellpadding=0 " + (css[9] ? "bgcolor=" + css[9] : "") + "><tr><td bgcolor='#" + m_col + "'><img src='/i/blank.gif' width=3 height=1 alt=''></td><td><img src='/i/blank.gif' width=3 height=1 alt=''></td><td width='100%'>" + (show ? top.mydate(time) : "") + html + "</td></tr></table>")
  1461. }
  1462. function outnick(host, nick, nickhtml, fclass, css, needcss)
  1463. {
  1464.     if (nickhtml == '')
  1465.     {
  1466.         nick1 = top.nickprint_1;
  1467.         nick2 = nick;
  1468.         nick3 = top.nickprint_2
  1469.     }
  1470.     else
  1471.     {
  1472.         var tmp = nickhtml.split("`");
  1473.         nick1 = tmp[0];
  1474.         nick2 = tmp[1];
  1475.         nick3 = tmp[2]
  1476.     }
  1477.     return xoutnick(host, nick, nick1, nick2, nick3, fclass, css, needcss)
  1478. }
  1479. function outnickme(host, nick, nickhtml, fclass, css, needcss)
  1480. {
  1481.     nick1 = top.nickprint_me1;
  1482.     nick3 = top.nickprint_me2;
  1483.     if (nickhtml == '') nick2 = nick;
  1484.     else
  1485.     {
  1486.         var tmp = nickhtml.split("`");
  1487.         nick2 = tmp[1]
  1488.     }
  1489.     return xoutnick(host, nick, nick1, nick2, nick3, fclass, css, needcss)
  1490. }
  1491. function xoutnick(host, nick, nick1, nick2, nick3, fclass, css, needcss)
  1492. {
  1493.     if (fclass == 'join_nick' || fclass == 'part_nick') nick3 = '';
  1494.     if (lite_version == 1)
  1495.     {
  1496.         nick2 = gradnick(nick2)
  1497.     }
  1498.     return "<a style=\"cursor: pointer; cursor: hand;\" onClick=\"javascript:top.nickcopy('" + nick + "')\" " + "onMouseOver=\"window.status=top.st('" + nick + "'); top.mnick='" + nick + "'; top.mhost='" + host + "'; top.select=1; return true\" " + "onMouseClick=\"window.status='" + top.copy + "'; top.select=1; return true\" " + "onMouseOut=\"window.status='" + top.copy + "'; top.select=2;\" target=kbdpost>" + "<font class=" + fclass + " " + (needcss ? nickcss(css) : "") + "onMouseOver=\"this.style.color='" + top.activenick_ct + "'; this.style.backgroundColor='" + top.activenick_cf + "'; \" " + "onMouseOut=\"this.style.color='" + (needcss ? css[3] : "") + "'; this.style.backgroundColor='" + (needcss ? css[4] : "") + "';  \">" + nick1 + nick2 + nick3 + "</font></a>"
  1499. }
  1500. function userlist_init(x)
  1501. {
  1502.     var num;
  1503.     top.user = new Array();
  1504.     top.userinfo = new Array();
  1505.     for (var i = 0; i < x.length; i++)
  1506.     {
  1507.         top._j(2, '', x[i][0], x[i][1], x[i][2], x[i][3], x[i][4], x[i][5], x[i][6], x[i][7], x[i][8], x[i][9], x[i][10], x[i][11], x[i][12], x[i][13], x[i][14])
  1508.     }
  1509.     for (i = 0; i < pre_ignore.length; i++)
  1510.     {
  1511.         num = nick2num(top.pre_ignore[i]);
  1512.         if (num >= 0) top.userinfo[num][4] = 1
  1513.     }
  1514. }
  1515. function _j(type, skinmsg, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14)
  1516. {
  1517.     if (type == 0 || type == 1) top._in("q_join", p14, p3, p0, p12, p13, skinmsg);
  1518.     if (type == 1 || type == 2)
  1519.     {
  1520.         num = top.user2num(p0);
  1521.         if (num == -1) num = top.user.length;
  1522.         top.user[num] = [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14];
  1523.         top.userinfo[num] = [top.str2chr(p0, 3), type == 1 ? 0 : 1, "", "", 0];
  1524.         top.userlist_sort();
  1525.         top.userlist_show()
  1526.     }
  1527. }
  1528. function _p(type, skinmsg, nick, time, partmsg)
  1529. {
  1530.     num = top.user2num(nick);
  1531.     if (type == 0 || type == 1) if (num == -1) top._in("q_part", time, "", nick, "", "", skinmsg, partmsg);
  1532.     else
  1533.     {
  1534.         v = top.user[num];
  1535.         top._in("q_part", time, v[3], nick, v[12], v[13], skinmsg, partmsg)
  1536.     }
  1537.     if (type == 1 || type == 2)
  1538.     {
  1539.         if (num == -1) return;
  1540.         top.user = unset(top.user, num);
  1541.         top.userinfo = unset(top.userinfo, num)
  1542.     }
  1543.     top.userlist_show()
  1544. }
  1545. function _u(time, arr)
  1546. {
  1547.     var nick, num, digit, i;
  1548.     top.rirclist = 0;
  1549.     for (i = 0; i < arr.length; i++)
  1550.     {
  1551.         nick = arr[i][0];
  1552.         num = top.user2num(nick);
  1553.         if (num == -1)
  1554.         {
  1555.             parent.frames.irc.location.href = parent.frames.irc.location.href;
  1556.             return
  1557.         }
  1558.         digit = arr[i][1];
  1559.         if ((digit & 1) > 0) top.userinfo[num][1] = arr[i][1 + 1];
  1560.         if ((digit & 2) > 0)
  1561.         {
  1562.             top.user[num][8] = arr[i][1 + 2];
  1563.             updateidle(nick, time)
  1564.         }
  1565.         if ((digit & 4) > 0) top.user[num][10] = arr[i][1 + 3];
  1566.         if ((digit & 8) > 0)
  1567.         {
  1568.             top.user[num][1] = arr[i][1 + 4];
  1569.             top.s3 = arr[i][1 + 4]
  1570.         }
  1571.         if ((digit & 16) > 0) top.userinfo[num][2] = arr[i][1 + 5]
  1572.     }
  1573.     top.userlist_show()
  1574. }
  1575. function updateidle(nick, time)
  1576. {
  1577.     var num = top.user2num(nick);
  1578.     if (num == -1) return;
  1579.     if (!time) time = unixtime();
  1580.     top.user[num][10] = "";
  1581.     top.user[num][11] = time;
  1582.     top.userinfo[num][3] = "";
  1583.     top.userlist_show()
  1584. }
  1585. function _set_ignore(nicks)
  1586. {
  1587.     var num, i;
  1588.     nicks = nicks.split(":");
  1589.     for (i = 0; i < top.userinfo.length; i++)
  1590.     {
  1591.         top.userinfo[i][4] = 0
  1592.     }
  1593.     for (i = 0; i < nicks.length; i++)
  1594.     {
  1595.         num = top.user2num(nicks[i]);
  1596.         if (num >= 0) top.userinfo[num][4] = 1
  1597.     }
  1598.     top.userlist_show()
  1599. }
  1600. function _add_ignore(nick)
  1601. {
  1602.     var num;
  1603.     num = top.user2num(nick);
  1604.     if (num >= 0) top.userinfo[num][4] = 1;
  1605.     top.userlist_show()
  1606. }
  1607. function _del_ignore(nick)
  1608. {
  1609.     var num;
  1610.     if (nick == "*")
  1611.     {
  1612.         for (i = 0; i < top.userinfo.length; i++) top.userinfo[i][4] = 0
  1613.     }
  1614.     else
  1615.     {
  1616.         num = top.user2num(nick);
  1617.         if (num >= 0) top.userinfo[num][4] = 0
  1618.     }
  1619.     top.userlist_show()
  1620. }
  1621. function hide_demos()
  1622. {
  1623.     document.getElementById("demos").style.display = "none"
  1624. }
  1625. function add_photo(place)
  1626. {
  1627.     var div = gebi("chat_info_div");
  1628.     div.src = "http://netchat.ru/ajax/loading.html";
  1629.     div.src = "http://netchat.ru/chat/add_photo.php";
  1630.     div.style.top = absPosition(place).y - 150;
  1631.     div.style.left = absPosition(place).x - 335;
  1632.     div.style.display = "block"
  1633. }
  1634. function check_orfo(place)
  1635. {
  1636.     var div = gebi("chat_info_div");
  1637.     div.src = "http://netchat.ru/ajax/loading.html";
  1638.     var orfo_text = parent.kbd.document.kbd_form.msgname.value;
  1639.     div.src = "http://netchat.ru/ajax/orfo.php?t=" + escape(orfo_text);
  1640.     div.style.top = absPosition(place).y - 150;
  1641.     div.style.left = absPosition(place).x - 335;
  1642.     div.style.display = "block"
  1643. }
  1644. function hidechatalert()
  1645. {
  1646.     gebi("alert_chat_div").style.display = "none";
  1647.     return false
  1648. }
  1649. function chatalert(text)
  1650. {
  1651.     var div = gebi("alert_chat_div");
  1652.     gebi("chat_alert_text").innerHTML = text;
  1653.     div.style.top = pageHeight() / 2 - 80;
  1654.     div.style.left = pageWidth() / 2 - 110;
  1655.     div.style.display = "block"
  1656. }
  1657. function hide_check_orfo()
  1658. {
  1659.     gebi("chat_info_div").style.display = "none";
  1660.     gebi("chat_info_div").src = "http://netchat.ru/ajax/loading.html";
  1661.     return false
  1662. }
  1663. function chatModer(_link, id)
  1664. {
  1665.     top.topChatModer(id, absPosition(_link).x, absPosition(_link).y, document.body.scrollTop);
  1666.     return false
  1667. }
  1668. function topChatModer(id, x, y, frameScroll)
  1669. {
  1670.     var iframe, userList, top, left;
  1671.     gebi("for_user_info").src = "http://netchat.ru/ajax/loading.html";
  1672.     hideModerChat();
  1673.     iframe = gebi("for_user_info");
  1674.     userList = gebi("list");
  1675.     iframe.src = "http://netchat.ru/ajax/uinfo.php?login=" + escape(id);
  1676.     iframe.style.display = "block";
  1677.     top = absPosition(userList).y + 22;
  1678.     iframe.style.top = top > 0 ? top : 0;
  1679.     left = absPosition(userList).x + x - iframe.offsetWidth + 20;
  1680.     iframe.style.left = left > 0 ? left : 0
  1681. }
  1682. function hideModerChat()
  1683. {
  1684.     gebi("for_user_info").style.display = "none";
  1685.     gebi("for_user_info").src = "http://netchat.ru/ajax/loading.html";
  1686.     return false
  1687. }
  1688. function ChangeSearchAction(type)
  1689. {
  1690.     if (type == 2)
  1691.     {
  1692.         document.getElementById("frame_a_more").style.display = "";
  1693.         document.getElementById("frame_c_more").style.display = "none";
  1694.         document.getElementById("frame_b_more").style.display = "none";
  1695.         document.getElementById("frame_me_more").style.display = "none";
  1696.         document.getElementById("stype_1").style.display = "none";
  1697.         document.getElementById("stype_2").style.display = ""
  1698.     }
  1699.     else
  1700.     {
  1701.         document.getElementById("frame_c_more").style.display = "";
  1702.         document.getElementById("frame_a_more").style.display = "none";
  1703.         document.getElementById("frame_b_more").style.display = "none";
  1704.         document.getElementById("frame_me_more").style.display = "none";
  1705.         document.getElementById("stype_1").style.display = "";
  1706.         document.getElementById("stype_2").style.display = "none"
  1707.     }
  1708. }
  1709. function ChangeSx()
  1710. {
  1711.     document.getElementById("frame_b_more").style.display = "";
  1712.     document.getElementById("frame_c_more").style.display = "none";
  1713.     document.getElementById("frame_a_more").style.display = "none";
  1714.     document.getElementById("frame_me_more").style.display = "none"
  1715. }
  1716. function ChangeSxx()
  1717. {
  1718.     document.getElementById("frame_me_more").style.display = "";
  1719.     document.getElementById("frame_b_more").style.display = "none";
  1720.     document.getElementById("frame_c_more").style.display = "none";
  1721.     document.getElementById("frame_a_more").style.display = "none"
  1722. }
  1723. function gotrn()
  1724. {
  1725.     var trn = document.more_form.trn.checked ? 1 : 0;
  1726.     var url = 'http://' + top.http_host + '/' + top.wwp + 'setup.php?c=translit&trn=' + trn + top.asess;
  1727.     parent.frames.kbdpost.location = url
  1728. }
  1729. function more_swf()
  1730. {
  1731.     if (top.cook_swf == 1)
  1732.     {
  1733.         top.cook_swf = 0;
  1734.         if (top.cook_swf == 0) top.chatalert("Вы услышите все звуковые команды чата! Звуковые уведомления чата настраиваются отдельно на вашей странице настроек.")
  1735.     }
  1736.     else
  1737.     {
  1738.         top.cook_swf = 1;
  1739.         if (top.cook_swf == 1) top.chatalert("Вы более не будете слышать звуковых команд чата! Звуковые уведомления чата настраиваются отдельно на вашей странице настроек.")
  1740.     }
  1741.     top.putCookie("swf_disable", top.cook_swf)
  1742. }
  1743. function kbdtime()
  1744. {
  1745.     top.mytimes = top.mytimes + 1;
  1746.     if (top.mytimes == 60)
  1747.     {
  1748.         top.mytimes = 0;
  1749.         top.mytimem = top.mytimem + 1;
  1750.         if (top.mytimem == 60)
  1751.         {
  1752.             top.mytimem = 0;
  1753.             top.mytimeh = top.mytimeh + 1
  1754.         }
  1755.     }
  1756.     gebi("chatdate").innerHTML = top.zero2(top.mytimeh) + ":" + top.zero2(top.mytimem) + ":" + top.zero2(top.mytimes);
  1757.     setTimeout("kbdtime()", 1000)
  1758. }
  1759. var clock_i = 0;
  1760.  
  1761. function clock_form()
  1762. {
  1763.     clock_time = (timethisx + clock_i) * 1000;
  1764.     clock_i = clock_i + 1;
  1765.     d = new Date(clock_time + new Date().getTimezoneOffset() - (parent.timezone * 1000));
  1766.     m_hh = (d.getHours() < 10 ? "0" + d.getHours() : d.getHours());
  1767.     m_mm = (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes());
  1768.     m_ss = (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds());
  1769.     m_dd = (d.getDate() < 10 ? "0" + d.getDate() : d.getDate());
  1770.     m_mo = ((d.getMonth() + 1) < 10 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1));
  1771.     m_yy = d.getYear();
  1772.     str = m_dd + "/" + m_mo + "/" + m_yy + " " + m_hh + ":" + m_mm + ":" + m_ss;
  1773.     gebi("htmlDate").innerHTML = str;
  1774.     setTimeout("clock_form()", 1000)
  1775. }
  1776. function close_right()
  1777. {
  1778.     gebi("right_block").style.display = "none";
  1779.     gebi("right_menu").innerHTML = '<img onclick="tc();open_right();return false;" onMouseOver="ts(this, event, 2);" onMouseOut="tc()" style="cursor: pointer; cursor: hand;" src="/i/right_open.gif" width=15 border=0 alt="" height=74 vspace=9><br>';
  1780.     set_focus()
  1781. }
  1782. function open_right()
  1783. {
  1784.     gebi("right_block").style.display = "";
  1785.     gebi("right_menu").innerHTML = '<img onclick="tc();close_right();return false;" onMouseOver="ts(this, event, 1)" onMouseOut="tc()" style="cursor: pointer; cursor: hand;" src="/i/right_close.gif" width=15 border=0 alt="" height=51 vspace=9><br>';
  1786.     set_focus()
  1787. }
  1788. function close_down()
  1789. {
  1790.     gebi("down_block").style.display = "none";
  1791.     gebi("down_menu").innerHTML = '<img onclick="open_down();return false;" style="cursor: pointer; cursor: hand;" src="/i/down_open.gif" width=74 border=0 alt="" height=15 vspace=1><br>';
  1792.     set_focus()
  1793. }
  1794. function open_down()
  1795. {
  1796.     gebi("down_block").style.display = "";
  1797.     gebi("down_menu").innerHTML = '<img onclick="tc();close_down();return false;" onMouseOver="ts(this, event, 1)" onMouseOut="tc()" style="cursor: pointer; cursor: hand;" src="/i/down_close.gif" width=51 border=0 alt="" height=15 vspace=1><br>';
  1798.     set_focus()
  1799. }
  1800. var frm_more_load = 0;
  1801. var frm_list_load = 0;
  1802. var frm_kbd_load = 0;
  1803. var frm_firc_load = 0;
  1804. var frm_kbdnull_load = 0;
  1805. var frm_snd_load = 0;
  1806.  
  1807. function check_load()
  1808. {
  1809.     var loaded = 0;
  1810.     if (top.frm_more_load == 0)
  1811.     {
  1812.         loaded = loaded + 1;
  1813.         gebi("more").src = 'http://netchat.ru/chat/frame_more.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1814.     }
  1815.     if (top.frm_list_load == 0)
  1816.     {
  1817.         loaded = loaded + 1;
  1818.         gebi("list").src = 'http://netchat.ru/chat/frame_list.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1819.     }
  1820.     if (top.frm_kbd_load == 0)
  1821.     {
  1822.         loaded = loaded + 1;
  1823.         gebi("kbd").src = 'http://netchat.ru/chat/frame_kbd.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1824.     }
  1825.     if (top.frm_firc_load == 0)
  1826.     {
  1827.         loaded = loaded + 1;
  1828.         gebi("irc").src = 'http://netchat.ru/chat/firc.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1829.     }
  1830.     if (top.frm_kbdnull_load == 0)
  1831.     {
  1832.         loaded = loaded + 1;
  1833.         gebi("kbdnull").src = 'http://netchat.ru/chat/frame_kbdnull.php?&PHPSESSID=f6aeb848d082140f500bbae2e396c8e2&'
  1834.     }
  1835.     if (loaded > 0)
  1836.     {
  1837.         setTimeout("check_load()", 5000)
  1838.     }
  1839. }
  1840. function put_smiles(smile)
  1841. {
  1842.     var p = parent.frames.kbd.document.kbd_form;
  1843.     p.msgname.value = p.msgname.value + ' :' + smile + ': ';
  1844.     p.msgname.focus()
  1845. }
  1846. function openfoto(a)
  1847. {
  1848.     window.open('http://netchat.ru/ajax/show_photo.php?id=' + a, '_blank', 'width=120,height=120,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,status=no')
  1849. }
Advertisement
Add Comment
Please, Sign In to add comment