Guest User

Untitled

a guest
Dec 30th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function (a) {
  2.     var b = !1,
  3.         c = [],
  4.         d = function () {
  5.             if (!b && (b = !0, a.htmlNode = geByTag1("html"), a.bodyNode = geByTag1("body"), c)) {
  6.                 for (var d = null; d = c.shift();) d.call(document);
  7.                 c = null
  8.             }
  9.         };
  10.     document.addEventListener ? document.addEventListener("DOMContentLoaded", function () {
  11.         document.removeEventListener("DOMContentLoaded", arguments.callee, !1);
  12.         d()
  13.     }, !1) : document.attachEvent && document.attachEvent("onreadystatechange", function () {
  14.         "complete" === document.readyState && (document.detachEvent("onreadystatechange", arguments.callee), d())
  15.     });
  16.     a.addEventListener ? a.addEventListener("load", d, !1) : a.attachEvent ? a.attachEvent("onload", d) : a.onload = d;
  17.     a.onDOMReady = function (a) {
  18.         b ? a.call(document) : c.push(a)
  19.     }
  20. })(window);
  21. if (!window._ua) var _ua = navigator.userAgent.toLowerCase();
  22. var browser = {
  23.     version: (_ua.match(/.+(?:me|ox|on|rv|it|era|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],
  24.     opera: /opera/i.test(_ua),
  25.     msie: /msie/i.test(_ua) && !/opera/i.test(_ua),
  26.     msie6: /msie 6/i.test(_ua) && !/opera/i.test(_ua),
  27.     msie7: /msie 7/i.test(_ua) && !/opera/i.test(_ua),
  28.     msie8: /msie 8/i.test(_ua) && !/opera/i.test(_ua),
  29.     msie9: /msie 9/i.test(_ua) && !/opera/i.test(_ua),
  30.     mozilla: /firefox/i.test(_ua),
  31.     chrome: /chrome/i.test(_ua),
  32.     safari: !/chrome/i.test(_ua) && /webkit|safari|khtml/i.test(_ua),
  33.     iphone: /iphone/i.test(_ua),
  34.     ipod: /ipod/i.test(_ua),
  35.     iphone4: /iphone.*OS 4/i.test(_ua),
  36.     ipod4: /ipod.*OS 4/i.test(_ua),
  37.     ipad: /ipad/i.test(_ua),
  38.     android: /android/i.test(_ua),
  39.     bada: /bada/i.test(_ua),
  40.     opera_mini: /opera mini/i.test(_ua),
  41.     mobile: /iphone|ipod|ipad|opera mini|opera mobi|iemobile/i.test(_ua),
  42.     msie_mobile: /iemobile/i.test(_ua),
  43.     safari_mobile: /iphone|ipod|ipad/i.test(_ua),
  44.     opera_mobile: /opera mini|opera mobi/i.test(_ua),
  45.     mac: /mac/i.test(_ua)
  46. };
  47. browser.desktop = (browser.opera || browser.msie || browser.mozilla || browser.chrome || browser.safari) && !browser.mobile;
  48. var isTouch = "ontouchstart" in window;
  49.  
  50. function setDocumentDomain() {
  51.     var a = (document.domain || "").match(/(m\.)?([a-zA-Z]+\.[a-zA-Z]+\.?)$/);
  52.     window.locDomain = "https:" == location.protocol ? a[2] : a[0];
  53.     a = navigator.userAgent.toLowerCase();
  54.     if (/opera/i.test(a) || !/msie 6/i.test(a) || document.domain != locDomain) document.domain = locDomain
  55. }
  56. function isFunction(a) {
  57.     return "[object Function]" === Object.prototype.toString.call(a)
  58. }
  59. function isArray(a) {
  60.     return "[object Array]" === Object.prototype.toString.call(a)
  61. }
  62. function isObject(a) {
  63.     return "[object Object]" === Object.prototype.toString.call(a)
  64. }
  65. function escapeRE(a) {
  66.     return a ? a.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") : ""
  67. }
  68. function htsc(a) {
  69.     return a.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/\'/g, "&#39;").replace(/%/g, "&#37;")
  70. }
  71. function escapeAttr(a) {
  72.     return a.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/\'/g, "&#39;")
  73. }
  74. function replaceEntities(a) {
  75.     return ce("textarea", {
  76.         innerHTML: (a || "").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")
  77.     }).value
  78. }
  79. function stripTags(a) {
  80.     return a.replace(/<[^>]+>/g, "")
  81. }
  82. function vkNow() {
  83.     return +new Date
  84. }
  85. function intval(a) {
  86.     return !0 === a ? 1 : parseInt(a) || 0
  87. }
  88. function qs2obj(a) {
  89.     if (!a) return {};
  90.     var b = {};
  91.     a = a.toString().split("&");
  92.     for (var c = 0, d = a.length; c < d; c++) {
  93.         var e = a[c].split("=");
  94.         e[0] && (b[decodeURIComponent(e[0])] = decodeURIComponent(e[1] || ""))
  95.     }
  96.     return b
  97. }
  98. function obj2qs(a) {
  99.     if (!a) return "";
  100.     var b = [],
  101.         c;
  102.     for (c in a) b.push(encodeURIComponent(c) + "=" + encodeURIComponent(a[c].toString() || ""));
  103.     return b.length ? "?" + b.join("&") : ""
  104. }
  105. function parseJSON(a) {
  106.     try {
  107.         return JSON.parse(a)
  108.     } catch (b) {
  109.         return eval("(" + a + ")")
  110.     }
  111. }
  112. function lsSet(a, b) {
  113.     if ("undefined" !== typeof b) try {
  114.         return localStorage.setItem(a, b)
  115.     } catch (c) {} else try {
  116.         return localStorage.removeItem(a)
  117.     } catch (d) {}
  118.     return !1
  119. }
  120. function lsGet(a) {
  121.     try {
  122.         return localStorage.getItem(a)
  123.     } catch (b) {}
  124.     return !1
  125. }
  126. function ssSet(a, b) {
  127.     if ("undefined" !== typeof b) try {
  128.         return sessionStorage.setItem(a, b)
  129.     } catch (c) {} else try {
  130.         return sessionStorage.removeItem(a)
  131.     } catch (d) {}
  132.     return !1
  133. }
  134. function ssGet(a) {
  135.     try {
  136.         return sessionStorage.getItem(a)
  137.     } catch (b) {}
  138.     return !1
  139. }
  140. function getValues(a) {
  141.     if (!isArray(a)) return a.call ? a() : a;
  142.     for (var b = [], c = 0, d = a.length; c < d; c++) b.push(getValues(a[c]));
  143.     return b
  144. }
  145. function len(a) {
  146.     if (isArray(a)) return a.length;
  147.     if (isObject(a)) {
  148.         var b = 0,
  149.             c;
  150.         for (c in a) b++;
  151.         return b
  152.     }
  153.     return 0
  154. }(function () {
  155.     var a = vkNow();
  156.     window.clog = function (b) {
  157.         if (vk.__debug) try {
  158.             if (window.console && console.log) {
  159.                 var c = Array.prototype.slice.call(arguments);
  160.                 c.unshift("[" + (vkNow() - a) / 1E3 + "] ");
  161.                 browser.msie || browser.mobile ? console.log(c.join(" ")) : console.log.apply(console, c)
  162.             }
  163.         } catch (d) {}
  164.     }
  165. })();
  166.  
  167. function each(a, b) {
  168.     var c, d = 0,
  169.         e = a.length;
  170.     if ("undefined" === typeof e) for (c in a) {
  171.         if (!1 === b.call(a[c], c, a[c])) break
  172.     } else for (c = a[0]; d < e && !1 !== b.call(c, d, c); c = a[++d]);
  173.     return a
  174. }
  175. function copy(a) {
  176.     return isArray(a) ? a.concat([]) : isObject(a) ? extend({}, a) : a
  177. }
  178. var rf = function () {
  179.     return !1
  180. };
  181.  
  182. function addEvent(a, b, c) {
  183.     a = ge(a);
  184.     c = c || rf;
  185.     if (a && !(3 == a.nodeType || 8 == a.nodeType)) {
  186.         a.setInterval && a != window && (a = window);
  187.         b = b.split(" ");
  188.         for (var d = 0, e = b.length; d < e; d++) {
  189.             var f = b[d];
  190.             a.addEventListener ? a.addEventListener(f, c, !1) : a.attachEvent && a.attachEvent("on" + f, c)
  191.         }
  192.     }
  193. }
  194. function removeEvent(a, b, c) {
  195.     a = ge(a);
  196.     c = c || rf;
  197.     if (a && !(3 == a.nodeType || 8 == a.nodeType)) {
  198.         b = b.split(" ");
  199.         for (var d = 0, e = b.length; d < e; d++) {
  200.             var f = b[d];
  201.             a.removeEventListener ? a.removeEventListener(f, c, !1) : a.detachEvent && a.detachEvent("on" + f, c)
  202.         }
  203.     }
  204. }
  205. function cancelEvent(a) {
  206.     a = a || window.event;
  207.     if (!a) return !1;
  208.     a = a.originalEvent || a;
  209.     a.preventDefault && a.preventDefault();
  210.     a.stopPropagation && a.stopPropagation();
  211.     a.cancelBubble = !0;
  212.     return a.returnValue = !1
  213. }
  214. function checkEvent(a) {
  215.     return (a = a || window.event) && ("click" == a.type || "mousedown" == a.type || "mouseup" == a.type) && (1 < a.which || 1 < a.button || a.ctrlKey || a.shiftKey || a.metaKey)
  216. }
  217. function onCtrlEnter(a, b, c) {
  218.     b = b || window.event;
  219.     if (10 == b.keyCode || 13 == b.keyCode && (b.ctrlKey || b.metaKey && browser.mac)) c.call(a), cancelEvent(b)
  220. }
  221. function submitBtn(a) {
  222.     if (!a) return !1;
  223.     a = (a = a.form || gpeByTag("form", a)) ? geByClass("btn", a, "input") : !1;
  224.     if (!a) return !1;
  225.     for (var b in a) {
  226.         var c = a[b];
  227.         if ("submit" == c.type && !c.name) break
  228.     }
  229.     return c
  230. }
  231. function parseCyr(a, b) {
  232.     for (var c = a, d = "yo zh kh ts ch sch shch sh eh yu ya YO ZH KH TS CH SCH SHCH SH EH YU YA '".split(" "), e = "\u0451\u0436\u0445\u0446\u0447\u0449\u0449\u0448\u044d\u044e\u044f\u0401\u0416\u0425\u0426\u0427\u0429\u0429\u0428\u042d\u042e\u042f\u044c".split(""), f = 0, g = d.length; f < g; f++) c = b ? c.split(d[f]).join(e[f]) : c.split(e[f]).join(d[f]);
  233.     f = 0;
  234.     for (g = 48; f < g; f++) c = b ? c.split("abvgdezijklmnoprstufhcyABVGDEZIJKLMNOPRSTUFHCY\u0451\u0401".charAt(f)).join("\u0430\u0431\u0432\u0433\u0434\u0435\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u044b\u0410\u0411\u0412\u0413\u0414\u0415\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u042b\u0435\u0415".charAt(f)) : c.split("\u0430\u0431\u0432\u0433\u0434\u0435\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u044b\u0410\u0411\u0412\u0413\u0414\u0415\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u042b\u0435\u0415".charAt(f)).join("abvgdezijklmnoprstufhcyABVGDEZIJKLMNOPRSTUFHCY\u0451\u0401".charAt(f));
  235.     return c == a ? null : c
  236. }
  237. function parseLat(a) {
  238.     return parseCyr(a, !0)
  239. }
  240. function parseRusKeys(a, b, c) {
  241.     if (!b) return null;
  242.     b = a;
  243.     for (var d = 0; 68 > d; d++) b = c ? b.split("qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?~".charAt(d)).join("\u0439\u0446\u0443\u043a\u0435\u043d\u0433\u0448\u0449\u0437\u0445\u044a\u0444\u044b\u0432\u0430\u043f\u0440\u043e\u043b\u0434\u0436\u044d\u044f\u0447\u0441\u043c\u0438\u0442\u044c\u0431\u044e.\u0451\u0419\u0426\u0423\u041a\u0415\u041d\u0413\u0428\u0429\u0417\u0425\u042a\u0424\u042b\u0412\u0410\u041f\u0420\u041e\u041b\u0414\u0416\u042d\u042f\u0427\u0421\u041c\u0418\u0422\u042c\u0411\u042e,\u0401".charAt(d)) : b.split("\u0439\u0446\u0443\u043a\u0435\u043d\u0433\u0448\u0449\u0437\u0445\u044a\u0444\u044b\u0432\u0430\u043f\u0440\u043e\u043b\u0434\u0436\u044d\u044f\u0447\u0441\u043c\u0438\u0442\u044c\u0431\u044e.\u0451\u0419\u0426\u0423\u041a\u0415\u041d\u0413\u0428\u0429\u0417\u0425\u042a\u0424\u042b\u0412\u0410\u041f\u0420\u041e\u041b\u0414\u0416\u042d\u042f\u0427\u0421\u041c\u0418\u0422\u042c\u0411\u042e,\u0401".charAt(d)).join("qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?~".charAt(d));
  244.     return b == a ? null : b
  245. }
  246. function parseLatKeys(a, b) {
  247.     return parseRusKeys(a, b, !0)
  248. }
  249. function scrollTop(a, b) {
  250.     if ("undefined" === typeof a) return htmlNode.scrollTop || bodyNode.scrollTop || window.scrollY || 0;
  251.     b ? setTimeout(function () {
  252.         window.scrollTo(0, Math.max(browser.android ? 1 : 0, a))
  253.     }, b) : window.scrollTo(0, Math.max(browser.android ? 1 : 0, a))
  254. }
  255. function se() {
  256.     var a = [],
  257.         b = Array.prototype.slice.call(arguments);
  258.     return function (c) {
  259.         if (c) if (c.apply) a.push(c);
  260.         else if ("__clear" === c) a = [];
  261.         else {
  262.             var d = Array.prototype.slice.call(arguments);
  263.             d.shift();
  264.             for (var e = 0, f = a.length; e < f; e++) a[e].apply(window, getValues(b).concat(d))
  265.         }
  266.     }
  267. }
  268. window.onBodyScroll = se(scrollTop);
  269. window.onBodyResize = se();
  270. addEvent(window, "scroll touchmove", function () {
  271.     onBodyScroll(!0)
  272. });
  273. addEvent(window, "error", function (a) {
  274.     console.log("line: " + a.lineno)
  275. });
  276.  
  277. function initAutoScroll(a, b, c) {
  278.     a && b && onBodyScroll(function (d) {
  279.         var e = getValues(a);
  280.         if (e) {
  281.             var f = getY(e),
  282.                 g = getCh();
  283.             f - d - g < (c || g) && b.call(e)
  284.         }
  285.     })
  286. }
  287. function autoScroll(a, b, c, d) {
  288.     var e = getValues(a),
  289.         f = ge("show_more_loading"),
  290.         g = function () {
  291.             ajax.click(this, b, {
  292.                 use_cache: !c
  293.             })
  294.         };
  295.     !e && f && g.call(f);
  296.     initAutoScroll(a, g, d)
  297. }
  298. function scrollToEl(a, b, c) {
  299.     a = ge(a) || window;
  300.     a = (a === window ? 1 : getY(a)) - (b || 0);
  301.     scrollTop(a, c)
  302. }
  303. function scrollToHash(a) {
  304.     a = a || nav.hash || location.hash;
  305.     "#" === a[0] && (a = a.substr(1));
  306.     if (a) {
  307.         var b = geBySel("a[name]");
  308.         !1 === b && (b = geByTag("a"));
  309.         each(b, function (b, d) {
  310.             if (d.name == a) return scrollToEl(d), !1
  311.         })
  312.     }
  313. }
  314. function lockButton(a) {
  315.     a = ge(a);
  316.     if ("input" == tag(a) && hasClass("btn", a)) {
  317.         var b = ce("button", {
  318.             id: a.id,
  319.             className: "locked" + (hasClass("sbtn", a) ? " sbtn" : ""),
  320.             innerHTML: "<span><b>" + (a.value || "") + "</b></span>",
  321.             onclick: function (a) {
  322.                 return cancelEvent(a)
  323.             },
  324.             real_btn: a
  325.         });
  326.         a.fake_btn = b;
  327.         before(b, a);
  328.         remove(a)
  329.     }
  330. }
  331. function unlockButton(a) {
  332.     a = ge(a);
  333.     a.real_btn ? (before(a.real_btn, a), remove(a)) : a.fake_btn && (before(a, a.fake_btn), remove(a.fake_btn))
  334. }
  335. function extend() {
  336.     var a = Array.prototype.slice.call(arguments),
  337.         b = a.shift();
  338.     if (!a.length) return b;
  339.     for (var c = 0, d = a.length; c < d; c++) for (var e in a[c]) b[e] = a[c][e];
  340.     return b
  341. }
  342. function ge(a) {
  343.     return "string" === typeof a ? document.getElementById(a) : a
  344. }
  345. function geByClass(a, b, c) {
  346.     b = ge(b) || document;
  347.     c = c || "*";
  348.     if (b.getElementsByClassName) {
  349.         b = b.getElementsByClassName(a);
  350.         if ("*" == c) return Array.prototype.slice.call(b);
  351.         var d = [];
  352.         c = c.toUpperCase();
  353.         a = 0;
  354.         for (var e = b.length; a < e; a++) b[a].tagName.toUpperCase() == c && d.push(b[a]);
  355.         return d
  356.     }
  357.     b = geByTag(c, b);
  358.     d = [];
  359.     c = RegExp("(^|\\s)" + escapeRE(a) + "(\\s|$)");
  360.     a = 0;
  361.     for (e = b.length; a < e; a++) c.test(b[a].className) && d.push(b[a]);
  362.     return d
  363. }
  364. function geByClass1(a, b, c) {
  365.     return geByClass(a, b, c)[0]
  366. }
  367. function gpeByClass(a, b) {
  368.     b = ge(b);
  369.     if (!b) return null;
  370.     for (; b = b.parentNode;) if (hasClass(a, b)) return b;
  371.     return null
  372. }
  373. function geByTag(a, b) {
  374.     return (ge(b) || document).getElementsByTagName(a)
  375. }
  376. function geByTag1(a, b) {
  377.     return geByTag(a, b)[0]
  378. }
  379. function gpeByTag(a, b) {
  380.     b = ge(b);
  381.     if (!b) return null;
  382.     for (a = a.toUpperCase(); b = b.parentNode;) if (b.tagName.toUpperCase() == a) return b;
  383.     return null
  384. }
  385. function geBySel(a, b) {
  386.     b = ge(b) || document;
  387.     return b.querySelectorAll ? b.querySelectorAll(a) : !1
  388. }
  389. function geBySel1(a, b) {
  390.     b = ge(b) || document;
  391.     return b.querySelector ? b.querySelector(a) : !1
  392. }
  393. function append(a, b) {
  394.     (b = ge(b)) && b.appendChild(ge(a))
  395. }
  396. function before(a, b) {
  397.     (b = ge(b)) && b.parentNode && b.parentNode.insertBefore(ge(a), b)
  398. }
  399. function after(a, b) {
  400.     (b = ge(b)) && b.parentNode && (b.nextSibling ? b.parentNode.insertBefore(ge(a), b.nextSibling) : b.parentNode.appendChild(ge(a)))
  401. }
  402. function remove(a) {
  403.     return (a = ge(a)) && a.parentNode ? a.parentNode.removeChild(a) : !1
  404. }
  405. function clone(a) {
  406.     return (a = ge(a)) ? a.cloneNode(!0) : !1
  407. }
  408. function tag(a) {
  409.     a = ge(a);
  410.     return (a && a.tagName || "").toLowerCase()
  411. }
  412. function outer(a) {
  413.     a = ge(a);
  414.     return !a ? "" : val(ce("div").appendChild(clone(a)).parentNode)
  415. }
  416. function show(a) {
  417.     if (a = ge(a)) a.style.display = a.oldstyle || ("span" == tag(a) || hasClass("i", a) ? "inline" : "block")
  418. }
  419. function hide(a) {
  420.     if (a = ge(a)) "none" != a.style.display && (a.oldstyle = a.style.display), a.style.display = "none"
  421. }
  422. function isVisible(a) {
  423.     a = ge(a);
  424.     return !a || !a.style ? !1 : "none" != a.style.display
  425. }
  426. function toggle(a, b) {
  427.     "undefined" === typeof b && (b = !isVisible(a));
  428.     (b ? show : hide)(a)
  429. }
  430. function ce(a, b, c) {
  431.     a = document.createElement(a);
  432.     b && extend(a, b);
  433.     c && extend(a.style, c);
  434.     return a
  435. }
  436. window.cdf = function (a) {
  437.     var b = a.createDocumentFragment(),
  438.         c = a.createElement("div"),
  439.         d = a.createRange && a.createRange();
  440.     b && b.appendChild(c);
  441.     d && d.selectNodeContents && d.selectNodeContents(c);
  442.     return !b ? function (a) {
  443.         return ce("div", {
  444.             innerHTML: a
  445.         })
  446.     } : d && d.createContextualFragment ? function (b) {
  447.         return !b ? a.createDocumentFragment() : d.createContextualFragment(b)
  448.     } : function (b) {
  449.         if (!b) return a.createDocumentFragment();
  450.         c.innerHTML = b;
  451.         for (b = a.createDocumentFragment(); c.firstChild;) b.appendChild(c.firstChild);
  452.         return b
  453.     }
  454. }(document);
  455.  
  456. function elfocus(a, b, c) {
  457.     a = ge(a);
  458.     try {
  459.         a.focus();
  460.         if ("undefined" === typeof b || !1 === b) b = a.value.length;
  461.         if ("undefined" === typeof c || !1 === c) c = b;
  462.         if (a.createTextRange) {
  463.             var d = a.createTextRange();
  464.             d.collapse(!0);
  465.             d.moveEnd("character", b);
  466.             d.moveStart("character", c);
  467.             d.select()
  468.         } else a.setSelectionRange && a.setSelectionRange(b, c)
  469.     } catch (e) {}
  470. }
  471. function elblur(a) {
  472.     (a = ge(a)) && a.blur && a.blur()
  473. }
  474. function val(a, b) {
  475.     if (a = ge(a)) {
  476.         var c = a.tagName.toLowerCase(),
  477.             d = "input" == c || "textarea" == c || "select" == c;
  478.         if ("undefined" === typeof b) return d ? a.value : a.innerHTML;
  479.         d ? a.value = b : (a.innerHTML = b, "a" != c && (ajax.prepare_nav(a), ajax.prepare_click(a), ajax.onPrepared(!0, a)))
  480.     }
  481. }
  482. function attr(a, b, c) {
  483.     if (a = ge(a)) {
  484.         if ("undefined" === typeof c) return a.getAttribute && a.getAttribute(b) || !1;
  485.         if (!1 === c) return a.removeAttribute && a.removeAttribute(b) || !1;
  486.         a.setAttribute && a.setAttribute(b, c)
  487.     }
  488. }
  489. function style(a, b, c) {
  490.     if ((a = ge(a)) && a.style) {
  491.         if (isObject(b)) return each(b, function (b, c) {
  492.             style(a, b, c)
  493.         });
  494.         var d = "number" === typeof c;
  495.         d && /height|width/i.test(b) && (c = Math.abs(c));
  496.         a.style[b] = d && !/z-?index|font-?weight|opacity|zoom|line-?height/i.test(b) ? c + "px" : c
  497.     }
  498. }
  499. function hasClass(a, b) {
  500.     if (b = ge(b)) return RegExp("(^|\\s)" + escapeRE(a) + "(\\s|$)").test(b.className)
  501. }
  502. function addClass(a, b) {
  503.     if ((b = ge(b)) && !hasClass(a, b)) b.className = (b.className ? b.className + " " : "") + a
  504. }
  505. function removeClass(a, b, c) {
  506.     if (b = ge(b)) b.className = (b.className || "").replace(RegExp("(^|\\s)" + (c ? a : escapeRE(a)) + "(\\s|$)"), function (a, b, c) {
  507.         return b && c ? " " : ""
  508.     })
  509. }
  510. function toggleClass(a, b, c) {
  511.     ("undefined" === typeof c ? hasClass(a, b) : !c) ? removeClass(a, b) : addClass(a, b)
  512. }
  513. function replaceClass(a, b, c, d) {
  514.     removeClass(a, c, d);
  515.     addClass(b, c)
  516. }
  517. function switchClass(a, b, c) {
  518.     hasClass(a, c) ? replaceClass(a, b, c) : replaceClass(b, a, c)
  519. }
  520. function getXY(a) {
  521.     a = ge(a);
  522.     if (!a) return [0, 0];
  523.     var b = 0,
  524.         c = 0;
  525.     if (a.offsetParent) {
  526.         do b += a.offsetLeft, c += a.offsetTop;
  527.         while (a = a.offsetParent)
  528.     }
  529.     return [b, c]
  530. }
  531. function getX(a) {
  532.     return getXY(a)[0]
  533. }
  534. function getY(a) {
  535.     return getXY(a)[1]
  536. }
  537. function getW(a) {
  538.     return (a = ge(a)) && a.offsetWidth || 0
  539. }
  540. function getH(a) {
  541.     return (a = ge(a)) && a.offsetHeight || 0
  542. }
  543. function getCw() {
  544.     return Math.max(window.innerWidth || 0, (window.htmlNode || {}).clientWidth || 0)
  545. }
  546. function getCh() {
  547.     return Math.max(window.innerHeight || 0, (window.htmlNode || {}).clientHeight || 0)
  548. }
  549. function evalJs(a) {
  550.     window.execScript ? window.execScript(a) : eval.call(window, a)
  551. }
  552. function alLoadingFix(a, b) {
  553.     b = b || "al_loading";
  554.     var c = ge(b);
  555.     if (c) {
  556.         if (!a) {
  557.             var d = ge("m").offsetHeight || 0,
  558.                 e = ge("mfoot").offsetHeight || 0;
  559.             a = getCh() - d + e
  560.         }
  561.         c.style.height = a + "px";
  562.         addClass(b, c)
  563.     }
  564. }
  565. function getHref(a) {
  566.     if (!a) return !1;
  567.     var b = !1;
  568.     a.getAttribute && (b = a.getAttribute("data-href") || a.getAttribute("href"));
  569.     b || (b = a.pathname ? a.pathname + a.search + a.hash : a);
  570.     return b || !1
  571. }
  572. function ajx2q(a) {
  573.     var b = [],
  574.         c = function (a) {
  575.             try {
  576.                 return encodeURIComponent(a)
  577.             } catch (b) {
  578.                 return a
  579.             }
  580.         }, d;
  581.     for (d in a) if (!(null == a[d] || isFunction(a[d]))) if (isArray(a[d])) for (var e = 0, f = 0, g = a[d].length; e < g; ++e) null == a[d][e] || isFunction(a[d][e]) || (b.push(c(d) + "[" + f + "]=" + c(a[d][e])), ++f);
  582.     else b.push(c(d) + "=" + c(a[d]));
  583.     b.sort();
  584.     return b.join("&")
  585. }
  586. function indexOf(a, b, c) {
  587.     c = c || 0;
  588.     for (var d = (a || []).length; c < d; c++) if (a[c] == b) return c;
  589.     return -1
  590. }
  591. function langNumeric(a, b, c) {
  592.     if (!b || !window.langConfig) return a;
  593.     var d;
  594.     isArray(b) ? (d = b[1], a != Math.floor(a) ? d = b[langConfig.numRules["float"]] : each(langConfig.numRules["int"], function (c, e) {
  595.         if ("*" == e[0] || -1 != indexOf(e[1], e[0] ? a % e[0] : a)) return d = b[e[2]], !1
  596.     })) : d = b;
  597.     if (c) {
  598.         c = a.toString().split(".");
  599.         for (var e = [], f = c[0].length - 3; - 3 < f; f -= 3) e.unshift(c[0].slice(0 < f ? f : 0, f + 3));
  600.         c[0] = e.join(langConfig.numDel);
  601.         a = c.join(langConfig.numDec)
  602.     }
  603.     return d = (d || "%s").replace("%s", a)
  604. }
  605. function setNotify(a) {
  606.     a = intval(a);
  607.     var b = ge("header_msgs"),
  608.         c = geByClass1("pcont main");
  609.     b && (val(b, "<i></i>" + (0 < a ? "<em>" + a + "</em>" : "")), 0 < a ? removeClass("no_notify", b) : addClass("no_notify", b), c && (b = geByClass1("mail", geByClass1("main_menu", c)), geByTag1("a", b), b = geByTag1("span", b), c = geByTag1("em", b), 0 < a ? c ? val(c, a) : append(ce("em", {
  610.         innerHTML: a
  611.     }), b) : remove(c)))
  612. }
  613. function getNotify() {
  614.     var a = ge("header_msgs");
  615.     return !a ? 0 : intval(val(geByTag1("em", a)))
  616. }
  617. window.cur = {};
  618. window.lang = {};
  619. var geo = {
  620.     _def_opts: {
  621.         enableHighAccuracy: !0,
  622.         maximumAge: 3E5,
  623.         timeout: 6E4
  624.     },
  625.     _provider: null,
  626.     initW3C: function () {
  627.         geo._provider = navigator.geolocation;
  628.         geo.getCurrentPosition = function (a, b, c) {
  629.             geo._provider.getCurrentPosition(function (b) {
  630.                 "undefined" !== typeof b.latitude ? a(extend(b, {
  631.                     coords: extend(b.coords || {}, {
  632.                         latitude: b.latitude,
  633.                         longitude: b.longitude
  634.                     })
  635.                 })) : a(b)
  636.             }, b, c)
  637.         }
  638.     },
  639.     initGears: function () {
  640.         clog("initGears");
  641.         geo._provider = google.gears.factory.create("beta.geolocation")
  642.     },
  643.     initSymbian: function () {
  644.         clog("initSymbian");
  645.         geo._provider = device.getServiceObject("Service.Location", "ILocation");
  646.         geo.getCurrentPosition = function (a, b) {
  647.             geo._provider.ILocation.GetLocation({
  648.                 LocationInformationClass: "BasicLocationInformation"
  649.             }, function (c, d, e) {
  650.                 4 == d ? b({
  651.                     code: 2,
  652.                     message: "Position unavailable"
  653.                 }) : a({
  654.                     timestamp: null,
  655.                     coords: {
  656.                         latitude: e.ReturnValue.Latitude,
  657.                         longitude: e.ReturnValue.Longitude,
  658.                         altitude: e.ReturnValue.Altitude,
  659.                         heading: e.ReturnValue.Heading
  660.                     }
  661.                 })
  662.             })
  663.         }
  664.     },
  665.     initPalm: function () {
  666.         clog("initPalm");
  667.         geo.getCurrentPosition = function (a, b, c) {
  668.             var d = {};
  669.             c && (c.enableHighAccuracy && !0 == c.enableHighAccuracy && (d.accuracy = 1), c.maximumAge && (d.maximumAge = c.maximumAge), c.responseTime && (5 > c.responseTime ? d.responseTime = 1 : 20 > c.responseTime ? d.responseTime = 2 : d.timeout = 3));
  670.             new Mojo.Service.Request("palm://com.palm.location", {
  671.                 method: "getCurrentPosition",
  672.                 parameters: d,
  673.                 onSuccess: function (b) {
  674.                     a({
  675.                         timestamp: b.timestamp,
  676.                         coords: {
  677.                             latitude: b.latitude,
  678.                             longitude: b.longitude,
  679.                             heading: b.heading
  680.                         }
  681.                     })
  682.                 },
  683.                 onFailure: function (a) {
  684.                     1 == a.errorCode ? b({
  685.                         code: 3,
  686.                         message: "Timeout"
  687.                     }) : 2 == a.errorCode ? b({
  688.                         code: 2,
  689.                         message: "Position unavailable"
  690.                     }) : b({
  691.                         code: 0,
  692.                         message: "Unknown Error: webOS-code" + errorCode
  693.                     })
  694.                 }
  695.             })
  696.         }
  697.     },
  698.     getCurrentPosition: function (a, b, c) {
  699.         geo._provider.getCurrentPosition(a, b, extent(geo._def_opts, c || {}))
  700.     },
  701.     init: function () {
  702.         try {
  703.             if ("undefined" !== typeof navigator.geolocation) geo.initW3C();
  704.             else if ("undefined" !== typeof window.google && "undefined" !== typeof google.gears) geo.initGears();
  705.             else if ("undefined" !== typeof device && "undefined" !== typeof device.getServiceObject) geo.initSymbian();
  706.             else if ("undefined" !== typeof Mojo && "Mojo.Service.Request" !== typeof Mojo.Service.Request) geo.initPalm();
  707.             else return !1
  708.         } catch (a) {
  709.             return !1
  710.         }
  711.         return !0
  712.     }
  713. }, ajax = {
  714.     _tStart: !1,
  715.     _tAlStart: !1,
  716.     _init: function () {
  717.         try {
  718.             new XMLHttpRequest && (ajax._req = function () {
  719.                 return new XMLHttpRequest
  720.             })
  721.         } catch (a) {
  722.             try {
  723.                 new ActiveXObject("Msxml2.XMLHTTP") && (ajax._req = function () {
  724.                     return new ActiveXObject("Msxml2.XMLHTTP")
  725.                 })
  726.             } catch (b) {
  727.                 try {
  728.                     new ActiveXObject("Microsoft.XMLHTTP") && (ajax._req = function () {
  729.                         return new ActiveXObject("Microsoft.XMLHTTP")
  730.                     })
  731.                 } catch (c) {
  732.                     ajax._req = !1
  733.                 }
  734.             }
  735.         }
  736.     },
  737.     _getreq: function () {
  738.         ajax._req || ajax._init();
  739.         return ajax._req()
  740.     },
  741.     _al_reqs: [],
  742.     _last_req: null,
  743.     save_req: function (a) {
  744.         ajax._al_reqs.push(a || ajax._last_req)
  745.     },
  746.     abort_reqs: function () {
  747.         var a = [];
  748.         each(ajax._al_reqs, function (b, c) {
  749.             a.push(c.readyState);
  750.             4 > c.readyState && c.abort()
  751.         });
  752.         ajax._al_reqs = [];
  753.         clog(a)
  754.     },
  755.     plainpost: function (a, b, c, d, e) {
  756.         var f = ajax._last_req = ajax._getreq();
  757.         b = "string" != typeof b ? ajx2q(b) : b;
  758.         f.onreadystatechange = function () {
  759.             4 == f.readyState && (200 <= f.status && 300 > f.status ? c && c(f.responseText, f) : d && d(f.responseText, f))
  760.         };
  761.         try {
  762.             f.open("POST", a, !0)
  763.         } catch (g) {
  764.             return !1
  765.         }
  766.         e || (f.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), f.setRequestHeader("X-Requested-With", "XMLHttpRequest"));
  767.         f.send(b);
  768.         return f
  769.     },
  770.     post: function (a, b, c) {
  771.         "/" != a.substr(0, 1) && (a = "/" + a);
  772.         return ajax._post(a, b, c || {})
  773.     },
  774.     onPrepared: se(),
  775.     prepare_click: function (a) {
  776.         if (isTouch && window.al && al.ver) {
  777.             var b = [],
  778.                 c = !1;
  779.             a && "a" == (a.tagName || "").toLowerCase() ? b.push(a) : isArray(a) ? b = a : (b = geByTag("a", a), c = !0);
  780.             if (b[0] && b[0].getAttribute) {
  781.                 a = 0;
  782.                 for (var d = b.length; a < d; a++) {
  783.                     var e = b[a],
  784.                         f = attr(e, "onclick") || "",
  785.                         g = e && e.target || "";
  786.                     if ((!c || !attr(e, "data-href") && f && "_blank" != g) && null != attr(e, "href")) attr(e, "data-href", getHref(e)), attr(e, "href", !1)
  787.                 }
  788.             }
  789.         }
  790.     },
  791.     click: function (a, b, c) {
  792.         b = b || {};
  793.         var d = !1,
  794.             e = {
  795.                 _ajax: 1
  796.             }, f = extend(b, {
  797.                 link: a
  798.             });
  799.         c = c || {};
  800.         if (b.onStart) {
  801.             var g = ajax.tAlGetParam();
  802.             ajax.tAlStart = (new Date).getTime();
  803.             g && (e._talstat = g)
  804.         }
  805.         if (c.use_cache) {
  806.             var j = ge(!0 === c.use_cache ? "preload_data" : c.use_cache),
  807.                 e = j.innerHTML.replace(/(^\x3c!--|--\x3e$)/g, ""),
  808.                 g = e.split("--\x3e\x3c!--");
  809.             e ? (j.innerHTML = "", b.onStart && b.onStart.apply(f), c.nav && nav.go(d, null, {
  810.                 push_only: !0
  811.             }), b.onDone && b.onDone.apply(f, g), (a = geByClass1("show_more", geByClass1("pcont", "mcont"))) && ajax.click(a, {
  812.                 onDone: function () {
  813.                     var a = "";
  814.                     each(arguments, function (b, c) {
  815.                         a += "\x3c!--" + (c || "") + "--\x3e"
  816.                     });
  817.                     j.innerHTML = a;
  818.                     ge("show_more_loading") && ajax.click(!1, b, c)
  819.                 }
  820.             })) : (b.onStart && b.onStart.apply(f), c.nav && nav.go(d, null, {
  821.                 push_only: !0
  822.             }));
  823.             return !1
  824.         }
  825.         if (!a) return !0;
  826.         if (a.form) {
  827.             var g = a.form,
  828.                 l = {}, d = (g.action || "").replace(/^https?:\/\/[^\/]+/i, "");
  829.             each(g, function (b, c) {
  830.                 if (!c.name || c.disabled || "radio" === c.type && !c.checked || "checkbox" === c.type && !c.checked || "button" === c.type || "submit" === c.type && c !== a || "image" === c.type && c !== a) return !0;
  831.                 l[c.name] = c.value
  832.             });
  833.             !g.method || "get" == g.method ? d = d.split("?", 1).shift() + obj2qs(l) : extend(e, l)
  834.         } else a.getAttribute && (d = a.getAttribute("data-href") || a.getAttribute("href"));
  835.         d || (d = a.pathname ? a.pathname + a.search + a.hash : a);
  836.         if (!d) return !0;
  837.         extend(e, c.url_params || {});
  838.         if (e = ajax.post(d, e, {
  839.             onDone: function () {
  840.                 c.lock && unlockButton(a);
  841.                 b.onDone && b.onDone.apply(f, arguments);
  842.                 (c.nav || c.scroll) && scrollToHash()
  843.             },
  844.             onFail: function () {
  845.                 c.lock && unlockButton(a);
  846.                 b.onFail && b.onFail.apply(f, arguments);
  847.                 (c.nav || c.scroll) && scrollToHash()
  848.             }
  849.         })) b.onStart && b.onStart.apply(f), c.nav && nav.go(d, null, {
  850.             push_only: !0
  851.         }), c.lock && lockButton(a);
  852.         return !e
  853.     },
  854.     prepare_nav: function (a) {
  855.         if (window.al && al.ver) {
  856.             var b = [],
  857.                 c = !1;
  858.             a && "a" == tag(a) ? b.push(a) : isArray(a) ? b = a : (b = geByTag("a", a), c = !0);
  859.             for (var d = 0, e = b.length; d < e; d++) {
  860.                 var f = b[d];
  861.                 addEvent(f, "touchstart", thover.start);
  862.                 if (!c || !attr(f, "onclick") && attr(f, "href")) {
  863.                     var g = f.hostname || (/^(https?:)\/\/([^:\/]+)?(?::(\d+))?\/?(.*)$/i.exec(f.href) || [])[2];
  864.                     "_blank" !== f.target && g == location.hostname && attr(f, "onclick", "return nav.go(this, event);")
  865.                 }
  866.             }
  867.             a = geByTag("input", a);
  868.             d = 0;
  869.             for (e = a.length; d < e; d++) b = a[d], b.form && ("submit" == b.type && !b.getAttribute("onclick")) && attr(b, "onclick", "return nav.go(this, event);")
  870.         }
  871.     },
  872.     nav: function (a, b) {
  873.         b = b || {};
  874.         b.nav = b.nav || {};
  875.         var c = getHref(a),
  876.             d, e = page.getHash(b.nav);
  877.         if (!(c = nav.checkUrl(c))) return !1;
  878.         "/" != c.substr(0, 1) && (c = "/" + c);
  879.         menu.close(null, !0);
  880.         var f = ajax.tGetParam();
  881.         ajax.tStart = (new Date).getTime();
  882.         b.need_restore && menu && menu.closeSearch();
  883.         if (b.need_restore && b.nav.push && page.restore(e)) return ajax.abort_reqs(), nav.set(b), ajax.tModule = cur.module, ajax.tRestoreRender = (new Date).getTime(), !0;
  884.         var g = !1,
  885.             j = !1;
  886.         if (b.fast) g = !0, page.set(e, !1, {
  887.             before: !0,
  888.             beforeAppend: b.beforeAppend,
  889.             afterAppend: b.afterAppend
  890.         });
  891.         else if (b.target && b.target.className) {
  892.             var l = (d = /(?:^|\s)(al_([a-z_]+)(-?[0-9]+)?)(?:\s|$)/i.exec(b.target.className)) && d[1] || !1,
  893.                 h = d && d[2] || !1,
  894.                 k;
  895.             switch (h) {
  896.                 case "menu":
  897.                     g = !0;
  898.                     page.set(e, !1, {
  899.                         before: !0,
  900.                         beforeAppend: function (a) {
  901.                             val(geByClass1("mcont", a), '<div class="pcont bl_cont"><div id="al_loading"></div></div>');
  902.                             var c = b.target.getAttribute("data-header") || "",
  903.                                 d = geByClass1("mhead", a);
  904.                             geByClass1("btn logo", d) ? val(d, "" + (window.al && window.al.menu ? '<div class="btn home"><a href="/" class="b" accesskey="*" onclick="return menu.toggle(event);"><i></i></a></div>' : '<div class="btn home vk_home"><a href="/" class="b" accesskey="*"><i></i></a></div>') + '<div class="btn notify">' + val(geByClass1("btn notify", a)) + '</div><div class="btn back"><div class="b"><div class="title"><h1>' + (c || "&nbsp;") + "</h1></div></div></div>") : c && val(geByClass1("btn back", a), '<div class="b"><div class="title"><h1>' + c + "</h1></div></div>")
  905.                         },
  906.                         afterAppend: function () {
  907.                             hasClass("_lms", bodyNode) && menu.enabled(!0);
  908.                             alLoadingFix();
  909.                             scrollTop(0)
  910.                         }
  911.                     });
  912.                     break;
  913.                 case "tab":
  914.                     g = !0;
  915.                     page.set(e, !1, {
  916.                         before: !0,
  917.                         beforeAppend: function (a) {
  918.                             hasClass("_tclose", b.target) && removeClass("tabs_opened", geByClass1("tabs_wrapper", a));
  919.                             hasClass("_thide", b.target) && each(geByClass("_hide", a), function (a, b) {
  920.                                 hide(b)
  921.                             });
  922.                             val(geByClass1("upanel", a), '<div id="al_loading"></div>');
  923.                             var c = geByClass1("tabs_wrapper", a) || geByClass1("tabs", a),
  924.                                 d = geByClass1("active", c);
  925.                             d && (removeClass("cur", geByClass1("cur", c)), addClass("cur", d.parentNode));
  926.                             (k = b.target.getAttribute("data-header")) && val(geByClass1("btn back", a), '<div class="b"><div class="title"><h1>' + k + "</h1></div></div>")
  927.                         },
  928.                         afterAppend: function () {
  929.                             alLoadingFix()
  930.                         }
  931.                     }, b);
  932.                     break;
  933.                 case "post":
  934.                     g = !0;
  935.                     page.set(e, !1, {
  936.                         before: !0,
  937.                         beforeAppend: function (a) {
  938.                             var c = clone(gpeByClass("post", b.target)),
  939.                                 d = c.id,
  940.                                 e, f = outer(gpeByTag("a", geByClass1("u", c, "img"))),
  941.                                 g = gpeByTag("div", geByClass1("author", c)),
  942.                                 p = remove(geByClass1("date", c)),
  943.                                 q = outer(remove(geByClass1("explain", g))),
  944.                                 g = outer(g),
  945.                                 c = geByClass1("cc", c),
  946.                                 h = geByClass1("more", c),
  947.                                 j = geByClass1("info", c),
  948.                                 k = geByClass1("links", c),
  949.                                 t = geByClass1("replies_link", k),
  950.                                 j = val(remove(geByClass1("replies", j))) ? val(t) : lang.mobile_wall_post_replies_title,
  951.                                 t = t ? '<a name="comments"></a><h5>' + (j || "") + '</h5><div id="al_loading"></div>' : "";
  952.                             h && (h.nextSibling.style.display = "inline", h.style.display = "none");
  953.                             val(k, outer(geByClass1("like_wrap", c)));
  954.                             (e = b.target.getAttribute("data-header")) && val(geByClass1("btn back", a), '<div class="b"><div class="title"><h1>' + e + "</h1></div></div>");
  955.                             e = val;
  956.                             a = geByClass1("mcont", a);
  957.                             p = val(p);
  958.                             c = val(c);
  959.                             e(a, '<div class="pcont wall bl_cont"><div class="panel">' + (f || "") + '<div class="cont">' + (g || "") + '<div class="info"><span class="date">' + (p || "") + '</span></div></div></div><div id="' + (d || "") + '" class="post one"><div class="cont"><div class="ch">' + (q || "") + '</div><div class="cc">' + (c || "") + "</div></div></div>" + (t || "") + "</div>")
  960.                         },
  961.                         afterAppend: function (a) {
  962.                             (a = geByTag1("h5", a)) && alLoadingFix(b.nav.hash ? getCh() - a.offsetHeight : 0);
  963.                             b.nav.hash ? scrollToHash(b.nav.hash) : scrollTop(0)
  964.                         }
  965.                     }, b);
  966.                     break;
  967.                 case "pinfo":
  968.                     g = !0;
  969.                     page.set(e, !1, {
  970.                         before: !0,
  971.                         beforeAppend: function (a) {
  972.                             var b = geByClass1("pcont", a),
  973.                                 c = geByClass1("panel", a),
  974.                                 d = geByClass1("u", c, "img"),
  975.                                 e = geByTag1("h2", c),
  976.                                 f = geByTag1("b", e),
  977.                                 p = geByClass1("lv", c),
  978.                                 g = ce("div");
  979.                             addClass("prof_finfo", b);
  980.                             val(c, '<img src="' + attr(d, "src") + '" class="u" align="left"><div class="cont"><h2>' + stripTags(val(e)) + '</h2><div class="lvl">' + (f ? lang.mobile_online : val(p)) + '</div></div><div class="cb"></div>');
  981.                             each(geByClass("_pinfo", a), function (a, b) {
  982.                                 g.appendChild(b)
  983.                             });
  984.                             val(geByClass1("upanel", a), "<div>" + val(g) + '</div><div id="al_loading"></div>')
  985.                         },
  986.                         afterAppend: function () {
  987.                             alLoadingFix();
  988.                             scrollTop(0, 10)
  989.                         }
  990.                     }, b);
  991.                     break;
  992.                 case "player":
  993.                     g = !0;
  994.                     page.set(e, !1, {
  995.                         before: !0,
  996.                         beforeAppend: function (a) {
  997.                             var b = audio.playlist(),
  998.                                 c = audio.playlist_q(),
  999.                                 b = ((b[0] || {}).id || "").split("_").slice(2).join("_") || "",
  1000.                                 d = nav.path + (nav.params ? "?" + nav.params : "");
  1001.                             val(geByClass1("btn back", a), '<a class="b al_back" data-href="' + d + '" onclick="return nav.go(this, event);"><i>&nbsp;</i><div class="title"><h1>' + lang.mobile_menu_player_head_title + "</h1></div></a>");
  1002.                             val(geByClass1("mcont", a), '<div class="pcont audios"><div class="panel np"><form action="/audio" class="oneline qsearch"><input type="hidden" name="act" value="player"><input type="hidden" name="list" value="' + escapeAttr(b) + '"><table><tr><td width="100%"><div class="iwrap"><input id="qsearch_fld" type="text" class="text" name="q" placeholder="' + lang.mobile_audio_search_placeholder + '"></div></td><td class="last"><input id="qsearch_btn" class="btn" type="submit" value="' + lang.mobile_audio_search_btn + '" /></td></tr></table></form></div><div class="upanel"><div class="audios_wrap audios_list bl_cont" data-query="' + escapeAttr(c) + '"></div></div></div>');
  1003.                             val("m", a.innerHTML)
  1004.                         }
  1005.                     }, b);
  1006.                     j = function () {
  1007.                         var a = audio.playlist(),
  1008.                             b = ((a[0] || {}).id || "").split("_").slice(2).join("_") || "",
  1009.                             b = "/audio" + obj2qs({
  1010.                                 act: "player",
  1011.                                 list: b
  1012.                             }),
  1013.                             c = [],
  1014.                             d = {};
  1015.                         each(a, function (a, b) {
  1016.                             c.push(b.id);
  1017.                             d[b.id] = [b.artist + " " + b.title, b.id, b.src, b.artist, b.title, b.dur, b.can_add, !1]
  1018.                         });
  1019.                         qsearch.init({
  1020.                             action: b,
  1021.                             al_action: b,
  1022.                             container: geByClass1("upanel", "mcont"),
  1023.                             field: ge("qsearch_fld"),
  1024.                             btn: ge("qsearch_btn"),
  1025.                             top_items: c,
  1026.                             _cache: d,
  1027.                             hl_fields: [2, 3],
  1028.                             tpl: function (a, b, c, d) {
  1029.                                 return b ? d ? d : "" == d ? '<div class="audio_wrap audios_list" data-query="' + escapeAttr(b) + '">' + a + "</div>" : '<div class="audio_wrap audios_list" data-query="' + escapeAttr(b) + '"><div class="al_loading qs_loading">&nbsp;</div></div>' : '<div class="audio_wrap audios_list" data-query="' + escapeAttr(audio.playlist_q()) + '">' + a + "</div>"
  1030.                             },
  1031.                             item_tpl: function (a, b, c, d, e, r, f) {
  1032.                                 return audioplayer && audioplayer.getDOMFromAudio({
  1033.                                     id: a,
  1034.                                     src: b,
  1035.                                     dur: e,
  1036.                                     artist: c,
  1037.                                     title: d,
  1038.                                     can_add: r,
  1039.                                     can_del: f
  1040.                                 }, !0, this.q) || ""
  1041.                             },
  1042.                             null_tpl: function (a) {
  1043.                                 return '<div class="m"><div class="null">' + (a ? lang.mobile_audio_search_not_found.replace("%s", htsc(a)) : lang.mobile_audio_no_audio) + "</div></div>"
  1044.                             },
  1045.                             soft_filter: !0,
  1046.                             need_invalid_keys: browser.desktop,
  1047.                             top_len: 50,
  1048.                             global_search: !0,
  1049.                             onRendered: function () {
  1050.                                 audioplayer && audioplayer.initAudio()
  1051.                             },
  1052.                             al_need: !0,
  1053.                             init_offset: 0
  1054.                         });
  1055.                         a = audio.getCurrentId();
  1056.                         if (a = ge("audio" + a)) a = getY(a) + a.offsetHeight / 2 - getCh() / 2, scrollTop(a)
  1057.                     };
  1058.                     break;
  1059.                 case "photo":
  1060.                     g = !0;
  1061.                     page.set(e, !1, {
  1062.                         before: !0,
  1063.                         beforeAppend: function (a) {
  1064.                             var c = geByTag1("img", b.target),
  1065.                                 d = c && c.src || "/images/blank.gif",
  1066.                                 e = "",
  1067.                                 f = "",
  1068.                                 g = (attr(c, "data-photo") || "").split("|"),
  1069.                                 p = g[0],
  1070.                                 q = +g[1] || 0,
  1071.                                 g = +g[2] || 0,
  1072.                                 h = !0;
  1073.                             if (!q || !g) q = c && c.width || 0, g = c && c.height || 0, h = !1;
  1074.                             if (p) {
  1075.                                 if (q && g) var c = Math.min(604, getCw()) / q,
  1076.                                     j = Math.min(604, Math.ceil(1 <= c && h ? g : g * c)),
  1077.                                     e = e + ("height:" + j + "px;");
  1078.                                 e += "background:url(" + d + ") #f7f7f7 no-repeat center top;";
  1079.                                 100 < j && each(["-moz-", "-o-", "-webkit-", ""], function (a, b) {
  1080.                                     e += b + "background-size:contain;"
  1081.                                 });
  1082.                                 d = p
  1083.                             } else f += "width:100%;";
  1084.                             val(geByClass1("btn back", a), '<div class="b"><i>&nbsp;</i><div class="title"><h1>' + lang.mobile_photos_photo_head_title + "</h1></div></div>");
  1085.                             val(geByClass1("mcont", a), '<div class="pcont photoview bl_cont"><div class="summary">&nbsp;<div class="loading" style="float:left;"><i></i></div></div><div class="photo_wrap"><div class="pv" style="' + (e || "") + '"><img src="' + d + '" alt="" style="' + (f || "") + '" /></div></div><div id="al_fill"></div></div>')
  1086.                         },
  1087.                         afterAppend: function () {
  1088.                             alLoadingFix(0, "al_fill");
  1089.                             scrollTop(0)
  1090.                         }
  1091.                     }, b);
  1092.                     break;
  1093.                 case "u":
  1094.                 case "g":
  1095.                 case "p":
  1096.                 case "e":
  1097.                     g = !0;
  1098.                     page.set(e, !1, {
  1099.                         before: !0,
  1100.                         beforeAppend: function (a) {
  1101.                             var c, d = l.substr(2),
  1102.                                 e = geByClass1(d, a, "a") || geByClass1(d, a, "span"),
  1103.                                 e = stripTags(attr(b.target, "data-name") || attr(e, "data-name") || val(e) || ""),
  1104.                                 d = (d = geByClass1(d, a, "img")) && d.src || attr(b.target, "data-photo") || "/images/blank.gif",
  1105.                                 f = geByClass1("mhead", a);
  1106.                             "u" == h ? c = e.split(" ").shift() : "g" == h ? c = lang.mobile_group_head_title : "p" == h ? c = lang.mobile_public_head_title : "e" == h && (c = lang.mobile_event_head_title);
  1107.                             geByClass1("btn logo", f) ? val(f, "" + (window.al && window.al.menu ? '<div class="btn home"><a href="/" class="b" accesskey="*" onclick="return menu.toggle(event);"><i></i></a></div>' : '<div class="btn home vk_home"><a href="/" class="b" accesskey="*"><i></i></a></div>') + '<div class="btn notify">' + val(geByClass1("btn notify", a)) + '</div><div class="btn back"><div class="b"><div class="title"><h1>' + (c || "&nbsp;") + "</h1></div></div></div>") : c && val(geByClass1("btn back", a), '<div class="b"><div class="title"><h1>' + c + "</h1></div></div>");
  1108.                             val(geByClass1("mcont", a), '<div class="pcont prof bl_cont"><div class="panel prof_panel"><img src="' + (d || "") + '" class="u" align="left"><div class="cont"><h2>' + (e || "") + '<h2/></div></div><div id="al_loading"></div>')
  1109.                         },
  1110.                         afterAppend: function () {
  1111.                             alLoadingFix();
  1112.                             scrollTop(0)
  1113.                         }
  1114.                     }, b);
  1115.                     break;
  1116.                 default:
  1117.                     cur.al_fast && cur.al_fast[h] && (g = !0, page.set(e, !1, cur.al_fast[h](b), b))
  1118.             }
  1119.         }
  1120.         g && (nav.set(b), ajax.tModule = cur.module, ajax.tFastRender = (new Date).getTime());
  1121.         ajax.abort_reqs();
  1122.         b.local ? (c = !0, page.set(e, {}, {
  1123.             after: !0,
  1124.             no_scroll: !0,
  1125.             force: !0
  1126.         }, !1), j && j()) : (j = b.params || {}, f && (j._tstat = f), c = ajax._post(c, j, {
  1127.             onPageDone: function (a, c, d, f, u) {
  1128.                 ajax.tProcess = (new Date).getTime();
  1129.                 page.set(e, {
  1130.                     title: a,
  1131.                     html: c,
  1132.                     js: d,
  1133.                     lm: f,
  1134.                     bc: u
  1135.                 }, {
  1136.                     after: g,
  1137.                     no_scroll: g
  1138.                 }, g ? !1 : b);
  1139.                 ajax.tModule = cur.module;
  1140.                 ajax.tRender = (new Date).getTime()
  1141.             }
  1142.         }), ajax.save_req());
  1143.         return c
  1144.     },
  1145.     confirm: function (a, b, c, d) {
  1146.         return confirm(b) ? ajax.click(a, d, {
  1147.             url_params: {
  1148.                 hash: c
  1149.             }
  1150.         }) : !1
  1151.     },
  1152.     _post: function (a, b, c) {
  1153.         var d = function (a, b) {
  1154.             c.onFail && c.onFail.call(window, 0, a, b)
  1155.         };
  1156.         return ajax.plainpost(a, b, function (b) {
  1157.             var f = !1;
  1158.             try {
  1159.                 f = parseJSON(b)
  1160.             } catch (g) {
  1161.                 f = !1
  1162.             }
  1163.             if (!1 === f) d();
  1164.             else {
  1165.                 var j = f.shift(),
  1166.                     l = f.shift();
  1167.                 b = f.shift();
  1168.                 j = window.al && j != al.ver || !menu.refreshCounters(l);
  1169.                 !1 !== l && setNotify(l[2]);
  1170.                 switch (b) {
  1171.                     case 0:
  1172.                         if (j) return nav.hard_go(nav.cur, null, {
  1173.                             replace: !0
  1174.                         });
  1175.                         b = f.shift();
  1176.                         c.onDone && (isArray(f) ? c.onDone.apply(window, b) : c.onDone.call(window, b));
  1177.                         break;
  1178.                     case 1:
  1179.                         l = f.shift();
  1180.                         f = f.shift();
  1181.                         j || f ? nav.hard_go(l) : nav.go(l, null, {
  1182.                             ignore_cur_process: !0
  1183.                         });
  1184.                         break;
  1185.                     case 2:
  1186.                         l = f.shift();
  1187.                         c.onFail ? (f.unshift(l), f.unshift(b), c.onFail.apply(window, f)) : nav.hard_go(l);
  1188.                         break;
  1189.                     case 3:
  1190.                         page.need_hard_go = j;
  1191.                         if ((b = f[3]) && b.rdr && window.al && al.menu && 614 <= getW("vk_wrap")) {
  1192.                             nav.go(b.rdr, null, {
  1193.                                 replace: !0
  1194.                             });
  1195.                             break
  1196.                         }
  1197.                         c.onPageDone || (c.onPageDone = function (b, c, d, e, f) {
  1198.                             nav.go(a, null, {
  1199.                                 push_only: !0
  1200.                             });
  1201.                             page.set(page.getHash(nav), {
  1202.                                 title: b,
  1203.                                 html: c,
  1204.                                 js: d,
  1205.                                 lm: e,
  1206.                                 bc: f
  1207.                             })
  1208.                         });
  1209.                         c.onPageDone.apply(window, f)
  1210.                 }
  1211.             }
  1212.         }, d)
  1213.     },
  1214.     tGetParam: function () {
  1215.         if (ajax.tStart && ajax.tModule) {
  1216.             var a = ajax.tFastRender - ajax.tStart,
  1217.                 b = ajax.tRestoreRender - ajax.tStart,
  1218.                 c = ajax.tProcess - ajax.tStart,
  1219.                 d = ajax.tRender - ajax.tProcess,
  1220.                 a = ["/" == ajax.tModule.substr(0, 1) ? ajax.tModule.substr(1) : ajax.tModule, a, b, c, d],
  1221.                 e;
  1222.             for (e in a) if (!a[e] || 0 > a[e]) a[e] = 0;
  1223.             ajax.tStart = !1;
  1224.             return a.join(",")
  1225.         }
  1226.     },
  1227.     tAlGetParam: function () {
  1228.         if (ajax.tAlStart && ajax.tAlModule) {
  1229.             var a = ajax.tAlProcess - ajax.tAlStart,
  1230.                 b = ajax.tAlRender - ajax.tAlProcess,
  1231.                 a = ["al_" + ("/" == ajax.tAlModule.substr(0, 1) ? ajax.tAlModule.substr(1) : ajax.tAlModule), a, b],
  1232.                 c;
  1233.             for (c in a) if (!a[c] || 0 > a[c]) a[c] = 0;
  1234.             ajax.tAlStart = !1;
  1235.             return a.join(",")
  1236.         }
  1237.     }
  1238. }, thover = {
  1239.     obj: null,
  1240.     highlight: !1,
  1241.     start: function (a) {
  1242.         thover.clear();
  1243.         thover.end(a);
  1244.         thover.obj = this || null;
  1245.         thover.obj && (thover.highlight = !0, addClass("hover", thover.obj))
  1246.     },
  1247.     cancel: function (a) {
  1248.         thover.obj && (thover.highlight = !1, thover.end(a))
  1249.     },
  1250.     end: function () {
  1251.         thover.obj && (removeClass("hover", thover.obj), thover.highlight && (thover.clear(), addClass("active", thover.obj)), thover.obj = null, thover.highlight = !1)
  1252.     },
  1253.     clear: function () {
  1254.         removeClass("active", geByClass1("active", "vk_wrap"))
  1255.     }
  1256. };
  1257. addEvent(document, "touchmove touchcancel", thover.cancel);
  1258. addEvent(document, "touchend", thover.end);
  1259.  
  1260. function fixHeight() {
  1261.     if (browser.safari_mobile || browser.android || browser.opera_mobile && !browser.opera_mini) {
  1262.         getCh();
  1263.         var a = scrollTop();
  1264.         bodyNode.style.overflow = "hidden";
  1265.         bodyNode.style.minHeight = "5000px";
  1266.         scrollTop(10);
  1267.         var b = getCh() + 1;
  1268.         scrollTop(a);
  1269.         bodyNode.style.minHeight = b + "px";
  1270.         bodyNode.style.overflow = "auto"
  1271.     }
  1272. }
  1273. var page = {
  1274.     fast_load: !1,
  1275.     need_hard_go: !1,
  1276.     getHash: function (a) {
  1277.         return "#player" == a.hash ? !1 : a.path + (a.params ? "?" + a.params : "")
  1278.     },
  1279.     getAlias: function (a) {
  1280.         if (!a) return !1;
  1281.         var b = (a || "").split("?");
  1282.         a = b[0];
  1283.         b = qs2obj(b[1]);
  1284.         delete b.from;
  1285.         delete b.offset;
  1286.         return a + obj2qs(b)
  1287.     },
  1288.     set: function (a, b, c, d) {
  1289.         c = c || {};
  1290.         var e = scrollTop(),
  1291.             f = null;
  1292.         c.force || (f = remove("m"));
  1293.         if (!c.after && (clog("st " + e), !page.fast_load)) {
  1294.             var g = page.getHash(nav);
  1295.             page.save(g, {
  1296.                 html: null,
  1297.                 st: e,
  1298.                 page: f,
  1299.                 state: page.stash()
  1300.             }, !0)
  1301.         }
  1302.         c.before || page.clear();
  1303.         if (c.before || !c.before && !c.after) window.lm_qsearch_counter ? lm_qsearch_counter++ : lm_qsearch_counter = 1;
  1304.         if (c.before) page.fast_load = !0, d && d.target && addClass("__al_target", d.target), b = f.cloneNode(!0), d && d.target && removeClass("__al_target", d.target), d = geByClass1("__al_target", b), removeClass("__al_target", d), c.beforeAppend && c.beforeAppend(b, d), append(b, "vk_wrap"), cur.toggleHeaderSearch && cur.toggleHeaderSearch(!1), c.afterAppend && c.afterAppend(b), menu && menu.clear_hover(), menu && menu.closeSearch();
  1305.         else {
  1306.             d && nav.set(d);
  1307.             if (page.need_hard_go) return nav.hard_go(nav.cur, null, {
  1308.                 replace: !0
  1309.             });
  1310.             c.force || (b.title && (document.title = b.title), f = b.page, f || (f = ce("div", {
  1311.                 id: "m"
  1312.             }), val(f, b.html)), menu.opened() && (g = ce("div", {
  1313.                 id: "m_helper",
  1314.                 onclick: menu.close
  1315.             }), append(g, f)), append(f, "vk_wrap"));
  1316.             page.fast_load = !1;
  1317.             thover.clear();
  1318.             c.force || (b.js && evalJs(b.js), b.state && page.stash(b.state), page.save(a, b));
  1319.             b.lm && menu.refresh(b.lm);
  1320.             b.bc && (bodyNode.className = b.bc);
  1321.             d = d ? d.nav && d.nav.hash : nav.hash;
  1322.             b.st || !d ? scrollTop(b.st || 0, 10) : c.no_scroll && !c.force ? scrollTop(e, 10) : scrollToHash();
  1323.             audioplayer && audioplayer.initAudio()
  1324.         }
  1325.     },
  1326.     save: function (a, b, c) {
  1327.         if (a) {
  1328.             var d = c ? nav.page_get(a) : {};
  1329.             d && (nav.page_set(a, extend(d, b), page.getAlias(a)), clog((c ? "add " : "set ") + a))
  1330.         }
  1331.     },
  1332.     restore: function (a) {
  1333.         var b = nav.page_get(a);
  1334.         b || (b = nav.page_get(page.getAlias(a)));
  1335.         return b ? (b.lm && extend(b.lm, {
  1336.             tn: !1,
  1337.             bn: !1
  1338.         }), page.set(a, b), clog("get " + a), clog("scrolled to " + b.st), !0) : !1
  1339.     },
  1340.     stash: function (a) {
  1341.         return window.cur && cur.stash && cur.stash(a) || !1
  1342.     },
  1343.     clear: function () {
  1344.         onBodyScroll("__clear");
  1345.         onBodyResize("__clear");
  1346.         menu && menu.initEvents();
  1347.         window.cur && cur.destroy && cur.destroy();
  1348.         window.cur = {}
  1349.     }
  1350. }, nav = function () {
  1351.     function a(a) {
  1352.         var b;
  1353.         if (b = /^(https?:)\/\/([^:\/]+)?(?::(\d+))?\/?(.*)$/i.exec(a)) {
  1354.             if (b[1] != location.protocol || b[2] && b[2] != location.hostname || b[3] && b[3] != location.port) return !1;
  1355.             a = b[4]
  1356.         }
  1357.         return a
  1358.     }
  1359.     function b(a, b, c) {
  1360.         if (checkEvent(b) || c && c.push_only) return !0;
  1361.         c && c.replace ? location.replace(a) : a && (location.href = getHref(a));
  1362.         return !0
  1363.     }
  1364.     function c(a, c, d) {
  1365.         cancelEvent(c);
  1366.         a = getHref(a);
  1367.         if (window.al && al.ver && (d && d.push_only || ajax.nav(a, d))) return !0;
  1368.         b(a, c, d)
  1369.     }
  1370.     function d(b, d, f) {
  1371.         f = extend({
  1372.             no_push: !1,
  1373.             push_only: !1,
  1374.             replace: !1
  1375.         }, f);
  1376.         if (checkEvent(d) || !b) return !0;
  1377.         var m = b,
  1378.             g = "",
  1379.             h = "",
  1380.             p = "";
  1381.         !b.href && b.getAttribute && (m = b.getAttribute("data-href"));
  1382.         if (("input" == tag(b) || "button" == tag(b)) && "submit" == b.type && b.form) {
  1383.             var q = b.form,
  1384.                 j = {}, m = q.action || "",
  1385.                 k = !1;
  1386.             each(q, function (a, c) {
  1387.                 if (!c.name || c.disabled || "radio" === c.type && !c.checked || "checkbox" === c.type && !c.checked || "button" === c.type || "submit" === c.type && c !== b || "image" === c.type && c !== b) return !0;
  1388.                 if ("file" === c.type) return k = !0, !1;
  1389.                 j[c.name] = c.value
  1390.             });
  1391.             if (k) {
  1392.                 var l = ce("iframe");
  1393.                 attr(l, "id", "upload_iframe");
  1394.                 attr(l, "name", "upload_iframe");
  1395.                 attr(l, "width", "0");
  1396.                 attr(l, "height", "0");
  1397.                 attr(l, "border", "0");
  1398.                 attr(l, "style", "width:0;height:0;border:none;position:absolute;left:-1000px;");
  1399.                 append(l, q.parentNode);
  1400.                 window.frames.upload_iframe.name = "upload_iframe";
  1401.                 var l = ge("upload_iframe"),
  1402.                     t = !1;
  1403.                 each(q, function (a, b) {
  1404.                     if ("submit" === b.type) return t = b, !1
  1405.                 });
  1406.                 addEvent(l, "load", function C() {
  1407.                     removeEvent(l, "load", C);
  1408.                     setTimeout(function () {
  1409.                         remove(l);
  1410.                         unlockButton(t)
  1411.                     }, 2E3)
  1412.                 });
  1413.                 setDocumentDomain();
  1414.                 attr(q, "target", "upload_iframe");
  1415.                 attr(q, "method", "post");
  1416.                 attr(q, "enctype", "multipart/form-data");
  1417.                 attr(q, "encoding", "multipart/form-data");
  1418.                 append(ce("input", {
  1419.                     type: "hidden",
  1420.                     id: "__extra",
  1421.                     name: "__extra",
  1422.                     value: 1
  1423.                 }), q);
  1424.                 q.submit();
  1425.                 lockButton(t);
  1426.                 setTimeout(function () {
  1427.                     remove("__extra")
  1428.                 }, 0);
  1429.                 return !1
  1430.             }
  1431.             if (!(m = a(m))) return !0;
  1432.             !q.method || "get" == q.method ? m = m.split("?", 1).shift() + obj2qs(j) : f.params = j;
  1433.             clog(q.method);
  1434.             clog(m);
  1435.             clog(obj2qs(f.params))
  1436.         }
  1437.         if ("string" !== typeof m) g = m.pathname, "/" !== g.substr(0, 1) && (g = "/" + g), h = m.search.substr(1), p = m.hash, m = g + m.search + p;
  1438.         else if (g = m.split("#"), q = g.shift(), p = g.length ? "#" + g.join("#") : "", q = q.split("?"), g = q.shift(), h = q.join("?"), (p || h) && !g) g = nav.path, q || (h = nav.params), m = g + (h ? "?" + h : "") + p;
  1439.         d && (m.split("#").shift() == nav.cur.split("#").shift() && p) && (scrollToHash(p), f.push_only = !0);
  1440.         if (f.no_push && nav.cur == m) return !1;
  1441.         if (f.push_only) return e(extend(f, {
  1442.             nav: {
  1443.                 push: m,
  1444.                 path: g,
  1445.                 params: h,
  1446.                 hash: p
  1447.             }
  1448.         })), !1;
  1449.         addClass("active", f.link || b);
  1450.         hasClass("al_back", b) && (f.need_restore = !0);
  1451.         d = extend(f, b.tagName ? {
  1452.             target: b
  1453.         } : {}, {
  1454.             nav: {
  1455.                 push: m,
  1456.                 path: g,
  1457.                 params: h,
  1458.                 hash: p
  1459.             }
  1460.         });
  1461.         !d.ignore_cur_process && cur.processNav && cur.processNav(d) ? (e(d), menu.close(null, !0)) : c(d.nav.push, null, d);
  1462.         return !1
  1463.     }
  1464.     function e(a) {
  1465.         if (!a.no_push && nav.cur != a.nav.push) try {
  1466.             var c = a.nav.push;
  1467.             if (g) c = "/" == c.substr(0, 1) ? c : "/" + c, a.replace ? history.replaceState(null, null, c) : history.pushState(null, null, c), clog(a.replace ? "replace: " + c : "push: " + c);
  1468.             else {
  1469.                 var d = "/" == c.substr(0, 1) ? c : "/" + c;
  1470.                 ge("base").href = d;
  1471.                 a.replace ? location.replace(location.pathname + location.search + "#" + d) : (j = d, location.hash = d);
  1472.                 clog(a.replace ? "replace hash: " + c : "push hash: " + c)
  1473.             }
  1474.         } catch (e) {
  1475.             return b(a.nav.push, null, a)
  1476.         }
  1477.         nav.cur = a.nav.push;
  1478.         nav.path = a.nav.path;
  1479.         nav.params = a.nav.params;
  1480.         nav.hash = a.nav.hash
  1481.     }
  1482.     function f() {
  1483.         var a = (location.hash || "").substr(1);
  1484.         j !== a && (j = a, l(!0));
  1485.         setTimeout(f, 100)
  1486.     }
  1487.     var g = !(!window.history || !history.pushState),
  1488.         j = null,
  1489.         l = se(function () {
  1490.             return j
  1491.         }),
  1492.         h = [];
  1493.     if (g) addEvent(window, "popstate", function () {
  1494.         clog("popstate: " + location.href);
  1495.         d(location, null, {
  1496.             no_push: !0,
  1497.             need_restore: !0
  1498.         })
  1499.     });
  1500.     else {
  1501.         var k = location.hash || "";
  1502.         "#/" == k.substr(0, 2) && b(k.substr(1), null, {
  1503.             replace: !0
  1504.         });
  1505.         "onhashchange" in window ? addEvent(window, "hashchange", function () {
  1506.             var a = (location.hash || "").substr(1);
  1507.             a || (a = location);
  1508.             d(a, null, {
  1509.                 no_push: !0,
  1510.                 need_restore: !0
  1511.             })
  1512.         }) : (f(), l(function (a) {
  1513.             clog("popstate hash: " + a);
  1514.             d(a, null, {
  1515.                 no_push: !0,
  1516.                 need_restore: !0
  1517.             })
  1518.         }))
  1519.     }
  1520.     return {
  1521.         go: d,
  1522.         al_go: c,
  1523.         app_go: function (a, b, c) {
  1524.             if (!c || checkEvent(b)) return !0;
  1525.             remove("app_go_frame");
  1526.             var d = getHref(a);
  1527.             a = ce("iframe", {
  1528.                 id: "app_go_frame",
  1529.                 src: c,
  1530.                 onload: function () {
  1531.                     remove("app_go_frame");
  1532.                     d && nav.hard_go(d)
  1533.                 }
  1534.             }, {
  1535.                 display: "none"
  1536.             });
  1537.             bodyNode.appendChild(a);
  1538.             return !1
  1539.         },
  1540.         hard_go: b,
  1541.         page_set: function (a, b, c) {
  1542.             clog("SET", "hash:", a, "alias:", c);
  1543.             for (var d = h.length - 1; 0 <= d; --d) if (h[d].h == a || h[d].a == a) {
  1544.                 h[d] = {
  1545.                     h: a,
  1546.                     d: b,
  1547.                     a: c
  1548.                 };
  1549.                 return
  1550.             }
  1551.             h.push({
  1552.                 h: a,
  1553.                 d: b,
  1554.                 a: c
  1555.             });
  1556.             7 < h.length && h.shift()
  1557.         },
  1558.         page_get: function (a) {
  1559.             clog("GET", "hash:", a);
  1560.             for (var b = h.length - 1; 0 <= b; --b) if (h[b].h == a || h[b].a == a) return h = h.slice(0, b + 1), clog("found", "hash:", h[b].h, "alias:", h[b].a), h[b].d;
  1561.             return !1
  1562.         },
  1563.         set: e,
  1564.         checkUrl: a,
  1565.         cur: location.pathname + location.search + location.hash,
  1566.         path: location.pathname,
  1567.         params: location.search.substr(1),
  1568.         hash: location.hash
  1569.     }
  1570. }();
  1571. ajax._init();
  1572. ajax.enabled = ajax._req ? !0 : !1;
  1573. ajax.enabled && (onDOMReady(function () {
  1574.     remove("app_go_frame");
  1575.     ajax.prepare_nav();
  1576.     ajax.prepare_click();
  1577.     menu && menu.initTouch();
  1578.     audioplayer && audioplayer.initAudio();
  1579.     addClass("_js", "vk_wrap")
  1580. }), page.clear());
  1581. addEvent(window, "orientationchange", fixHeight);
  1582. setTimeout(function () {
  1583.     !location.hash && scrollTop(0)
  1584. }, 0);
  1585. onDOMReady(fixHeight);
  1586. var Like = {
  1587.     onDone: function (a, b, c, d) {
  1588.         var e = ge(a) || geByClass1("like_box");
  1589.         if (e && a) {
  1590.             geByClass1("info", e);
  1591.             a = geByClass1("like", e);
  1592.             var f = geByClass1("repost", e),
  1593.                 e = geByClass1("like_wrap", e);
  1594.             a && (a.innerHTML = b || "", toggle(a, b));
  1595.             f && (f.innerHTML = c || "", toggle(f, c));
  1596.             e && val(e, d || "")
  1597.         }
  1598.     },
  1599.     onFail: function () {
  1600.         var a = Array.prototype.slice.call(arguments);
  1601.         switch (a.shift()) {
  1602.             case 2:
  1603.                 nav.hard_go(a[0])
  1604.         }
  1605.     }
  1606. }, PhotoLike = {
  1607.     onDone: function (a, b, c, d) {
  1608.         Like.onDone.apply(this, arguments);
  1609.         if (this.photo_id) {
  1610.             var e = photo.get(this.photo_id);
  1611.             if (e) {
  1612.                 var f = ce("div", {
  1613.                     innerHTML: e.likes
  1614.                 });
  1615.                 val(geByClass1("like", f), b);
  1616.                 e.likes = val(f);
  1617.                 e.publish = '<span class="repost">' + c + "</span>";
  1618.                 var f = ce("div", {
  1619.                     innerHTML: e.actions
  1620.                 }),
  1621.                     g = geByClass1("like_wrap", f);
  1622.                 val(g, d);
  1623.                 e.actions = val(f);
  1624.                 photo.save(e)
  1625.             }
  1626.         }
  1627.     },
  1628.     onFail: Like.onFail
  1629. }, PhotoTag = {
  1630.     onDone: function () {
  1631.         if (this.photo_id) {
  1632.             var a = photo.get(this.photo_id);
  1633.             a && (a.tag_info = "", photo.save(a));
  1634.             a = geByClass1("photoview");
  1635.             a = geByClass1("tag_info_wrap", a);
  1636.             val(a, "")
  1637.         }
  1638.     }
  1639. }, PhotoDelete = {
  1640.     onDone: function (a, b, c) {
  1641.         var d = geByClass1("photoview"),
  1642.             e = geByClass1("photo_msg"),
  1643.             f = !! b;
  1644.         if (d && e) {
  1645.             val(e, b || "");
  1646.             toggleClass("photo_deleted", d, f);
  1647.             if (a = photo.get(a)) a.deleted = b, photo.save(a);
  1648.             c && menu && menu.refresh({
  1649.                 pp: c
  1650.             })
  1651.         }
  1652.     }
  1653. }, Poll = {
  1654.     onDone: function (a, b) {
  1655.         val(a, b)
  1656.     }
  1657. }, ToggleMenu = {
  1658.     onStart: function () {
  1659.         addClass("loading", this.link)
  1660.     },
  1661.     onDone: function (a) {
  1662.         this.link && val(this.link.parentNode, a)
  1663.     }
  1664. }, Comment = {
  1665.     onDone: function (a, b) {
  1666.         if (a) {
  1667.             remove(a + "_msg");
  1668.             var c = ge(a);
  1669.             if (c) {
  1670.                 if (b) {
  1671.                     var d = ce("div", {
  1672.                         id: a + "_msg",
  1673.                         className: "post post_msg"
  1674.                     });
  1675.                     val(d, '<div class="cont">' + b + "</div>");
  1676.                     after(d, c);
  1677.                     hide(c)
  1678.                 } else show(a);
  1679.                 if (this.photo_id && (c = photo.get(this.photo_id))) d = geByClass1("photoview"), d = geByClass1("comments_wrap", d), c.comments_html = val(d)
  1680.             }
  1681.         }
  1682.     }
  1683. }, Wall = {
  1684.     onStart: function () {
  1685.         var a = gpeByClass("show_more_wrap", this.link) || this.link,
  1686.             b = ce("div", {
  1687.                 id: "show_more_loading",
  1688.                 className: "show_more_loading",
  1689.                 innerHTML: "<i>&nbsp;</i>"
  1690.             }),
  1691.             c = ce("div", {
  1692.                 id: "show_more_wrap",
  1693.                 className: "show_more_wrap"
  1694.             });
  1695.         attr(b, "data-href", getHref(a));
  1696.         c.appendChild(b);
  1697.         before(c, a);
  1698.         remove(a)
  1699.     },
  1700.     onDone: function (a) {
  1701.         ajax.tAlProcess = (new Date).getTime();
  1702.         var b = ge("show_more_wrap");
  1703.         a = cdf(a);
  1704.         before(a, b);
  1705.         remove(b);
  1706.         ajax.prepare_nav("mcont");
  1707.         ajax.prepare_click("mcont");
  1708.         onBodyScroll(!0);
  1709.         ajax.tAlModule = cur.module;
  1710.         ajax.tAlRender = (new Date).getTime()
  1711.     }
  1712. }, Photos = {
  1713.     onStart: Wall.onStart,
  1714.     onDone: function (a, b) {
  1715.         ajax.tAlProcess = (new Date).getTime();
  1716.         var c = geByClass1("pv_all", geByClass1("photos", "mcont")),
  1717.             d = ge("show_more_wrap"),
  1718.             e = cdf(b);
  1719.         a = a.replace(/<img src="([^"]+)"/gi, '<img data-src="$1" class="_i"');
  1720.         var f = cdf(a);
  1721.         c && c.appendChild(f);
  1722.         before(e, d);
  1723.         remove(d);
  1724.         ajax.prepare_nav("mcont");
  1725.         ajax.prepare_click("mcont");
  1726.         setTimeout(function () {
  1727.             onBodyScroll(!0)
  1728.         }, 100);
  1729.         ajax.tAlModule = cur.module;
  1730.         ajax.tAlRender = (new Date).getTime()
  1731.     }
  1732. }, Audios = {
  1733.     onStart: Wall.onStart,
  1734.     onDone: function (a, b) {
  1735.         ajax.tAlProcess = (new Date).getTime();
  1736.         var c = geByClass1("audios_wrap", geByClass1("audios", "mcont")),
  1737.             d = ge("show_more_wrap"),
  1738.             e = cdf(b),
  1739.             f = cdf(a);
  1740.         c && c.appendChild(f);
  1741.         before(e, d);
  1742.         remove(d);
  1743.         ajax.prepare_nav("mcont");
  1744.         ajax.prepare_click("mcont");
  1745.         ajax.tAlModule = cur.module;
  1746.         ajax.tAlRender = (new Date).getTime()
  1747.     }
  1748. }, FixPost = {
  1749.     onDone: function (a) {
  1750.         val(this.link.parentNode, a)
  1751.     }
  1752. }, Notify = {
  1753.     onStart: function () {
  1754.         for (var a = this.link; a = a.parentNode;) if (hasClass("notify", a)) {
  1755.             hasClass("notify_panel", a.parentNode) ? remove(a.parentNode) : remove(a);
  1756.             break
  1757.         }
  1758.     }
  1759. }, Dialog = {
  1760.     onStart: function () {
  1761.         var a = geByClass("pages", "mcont");
  1762.         each(a, function (a, c) {
  1763.             before(ce("div", {
  1764.                 className: "loading",
  1765.                 innerHTML: "<i></i>"
  1766.             }), c.firstChild)
  1767.         })
  1768.     },
  1769.     onDone: function (a, b) {
  1770.         var c = ge("messages" + b);
  1771.         c && (val(c, a), !this.save && scrollToEl());
  1772.         this.save && mail.saveDialog({
  1773.             messages: a
  1774.         }, this.save);
  1775.         this.clear && (val(geByTag1("textarea", "write_form"), ""), remove(geByClass1("medias", "write_form")))
  1776.     },
  1777.     onFail: function () {
  1778.         switch (Array.prototype.slice.call(arguments).shift()) {
  1779.             case 2:
  1780.                 this.link.form && this.link.form.submit()
  1781.         }
  1782.     }
  1783. }, Dialogs = {
  1784.     onStart: function () {
  1785.         var a = geByClass("pages", "mcont");
  1786.         each(a, function (a, c) {
  1787.             before(ce("div", {
  1788.                 className: "loading",
  1789.                 innerHTML: "<i></i>"
  1790.             }), c.firstChild)
  1791.         })
  1792.     },
  1793.     onDone: function (a, b) {
  1794.         var c = ge("dialogs");
  1795.         c && (val(c, a), !this.no_scroll && scrollToEl(), mail.cacheDialogsPage());
  1796.         mail.save(b)
  1797.     }
  1798. }, reply = {
  1799.     show: function (a, b) {
  1800.         if (checkEvent(b)) return !0;
  1801.         reply.hideall();
  1802.         addClass("reply_to", geByClass1("reply_wrap", "wall_reply" + a));
  1803.         addClass("reply_to", "reply_add" + a);
  1804.         replaceClass("add_reply", "reply_to", geByClass1("pcont", "mcont"));
  1805.         elfocus(geByTag1("textarea", "reply_add" + a));
  1806.         return !1
  1807.     },
  1808.     hide: function (a) {
  1809.         if (checkEvent(a)) return !0;
  1810.         reply.edithide();
  1811.         elfocus(geByTag1("textarea", "reply_add"));
  1812.         return !1
  1813.     },
  1814.     hideall: function () {
  1815.         for (var a = geByClass1("replies", "mcont"), a = geByClass("post", a), b = 0, c = a.length; b < c; b++) {
  1816.             var d = a[b],
  1817.                 e = ge(d.id.replace("wall_reply", "reply_add")),
  1818.                 f = ge(d.id.replace("wall_reply", "edit_reply"));
  1819.             removeClass("reply_to", geByClass1("reply_wrap", d));
  1820.             removeClass("reply_to", e);
  1821.             removeClass("edit", d);
  1822.             removeClass("edit", f)
  1823.         }
  1824.         return !1
  1825.     },
  1826.     editshow: function (a, b) {
  1827.         if (checkEvent(b)) return !0;
  1828.         reply.hideall();
  1829.         addClass("edit", "wall_reply" + a);
  1830.         addClass("edit", "edit_reply" + a);
  1831.         addClass("edit_post", geByClass1("pcont", "mcont"));
  1832.         elfocus(geByTag1("textarea", "edit_reply" + a));
  1833.         return !1
  1834.     },
  1835.     edithide: function (a) {
  1836.         if (checkEvent(a)) return !0;
  1837.         replaceClass("reply_to", "add_reply", geByClass1("pcont", "mcont"));
  1838.         removeClass("edit_post", geByClass1("pcont", "mcont"));
  1839.         return !1
  1840.     },
  1841.     greeting: function (a, b) {
  1842.         var c = geByTag1("textarea", b || geByClass1("post_add", "mcont"));
  1843.         if (!c) return !0;
  1844.         var d = c.value.match(/\[post\d+\|[^\]]+\]/g),
  1845.             e = 0,
  1846.             f;
  1847.         for (f in d || {})++e;
  1848.         10 > e && (c.value += a);
  1849.         edit.hide();
  1850.         elfocus(c);
  1851.         return !1
  1852.     }
  1853. }, edit = {
  1854.     show: function (a, b) {
  1855.         if (checkEvent(b)) return !0;
  1856.         edit.hideall();
  1857.         addClass("edit", "post" + a);
  1858.         addClass("edit", "edit_post" + a);
  1859.         addClass("edit_post", geByClass1("pcont", "mcont"));
  1860.         elfocus(geByTag1("textarea", "edit_post" + a));
  1861.         return !1
  1862.     },
  1863.     hide: function (a) {
  1864.         if (checkEvent(a)) return !0;
  1865.         removeClass("edit_post", geByClass1("pcont", "mcont"));
  1866.         return !1
  1867.     },
  1868.     hideall: function () {
  1869.         for (var a = geByClass1("msgs", "mcont"), a = geByClass("post", a), b = 0, c = a.length; b < c; b++) {
  1870.             var d = a[b],
  1871.                 e = ge(d.id.replace("post", "edit_post"));
  1872.             removeClass("edit", d);
  1873.             removeClass("edit", e)
  1874.         }
  1875.         return !1
  1876.     }
  1877. }, post = {
  1878.     add_attach: function (a, b) {
  1879.         var c = gpeByTag("form", a),
  1880.             d = ce("input", {
  1881.                 type: "hidden",
  1882.                 name: "add_attach",
  1883.                 value: 1
  1884.             });
  1885.         if (c) {
  1886.             var e = !1;
  1887.             each(c, function (a, b) {
  1888.                 if ("submit" === b.type) return e = b, !1
  1889.             });
  1890.             if (e) return append(d, c), window.al && al.ver ? nav.go(e, b) : c.submit()
  1891.         }
  1892.         return !0
  1893.     },
  1894.     toggleGif: function (a, b, c) {
  1895.         return !a || checkEvent(b) ? !0 : hasClass("cur_gif", a.parentNode) ? post.hideGif(a, b) : post.showGif(a, b, c)
  1896.     },
  1897.     showGif: function (a, b, c) {
  1898.         if (!a || checkEvent(b)) return !0;
  1899.         if (c) {
  1900.             cur.loadedGifs || (cur.loadedGifs = {});
  1901.             if (!cur.loadedGifs[a.href] && !confirm(c)) return !1;
  1902.             cur.loadedGifs[a.href] = !0
  1903.         }
  1904.         var d = a.parentNode;
  1905.         c = getY(d);
  1906.         var e = scrollTop();
  1907.         each(geByClass("cur_gif", "mcont"), function (a, b) {
  1908.             post.hideGif(geByTag1("a", b))
  1909.         });
  1910.         scrollTop(e - (c - getY(d)));
  1911.         var f = ce("image", {
  1912.             src: a.href,
  1913.             className: "gif_original"
  1914.         });
  1915.         addClass("cur_gif gif_loading", d);
  1916.         append(f, a);
  1917.         a = function (a) {
  1918.             if (getW(f) && getH(f) || a) clearInterval(g), hasClass("cur_gif", d) && replaceClass("gif_loading", "gif_opened", d)
  1919.         };
  1920.         var g = setInterval(a, 100);
  1921.         f.onload = a;
  1922.         return cancelEvent(b)
  1923.     },
  1924.     hideGif: function (a, b) {
  1925.         if (!a || checkEvent(b)) return !0;
  1926.         var c = a.parentNode;
  1927.         removeClass("cur_gif", c);
  1928.         removeClass("gif_opened", c);
  1929.         removeClass("gif_loading", c);
  1930.         remove(geByClass1("gif_original", c));
  1931.         return cancelEvent(b)
  1932.     }
  1933. }, menu = {
  1934.     enabled: function (a) {
  1935.         if (!window.al || !window.al.menu) return removeClass("_lm", bodyNode), !1;
  1936.         "undefined" !== typeof a && (toggleClass("_lm", bodyNode, a), a || removeClass("qs_opened", "vk_wrap"));
  1937.         return hasClass("_lm", bodyNode)
  1938.     },
  1939.     opened: function () {
  1940.         return hasClass("lm_opened", bodyNode)
  1941.     },
  1942.     toggle: function (a, b) {
  1943.         if (checkEvent(a) || !window.al || !window.al.menu) return !0;
  1944.         menu.opened() ? menu.close(a, b) : menu.open(a, b);
  1945.         return !1
  1946.     },
  1947.     open: function (a) {
  1948.         if (checkEvent(a) || !window.al || !window.al.menu) return !0;
  1949.         if (menu.opened()) return !1;
  1950.         if (!menu.enabled()) return nav.go("/"), !1;
  1951.         menu.clear_hover();
  1952.         var b = ce("div", {
  1953.             id: "m_helper",
  1954.             onclick: menu.close
  1955.         });
  1956.         a = menu._st || 0;
  1957.         var c = scrollTop(),
  1958.             d = ge("l"),
  1959.             e = ge("m"),
  1960.             f = ge("vk_wrap").offsetWidth,
  1961.             g = e.offsetWidth;
  1962.         mh = e.offsetHeight;
  1963.         if (!(882 <= f)) return append(b, "m"), addClass("lm_opened", bodyNode), b = d.offsetHeight, 480 <= f ? a = c <= b - getCh() ? Math.min(c, b - getCh()) : 0 : c < a ? a = c : c - a > mh - b && mh > b && (a = c - mh + b), menu._st = Math.max(0, c - a), menu._mw = g, menu.fix_size(), scrollTop(a), ajax.post("/", {
  1964.             _ajax: 1,
  1965.             act: "ping"
  1966.         }), window.lm_qsearch_counter ? lm_qsearch_counter-- : lm_qsearch_counter = -1, lm_qsearch_counter && menu.cancelSearch(), !1
  1967.     },
  1968.     close: function (a) {
  1969.         if (checkEvent(a) || !window.al || !window.al.menu) return !0;
  1970.         if (!menu.opened()) return !1;
  1971.         remove("m_helper");
  1972.         menu.clear_hover();
  1973.         a = scrollTop();
  1974.         var b = menu._st + a;
  1975.         ge("l");
  1976.         var c = 480 <= ge("vk_wrap").offsetWidth;
  1977.         removeClass("lm_opened", bodyNode);
  1978.         menu._st = c ? 0 : a;
  1979.         menu.fix_size(!0);
  1980.         scrollTop(b);
  1981.         window.lm_qsearch_focused && menu.cancelSearch();
  1982.         return !1
  1983.     },
  1984.     fix_size: function (a) {
  1985.         var b = ge("l"),
  1986.             c = ge("m");
  1987.         menu._mw || Math.min(690, getCw());
  1988.         var d = ge("mhead"),
  1989.             d = d && d.offsetHeight || 0,
  1990.             e = menu._st || 0;
  1991.         b && (a ? (c.style.minHeight = "0", c.style.marginTop = "0") : (e = e > d ? e : 0, b.style.minHeight = getCh() + "px", c.style.minHeight = b.offsetHeight + e + "px", c.style.marginTop = -e + "px"))
  1992.     },
  1993.     clear_hover: function () {
  1994.         thover.clear()
  1995.     },
  1996.     refreshCounters: function (a) {
  1997.         if (!a || !a.length || !window.al || !window.al.menu) return !0;
  1998.         if (a.length != window.al.menu.length) return !1;
  1999.         var b = geByClass1("main_menu", "l");
  2000.         each(a, function (a, d) {
  2001.             if ("undefined" === typeof d) return !0;
  2002.             var e = al.menu[a],
  2003.                 f = geByClass1(e[0], b),
  2004.                 g = geByTag1("a", f),
  2005.                 f = geByTag1("span", f),
  2006.                 j = geByTag1("em", f);
  2007.             attr(g, "data-href", !1);
  2008.             d ? (e[2] && attr(g, "href", e[2]), j ? val(j, d) : append(ce("em", {
  2009.                 innerHTML: d
  2010.             }), f)) : (e[1] && attr(g, "href", e[1]), remove(j));
  2011.             ajax.prepare_click(g)
  2012.         });
  2013.         return !0
  2014.     },
  2015.     refresh: function (a) {
  2016.         a = a || {};
  2017.         a.fv_link && attr("lm_fv_link", "href", a.fv_link);
  2018.         "undefined" !== typeof a.pp && !1 !== a.pp && val("lm_prof_panel", a.pp);
  2019.         "undefined" !== typeof a.tn && !1 !== a.tn && val("lm_top_notify", a.tn);
  2020.         "undefined" !== typeof a.bn && !1 !== a.bn && val("lm_bottom_notify", a.bn)
  2021.     },
  2022.     initEvents: function () {
  2023.         onBodyResize(function () {
  2024.             var a = ge("vk_wrap").offsetWidth,
  2025.                 b = menu._st || 0;
  2026.             882 <= a && 44 < b && menu.close()
  2027.         })
  2028.     },
  2029.     initTouch: function () {
  2030.         function a(a) {
  2031.             var b = a.touches;
  2032.             return {
  2033.                 x: a.pageX || b && b[0] && b[0].pageX || 0,
  2034.                 y: a.pageY || b && b[0] && b[0].pageY || 0
  2035.             }
  2036.         }
  2037.         menu.initEvents();
  2038.         addEvent(document, "orientationchange", function () {
  2039.             var a = ge("vk_wrap").offsetWidth,
  2040.                 b = menu._st || 0;
  2041.             882 <= a && 44 < b && menu.close()
  2042.         });
  2043.         addEvent(document, "keydown", function (a) {
  2044.             if (a && a.shiftKey && (a.ctrlKey || a.metaKey)) 37 == a.keyCode ? (cancelEvent(a), menu.close()) : 39 == a.keyCode && (cancelEvent(a), menu.open())
  2045.         });
  2046.         if (isTouch) {
  2047.             var b = !1,
  2048.                 c = !1,
  2049.                 d = Math.min(604, getCw()) / 3;
  2050.             addEvent(document, "touchstart", function (d) {
  2051.                 geByClass1("btn home", "mhead") && (b = c = a(d))
  2052.             });
  2053.             addEvent(document, "touchmove touchend touchcancel", function (e) {
  2054.                 if (b) {
  2055.                     "touchmove" == e.type && (c = a(e));
  2056.                     var f;
  2057.                     f = c.x - b.x;
  2058.                     var g = c.y - b.y;
  2059.                     f = Math.sqrt(f * f + g * g);
  2060.                     g = Math.abs(180 * Math.atan2(b.y - c.y, c.x - b.x) / Math.PI);
  2061.                     if ("touchend" == e.type || "touchcancel" == e.type) if (b = !1, "touchcancel" == e.type) return;
  2062.                     10 > f || (menu.opened() && (g = 180 - g), 30 < g ? b = !1 : (e && cancelEvent(e), f > d && (b = !1, menu.toggle())))
  2063.                 }
  2064.             })
  2065.         }
  2066.     },
  2067.     closeSearch: function () {
  2068.         if (!window.al || !window.al.menu) return !0;
  2069.         lm_qsearch && lm_qsearch.blur();
  2070.         removeClass("qs_opened", "vk_wrap");
  2071.         return !1
  2072.     },
  2073.     cancelSearch: function () {
  2074.         if (!window.al || !window.al.menu) return !0;
  2075.         lm_qsearch && lm_qsearch.clear();
  2076.         removeClass("qs_opened", "vk_wrap");
  2077.         return !1
  2078.     },
  2079.     headerAction: function () {
  2080.         return menu.toggle()
  2081.     }
  2082. }, mail = function () {
  2083.     function a() {
  2084.         if (g) {
  2085.             var a = [];
  2086.             each(geByClass("_unread"), function (b, c) {
  2087.                 var d = /(?:^|\s)_msg([0-9]+)(?:\s|$)/i.exec(c.className)[1] || 0;
  2088.                 d && a.push(d)
  2089.             });
  2090.             a.length && mail.sendMarkAsRead(g, a)
  2091.         }
  2092.     }
  2093.     function b(a, b) {
  2094.         b ? -1 == b ? replaceClass("lvi", "mlvi", a) : replaceClass("mlvi", "lvi", a) : (removeClass("lvi", a), removeClass("mlvi", a))
  2095.     }
  2096.     var c = {}, d, e, f, g = null,
  2097.         j = !1,
  2098.         l = {}, h = {}, k = {}, s = null;
  2099.     return {
  2100.         init: function (b, c) {
  2101.             b && (g = b, c && mail.saveDialog(c, b));
  2102.             j || (j = !0, addEvent(document, isTouch ? "touchstart" : "click", a));
  2103.             im.on()
  2104.         },
  2105.         clear: function () {
  2106.             c = {};
  2107.             f = e = d = void 0;
  2108.             l = {};
  2109.             g = null;
  2110.             removeEvent(document, isTouch ? "touchstart" : "click", a);
  2111.             j = !1;
  2112.             im.off()
  2113.         },
  2114.         send: function (a, b) {
  2115.             return ajax.click(a, extend({
  2116.                 clear: !0,
  2117.                 save: b
  2118.             }, Dialog), {
  2119.                 lock: !0
  2120.             })
  2121.         },
  2122.         save: function (a) {
  2123.             each(a, function (a, b) {
  2124.                 c[a] && b.last_msg == c[a].last_msg && delete b.messages;
  2125.                 mail.saveDialog(b, a)
  2126.             })
  2127.         },
  2128.         saveDialog: function (a, b) {
  2129.             c[b] || (c[b] = {});
  2130.             var d = c[b];
  2131.             extend(d, a);
  2132.             d.msgs && each(d.msgs, function (a, c) {
  2133.                 l[c] = b
  2134.             })
  2135.         },
  2136.         getPeerByMsg: function (a) {
  2137.             return l[a] || !1
  2138.         },
  2139.         cacheDialogsPage: function () {
  2140.             d = val("m");
  2141.             e = nav.cur
  2142.         },
  2143.         keyup: function (a, b, c) {
  2144.             var d = s || "";
  2145.             a = a.value || "";
  2146.             if (d.length != a.length || d != a) mail.myTyping(b, c), s = a
  2147.         },
  2148.         myTyping: function (a, b) {
  2149.             if (!(0 >= a)) {
  2150.                 var c = vkNow();
  2151.                 k[a] && 5E3 > c - k[a] || (k[a] = c, ajax.post("/mail", {
  2152.                     _ajax: 1,
  2153.                     act: "typing",
  2154.                     peer: a,
  2155.                     hash: b
  2156.                 }))
  2157.             }
  2158.         },
  2159.         typing: function (a, b) {
  2160.             b = b || a;
  2161.             2E9 < a ? (h[a] || (h[a] = {}), h[a][b] = vkNow()) : h[a] = vkNow();
  2162.             mail.updateTyping(a)
  2163.         },
  2164.         updateTyping: function (a) {
  2165.             var b = ge("dialog_near" + a),
  2166.                 c = geByClass1("write_to", b),
  2167.                 d = geByClass1("typing", b);
  2168.             if (b) {
  2169.                 var e = [],
  2170.                     f = vkNow();
  2171.                 if (2E9 < a) each(h[a] || {}, function (a, b) {
  2172.                     attr(d, "data-u" + a) && (b && 6E3 > f - b) && e.push(a)
  2173.                 });
  2174.                 else {
  2175.                     var g = h[a];
  2176.                     attr(d, "data-u" + a) && (g && 6E3 > f - g) && e.push(a)
  2177.                 }
  2178.                 if (e.length) {
  2179.                     if (1 == e.length) {
  2180.                         var j = e[0],
  2181.                             g = attr(d, "data-u" + j),
  2182.                             j = attr(d, "data-s" + j);
  2183.                         val(d, "<i></i>" + (lang.mobile_mail_typing[j] || "").replace("{user}", g))
  2184.                     } else each(e, function (a, b) {
  2185.                         e[a] = attr(d, "data-u" + b)
  2186.                     }), g = e.pop(), val(d, "<i></i>" + (lang.mobile_mail_multi_typing || "").replace("{users}", e.join(", ")).replace("{last_user}", g));
  2187.                     c.offsetWidth && style(d, "minWidth", c.offsetWidth);
  2188.                     addClass("is_typing", b);
  2189.                     setTimeout(function () {
  2190.                         addClass("animated", b)
  2191.                     }, 10);
  2192.                     setTimeout(function () {
  2193.                         mail.updateTyping(a)
  2194.                     }, 2E3)
  2195.                 } else val(d, ""), style(d, "minWidth", 0), removeClass("animated", b), removeClass("is_typing", b)
  2196.             }
  2197.         },
  2198.         updateOnline: function (a, d) {
  2199.             var e = ge("messages" + a);
  2200.             e && remove(geByClass1("activity", e));
  2201.             each(geByClass("_lv" + a, "mcont"), function (a, c) {
  2202.                 b(c, d)
  2203.             });
  2204.             c[a] && (c[a].write_form && (e = ce("div", {
  2205.                 innerHTML: c[a].write_form
  2206.             }), each(geByClass("_lv" + a, e), function (a, c) {
  2207.                 b(c, d)
  2208.             }), c[a].write_form = val(e)), c[a].messages && (e = ce("div", {
  2209.                 innerHTML: c[a].messages
  2210.             }), remove(geByClass1("activity", e)), c[a].messages = val(e)))
  2211.         },
  2212.         sendMarkAsRead: function (a, b) {
  2213.             isArray(b) || (b = [b]);
  2214.             var d = c[a];
  2215.             d && d.hash && ajax.post("/mail", {
  2216.                 _ajax: 1,
  2217.                 act: "mark_read",
  2218.                 peer: a,
  2219.                 msgs: b.join(","),
  2220.                 hash: d.hash
  2221.             }, {
  2222.                 onDone: function (c) {
  2223.                     c && each(b, function (b, c) {
  2224.                         mail.markAsRead(a, c)
  2225.                     })
  2226.                 }
  2227.             })
  2228.         },
  2229.         markAsRead: function (a, b) {
  2230.             var d = ge("messages" + a);
  2231.             if (d && (removeClass("new", geByClass1("_msg" + b, d)), (d = c[a]) && d.messages)) {
  2232.                 var e = ce("div", {
  2233.                     innerHTML: d.messages
  2234.                 });
  2235.                 removeClass("new", geByClass1("_msg" + b, e));
  2236.                 d.messages = val(e)
  2237.             }
  2238.         },
  2239.         markAsDeleted: function (a, b) {
  2240.             var d = ge("messages" + a);
  2241.             if (d && (remove(geByClass1("_msg" + b, d)), (d = c[a]) && d.messages)) {
  2242.                 var e = ce("div", {
  2243.                     innerHTML: d.messages
  2244.                 });
  2245.                 remove(geByClass1("_msg" + b, e));
  2246.                 d.messages = val(e)
  2247.             }
  2248.         },
  2249.         addMessage: function (a, b, d, e) {
  2250.             2E9 > a ? delete h[a] : h[a] && delete h[a][d];
  2251.             mail.updateTyping(a);
  2252.             if (!0 === e) ge("dialogs") && "/mail" == nav.path && (e = qs2obj(nav.params), !e.act && (!e.offset && !e.q) && ajax.click("/mail", extend({
  2253.                 no_scroll: !0
  2254.             }, Dialogs)));
  2255.             else if (a && b && (l[b] = a), !geByClass1("_msg" + b)) if ((d = c[a]) && d.messages) {
  2256.                 d.msgs && d.msgs.push(b);
  2257.                 var f = ce("div", {
  2258.                     innerHTML: d.messages
  2259.                 });
  2260.                 (b = geByClass1("activity", f)) ? (after(cdf(e), b), d.messages = val(f)) : d.messages = e + d.messages;
  2261.                 (a = ge("messages" + a)) && val(a, d.messages)
  2262.             } else if (a = ge("messages" + a))(b = geByClass1("activity", a)) ? after(cdf(e), b) : val(a, e + val(a))
  2263.         },
  2264.         getMsgHTML: function (a, b, d, e, f, g, h) {
  2265.             var j = b & 2 ? vk.id : h && h.from || d;
  2266.             if (!j) return !1;
  2267.             if (!ge("messages" + d)) return !0;
  2268.             if (h.attach1 || h.fwd || h.geo || h.emoji || !c[d] || !c[d].hash) return !1;
  2269.             h = "_u" + j;
  2270.             var k = geByClass1(h, "mcont", "a"),
  2271.                 j = stripTags(attr(k, "data-name") || val(k) || ""),
  2272.                 k = getHref(k),
  2273.                 l = geByClass1(h, "mcont", "img"),
  2274.                 l = l && l.src || "",
  2275.                 t = b & 32768;
  2276.             if (!j || !k || !l) return !1;
  2277.             d = intval(d);
  2278.             a = intval(a);
  2279.             f = f && -1 == f.toString().indexOf(" ... ") && 2E9 > d ? f : "";
  2280.             msg_class = b & 1 ? " new" : "";
  2281.             !(b & 2) && b & 1 && (msg_class += msg_class ? " _unread" : "");
  2282.             g = g.replace(/([a-zA-Z\-_\.0-9]+@[a-zA-Z\-_0-9]+\.[a-zA-Z\-_\.0-9]+[a-zA-Z\-_0-9]+)/g, function (a) {
  2283.                 return '<a href="/write?email=' + a + '">' + a + "</a>"
  2284.             });
  2285.             g = g.replace(/(https?:\/\/)?(([A-Za-z\u0410-\u042f\u0430-\u044f\u0401\u04510-9@][A-Za-z\u0410-\u042f\u0430-\u044f\u0401\u04510-9@\-\_\.]*[A-Za-z\u0410-\u042f\u0430-\u044f\u0401\u04510-9@])(\/([A-Za-z\u0410-\u042f\u0430-\u044f0-9@\-\_#%&?+\/\.=;:~]*[^\.\,;\(\)\?<\&\s:])?)?)/ig, function (a, b, c, d) {
  2286.                 b = b || "http://";
  2287.                 if (-1 == d.indexOf(".") || -1 != d.indexOf("..")) return a;
  2288.                 var e = d.split(".").pop();
  2289.                 if (5 < e.length || -1 == indexOf("info name aero arpa coop museum mobi travel xxx asia biz com net org gov mil edu int tel ac ad ae af ag ai al am an ao aq ar as at au aw ax az ba bb bd be bf bg bh bi bj bm bn bo br bs bt bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv cx cy cz de dj dk dm do dz ec ee eg eh er es et eu fi fj fk fm fo fr ga gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl pm pn pr ps pt pw py qa re ro ru rs rw sa sb sc sd se sg sh si sj sk sl sm sn so sr st su sv sy sz tc td tf tg th tj tk tl tm tn to tp tr tt tv tw tz ua ug uk um us uy uz va vc ve vg vi vn vu wf ws ye yt yu za zm zw \u0440\u0444 cat pro local".split(" "), e) || -1 != a.indexOf("@")) return a;
  2290.                 try {
  2291.                     a = decodeURIComponent(a)
  2292.                 } catch (f) {}
  2293.                 55 < a.length && (a = a.substr(0, 53) + "..");
  2294.                 a = htsc(a);
  2295.                 return !t && d.match(/^([a-zA-Z0-9\.\_\-]+\.)?(vkontakte\.ru|vk\.com|vkadre\.ru|vshtate\.ru|userapi\.com)$/) ? (c = replaceEntities(c).replace(/([^a-zA-Z0-9#%;_\-.\/?&=\[\]])/g, encodeURIComponent), '<a href="' + (b + c).replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + '">' + a + "</a>") : '<a href="/away?to=' + encodeURIComponent(b + replaceEntities(c)) + '" target="_blank">' + a + "</a>"
  2296.             });
  2297.             a = '<a name="msg' + a + '"></a><div class="msg _msg' + a + msg_class + '"><div class="i"><a class="al' + h + '" href="' + k + '"><img src="' + l + '" class="u ' + h + '" align="left"></a></div><div class="cont"><div class="ch"><a class="date" href="/mail?act=msg&amp;id=' + a + '">';
  2298.             b = new Date(1E3 * e);
  2299.             e = b.getHours();
  2300.             b = b.getMinutes();
  2301.             return a + (e + ":" + (10 > b ? "0" : "") + b) + '</a><a class="user al' + h + " " + h + '" href="' + k + '" data-name="' + escapeAttr(j) + '">' + j.split(" ").shift() + '</a></div><div class="cc">' + (f ? '<div class="title">' + f + "</div>" : "") + '<div class="text">' + g + '</div></div></div><div class="cb"></div></div>'
  2302.         },
  2303.         showDialog: function (a, b, d) {
  2304.             f = scrollTop();
  2305.             var e = c[b];
  2306.             if (e) {
  2307.                 var h = ce("div", {
  2308.                     innerHTML: val("m")
  2309.                 }),
  2310.                     p = geByClass1("btn back", geByClass1("mhead", h)),
  2311.                     j;
  2312.                 e.header && val(p, e.header);
  2313.                 (j = geByTag1("a", p)) && j.setAttribute("onclick", "return nav.go(this, event);");
  2314.                 val(geByClass1("pcont", geByClass1("mcont", h)), e.write_form + (b ? '<div id="messages' + b + '" class="messages">' + (e.messages || "") + '<div id="al_loading"></div></div>' : ""));
  2315.                 e.fv_link && (attr(geByClass1("fv_link", h), "href", e.fv_link), attr("lm_fv_link", "href", e.fv_link));
  2316.                 attr(geByClass1("app_link", h), "onclick", e.app_link ? "return nav.app_go(this, event, '" + escapeAttr(e.app_link) + "');" : !1);
  2317.                 val("m", h.innerHTML);
  2318.                 alLoadingFix();
  2319.                 g = b;
  2320.                 a = getHref(a);
  2321.                 nav.go(a, null, {
  2322.                     push_only: !0,
  2323.                     no_push: d
  2324.                 });
  2325.                 b ? (s = null, mail.updateTyping(b), ajax.click(a, extend({
  2326.                     save: b
  2327.                 }, Dialog), {
  2328.                     scroll: !0
  2329.                 })) : qsearch.init({
  2330.                     init_once: !0,
  2331.                     action: "/mail?act=write&fast=1",
  2332.                     container: geByClass1("peers", "mcont"),
  2333.                     field: ge("qsearch_fld"),
  2334.                     btn: ge("qsearch_btn"),
  2335.                     top_items: [],
  2336.                     _cache: {},
  2337.                     hl_fields: [2],
  2338.                     item_tpl: function (a, b, c, d, e) {
  2339.                         return 2E9 < this.id || -1 == this.id ? '<div class="member' + (-1 == this.id ? " null" : "") + '"><a href="' + (a || "") + '" class="tap">' + (b || "") + '<div class="cont"><span class="user">' + (c || "") + "</span>" + (d || "") + (e ? '<div class="status">' + e + "</div>" : "") + "</div></a></div>" : '<a href="' + (a || "") + '" class="inline_item_tap" onclick="return mail.showDialog(this, ' + (this.id || 0) + ');"><div class="inline_item">' + (b || "") + '<span class="user">' + (c || "") + "</span>" + (d || "") + "</div></a>"
  2340.                     },
  2341.                     null_tpl: function () {
  2342.                         return '<div class="m"><div class="null">' + lang.mobile_friends_no_friends + "</div></div>"
  2343.                     },
  2344.                     need_invalid_keys: browser.desktop,
  2345.                     onLoaded: function (a) {
  2346.                         for (var b in a) mail.saveDialog(a[b][a[b].length - 1], b)
  2347.                     }
  2348.                 });
  2349.                 scrollTop(0, 10)
  2350.             } else nav.al_go(e && e.cur_link || getHref(a) || nav.cur);
  2351.             return !1
  2352.         },
  2353.         backToDialogs: function (a) {
  2354.             if (d) nav.go(e, null, {
  2355.                 push_only: !0,
  2356.                 no_push: a
  2357.             }), ajax.click(e, extend({
  2358.                 no_scroll: !0
  2359.             }, Dialogs)), val("m", d), attr("lm_fv_link", "href", attr("fv_link", "href") || attr("fv_link", "data-href")), g = null, scrollTop(f || 0);
  2360.             else {
  2361.                 var b = e || "/mail";
  2362.                 nav.go(b, null, {
  2363.                     push_only: !0,
  2364.                     no_push: a
  2365.                 });
  2366.                 nav.al_go(b)
  2367.             }
  2368.         }
  2369.     }
  2370. }(),
  2371.     im = function () {
  2372.         function a() {
  2373.             64 > d && (d *= 2)
  2374.         }
  2375.         var b = null,
  2376.             c = {}, d = 1,
  2377.             e = null,
  2378.             f = !1,
  2379.             g = !1;
  2380.         return {
  2381.             init: function (a, c) {
  2382.                 b || (setDocumentDomain(), b = ce("iframe", {
  2383.                     src: a
  2384.                 }, {
  2385.                     display: "none"
  2386.                 }), onDOMReady(function () {
  2387.                     append(b, bodyNode)
  2388.                 }));
  2389.                 im.refreshParams(c);
  2390.                 setTimeout(im.check, 1E3)
  2391.             },
  2392.             on: function () {
  2393.                 clog("longpoll start");
  2394.                 f = !0;
  2395.                 setTimeout(im.check, 1E3)
  2396.             },
  2397.             off: function () {
  2398.                 clog("longpoll pause");
  2399.                 f = !1
  2400.             },
  2401.             refreshParams: function (a) {
  2402.                 extend(c, a || {});
  2403.                 extend(im, c)
  2404.             },
  2405.             getKey: function () {
  2406.                 if (e) try {
  2407.                     e.abort()
  2408.                 } catch (b) {}
  2409.                 e = ajax.post("/mail", {
  2410.                     _ajax: 1,
  2411.                     act: "im_get_key"
  2412.                 }, {
  2413.                     onDone: function (a) {
  2414.                         /[0-9a-f]{40}/i.test(a) ? (im.refreshParams({
  2415.                             key: a
  2416.                         }), im.check()) : clog("invalid key")
  2417.                     },
  2418.                     onFail: function () {
  2419.                         setTimeout(im.getKey, 1E3 * d);
  2420.                         clog("from getKey delaying getKey for " + d + "secs");
  2421.                         a()
  2422.                     }
  2423.                 })
  2424.             },
  2425.             check: function () {
  2426.                 if (f && !g) {
  2427.                     im.makeRequest || setTimeout(im.check, 1E3);
  2428.                     try {
  2429.                         im.makeRequest(function (b, c) {
  2430.                             g = !1;
  2431.                             if (vk.__debug) {
  2432.                                 var e = im.checked(parseJSON(c));
  2433.                                 clog("success", e);
  2434.                                 e && (im.check(), d = 1)
  2435.                             } else try {
  2436.                                 e = im.checked(parseJSON(c)), clog("success", e), e && (im.check(), d = 1)
  2437.                             } catch (f) {
  2438.                                 try {
  2439.                                     clog("error", f.message || "no message", f.type || "no type", f.stack || "no stack")
  2440.                                 } catch (j) {}
  2441.                                 setTimeout(im.check, 1E3 * d);
  2442.                                 a()
  2443.                             }
  2444.                         }, function () {
  2445.                             g = !1;
  2446.                             setTimeout(im.check, 1E3 * d);
  2447.                             a()
  2448.                         }), g = !0
  2449.                     } catch (b) {
  2450.                         clog("makeRequest failed")
  2451.                     }
  2452.                 }
  2453.             },
  2454.             checked: function (b) {
  2455.                 var e = b.failed;
  2456.                 if (1 == e || c.ts >= b.ts + 256) {
  2457.                     if (im.refreshParams({
  2458.                         ts: b.ts
  2459.                     }), e) return !0
  2460.                 } else {
  2461.                     if (2 == e) return clog("delaying getKey for " + d + "secs"), setTimeout(im.getKey, 1E3 * d), a(), !1;
  2462.                     if (e) {
  2463.                         clog(b);
  2464.                         return
  2465.                     }
  2466.                 }
  2467.                 clog("ts", b.ts, c.ts);
  2468.                 im.refreshParams({
  2469.                     ts: b.ts
  2470.                 });
  2471.                 if (b.updates) {
  2472.                     var e = [],
  2473.                         f = [],
  2474.                         g;
  2475.                     for (g in b.updates) {
  2476.                         var s = b.updates[g],
  2477.                             r = intval(s[0]),
  2478.                             n = intval(s[1]),
  2479.                             m = intval(s[2]),
  2480.                             u = intval(s[3]);
  2481.                         clog(s);
  2482.                         51 != r && (61 == r ? mail.typing(n) : 62 == r ? mail.typing(2E9 + m, n) : 8 == r ? e.push(-n) : 9 == r ? mail.updateOnline(-n, 0) : u && (4 == r ? (r = m & 2 ? vk.id : s[7] && s[7].from || u, (s = mail.getMsgHTML(n, m, u, s[4], s[5], s[6], s[7])) ? (mail.addMessage(u, n, r, s), m & 2 || (n = getNotify() + 1, setNotify(n), window.al && window.al.menu && (m = Array(al.menu.length), m[2] = n, menu.refreshCounters(m)))) : f.push({
  2483.                             peer: u,
  2484.                             msg_id: n,
  2485.                             from_id: r
  2486.                         })) : 0 == r ? mail.markAsDeleted(n) : 2 == r ? m & 128 && mail.markAsDeleted(u, n) : 3 == r && m & 1 && mail.markAsRead(u, n)))
  2487.                     }
  2488.                     e.length && ajax.post("/mail", {
  2489.                         _ajax: 1,
  2490.                         act: "get_onlines",
  2491.                         uids: e.join(",")
  2492.                     }, {
  2493.                         onDone: function (a) {
  2494.                             each(a, function (a, b) {
  2495.                                 mail.updateOnline(a, b)
  2496.                             })
  2497.                         }
  2498.                     });
  2499.                     if (f.length) {
  2500.                         var x = [];
  2501.                         each(f, function (a, b) {
  2502.                             x.push(b.msg_id)
  2503.                         });
  2504.                         ajax.post("/mail", {
  2505.                             _ajax: 1,
  2506.                             act: "get_messages",
  2507.                             msgs: x.join(",")
  2508.                         }, {
  2509.                             onDone: function (a) {
  2510.                                 each(f, function (b, c) {
  2511.                                     a[c.msg_id] && mail.addMessage(c.peer, c.msg_id, c.from_id, a[c.msg_id])
  2512.                                 })
  2513.                             }
  2514.                         })
  2515.                     }
  2516.                 }
  2517.                 return !0
  2518.             }
  2519.         }
  2520.     }(),
  2521.     geoloc = function () {
  2522.         function a(a, b) {
  2523.             var c = ge("medias_map"),
  2524.                 d = ge("attached_wrap");
  2525.             c || (c = ce("div", {
  2526.                 id: "medias_map",
  2527.                 className: "medias"
  2528.             }), d.appendChild(c));
  2529.             var d = a.latitude,
  2530.                 e = a.longitude,
  2531.                 k = geByClass1("row map", c),
  2532.                 s = b ? '<div class="close"><i>&nbsp;</i></div><div class="label">' + b + "</div>" : "";
  2533.             map_field = '<input type="hidden" name="map" value="' + (d + "_" + e + "_0") + '">';
  2534.             k ? val(k, s + "" + map_field) : val(c, '<div class="row map" onclick="geoloc.remove();">' + s + "" + map_field + "</div>");
  2535.             show(c)
  2536.         }
  2537.         function b(b) {
  2538.             if (b && b.coords) {
  2539.                 var e = d = {
  2540.                     latitude: +b.coords.latitude || 0,
  2541.                     longitude: +b.coords.longitude || 0
  2542.                 };
  2543.                 ajax.post("/places.php", {
  2544.                     _ajax: 1,
  2545.                     act: "map_label",
  2546.                     lat: e.latitude,
  2547.                     lng: e.longitude
  2548.                 }, {
  2549.                     onDone: function (b) {
  2550.                         hide("geo_waiting");
  2551.                         a(e, b)
  2552.                     },
  2553.                     onFail: c
  2554.                 })
  2555.             }
  2556.         }
  2557.         function c() {
  2558.             geoloc.remove();
  2559.             hide("geo_waiting")
  2560.         }
  2561.         var d = null,
  2562.             e = !1;
  2563.         return {
  2564.             toggle: function () {
  2565.                 e ? geoloc.remove() : geoloc.add()
  2566.             },
  2567.             add: function (f) {
  2568.                 if (f || !e) e = !0, addClass("sel", "geo_btn"), f && (f.latitude || f.longitude) ? (d = {
  2569.                     latitude: +f.latitude || 0,
  2570.                     longitude: +f.longitude || 0
  2571.                 }, a(d, f.label)) : (geo.getCurrentPosition(b, c), show("geo_waiting"))
  2572.             },
  2573.             remove: function () {
  2574.                 e && (e = !1, removeClass("sel", "geo_btn"), d = null, remove("medias_map"))
  2575.             },
  2576.             init: function (a) {
  2577.                 a && geoloc.add(a);
  2578.                 return geo.init()
  2579.             }
  2580.         }
  2581.     }(),
  2582.     checkin = function () {
  2583.         function a(a, b) {
  2584.             ajax.post("/places.php", {
  2585.                 _ajax: 1,
  2586.                 act: "search",
  2587.                 lat: a.latitude,
  2588.                 lng: a.longitude
  2589.             }, {
  2590.                 onDone: function (d, e, f) {
  2591.                     hide("geo_waiting");
  2592.                     r = d || {};
  2593.                     n = e || [];
  2594.                     m = f || 0;
  2595.                     if (u) return c();
  2596.                     if (!b) {
  2597.                         if (e.length) return c();
  2598.                         g(a)
  2599.                     }
  2600.                 },
  2601.                 onFail: function () {
  2602.                     checkin.remove();
  2603.                     hide("geo_waiting")
  2604.                 }
  2605.             })
  2606.         }
  2607.         function b(a) {
  2608.             s = !1;
  2609.             var b = ge("medias_map"),
  2610.                 c = ge("attached_wrap");
  2611.             b || (b = ce("div", {
  2612.                 id: "medias_map",
  2613.                 className: "medias"
  2614.             }), c.appendChild(b));
  2615.             var c = +a[1] || 0,
  2616.                 d = a[3] || "",
  2617.                 e = a[4] || "",
  2618.                 f = a[5] || "";
  2619.             a = (+a[6].lat || 0) + "_" + (+a[6].lng || 0);
  2620.             var v = geByClass1("row link checkin", b),
  2621.                 d = '<div class="close" onclick="checkin.remove();"><i>&nbsp;</i></div><div class="label" onclick="checkin.changePlace();">' + d + (f ? ", " + f : e ? ", " + e : "") + "</div>";
  2622.             checkin_field = '<input type="hidden" name="place_id" value="' + c + '"><input type="hidden" name="place" value="' + a + '">';
  2623.             v ? val(v, d + checkin_field) : (d = '<div class="row map">' + d + checkin_field + "</div>", val(b, d));
  2624.             addClass("sel", "geo_btn");
  2625.             k = !0;
  2626.             show(b)
  2627.         }
  2628.         function c(a) {
  2629.             u || (u = val("m"));
  2630.             var b = ce("div", {
  2631.                 innerHTML: u
  2632.             });
  2633.             val(geByClass1("btn back", b), '<a class="b" onclick="checkin.back(); return false;"><i>&nbsp;</i><div class="title"><h1>' + lang.mobile_geo_head_title + "</h1></div></a>");
  2634.             var c = Math.min(604, getCw()) || 0,
  2635.                 d = Math.ceil(c / 2) || 0,
  2636.                 e = h.latitude,
  2637.                 f = h.longitude,
  2638.                 v = 1.5 <= window.devicePixelRatio ? "/images/x_map_point.png" : "/images/map_point.png",
  2639.                 g = 1.5 <= window.devicePixelRatio ? 2 : 1,
  2640.                 c = !hasClass("ioff", bodyNode) ? '<div style="background: url(//maps.googleapis.com/maps/api/staticmap?center=' + e + "," + f + "&amp;zoom=14&amp;size=" + c + "x" + d + "&amp;scale=" + g + "&amp;sensor=true&amp;language=ru) #fff no-repeat center; background-size: " + c + "px " + d + 'px;"><div class="img" style="width: 100%; height: ' + d + "px; background: url(" + v + ') no-repeat center; background-size: 180px 70px;"></div></div>' : "";
  2641.             val(geByClass1("pcont", geByClass1("mcont", b)), '<div class="checkin_map" onclick="checkin.refreshCurrentPosition();">' + c + '</div><div id="places_box"><div class="panel"><form class="oneline qsearch" onsubmit="qsearch.go(event); return false;"><table><tr><td width="100%"><div class="iwrap"><input id="qsearch_fld" type="text" class="text" name="q" value="" placeholder="' + lang.mobile_geo_places_placeholder + '"></div></td><td class="last"><input id="qsearch_btn" type="submit" class="btn" value="' + lang.mobile_search_btn + '" onclick="return qsearch.go(event);"></td></tr></tbody></table></form></div><div class="items blt_cont"></div></div><div id="place_add_box" style="display:none;"></div>');
  2642.             val("m", b.innerHTML);
  2643.             scrollTop(0);
  2644.             nav.go(nav.path + (nav.params ? "?" + nav.params : "") + "#select_place", null, {
  2645.                 push_only: !0,
  2646.                 no_push: a
  2647.             });
  2648.             a = "/places.php?act=search&lat=" + e + "&lng=" + f;
  2649.             qsearch.init({
  2650.                 action: a,
  2651.                 al_action: a,
  2652.                 container: geByClass1("items", "mcont"),
  2653.                 field: ge("qsearch_fld"),
  2654.                 btn: ge("qsearch_btn"),
  2655.                 top_items: n || [],
  2656.                 _cache: r || {},
  2657.                 hl_fields: [2, 3],
  2658.                 tpl: function (a, b) {
  2659.                     var c = b ? lang.mobile_geo_place_add_link.replace("%s", htsc(b)) : lang.mobile_geo_place_add_item,
  2660.                         d = escapeAttr(b || ""),
  2661.                         e = escapeAttr(checkin.getCurrentAddress());
  2662.                     return a + '<div class="member new_place"><a class="tap" onclick="checkin.addPlaceShow(\'' + d + "', '" + e + "'); return false;\">" + (a ? '<div class="i"></div>' : "") + '<div class="cont"><span class="user">' + c + "</span>" + (e ? '<div class="info">' + e + "</div>" : "") + "</div></a></div>"
  2663.                 },
  2664.                 item_tpl: function (a, b, c, d) {
  2665.                     return '<div class="member place"><a class="tap" onclick="return checkin.selectPlace(this, ' + (this.id || 0) + ');">' + (b || "") + '<div class="cont"><span class="user">' + (c || "") + "</span>" + (d ? '<div class="info">' + d + "</div>" : "") + "</div></a></div>"
  2666.                 },
  2667.                 null_tpl: function () {
  2668.                     return ""
  2669.                 },
  2670.                 top_len: 10,
  2671.                 need_invalid_keys: browser.desktop,
  2672.                 load_limit: m,
  2673.                 onLoaded: function (a) {
  2674.                     extend(r, a)
  2675.                 },
  2676.                 al_need: !0
  2677.             });
  2678.             return !1
  2679.         }
  2680.         function d() {
  2681.             val("place_add_box", "");
  2682.             hide("place_add_box");
  2683.             show("places_box")
  2684.         }
  2685.         function e(a, c) {
  2686.             f();
  2687.             var d = r[c];
  2688.             d && (h = {
  2689.                 latitude: +d[6].lat || 0,
  2690.                 longitude: +d[6].lng || 0
  2691.             }, c ? b(d) : g(h, d))
  2692.         }
  2693.         function f(a) {
  2694.             if (!u) return !0;
  2695.             val("m", u);
  2696.             u = null;
  2697.             scrollToEl(geByClass1("post_add", geByClass1("wall_edit")));
  2698.             nav.go(nav.path + (nav.params ? "?" + nav.params : ""), null, {
  2699.                 push_only: !0,
  2700.                 no_push: a
  2701.             });
  2702.             return !1
  2703.         }
  2704.         function g(a, b) {
  2705.             s = !0;
  2706.             var c = ge("medias_map"),
  2707.                 d = ge("attached_wrap");
  2708.             c || (c = ce("div", {
  2709.                 id: "medias_map",
  2710.                 className: "medias"
  2711.             }), d.appendChild(c));
  2712.             var d = a.latitude,
  2713.                 e = a.longitude,
  2714.                 f = b && b[4] || !1,
  2715.                 v = geByClass1("row map", c),
  2716.                 f = f ? '<div class="close" onclick="checkin.remove();"><i>&nbsp;</i></div><div class="label" onclick="checkin.changePlace();">' + f + "</div>" : "";
  2717.             map_field = '<input type="hidden" name="map" value="' + (d + "_" + e + "_0") + '">';
  2718.             v ? val(v, f + "" + map_field) : val(c, '<div class="row map">' + f + "" + map_field + "</div>");
  2719.             k = !0;
  2720.             addClass("sel", "geo_btn");
  2721.             show(c)
  2722.         }
  2723.         function j(b) {
  2724.             b && b.coords && (h = {
  2725.                 latitude: +b.coords.latitude || 0,
  2726.                 longitude: +b.coords.longitude || 0
  2727.             }, a(h))
  2728.         }
  2729.         function l() {
  2730.             checkin.remove();
  2731.             hide("geo_waiting")
  2732.         }
  2733.         var h = null,
  2734.             k = !1,
  2735.             s = !1,
  2736.             r = {}, n = [],
  2737.             m = 0,
  2738.             u = null,
  2739.             x = "";
  2740.         return {
  2741.             toggle: function () {
  2742.                 k ? checkin.remove() : checkin.add()
  2743.             },
  2744.             addNewPlace: function () {
  2745.                 var a = val("place_name_fld"),
  2746.                     b = val("place_address_fld");
  2747.                 if (!a) return elfocus("place_name_fld"), !1;
  2748.                 lockButton("place_add_btn");
  2749.                 ajax.post("/places.php", {
  2750.                     _ajax: 1,
  2751.                     act: "add_place",
  2752.                     latitude: h.latitude,
  2753.                     longitude: h.longitude,
  2754.                     title: a,
  2755.                     address: b,
  2756.                     hash: x
  2757.                 }, {
  2758.                     onDone: function (a, b) {
  2759.                         unlockButton("place_add_btn");
  2760.                         if (a) {
  2761.                             var c = {};
  2762.                             c[a] = b;
  2763.                             extend(r, c);
  2764.                             n.splice(n[0] ? 0 : 1, 0, a);
  2765.                             d();
  2766.                             e(null, a)
  2767.                         }
  2768.                     },
  2769.                     onFail: function () {
  2770.                         unlockButton("place_add_btn");
  2771.                         var a = Array.prototype.slice.call(arguments).shift(),
  2772.                             b = ge("place_add_form");
  2773.                         switch (a) {
  2774.                             case 2:
  2775.                                 b && b.submit()
  2776.                         }
  2777.                     }
  2778.                 });
  2779.                 return !1
  2780.             },
  2781.             addPlaceShow: function (a, b) {
  2782.                 var c = "/places.php" + obj2qs({
  2783.                     act: "add_place",
  2784.                     latitude: h.latitude,
  2785.                     longitude: h.longitude,
  2786.                     hash: x
  2787.                 });
  2788.                 val("place_add_box", "<h4>" + lang.mobile_geo_new_place_header + '</h4><form id="place_add_form" action="' + c + '" method="post" class="place_add_box"><div class="cont"><dl><dt>' + lang.mobile_geo_place_name_label + '</dt><dd class="iwrap"><input type="text" class="text" id="place_name_fld" name="title" /></dd></dl><dl><dt>' + lang.mobile_geo_place_address_label + '</dt><dd class="iwrap"><input type="text" class="text" id="place_address_fld" name="address" /></dd></dl><div class="near_box"><input class="btn" type="submit" id="place_add_btn" value="' + lang.mobile_geo_place_add_btn + '" onclick="return checkin.addNewPlace(this);" /><div class="near_btn"><a onclick="checkin.addPlaceCancel(); return false;">' + lang.mobile_cancel + "</a></div></div></div></form>");
  2789.                 val("place_name_fld", a || "");
  2790.                 val("place_address_fld", b || "");
  2791.                 hide("places_box");
  2792.                 show("place_add_box");
  2793.                 a ? elfocus("place_address_fld") : elfocus("place_name_fld")
  2794.             },
  2795.             addPlaceCancel: d,
  2796.             selectPlace: e,
  2797.             changePlace: c,
  2798.             back: f,
  2799.             refreshCurrentPosition: function () {
  2800.                 geo.getCurrentPosition(j, l)
  2801.             },
  2802.             getCurrentAddress: function () {
  2803.                 return r[0] && r[0][5] || ""
  2804.             },
  2805.             add: function (d) {
  2806.                 if (!d && k) return c();
  2807.                 d && (d.latitude || d.longitude) && d.place ? (h = {
  2808.                     latitude: +d.latitude || 0,
  2809.                     longitude: +d.longitude || 0
  2810.                 }, d.place[1] ? b(d.place) : g(h, d.place), a(h, !0)) : (geo.getCurrentPosition(j, l), show("geo_waiting"))
  2811.             },
  2812.             remove: function () {
  2813.                 k = !1;
  2814.                 removeClass("sel", "geo_btn");
  2815.                 h = null;
  2816.                 r = {};
  2817.                 n = [];
  2818.                 m = 0;
  2819.                 remove("medias_map")
  2820.             },
  2821.             stash: function (a) {
  2822.                 if (a) h = a[0], k = a[1], s = a[2], r = a[3], n = a[4], m = a[5], u = a[6];
  2823.                 else return [h, k, s, r, n, m, u]
  2824.             },
  2825.             init: function (a, b) {
  2826.                 h = null;
  2827.                 s = k = !1;
  2828.                 r = {};
  2829.                 n = [];
  2830.                 m = 0;
  2831.                 u = null;
  2832.                 x = b || "";
  2833.                 a && checkin.add(a);
  2834.                 return geo.init()
  2835.             }
  2836.         }
  2837.     }();
  2838.  
  2839. function QuickSearch(a) {
  2840.     function b(a) {
  2841.         a = a.replace(/https?:\/\/(m\.)?vk\.com\/([^#]+#\/)?/, "");
  2842.         var b, c, d = F;
  2843.         a = [a, b = parseRusKeys(a, d) || a, c = parseLatKeys(a, d) || a, parseLat(b), parseCyr(c)];
  2844.         c = {};
  2845.         for (var d = [], e = 0, f = a.length; e < f; e++) a[e] && !c[a[e]] && (c[a[e]] = !0, b = escapeRE(a[e]), b = b.replace(/[\u0435\u0451]/gi, "[\u0435\u0451]").replace(/(e|yo)/gi, "(?:e|yo)"), d.push(RegExp("(^|\\s|\\(|>)(" + b + ")", "gi")));
  2846.         return d
  2847.     }
  2848.     function c(a, v, g) {
  2849.         clearTimeout(z);
  2850.         if (!g) return z = setTimeout(function () {
  2851.             c(a, v, !0)
  2852.         }, 10), !1;
  2853.         g = val(a) || "";
  2854.         if (q == g) return !1;
  2855.         var h = "_" + g,
  2856.             w = m[h],
  2857.             C = b(g),
  2858.             j;
  2859.         if (!w && 2 < g.length && m["_" + g.slice(0, -2)]) {
  2860.             var k = "_" + g.slice(0, -2);
  2861.             if (m[k] && (x[k] && !m[k].length) && (!K || K && !u[k])) x[h] = !0, w = m[h] = [], K && (u[h] = "")
  2862.         }
  2863.         if (w) clog("`" + g + "`: from cache");
  2864.         else {
  2865.             w = [];
  2866.             k = 0;
  2867.             if (!g && r.length) for (var t = B, l = B + Math.min(E, r.length); t < l; t++) w.push([r[t]]), k++;
  2868.             else {
  2869.                 for (var L = {}, p = 0, t = 0, l = r.length; t < l; t++) {
  2870.                     var D = r[t];
  2871.                     if (n[D]) {
  2872.                         L[D] = !0;
  2873.                         if (j = e(C, n[D][0])) if (w.push([D, j]), ++p >= M) break;
  2874.                         k++
  2875.                     }
  2876.                 }
  2877.                 if (p < M) for (D in n) if (!L[D] && (j = e(C, n[D][0]))) {
  2878.                     w.push([D, j]);
  2879.                     if (++p >= M) break;
  2880.                     k++
  2881.                 }
  2882.             }
  2883.             clog("`" + g + "`: analyse " + k + " peers, " + w.length + " found");
  2884.             x[h] = x[h] || !g && r.length || w.length > 2 * E;
  2885.             x[h] = x[h] || K && w.length > E
  2886.         }
  2887.         if (!x[h] && (G || K)) clog("`" + g + "`: need load"), d(a, g);
  2888.         m[h] = w;
  2889.         q = g;
  2890.         f(w, u[h]);
  2891.         R && R(g);
  2892.         H && !q && (I = E);
  2893.         return !1
  2894.     }
  2895.     function d(a, c, v) {
  2896.         clearTimeout(A);
  2897.         if (!v) return A = setTimeout(function () {
  2898.             d(a, c, !0)
  2899.         }, 200), !1;
  2900.         ajax.post(g, {
  2901.             _ajax: 1,
  2902.             q: c
  2903.         }, {
  2904.             onDone: function (d, v, g) {
  2905.                 L && L.apply(null, arguments);
  2906.                 for (var h = "_" + c, w = m[h] || [], C = {}, j = b(c), k, t = 0, l = w.length; t < l; t++) C[w[t][0]] = !0;
  2907.                 t = 0;
  2908.                 for (l = v.length; t < l; t++) {
  2909.                     var D = v[t];
  2910.                     C[D] || ((k = e(j, d[D][0])) || J || !c) && w.push([D, k])
  2911.                 }
  2912.                 clog("`" + c + "`: loaded. now " + w.length + " peers");
  2913.                 x[h] = !0;
  2914.                 m[h] = w;
  2915.                 K && (u[h] = g || "");
  2916.                 n = extend(d, n);
  2917.                 G = !y || len(n) < y;
  2918.                 q == c ? f(w, u[h]) : delete m[h];
  2919.                 removeClass("loading", a)
  2920.             },
  2921.             onFail: function () {
  2922.                 delete m["_" + c];
  2923.                 removeClass("loading", a)
  2924.             }
  2925.         });
  2926.         geByClass1("al_loading", l) || addClass("loading", a)
  2927.     }
  2928.     function e(a, b) {
  2929.         if (!b) return !1;
  2930.         for (var c = 0, d = a.length; c < d; c++) if (-1 !== b.search(a[c])) return a[c];
  2931.         return !1
  2932.     }
  2933.     function f(a, b) {
  2934.         var c = "";
  2935.         if (C && l) {
  2936.             for (var d = 0, e = a.length; d < e; d++) {
  2937.                 var f = a[d][0],
  2938.                     g = a[d][1];
  2939.                 if (n[f]) {
  2940.                     var j = n[f].slice(1);
  2941.                     if (g) for (var k in t) {
  2942.                         var m = t[k];
  2943.                         j[m] && (j[m] = j[m].replace(g, "$1<em>$2</em>"))
  2944.                     }
  2945.                     c += C.apply({
  2946.                         id: f,
  2947.                         q: q,
  2948.                         highlight: function (a) {
  2949.                             return (a || "").replace(g, "$1<em>$2</em>")
  2950.                         }
  2951.                     }, j)
  2952.                 }
  2953.             }
  2954.             if (!c && !x["_" + q] && (G || K)) removeClass("loading", h), c = q ? '<div class="al_loading qs_loading">&nbsp;</div>' : '<div id="al_loading"></div>';
  2955.             !c && w && (c = w(q));
  2956.             clog("rendered");
  2957.             val(l, v ? v(c, q, H, b) : c + (b || ""));
  2958.             s && (q ? show(s) : hide(s));
  2959.             !q && alLoadingFix();
  2960.             D && D()
  2961.         }
  2962.     }
  2963.     var g, j, l, h, k, s, r = [],
  2964.         n = {}, m = {}, u = {}, x = {}, p = !1,
  2965.         q = null,
  2966.         z = null,
  2967.         A = null,
  2968.         B = 0,
  2969.         t = [],
  2970.         v = null,
  2971.         C = null,
  2972.         w = null,
  2973.         J = !1,
  2974.         F = !1,
  2975.         E = 10,
  2976.         M = 30,
  2977.         G = !0,
  2978.         y = !1,
  2979.         H = !1,
  2980.         K = !1,
  2981.         L, R, D, P, I = 0,
  2982.         N = 0,
  2983.         Q = !1;
  2984.     extend(this, {
  2985.         go: function (a) {
  2986.             if (!h) return !0;
  2987.             c(h, a, !0);
  2988.             h.blur();
  2989.             cancelEvent(a);
  2990.             return !1
  2991.         },
  2992.         redraw: function () {
  2993.             var a = "_" + q;
  2994.             f(m[a], u[a])
  2995.         },
  2996.         clear: function (a, b) {
  2997.             val(h, "");
  2998.             b ? elfocus(h) : elblur(h);
  2999.             c(h, a, !0);
  3000.             cancelEvent(a);
  3001.             return !1
  3002.         },
  3003.         blur: function () {
  3004.             elblur(h)
  3005.         },
  3006.         init: function (a) {
  3007.             clog(a);
  3008.             a = a || {};
  3009.             l = ge(a.container) || null;
  3010.             h = ge(a.field) || null;
  3011.             k = ge(a.btn) || null;
  3012.             s = ge(a.clear_btn) || null;
  3013.             q = null;
  3014.             if (!p || g != a.action || !a.init_once) m = {}, u = {}, x = {}, g = a.action || "", j = a.al_action || g, r = a.top_items || [], n = a._cache || {}, t = a.hl_fields || [], v = a.tpl || null, C = a.item_tpl || null, w = a.null_tpl || null, J = a.soft_filter || !1, F = a.need_invalid_keys || !1, E = a.top_len || 10, y = a.load_limit || !1, L = a.onLoaded || !1, R = a.onFiltered || !1, D = a.onRendered || !1, P = a.onFocusChanged || !1, H = a.al_need || !1, B = !H && a.init_offset || 0, K = a.global_search || !1;
  3015.             var b = null;
  3016.             if (g && l && h && C) {
  3017.                 G = !0 !== g && (!y || len(n) < y);
  3018.                 addEvent(h, "focus", function (a) {
  3019.                     var d = function (e) {
  3020.                         !e && c(h, a, !0);
  3021.                         b = setTimeout(d, 100)
  3022.                     };
  3023.                     clearTimeout(b);
  3024.                     P && P.call({
  3025.                         q: q
  3026.                     }, !0);
  3027.                     d(!0)
  3028.                 });
  3029.                 addEvent(h, "keydown keypress change blur", function (a) {
  3030.                     "blur" == a.type && (clearTimeout(b), P && P.call({
  3031.                         q: q
  3032.                     }, !1));
  3033.                     c(h, a, "keydown" != a.type && "keypress" != a.type)
  3034.                 });
  3035.                 a._new || k && !attr(k, "onclick") && attr(k, "onclick", "return qsearch.go(event);");
  3036.                 if (H && (!p || !a.init_once)) I = E, N = len(n), initAutoScroll(function () {
  3037.                     var a = l.childNodes;
  3038.                     return a[I] || a[a.length - 1]
  3039.                 }, function () {
  3040.                     if (!Q && !q) if (I + E > N && G) Q = !0, ajax.post(j, {
  3041.                         _ajax: 1,
  3042.                         offset: N
  3043.                     }, {
  3044.                         onDone: function (a, b) {
  3045.                             L && L.apply(null, arguments);
  3046.                             var c = len(a);
  3047.                             Q = !1;
  3048.                             y || (r = r.slice(0, N).concat(b));
  3049.                             N += c;
  3050.                             n = extend(a, n);
  3051.                             G = !0 !== g && (!y && c || len(n) < y);
  3052.                             if (!q) {
  3053.                                 I += E;
  3054.                                 for (var c = [], d = 0, e = Math.min(I, r.length); d < e; d++) c.push([r[d]]);
  3055.                                 clog("scroll loaded. show " + c.length + " peers");
  3056.                                 f(c, u._)
  3057.                             }
  3058.                         },
  3059.                         onFail: function () {
  3060.                             Q = !1
  3061.                         }
  3062.                     });
  3063.                     else if (I < r.length) {
  3064.                         I += E;
  3065.                         for (var a = [], b = 0, c = Math.min(I, r.length); b < c; b++) a.push([r[b]]);
  3066.                         clog("scroll from cache. show " + a.length + " peers");
  3067.                         f(a, u._)
  3068.                     }
  3069.                 });
  3070.                 !a.skip_init_filter && c(h, null, !0);
  3071.                 p = !0
  3072.             }
  3073.         }
  3074.     });
  3075.     a && this.init(a)
  3076. }
  3077. var qsearch = new QuickSearch,
  3078.     photo = function () {
  3079.         function a() {
  3080.             h = geByClass1("photoview");
  3081.             if (!h) return nav.al_go(nav.cur), !1;
  3082.             k = geByClass1("summary", h);
  3083.             pm = geByClass1("photo_msg", h);
  3084.             pt = geByClass1("tag_info_wrap", h);
  3085.             n = geByClass1("photo_wrap", h);
  3086.             m = geByClass1("pv", n);
  3087.             r = geByClass1("nav", n);
  3088.             u = geByTag1("a", m);
  3089.             x = geByTag1("img", m);
  3090.             p = geByClass1("desc", h);
  3091.             q = geByClass1("actions", h);
  3092.             z = geByClass1("comments_wrap", h);
  3093.             if (!(s = geByClass1("loading", k))) s = ce("div", {
  3094.                 innerHTML: "<i></i>",
  3095.                 className: "loading"
  3096.             }, {
  3097.                 display: "none"
  3098.             }), k.appendChild(s);
  3099.             if (r) {
  3100.                 var a = geByTag("a", r);
  3101.                 A = a[0];
  3102.                 B = a[1];
  3103.                 A && A.setAttribute("onclick", "return photo.prev(event);");
  3104.                 B && B.setAttribute("onclick", "return photo.next(event);");
  3105.                 u && u.setAttribute("onclick", "return photo.next(event);");
  3106.                 ajax.prepare_click([A, B, u])
  3107.             }
  3108.             removeEvent(window, "orientationchange", f);
  3109.             addEvent(window, "orientationchange", f);
  3110.             return !0
  3111.         }
  3112.         function b(a) {
  3113.             var b = [];
  3114.             each(a, function (a, c) {
  3115.                 if (!c) return !0;
  3116.                 b.push(t[c.id] = c)
  3117.             });
  3118.             return b
  3119.         }
  3120.         function c(a) {
  3121.             return t[a] || {}
  3122.         }
  3123.         function d(a, c, d) {
  3124.             null === c ? delete v[a] : (v[a] || (v[a] = Array(d ? d : d(c))), b(c), a = v[a], F && a.reverse(), extend(a, c), F && (w = copy(a), a.reverse()))
  3125.         }
  3126.         function e(a) {
  3127.             if ("string" !== typeof a) return a;
  3128.             a = v[a] || [];
  3129.             return F ? copy(a).reverse() : a
  3130.         }
  3131.         function f() {
  3132.             nav.hash || onDOMReady(function () {
  3133.                 if (geByClass1("photoview")) {
  3134.                     var a = scrollTop();
  3135.                     n && getY(n) < a && scrollToEl(n)
  3136.                 }
  3137.             })
  3138.         }
  3139.         function g(a, b, c) {
  3140.             var e = w[a],
  3141.                 v = 1 == w.length;
  3142.             if (e) {
  3143.                 f();
  3144.                 var t = {};
  3145.                 E && (t.list = E);
  3146.                 F && (t.rev = 1);
  3147.                 M && (t.from = M);
  3148.                 var m = obj2qs(t),
  3149.                     t = "photo" + e.id + m,
  3150.                     n = e.photo,
  3151.                     r = (j(a - 1) || {}).id;
  3152.                 a = (j(a + 1) || {}).id;
  3153.                 v || (u.href = "/photo" + a + m, A.href = "/photo" + r + m, B.href = "/photo" + a + m, ajax.prepare_click([A, B, u]));
  3154.                 x && x.src != n && (x.onload = null, remove(x), x = ce("img", {
  3155.                     src: n,
  3156.                     alt: ""
  3157.                 }), append(x, u));
  3158.                 toggleClass("photo_deleted", h, !! e.deleted);
  3159.                 val(geByTag1("span", k), y + 1);
  3160.                 val(pm, e.deleted || "");
  3161.                 val(pt, e.tag_info || "");
  3162.                 v = "";
  3163.                 e.caption && (v += '<div class="text">' + e.caption + "</div>");
  3164.                 e.album_link && (v += "<dl><dt>" + lang.mobile_photos_photo_album_label + "</dt><dd>" + e.album_link + "</dd></dl>");
  3165.                 e.author_link && (v += "<dl><dt>" + lang.mobile_photos_photo_author_label + "</dt><dd>" + e.author_link + "</dd></dl>");
  3166.                 if (e.date || e.likes || e.publish) v += '<div class="info">' + (e.date || "") + (e.likes || "") + (e.publish || "") + "</div>";
  3167.                 val(p, v);
  3168.                 val(q, e.actions || "");
  3169.                 val(z, e.comments_html || "");
  3170.                 e.fv_link && (attr("fv_link", "href", e.fv_link), attr("lm_fv_link", "href", e.fv_link));
  3171.                 attr("app_link", "onclick", e.app_link ? "return nav.app_go(this, event, '" + escapeAttr(e.app_link) + "');" : !1);
  3172.                 nav.go("/" + t, null, {
  3173.                     no_push: b,
  3174.                     push_only: !0,
  3175.                     replace: c
  3176.                 })
  3177.             }
  3178.             if (!G) {
  3179.                 if (!H) {
  3180.                     b = !1;
  3181.                     c = 1;
  3182.                     for (e = 0; 5 > e; e++) v = e + y, t = j(v), t || (b = v, c = 1);
  3183.                     if (!1 === b) for (e = -1; - 3 < e; e--) v = e + y, t = j(v), t || (b = v, c = -1);
  3184.                     if (!1 !== b && (e = j(y))) H = !0, show(s), ajax.post("/photos.php", {
  3185.                         _ajax: 1,
  3186.                         oid: e.owner_id,
  3187.                         list: J,
  3188.                         offset: b,
  3189.                         direction: c,
  3190.                         rev: F ? 1 : 0
  3191.                     }, {
  3192.                         onDone: function (a) {
  3193.                             hide(s);
  3194.                             H = !1;
  3195.                             d(J, a, w.length);
  3196.                             g(y, !0)
  3197.                         }
  3198.                     })
  3199.                 }
  3200.                 b = 0;
  3201.                 for (c = y + 1; b < l; b++) {
  3202.                     var O = (e = j(b + c)) && e.photo;
  3203.                     O && !C[O] && (e = C[O] = new Image, e.src = O, e.onload = function () {
  3204.                         C[O] = !0
  3205.                     })
  3206.                 }
  3207.             }
  3208.         }
  3209.         function j(a) {
  3210.             a = 0 < a ? a % w.length : (100 * w.length + a) % w.length;
  3211.             return w[a]
  3212.         }
  3213.         var l = 1,
  3214.             h, k, s, r, n, m, u, x, p, q, z, A, B, t = {}, v = {}, C = {}, w = null,
  3215.             J = null,
  3216.             F = !1,
  3217.             E = null,
  3218.             M = null,
  3219.             G = !0,
  3220.             y = 0,
  3221.             H = !1;
  3222.         return {
  3223.             save: b,
  3224.             get: c,
  3225.             saveSource: d,
  3226.             getSource: e,
  3227.             clear: function () {
  3228.                 removeEvent(window, "orientationchange", f)
  3229.             },
  3230.             open: function (b, d, f, v, h) {
  3231.                 if (checkEvent(f) || !a()) return !0;
  3232.                 F = !1;
  3233.                 "/rev" == d.substr(-4) && (d = d.slice(0, -4), F = !0);
  3234.                 M = v || null;
  3235.                 d ? J = d : (d = c(b), J = d.album ? "album" + d.album : "");
  3236.                 E = qs2obj(nav.params).list ? J : "";
  3237.                 w = e(J);
  3238.                 a: {
  3239.                     (d = w) || (d = w);
  3240.                     for (var C in d) if (w[C].id == b) {
  3241.                         y = +C;
  3242.                         break a
  3243.                     }
  3244.                     y = -1
  3245.                 }
  3246.                 if (-1 === y) if (d = c(b), d.id) w = [d],
  3247.                 y = 0;
  3248.                 else return !1;
  3249.                 G = 2 > w.length;
  3250.                 b = w[y] && b != w[y].id;
  3251.                 g(y, h && !b, b);
  3252.                 return !1
  3253.             },
  3254.             prev: function (b) {
  3255.                 if (checkEvent(b)) return !0;
  3256.                 if (H && !j(y - 1)) return !1;
  3257.                 if (!a()) return !0;
  3258.                 if (G) return photo.close();
  3259.                 0 > --y && (y = w.length - 1);
  3260.                 g(y);
  3261.                 return !1
  3262.             },
  3263.             next: function (b) {
  3264.                 if (checkEvent(b)) return !0;
  3265.                 if (H && !j(y + 1)) return !1;
  3266.                 if (!a()) return !0;
  3267.                 if (G) return !1;
  3268.                 ++y >= w.length && (y = 0);
  3269.                 g(y);
  3270.                 return !1
  3271.             },
  3272.             close: function (a) {
  3273.                 return checkEvent(a) ? !0 : !1
  3274.             },
  3275.             init: function (a, b, c, d, e, f, v) {
  3276.                 l = "undefined" !== typeof v ? v : 1;
  3277.                 F = !! e;
  3278.                 photo.saveSource(a, b, c);
  3279.                 onDOMReady(function () {
  3280.                     photo.open(d, a + (e ? "/rev" : ""), null, f, !0)
  3281.                 })
  3282.             }
  3283.         }
  3284.     }(),
  3285.     audio = function () {
  3286.         function a() {
  3287.             return n[m] || !1
  3288.         }
  3289.         function b() {
  3290.             return a().id || !1
  3291.         }
  3292.         function c(a) {
  3293.             a && (k.src = a.src, k.load(), audio.onSelect(!0, a))
  3294.         }
  3295.         function d() {
  3296.             var a = b();
  3297.             ssSet("audio_id", a);
  3298.             ssSet("audio_pos", 0);
  3299.             clog("saved");
  3300.             A && (document.cookie = A + "=" + a + "; expires=" + (new Date(vkNow() + 864E5)).toUTCString() + "; path=" + B)
  3301.         }
  3302.         var e = !1,
  3303.             f = !1,
  3304.             g = !1,
  3305.             j = !1,
  3306.             l = function (a) {
  3307.                 clog("play after document click");
  3308.                 if (e || !1 !== j) if (clog("playing: " + (p ? "true" : "false")), e = !1, !p || !1 !== j) g = !0, k.pause(), clog("audio paused after document click");
  3309.                 cancelEvent(a);
  3310.                 removeEvent(k, "play", l);
  3311.                 removeEvent(document, isTouch ? "touchstart" : "click", h)
  3312.             }, h = function () {
  3313.                 f && (f = !1, clog("document clicked"), e = !0, k.play(), removeEvent(document, isTouch ? "touchstart" : "click", h))
  3314.             }, k, s = window.Audio ? new Audio : ce("audio");
  3315.         s.autobuffer = !0;
  3316.         j = g = e = q = z = s.muted = !1;
  3317.         addEvent(s, "play", function () {
  3318.             p || (p = !0, audio.onPlay(!0), ssSet("audio_play", "1"))
  3319.         });
  3320.         addEvent(s, "pause", function () {
  3321.             g ? g = !1 : p && (p = !1, audio.onPause(!0), ssSet("audio_play", "0"))
  3322.         });
  3323.         addEvent(s, "progress", function () {
  3324.             audio.onProgress(!0)
  3325.         });
  3326.         addEvent(s, "timeupdate", function () {
  3327.             g || (audio.onProgress(!0), audio.onPositionChanged(!0, audio.position(), audio.duration()), ssSet("audio_pos", audio.position()), !z && 0.5 > k.duration - k.currentTime && (z = !0), q && (q = !1, audio.next()))
  3328.         });
  3329.         addEvent(s, "ended", function () {
  3330.             audio.onEnded(!0);
  3331.             z ? (z = !1, audio.next()) : q = !0
  3332.         });
  3333.         addEvent(s, "play", l);
  3334.         addEvent(s, "progress canplaythrough", function () {
  3335.             clog("progress fired, fix_update " + (!j ? "not " : "") + "found");
  3336.             !1 !== j && j()
  3337.         });
  3338.         addEvent(document, isTouch ? "touchstart" : "click", h);
  3339.         k = s;
  3340.         var r = Math.random().toString(36).substr(2),
  3341.             n = [],
  3342.             m = null,
  3343.             u = {}, x = "",
  3344.             p = !1,
  3345.             q = !1,
  3346.             z = !1,
  3347.             A = !1,
  3348.             B = !1;
  3349.         setInterval(function () {
  3350.             var a = lsGet("audio_current_player");
  3351.             r != a && p && audio.pause()
  3352.         }, 100);
  3353.         return {
  3354.             init: function (a) {
  3355.                 if (!audio.support) return !1;
  3356.                 a.cookie && (A = a.cookie, B = a.cookie_path || "/");
  3357.                 onDOMReady(function () {
  3358.                     a.playlist && audio.playlist(a.playlist, {
  3359.                         q: a.playlist_q || ""
  3360.                     });
  3361.                     var b = ssGet("audio_id");
  3362.                     if (b) {
  3363.                         var c = ssGet("audio_pos"),
  3364.                             d = ssGet("audio_vol"),
  3365.                             e = ssGet("audio_play");
  3366.                         audio.select(b);
  3367.                         "1" == e && (null !== c && audio.position(c), null !== d && audio.volume(d), f = !0, audio.play());
  3368.                         clog(["restored", b, c, d, e].join(", "))
  3369.                     }
  3370.                 })
  3371.             },
  3372.             support: k.canPlayType && k.canPlayType("audio/mpeg") && "no" != k.canPlayType("audio/mpeg") || !1,
  3373.             onPlay: se(b),
  3374.             onPause: se(b),
  3375.             onDeselect: se(b, function () {
  3376.                 return audio.duration()
  3377.             }),
  3378.             onSelect: se(),
  3379.             onProgress: se(b, function () {
  3380.                 return audio.loaded()
  3381.             }, function () {
  3382.                 return audio.duration()
  3383.             }),
  3384.             onPositionChanged: se(b),
  3385.             onVolumeChanged: se(b, function () {
  3386.                 return k.volume
  3387.             }),
  3388.             onEnded: se(b),
  3389.             onNotFoundError: se(),
  3390.             onEmptyPlaylistError: se(),
  3391.             getCurrent: a,
  3392.             getCurrentId: b,
  3393.             operate: function (a) {
  3394.                 if (!audio.support) return !1;
  3395.                 a && (!n[m] || a != n[m].id) ? audio.play(a) : p ? audio.pause() : audio.play()
  3396.             },
  3397.             playing: function () {
  3398.                 return p
  3399.             },
  3400.             select: function (a) {
  3401.                 if (!audio.support) return !1;
  3402.                 if (a) if (n.length) {
  3403.                     if (n[u[a]]) return b() && audio.onDeselect(!0), m = u[a], c(n[m]), d(), !0;
  3404.                     audio.onNotFoundError(!0, a)
  3405.                 } else audio.onEmptyPlaylistError(!0, a)
  3406.             },
  3407.             play: function (a) {
  3408.                 if (!audio.support) return !1;
  3409.                 if (a) {
  3410.                     p && audio.pause();
  3411.                     if (!audio.select(a)) return;
  3412.                     try {
  3413.                         k.currentTime = 0.01
  3414.                     } catch (b) {}
  3415.                 }
  3416.                 p || (k.muted = !1, k.play(), p = !0, audio.onPlay(!0), ssSet("audio_play", "1"), lsSet("audio_current_player", r))
  3417.             },
  3418.             pause: function () {
  3419.                 if (!audio.support) return !1;
  3420.                 p && (k.pause(), p = !1, audio.onPause(!0), ssSet("audio_play", "0"))
  3421.             },
  3422.             position: function (a, b) {
  3423.                 if (!audio.support) return !1;
  3424.                 if ("undefined" !== typeof a) {
  3425.                     b && (a *= audio.duration());
  3426.                     a = Math.max(0, Math.min(a, audio.duration()));
  3427.                     var c = p;
  3428.                     clog("fix_update: " + j);
  3429.                     c && (p = !1, k.pause());
  3430.                     try {
  3431.                         k.currentTime = a, audio.onPositionChanged(!0, audio.position(), audio.duration()), ssSet("audio_pos", a), c && (p = !0, k.muted = !1, k.play())
  3432.                     } catch (d) {
  3433.                         audio.onPositionChanged(!0, a, audio.duration()), clog("need to set position"), j = function () {
  3434.                             clog("set position");
  3435.                             j = !1;
  3436.                             clog("pos: " + a + ", playing: " + p);
  3437.                             audio.position(a);
  3438.                             clog("p.currentTime: " + k.currentTime)
  3439.                         }, c && (p = !0)
  3440.                     }
  3441.                 } else return k.currentTime
  3442.             },
  3443.             volume: function (a) {
  3444.                 if (!audio.support) return !1;
  3445.                 if ("undefined" !== typeof a) {
  3446.                     try {
  3447.                         k.volume = a || 0
  3448.                     } catch (b) {}
  3449.                     audio.onVolumeChanged(!0);
  3450.                     ssSet("audio_vol", a || 0)
  3451.                 } else return k.volume
  3452.             },
  3453.             loaded: function () {
  3454.                 return k.buffered && k.buffered.length && k.buffered.end(k.buffered.length - 1) || 0
  3455.             },
  3456.             duration: function () {
  3457.                 return n[m] && n[m].dur || k.duration || 0
  3458.             },
  3459.             next: function () {
  3460.                 if (!audio.support) return !1;
  3461.                 p && audio.pause();
  3462.                 audio.onDeselect(!0);
  3463.                 ++m >= n.length && (m = 0);
  3464.                 c(n[m]);
  3465.                 d();
  3466.                 f = !0;
  3467.                 audio.play()
  3468.             },
  3469.             prev: function () {
  3470.                 if (!audio.support) return !1;
  3471.                 p && audio.pause();
  3472.                 audio.onDeselect(!0);
  3473.                 0 >= --m && (m = n.length - 1);
  3474.                 c(n[m]);
  3475.                 d();
  3476.                 f = !0;
  3477.                 audio.play()
  3478.             },
  3479.             playlist: function (b, c) {
  3480.                 if (!audio.support) return !1;
  3481.                 if ("undefined" !== typeof b) {
  3482.                     p && audio.pause();
  3483.                     if (a()) audio.onDeselect(!0);
  3484.                     n = b;
  3485.                     x = c && c.q || "";
  3486.                     m = null;
  3487.                     u = {};
  3488.                     each(b, function (a, b) {
  3489.                         u[b.id] = a
  3490.                     });
  3491.                     var d = x;
  3492.                     ssSet("audio_query", d);
  3493.                     A && (document.cookie = A + "q=" + encodeURIComponent(d) + "; expires=" + (new Date(vkNow() + 864E5)).toUTCString() + "; path=" + B)
  3494.                 } else return n
  3495.             },
  3496.             playlist_q: function () {
  3497.                 return x
  3498.             }
  3499.         }
  3500.     }(),
  3501.     audioplayer = function () {
  3502.         function a(a) {
  3503.             if (a) {
  3504.                 show("lm_player");
  3505.                 var b = ge("lm_audio");
  3506.                 b && (val(geByClass1("artist", b), a.artist), val(geByClass1("title", b), a.title));
  3507.                 if (a = ge("audio" + a.id)) j(a, 0), l(a, 0), g(a, r(0, audio.duration())), h(a, audio.volume()), addClass("audio_current", a)
  3508.             } else hide("lm_player")
  3509.         }
  3510.         function b(a, b) {
  3511.             var c = ge("audio" + a);
  3512.             removeClass("playing", "lm_audio");
  3513.             c && (g(c, s(b)), removeClass("playing", c), removeClass("audio_current", c))
  3514.         }
  3515.         function c(a, b, c) {
  3516.             if (a = ge("audio" + a)) z || l(a, b / c), g(a, audioplayer.getFormatedTime(b, c))
  3517.         }
  3518.         function d(a) {
  3519.             var b = gpeByClass("audios_list", "audio" + a),
  3520.                 c = geByClass("audio", b),
  3521.                 d = [],
  3522.                 e = !1;
  3523.             each(c, function (b, c) {
  3524.                 c = k(c);
  3525.                 if (!c) return !0;
  3526.                 d.push(c);
  3527.                 c.id == a && (e = !0)
  3528.             });
  3529.             audio.playlist(d, {
  3530.                 q: attr(b, "data-query")
  3531.             });
  3532.             e && audio.play(a)
  3533.         }
  3534.         function e(a) {
  3535.             if (z) {
  3536.                 var b = gpeByClass("audio", z),
  3537.                     c = f(z, a);
  3538.                 a && cancelEvent(a);
  3539.                 B && l(b, c);
  3540.                 t && (h(b, c), audio.volume(c));
  3541.                 A = c
  3542.             }
  3543.         }
  3544.         function f(a, b) {
  3545.             var c = hasClass("touch", bodyNode) ? 10 : 8,
  3546.                 d = (b.pageX || b.touches && b.touches[0] && b.touches[0].pageX || 0) - getX(a) - c / 2;
  3547.             return (c = a.offsetWidth - c) ? Math.max(0, Math.min(d / c, 1)) : 0
  3548.         }
  3549.         function g(a, b) {
  3550.             if (a) {
  3551.                 var c = geByClass1("dur", a);
  3552.                 val(c, b)
  3553.             }
  3554.         }
  3555.         function j(a, b) {
  3556.             if (a) {
  3557.                 var c = geByClass1("progress_wrap", a);
  3558.                 geByClass1("load_line", c).style.width = 100 * Math.max(0, Math.min(b, 1)) + "%"
  3559.             }
  3560.         }
  3561.         function l(a, b) {
  3562.             if (a) {
  3563.                 var c = geByClass1("progress_wrap", a),
  3564.                     c = geByClass1("progress_line", c);
  3565.                 geByClass1("slider", c);
  3566.                 c.style.width = 100 * b + "%"
  3567.             }
  3568.         }
  3569.         function h(a, b) {
  3570.             if (a) {
  3571.                 var c = geByClass1("volume_wrap", a),
  3572.                     c = geByClass1("progress_line", c);
  3573.                 geByClass1("slider", c);
  3574.                 c.style.width = 100 * b + "%"
  3575.             }
  3576.         }
  3577.         function k(a) {
  3578.             a = ge(a);
  3579.             if (!a || !attr(a, "data-id") || hasClass("deleted", a)) return !1;
  3580.             var b = attr(a, "data-id"),
  3581.                 c = val(geByTag1("input", a)),
  3582.                 d = attr(geByClass1("dur", a), "data-dur"),
  3583.                 e = val(geByClass1("artist", a)),
  3584.                 f = val(geByClass1("title", a)),
  3585.                 g = !! geByClass1("add", a);
  3586.             a = !! geByClass1("del", a);
  3587.             return {
  3588.                 id: b,
  3589.                 src: c,
  3590.                 dur: d,
  3591.                 artist: htsc(stripTags(e)),
  3592.                 title: htsc(stripTags(f)),
  3593.                 can_add: g,
  3594.                 can_del: a
  3595.             }
  3596.         }
  3597.         function s(a) {
  3598.             var b, c, d = 0 > a;
  3599.             a = Math.round(d ? -a : a);
  3600.             b = a % 60;
  3601.             a = Math.floor(a / 60);
  3602.             c = a % 60;
  3603.             b = c + ":" + (10 > b ? "0" + b : b);
  3604.             a = Math.floor(a / 60);
  3605.             0 < a && (10 > c && (b = "0" + b), b = a + ":" + b);
  3606.             d && (b = "-" + b);
  3607.             return b
  3608.         }
  3609.         function r(a, b) {
  3610.             return s(u && b ? a - b : a)
  3611.         }
  3612.         function n(a) {
  3613.             cur.deletedAudios || (cur.deletedAudios = {});
  3614.             cur.deletedAudios[a] = !0
  3615.         }
  3616.         function m(a) {
  3617.             cur.deletedAudios && delete cur.deletedAudios[a]
  3618.         }
  3619.         var u = "1" == lsGet("audio_time_left"),
  3620.             x = "",
  3621.             p = "",
  3622.             q = "";
  3623.         audio.onPlay(function (a) {
  3624.             addClass("playing", "lm_audio");
  3625.             if (a = ge("audio" + a)) addClass("playing", a), addClass("audio_current", a)
  3626.         });
  3627.         audio.onPause(function (a) {
  3628.             removeClass("playing", "lm_audio");
  3629.             if (a = ge("audio" + a)) removeClass("playing", a), addClass("audio_current", a)
  3630.         });
  3631.         audio.onSelect(a);
  3632.         audio.onDeselect(b);
  3633.         audio.onProgress(function (a, b, c) {
  3634.             a = ge("audio" + a);
  3635.             audio.playing() ? (addClass("playing", a), addClass("playing", "lm_audio")) : (removeClass("playing", a), removeClass("playing", "lm_audio"));
  3636.             a && (j(a, b / c), addClass("audio_current", a))
  3637.         });
  3638.         audio.onPositionChanged(c);
  3639.         audio.onVolumeChanged(function (a, b) {
  3640.             var c = ge("audio" + a);
  3641.             c && h(c, b)
  3642.         });
  3643.         audio.onEnded(function (a) {
  3644.             (a = ge("audio" + a)) && l(a, 1)
  3645.         });
  3646.         audio.onNotFoundError(d);
  3647.         audio.onEmptyPlaylistError(d);
  3648.         var z = null,
  3649.             A = null,
  3650.             B = !1,
  3651.             t = !1;
  3652.         addEvent(document, isTouch ? "touchend touchcancel" : "mouseup", function (a) {
  3653.             if (z) {
  3654.                 var b = gpeByClass("audio", z),
  3655.                     c = f(z, a) || A;
  3656.                 a && cancelEvent(a);
  3657.                 B && (l(b, c), audio.position(c, !0));
  3658.                 t && h(b, c);
  3659.                 z = A = null;
  3660.                 B = t = !1
  3661.             }
  3662.         });
  3663.         addEvent(document, isTouch ? "touchmove" : "mousemove", e);
  3664.         return {
  3665.             init: function (a) {
  3666.                 if (!audio.support) return !1;
  3667.                 x = a.add_hash || "";
  3668.                 p = a.del_hash || "";
  3669.                 q = a.res_hash || ""
  3670.             },
  3671.             initAudio: function () {
  3672.                 each(geByClass("audio_current"), function (a, c) {
  3673.                     c = k(c);
  3674.                     b(c.id, c.dur)
  3675.                 });
  3676.                 var d = audio.getCurrentId(),
  3677.                     d = ge("audio" + d),
  3678.                     e = audio.loaded(),
  3679.                     f = audio.position(),
  3680.                     g = audio.duration();
  3681.                 audio.playing() ? (addClass("playing", d), addClass("playing", "lm_audio")) : (removeClass("playing", d), removeClass("playing", "lm_audio"));
  3682.                 a(audio.getCurrent());
  3683.                 j(d, e / g);
  3684.                 c(audio.getCurrentId(), f, g)
  3685.             },
  3686.             getDOMFromAudio: function (a, b, c) {
  3687.                 if (!a) return "";
  3688.                 var d = htsc(a.id),
  3689.                     e = htsc(a.src),
  3690.                     f = +a.dur,
  3691.                     g = a.artist,
  3692.                     h = a.title,
  3693.                     j = a.can_add;
  3694.                 a = a.can_del;
  3695.                 var k = h ? " &ndash; " : "",
  3696.                     m = isTouch ? "ontouchstart" : "onmousedown",
  3697.                     l = "",
  3698.                     n = "",
  3699.                     p;
  3700.                 p = cur.deletedAudios ? cur.deletedAudios[d] : !1;
  3701.                 if (p) {
  3702.                     if (c) return "";
  3703.                     l += " deleted"
  3704.                 }
  3705.                 c = cur.addedAudios ? cur.addedAudios[d] : !1;
  3706.                 c && (l += " added");
  3707.                 a ? (l += " have_btn", n = '<div class="del" onclick="audioplayer.del(\'' + d + "', event);\"><i></i></div>") : j && (l += " have_btn", n = '<div class="add" onclick="audioplayer.add(\'' + d + "', event);\"><i></i></div>");
  3708.                 d == audio.getCurrentId() && (audio.playing() && (l += " playing"), l += " audio_current");
  3709.                 return '<div id="audio' + d + '" data-id="' + d + '" class="audio' + l + '" onclick="audioplayer.playPause(\'' + d + "'" + (b ? ", true" : "") + ');"><div class="audio_info"><div class="play"><i></i></div>' + n + '<div class="audio_cont"><div class="dur" data-dur="' + f + '" onclick="audioplayer.switchTimeFormat(this, event);"><span>' + s(f) + '</span></div><div class="audio_label"><span class="artist">' + g + "</span>" + k + '<span class="title">' + h + '</span></div><input type="hidden" value="' + e + '"></div></div><div class="controls"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td class="line_wrap progress_wrap"><div class="line" ' + m + '="audioplayer.setPosition(this, event);" onclick="cancelEvent(event);"><div class="ln back_line" onclick="cancelEvent(event);"></div><div class="ln load_line" onclick="cancelEvent(event);"></div><div class="ln progress_line_wrap" onclick="cancelEvent(event);"><div class="ln progress_line" onclick="cancelEvent(event);"><div class="slider" onclick="cancelEvent(event);"></div></div></div></div></td><td class="line_wrap volume_wrap"><div class="line" ' + m + '="audioplayer.setVolume(this, event);" onclick="cancelEvent(event);"><div class="ln back_line" onclick="cancelEvent(event);"></div><div class="ln progress_line_wrap" onclick="cancelEvent(event);"><div class="ln progress_line" onclick="cancelEvent(event);"><div class="slider" onclick="cancelEvent(event);"></div></div></div></div></td></tr></table></div></div>'
  3710.             },
  3711.             add: function (a, b) {
  3712.                 audio.support && !hasClass("added", "audio" + a) && (addClass("added", "audio" + a), cur.addedAudios || (cur.addedAudios = {}), cur.addedAudios[a] = !0, ajax.post("/audio", {
  3713.                     _ajax: 1,
  3714.                     act: "add",
  3715.                     audio: a,
  3716.                     hash: x
  3717.                 }, {
  3718.                     onDone: function (b) {
  3719.                         b || (removeClass("added", "audio" + a), cur.addedAudios && delete cur.addedAudios[a])
  3720.                     },
  3721.                     onFail: function () {
  3722.                         removeClass("added", "audio" + a);
  3723.                         cur.addedAudios && delete cur.addedAudios[a];
  3724.                         switch (Array.prototype.slice.call(arguments).shift()) {
  3725.                             case 2:
  3726.                                 nav.go("/audio?act=add&audio=" + a + "&hash=" + x)
  3727.                         }
  3728.                     }
  3729.                 }), b && cancelEvent(b))
  3730.             },
  3731.             del: function (a, b) {
  3732.                 if (audio.support && ge("audio" + a)) {
  3733.                     var c = hasClass("deleted", "audio" + a);
  3734.                     toggleClass("deleted", "audio" + a, !c);
  3735.                     c ? m(a) : n(a);
  3736.                     ajax.post("/audio", {
  3737.                         _ajax: 1,
  3738.                         act: c ? "restore" : "delete",
  3739.                         audio: a,
  3740.                         hash: c ? q : p
  3741.                     }, {
  3742.                         onDone: function (b) {
  3743.                             b || (toggleClass("deleted", "audio" + a, c), c ? n(a) : m(a))
  3744.                         },
  3745.                         onFail: function () {
  3746.                             toggleClass("deleted", "audio" + a, c);
  3747.                             c ? n(a) : m(a);
  3748.                             switch (Array.prototype.slice.call(arguments).shift()) {
  3749.                                 case 2:
  3750.                                     nav.go("/audio?act=" + (c ? "restore" : "delete") + "&audio=" + a + "&hash=" + (c ? q : p))
  3751.                             }
  3752.                         }
  3753.                     });
  3754.                     b && cancelEvent(b)
  3755.                 }
  3756.             },
  3757.             playPause: function (a, b) {
  3758.                 if (audio.support) {
  3759.                     var c = ge("audio" + a);
  3760.                     if (!c || !hasClass("deleted", c)) b && a != audio.getCurrentId() ? d(a, !0) : audio.operate(a)
  3761.                 } else alert(lang.mobile_audio_player_not_support)
  3762.             },
  3763.             getFormatedTime: r,
  3764.             switchTimeFormat: function (a, b) {
  3765.                 if (hasClass("audio_current", gpeByClass("audio", a))) {
  3766.                     u = !u;
  3767.                     lsSet("audio_time_left", u ? "1" : "0");
  3768.                     var c = ge("audio" + audio.getCurrentId());
  3769.                     g(c, r(audio.position(), audio.duration()));
  3770.                     b && cancelEvent(b)
  3771.                 }
  3772.             },
  3773.             setPosition: function (a, b) {
  3774.                 z || (z = a, B = !0, e(b))
  3775.             },
  3776.             setVolume: function (a, b) {
  3777.                 z || (z = a, t = !0, e(b))
  3778.             },
  3779.             openPlayer: function (a, b) {
  3780.                 var c = nav.path,
  3781.                     d = nav.params,
  3782.                     e = c + (d ? "?" + d : "") + "#player";
  3783.                 return nav.al_go(e, null, {
  3784.                     local: !0,
  3785.                     target: a,
  3786.                     nav: {
  3787.                         push: e,
  3788.                         path: c,
  3789.                         params: d,
  3790.                         hash: "#player"
  3791.                     },
  3792.                     no_push: b
  3793.                 })
  3794.             }
  3795.         }
  3796.     }();
Add Comment
Please, Sign In to add comment