(function ($) {
var hasIntrospection = (function () {
_;
}
).toString().indexOf("_") > - 1, emptyBase = function () {

}
, objCreate = Object.create || function (ptp) {
var inheritance = function () {

}
;
inheritance.prototype = ptp;
return new inheritance();
}
, needCheckProps = true, testPropObj = {
toString: ""};
for(var i in testPropObj) {
testPropObj.hasOwnProperty(i) && (needCheckProps = false);
}

var specProps = needCheckProps ? ["toString", "valueOf"] : null;
function override(base, result, add) {
var hasSpecProps = false;
if (needCheckProps)
{
var addList = [];
$.each(specProps,function () {
add.hasOwnProperty(this) && (hasSpecProps = true) && addList.push({
name: this,
val: add[this]});
}
);
if (hasSpecProps)
{
$.each(add,function (name) {
addList.push({
name: name,
val: this});
}
);
add = addList;
}

}

$.each(add,function (name, prop) {
if (hasSpecProps)
{
name = prop.name;
prop = prop.val;
}

if ($.isFunction(prop) && (! hasIntrospection || prop.toString().indexOf(".__base") > - 1))
{
var baseMethod = base[name] || function () {

}
;
result[name] = function () {
var baseSaved = this.__base;
this.__base = baseMethod;
var result = prop.apply(this,arguments);
this.__base = baseSaved;
return result;
}
;
}
 else
{
result[name] = prop;
}

}
);
}

$.inherit = function () {
var args = arguments, hasBase = $.isFunction(args[0]), base = hasBase ? args[0] : emptyBase, props = args[hasBase ? 1 : 0] || {
}, staticProps = args[hasBase ? 2 : 1], result = props.__constructor || hasBase && base.prototype.__constructor ? function () {
return this.__constructor.apply(this,arguments);
}
 : function () {

}
;
if (! hasBase)
{
result.prototype = props;
result.prototype.__self = result.prototype.constructor = result;
return $.extend(result,staticProps);
}

$.extend(result,base);
var basePtp = base.prototype, resultPtp = result.prototype = objCreate(basePtp);
resultPtp.__self = resultPtp.constructor = result;
override(basePtp,resultPtp,props);
staticProps && override(base,result,staticProps);
return result;
}
;
$.inheritSelf = function (base, props, staticProps) {
var basePtp = base.prototype;
override(basePtp,basePtp,props);
staticProps && override(base,base,staticProps);
return base;
}
;
}
)(jQuery);
;
(function ($) {
var counter = 0, expando = "__" + + new Date(), get = function () {
return "uniq" + ++counter;
}
;
$.identify = function (obj, onlyGet) {
if (! obj)
return get();
var key = "uniqueID" in obj ? "uniqueID" : expando;
return onlyGet || key in obj ? obj[key] : (obj[key] = get());
}
;
}
)(jQuery);
;
(function ($) {
$.isEmptyObject || ($.isEmptyObject = function (obj) {
for(var i in obj) return false;
return true;
}
);
}
)(jQuery);
;
(function ($) {
$.extend({
debounce: function (fn, timeout, invokeAsap, ctx) {
if (arguments.length == 3 && typeof invokeAsap != "boolean")
{
ctx = invokeAsap;
invokeAsap = false;
}

var timer;
return function () {
var args = arguments;
ctx = ctx || this;
invokeAsap && ! timer && fn.apply(ctx,args);
clearTimeout(timer);
timer = setTimeout(function () {
invokeAsap || fn.apply(ctx,args);
timer = null;
}
,timeout);
}
;
}
,
throttle: function (fn, timeout, ctx) {
var timer, args, needInvoke;
return function () {
args = arguments;
needInvoke = true;
ctx = ctx || this;
timer || (function () {
if (needInvoke)
{
fn.apply(ctx,args);
needInvoke = false;
timer = setTimeout(arguments.callee,timeout);
}
 else
{
timer = null;
}

}
)();
}
;
}
});
}
)(jQuery);
;
(function ($) {
var storageExpando = "__" + + new Date() + "storage", getFnId = function (fn, ctx) {
return $.identify(fn) + (ctx ? $.identify(ctx) : "");
}
, Observable = {
buildEventName: function (e) {
return e;
}
,
on: function (e, data, fn, ctx, _special) {
if (typeof e == "string")
{
if ($.isFunction(data))
{
ctx = fn;
fn = data;
data = undefined;
}

var id = getFnId(fn,ctx), storage = this[storageExpando] || (this[storageExpando] = {
}), eList = e.split(" "), i = 0, eStorage;
while (e = eList[i++]) {
e = this.buildEventName(e);
eStorage = storage[e] || (storage[e] = {
ids: {
},
list: {
}});
if (! (id in eStorage.ids))
{
var list = eStorage.list, item = {
fn: fn,
data: data,
ctx: ctx,
special: _special};
if (list.last)
{
list.last.next = item;
item.prev = list.last;
}
 else
{
list.first = item;
}

eStorage.ids[id] = list.last = item;
}

}

}
 else
{
var _this = this;
$.each(e,function (e, fn) {
_this.on(e,fn,data,_special);
}
);
}

return this;
}
,
onFirst: function (e, data, fn, ctx) {
return this.on(e,data,fn,ctx,{
one: true});
}
,
un: function (e, fn, ctx) {
if (typeof e == "string" || typeof e == "undefined")
{
var storage = this[storageExpando];
if (storage)
{
if (e)
{
var eList = e.split(" "), i = 0, eStorage;
while (e = eList[i++]) {
e = this.buildEventName(e);
if (eStorage = storage[e])
{
if (fn)
{
var id = getFnId(fn,ctx), ids = eStorage.ids;
if (id in ids)
{
var list = eStorage.list, item = ids[id], prev = item.prev, next = item.next;
if (prev)
{
prev.next = next;
}
 else
if (item === list.first)
{
list.first = next;
}

if (next)
{
next.prev = prev;
}
 else
if (item === list.last)
{
list.last = prev;
}

delete ids[id];
}

}
 else
{
delete this[storageExpando][e];
}

}

}

}
 else
{
delete this[storageExpando];
}

}

}
 else
{
var _this = this;
$.each(e,function (e, fn) {
_this.un(e,fn,ctx);
}
);
}

return this;
}
,
trigger: function (e, data) {
var _this = this, storage = _this[storageExpando], rawType;
typeof e === "string" ? (e = $.Event(_this.buildEventName(rawType = e))) : (e.type = _this.buildEventName(rawType = e.type));
e.target || (e.target = _this);
if (storage && (storage = storage[e.type]))
{
var item = storage.list.first, ret;
while (item) {
e.data = item.data;
ret = item.fn.call(item.ctx || _this,e,data);
if (typeof ret !== "undefined")
{
e.result = ret;
if (ret === false)
{
e.preventDefault();
e.stopPropagation();
}

}

item.special && item.special.one && _this.un(rawType,item.fn,item.ctx);
item = item.next;
}

}

return this;
}
};
$.observable = $.inherit(Observable,Observable);
}
)(jQuery);
;
(function ($, undefined) {
var afterCurrentEventFns = [], blocks = {
}, channels = {
};
function buildModFnName(elemName, modName, modVal) {
return (elemName ? "__elem_" + elemName : "") + "__mod" + (modName ? "_" + modName : "") + (modVal ? "_" + modVal : "");
}

function modFnsToProps(modFns, props, elemName) {
$.isFunction(modFns) ? (props[buildModFnName(elemName,"*","*")] = modFns) : $.each(modFns,function (modName, modFn) {
$.isFunction(modFn) ? (props[buildModFnName(elemName,modName,"*")] = modFn) : $.each(modFn,function (modVal, modFn) {
props[buildModFnName(elemName,modName,modVal)] = modFn;
}
);
}
);
}

function buildCheckMod(modName, modVal) {
return modVal ? Array.isArray(modVal) ? function (block) {
var i = 0, len = modVal.length;
while (i < len) if (block.hasMod(modName,modVal[i++]))
return true;
return false;
}
 : function (block) {
return block.hasMod(modName,modVal);
}
 : function (block) {
return block.hasMod(modName);
}
;
}

this.BEM = $.inherit($.observable,{
__constructor: function (mods, params, initImmediately) {
var _this = this;
_this._modCache = mods || {
};
_this._processingMods = {
};
_this._params = params;
_this.params = null;
initImmediately !== false ? _this._init() : _this.afterCurrentEvent(function () {
_this._init();
}
);
}
,
_init: function () {
if (! this._initing && ! this.hasMod("js","inited"))
{
this._initing = true;
if (! this.params)
{
this.params = $.extend(this.getDefaultParams(),this._params);
delete this._params;
}

this.setMod("js","inited");
delete this._initing;
this.hasMod("js","inited") && this.trigger("init");
}

return this;
}
,
changeThis: function (fn, ctx) {
return fn.bind(ctx || this);
}
,
afterCurrentEvent: function (fn, ctx) {
this.__self.afterCurrentEvent(this.changeThis(fn,ctx));
}
,
trigger: function (e, data) {
this.__base(e = this.buildEvent(e),data).__self.trigger(e,data);
return this;
}
,
buildEvent: function (e) {
typeof e == "string" && (e = $.Event(e));
e.block = this;
return e;
}
,
hasMod: function (elem, modName, modVal) {
var len = arguments.length, invert = false;
if (len == 1)
{
modVal = "";
modName = elem;
elem = undefined;
invert = true;
}
 else
if (len == 2)
{
if (typeof elem == "string")
{
modVal = modName;
modName = elem;
elem = undefined;
}
 else
{
modVal = "";
invert = true;
}

}

var res = this.getMod(elem,modName) === modVal;
return invert ? ! res : res;
}
,
getMod: function (elem, modName) {
var type = typeof elem;
if (type === "string" || type === "undefined")
{
modName = elem || modName;
var modCache = this._modCache;
return modName in modCache ? modCache[modName] : (modCache[modName] = this._extractModVal(modName));
}

return this._getElemMod(modName,elem);
}
,
_getElemMod: function (modName, elem, elemName) {
return this._extractModVal(modName,elem,elemName);
}
,
getMods: function (elem) {
var hasElem = elem && typeof elem != "string", _this = this, modNames = [].slice.call(arguments,hasElem ? 1 : 0), res = _this._extractMods(modNames,hasElem ? elem : undefined);
if (! hasElem)
{
modNames.length ? modNames.forEach(function (name) {
_this._modCache[name] = res[name];
}
) : (_this._modCache = res);
}

return res;
}
,
setMod: function (elem, modName, modVal) {
if (typeof modVal == "undefined")
{
modVal = modName;
modName = elem;
elem = undefined;
}

var _this = this;
if (! elem || elem[0])
{
var modId = (elem && elem[0] ? $.identify(elem[0]) : "") + "_" + modName;
if (this._processingMods[modId])
return _this;
var elemName, curModVal = elem ? _this._getElemMod(modName,elem,elemName = _this.__self._extractElemNameFrom(elem)) : _this.getMod(modName);
if (curModVal === modVal)
return _this;
this._processingMods[modId] = true;
var needSetMod = true, modFnParams = [modName, modVal, curModVal];
elem && modFnParams.unshift(elem);
[["*", "*"], [modName, "*"], [modName, modVal]].forEach(function (mod) {
needSetMod = _this._callModFn(elemName,mod[0],mod[1],modFnParams) !== false && needSetMod;
}
);
! elem && needSetMod && (_this._modCache[modName] = modVal);
needSetMod && _this._afterSetMod(modName,modVal,curModVal,elem,elemName);
delete this._processingMods[modId];
}

return _this;
}
,
_afterSetMod: function (modName, modVal, oldModVal, elem, elemName) {

}
,
toggleMod: function (elem, modName, modVal1, modVal2, condition) {
if (typeof elem == "string")
{
condition = modVal2;
modVal2 = modVal1;
modVal1 = modName;
modName = elem;
elem = undefined;
}

if (typeof modVal2 == "undefined")
{
modVal2 = "";
}
 else
if (typeof modVal2 == "boolean")
{
condition = modVal2;
modVal2 = "";
}

var modVal = this.getMod(elem,modName);
(modVal == modVal1 || modVal == modVal2) && this.setMod(elem,modName,typeof condition === "boolean" ? condition ? modVal1 : modVal2 : this.hasMod(elem,modName,modVal1) ? modVal2 : modVal1);
return this;
}
,
delMod: function (elem, modName) {
if (! modName)
{
modName = elem;
elem = undefined;
}

return this.setMod(elem,modName,"");
}
,
_callModFn: function (elemName, modName, modVal, modFnParams) {
var modFnName = buildModFnName(elemName,modName,modVal);
return this[modFnName] ? this[modFnName].apply(this,modFnParams) : undefined;
}
,
_extractModVal: function (modName, elem) {
return "";
}
,
_extractMods: function (modNames, elem) {
return {
};
}
,
channel: function (id, drop) {
return this.__self.channel(id,drop);
}
,
getDefaultParams: function () {
return {
};
}
,
del: function (obj) {
var args = [].slice.call(arguments);
typeof obj == "string" && args.unshift(this);
this.__self.del.apply(this.__self,args);
return this;
}
,
destruct: function () {

}
},{
_name: "i-bem",
blocks: blocks,
decl: function (decl, props, staticProps) {
if (typeof decl == "string")
decl = {
block: decl}; else
if (decl.name)
{
decl.block = decl.name;
}

if (decl.baseBlock && ! blocks[decl.baseBlock])
throw "baseBlock \"" + decl.baseBlock + "\" for \"" + decl.block + "\" is undefined";
props || (props = {
});
if (props.onSetMod)
{
modFnsToProps(props.onSetMod,props);
delete props.onSetMod;
}

if (props.onElemSetMod)
{
$.each(props.onElemSetMod,function (elemName, modFns) {
modFnsToProps(modFns,props,elemName);
}
);
delete props.onElemSetMod;
}

var baseBlock = blocks[decl.baseBlock || decl.block] || this;
if (decl.modName)
{
var checkMod = buildCheckMod(decl.modName,decl.modVal);
$.each(props,function (name, prop) {
$.isFunction(prop) && (props[name] = function () {
var method;
if (checkMod(this))
{
method = prop;
}
 else
{
var baseMethod = baseBlock.prototype[name];
baseMethod && baseMethod !== props[name] && (method = this.__base);
}

return method ? method.apply(this,arguments) : undefined;
}
);
}
);
}

if (staticProps && typeof staticProps.live === "boolean")
{
var live = staticProps.live;
staticProps.live = function () {
return live;
}
;
}

var block;
decl.block == baseBlock._name ? (block = $.inheritSelf(baseBlock,props,staticProps))._processLive(true) : ((block = blocks[decl.block] = $.inherit(baseBlock,props,staticProps))._name = decl.block);
return block;
}
,
_processLive: function (heedLive) {
return false;
}
,
create: function (block, params) {
typeof block == "string" && (block = {
block: block});
return new blocks[block.block](block.mods, params);
}
,
getName: function () {
return this._name;
}
,
_extractElemNameFrom: function (elem) {

}
,
afterCurrentEvent: function (fn, ctx) {
afterCurrentEventFns.push({
fn: fn,
ctx: ctx}) == 1 && setTimeout(this._runAfterCurrentEventFns,0);
}
,
_runAfterCurrentEventFns: function () {
var fnsLen = afterCurrentEventFns.length;
if (fnsLen)
{
var fnObj, fnsCopy = afterCurrentEventFns.splice(0,fnsLen);
while (fnObj = fnsCopy.shift()) fnObj.fn.call(fnObj.ctx || this);
}

}
,
changeThis: function (fn, ctx) {
return fn.bind(ctx || this);
}
,
del: function (obj) {
var delInThis = typeof obj == "string", i = delInThis ? 0 : 1, len = arguments.length;
delInThis && (obj = this);
while (i < len) delete obj[arguments[i++]];
return this;
}
,
channel: function (id, drop) {
if (typeof id == "boolean")
{
drop = id;
id = undefined;
}

id || (id = "default");
if (drop)
{
if (channels[id])
{
channels[id].un();
delete channels[id];
}

return;
}

return channels[id] || (channels[id] = new $.observable());
}
});
}
)(jQuery);
;
(function () {
Object.keys || (Object.keys = function (obj) {
var res = [];
for(var i in obj) obj.hasOwnProperty(i) && res.push(i);
return res;
}
);
}
)();
;
(function () {
var ptp = Array.prototype, toStr = Object.prototype.toString, methods = {
indexOf: function (item, fromIdx) {
fromIdx = + (fromIdx || 0);
var t = this, len = t.length;
if (len > 0 && fromIdx < len)
{
fromIdx = fromIdx < 0 ? Math.ceil(fromIdx) : Math.floor(fromIdx);
fromIdx < - len && (fromIdx = 0);
fromIdx < 0 && (fromIdx = fromIdx + len);
while (fromIdx < len) {
if (fromIdx in t && t[fromIdx] === item)
return fromIdx;
++fromIdx;
}

}

return - 1;
}
,
forEach: function (callback, ctx) {
var i = - 1, t = this, len = t.length;
while (++i < len) i in t && (ctx ? callback.call(ctx,t[i],i,t) : callback(t[i],i,t));
}
,
map: function (callback, ctx) {
var i = - 1, t = this, len = t.length, res = new Array(len);
while (++i < len) i in t && (res[i] = ctx ? callback.call(ctx,t[i],i,t) : callback(t[i],i,t));
return res;
}
,
filter: function (callback, ctx) {
var i = - 1, t = this, len = t.length, res = [];
while (++i < len) i in t && (ctx ? callback.call(ctx,t[i],i,t) : callback(t[i],i,t)) && res.push(t[i]);
return res;
}
,
reduce: function (callback, initialVal) {
var i = - 1, t = this, len = t.length, res;
if (arguments.length < 2)
{
while (++i < len) {
if (i in t)
{
res = t[i];
break;
}

}

}
 else
{
res = initialVal;
}

while (++i < len) i in t && (res = callback(res,t[i],i,t));
return res;
}
,
some: function (callback, ctx) {
var i = - 1, t = this, len = t.length;
while (++i < len) if (i in t && (ctx ? callback.call(ctx,t[i],i,t) : callback(t[i],i,t)))
return true;
return false;
}
,
every: function (callback, ctx) {
var i = - 1, t = this, len = t.length;
while (++i < len) if (i in t && ! (ctx ? callback.call(ctx,t[i],i,t) : callback(t[i],i,t)))
return false;
return true;
}
};
for(var name in methods) ptp[name] || (ptp[name] = methods[name]);
Array.isArray || (Array.isArray = function (obj) {
return toStr.call(obj) === "[object Array]";
}
);
}
)();
;
(function () {
var slice = Array.prototype.slice;
Function.prototype.bind || (Function.prototype.bind = function (ctx) {
var fn = this, args = slice.call(arguments,1);
return function () {
return fn.apply(ctx,args.concat(slice.call(arguments)));
}
;
}
);
}
)();
;
(function (BEM, $, undefined) {
var MOD_DELIM = "_", ELEM_DELIM = "__", NAME_PATTERN = "[a-zA-Z0-9-]+";
function buildModPostfix(modName, modVal, buffer) {
buffer.push(MOD_DELIM,modName,MOD_DELIM,modVal);
}

function buildBlockClass(name, modName, modVal, buffer) {
buffer.push(name);
modVal && buildModPostfix(modName,modVal,buffer);
}

function buildElemClass(block, name, modName, modVal, buffer) {
buildBlockClass(block,undefined,undefined,buffer);
buffer.push(ELEM_DELIM,name);
modVal && buildModPostfix(modName,modVal,buffer);
}

BEM.INTERNAL = {
NAME_PATTERN: NAME_PATTERN,
MOD_DELIM: MOD_DELIM,
ELEM_DELIM: ELEM_DELIM,
buildModPostfix: function (modName, modVal, buffer) {
var res = buffer || [];
buildModPostfix(modName,modVal,res);
return buffer ? res : res.join("");
}
,
buildClass: function (block, elem, modName, modVal, buffer) {
var typeOf = typeof modName;
if (typeOf == "string")
{
if (typeof modVal != "string" && typeof modVal != "number")
{
buffer = modVal;
modVal = modName;
modName = elem;
elem = undefined;
}

}
 else
if (typeOf != "undefined")
{
buffer = modName;
modName = undefined;
}
 else
if (elem && typeof elem != "string")
{
buffer = elem;
elem = undefined;
}

if (! (elem || modName || buffer))
{
return block;
}

var res = buffer || [];
elem ? buildElemClass(block,elem,modName,modVal,res) : buildBlockClass(block,modName,modVal,res);
return buffer ? res : res.join("");
}
,
buildClasses: function (block, elem, mods, buffer) {
if (elem && typeof elem != "string")
{
buffer = mods;
mods = elem;
elem = undefined;
}

var res = buffer || [];
elem ? buildElemClass(block,elem,undefined,undefined,res) : buildBlockClass(block,undefined,undefined,res);
mods && $.each(mods,function (modName, modVal) {
if (modVal)
{
res.push(" ");
elem ? buildElemClass(block,elem,modName,modVal,res) : buildBlockClass(block,modName,modVal,res);
}

}
);
return buffer ? res : res.join("");
}
};
}
)(BEM,jQuery);
;
jQuery.cookie = function (name, value, options) {
if (typeof value != "undefined")
{
options = options || {
};
if (value === null)
{
value = "";
options.expires = - 1;
}

var expires = "";
if (options.expires && (typeof options.expires == "number" || options.expires.toUTCString))
{
var date;
if (typeof options.expires == "number")
{
date = new Date();
date.setTime(date.getTime() + options.expires * 24 * 60 * 60 * 1000);
}
 else
{
date = options.expires;
}

expires = "; expires=" + date.toUTCString();
}

var path = options.path ? "; path=" + options.path : "";
var domain = options.domain ? "; domain=" + options.domain : "";
var secure = options.secure ? "; secure" : "";
document.cookie = [name, "=", encodeURIComponent(value), expires, path, domain, secure].join("");
}
 else
{
var cookieValue = null;
if (document.cookie && document.cookie != "")
{
var cookies = document.cookie.split(";");
for (var i = 0;i < cookies.length;i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0,name.length + 1) == name + "=")
{
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}

}

}

