var base_domain = base_domain || "/"; var css_versions = {}; var _ua = navigator.userAgent.toLowerCase(); var browser = { version: (_ua.match( /.+(?:me|ox|on|rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], opera: /opera/i.test(_ua), msie: (/msie/i.test(_ua) && !/opera/i.test(_ua)), msie6: (/msie 6/i.test(_ua) && !/opera/i.test(_ua)), msie7: (/msie 7/i.test(_ua) && !/opera/i.test(_ua)), msie8: (/msie 8/i.test(_ua) && !/opera/i.test(_ua)), msie9: (/msie 9/i.test(_ua) && !/opera/i.test(_ua)), mozilla: /firefox/i.test(_ua), chrome: /chrome/i.test(_ua), safari: (!(/chrome/i.test(_ua)) && /webkit|safari|khtml/i.test(_ua)), iphone: /iphone/i.test(_ua), ipod: /ipod/i.test(_ua), iphone4: /iphone.*OS 4/i.test(_ua), ipod4: /ipod.*OS 4/i.test(_ua), ipad: /ipad/i.test(_ua), safari_mobile: /iphone|ipod|ipad/i.test(_ua), android: /android/i.test(_ua), opera_mobile: /opera mini|opera mobi/i.test(_ua), mobile: /iphone|ipod|ipad|opera mini|opera mobi/i.test(_ua), mac: /mac/i.test(_ua) } if (!window.vk) window.vk = {loginscheme: 'http', ip_h: ''}; function langNumeric(count, vars, format_num) { if (!vars || !window.langConfig) { return count; } var res; if (!isArray(vars)) { result = vars; } else { res = vars[1]; if(count != Math.floor(count)) { res = vars[langConfig.numRules['float']]; } else { each(langConfig.numRules['int'], function(i,v){ if(v[0] == '*') { res = vars[v[2]]; return false; } var c = v[0] ? count % v[0] : count; if(indexOf(v[1], c) != -1) { res = vars[v[2]]; return false; } }); } } if(format_num) { var n = count.toString().split('.'), c = []; for(var i = n[0].length - 3; i > -3; i-=3) { c.unshift(n[0].slice(i > 0?i:0, i+3)); } n[0] = c.join(langConfig.numDel); count = n.join(langConfig.numDec); } res = (res || '%s').replace('%s', count); return res; } function langSex(sex, vars) { if(!isArray(vars)) return vars; var res = vars[1]; if(!window.langConfig) return res; each(langConfig.sexRules, function(i,v){ if(v[0] == '*') { res = vars[v[1]]; return false; } if(sex == v[0] && vars[v[1]]) { res = vars[v[1]]; return false; } }); return res; } function getLang(){ try { var args = Array.prototype.slice.call(arguments); var key = args.shift(); if (!key) return '...'; var val = (window.lang && window.lang[key]) || (window.langpack && window.langpack[key]) || window[key]; if (!val) { var res = key.split('_'); res.shift(); return res.join(' '); } if (isFunction(val)) { return val.apply(null, args); } else if (isArray(val)) { return langNumeric(args[0], val); } else { return val; } } catch(e) { debugLog('lang error:' + e.message + '(' + Array.prototype.slice.call(arguments).join(', ') + ')'); } } /** * DOM **/ function ge() { var ea; for (var i = 0; i < arguments.length; i++) { var e = arguments[i]; if (typeof e == 'string' || typeof e == 'number') e = document.getElementById(e); if (arguments.length == 1) return e; if (!ea) ea = new Array(); ea.push(e); } return ea; } var _logTimer = (new Date()).getTime(); function debugLog(msg){ try { var _time = (new Date()).getTime(); var t = '['+((_time - _logTimer)/1000)+'] '; if (ge('debuglog')) { if (msg===null) msg = '[NULL]'; else if (msg===undefined) msg = '[UNDEFINED]'; ge('debuglog').innerHTML += t + msg.toString().replace('<', '<').replace('>', '>')+'
'; } if(window.console && console.log){console.log(t + msg);} return _time; } catch (e) {return 0;} } function geByClass(searchClass, node, tag) { var classElements = new Array(); if (node == null) node = document; if (tag == null) tag = '*'; if (node.getElementsByClassName) { classElements = node.getElementsByClassName(searchClass); if (tag != '*') { for (i = 0; i < classElements.length; i++) { if (classElements.nodeName == tag) classElements.splice(i, 1); } } return classElements; } var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } function geByClass1(searchClass, node, tag) { node = node || document; tag = tag || '*'; return node.querySelector && node.querySelector(tag + '.' + searchClass) || geByClass(searchClass, node, tag)[0]; } function ce(tagName, attr, style) { var el = document.createElement(tagName); if (attr) extend(el, attr); if (style) setStyle(el, style); return el; } function se(html) {return ce('div', {innerHTML: html}).firstChild;} function show(elem) { if (arguments.length > 1) { for (var i = 0; i < arguments.length; i++) { show(arguments[i]); } return; } elem = ge(elem); if (!elem) return; var old = data(elem, "olddisplay"); elem.style.display = old || ""; if (getStyle(elem, 'display') == "none" ) { if (elem.tagName.toLowerCase() == 'tr' && !browser.msie) { elem.style.display = 'table-row'; } else if (elem.tagName.toLowerCase() == 'table' && !browser.msie) { elem.style.display = 'table'; } else { elem.style.display = data(elem, "olddisplay", "block"); } } } function hide(elem){ if (arguments.length > 1) { for (var i = 0; i < arguments.length; i++) { hide(arguments[i]); } return; } elem = ge(elem); if (!elem) return; if (getStyle(elem, 'display') != "none") data(elem, "olddisplay", elem.style.display); elem.style.display = "none"; } function isVisible(elem) { elem = ge(elem); return getStyle(elem, 'display') != 'none' && getStyle(elem, 'visibility') != 'hidden'; } function toggle(elem, val) { if (val === undefined) { val = !isVisible(elem); } if (val) { show(elem); } else { hide(elem); } } window.shide = toggle; var hfTimeout; function toggleFlash(show, timeout) { //if (/mac/i.test(navigator.userAgent)) return; clearTimeout(hfTimeout); if (timeout > 0) { hfTimeout = setTimeout(function(){toggleFlash(show, 0)}, timeout); return; } var visib = show ? 'visible' : 'hidden'; var body = document.getElementsByTagName('body')[0]; var f = function() { if (this.getAttribute('preventhide')) { return; } else if ((this.id == 'extra_player' && browser.chrome) || (this.id == 'app_container' && browser.msie)) { show ? setStyle(this, {position:"static", top:0}) : setStyle(this, {position:"absolute", top:"-5000px"}); } else { this.style.visibility = visib; } }; each(body.getElementsByTagName('embed'), f); each(body.getElementsByTagName('object'), f); var ep = ge('extra_player'); if (ep) f.apply(ep); var b1 = ge('banner1'), b2 = ge('banner2'); if (b1) b1.style.visibility = visib; if (b2) b2.style.visibility = visib; } function getXY(obj, forFixed) { if (!obj || obj == undefined) return; var left = 0, top = 0, pos, lastLeft, bodyNode = document.getElementsByTagName('body')[0], htmlNode = document.getElementsByTagName('html')[0]; if (obj.offsetParent) { do { left += (lastLeft = obj.offsetLeft); top += obj.offsetTop; pos = getStyle(obj, 'position'); if (pos == 'fixed' || pos == 'absolute' || (pos == 'relative' && obj.id == 'page_wrap')) { left -= obj.scrollLeft; top -= obj.scrollTop; if (pos == 'fixed' && !forFixed) { left += ((obj.offsetParent || {}).scrollLeft || bodyNode.scrollLeft || htmlNode.scrollLeft); top += ((obj.offsetParent || {}).scrollTop || bodyNode.scrollTop || htmlNode.scrollTop); } } } while (obj = obj.offsetParent); } if (forFixed && browser.msie && !browser.msie9) { if (lastLeft) { left += ge('page_layout').offsetLeft; } } return [left,top]; } function getSize(elem, withoutBounds) { var s = [0, 0]; if (elem == document) { s = [Math.max( document.documentElement["clientWidth"], document.body["scrollWidth"], document.documentElement["scrollWidth"], document.body["offsetWidth"], document.documentElement["offsetWidth"] ), Math.max( document.documentElement["clientHeight"], document.body["scrollHeight"], document.documentElement["scrollHeight"], document.body["offsetHeight"], document.documentElement["offsetHeight"] )]; } else if (elem){ function getWH() { s = [elem.offsetWidth, elem.offsetHeight]; if (!withoutBounds) return; var padding = 0, border = 0; each(s, function(i, v) { var which = i ? ['Top', 'Bottom'] : ['Left', 'Right']; each(which, function(){ s[i] -= parseFloat(getStyle(elem, "padding" + this)) || 0; s[i] -= parseFloat(getStyle(elem, "border" + this + "Width")) || 0; }); }); s = [Math.round(s[0]), Math.round(s[1])]; } if (!isVisible(elem)) { var props = {position: "absolute", visibility: "hidden", display:"block"}; var old = {}; each(props, function(i, val){ old[i] = elem.style[i]; elem.style[i] = val; }); getWH(); each(props, function(i, val){ elem.style[i] = old[i]; }); } else getWH(); } return s; } function getScroll() { var b = (browser.msie6) ? ge('PageContainer') : document.body, de = document.documentElement; return [b.scrollLeft || de.scrollLeft || window.pageXOffset || 0, b.scrollTop || de.scrollTop || window.pageYOffset || 0, de.clientWidth || b.clientWidth || 0, de.clientHeight || b.clientHeight || 0]; } function getZoom() { var r1 = ge('zoom_test_1') || document.body.appendChild(ce('div', {id: 'zoom_test_1'}, {left: '10%', position: 'absolute', visibility: 'hidden'})), r2 = ge('zoom_test_2') || document.body.appendChild(ce('div', {id: 'zoom_test_2'}, {left: r1.offsetLeft + 'px', position: 'absolute', visibility: 'hidden'})); return r2.offsetLeft / r1.offsetLeft; } /** * Useful utils */ Function.prototype.bind = function(object) { var __method = this; return function() { return __method.apply(object, arguments); } } Function.prototype.pbind = function() { var func = this, args = arguments; return function() { var argsArray = []; each(args, function(i, obj) { argsArray[i] = obj; }); var obj = window, currArgs = []; each(arguments, function(i, obj) { currArgs[i] = obj }); return func.apply(obj, argsArray.concat(currArgs)); } } function rand(min, max) { return Math.random() * (max - min + 1) + min; } function isFunction(obj) { return Object.prototype.toString.call(obj) === "[object Function]"; } function isArray(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; } function isEmpty(o) { if(Object.prototype.toString.call(o) !== "[object Object]") {return false;} for(var i in o){ if(o.hasOwnProperty(i)){return false;} } return true; } function vkNow() { return +new Date; } function vkImage() { return window.Image ? (new Image()) : ce('img'); } // IE8 workaround function trim(text) { return (text || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""); } function stripHTML(text) { return text ? text.replace(/<(?:.|\s)*?>/g, "") : ''; } function escapeRE(s) { return s ? s.replace(/[.*+?^${}()|[\]\/\\]/g, '\\$0') : ''; } function intval(value) { if (value === true) return 1; return isNaN(parseInt(value, 10)) ? 0 : parseInt(value, 10); } function winToUtf(text) { var m, i, j, code; m = text.match(/&#[0-9]{2}[0-9]*;/gi); for (j in m) { var val = '' + m[j]; // buggy IE6 code = intval(val.substr(2, val.length - 3)); if (code >= 32 && ('&#' + val.replace(/[^0-9]/g, '') + ';' == val)) { // buggy IE6 text = text.replace(val, String.fromCharCode(code)); } } text = text.replace(/"/gi, '"').replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>'); return text; } function replaceEntities(str) { return se('').value; } /** * Arrays, objects **/ function each(object, callback) { var name, i = 0, length = object.length; if ( length === undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} return object; }; function indexOf(arr, value, from) { from = (from == null) ? 0 : from; var m = arr.length; for(var i = from; i < m; i++) if (arr[i] == value) return i; return -1; } function inArray(value, array) { for (var i = 0; i < array.length; i++) { if (array[i] == value) return true; } return false; } function clone(obj) { var newObj = isArray(obj) ? [] : {}; for (var i in obj) { newObj[i] = obj[i]; } return newObj; } // Extending object by another function extend() { var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; if (typeof target === "boolean") { deep = target; target = arguments[1] || {}; i = 2; } if (typeof target !== "object" && !isFunction(target)) target = {}; if (length == i) { return target; } for (; i < length; i++) if ((options = arguments[i]) != null) for (var name in options) { var src = target[name], copy = options[name]; if (target === copy) continue; if (deep && copy && typeof copy === "object" && !copy.nodeType) target[name] = extend(deep, src || (copy.length != null ? [] : { }) , copy); else if (copy !== undefined) target[name] = copy; } return target; } /** * CSS classes **/ function hasClass(obj, name) { obj=ge(obj); return obj && (new RegExp('(\\s|^)' + name + '(\\s|$)')).test(obj.className); } function addClass(obj, name) { obj=ge(obj); if (obj && !hasClass(obj, name)) obj.className = trim(obj.className + ' ' + name); } function removeClass(obj, name) { obj=ge(obj); if (obj && hasClass(obj, name)) obj.className = trim(obj.className.replace((new RegExp('(\\s+|^)' + name + '(\\s+|$)')), ' ')); } function toggleClass(obj, name, val) { if (val === undefined) { val = !hasClass(obj, name); } (val ? addClass : removeClass)(obj, name); } //shortcuts function btnOut(o){removeClass(geByClass('box_button', o)[0], 'button_hover');} function btnOver(o){addClass(geByClass('box_button', o)[0], 'button_hover');} // Get computed style function getStyle(elem, name, force) { elem = ge(elem); if (force === undefined) force = true; if (!force && name == 'opacity' && browser.msie) { var filter = elem.style['filter']; return filter ? (filter.indexOf("opacity=") >= 0 ? (parseFloat(filter.match(/opacity=([^)]*)/)[1] ) / 100) + '' : '1') : ''; } if (!force && elem.style && (elem.style[name] || name == 'height')) return elem.style[name]; if (force && (name == "width" || name == "height")) { return getSize(elem, true)[({'width':0, 'height':1})[name]] + 'px'; } var ret, defaultView = document.defaultView || window; if (defaultView.getComputedStyle) { name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); var computedStyle = defaultView.getComputedStyle( elem, null ); if (computedStyle) ret = computedStyle.getPropertyValue(name); } else if (elem.currentStyle) { if (name == 'opacity' && browser.msie) { var filter = elem.currentStyle['filter']; return filter && filter.indexOf("opacity=") >= 0 ? (parseFloat(filter.match(/opacity=([^)]*)/)[1] ) / 100) + '' : '1'; } var camelCase = name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); ret = elem.currentStyle[name] || elem.currentStyle[camelCase]; //dummy fix for ie if(ret == 'auto')ret = 0; // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; style.left = ret || 0; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } } if (ret == 'rgba(0, 0, 0, 0)') ret = 'transparent'; return ret; } function setStyle(elem, name, value){ elem = ge(elem); if (!elem) return; if (typeof name == 'object') return each(name, function(k,v){setStyle(elem,k,v);}); if (name == 'opacity'){ if (browser.msie) { if ((value + '').length) { elem.style.filter = "alpha(opacity=" + value*100 + ")"; } else { elem.style.filter = ''; } elem.style.zoom = 1; }; elem.style.opacity = value; } else { var isNum = typeof(value) == 'number' && !(/z-?index|font-?weight|opacity|zoom|line-?height/i).test(name); if(isNum && value < 0 && (/^(width|height)$/i).test(name)){ value = 0; //fix for IE; } elem.style[name] = isNum ? value + 'px': value; } } function swapStyle(elem, options, callback) { elem = ge(elem); var old = {}; for (var name in options) { old[name] = elem.style[name]; elem.style[name] = options[name]; } callback.call(elem); for (var name in options) elem.style[name] = old[ name ]; } /** * Store data connected to element **/ var expand = 'VK' + vkNow(), vk_uuid = 0, vk_cache = {}; // Get or set element data function data(elem, name, data) { if (!elem) return false; var id = elem[ expand ], undefined; if ( !id ) id = elem[ expand ] = ++vk_uuid; if (name && !vk_cache[id]) vk_cache[id] = {}; if (data !== undefined) vk_cache[id][name] = data; return name ? vk_cache[id][name] : id; } function removeData(elem, name) { if (!elem) return false; var id = elem[expand]; if (name) { if (vk_cache[id]) { delete vk_cache[id][name]; name = ""; for (name in vk_cache[id]) break; if (!name) removeData(elem); } } else { try { delete elem[expand]; } catch(e){ // fix for IE if (elem.removeAttribute) elem.removeAttribute(expand); } delete vk_cache[id]; } } /** * Simple FX **/ function animate(el, params, speed, callback) { el = ge(el); var options = extend({}, typeof speed == 'object' ? speed : {duration: speed, onComplete: callback || function(){}}); var fromArr = {}, toArr = {}, visible = isVisible(el), self = this, p; options.orig = {}; params = clone(params); var tween = data(el, 'tween'), i, name, toggleAct = visible ? 'hide' : 'show'; if (tween && tween.isTweening) { options.orig = extend(options.orig, tween.options.orig); tween.stop(false); if (tween.options.show) toggleAct = 'hide'; else if (tween.options.hide) toggleAct = 'show'; } for (p in params) { if (!tween && (params[p] == 'show' && visible || params[p] == 'hide' && !visible)) return options.onComplete.call(this, el); if ((p == "height" || p == "width") && el.style) { if (options.orig.overflow == undefined) { options.orig.overflow = getStyle(el, 'overflow'); } el.style.overflow = 'hidden'; if (!hasClass(el, 'inl_bl')) { el.style.display = 'block'; } } if (/show|hide|toggle/.test(params[p])) { if (params[p] == 'toggle') params[p] = toggleAct; if (params[p] == 'show') { var from = 0; options.show = true; if (options.orig[p] == undefined) { options.orig[p] = getStyle(el, p, false) || ''; setStyle(el, p, 0); } var sopt = {}; if (p == 'height' && browser.msie6) { sopt[p] = '0px'; el.style.overflow = ''; } else { sopt[p] = options.orig[p]; } swapStyle(el, sopt, function() { params[p] = parseFloat(getStyle(el, p, true)); }); if (p == 'height' && browser.msie) { el.style.overflow = 'hidden'; } } else { if (options.orig[p] == undefined) { options.orig[p] = getStyle(el, p, false) || ''; } options.hide = true; params[p] = 0; } } } if (options.show && !visible) { show(el); } tween = new Fx.Base(el, options, null); each(params, function(name, to) { if (/backgroundColor|borderBottomColor|borderLeftColor|borderRightColor|borderTopColor|color|borderColor|outlineColor/.test(name)) { var p = (name == 'borderColor') ? 'borderTopColor' : name; from = getColor(el, p); to = getRGB(to); } else { var parts = to.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), start = tween.cur(name, true) || 0; if (parts) { to = parseFloat(parts[2]); if ( parts[1] ) to = ((parts[1] == "-=" ? -1 : 1) * to) + to; } if (options.hide && name == 'height' && browser.msie6) { el.style.height = '0px'; el.style.overflow = ''; } from = tween.cur(name, true); if (options.hide && name == 'height' && browser.msie6) { el.style.height = ''; el.style.overflow = 'hidden'; } if (from == 0 && (name == "width" || name == "height")) from = 1; if (name == "opacity" && to > 0 && !visible) { setStyle(el, 'opacity', 0); from = 0; show(el); } } if (from != to || (isArray(from) && from.join(',') == to.join(','))) { fromArr[name] = from; toArr[name] = to; } }); tween.start(fromArr, toArr); data(el, 'tween', tween); return tween; } function fadeTo(el, speed, to, callback) {return animate(el, {opacity: to}, speed, callback);} var Fx = fx = { Transitions: { linear: function(t, b, c, d) { return c*t/d + b; }, sineInOut: function(t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, halfSine: function(t, b, c, d) { return c * Math.sin(Math.PI * (t/d) / 2) + b; }, easeOutBack: function(t, b, c, d) { var s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeOutCubic: function(t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b;} }, Attrs: [ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], [ "opacity" ] ], Timers: [], TimerId: null }; Fx.Base = function(el, options, name){ this.el = ge(el); this.name = name; this.options = extend({ onComplete: function(){}, transition: Fx.Transitions.sineInOut, duration: 500 }, options || {}); }; function genFx(type, num){ var obj = {}; each( Fx.Attrs.concat.apply([], Fx.Attrs.slice(0,num)), function(){ obj[this] = type; }); return obj; }; // Shortcuts for custom animations each({slideDown: genFx('show', 1), slideUp: genFx('hide', 1), slideToggle: genFx('toggle', 1), fadeIn: {opacity: 'show'}, fadeOut: {opacity: 'hide'}, fadeToggle: {opacity: 'toggle'}}, function(f, val){ window[f] = function(el, speed, callback){return animate(el, val, speed, callback);} }); Fx.Base.prototype = { start: function(from, to){ this.from = from; this.to = to; this.time = vkNow(); this.isTweening = true; var self = this; function t(gotoEnd) { return self.step(gotoEnd); } t.el = this.el; if (t() && Fx.Timers.push(t) && !Fx.TimerId) { Fx.TimerId = setInterval(function(){ var timers = Fx.Timers; for (var i = 0; i < timers.length; i++) if (!timers[i]()) timers.splice(i--, 1); if (!timers.length) { clearInterval(Fx.TimerId); Fx.TimerId = null; } }, 13); } return this; }, stop: function(gotoEnd) { var timers = Fx.Timers; // go in reverse order so anything added to the queue during the loop is ignored for (var i = timers.length - 1; i >= 0; i--) if (timers[i].el == this.el ) { if (gotoEnd) // force the next step to be the last timers[i](true); timers.splice(i, 1); } this.isTweening = false; }, step: function(gotoEnd){ var time = vkNow(); if (!gotoEnd && time < this.time + this.options.duration){ this.cTime = time - this.time; this.now = {}; for (p in this.to) { // color fx if (isArray(this.to[p])) { var color = [], j; for (j = 0; j < 3; j++) color.push(Math.min(parseInt(this.compute(this.from[p][j], this.to[p][j])), 255)); this.now[p] = color; } else this.now[p] = this.compute(this.from[p], this.to[p]); } this.update(); return true; } else { // if (this.el.className == 'im_tab3') alert('this.time: ' + this.time + ', ' + (time - this.time) + ' > ' + this.options.duration); setTimeout(this.options.onComplete.bind(this, this.el), 10); this.now = extend(this.to, this.options.orig); this.update(); if (this.options.hide) hide(this.el); this.isTweening = false; return false; } }, compute: function(from, to){ var change = to - from; return this.options.transition(this.cTime, from, change, this.options.duration); }, update: function(){ for (var p in this.now) { if (isArray(this.now[p])) setStyle(this.el, p, 'rgb(' + this.now[p].join(',') + ')'); else this.el[p] != undefined ? (this.el[p] = this.now[p]) : setStyle(this.el, p, this.now[p]); } }, cur: function(name, force){ if (this.el[name] != null && (!this.el.style || this.el.style[name] == null)) return this.el[name]; return parseFloat(getStyle(this.el, name, force)) || 0; } }; // Parse strings looking for color tuples [255,255,255] function getRGB(color) { var result; if ( color && isArray(color) && color.length == 3 ) return color; if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; } function getColor(elem, attr) { var color; do { color = getStyle(elem, attr); if (color != '' && color != 'transparent' || elem.nodeName.toLowerCase() == "body") break; attr = "backgroundColor"; } while (elem = elem.parentNode); return getRGB(color); } function scrollToTop(speed, top) { if (speed == undefined) speed = 400; top = top ? (!isNaN(parseInt(top, 10)) ? top : getXY(ge(top))[1]) : 0; if (speed) { animate(document.getElementsByTagName('html')[0], {scrollTop: top}, speed); animate(document.getElementsByTagName('body')[0], {scrollTop: top}, speed); } else window.scroll(0, top); } /** * Events **/ var KEY = window.KEY = { LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, DEL: 8, TAB: 9, RETURN: 13, ESC: 27, PAGEUP: 33, PAGEDOWN: 34, SPACE: 32, HOME: 36, END: 35, ENTER: 13, DELETE: 46, BACKSPACE: 8 }; function addEvent(elem, types, handler, custom, context) { elem = ge(elem); if (!elem || elem.nodeType == 3 || elem.nodeType == 8 ) return; var real_handler = context ? function(e) { var prev_data = e.data; e.data = context; var ret = handler.apply(this, [e]); e.data = prev_data; return ret; } : handler; // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process if (elem.setInterval && elem != window) elem = window; var events = data(elem, "events") || data(elem, "events", []), handle = data(elem, "handle") || data(elem, "handle", function(){ _eventHandle.apply(arguments.callee.elem, arguments); }); // Add elem as a property of the handle function // This is to prevent a memory leak with non-native // event in IE. handle.elem = elem; each(types.split(/\s+/), function(index, type) { var handlers = events[type]; if (!handlers) { handlers = events[type] = new Array(); if (!custom && elem.addEventListener) elem.addEventListener(type, handle, false); else if (!custom && elem.attachEvent) elem.attachEvent('on' + type, handle); } handlers.push(real_handler); }); elem = null; } function triggerEvent(elem, type, ev) { var handle = data(elem, "handle"); if (handle) { setTimeout(function() {handle.call(elem, extend((ev || {}), {type: type, target: elem}))}, 0); } } function removeEvent(elem, types, handler) { elem = ge(elem); if (!elem) return; var events = data(elem, 'events'); if (!events) return; if (typeof(types) != 'string') { for (var i in events) { removeEvent(elem, i); } return; } each(types.split(/\s+/), function(index, type) { if (!isArray(events[type])) return; if (isFunction(handler)) { for (var i = 0; i < events[type].length; i++) { if (events[type][i] == handler) { delete events[type][i]; break; } } } else { for (var i = 0; i < events[type].length; i++) { delete events[type][i]; } } for (var ret in events[type]) break; if (!ret) { if (elem.removeEventListener) { elem.removeEventListener(type, data(elem, 'handle'), false); } else if (elem.detachEvent) { elem.detachEvent('on' + type, data(elem, 'handle')); } ret = null; delete events[type]; } }); } function cancelEvent(event) { if (!event) return; var e = event.originalEvent || event; try { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); } catch (d){}; e.cancelBubble = true; e.returnValue = false; return false; } function checkEvent(e) { return ((e = (e || window.event)) && (e.type == 'click' || e.type == 'mousedown' || e.type == 'mouseup') && (e.which > 1 || e.button > 1 || e.ctrlKey || e.shiftKey || browser.mac && e.metaKey)); } function _eventHandle(event) { event = event || window.event; var originalEvent = event; event = clone(originalEvent); event.originalEvent = originalEvent; if (!event.target) event.target = event.srcElement || document; if (!event.currentTarget) event.currentTarget = this; // check if target is a textnode (safari) if (event.target.nodeType == 3) event.target = event.target.parentNode; if (!event.relatedTarget && event.fromElement) event.relatedTarget = event.fromElement == event.target; if (event.pageX == null && event.clientX != null) { var doc = document.documentElement, body = document.body; event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); } if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) event.which = event.charCode || event.keyCode; // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) if (!event.metaKey && event.ctrlKey) event.metaKey = event.ctrlKey; // Add which for click: 1 == left; 2 == middle; 3 == right // Note: button is not normalized, so don't use it if (!event.which && event.button) event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); var handlers = data(this, "events"); if (!handlers || typeof(event.type) != 'string' || !handlers[event.type] || !handlers[event.type].length) { return; } for (var i in (handlers[event.type] || [])) { if (event.type == 'mouseover' || event.type == 'mouseout') { var parent = event.relatedElement; // Traverse up the tree while ( parent && parent != this ) try { parent = parent.parentNode; } catch(e) { parent = this; } if (parent == this) { continue } } var ret = handlers[event.type][i].apply(this, arguments); if (ret === false) { cancelEvent(event); } } } // Prevent memory leaks in IE // And prevent errors on refresh with events like mouseover in other browsers // Window isn't included so as not to unbind existing unload events addEvent(window, "unload", function(){ for (var id in vk_cache) if (vk_cache[id].handle && vk_cache[id].handle.elem != window) removeEvent(vk_cache[id].handle.elem); }); // Dom ready event handler (function(){ var isRdy = false, rdyBnd = false, rdyList = []; window.onDomReady = function(fn) { bindRdy(); if (isRdy){ fn.call(document); } else { rdyList.push(function() { fn.call(document); }); } }; window.onBodyResize = function() { var dwidth = Math.max(intval(window.innerWidth), intval(document.documentElement.offsetWidth)); if (window.lastWindowWidth != dwidth) { window.lastWindowWidth = dwidth; if (browser.msie6) return; if (!window.photoLayerVisible) document.body.style.overflowY = 'auto'; var pl = ge('pageLayout').offsetWidth, sbw = sbWidth(); if (document.body.offsetWidth < pl) { document.body.style.overflowX = 'auto'; dwidth = pl + sbw + 2; } else { document.body.style.overflowX = 'hidden'; } if (dwidth) { ge('pageContainer').style.width = (dwidth - sbw - 2) + 'px'; } } } var rdy = function() { if (!isRdy) { isRdy = true; if (rdyList) { var l = rdyList; l.reverse(); while (fn = l.pop()) { fn.apply(document); } rdyList = null; } } }; var bindRdy = function() { if (rdyBnd) return; rdyBnd = true; if(document.addEventListener && !browser.opera) document.addEventListener("DOMContentLoaded", rdy, false); if (browser.msie && window == top) (function(){ if (isRdy) return; try {document.documentElement.doScroll("left"); } catch (e) { setTimeout(arguments.callee,0); return; } rdy(); })(); if (browser.opera) document.addEventListener("DOMContentLoaded", function(){ if (isRdy) return; rdy(); }, false); if (browser.safari) { (function(){ if(isRdy) return; if (document.readyState != "loaded" && document.readyState != "complete") { setTimeout(arguments.callee,0); return; } rdy(); })(); } addEvent(window, "load", rdy); } })(); /** * Ajax **/ function serializeForm(form) { if (typeof(form) != 'object') { return false; } var result = {}; var g = function(n) { return form.getElementsByTagName(n) }; var nv = function(i, e){ if (e.name) result[e.name] = (browser.msie && !e.value && form[e.name]) ? form[e.name].value : e.value; }; each(g('input'), function(i, e) { if ((e.type != 'radio' && e.type != 'checkbox') || e.checked) return nv(i, e); }); each(g('select'), nv); each(g('textarea'), nv); return result; } function ajx2q(qa) { var query = [], q, i =0; for (var key in qa) { if (qa[key] === undefined || qa[key] === null || typeof(qa[key]) == 'function') continue; if (isArray(qa[key])) { for (var i = 0; i < qa[key].length; ++i) { if (qa[key][i] === undefined || qa[key][i] === null || typeof(qa[key][i]) == 'function') continue; query.push(encodeURIComponent(key) + '[]=' + encodeURIComponent(qa[key][i])); } } else { query.push(encodeURIComponent(key) + '=' + encodeURIComponent(qa[key])); } } return query.join('&'); } function q2o(q) { var t = q; if (typeof q == 'string') { var d=q.split('&'),v,i; t={}; for (i=0; i= 200 && tram.status < 300) { if(eval_res) parseRes(); if( _t.onDone ) _t.onDone(extend(_t, {url: url, data: data}), tram.responseText); } else { _t.status = tram.status; _t.readyState = tram.readyState; if( _t.onFail ) _t.onFail(extend(_t, {url: url, data: data}), tram.responseText); } } }; var parseRes = function(){ if(!tram || !tram.responseText)return; var res = tram.responseText.replace(/^[\s\n]+/g, ''); if(res.substr(0,10)==""); eval(arr[0]); tram.responseText = arr[1]; }catch(e){ debugLog('eval ajax script:' + e.message); } }else{} }; this.get = function(u, d, f){ tram.onreadystatechange = function(){ readystatechange(u, d); }; f = f || false; var q = (typeof(d) != 'string') ? ajx2q(d) : d; u = u + (q ? ('?'+q) : ''); tram.open('GET', u, !f); tram.setRequestHeader("X-Requested-With", "XMLHttpRequest"); tram.send(''); }; this.post = function(u, d, f){ tram.onreadystatechange = function(){ readystatechange(u, d); }; f = f || false; var q = (typeof(d) != 'string') ? ajx2q(d) : d; try { tram.open('POST', u, !f); } catch(e) { debugLog('ajax post error: '+e.message); } tram.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); tram.setRequestHeader("X-Requested-With", "XMLHttpRequest"); tram.send(q); }; } function activate_mobile(from_captcha, on_hide, hash) { if (from_captcha) { on_hide = function() { Ajax._captchaBox.show(); if (!window.need_mobile_act) { triggerEvent(ge('captchaKey'), 'keypress', {keyCode: 13}); } } } showBox('activate_mobile', 'activation.php', {act: 'activate_mobile_box', hash: hash}, false, true, {type: 'POPUP', hideOnClick: false, progress: 'activate_progress', onHide: on_hide}, ['css/al/reg.css']); } function showCaptcha(sid, img, onClick, onShow, onHide) { if (window.Ajax._captchaBox === undefined) { window.Ajax._captchaBox = new MessageBox({title: getLang('captcha_enter_code'), width: 300}); } var box = window.Ajax._captchaBox; box.removeButtons(); var key; var about_mobile_text = ''; var onClickHandler = function() { removeEvent(key, 'keypress'); onClick(sid, key.value); hide('captchaKey'); show('captchaLoader'); } if (window.need_mobile_act == 1 && !ge('please_confirm_mail')) { about_mobile_text = global_try_to_activate.replace('{link}', '').replace('{/link}', ''); about_mobile_text = '
' + about_mobile_text + ''; } box.addButton({label: getLang('captcha_cancel'), style: 'button_no', onClick: function(){ removeEvent(key, 'keypress'); box.hide(); }}); box.addButton({label: getLang('captcha_send'), onClick: onClickHandler}); box.setOptions({onHide: onHide, bodyStyle: 'padding: 16px 14px' + (about_mobile_text.length ? ' 10px' : '')}); box.content('
' + about_mobile_text); box.show(); if (isFunction(onShow)) onShow(); key = ge('captchaKey'); addEvent(key, 'keypress', function(e) { if(e.keyCode==13){ onClickHandler(); }}); addEvent(ge('refreshCaptcha'), 'click', onClickHandler); key.focus(); } (function(){ var ajaxObjs = {}; window.Ajax.Get = function(p){ var a = (p.key)?ajaxObjs[p.key]:null; if(!a){ a = new Ajax(p.onDone, p.onFail, p.eval); if(p.key)ajaxObjs[p.key] = a; } a.get(p.url, p.query, p.sync); } window.Ajax.Post = function(p){ var a = (p.key)?ajaxObjs[p.key]:null; if(!a){ a = new Ajax(p.onDone, p.onFail, p.eval); if(p.key)ajaxObjs[p.key] = a; } a.post(p.url, p.query, p.sync); } window.Ajax.postWithCaptcha = function(url, data, options) { var onSuccess, onFail, onCaptchaShow, onCaptchaHide, difficulty, p; if (!options) options = {}; if (isFunction(options)) { onSuccess = options; } else { onSuccess = options.onSuccess; onFail = options.onFail; onCaptchaShow = options.onCaptchaShow; onCaptchaHide = options.onCaptchaHide; } var done = function(o, t) { var r; try { r = eval('(' + t + ')'); if (r.ok == -5) { if (ge('please_confirm_mail')) { r.ok = -4; } } switch(r.ok) { case -6: var box = new MessageBox({title:r.title || getLang('global_charged_zone_title'), returnHidden:true}); box.addButton({label: getLang('global_cancel'), style: 'button_no', onClick: function() { box.setOptions({returnHidden:false}); box.hide(); }}).addButton({label:getLang('global_charged_zone_continue'), onClick: function() { box.hide(); p.query.charged_confirm = r.hash; Ajax.Post(p); }}).content(r.message).show(); break; case -5: if (isFunction(onCaptchaShow)) onCaptchaShow(); if (r.title || r.message) { var box = new MessageBox({title: r.title || 'Ïîäòâåðæäåíèå äåéñòâèÿ'}); box.addButton({label: getLang('global_close'), onClick: box.hide}); box.content(r.message || 'Ïðåâûøåíî îãðàíè÷åíèå íà êîëè÷åñòâî äåéñòâèé, ïîïðîáóéòå ïîçæå.').show(); } else { window.validated = false; activate_mobile(false, function() { if (window.validated) { Ajax.Post(p); } if (onCaptchaHide) onCaptchaHide(!window.need_mobile_act); }, r.hash); } break; case -4: if (isFunction(onCaptchaShow)) onCaptchaShow() if (ge('please_confirm_mail')) { show_change_mail_box(onCaptchaHide); } else { if (onCaptchaHide) onCaptchaHide(); } break; case -3: var to; var iframe = ce('iframe', {src: vk.loginscheme + '://login.vk.com/?ip_h=' + vk.ip_h + '&from_host=' + location.host + '&from_protocol=' + location.protocol}, {visibility: 'hidden', position: 'absolute'}); document.body.appendChild(iframe); var onload = function() { try { var href = iframe.contentWindow.location.href; if (href.match(/&hash=/)) { if (href.match(/&hash=[a-z0-9]+/)) { Ajax.Post(p); } else { location.href= base_domain + 'login.php?op=logout'; return false; } clearInterval(t); } } catch(e) {} } if (browser.msie) { to = setInterval(function(){ if (iframe.document.readyState == 'complete') { onload(); } }, 200); } else { iframe.onload = onload; } break; case -2: // Show captcha here TODO var difficulty = ''; if (r.difficult === undefined) r.difficult = options.difficultCaptcha ? 1 : 0; if (r.difficult !== undefined) { difficulty = intval(r.difficult) ? '' : 's=1&'; } var onClick = function(sid, value) { if (typeof(p.query) == 'object') { extend(p.query, {'captcha_sid': sid, 'captcha_key': value}); } else { p.query += '&captcha_sid=' + sid + '&captcha_key=' + value; } Ajax.Post(p); return false; }; var captcha_img = base_domain+'captcha.php?'+difficulty+'sid='+r.captcha_sid; showCaptcha(r.captcha_sid, captcha_img, onClick, onCaptchaShow, onCaptchaHide); break; default: throw "Exit"; break; } } catch (e) { // if captcha test passed if (options.json && r) t = r; else if (r && typeof(r.text) == 'string') t = r.text; if (window.Ajax._captchaBox) { window.Ajax._captchaBox.setOptions({onHide: function(){}}).hide(); if (isFunction(onCaptchaHide)) onCaptchaHide(true); } if (isFunction(onSuccess)) onSuccess(o, t); } }; var fail = function(o, t) { if (isFunction(onFail)) onFail(o, t); if (window.Ajax._captchaBox) { window.Ajax._captchaBox.setOptions({onHide: function(){}}).hide(); if (isFunction(onCaptchaHide)) onCaptchaHide(true); } }; p = { url: url, query: data, onFail: fail, onDone: done }; Ajax.Post(p); } window.Ajax.History = function(url, query, update, failed) { ajaxHistory.useCache = false; ajaxHistory.prepare({url: url, done: function(o,t){ try { var r = eval('('+t+')'); if(r.data)Ajax.current = r.data; update(r); } catch (e) { debugLog(e); } }, fail:failed, def: query}); Ajax.current = query; }; window.Ajax.Go = function(query) { var q = extend(clone(Ajax.current), query); ajaxHistory.go(q); return false; } window.Ajax.Send = Ajax.postWithCaptcha; })(); var ajaxHistory = $ah = new (function(){ var _t = this; var curHash = ""; var curHashes = {}; var frame = null; var with_frame = browser.msie6 || browser.msie7; var frame_doc = function() { return frame.contentDocument ? frame.contentDocument : (frame.contentWindow ? frame.contentWindow.document : frame.document); } var setFrameContent = function(hash) { var d = frame_doc(); d.open(); d.write('
' + hash.replace('&', '&').replace('"', '"').replace('>', '>').replace('<', '<') + '
' ); d.close(); } var forceLoad = false; var order = null; //_t.frameLoading = false; _t.enabled = false; _t.useCache = true; _t.onLoad = {}; _t.cache = {}; _t.preloads = {}; var setHash = function(hash){ hash = hash.replace("#",""); if (location.hash != "#" + hash){ location.hash = "#" + hash; if (with_frame) { setFrameContent(hash); handler(); } } return true; }; var getHash = function(){ if (!with_frame) return location.hash.replace("#",""); try { return frame_doc().getElementById('hash').innerHTML.replace(/</ig, '<').replace(/>/ig, '>').replace(/"/ig, '"').replace(/&/ig, '&'); } catch(e) { return curHash; } }; var splitHash = function(hash){ if(!hash)return {}; hash = hash.split("/"); if(hash.length == 1){ if(!_t.onLoad['default'])return {}; if(_t.onLoad['default'].show)hash[0] = _t.onLoad['default'].show.from(hash[0]); return {'default':sortParams(hash[0])}; } var parsed = {}; for(var i=0;i
'}, {padding: 0}); } hide('header'); this.prev_content.parentNode.replaceChild(this.qsearch_cont, this.prev_content); if (!this.loading) this.load(); self.hub.done(); self.hintsHub.done(); if (e) return cancelEvent(e); }; this.go = function (e) { if (self.global) { return globalSearch(); } var url = '/gsearch.php?section=' + (self.last_section || 'people') + '&q=' + trim(ge('search_input').getValue ? ge('search_input').getValue() : ge('search_input').value) + '&name=1'; cancelEvent(e || window.event); location.href = url; return false; }; this.hide = function(e, force) { if (!ge('quick_search')) return; if ((self.active && !force) || !self.on) return; self.on = 0; toggleFlash(); if (self.beforeHide && self.beforeHide()) { return true; } show('header'); hide('quick_search'); if (ge('search_input').setValue) { ge('search_input').setValue(''); } else { ge('search_input').value = ''; } removeClass('qsearch_link', 'active'); if (self.qsearch_cont) self.qsearch_cont.parentNode.replaceChild(self.prev_content, self.qsearch_cont); }; this.init = function(options) { this.opt = options || {}; } })(); function dispatchIntro(step, params) { if (typeof dispatchIntroEvent != 'undefined') {dispatchIntroEvent(step, params);} } var send_request_url = 'http://userapi.com/data?'; var qCur = 0, qOn = 0, sOn = 0, qfOn = 0, qd = 0, l = 0, qa = 0, qfCur = -1, newSearch = 0; // var qArr is in langpack reqs = []; res = []; friends_l = []; friends_arr = []; floaded = false; function doRequest(params, resultFunc) { var req = createRequest(params, resultFunc); sendRequest(req); } function createRequest(params, resultFunc) { var req = new Object(); req.params = params; req.resultFunc = resultFunc; req.destroy = destroy; var rnum = Math.floor(Math.random()*1000); req.num = rnum; req.running = 1; reqs[rnum] = req; return req; } function sendRequest(req) { attachScript('req'+req.num, send_request_url+req.params+'&sid='+getCookie('remixsid')+'&back=reqs['+req.num+'].resultFunc'); } function attachScript(id, c) { var i, new_id = c.substr(c.indexOf('/')+1, c.indexOf('.')-c.indexOf('/')+2).replace(/[\/\.]/g, '_'); var newreqs = []; for (reqnum in reqs) { req = reqs[reqnum]; if (req) { if (req.running == 0) { ge('req'+req.num).parentNode.removeChild(ge('req'+req.num)); reqs[reqnum] = null; } else { newreqs[reqnum] = req; } } } reqs = newreqs; document.getElementsByTagName('head')[0].appendChild( ce('script', {id: id, type: 'text/javascript', src: ((!/^http:\/\//i.test(c) && !/^\//i.test(c)) ? base_domain : '') + c + (css_versions[new_id] ? ('?' + css_versions[new_id]) : '')}) ); } function destroy() { if (reqs[this.num]) { reqs[this.num].running = 0; } } function addCss(c) { var new_id = c.substr(c.indexOf('/')+1, c.indexOf('.')-c.indexOf('/')-1)+'_css'; if (!ge(new_id)) { document.getElementsByTagName("head")[0].appendChild( ce('link', {type: 'text/css', rel: 'stylesheet', href: base_domain + c + (css_versions[new_id] ? ('?' + css_versions[new_id]) : ''), id: new_id, media: 'screen'}) ); } } var rateBox; function showRateVotesBox() { if (window.event && (window.event.which == 2 || window.event.button == 1)) { return true; } addCss('css/privacy.css'); addCss('css/wiki.css'); if (rateBox == undefined) { rateBox = new MessageBox( {title: getLang('global_rating_box_header'), bodyStyle: 'padding:0px', width: '480px', progress: 'rateProgress'} ); } rateBox.removeButtons(); rateBox.addButton({ onClick: function() { rateBox.hide(200); }, label: getLang('box_close') }); rateBox.loadContent('rate.php', {'act':'a_get_rate_votes', 'full': 1}, true).show(); return false; } function leftBlockOver(block) { var timer = 'timer', over = 1; if (!block.id) { block = ge('left_hide' + block); over = 0; } if (over || !block.timer) { if (block.showing) { delete block.showing; } else { animate(block, {opacity: over ? 1 : 0.5}, 200); if (over) { block.showing = 1; } } } if (block.timer) { clearTimeout(block.timer); delete block.timer; } } function leftBlockOut(block) { var opacity = 0.5; if (!block.id) { block = ge('left_hide' + block); opacity = 0; } block.timer = setTimeout(function() { animate(block, {opacity: opacity}, 200); delete block.timer; }, 1); } function leftBlockHide(block, hash) { ajax.post('al_index.php', {act: 'hide_block', block: block, hash: hash}); hide('left_block' + block); } function leftAdBlockHide(blockId, url) { var ajax = new Ajax(); ajax.onDone = function(obj, response) { var r = eval('(' + response + ')'); if (r.done) { var box = ge('ad_box' + blockId); var mask = ge('ad_hide_mask' + blockId); if (!box || !mask) return false; mask.timer = setTimeout(function() { animate(mask, {opacity: 1}, 200); delete mask.timer; }, 0); var x = getXY(box), s = getSize(box), btop = 1, bbot = 1; if (box.style.borderTop == '0px') { btop = 0; } if (btop) { s[1] -= btop; } if (bbot) { s[1] -= bbot; } var textH = (mask.firstChild.nextSibling === null) ? 40 : 108; var padtop; if (s[1] < textH + 10) { s[1] = textH + 10; padtop = Math.floor((s[1] - textH) / 2); box.style.height = s[1] - 6 - padtop + 'px'; } var padtop = Math.floor((s[1] - textH) / 2); setStyle(mask, {left: x[0], top: x[1], height: s[1] - padtop, paddingTop: padtop, display: 'block'}); } } ajax.post(url); var hideX = ge('left_hide' + blockId); if (hideX && hideX.parentNode) { hideX.parentNode.removeChild(hideX); } return false; } function parseLatin(text, back){ var outtext = text; var lat1 = ["yo","zh","kh","ts","ch","sch","shch","sh","eh","yu","ya","YO","ZH","KH","TS","CH","SCH","SHCH","SH","EH","YU","YA","'"]; var rus1 = ["¸", "æ", "õ", "ö", "÷", "ù", "ù", "ø", "ý", "þ", "ÿ", "¨", "Æ", "Õ", "Ö", "×", "Ù", "Ù", "Ø", "Ý", "Þ", "ß", "ü"]; for(var i=0;i