return cookieValue;
}

}
;
;
(function (BEM, $, undefined) {
var INTERNAL = BEM.INTERNAL, ELEM_DELIM = INTERNAL.ELEM_DELIM, SHORT_TAGS = {
area: 1,
base: 1,
br: 1,
col: 1,
command: 1,
embed: 1,
hr: 1,
img: 1,
input: 1,
keygen: 1,
link: 1,
meta: 1,
param: 1,
source: 1,
wbr: 1}, buildClass = INTERNAL.buildClass, buildClasses = INTERNAL.buildClasses, decls = {
};
function addPropToDecl(decl, name, fn) {
(decl[name] || (decl[name] = [])).unshift(fn);
}

function buildDeclFn(fn, desc) {
return desc.modName ? function (ctx) {
(ctx._curBlock.mods || {
})[desc.modName] === desc.modVal && fn(ctx);
}
 : fn;
}

function join(a, b) {
var isArrayB = $.isArray(b), res;
$.isArray(a) ? isArrayB ? (res = a.concat(b)) : (res = a).push(b) : isArrayB ? (res = b).unshift(a) : (res = [a, b]);
return res;
}

var attrEscapes = {
"\"": "&quot;",
"&": "&amp;",
"<": "&lt;",
">": "&gt;"}, attrEscapesRE = /["&<>]/g;
function escapeAttr(attrVal) {
return attrVal.replace(attrEscapesRE,function (needToEscape) {
return attrEscapes[needToEscape];
}
);
}

BEM.HTML = {
decl: function (desc, props) {
typeof desc == "string" && (desc = {
block: desc});
desc.name && (desc.block = desc.name);
var decl = decls[desc.block] || (decls[desc.block] = {
});
props.onBlock && addPropToDecl(decl,"_block",buildDeclFn(props.onBlock,desc));
if (props.onElem)
{
$.isFunction(props.onElem) ? addPropToDecl(decl,"_elem",buildDeclFn(props.onElem,desc)) : $.each(props.onElem,function (elem, fn) {
addPropToDecl(decl,"_elem" + (elem === "*" ? "" : ELEM_DELIM + elem),buildDeclFn(fn,desc));
}
);
}

}
,
build: function (params) {
var builder = new this.Ctx(params);
builder._buildAll();
return builder._flush();
}
,
Ctx: $.inherit({
__constructor: function (params) {
this._buffer = [];
this._params = params;
this._tParams = null;
this._tParamsChanges = null;
this._curBlock = undefined;
}
,
pos: function () {
return this._params._pos;
}
,
isFirst: function () {
return this._params._pos === 1;
}
,
isLast: function () {
var params = this._params;
return params._pos === params._siblingsCount;
}
,
params: function (params) {
var _this = this;
if (typeof params == "undefined")
return _this._params;
_this._params = params;
return _this;
}
,
param: function (name, val, force, needExtend) {
var _this = this, params = _this._params;
if (typeof val == "undefined")
return params[name];
if (force || ! (name in params))
{
params[name] = val;
}
 else
if (needExtend)
{
params[name] = $.extend(val,params[name]);
}

return _this;
}
,
attrs: function (val, force) {
return this.param("attrs",val,force,true);
}
,
attr: function (name, val, force) {
var _this = this;
if (typeof val == "undefined")
return (_this._params.attrs || {
})[name];
var attrs = _this._params.attrs;
attrs ? (force || ! (name in attrs)) && (attrs[name] = val) : ((_this._params.attrs = {
})[name] = val);
return _this;
}
,
tag: function (val, force) {
return this.param("tag",val,force);
}
,
cls: function (val, force) {
return this.param("cls",val,force);
}
,
mods: function (val, force) {
return this.param("mods",val,force,true);
}
,
mod: function (name, val, force) {
var _this = this;
if (typeof val == "undefined")
return (_this._params.mods || {
})[name];
var mods = _this._params.mods;
mods ? (force || ! (name in mods)) && (mods[name] = val) : ((_this._params.mods = {
})[name] = val);
return _this;
}
,
mix: function (val, force) {
var _this = this, params = _this._params;
if (typeof val == "undefined")
return params.mix;
if (force || ! ("mix" in params))
{
params.mix = val;
}
 else
{
params.mix = params.mix.concat(val);
}

return _this;
}
,
js: function (val) {
return this.param("js",val);
}
,
content: function (val, force) {
return this.param("content",val,force);
}
,
wrapContent: function (obj) {
var _this = this, params = _this._params;
obj.content = params.content;
params.content = obj;
return _this;
}
,
beforeContent: function (obj) {
var _this = this, params = _this._params;
params.content = join(obj,params.content);
return _this;
}
,
afterContent: function (obj) {
var _this = this, params = _this._params;
params.content = join(params.content,obj);
return _this;
}
,
wrap: function (obj) {
var _this = this, params = _this._params;
obj.block || (obj._curBlock = _this._curBlock);
obj.content = params._wrapper ? params._wrapper : params;
params._wrapper = obj;
return _this;
}
,
tParam: function (name, val) {
var _this = this, tParams = _this._tParams || (_this._tParams = {
});
if (typeof val == "undefined")
return tParams[name];
var tParamsChanges = _this._tParamsChanges || (_this._tParamsChanges = {
});
name in tParamsChanges || (tParamsChanges[name] = tParams[name]);
tParams[name] = val;
return _this;
}
,
generateId: function () {
return $.identify();
}
,
stop: function () {
this._params._isStopped = true;
}
,
_buildAll: function () {
var _this = this, buffer = _this._buffer, params = _this._params, paramsType = typeof params;
if (paramsType == "string" || paramsType == "number")
{
buffer.push(params);
}
 else
if ($.isArray(params))
{
var i = 0, len = params.length, currParams, currParamsType;
while (i < len) {
_this._params = currParams = params[i++];
currParamsType = typeof currParams;
if (currParamsType == "string" || currParamsType == "number")
{
buffer.push(currParams);
}
 else
if (currParams)
{
currParams._pos = i;
currParams._siblingsCount = len;
_this._buildByDecl();
}

}

}
 else
if (params)
{
_this._params._pos = _this._params._siblingsCount = 1;
_this._buildByDecl();
}

}
,
_build: function () {
var _this = this, buffer = _this._buffer, params = _this._params, tag = params.tag || "div", jsParams, isBEM = params.block || params.elem, curBlock = isBEM && (params.block || _this._curBlock.block), addInitingCls = false;
if (params.js)
{
(jsParams = {
})[buildClass(curBlock,params.elem)] = params.js === true ? {
} : params.js;
addInitingCls = ! params.elem;
}

buffer.push("<",tag);
if (isBEM || params.cls)
{
buffer.push(" class=\"");
if (isBEM)
{
buildClasses(curBlock,params.elem,params.mods,buffer);
params.mix && $.each(params.mix,function (i, mix) {
if (mix)
{
buffer.push(" ");
buildClasses(mix.block,mix.elem,mix.mods,buffer);
if (mix.js)
{
(jsParams || (jsParams = {
}))[buildClass(mix.block,mix.elem)] = mix.js === true ? {
} : mix.js;
addInitingCls || (addInitingCls = ! mix.elem);
}

}

}
);
}

params.cls && buffer.push(isBEM ? " " : "",params.cls);
addInitingCls && buffer.push(" i-bem");
buffer.push("\"");
}

jsParams && buffer.push(" onclick=\"return ",escapeAttr(JSON.stringify(jsParams)),"\"");
params.attrs && $.each(params.attrs,function (name, val) {
typeof val != "undefined" && val !== null && val !== false && buffer.push(" ",name,"=\"",val.toString().replace(/"/g,"&quot;"),"\"");
}
);
if (SHORT_TAGS[tag])
{
buffer.push("/>");
}
 else
{
buffer.push(">");
if (typeof params.content != "undefined")
{
_this._params = params.content;
_this._buildAll();
}

buffer.push("</",tag,">");
}

}
,
_flush: function () {
var res = this._buffer.join("");
delete this._buffer;
return res;
}
,
_buildByDecl: function () {
var _this = this, currBlock = _this._curBlock, params = _this._params;
params._curBlock && (_this._curBlock = params._curBlock);
params.block && (_this._curBlock = params);
if (! params._wrapper)
{
if (params.block || params.elem)
{
var decl = decls[_this._curBlock.block];
if (decl)
{
var fns;
if (params.elem)
{
fns = decl["_elem" + ELEM_DELIM + params.elem];
decl._elem && (fns = fns ? fns.concat(decl._elem) : decl._elem);
}
 else
{
fns = decl._block;
}

if (fns)
{
var i = 0, fn;
while (fn = fns[i++]) {
fn(_this);
if (params._isStopped)
break;
}

}

}

}

if (params._wrapper)
{
params._curBlock = _this._curBlock;
_this._params = params._wrapper;
return _this._buildAll();
}

}

var tParamsChanges = _this._tParamsChanges;
_this._tParamsChanges = null;
_this._build();
_this._curBlock = currBlock;
if (tParamsChanges)
{
var tParams = _this._tParams;
$.each(tParamsChanges,function (name, val) {
typeof val == "undefined" ? delete tParams[name] : (tParams[name] = val);
}
);
}

}
})};
}
)(BEM,jQuery);
;
(function (undefined) {
if (window.JSON)
return;
var _toString = Object.prototype.toString, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, meta = {
"\b": "\\b",
"\t": "\\t",
"\n": "\\n",
"\f": "\\f",
"\r": "\\r",
"\"": "\\\"",
"\\": "\\\\"}, stringify;
window.JSON = {
stringify: stringify = function (val) {
if (val === null)
{
return "null";
}

if (typeof val === "undefined")
{
return undefined;
}

switch (_toString.call(val)) {
case "[object String]":
escapable.lastIndex = 0;
return "\"" + (escapable.test(val) ? val.replace(escapable,function (a) {
var c = meta[a];
return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(- 4);
}
) : val) + "\"";
case "[object Number]":

case "[object Boolean]":
return "" + val;
case "[object Array]":
var res = "[", i = 0, len = val.length, strVal;
while (i < len) {
strVal = stringify(val[i]);
res += (i++ ? "," : "") + (typeof strVal === "undefined" ? "null" : strVal);
}

return res + "]";
case "[object Object]":
if (_toString.call(val.toJSON) === "[object Function]")
{
return stringify(val.toJSON());
}

var res = "{", i = 0, strVal;
for(var key in val) {
if (val.hasOwnProperty(key))
{
strVal = stringify(val[key]);
typeof strVal !== "undefined" && (res += (i++ ? "," : "") + "\"" + key + "\":" + strVal);
}

}

return res + "}";
default:
return undefined;
}

}
};
}
)();
;
(function (BEM, $, undefined) {
var win = $(window), doc = $(document), uniqIdToDomElems = {
}, uniqIdToBlock = {
}, domElemToParams = {
}, liveEventCtxStorage = {
}, liveClassEventStorage = {
}, blocks = BEM.blocks, INTERNAL = BEM.INTERNAL, NAME_PATTERN = INTERNAL.NAME_PATTERN, MOD_DELIM = INTERNAL.MOD_DELIM, ELEM_DELIM = INTERNAL.ELEM_DELIM, buildModPostfix = INTERNAL.buildModPostfix, buildClass = INTERNAL.buildClass;
function init(domElem, uniqInitId) {
var domNode = domElem[0];
$.each(getParams(domNode),function (blockName, params) {
processParams(params,domNode,blockName,uniqInitId);
var block = uniqIdToBlock[params.uniqId];
if (block)
{
if (block.domElem.index(domNode) < 0)
{
block.domElem = block.domElem.add(domElem);
$.extend(block._params,params);
}

}
 else
{
initBlock(blockName,domElem,params);
}

}
);
}

function initBlock(blockName, domElem, params, forceLive, callback) {
if (typeof params == "boolean")
{
callback = forceLive;
forceLive = params;
params = undefined;
}

var domNode = domElem[0];
params = processParams(params || getParams(domNode)[blockName],domNode,blockName);
var uniqId = params.uniqId;
if (uniqIdToBlock[uniqId])
{
return uniqIdToBlock[uniqId]._init();
}

uniqIdToDomElems[uniqId] = uniqIdToDomElems[uniqId] ? uniqIdToDomElems[uniqId].add(domElem) : domElem;
var parentDomNode = domNode.parentNode;
if (! parentDomNode || parentDomNode.nodeType === 11)
{
$.unique(uniqIdToDomElems[uniqId]);
}

var blockClass = blocks[blockName] || DOM.decl(blockName,{
},{
live: true});
if (! (blockClass._liveInitable = ! ! blockClass._processLive()) || forceLive || params.live === false)
{
var block = new blockClass(uniqIdToDomElems[uniqId], params, ! ! forceLive);
delete uniqIdToDomElems[uniqId];
callback && callback.apply(block,Array.prototype.slice.call(arguments,4));
return block;
}

}

function processParams(params, domNode, blockName, uniqInitId) {
(params || (params = {
})).uniqId || (params.uniqId = (params.id ? blockName + "-id-" + params.id : $.identify()) + (uniqInitId || $.identify()));
var domUniqId = $.identify(domNode), domParams = domElemToParams[domUniqId] || (domElemToParams[domUniqId] = {
});
domParams[blockName] || (domParams[blockName] = params);
return params;
}

function findDomElem(ctx, selector, excludeSelf) {
var res = ctx.find(selector);
return excludeSelf ? res : res.add(ctx.filter(selector));
}

function getParams(domNode) {
var uniqId = $.identify(domNode);
return domElemToParams[uniqId] || (domElemToParams[uniqId] = extractParams(domNode));
}

function extractParams(domNode) {
var fn = domNode.onclick || domNode.ondblclick;
if (! fn && domNode.tagName.toLowerCase() == "body")
{
var elem = $(domNode), attr = elem.attr("onclick") || elem.attr("ondblclick");
attr && (fn = Function(attr));
}

return fn ? fn() : {
};
}

function cleanupDomNode(domNode) {
delete domElemToParams[$.identify(domNode)];
}

function removeDomNodeFromBlock(block, domNode) {
block.domElem.length === 1 ? block.destruct(true) : (block.domElem = block.domElem.not(domNode));
}

function getClientNode() {
return doc[0][$.support.boxModel ? "documentElement" : "body"];
}

$.fn.bem = function (blockName, params) {
return initBlock(blockName,this,params,true);
}
;
var DOM = BEM.DOM = BEM.decl("i-bem__dom",{
__constructor: function (domElem, params, initImmediately) {
var _this = this;
_this.domElem = domElem;
_this._eventNameCache = {
};
_this._elemCache = {
};
uniqIdToBlock[_this._uniqId = params.uniqId || $.identify(_this)] = _this;
_this._needSpecialUnbind = false;
_this.__base(null,params,initImmediately);
}
,
findBlocksInside: function (elem, block) {
return this._findBlocks("find",elem,block);
}
,
findBlockInside: function (elem, block) {
return this._findBlocks("find",elem,block,true);
}
,
findBlocksOutside: function (elem, block) {
return this._findBlocks("parents",elem,block);
}
,
findBlockOutside: function (elem, block) {
return this._findBlocks("closest",elem,block)[0] || null;
}
,
findBlocksOn: function (elem, block) {
return this._findBlocks("",elem,block);
}
,
findBlockOn: function (elem, block) {
return this._findBlocks("",elem,block,true);
}
,
_findBlocks: function (select, elem, block, onlyFirst) {
if (! block)
{
block = elem;
elem = undefined;
}

var ctxElem = elem ? typeof elem == "string" ? this.findElem(elem) : elem : this.domElem, isSimpleBlock = typeof block == "string", blockName = isSimpleBlock ? block : block.block || block.blockName, selector = "." + (isSimpleBlock ? buildClass(blockName) : buildClass(blockName,block.modName,block.modVal)) + (onlyFirst ? ":first" : ""), domElems = ctxElem.filter(selector);
select && (domElems = domElems.add(ctxElem[select](selector)));
if (onlyFirst)
{
return domElems[0] ? initBlock(blockName,domElems.eq(0),true) : null;
}

var res = [], uniqIds = {
};
$.each(domElems,function (i, domElem) {
var block = initBlock(blockName,$(domElem),true);
if (! uniqIds[block._uniqId])
{
uniqIds[block._uniqId] = true;
res.push(block);
}

}
);
return res;
}
,
bindToDomElem: function (domElem, event, fn) {
var _this = this;
fn ? domElem.bind(_this._buildEventName(event),function (e) {
(e.data || (e.data = {
})).domElem = $(this);
return fn.apply(_this,arguments);
}
) : $.each(event,function (event, fn) {
_this.bindToDomElem(domElem,event,fn);
}
);
return _this;
}
,
bindToDoc: function (event, fn) {
this._needSpecialUnbind = true;
return this.bindToDomElem(doc,event,fn);
}
,
bindToWin: function (event, fn) {
var _fn = fn, currentHeight, currentWidth;
if (event === "resize")
{
fn = function () {
var height = win.height(), width = win.width();
if (currentHeight !== height || currentWidth !== width)
{
currentHeight = height;
currentWidth = width;
_fn.apply(this,arguments);
}

}
;
}

this._needSpecialUnbind = true;
return this.bindToDomElem(win,event,fn);
}
,
bindTo: function (elem, event, fn) {
if (! event || $.isFunction(event))
{
fn = event;
event = elem;
elem = this.domElem;
}
 else
if (typeof elem == "string")
{
elem = this.elem(elem);
}

return this.bindToDomElem(elem,event,fn);
}
,
unbindFromDomElem: function (domElem, event) {
domElem.unbind(this._buildEventName(event));
return this;
}
,
unbindFromDoc: function (event) {
return this.unbindFromDomElem(doc,event);
}
,
unbindFromWin: function (event) {
return this.unbindFromDomElem(win,event);
}
,
unbindFrom: function (elem, event) {
if (! event)
{
event = elem;
elem = this.domElem;
}
 else
if (typeof elem == "string")
{
elem = this.elem(elem);
}

return this.unbindFromDomElem(elem,event);
}
,
_buildEventName: function (event) {
var _this = this;
return event.indexOf(" ") > 1 ? event.split(" ").map(function (e) {
return _this._buildOneEventName(e);
}
).join(" ") : _this._buildOneEventName(event);
}
,
_buildOneEventName: function (event) {
var _this = this, eventNameCache = _this._eventNameCache;
if (event in eventNameCache)
return eventNameCache[event];
var uniq = "." + _this._uniqId;
if (event.indexOf(".") < 0)
return eventNameCache[event] = event + uniq;
var lego = ".bem_" + _this.__self._name;
return eventNameCache[event] = event.split(".").map(function (e, i) {
return i == 0 ? e + lego : lego + "_" + e;
}
).join("") + uniq;
}
,
trigger: function (e, data) {
this.__base(e = this.buildEvent(e),data).domElem && this._ctxTrigger(e,data);
return this;
}
,
_ctxTrigger: function (e, data) {
var _this = this, storage = liveEventCtxStorage[_this.__self._buildCtxEventName(e.type)], ctxIds = {
};
storage && _this.domElem.each(function () {
var ctx = this, counter = storage.counter;
while (ctx && counter) {
var ctxId = $.identify(ctx,true);
if (ctxId)
{
if (ctxIds[ctxId])
break;
var storageCtx = storage.ctxs[ctxId];
if (storageCtx)
{
$.each(storageCtx,function (uniqId, handler) {
handler.fn.call(handler.ctx || _this,e,data);
}
);
counter--;
}

ctxIds[ctxId] = true;
}

ctx = ctx.parentNode;
}

}
);
}
,
setMod: function (elem, modName, modVal) {
if (elem && typeof modVal != "undefined" && elem.length > 1)
{
var _this = this;
elem.each(function () {
var item = $(this);
item.__bemElemName = elem.__bemElemName;
_this.setMod(item,modName,modVal);
}
);
return _this;
}

return this.__base(elem,modName,modVal);
}
,
_extractModVal: function (modName, elem, elemName) {
var domNode = (elem || this.domElem)[0], matches;
domNode && (matches = domNode.className.match(this.__self._buildModValRE(modName,elemName || elem)));
return matches ? matches[2] : "";
}
,
_extractMods: function (modNames, elem) {
var res = {
}, extractAll = ! modNames.length, countMatched = 0;
((elem || this.domElem)[0].className.match(this.__self._buildModValRE("(" + (extractAll ? NAME_PATTERN : modNames.join("|")) + ")",elem,"g")) || []).forEach(function (className) {
var iModVal = (className = className.trim()).lastIndexOf(MOD_DELIM), iModName = className.substr(0,iModVal - 1).lastIndexOf(MOD_DELIM);
res[className.substr(iModName + 1,iModVal - iModName - 1)] = className.substr(iModVal + 1);
++countMatched;
}
);
countMatched < modNames.length && modNames.forEach(function (modName) {
modName in res || (res[modName] = "");
}
);
return res;
}
,
_afterSetMod: function (modName, modVal, oldModVal, elem, elemName) {
var _self = this.__self, classPrefix = _self._buildModClassPrefix(modName,elemName), classRE = _self._buildModValRE(modName,elemName), needDel = modVal === "";
(elem || this.domElem).each(function () {
var className = this.className;
className.indexOf(classPrefix) > - 1 ? (this.className = className.replace(classRE,needDel ? "" : "$1" + classPrefix + modVal)) : needDel || $(this).addClass(classPrefix + modVal);
}
);
elemName && this.dropElemCache(elemName,modName,oldModVal).dropElemCache(elemName,modName,modVal);
}
,
findElem: function (ctx, names, modName, modVal) {
if (arguments.length % 2)
{
modVal = modName;
modName = names;
names = ctx;
ctx = this.domElem;
}
 else
if (typeof ctx == "string")
{
ctx = this.findElem(ctx);
}

var _self = this.__self, selector = "." + names.split(" ").map(function (name) {
return buildClass(_self._name,name,modName,modVal);
}
).join(",.");
return findDomElem(ctx,selector);
}
,
_elem: function (name, modName, modVal) {
var key = name + buildModPostfix(modName,modVal), res;
if (! (res = this._elemCache[key]))
{
res = this._elemCache[key] = this.findElem(name,modName,modVal);
res.__bemElemName = name;
}

return res;
}
,
elem: function (names, modName, modVal) {
if (modName && typeof modName != "string")
{
modName.__bemElemName = names;
return modName;
}

if (names.indexOf(" ") < 0)
{
return this._elem(names,modName,modVal);
}

var res = $([]), _this = this;
names.split(" ").forEach(function (name) {
res = res.add(_this._elem(name,modName,modVal));
}
);
return res;
}
,
dropElemCache: function (names, modName, modVal) {
if (names)
{
var _this = this, modPostfix = buildModPostfix(modName,modVal);
names.indexOf(" ") < 0 ? delete _this._elemCache[names + modPostfix] : names.split(" ").forEach(function (name) {
delete _this._elemCache[name + modPostfix];
}
);
}
 else
{
this._elemCache = {
};
}

return this;
}
,
elemParams: function (elem) {
var elemName;
if (typeof elem == "string")
{
elemName = elem;
elem = this.elem(elem);
}
 else
{
elemName = this.__self._extractElemNameFrom(elem);
}

return extractParams(elem[0])[buildClass(this.__self.getName(),elemName)] || {
};
}
,
elemify: function (elem, elemName) {
(elem = $(elem)).__bemElemName = elemName;
return elem;
}
,
containsDomElem: function (domElem) {
var res = false;
this.domElem.each(function () {
return ! (res = domElem.parents().andSelf().index(this) > - 1);
}
);
return res;
}
,
buildSelector: function (elem, modName, modVal) {
return this.__self.buildSelector(elem,modName,modVal);
}
,
destruct: function (keepDOM) {
var _this = this, _self = _this.__self;
_this._isDestructing = true;
_this._needSpecialUnbind && _self.doc.add(_self.win).unbind("." + _this._uniqId);
_this.dropElemCache().domElem.each(function (i, domNode) {
var params = getParams(domNode);
$.each(params,function (blockName, blockParams) {
var block = uniqIdToBlock[blockParams.uniqId];
if (block)
{
if (! block._isDestructing)
{
removeDomNodeFromBlock(block,domNode);
delete params[blockName];
}

}
 else
{
delete uniqIdToDomElems[blockParams.uniqId];
}

}
);
$.isEmptyObject(params) && cleanupDomNode(domNode);
}
);
keepDOM || _this.domElem.remove();
delete uniqIdToBlock[_this.un()._uniqId];
delete _this.domElem;
delete _this._elemCache;
_this.__base();
}
},{
scope: null,
doc: doc,
win: win,
_processLive: function (heedLive) {
var _this = this, res = _this._liveInitable;
if ("live" in _this)
{
var noLive = typeof res == "undefined";
if (noLive ^ heedLive)
{
res = _this.live() !== false;
_this.live = function () {

}
;
}

}

return res;
}
,
init: function (ctx, callback, callbackCtx) {
if (! ctx || $.isFunction(ctx))
{
callbackCtx = callback;
callback = ctx;
ctx = doc;
}

var uniqInitId = $.identify();
findDomElem(ctx,".i-bem").each(function () {
init($(this),uniqInitId);
}
);
callback && this.afterCurrentEvent(function () {
callback.call(callbackCtx || this,ctx);
}
);
this._runAfterCurrentEventFns();
return ctx;
}
,
destruct: function (keepDOM, ctx, excludeSelf) {
if (typeof keepDOM != "boolean")
{
excludeSelf = ctx;
ctx = keepDOM;
keepDOM = undefined;
}

findDomElem(ctx,".i-bem",excludeSelf).each(function (i, domNode) {
var params = getParams(this);
$.each(params,function (blockName, blockParams) {
if (blockParams.uniqId)
{
var block = uniqIdToBlock[blockParams.uniqId];
if (block)
{
removeDomNodeFromBlock(block,domNode);
delete params[blockName];
}
 else
{
delete uniqIdToDomElems[blockParams.uniqId];
}

}

}
);
$.isEmptyObject(params) && cleanupDomNode(this);
}
);
keepDOM || (excludeSelf ? ctx.empty() : ctx.remove());
}
,
update: function (ctx, content, callback, callbackCtx) {
this.destruct(ctx,true);
this.init(ctx.html(content),callback,callbackCtx);
}
,
replace: function (ctx, content) {
this.destruct(true,ctx);
this.init($(content).replaceAll(ctx));
}
,
append: function (ctx, content) {
this.init($(content).appendTo(ctx));
}
,
prepend: function (ctx, content) {
this.init($(content).prependTo(ctx));
}
,
before: function (ctx, content) {
this.init($(content).insertBefore(ctx));
}
,
after: function (ctx, content) {
this.init($(content).insertAfter(ctx));
}
,
_buildCtxEventName: function (e) {
return this._name + ":" + e;
}
,
_liveClassBind: function (className, e, callback, invokeOnInit) {
var _this = this;
if (e.indexOf(" ") > - 1)
{
e.split(" ").forEach(function (e) {
_this._liveClassBind(className,e,callback,invokeOnInit);
}
);
}
 else
{
var storage = liveClassEventStorage[e], uniqId = $.identify(callback);
if (! storage)
{
storage = liveClassEventStorage[e] = {
};
doc.bind(e,_this.changeThis(_this._liveClassTrigger,_this));
}

storage = storage[className] || (storage[className] = {
uniqIds: {
},
fns: []});
if (! (uniqId in storage.uniqIds))
{
storage.fns.push({
uniqId: uniqId,
fn: _this._buildLiveEventFn(callback,invokeOnInit)});
storage.uniqIds[uniqId] = storage.fns.length - 1;
}

}

return this;
}
,
_liveClassUnbind: function (className, e, callback) {
var storage = liveClassEventStorage[e];
if (storage)
{
if (callback)
{
if (storage = storage[className])
{
var uniqId = $.identify(callback);
if (uniqId in storage.uniqIds)
{
var i = storage.uniqIds[uniqId], len = storage.fns.length - 1;
storage.fns.splice(i,1);
while (i < len) storage.uniqIds[storage.fns[i++].uniqId] = i - 1;
delete storage.uniqIds[uniqId];
}

}

}
 else
{
delete storage[className];
}

}

return this;
}
,
_liveClassTrigger: function (e) {
var storage = liveClassEventStorage[e.type];
if (storage)
{
var node = e.target, classNames = [];
for(var className in storage) storage.hasOwnProperty(className) && classNames.push(className);
do {
var nodeClassName = " " + node.className + " ", i = 0;
while (className = classNames[i++]) {
if (nodeClassName.indexOf(" " + className + " ") > - 1)
{
var j = 0, fns = storage[className].fns, fn, stopPropagationAndPreventDefault = false;
while (fn = fns[j++]) if (fn.fn.call($(node),e) === false)
stopPropagationAndPreventDefault = true;
stopPropagationAndPreventDefault && e.preventDefault();
if (stopPropagationAndPreventDefault || e.isPropagationStopped())
return;
classNames.splice(--i,1);
}

}

}
 while (classNames.length && (node = node.parentNode));
}

}
,
_buildLiveEventFn: function (callback, invokeOnInit) {
var _this = this;
return function (e) {
var args = [_this._name, ((e.data || (e.data = {
})).domElem = $(this)).closest(_this.buildSelector()), true], block = initBlock.apply(null,invokeOnInit ? args.concat([callback, e]) : args);
if (block && ! invokeOnInit && callback)
return callback.apply(block,arguments);
}
;
}
,
liveInitOnEvent: function (elemName, event, callback) {
return this.liveBindTo(elemName,event,callback,true);
}
,
liveBindTo: function (to, event, callback, invokeOnInit) {
if (! event || $.isFunction(event))
{
callback = event;
event = to;
to = undefined;
}

if (! to || typeof to == "string")
{
to = {
elem: to};
}

to.elemName && (to.elem = to.elemName);
var _this = this;
if (to.elem && to.elem.indexOf(" ") > 0)
{
to.elem.split(" ").forEach(function (elem) {
_this._liveClassBind(buildClass(_this._name,elem,to.modName,to.modVal),event,callback,invokeOnInit);
}
);
return _this;
}

return _this._liveClassBind(buildClass(_this._name,to.elem,to.modName,to.modVal),event,callback,invokeOnInit);
}
,
liveUnbindFrom: function (elem, event, callback) {
var _this = this;
if (elem.indexOf(" ") > 1)
{
elem.split(" ").forEach(function (elem) {
_this._liveClassUnbind(buildClass(_this._name,elem),event,callback);
}
);
return _this;
}

return _this._liveClassUnbind(buildClass(_this._name,elem),event,callback);
}
,
_liveInitOnBlockEvent: function (event, blockName, callback, findFnName) {
var name = this._name;
blocks[blockName].on(event,function (e) {
var args = arguments, blocks = e.block[findFnName](name);
callback && blocks.forEach(function (block) {
callback.apply(block,args);
}
);
}
);
return this;
}
,
liveInitOnBlockEvent: function (event, blockName, callback) {
return this._liveInitOnBlockEvent(event,blockName,callback,"findBlocksOn");
}
,
liveInitOnBlockInsideEvent: function (event, blockName, callback) {
return this._liveInitOnBlockEvent(event,blockName,callback,"findBlocksOutside");
}
,
liveInitOnBlockInit: function (blockName, callback) {
return this.liveInitOnBlockEvent("init",blockName,callback);
}
,
liveInitOnBlockInsideInit: function (blockName, callback) {
return this.liveInitOnBlockInsideEvent("init",blockName,callback);
}
,
on: function (ctx, e, data, fn, fnCtx) {
return ctx.jquery ? this._liveCtxBind(ctx,e,data,fn,fnCtx) : this.__base(ctx,e,data,fn);
}
,
un: function (ctx, e, fn, fnCtx) {
return ctx.jquery ? this._liveCtxUnbind(ctx,e,fn,fnCtx) : this.__base(ctx,e,fn);
}
,
liveCtxBind: function (ctx, e, data, fn, fnCtx) {
return this._liveCtxBind(ctx,e,data,fn,fnCtx);
}
,
_liveCtxBind: function (ctx, e, data, fn, fnCtx) {
var _this = this;
if (typeof e == "string")
{
if ($.isFunction(data))
{
fnCtx = fn;
fn = data;
data = undefined;
}

if (e.indexOf(" ") > - 1)
{
e.split(" ").forEach(function (e) {
_this._liveCtxBind(ctx,e,data,fn,fnCtx);
}
);
}
 else
{
var ctxE = _this._buildCtxEventName(e), storage = liveEventCtxStorage[ctxE] || (liveEventCtxStorage[ctxE] = {
counter: 0,
ctxs: {
}});
ctx.each(function () {
var ctxId = $.identify(this), ctxStorage = storage.ctxs[ctxId];
if (! ctxStorage)
{
ctxStorage = storage.ctxs[ctxId] = {
};
++storage.counter;
}

ctxStorage[$.identify(fn) + (fnCtx ? $.identify(fnCtx) : "")] = {
fn: fn,
data: data,
ctx: fnCtx};
}
);
}

}
 else
{
$.each(e,function (e, fn) {
_this._liveCtxBind(ctx,e,fn,data);
}
);
}

return _this;
}
,
liveCtxUnbind: function (ctx, e, fn, fnCtx) {
return this._liveCtxUnbind(ctx,e,fn,fnCtx);
}
,
_liveCtxUnbind: function (ctx, e, fn, fnCtx) {
var _this = this, storage = liveEventCtxStorage[e = _this._buildCtxEventName(e)];
if (storage)
{
ctx.each(function () {
var ctxId = $.identify(this,true), ctxStorage;
if (ctxId && (ctxStorage = storage.ctxs[ctxId]))
{
fn && delete ctxStorage[$.identify(fn) + (fnCtx ? $.identify(fnCtx) : "")];
if (! fn || $.isEmptyObject(ctxStorage))
{
storage.counter--;
delete storage.ctxs[ctxId];
}

}

}
);
storage.counter || delete liveEventCtxStorage[e];
}

return _this;
}
,
_extractElemNameFrom: function (elem) {
if (elem.__bemElemName)
return elem.__bemElemName;
var matches = elem[0].className.match(this._buildElemNameRE());
return matches ? matches[1] : undefined;
}
,
extractParams: extractParams,
_buildModClassPrefix: function (modName, elem) {
return buildClass(this._name) + (elem ? ELEM_DELIM + (typeof elem === "string" ? elem : this._extractElemNameFrom(elem)) : "") + MOD_DELIM + modName + MOD_DELIM;
}
,
_buildModValRE: function (modName, elem, quantifiers) {
return new RegExp("(\\s|^)" + this._buildModClassPrefix(modName,elem) + "(" + NAME_PATTERN + ")(?=\\s|$)", quantifiers);
}
,
_buildElemNameRE: function () {
return new RegExp(this._name + ELEM_DELIM + "(" + NAME_PATTERN + ")(?:\\s|$)");
}
,
buildSelector: function (elem, modName, modVal) {
return "." + buildClass(this._name,elem,modName,modVal);
}
,
getBlockByUniqId: function (uniqId) {
return uniqIdToBlock[uniqId];
}
,
getWindowSize: function () {
return {
width: win.width(),
height: win.height()};
}
});
$(function () {
BEM.DOM.scope = $("body");
}
);
}
)(BEM,jQuery);
;
(function () {
String.prototype.trim || (String.prototype.trim = function () {
var str = this.replace(/^\s\s*/,""), ws = /\s/, i = str.length;
while (ws.test(str.charAt(--i))) ;
return str.slice(0,i + 1);
}
);
}
)();
;
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.isSessionValid = function () {
return ! ! Lego.getCookie("yandex_login");
}
;
}
)(window.Lego);
;
BEM.DOM.decl("i-global",{
onSetMod: {
"js": function () {
this.del(this.__self._params = $.extend({
},this.params),"uniqId","name");
var params = this.__self._params;
params["passport-msg"] || (params["passport-msg"] = params.id);
if (params["show-counters"] === undefined)
{
params["show-counters"] = Math.round(Math.random() * 100) <= params["show-counters-percent"];
}

params.locale = params.lang;
$(function () {
params.oframebust && Lego.oframebust(params.oframebust);
}
);
}
},
getDefaultParams: function () {
return {
id: "",
login: Lego.isSessionValid() ? $.cookie("yandex_login") || "" : "",
yandexuid: $.cookie("yandexuid"),
lang: "ru",
retpath: window.location.toString(),
"passport-host": "https://passport.yandex.ru",
"pass-host": "//pass.yandex.ru",
"social-host": "//social.yandex.ru",
"lego-path": "/lego",
"show-counters-percent": 100};
}
},{
param: function (name) {
return (this._params || {
})[name];
}
});
;
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
! Lego.params && (Lego.params = {
});
function preparseHost(h) {
return h.replace(/^(?:https?:)?\/\//,"");
}

Lego.c = function (w, a, opts) {
var host = preparseHost(opts && opts.host || BEM.blocks["i-global"].param("click-host") || "clck.yandex.ru"), url = function (w, h, t, a) {
h = h.replace("'","%27");
return h.indexOf("/dtype=") > - 1 ? h : location.protocol + "//" + host + "/" + t + "/dtype=" + w + "/rnd=" + ((new Date()).getTime() + Math.round(Math.random() * 100)) + (a ? "/*" + (h.match(/^http/) ? h : location.protocol + "//" + location.host + (h.match("^/") ? h : "/" + h)) : "/*data=" + encodeURIComponent("url=" + encodeURIComponent(h.match(/^http/) ? h : location.protocol + "//" + location.host + (h.match("^/") ? h : "/" + h))));
}
, click = function () {
var head = document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0];
var script = document.createElement("script");
script.setAttribute("src",url(w,location.href,"jclck"));
head.insertBefore(script,head.firstChild);
}
;
if (a)
{
if (a.className.match(/b-link_pseudo_yes/) || a.href && a.href.match(/^mailto:/) || opts && opts.noRedirect === true)
{
click();
}
 else
if (a.href)
{
var h = a.href;
a.href = url(w,h,"redir");
setTimeout(function () {
a.href = h;
}
,500);
}
 else
if (a.form)
{
if (a.type.match(/submit|button|image/))
{
var h = a.form.action;
a.form.action = url(w,h,"redir",true);
setTimeout(function () {
a.form.action = h;
}
,500);
}
 else
{
click();
}

}
 else
if (a.action)
{
a.action = url(w,a.action,"redir",true);
}
 else
{
throw "counter.js: not link and not form!";
}

}
 else
{
click();
}

}
;
}
)(window.Lego);
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.cp = function (pi, ci, p, a, opts) {
Lego.c("stred/pid=" + pi + "/cid=" + ci + (p ? "/path=" + p : ""),a,opts);
}
;
}
)(window.Lego);
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.ch = function (p, a) {
BEM.blocks["i-global"].param("show-counters") && Lego.cp(0,2219,p,a);
}
;
}
)(window.Lego);
;
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.getCookie = function (n) {
var c = document.cookie;
if (c.length < 1)
return false;
var b = c.indexOf(n + "=");
if (b == - 1)
return false;
b += n.length + 1;
var e = c.indexOf(";",b);
return decodeURIComponent(e == - 1 ? c.substring(b) : c.substring(b,e));
}
;
}
)(window.Lego);
;
(function ($, Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.init || (Lego.init = function (params) {
(params = Lego.params = $.extend({
id: "",
login: Lego.isSessionValid() ? Lego.getCookie("yandex_login") || "" : "",
yandexuid: Lego.getCookie("yandexuid"),
locale: "ru",
retpath: window.location.toString(),
"passport-host": "//passport.yandex.ru",
"pass-host": "//pass.yandex.ru",
"passport-msg": params.id,
"social-host": "//social.yandex.ru",
"lego-path": "/lego",
"show-counters-percent": 100},params,Lego.params))["show-counters"] = Math.round(Math.random() * 100) <= params["show-counters-percent"];
BEM.blocks["i-global"]._params || $.extend(BEM.blocks["i-global"]._params = {
},params);
$(function () {
params.oframebust && Lego.oframebust(params.oframebust);
}
);
return params;
}
);
Lego.block || (Lego.block = {
});
Lego.blockInit || (Lego.blockInit = function (context, blockSelector) {
context = context || document;
blockSelector = blockSelector || ".g-js";
$(context).find(blockSelector).each(function () {
var block = $(this), params = this.onclick ? this.onclick() : {
}, name = params.name || "", init = Lego.block[name];
if (init && ! block.data(name))
{
init.call(block,params);
block.data(name,true).addClass(name + "_js_inited");
}

}
);
}
);
Lego.blockInitBinded || (Lego.blockInitBinded = ! ! $(document).ready(function () {
Lego.blockInit();
}
));
}
)(jQuery,window.Lego);
;
(function (Lego) {
if (! Lego)
Lego = window.Lego = {
};
Lego.messages = Lego.messages || {
};
Lego.message = function (id, text) {
return Lego.params.locale == "ru" ? text : Lego.messages[id] || text;
}
;
}
)(window.Lego);
;
$(function () {
BEM.DOM.init();
}
);
;
(function () {
window.console = window.console;
(function () {
var map = {
"&": "&amp;",
"  ": "&nbsp; ",
"<": "&lt;",
">": "&gt;",
"\n": "<br />",
"\r\n": "<br />",
"\"": "&quot;"};
var map2 = {
"&amp;": "&",
"&nbsp;": " ",
"&lt;": "<",
"&gt;": ">",
"<br />": "\n",
"<br/>": "\n",
"<br>": "\n",
"&quot;": "\""};
var funcReplace = function (str) {
return map[str];
}
;
var funcReplace2 = function (str) {
return map2[str.toLowerCase()];
}
;
String.prototype.toHTML = function () {
return this.replace(/&|  |<|>|\r\n|\n|"|"/g,funcReplace);
}
;
String.prototype.fromHTML = function () {
return this.replace(/&amp;|&nbsp;|&lt;|&gt;|<(br|BR)\s*\/?>|&quot;/g,funcReplace2);
}
;
}
)();
Function.empty = function () {

}
;
Function.prototype.callbackDelay = function (minTimeout) {
if (! minTimeout || minTimeout < 1)
{
return this;
}

var endTime = (new Date()).valueOf() + minTimeout;
var func = this;
return function () {
var interval = endTime - (new Date()).valueOf();
var args = arguments, self = this;
if (interval > 0)
{
setTimeout(function () {
func.apply(self,args);
}
,interval);
}
 else
{
func.apply(self,args);
}

}
;
}
;
BEM.decl("i-widget-helper",{
},{
_localStringPrefix: "",
_initialized: false,
init: function (platform, localStringPrefix) {
if (this._initialized)
{
return this;
}

this._initialized = true;
this._platform = platform;
this._localStringPrefix = localStringPrefix || "";
BEM.I18N.lang(platform.language);
var self = this;
this._helperPlatformListener = function (message) {
if (! message)
{
return;
}

var topic, data;
try {
topic = message.message || message;
data = message.data || null;
self._platform.logger.debug("getMessage::",topic,data);
}
catch (exc) {
self._platform.logger.error("[slice] onMessage: parameter error");
return;
}

self.fireEvent(topic,data);
}
;
this._platform.onMessage.addListener(this._helperPlatformListener);
var notunloaded = true;
function unload() {
if (notunloaded)
{
try {
self.clearInterval();
self._removePlatformListener();
notunloaded = false;
}
catch (exc) {

}

}

}

window.onunload = unload;
window.onbeforeunload = unload;
jQuery.ajaxSetup({
crossDomain: false,
xhr: function () {
return new platform.XMLHttpRequest();
}
});
if (! this._enableContextMenu)
{
document.oncontextmenu = function (e) {
e = e || window.event;
var tag = (e.target || e.srcElement).tagName;
return tag === "INPUT" || tag === "TEXTAREA";
}
;
window.onerror = function (e, ur, ln) {
return false;
}
;
}

;
return this;
}
,
setInterval: function (ms) {
this.clearInterval();
var curtime = (new Date()).valueOf();
var self = this;
this._workTimer = setInterval(function () {
var time = (new Date()).valueOf();
self.fireEvent(":timer",time - curtime);
curtime = time;
}
,ms || 10);
}
,
clearInterval: function () {
if (this._workTimer)
{
clearInterval(this._workTimer);
this._workTimer = null;
}

}
,
logDebug: function (str) {
this._platform.logger.debug(str);
}
,
logError: function (str) {
this._platform.logger.error(str);
}
,
branding: function (conf) {
if (! conf.current)
{
conf.current = {
};
var bran = (conf.branding || {
})[this._platform.brandID];
$.extend(conf.current,conf.common || {
},bran || {
});
}

return conf.current;
}
,
getScript: function (url, callback) {
this.ajax({
type: "GET",
url: url,
success: callback,
dataType: "script"});
}
,
ajax: function (config, attemptsCount) {
attemptsCount = attemptsCount || 1;
if (config.dataType == "script" || config.dataType == "jsonp")
{
config.crossDomain = true;
}

function request() {
attemptsCount--;
return $.ajax(config);
}

if (attemptsCount > 1)
{
var oldError = config.error || Function.empty;
config.error = function () {
if (attemptsCount)
{
request();
}
 else
{
oldError.apply(this,arguments);
}

}
;
}

request();
}
,
getCookie: function (url, name, http) {
if (! /^https?:/.test(url))
{
url = "http://" + url;
}

return this._platform.getCookie(url,name,! ! http);
}
,
openSettings: function () {
if (! window.closed)
{
window.close();
}

this._platform.showSettings();
}
,
parseDate: function (str) {
if (typeof str !== "string" || ! str)
{
return str;
}

var i, part = str.match(/\d+/g);
for (i = 0;i < part.length;++i) {
part[i] = parseInt(part[i],10);
}

return new Date(part[0], part[1] - 1, part[2], part[3], part[4], part[5]);
}
,
openNewTab: function (url) {
this._platform.navigate(url,"new tab");
window.close();
}
,
localStr: function (key) {
var str = this._platform.getLocalizedString(this._localStringPrefix + key) || "";
if (! str)
{
this._platform.logger.error("[slice] getLocalizedString: (" + this.lang() + ") empty string \"" + this._localStringPrefix + key + "\"");
}

return str;
}
,
lang: function () {
return this._platform.language;
}
,
getParam: function (param, url) {
return (RegExp("[?&]" + param + "=([^&#]*)","i").exec(url || document.location.href) || "")[1] || "";
}
,
platformLocalization: function (mainBlock) {
if (mainBlock.platform_i18n)
{
mainBlock.platform_i18n(this);
}

for(var bl in BEM.blocks) {
if (/^b-/.test(bl))
{
var blocks = mainBlock.findBlocksInside(bl);
if (blocks)
{
for (var i = 0;i < blocks.length;++i) {
if (blocks[i].platform_i18n)
{
blocks[i].platform_i18n(this,i);
}

}

}

}

}

}
,
logAction: function (actionCode) {
this._platform.logCustomAction(actionCode);
}
,
_helperPlatformListener: null,
_pltfListeners: {
},
_removePlatformListener: function () {
if (this._helperPlatformListener)
{
this._platform.onMessage.removeListener(this._helperPlatformListener);
this._helperPlatformListener = null;
}

}
,
reloadSlice: function () {
this._removePlatformListener();
window.location.reload(true);
}
,
removeListener: function (topic, callback) {
if (! this._pltfListeners[topic])
{
return;
}

if (! callback)
{
this._pltfListeners[topic] = null;
}
 else
{
var listeners = this._pltfListeners[topic];
for (var i = 0;i < listeners.length;++i) {
if (listeners[i].func == callback)
{
listeners.splice(i,1);
--i;
}

}

}

}
,
addListener: function (topic, callback, scope) {
this._pltfListeners[topic] = this._pltfListeners[topic] || [];
this._pltfListeners[topic].push({
func: callback,
scope: scope});
return this;
}
,
addBlockListeners: function (block) {
var handlers = block.handlers;
if (handlers && ! block.__addBlockListeners_called)
{
for(var i in handlers) {
if (handlers.hasOwnProperty(i))
{
var val = handlers[i];
if (typeof val == "string" && handlers.hasOwnProperty(val))
{
val = handlers[val];
}

if (typeof val == "function")
{
this.addListener(i,val,block);
}

}

}

block.__addBlockListeners_called = true;
}

return this;
}
,
initAllHandlers: function (mainBlock) {
this.addBlockListeners(mainBlock);
for(var bl in BEM.blocks) {
if (/^b-/.test(bl))
{
var blocks = mainBlock.findBlocksInside(bl);
if (blocks)
{
for (var i = 0;i < blocks.length;++i) {
this.addBlockListeners(blocks[i]);
}

}

}
 else
{
if (/^i-/.test(bl))
{
this.addBlockListeners(BEM.blocks[bl]);
}

}

}

}
,
sendMessage: function (msg, data) {
var obj = {
message: msg};
if (data !== undefined)
{
obj.data = data;
}

this._platform.sendMessage(obj);
}
,
fireEvent: function (topic, data) {
var listeners = this._pltfListeners[topic];
if (listeners)
{
for (var i = 0;i < listeners.length;++i) {
var ret = listeners[i].func.call(listeners[i].scope || window,topic,data);
if (ret === false)
{
break;
}

}

}

}
,
md5: function (str, callback, scope) {
this.addListener("md5",function md5Callback(topic, data) {
if (typeof callback === "function")
scope ? callback.call(scope,data) : callback(data);
this.removeListener("md5",md5Callback);
}
,this);
window.platform.sendMessage({
message: "md5",
data: str});
}
,
shuffle: function (inArray) {
var outArray = Array.prototype.slice.call(inArray);
for (var j, x, i = outArray.length;i;(j = parseInt(Math.random() * i), x = outArray[--i], outArray[i] = outArray[j], outArray[j] = x)) ;
return outArray;
}
});
}
)();
;
(function ($) {
BEM.decl("i-widget-traffic",{
},{
_mapConfigFromExport: null,
_trafficInfo: null,
_trafficAlert: null,
init: function () {
this._helper = BEM.blocks["i-widget-helper"];
this.utils = BEM.blocks["i-widget-traffic__utils"];
this.storage = BEM.blocks["i-widget-traffic__storage"];
this._configs = BEM.blocks["i-widget-traffic__config"];
if (window.parent && window.parent.__debug_Tools_)
{
window.parent.__debug_Tools_(this,window);
}

if (! window.platform)
{
window.platform = window.external;
}

var platform = window.platform;
this._platform = platform;
this._helper.init(platform);
this.config = this._helper.branding(this._configs);
this.utils.init(platform,this);
this.storage.init(platform,this);
var sz = this.config.windowSize;
platform.resizeWindowTo(sz[0],sz[1]);
}
,
update: function (callback, errback) {
var self = this;
$.ajax({
url: this.config.EXPORT_URL,
data: {
region: this._helper.getParam("region"),
lang: this._platform.language,
brid: this._platform.brandID,
_rand: Math.round((new Date()).valueOf() / 7000)},
dataType: "xml",
success: function (data) {
self._updateHandler(data,callback);
}
,
error: function () {
(errback || Function.empty).apply(window,arguments);
}
});
}
,
_updateHandler: function (xml, callback) {
var regionNode = $("info>region",xml), trafficNode = $("info>traffic",xml), levelNode = trafficNode.children("level"), trafficAlert = $("info>traffic-alert",xml);
var mconf = this._mapConfigFromExport;
var newRegion = {
title: regionNode.children("title").text(),
id: regionNode.attr("id") || this._helper.getParam("region"),
zoom: parseInt(regionNode.attr("zoom"),10),
lat: regionNode.attr("lat"),
lon: regionNode.attr("lon")};
if (! mconf || mconf.region.id != newRegion.id)
{
mconf = {
region: newRegion,
traffic: null};
this._mapConfigFromExport = mconf;
mconf.region.center = [parseFloat(mconf.region.lat), parseFloat(mconf.region.lon)];
this.storage.setRegion(mconf.region.title);
if (levelNode.length)
{
mconf.traffic = {
title: trafficNode.children("title").text(),
id: trafficNode.attr("region"),
zoom: parseInt(trafficNode.attr("zoom"),10),
lat: trafficNode.attr("lat"),
lon: trafficNode.attr("lon")};
mconf.traffic.center = [parseFloat(mconf.traffic.lat), parseFloat(mconf.traffic.lon)];
}

}

if (levelNode.length)
{
this._trafficInfo = {
balls: trafficNode.children("level").text(),
ballsText: trafficNode.children("hint[lang=\"" + platform.language + "\"]").text(),
icon: trafficNode.children("icon").text(),
time: (new Date()).valueOf()};
if (mconf.traffic && mconf.traffic.title != mconf.region.title)
{
this._trafficInfo.city = mconf.traffic.title;
}

}
 else
{
this._trafficInfo = {
error: "notraffic"};
}

if (trafficAlert.length && trafficAlert.attr("text"))
{
this._trafficAlert = {
text: trafficAlert.attr("text"),
start: parseInt(trafficAlert.attr("start-time")) * 1000,
end: parseInt(trafficAlert.attr("end-time")) * 1000};
}
 else
{
this._trafficAlert = null;
}

this.storage.saveTrafficData(this._trafficInfo);
callback();
}
,
getMapConfig: function () {
return this._mapConfigFromExport;
}
,
getTrafficInfo: function () {
return this._trafficInfo;
}
,
getTrafficAlert: function () {
if (this._trafficAlert)
{
if (this._trafficAlert.end >= (new Date()).valueOf())
{
return this._trafficAlert.text;
}

}

return "";
}
});
}
)(jQuery);
;
(function ($) {
BEM.decl("i-widget-traffic__utils",{
},{
helper: null,
init: function (platform, widget) {
this._platform = platform;
this.helper = BEM.blocks["i-widget-helper"];
this._widget = widget;
}
,
getLang: function (allowLangs) {
var lang = this.helper.lang();
if (! allowLangs || ! allowLangs.length)
{
return lang;
}

if (typeof allowLangs == "string")
{
allowLangs = [allowLangs];
}

for (var i = 0;i < allowLangs.length;++i) {
if (allowLangs[i] == lang)
{
return lang;
}

}

return allowLangs[0];
}
,
distance: function (a, b, zoom) {
var len = Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) * Math.cos(b[0] * Math.PI / 180));
while (zoom < 10) {
len = len / 2;
zoom++;
}

while (zoom > 10) {
len = len * 2;
zoom--;
}

return len;
}
,
getJam: function (rTime, jamsTime, routeLength) {
var k = 1, route_km = routeLength / 1000;
if (routeLength < 500)
{
k = 0.5;
}
 else
if (route_km < 1)
{
k = 0.75;
}
 else
if (route_km >= 15 && route_km < 80)
{
k = 1 / 65 * (route_km - 15) + 1;
}
 else
if (route_km >= 80)
{
k = 2;
}

var index = k * (jamsTime / rTime - 1) * 100, c = - 1;
if (index >= 0)
{
c = 0;
}

;
if (index > 10)
{
c = 1;
}

;
if (index > 25)
{
c = 2;
}

;
if (index > 40)
{
c = 3;
}

;
if (index > 60)
{
c = 4;
}

;
if (index > 85)
{
c = 5;
}

;
if (index > 115)
{
c = 6;
}

;
if (index > 155)
{
c = 7;
}

;
if (index > 195)
{
c = 8;
}

;
if (index > 240)
{
c = 9;
}

;
if (index > 290)
{
c = 10;
}

;
return c;
}
,
getLL: function () {
var cook = this._platform.getCookie("http://" + this._widget.config.COOKIE_DOMAIN,"ys",false);
if (cook && /gpauto\.(-?\d*_\d*)(%3[Aa]|:)(-?\d*_\d*)[%:]/.test(cook))
{
var lat = RegExp.$1, lon = RegExp.$3;
lat = lat.replace("_",".");
lon = lon.replace("_",".");
return {
latitude: parseFloat(lat),
longitude: parseFloat(lon)};
}

return ymaps.geolocation;
}
,
isRouteRevertByTime: function () {
var dt = new Date();
var h = dt.getHours();
return ! (h >= 3 && h < 16);
}
,
format: function (key, content) {
return BEM.I18N("b-traffic",key,{
content: content});
}
,
getBallStr: function (ball) {
ball = parseInt(ball,10);
if (ball === 1)
{
return BEM.I18N("b-traffic","balls1");
}
 else
{
return BEM.I18N("b-traffic",ball > 1 && ball < 5 ? "balls234" : "balls");
}

}
,
getTimeStr: function (sec) {
var m = Math.round(sec / 60);
var h = Math.floor(m / 60 + 0.001);
var hstr = h ? h + " " + BEM.I18N("b-traffic","time.h") + " " : "";
m = Math.round(m - h * 60);
return hstr + (m ? m + " " + BEM.I18N("b-traffic","time.m") : "");
}
,
lpad: function (num, len) {
num = num.toString();
while (num.length < len) {
num = "0" + num;
}

return num;
}
,
getTimePointStr: function (time) {
var dt = new Date(parseInt(time,10));
return this.lpad(dt.getHours()) + ":" + this.lpad(dt.getMinutes());
}
});
}
)(jQuery);
;
(function () {
BEM.decl("i-widget-traffic__config",{
},{
current: null,
common: {
COOKIE_DOMAIN: "yandex.ru",
EXPORT_URL: "http://export.yandex.ru/bar/reginfo.xml",
MAP_API_URL: "http://api-maps.yandex.ru/2.0/?load=package.full&lang=",
SUGGEST_URL: "http://suggest-maps.yandex.ru/suggest-geo",
MAP_URL: "http://maps.yandex.ru/",
SUGGEST_LANGS: ["ru", "uk", "be"],
API_LANGS: ["ru", "uk", "be"],
ENG_YA_SYMBOL: {
en: true,
tr: true,
cs: true},
YA_SYMBOL_PATH_RU: "http://yandex.st/lego/_/7CK9GSbMtRufcc7Wro_z41OvFoI.png",
YA_SYMBOL_PATH_EN: "http://yandex.st/lego/_/0C5hXMbglXhq_iSYkvTTLXa60jM.png",
windowSize: [480, 560]},
branding: {
tb: {
COOKIE_DOMAIN: "yandex.com.tr",
EXPORT_URL: "http://export.yandex.com.tr/bar/reginfo.xml",
SUGGEST_URL: "http://suggest-maps.yandex.com.tr/suggest-geo",
MAP_URL: "http://harita.yandex.com.tr/",
SUGGEST_LANGS: ["tr", "en"],
API_LANGS: ["tr", "en"]},
ua: {
COOKIE_DOMAIN: "yandex.ua",
EXPORT_URL: "http://export.yandex.ua/bar/reginfo.xml",
SUGGEST_URL: "http://suggest-maps.yandex.ua/suggest-geo",
MAP_URL: "http://maps.yandex.ua/",
SUGGEST_LANGS: ["uk"],
API_LANGS: ["uk"]}}});
}
)();
;
(function ($) {
BEM.decl("i-widget-traffic__storage",{
},{
init: function (platform) {
this._platform = platform;
this._helper = BEM.blocks["i-widget-helper"];
this._widget = BEM.blocks["i-widget-traffic"];
}
,
setRegion: function (region) {
this._region = (region || "").toUpperCase();
}
,
loadTrafficData: function () {
var str = this._platform.getOption("old-balls") || "";
if (! str)
{
return null;
}

str = str.split("||");
var time = parseInt(str[1],10), currTime = (new Date()).valueOf();
if (currTime - time > 3600000)
{
return null;
}

return {
balls: str[0],
time: time,
ballsText: str[2]};
}
,
saveTrafficData: function (data) {
var str = data && ! data.error ? data.balls + "||" + data.time + "||" + data.ballsText : "";
this._platform.setOption("old-balls",str);
}
,
_symb: "^#",
_getRoutes: function (fromSave) {
var noData = {
index: 0,
home: [""],
work: [""]};
var s1 = this._platform.getOption("route-home");
if (! s1)
{
return noData;
}

var s2 = this._platform.getOption("route-work");
if (! s2)
{
return noData;
}

var symb = this._symb;
var region = this._region;
if (s1.indexOf(symb) != 0)
{
s1 = symb + region + "||" + s1;
s2 = symb + region + "||" + s2;
if (! fromSave)
{
this._platform.setOption("route-home",s1);
this._platform.setOption("route-work",s2);
}

}

s1 = s1.split(symb);
s2 = s2.split(symb);
var routeIndex = 0;
for (var i = 1;i < s1.length;++i) {
if (s1[i].substr(0,s1[i].indexOf("||")) == region)
{
routeIndex = i;
}

}

return {
index: routeIndex,
home: s1,
work: s2};
}
,
loadRouteData: function (bTest) {
function numbers(str) {
str = str.split("|");
if (str[0] != "N")
{
str[0] = parseFloat(str[0]);
str[1] = parseFloat(str[1]);
return str;
}
 else
{
return null;
}

}

var routes = this._getRoutes(false);
if (bTest || ! routes.index)
{
return ! ! routes.index || null;
}

var home = routes.home[routes.index], work = routes.work[routes.index];
home = home.substr(home.indexOf("||") + 2);
work = work.substr(work.indexOf("||") + 2);
var fi1 = home.indexOf("||");
var fi2 = work.indexOf("||");
return {
revert: this._widget.utils.isRouteRevertByTime(),
home: home.substr(fi1 + 2),
work: work.substr(fi2 + 2),
homePoint: fi1 > 0 ? numbers(home.substr(0,fi1)) : null,
workPoint: fi2 > 0 ? numbers(work.substr(0,fi2)) : null};
}
,
saveRouteData: function (data) {
var arr = ["N", "N"];
var region = this._region;
var routes = this._getRoutes(true);
if (routes.index)
{
routes.home.splice(routes.index,1);
routes.work.splice(routes.index,1);
}

if (data)
{
if (routes.home.length >= 5)
{
routes.home.splice(1,1);
routes.work.splice(1,1);
}

routes.home.push(region + "||" + (data.homePoint || arr).join("|") + "||" + data.home);
routes.work.push(region + "||" + (data.workPoint || arr).join("|") + "||" + data.work);
}

if (routes.index || data)
{
this._platform.setOption("route-home",routes.home.join(this._symb));
this._platform.setOption("route-work",routes.work.join(this._symb));
}

}
});
}
)(jQuery);
;
(function ($) {
BEM.DOM.decl("b-traffic",{
onSetMod: {
js: function () {
if (this._initialized)
{
return;
}

this._initialized = true;
var self = this;
var loadListener = function () {
$(window).unbind("load",loadListener);
self.__init();
}
;
$(window).bind("load",loadListener);
}
},
_updating: false,
__init: function () {
this._helper = BEM.blocks["i-widget-helper"];
this._widget = BEM.blocks["i-widget-traffic"];
this._map = this.findBlockInside("b-traffic-map");
this._settings = this.findBlockInside("b-traffic-settings");
this._notify = this.findBlockInside("b-traffic-notify");
var infoBlocks = this.findBlocksInside("b-traffic-info");
this._ballsInfo = infoBlocks[0];
this._routeInfo = infoBlocks[1];
this._widget.init();
this._settings.init(this);
this._helper.platformLocalization(this);
this._helper.addListener("update",function () {
if (this._map.isApiErrorState())
{
this._helper.reloadSlice();
return;
}

this.update();
}
,this);
this._helper.addListener("traffic-before-popup",function () {
if (this._map.isApiErrorState())
{
this._helper.reloadSlice();
return false;
}

var stp = this.getMod("type");
if (stp == "error")
{
this.update();
}

}
,this);
this._helper.addListener("map.apierror",function () {
this.setSliceType("map-error");
}
,this);
this._helper.addListener("map.route",function (topic, data) {
this._routeInfo.showRouteInfo(data.route,data.revert);
this.setSliceType("route-view");
if (data.isNewRoute)
{
this._widget.storage.saveRouteData(data.data);
}

}
,this);
this._helper.addListener("map.create",this.updateSliceType,this);
this._helper.addListener("get.zoomCtrlTop",function () {
var top = this.elem("topmarker").offset().top - this._map.domElem.offset().top;
this._helper.fireEvent("put.zoomCtrlTop",top);
}
,this);
this.update();
this._map.init();
this._addButtonHandlers();
}
,
platform_i18n: function (helper) {
var dtdMap = {
"new": "set.points",
"route": "my.route",
"bigmap": "link.map"};
var self = this;
this.elem("btn").each(function () {
var elem = $(this);
elem.find(".b-form-button__text").text(BEM.I18N("b-traffic",dtdMap[self.getMod(elem,"type")]));
}
);
}
,
_addButtonHandlers: function () {
var handlers = {
"new": function () {
this.setSliceType("form");
this._helper.logAction(2);
}
,
"route": function () {
this.setSliceType("form");
this._helper.logAction(2);
this._settings.setRouteInfo(this._widget.storage.loadRouteData());
}
,
"bigmap": function () {
this._helper.logAction(5);
this._helper.openNewTab(this._map.getMapUrl());
}
};
var self = this;
this.elem("btn").each(function () {
var elem = $(this);
var action = handlers[self.getMod(elem,"type")];
elem.children("a:first").click(function (e) {
action.call(self);
e.preventDefault();
return false;
}
);
}
);
}
,
update: function () {
if (this._updating)
{
return;
}

this._updating = true;
var stp = this.getMod("type");
if (stp == "error")
{
this.setSliceType("loading");
}

var self = this;
this._widget.update(function () {
self._updating = false;
self._updateHandler();
}
,function () {
self._updating = false;
self.setSliceType("error","net");
}
);
}
,
_updateHandler: function () {
var traff = this._widget.getTrafficInfo();
this._ballsInfo.showJamsInfo(traff);
this._notify.setText(this._widget.getTrafficAlert());
this._map.createMap();
this._map.setLoadTimer();
this.updateSliceType();
}
,
updateSliceType: function () {
var sliceType;
if (this._map.isApiErrorState())
{
sliceType = "map-error";
}
 else
{
if (! this._map.isApiReadyState())
{
sliceType = "map-loading";
}
 else
{
if (this._map.getRoute())
{
sliceType = "route-view";
}
 else
{
sliceType = this._widget.storage.loadRouteData(true) ? "route" : "new";
}

}

}

this.setSliceType(sliceType);
}
,
setSliceType: function (type, opt_error) {
var ctype = this.getMod("type");
if (type == ctype)
{
return;
}

var errMap = type == "map-error";
if (errMap && ctype == "error")
{
return;
}

this.setMod("type",type);
if (/error$/.test(type))
{
this._map.setErrorText(BEM.I18N("b-traffic","error." + (errMap ? "map" : opt_error)));
if (! errMap)
{
var data = this._widget.storage.loadTrafficData();
this._ballsInfo.showJamsInfo(data,opt_error);
}

}
 else
{
this._helper.fireEvent("get.zoomCtrlTop");
if (type == "form")
{
this._settings.onShow();
}

}

}
},{
});
}
)(jQuery);
;
(function ($) {
BEM.DOM.decl("b-traffic-info",{
showJamsInfo: function (data, error) {
var helper = BEM.blocks["i-widget-helper"];
var widget = BEM.blocks["i-widget-traffic"];
if (error)
{
error = "error." + error;
}
 else
{
if (data && data.error)
{
error = data.error;
data = null;
}

}

if (data)
{
this.setMod(this.elem("icon"),"type",data.icon);
this.elem("ball").text(data.balls + " " + widget.utils.getBallStr(data.balls));
this.elem("error").text(error ? " - " + widget.utils.format("last.resp",widget.utils.getTimePointStr(data.time)) : "");
this.elem("city").text(! error && data.city ? " (" + data.city + ")" : "");
this.elem("text").text(data.ballsText);
}
 else
{
this.delMod(this.elem("icon"),"type");
this.elem("ball").html("&nbsp;");
this.elem("error").empty();
this.elem("city").empty();
this.elem("text").text(BEM.I18N("b-traffic",error));
}

}
,
showRouteInfo: function (route, revert) {
var helper = BEM.blocks["i-widget-helper"];
var widget = BEM.blocks["i-widget-traffic"];
var utils = widget.utils;
var time = route.getTime();
var jamsTime = route.getJamsTime();
var len = route.getLength();
var minProblemTime = 1200;
var minSpeed = 0.28;
var ball = utils.getJam(time,jamsTime,len);
var color = ball >= 7 ? "red" : ball >= 4 ? "yellow" : "green";
this.setMod(this.elem("icon"),"type",color);
var routeText = "<b>" + ball + " " + utils.getBallStr(ball) + "</b>&nbsp;-&nbsp;";
if (jamsTime > minProblemTime && jamsTime * minSpeed > len)
{
routeText += BEM.I18N("b-traffic","error.longroute");
}
 else
{
routeText += utils.format(revert ? "to.home" : "to.work","<b>" + utils.getTimeStr(jamsTime) + "</b>");
}

this.elem("text").html(routeText);
}
},{
});
}
)(jQuery);
;
(function ($) {
BEM.DOM.decl("b-traffic-notify",{
setText: function (str) {
this.elem("text").text(str);
this.domElem.css("display",str ? "block" : "none");
}
},{
});
}
)(jQuery);
;
(function ($) {
BEM.DOM.decl("b-traffic-settings",{
init: function (parent) {
this._helper = BEM.blocks["i-widget-helper"];
this._widget = BEM.blocks["i-widget-traffic"];
this._map = parent._map;
this._parent = parent;
this._helper.addListener("map.routeerror",function (topic, saveRoute) {
if (saveRoute)
{
this.showErrorMsg(true);
}

}
,this);
this._helper.addListener("map.route",function (topic, data) {
this._btnRemove.setMod("disabled","no");
if (data.isNewRoute)
{
this._setText(this._textboxHome,data.data.home);
this._setText(this._textboxWork,data.data.home);
}

}
,this);
this.showErrorMsg(false);
this._suggestLang = this._widget.utils.getLang(this._widget.config.SUGGEST_LANGS);
this._addControlHandlers();
}
,
_addControlHandlers: function () {
var i, blocks = this.findBlocksInside("b-form-button");
for (i = 0;i < blocks.length;++i) {
if (blocks[i].getMod("type") == "create")
{
this._btnCreate = blocks[i];
}
 else
{
this._btnRemove = blocks[i];
}

}

blocks = this.findBlocksInside("b-form-input");
for (i = 0;i < blocks.length;++i) {
if (blocks[i].getMod("type") == "home")
{
this._textboxHome = blocks[i];
this._textboxHome.elem("input").data("type","home");
}
 else
{
this._textboxWork = blocks[i];
this._textboxWork.elem("input").data("type","work");
}

}

var self = this;
var utils = this._widget.utils;
function makeRoute(tp) {
var data = {
home: self._getText(self._textboxHome),
work: self._getText(self._textboxWork),
revert: utils.isRouteRevertByTime()};
if (! data.home && ! data.work)
{
return;
}

if (! data.work)
{
if (tp == "homeenter")
{
self._textboxWork.elem("input").focus();
}

return;
}

if (! data.home)
{
if (tp == "workenter")
{
self._textboxHome.elem("input").focus();
}

return;
}

if (data.home == data.work)
{
if (tp == "homeenter")
{
self._textboxWork.elem("input").focus();
}

if (tp == "workenter")
{
self._textboxHome.elem("input").focus();
}

return;
}

if (! tp)
{
self._helper.logAction(3);
}

self._map.makeMyRoute(data,true);
}

this._btnCreate.domElem.click(function () {
makeRoute();
return false;
}
);
this._btnRemove.domElem.click(function () {
if (! self._widget.storage.loadRouteData(true))
{
return false;
}

self._setText(self._textboxHome,"");
self._setText(self._textboxWork,"");
self._btnRemove.setMod("disabled","yes");
self._textboxHome.elem("input").focus();
self._widget.storage.saveRouteData(null);
self._map.deleteRoute();
return false;
}
);
self._setText(self._textboxHome,"");
self._setText(self._textboxWork,"");
var routeErrMsg = $("#id_routeErrorMsg");
function edKeyEvent(e) {
e = e || window.event;
if (e.stopPropagation)
{
e.stopPropagation();
}
 else
{
e.cancelBubble = true;
}

if (e.type == "keydown" && e.keyCode == 13)
{
$(this).autocomplete("close");
this.blur();
makeRoute(this.id == "id_home" ? "homeenter" : "workenter");
}

}

var lastMDInput = null;
var lastFocused = null;
function sel(inp) {
try {
if (inp.createTextRange)
{
var r = inp.createTextRange();
r.select();
return;
}

if (inp.setSelectionRange)
{
inp.setSelectionRange(0,inp.value.length);
}

}
catch (ex) {

}

}

function tbEvents(textBox) {
var elem = textBox.elem("input").bind("focus",function () {
if (textBox.getMod(elem,"showhint") == "yes")
{
elem.val("");
textBox.delMod(elem,"showhint");
}

self.showErrorMsg(false);
if (lastMDInput && this.value)
{
lastFocused = this;
}

lastMDInput = null;
if (this.value && this.value.length)
{
sel(this);
lastFocused = this;
}
 else
{
lastFocused = null;
}

}
).bind("blur",function () {
var th = $(this);
if (! elem.val())
{
self._setText(textBox,"");
}

}
).bind("keydown",edKeyEvent).bind("keyup",edKeyEvent).bind("mousedown",function () {
lastMDInput = this;
}
).bind("mouseup",function () {
lastMDInput = null;
return ! lastFocused;
}
).click(function () {
var ret = ! lastFocused;
lastFocused = null;
lastMDInput = null;
return ret;
}
);
self._autocomplete(elem);
}

tbEvents(this._textboxHome);
tbEvents(this._textboxWork);
}
,
platform_i18n: function (helper) {
this.elem("error").text(BEM.I18N("b-traffic","error.route"));
this._btnCreate.elem("text").text(BEM.I18N("b-traffic","make.route"));
this._btnRemove.elem("text").text(BEM.I18N("b-traffic","remove.route"));
this.elem("title").text(BEM.I18N("b-traffic","my.route"));
this._textboxHome.elem("label").text(BEM.I18N("b-traffic","home"));
this._textboxWork.elem("label").text(BEM.I18N("b-traffic","work"));
}
,
showErrorMsg: function (show) {
this.elem("error").css("display",show !== false ? "" : "none");
this._helper.fireEvent("get.zoomCtrlTop");
}
,
onShow: function () {
this.showErrorMsg(false);
this._textboxHome.elem("input").focus();
this._btnRemove.setMod("disabled",this._widget.storage.loadRouteData(true) ? "no" : "yes");
}
,
_autocomplete: function (elem) {
function itemClick() {
elem.val(this.__data);
elem.autocomplete("close");
}

var self = this;
elem.autocomplete({
minLength: 2,
source: function (request, response) {
var cen = self._map.getCenter();
self._helper.ajax({
url: self._widget.config.SUGGEST_URL,
dataType: "jsonp",
data: {
lang: self._suggestLang,
ll: cen[1] + "," + cen[0],
spn: self._map.getSPN(),
highlight: 1,
fullpath: 1,
v: 3,
yu: self._widget._platform.getCookie("http://" + self._widget.config.COOKIE_DOMAIN,"yandexuid",false),
search_type: "tp",
part: request.term},
success: function (data) {
var data = data[1];
var i, j, item, html;
for (var i = 0;i < data.length;++i) {
item = data[i];
html = "<span class=\"ac-item_content\">";
for (var j = 0;j < item[1].length;++j) {
html += typeof item[1][j] === "string" ? item[1][j] : "<b>" + item[1][j][1] + "</b>";
}

html += "</span>";
data[i] = {
label: html,
value: (item[2] || "").replace(/\s*\s$/,"")};
}

response(data);
}
});
}
});
var oldRI = elem.data("autocomplete")._renderItem;
elem.data("autocomplete")._renderItem = function (ul, item) {
return oldRI.call(this,ul,item).find("a").html(item.label).end();
}
;
}
,
_setText: function (textBox, text) {
var input = textBox.elem("input");
if (text)
{
textBox.delMod(input,"showhint");
input.val(text);
}
 else
{
textBox.setMod(input,"showhint","yes");
input.val(BEM.I18N("b-traffic","address"));
}

}
,
_getText: function (textBox) {
var input = textBox.elem("input");
var hint = textBox.getMod(input,"showhint");
return hint == "yes" ? "" : input.val();
}
,
setRouteInfo: function (data) {
data = data || {
home: "",
work: ""};
this._setText(this._textboxHome,data.home);
this._setText(this._textboxWork,data.work);
this._btnRemove.setMod("disabled",data.home && data.work ? "no" : "yes");
}
},{
live: function () {
"use strict";
this.liveBindTo("close","leftclick",function (e) {
e.preventDefault();
this._parent.updateSliceType();
}
);
}
});
}
)(jQuery);
;
(function ($) {
var leftClick = $.event.special.leftclick = {
setup: function () {
$(this).bind("click",leftClick.handler);
}
,
teardown: function () {
$(this).unbind("click",leftClick.handler);
}
,
handler: function (e) {
if (! e.button)
{
e.type = "leftclick";
$.event.handle.apply(this,arguments);
e.type = "click";
}

}
};
}
)(jQuery);
;
(function () {
var instances, sysChannel, update = function () {
var instance, i = 0;
while (instance = instances[i++]) instance.val(instance.elem("input").val());
}
, getActiveElement = function (doc) {
try {
return doc.activeElement;
}
catch (e) {

}

}
;
BEM.DOM.decl("b-form-input",{
onSetMod: {
"js": function () {
var _this = this, input = _this.elem("input"), activeElement = getActiveElement(_this.__self.doc[0]), haveToSetAutoFocus = _this.params.autoFocus && ! (activeElement && $(activeElement).is("input, textarea"));
_this._val = input.val();
if (activeElement === input[0] || haveToSetAutoFocus)
{
_this.setMod("focused","yes")._focused = true;
}

if (! sysChannel)
{
instances = [];
sysChannel = _this.channel("sys").on({
"tick": update,
"idle": function () {
sysChannel.un("tick",update);
}
,
"wakeup": function () {
sysChannel.on("tick",update);
}
});
}

_this._instanceIndex = instances.push(_this.bindTo(input,{
focus: _this._onFocus,
blur: _this._onBlur})) - 1;
_this.params.shortcut && _this.bindToDoc("keydown",function (e) {
if (e.ctrlKey && e.keyCode == 38 && ! $(e.target).is("input, textarea"))
{
_this.setMod("focused","yes");
}

}
);
}
,
"disabled": function (modName, modVal) {
this.elem("input").attr("disabled",modVal == "yes");
}
,
"focused": function (modName, modVal) {
if (this.hasMod("disabled","yes"))
return false;
var focused = modVal == "yes";
focused ? this._focused || this._focus() : this._focused && this._blur();
this.afterCurrentEvent(function () {
this.trigger(focused ? "focus" : "blur");
}
);
}
},
onElemSetMod: {
"message": {
"visibility": function (elem, modName, modVal) {
var _this = this, type = _this.getMod(elem,"type");
if (type)
{
var needSetMod = true;
modVal || _this.elem("message","type",type).each(function () {
this != elem[0] && _this.hasMod($(this),"visibility","visible") && (needSetMod = false);
}
);
needSetMod && _this.toggleMod("message-" + type,"yes","",modVal === "visible");
}

}
}},
val: function (val, data) {
if (typeof val == "undefined")
return this._val;
if (this._val != val)
{
var input = this.elem("input");
input.val() != val && input.val(val);
this._val = val;
this.trigger("change",data);
}

return this;
}
,
getSelectionEnd: function () {
var input = this.elem("input")[0], end = 0;
if (typeof input.selectionEnd == "number")
{
end = input.selectionEnd;
}
 else
{
var range = document.selection.createRange();
if (range && range.parentElement() == input)
{
var len = input.value.length, textInputRange = input.createTextRange();
textInputRange.moveToBookmark(range.getBookmark());
var endRange = input.createTextRange();
endRange.collapse(false);
end = textInputRange.compareEndPoints("EndToEnd",endRange) > - 1 ? len : - textInputRange.moveEnd("character",- len);
}

}

return end;
}
,
name: function (name) {
return this.elem("input").attr("name");
}
,
_onFocus: function () {
this._focused = true;
return this.setMod("focused","yes");
}
,
_onBlur: function () {
var self = this;
if (self._preventBlur)
{
setTimeout(function () {
self._focus();
}
,0);
return self;
}

self._focused = false;
return self.delMod("focused");
}
,
_focus: function () {
var input = this.elem("input")[0];
if (input.createTextRange && ! input.selectionStart)
{
var range = input.createTextRange();
range.move("character",input.value.length);
range.select();
}
 else
{
input.focus();
}

}
,
_blur: function () {
this.elem("input").blur();
}
,
destruct: function () {
this.__base.apply(this,arguments);
this.params.shortcut && this.unbindFromDoc("keydown");
instances.splice(this._instanceIndex,1);
var i = this._instanceIndex, instance;
while (instance = instances[i++]) --instance._instanceIndex;
}
});
BEM.HTML.decl("b-form-input",{
onBlock: function (ctx) {
var id = ctx.param("id") || ctx.generateId();
ctx.tag("span").tParam("id",id).tParam("has-clear",ctx.mod("has-clear") === "yes").tParam("type",ctx.mod("type") || "input").afterContent({
elem: "box",
tag: "span",
content: {
elem: "input",
attrs: {
value: ctx.param("value"),
name: ctx.param("name"),
id: id}}}).js(true);
}
,
onElem: {
"input": function (ctx) {
ctx.tag(ctx.tParam("type"));
}
,
"label": function (ctx) {
ctx.tag("label").attr("for",ctx.tParam("id"));
}
,
"box": function (ctx) {
if (ctx.tParam("has-clear"))
{
ctx.afterContent({
elem: "clear",
tag: "span"});
}

}
,
"hint": function (ctx) {
ctx.tag("label").attr("for",ctx.tParam("id"));
}
}});
}
)();
;
(function () {
var timer, counter = 0, isIdle = false, idleInterval = 0, channel = BEM.channel("sys"), TICK_INTERVAL = 50;
BEM.decl("i-system",{
},{
start: function () {
$(document).bind("mousemove keydown",function () {
idleInterval = 0;
if (isIdle)
{
isIdle = false;
channel.trigger("wakeup");
}

}
);
this._tick();
}
,
_tick: function () {
var _this = this;
channel.trigger("tick",{
counter: counter++});
if (! isIdle && (idleInterval += TICK_INTERVAL) > 3000)
{
isIdle = true;
channel.trigger("idle");
}

timer = setTimeout(function () {
_this._tick();
}
,TICK_INTERVAL);
}
}).start();
}
)();
;
BEM.DOM.decl("b-form-button",{
onSetMod: {
"js": function () {
var disabled = this.isDisabled();
(this._href = this.domElem.attr("href")) && disabled && this.domElem.removeAttr("href");
this.elem("input").attr("disabled",disabled);
}
,
"focused": {
"yes": function () {
var _this = this;
if (_this.isDisabled())
return false;
_this.bindTo("keydown",this._onKeyDown).elem("input").is(":focus") || _this.elem("input").focus();
_this._unloadInited || (_this._unloadInited = $(window).bind("unload",function () {
_this.delMod("focused");
}
));
}
,
"": function () {
this.unbindFrom("keydown").elem("input").blur();
}
},
"disabled": function (modName, modVal) {
var disable = modVal == "yes";
this._href && (disable ? this.domElem.removeAttr("href") : this.domElem.attr("href",this._href));
disable && this.domElem.keyup();
this.afterCurrentEvent(function () {
this.domElem && this.elem("input").attr("disabled",disable);
}
);
}
,
"pressed": function (modName, modVal) {
this.isDisabled() || this.trigger(modVal == "yes" ? "press" : "release");
}
,
"hovered": {
"": function () {
this.delMod("pressed");
}
},
"*": function (modName) {
if (this.isDisabled() && "hovered pressed".indexOf(modName) > - 1)
return false;
}
},
isDisabled: function () {
return this.hasMod("disabled","yes");
}
,
url: function (val) {
if (typeof val == "undefined")
{
return this._href;
}
 else
{
this._href = val;
this.isDisabled() || this.domElem.attr("href",val);
return this;
}

}
,
_onKeyDown: function (e) {
var keyCode = e.keyCode;
if ((keyCode == 13 || keyCode == 32) && ! this._keyDowned)
{
this._keyDowned = true;
this.setMod("pressed","yes").bindTo("keyup",function () {
this.delMod("pressed").unbindFrom("keyup");
delete this._keyDowned;
if (keyCode == 32 && this.domElem.attr("href"))
{
document.location = this.domElem.attr("href");
}

}
);
}

}
,
_onClick: function (e) {
this.isDisabled() ? e.preventDefault() : this.afterCurrentEvent(function () {
this.trigger("click");
}
);
}
,
destruct: function () {
this.delMod("focused");
this.__base.apply(this,arguments);
}
},{
live: function () {
var eventsToMods = {
"mouseover": {
name: "hovered",
val: "yes"},
"mouseout": {
name: "hovered"},
"mousedown": {
name: "pressed",
val: "yes"},
"mouseup": {
name: "pressed"},
"focusin": {
name: "focused",
val: "yes"},
"focusout": {
name: "focused"}};
this.liveBindTo("leftclick",function (e) {
this._onClick(e);
}
).liveBindTo("mouseover mouseout mouseup focusin focusout",function (e) {
var mod = eventsToMods[e.type];
this.setMod(mod.name,mod.val || "");
}
).liveBindTo("mousedown",function (e) {
var mod = eventsToMods[e.type];
e.which == 1 && this.setMod(mod.name,mod.val || "");
}
);
}
});
BEM.HTML.decl("b-form-button",{
onBlock: function (ctx) {
ctx.tag(ctx.param("url") ? "a" : "span").attrs({
href: ctx.param("url"),
target: ctx.param("target")}).mods({
size: ctx.mod("size"),
theme: ctx.mod("theme")}).content([{
elem: "left",
tag: "i"}, {
elem: "content",
tag: "span",
content: {
elem: "text",
tag: "span",
content: ctx.content()}}],true).afterContent(ctx.param("type") ? {
elem: "input",
attrs: {
value: ctx.param("value") || "",
type: ctx.param("type"),
name: ctx.param("name"),
disabled: ctx.mod("disabled") && "disabled"}} : {
elem: "click"}).js(true);
}
,
onElem: {
"input": function (ctx) {
ctx.tag("input");
}
,
"click": function (ctx) {
ctx.tag("i");
}
}});
;
(function ($) {
BEM.DOM.decl("b-traffic-map",{
_map: {
map: null,
api: {
ready: false,
error: false,
loaded: false,
timer: null,
startLoad: 0,
_callback: Function.empty,
clearTimer: function () {
if (this.timer)
{
clearTimeout(this.timer);
this.timer = null;
}

}
,
loadTimer: function () {
var mapAPI = this;
if (! mapAPI.loaded && ! mapAPI.timer && mapAPI.startLoad)
{
mapAPI.timer = setTimeout(function () {
mapAPI.timer = null;
if (! mapAPI.loaded)
{
mapAPI.loaded = true;
mapAPI.error = true;
mapAPI._callback(true,true);
}

}
,9000);
}

}
,
load: function (callback, setTimer) {
if (this.startLoad)
{
return;
}

this.startLoad = (new Date()).valueOf();
var mapAPI = this;
this._callback = callback || Function.empty;
var config = BEM.blocks["i-widget-traffic"].config;
var lang = this.utils.getLang(config.API_LANGS);
var apiUrl = config.MAP_API_URL + lang;
BEM.blocks["i-widget-helper"].getScript(apiUrl,function () {
mapAPI.loaded = true;
if (mapAPI.error)
{
return;
}

if (window.ymaps && window.ymaps.ready)
{
ymaps.ready(function () {
if (mapAPI.error)
{
return;
}

mapAPI.clearTimer();
mapAPI.ready = true;
mapAPI.error = false;
mapAPI._callback(false,false);
}
);
}
 else
{
mapAPI.clearTimer();
mapAPI.error = true;
mapAPI._callback(true,false);
}

}
);
setTimer && this.loadTimer();
}
},
init: function (widget) {
this.utils = widget.utils;
this.api.utils = widget.utils;
}
,
zoomCtrlPos: function (topic, top) {
if (this.map)
{
if (! this._szc)
{
this.map.controls.add("smallZoomControl",{
top: top + 7,
left: 7});
this._szc = this.map.controls.get("smallZoomControl");
}
 else
{
this._szc.options.set("position",{
top: top + 7,
left: 7});
}

}

}
,
create: function (params, elem) {
if (this.map || ! params || ! this.api.ready)
{
return false;
}

this.map = new ymaps.Map(elem, {
center: params.center,
zoom: params.zoom,
behaviors: ["drag", "scrollZoom", "dblClickZoom"]});
var helper = BEM.blocks["i-widget-helper"];
helper.addListener("put.zoomCtrlTop",this.zoomCtrlPos,this);
helper.fireEvent("get.zoomCtrlTop");
var trafficControl = new ymaps.control.TrafficControl();
this.map.controls.add(trafficControl,{
top: - 407,
left: 7});
trafficControl.state.set("shown",true);
var lt = this._szc.getLayout();
if (lt)
{
lt.events.add("click",function () {
BEM.blocks["i-widget-helper"].logAction(6);
}
);
}

return true;
}
,
correct: function (item) {
if (this.map.getZoom() != item.zoom || this.utils.distance(this.map.getCenter(),item.center,item.zoom) > 0.1)
{
this.map.setCenter(item.center,item.zoom);
}

}
},
_route: {
loading: false,
time: 0,
interval: 20,
route: null,
revert: false,
map: null,
utils: null,
viewHeights: null,
init: function (widget) {
this.utils = widget.utils;
}
,
isExpired: function () {
if (! this.route)
{
return false;
}

return (new Date()).valueOf() - this.time > 1000 * 60 * this.interval || this.utils.isRouteRevertByTime() != this.revert;
}
,
setRoute: function (route, rev) {
route = route || null;
if (this.route == route)
{
return;
}

if (this.route)
{
this.map.geoObjects.remove(this.route);
this.route = null;
}

this.time = (new Date()).valueOf();
if (! route)
{
return;
}

this.route = route;
this.revert = rev;
this.map.geoObjects.add(route);
var boundedBy = route.properties.get("boundedBy");
var mapSizes = this.viewHeights;
var hm = mapSizes.height - mapSizes.paddingTop - mapSizes.paddingBottom;
var hr = boundedBy[1][0] - boundedBy[0][0];
boundedBy[0][0] = boundedBy[0][0] - hr * mapSizes.paddingBottom / hm;
boundedBy[1][0] = boundedBy[1][0] + hr * mapSizes.paddingTop / hm;
var th = this;
this.map.setBounds(boundedBy,{
checkZoomRange: true,
callback: function (err) {
if (err)
{

}
 else
{
th.zoom = th.map.getZoom();
th.center = th.map.getCenter();
}

}
});
}
},
_placemark: {
time: 0,
interval: 20,
obj: null,
map: null,
utils: null,
init: function (widget) {
this.utils = widget.utils;
var engYa = widget.config.ENG_YA_SYMBOL[this.utils.getLang()];
this.yaImgUrl = widget.config["YA_SYMBOL_PATH_" + (engYa ? "EN" : "RU")];
}
,
create: function () {
var ctm = (new Date()).valueOf();
if (this.map && ctm - this.time > 1000 * 60 * this.interval)
{
if (this.obj)
{
this.map.geoObjects.remove(this.obj);
this.obj = null;
}

var gloc = this.utils.getLL();
this.obj = new ymaps.Placemark([gloc.latitude, gloc.longitude], {
}, {
iconImageHref: this.yaImgUrl,
iconImageSize: [32, 32],
iconImageOffset: [- 20, - 20]});
this.map.geoObjects.add(this.obj);
this.time = ctm;
}

}
},
platform_i18n: function (helper, i) {

}
,
isApiErrorState: function () {
return this._map.api.error;
}
,
isApiReadyState: function () {
return this._map.api.ready;
}
,
init: function () {
this._helper = BEM.blocks["i-widget-helper"];
this._widget = BEM.blocks["i-widget-traffic"];
this._map.init(this._widget);
this._route.init(this._widget);
this._placemark.init(this._widget);
this._helper.addListener("traffic-before-popup",function () {
if (this._map.map)
{
this._placemark.create();
if (this._route.route)
{
if (this._route.isExpired())
{
this.makeMyRoute(this._widget.storage.loadRouteData());
}
 else
{
this._map.correct(this._route);
}

}
 else
{
var savedRouteData = this._widget.storage.loadRouteData();
if (savedRouteData)
{
this.makeMyRoute(savedRouteData);
}
 else
{
this._map.correct(this._widget.getMapConfig().region);
}

}

}

this.loadMap();
}
,this);
}
,
loadMap: function () {
var self = this;
this._map.api.load(function (error, fromTimer) {
if (error)
{
self._helper.fireEvent("map.apierror",fromTimer);
}
 else
{
self.createMap();
}

}
);
}
,
deleteRoute: function () {
if (this._route.loading)
{
this._route.canceled = true;
}

this._route.setRoute(null);
}
,
makeMyRoute: function (data, saveRoute) {
if (this._route.loading || ! data || ! this._map.map)
{
return;
}

var rev = ! ! data.revert;
var home = data.homePoint || data.home;
var work = data.workPoint || data.work;
var self = this;
ymaps.route([rev ? work : home, rev ? home : work],{
boundedBy: this._map.map.getBounds(),
avoidTrafficJams: true}).then(function (route) {
self._route.loading = false;
if (self._route.canceled)
{
self._route.canceled = false;
return;
}

if (route.getLength() < 2)
{
return;
}

self._route.setRoute(route,rev);
var points = route.getWayPoints();
points.options.set("preset","twirl#blueStretchyIcon");
points.get(0).properties.set("iconContent",BEM.I18N("b-traffic","route.begin.title"));
points.get(1).properties.set("iconContent",BEM.I18N("b-traffic","route.end.title"));
var point0 = points.get(0).geometry.getBounds()[0];
var point1 = points.get(1).geometry.getBounds()[0];
data.homePoint = rev ? [point1[0], point1[1]] : [point0[0], point0[1]];
data.workPoint = rev ? [point0[0], point0[1]] : [point1[0], point1[1]];
data.home = points.get(rev ? 1 : 0).properties.get("balloonContentBody");
data.work = points.get(rev ? 0 : 1).properties.get("balloonContentBody");
self._helper.fireEvent("map.route",{
data: data,
route: route,
revert: rev,
isNewRoute: saveRoute});
}
,function (error) {
self._route.loading = false;
self._route.canceled = false;
self._helper.fireEvent("map.routeerror",saveRoute);
}
);
self._route.loading = true;
}
,
createMap: function () {
var mapDataFromExport = this._widget.getMapConfig();
if (! mapDataFromExport || this._map.map || ! this._map.api.ready)
{
return false;
}

var savedRouteData = this._widget.storage.loadRouteData();
this._helper.fireEvent("map.create");
this._map.create(mapDataFromExport.region,this.elem("ymap")[0]);
this._route.viewHeights = {
height: this.elem("ymap").height(),
paddingTop: 34,
paddingBottom: 2};
this._route.map = this._map.map;
this._placemark.map = this._map.map;
var self = this;
setTimeout(function () {
self.elem("ymap").find("a").click(function (e) {
self._helper.openNewTab(this.href);
return false;
}
);
}
,250);
this._placemark.create();
this.makeMyRoute(savedRouteData);
return true;
}
,
setLoadTimer: function () {
this._map.api.loadTimer();
}
,
getSPN: function (encoding) {
if (! this._map.map)
{
return "";
}

var bounds = this._map.map.getBounds();
return bounds[1][1] - bounds[0][1] + (encoding ? "%2C" : ",") + (bounds[1][0] - bounds[0][0]);
}
,
getCenter: function () {
return this._map.map.getCenter();
}
,
getRoute: function () {
return this._route.route;
}
,
getMapUrl: function () {
var domain = this._widget.config.MAP_URL;
if (! this._map.map)
{
return domain;
}

var cen = this._map.map.getCenter();
var params = ["z=" + this._map.map.getZoom(), "ll=" + cen[1] + "%2C" + cen[0], "l=map%2Ctrf", "elmt=traffic"];
if (this._route.route)
{
var points = this._route.route.getWayPoints();
var p0 = points.get(0).geometry.getBounds()[0];
var p1 = points.get(1).geometry.getBounds()[0];
params.push("rt=" + p0[1] + "%2C" + p0[0] + "~" + p1[1] + "%2C" + p1[0]);
}

return domain + "?" + params.join("&");
}
,
setErrorText: function (text) {
this.elem("error").text(text);
}
},{
live: function () {
this.liveBindTo("leftclick",function (e) {

}
);
}
});
}
)(jQuery);
;
(function (global_, bem_, undefined) {
if (typeof bem_.I18N === "function" && bem_.I18N._proto)
{
return bem_.I18N;
}

if (typeof i18n === "undefined")
{
i18n = {
};
}

BEM = bem_;
var MOD_DELIM = "_", ELEM_DELIM = "__", DEFAULT_LANG = "ru", cache = {
}, stack = [], log = typeof console !== "undefined" && console.log ? console.log.bind(console) : function () {

}
;
function bemName(decl) {
typeof decl === "string" && (decl = {
block: decl});
return decl.block + (decl.elem ? ELEM_DELIM + decl.elem : "") + (decl.modName ? MOD_DELIM + decl.modName + MOD_DELIM + decl.modVal : "");
}

function bemParse(name) {
var bemitem = {
};
name.split(ELEM_DELIM).forEach(function (item, i) {
var keys = [i ? "elem" : "block", "mod", "val"];
item.split(MOD_DELIM).forEach(function (part, j) {
bemitem[keys[j]] = part;
}
);
}
);
return bemitem;
}

function _pushStack(name) {
if (! name)
return false;
return stack.push(name);
}

function _popStack() {
return stack.length && stack.pop();
}

function _i18n() {
this._lang = "";
this._prj = "lego";
this._keyset = "";
this._key = "";
}

_i18n.prototype = {
lang: function (name) {
this._lang = name;
return this;
}
,
project: function (name) {
this._prj = name;
return this;
}
,
keyset: function (name, saveCtx) {
saveCtx && _pushStack(this._keyset);
this._keyset = bemName(name);
return this;
}
,
key: function (name) {
this._key = name;
return this;
}
,
decl: function (v) {
var bemitem = bemParse(this._keyset), prj = bemitem.block === "i-tanker" ? "tanker" : this._prj, keyset = bemitem.elem || this._keyset, key = this._key;
prj = i18n[prj] || (i18n[prj] = {
});
keyset = prj[keyset] || (prj[keyset] = {
});
keyset[key] = typeof v === "function" ? v : function (p) {
return v;
}
;
var l = cache[this._lang] || (cache[this._lang] = {
}), k = l[this._keyset] || (l[this._keyset] = {
});
k[key] = v;
}
,
val: function (params, ctx) {
var value = cache[this._lang] && cache[this._lang][this._keyset], debugString = "keyset: " + this._keyset + " key: " + this._key + " (lang: " + this._lang + ")";
if (! value)
{
log("[I18N_NO_KEYSET] %s",debugString);
return "";
}

value = value[this._key];
var valtype = typeof value;
if (valtype === "undefined")
{
log("[I18N_NO_VALUE] %s",debugString);
return "";
}

if (valtype === "string")
{
return value;
}

ctx || (ctx = this);
return value.call(ctx,params);
}
,
_cache: function () {
return cache;
}
};
bem_.I18N = (function (base) {
var klass = function (keyset, key, params) {
return klass.keyset(keyset).key(key,params);
}
;
klass._proto = base;
klass.project = function (name) {
this._proto.project(name);
return this;
}
;
klass.keyset = function (name) {
this._proto.keyset(name,true);
return this;
}
;
klass.key = function (name, params) {
var proto = this._proto, result, ksetRestored;
proto.lang(this._lang).key(name);
result = proto.val.call(proto,params,klass);
ksetRestored = _popStack();
ksetRestored && proto.keyset(ksetRestored,false);
return result;
}
;
klass.decl = function (bemitem, keysets, params) {
var proto = this._proto, k;
params || (params = {
});
params.lang && proto.lang(params.lang);
proto.keyset(bemitem);
for(k in keysets) {
if (keysets.hasOwnProperty(k))
{
proto.key(k).decl(keysets[k]);
}

}

return this;
}
;
klass.lang = function (lang) {
typeof lang !== "undefined" && (this._lang = lang);
return this._lang;
}
;
klass.lang(DEFAULT_LANG);
return klass;
}
)(new _i18n());
}
)(this,typeof BEM === "undefined" ? {
} : BEM);
(function (bem_, undefined) {
var DEFAULT_BRAND = null;
var base = bem_.I18N._i18n;
bem_.I18N.brand = (function () {
var _brand = DEFAULT_BRAND;
var klass = function (brand) {
base.setDeclProp("brand",brand);
}
;
return klass;
}
)();
}
)(typeof BEM === "undefined" ? {
} : BEM);
BEM.I18N.decl("b-form-input",{
"search": "Поиск",
"search-label": "поиск",
"vid": "Видео"},{
"lang": "ru"});
BEM.I18N.decl("b-traffic",{
"address": "Адрес",
"balls": "баллов",
"balls1": "балл",
"balls234": "балла",
"domain": "http://maps.yandex.ru/",
"domain.suggest": "http://suggest-maps.yandex.ru/suggest-geo",
"error.longroute": "некоторые участки маршрута перекрыты.",
"error.map": "Произошла ошибка при открытии карты. Попробуйте позднее.",
"error.net": "Нет подключения к интернету",
"error.route": "Невозможно проложить маршрут между заданными точками.",
"error.server": "Нет данных о пробках",
"home": "Дом",
"last.resp": function (params) {
return "по последним данным на " + params.content;
}
,
"link.map": "На большой карте",
"make.route": "Проложить",
"my.route": "Мой маршрут",
"notraffic": "Нет данных о пробках",
"remove.route": "Удалить",
"route.begin.title": "А",
"route.end.title": "Б",
"set.points": "Указать маршрут",
"time.h": "ч",
"time.m": "мин",
"title": "Виджет пробок",
"to.home": function (params) {
return "домой добираться " + params.content;
}
,
"to.url": "как объехать",
"to.work": function (params) {
return "на работу добираться " + params.content;
}
,
"work": "Работа"},{
"lang": "ru"});
BEM.I18N.decl("b-form-input",{
"search": "Search",
"search-label": "search",
"vid": "Video"},{
"lang": "en"});
BEM.I18N.decl("b-traffic",{
"address": "Address",
"balls": "points",
"balls1": "point",
"balls234": "points",
"domain": "http://maps.yandex.com/",
"domain.suggest": "http://suggest-maps.yandex.ru/suggest-geo",
"error.longroute": "some sections of the route are closed.",
"error.map": "Unable to open map. Please try again later.",
"error.net": "No internet connection",
"error.route": "Unable to create route between these points",
"error.server": "No traffic info",
"home": "Home",
"last.resp": function (params) {
return "last updated " + params.content;
}
,
"link.map": "Main map",
"make.route": "Get directions",
"my.route": "My route",
"notraffic": "No traffic data",
"remove.route": "Remove",
"route.begin.title": "A",
"route.end.title": "B",
"set.points": "Create route",
"time.h": "hr.",
"time.m": "min.",
"title": "Traffic widget",
"to.home": function (params) {
return "journey time home " + params.content;
}
,
"to.url": "avoid traffic",
"to.work": function (params) {
return "journey time to work " + params.content;
}
,
"work": "Work"},{
"lang": "en"});
BEM.I18N.decl("b-form-input",{
"search": "Arama",
"search-label": "arama",
"vid": "Video"},{
"lang": "tr"});
BEM.I18N.decl("b-traffic",{
"address": "Adres",
"balls": "derece",
"balls1": "derece",
"balls234": "derece",
"domain": "http://maps.yandex.com.tr/",
"domain.suggest": "http://suggest-maps.yandex.com.tr/suggest-geo",
"error.longroute": "rotanızdaki bazı yollar trafiğe kapalı.",
"error.map": "Harita açılırken hata oluştu. Daha sonra tekrar deneyin.",
"error.net": "İnternet bağlantısı yok",
"error.route": "Seçtiğiniz noktalar arasında rota hesaplanamıyor.",
"error.server": "Trafik bilgisi yok",
"home": "Ev",
"last.resp": function (params) {
return "son verilere göre " + params.content;
}
,
"link.map": "Büyük haritada",
"make.route": "Belirle",
"my.route": "Rotam",
"notraffic": "Trafik bilgisi yok",
"remove.route": "Sil",
"route.begin.title": "A",
"route.end.title": "B",
"set.points": "Rotayı belirle",
"time.h": "sa.",
"time.m": "dk.",
"title": "Trafik widgeti",
"to.home": function (params) {
return "eve " + params.content;
}
,
"to.url": "trafiğe takılmadan nasıl gidilir",
"to.work": function (params) {
return "işe " + params.content;
}
,
"work": "İş"},{
"lang": "tr"});
BEM.I18N.decl("b-form-input",{
"search": "Іздестіру",
"search-label": "іздестіру",
"vid": "Відео"},{
"lang": "kk"});
BEM.I18N.decl("b-traffic",{
"address": "Мекен-жай",
"balls": "балл",
"balls1": "балл",
"balls234": "балл",
"domain": "http://maps.yandex.ru/",
"domain.suggest": "http://suggest-maps.yandex.ru/suggest-geo",
"error.longroute": "маршруттың кейбір бөліктері жабылған",
"error.map": "Картаны ашуда қате кетті. Кейінірек сынап көріңіз.",
"error.net": "Интернетке қосылыс жоқ",
"error.route": "Белгіленген нүктелер аралығында маршрут құру мүмкін емес.",
"error.server": "Кептелістер туралы дерек жоқ",
"home": "Үй",
"last.resp": function (params) {
return "соңғы деректер бойынша " + params.content;
}
,
"link.map": "Үлкен картада",
"make.route": "Құру",
"my.route": "Менің маршрутым",
"notraffic": "Кептелістер туралы деректер жоқ",
"remove.route": "Жою",
"route.begin.title": "А",
"route.end.title": "Б",
"set.points": "Маршрут көрсету",
"time.h": "сағ",
"time.m": "мин",
"title": "Кептелістер виджеті",
"to.home": function (params) {
return "үйге жету " + params.content;
}
,
"to.url": "айналып өту",
"to.work": function (params) {
return "жұмысқа жету " + params.content;
}
,
"work": "Жұмыс"},{
"lang": "kk"});
BEM.I18N.decl("b-form-input",{
"search": "Пошук",
"search-label": "знайти",
"vid": "Відео"},{
"lang": "uk"});
BEM.I18N.decl("b-traffic",{
"address": "Адреса",
"balls": "балів",
"balls1": "бал",
"balls234": "бали",
"domain": "http://maps.yandex.ua/",
"domain.suggest": "http://suggest-maps.yandex.ru/suggest-geo",
"error.longroute": "деякі ділянки маршруту перекриті.",
"error.map": "Виникла помилка під час відкриття карти. Спробуйте пізніше.",
"error.net": "Немає підключення до інтернету",
"error.route": "Неможливо прокласти маршрут між заданими точками.",
"error.server": "Немає даних про затори",
"home": "Дім",
"last.resp": function (params) {
return "за останніми даними на " + params.content;
}
,
"link.map": "На великій карті",
"make.route": "Прокласти",
"my.route": "Мій маршрут",
"notraffic": "Немає даних про затори",
"remove.route": "Видалити",
"route.begin.title": "А",
"route.end.title": "Б",
"set.points": "Вказати маршрут",
"time.h": "год",
"time.m": "хв",
"title": "Віджет заторів",
"to.home": function (params) {
return "додому добиратися " + params.content;
}
,
"to.url": "як об'їхати",
"to.work": function (params) {
return "на роботу добиратися " + params.content;
}
,
"work": "Робота"},{
"lang": "uk"});
BEM.I18N.decl("b-form-input",{
"search": "Пошук",
"search-label": "пошук",
"vid": "Відэа"},{
"lang": "be"});
BEM.I18N.decl("b-traffic",{
"address": "Адрас",
"balls": "балаў",
"balls1": "бал",
"balls234": "балы",
"domain": "http://maps.yandex.ru/",
"domain.suggest": "http://suggest-maps.yandex.ru/suggest-geo",
"error.longroute": "некаторыя ўчасткі маршруту перекрытыя.",
"error.map": "Адбылася памылка падчас адчынення мапы Паспрабуйце пазней.",
"error.net": "Няма далучэння да інтэрнета",
"error.route": "Немагчыма пракласці маршрут паміж зададзенымі пунктамі.",
"error.server": "Няма звестак пра пробкі",
"home": "Дом",
"last.resp": function (params) {
return "паводле апошніх звестак на " + params.content;
}
,
"link.map": "На вялікай мапе",
"make.route": "Пракласці",
"my.route": "Мой маршрут",
"notraffic": "Няма звестак пра пробкі",
"remove.route": "Выдаліць",
"route.begin.title": "А",
"route.end.title": "Б",
"set.points": "Указаць маршрут",
"time.h": "гадз.",
"time.m": "хв.",
"title": "Віджэт пробак",
"to.home": function (params) {
return "дамой дабірацца " + params.content;
}
,
"to.url": "як аб'ехаць",
"to.work": function (params) {
return "на працу дабірацца " + params.content;
}
,
"work": "Праца"},{
"lang": "be"});
