(function(a){if(!a){a=window.Lego={};
}a.messages=a.messages||{};
a.message=function(c,b){return a.params.locale=="ru"?b:(a.messages[c]||b);
};})(window.Lego);
(function(){var a=function(){var b=document.documentElement.style;
return typeof b.borderRadius==="string"||typeof b.WebkitBorderRadius==="string"||typeof b.KhtmlBorderRadius==="string"||typeof b.MozBorderRadius==="string";
};document.documentElement.className+=a()?" m-border-radius":" m-no-border-radius";
}());(function(a){if(!a){a=window.Lego={};
}a.c=function(c,b,i){var g=(i&&i.host)||"clck.yandex.ru",d=function(k,m,l,j){return m.indexOf("/dtype=")>-1?m:location.protocol+"//"+g+"/"+l+"/dtype="+k+"/rnd="+((new Date()).getTime()+Math.round(Math.random()*100))+(j?"/*"+(m.match(/^http/)?m:location.protocol+"//"+location.host+(m.match("^/")?m:"/"+m)):"/*data="+encodeURIComponent("url="+encodeURIComponent((m.match(/^http/)?m:location.protocol+"//"+location.host+(m.match("^/")?m:"/"+m)))));
},f=function(){var j=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];
var h=document.createElement("script");
h.setAttribute("src",d(c,location.href,"jclck"));
j.insertBefore(h,j.firstChild);
};if(b){if(b.className.match(/b-pseudo-link/)||(b.href&&b.href.match(/^mailto:/))||(i&&i.noRedirect===true)){f();
}else{if(b.href){var e=b.href;
b.href=d(c,e,"redir");
setTimeout(function(){b.href=e;
},500);}else{if(b.form){if(b.type.match(/submit|button|image/)){var e=b.form.action;
b.form.action=d(c,e,"redir",true);
setTimeout(function(){b.form.action=e;
},500);}else{f();
}}else{if(b.action){b.action=d(c,b.action,"redir",true);
}else{throw"counter.js: not link and not form!";
}}}}}else{f();
}};})(window.Lego);
(function(a){if(!a){a=window.Lego={};
}a.cp=function(f,c,e,b,d){a.c("stred/pid="+f+"/cid="+c+(e?"/path="+e:""),b,d);
};})(window.Lego);
(function(a){if(!a){a=window.Lego={};
}a.ch=function(c,b){if(a.params["show-counters"]){a.cp(0,2219,c,b);
}};})(window.Lego);
(function(a){if(!a){a=window.Lego={};
}a.getCookie=function(h){var g=document.cookie;
if(g.length<1){return false;
}var d=g.indexOf(h+"=");
if(d==-1){return false;
}d+=(h.length+1);
var f=g.indexOf(";",d);
return decodeURIComponent((f==-1)?g.substring(d):g.substring(d,f));
};})(window.Lego);
(function(a){if(!a){a=window.Lego={};
}a.isSessionValid=function(){return !!a.getCookie("yandex_login");
};})(window.Lego);
(function(b,a){if(!a){a=window.Lego={};
}a.init||(a.init=function(c){(c=a.params=b.extend({id:"",login:a.isSessionValid()?a.getCookie("yandex_login")||"":"",yandexuid:a.getCookie("yandexuid"),locale:"ru",retpath:window.location.toString(),"passport-host":"//passport.yandex.ru","pass-host":"//pass.yandex.ru","passport-msg":c.id,"social-host":"//social.yandex.ru","lego-path":"/lego","show-counters-percent":100},c,a.params))["show-counters"]=Math.round(Math.random()*100)<=c["show-counters-percent"];
b(function(){c.oframebust&&a.oframebust(c.oframebust);
});return c;
});a.block||(a.block={});
a.blockInit||(a.blockInit=function(c,d){c=c||document;
d=d||".g-js";
b(c).find(d).each(function(){var h=b(this),g=this.onclick?this.onclick():{},e=g.name||"",f=a.block[e];
if(f&&!h.data(e)){f.call(h,g);
h.data(e,true).addClass(e+"_js_inited");
}});});a.blockInitBinded||(a.blockInitBinded=!!b(document).ready(function(){a.blockInit();
}));})(jQuery,window.Lego);
(function(a){a=a||{};
a.oframebustMatchDomain=function(g,h){g=Object.prototype.toString.call(g)==="[object Array]"?g:(function(){var d=[];
for(var e in g){g.hasOwnProperty(e)&&d.push(e);
}return d;}());
for(var c=0,b=g.length;
c<b;c++){var k=g[c];
if(typeof(k)=="string"){if(/(\?|\*)/.test(k)){var f=k.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".{1}");
if((new RegExp("^"+f+"$")).test(h)){return true;
}}else{if(h==k){return true;
}}}else{try{if(k.test(h)){return true;
}}catch(j){}}}};
})(window.Lego);
(function(a){if(!a){a=window.Lego={};
}a.oframebust=function(c){if(location==top.location){return;
}var d=(location.search.match(/[&?]oframebust=([^&;]+)/)||[])[1];
if(!d){top.location=location;
}if(a.oframebustMatchDomain(c,d)){var b=document.createElement("iframe");
b.style.position="absolute";
b.style.left="-999px";
b.style.width="1px";
b.src="//"+d+"/oframebust.html?"+encodeURIComponent(location.href);
(function(){if(document.body&&document.body.firstChild){document.body.insertBefore(b,document.body.firstChild);
}else{setTimeout(arguments.callee,0);
}})();return;
}top.location=location;
};})(window.Lego);
(function(e){var b=(function(){_;
}).toString().indexOf("_")>-1,a=e.browser.msie,c=a?["toString","valueOf"]:null,f=function(){};
function d(h,g,i){var k=false;
if(a){var j=[];
e.each(c,function(){i.hasOwnProperty(this)&&(k=true)&&j.push({name:this,val:i[this]});
});if(k){e.each(i,function(l){j.push({name:l,val:this});
});i=j;}}e.each(i,function(m,n){if(k){m=n.name;
n=n.val;}if(e.isFunction(n)&&(!b||n.toString().indexOf(".__base")>-1)){var l=h[m]||function(){};
g[m]=function(){var p=this.__base;
this.__base=l;
var o=n.apply(this,arguments);
this.__base=p;
return o;};
}else{g[m]=n;
}});}e.inherit=function(){var h=e.isFunction(arguments[0]),n=h?arguments[0]:f,j=arguments[h?1:0]||{},l=arguments[h?2:1],g=j.__constructor||(h&&n.prototype.__constructor)?function(){this.__constructor.apply(this,arguments);
}:function(){};
if(!h){g.prototype=j;
g.prototype.__self=g.prototype.constructor=g;
return e.extend(g,l);
}e.extend(g,n);
var k=function(){},i=k.prototype=n.prototype,m=g.prototype=new k();
m.__self=m.constructor=g;
d(i,m,j);l&&d(n,g,l);
return g;};
e.inheritSelf=function(j,h,i){var g=j.prototype;
d(g,g,h);i&&d(j,j,i);
return j;};
})(jQuery);
(function(c){var a=0,d="__"+(+new Date),b=function(){return"uniq"+ ++a;
};c.identify=function(g,f){if(!g){return b();
}var e="uniqueID" in g?"uniqueID":d;
return f||e in g?g[e]:g[e]=b();
};})(jQuery);
(function(a){a.isEmptyObject||(a.isEmptyObject=function(c){for(var b in c){return false;
}return true;
});})(jQuery);
(function(d){var a="__"+ +new Date+"storage",c=function(f,e){return d.identify(f)+(e?d.identify(e):"");
},b={buildEventName:function(f){return f;
},on:function(o,j,p,s,m){if(typeof o=="string"){if(d.isFunction(j)){s=p;
p=j;j=undefined;
}var f=c(p,s),l=this[a]||(this[a]={}),g=o.split(" "),h=0,q;
while(o=g[h++]){o=this.buildEventName(o);
q=l[o]||(l[o]={ids:{},list:{}});
if(!(f in q.ids)){var n=q.list,r={fn:p,data:j,ctx:s||this,special:m};
if(n.last){n.last.next=r;
r.prev=n.last;
}else{n.first=r;
}q.ids[f]=n.last=r;
}}}else{var k=this;
d.each(o,function(t,i){k.on(t,i,j,m);
});}return this;
},onFirst:function(i,h,g,f){return this.on(i,h,g,f,{one:true});
},un:function(p,q,t){if(typeof p=="string"||typeof p=="undefined"){var n=this[a];
if(n){if(p){var h=p.split(" "),k=0,r;
while(p=h[k++]){p=this.buildEventName(p);
if(r=n[p]){if(q){var g=c(q,t),f=r.ids;
if(g in f){var o=r.list,s=f[g],j=s.prev,l=s.next;
if(j){j.next=l;
}else{if(s===o.first){o.first=l;
}}if(l){l.prev=j;
}else{if(s===o.last){o.last=j;
}}delete f[g];
}}else{delete this[a][p];
}}}}else{delete this[a];
}}}else{var m=this;
d.each(p,function(u,i){m.un(u,i,t);
});}return this;
},trigger:function(k,i){var l=this[a],j;
typeof k==="string"?k=d.Event(this.buildEventName(j=k)):k.type=this.buildEventName(j=k.type);
if(l&&(l=l[k.type])){var h=l.list.first,f,g;
while(h){k.data=h.data;
f=h.fn.call(h.ctx,k,i);
if(typeof f!=="undefined"){k.result=f;
if(f===false){k.preventDefault();
k.stopPropagation();
}}g=h.next;
h.special&&h.special.one&&this.un(j,h.fn,h.ctx);
h=g;}}return this;
}};d.observable=d.inherit(b,b);
})(jQuery);
(function(f,h){var e=[],g={},b={},a={};
function d(k,j,i){return(k?"__elem_"+k:"")+"__mod"+(j?"_"+j:"")+(i?"_"+i:"");
}function c(j,i,k){f.isFunction(j)?(i[d(k,"*","*")]=j):f.each(j,function(m,l){f.isFunction(l)?(i[d(k,m,"*")]=l):f.each(l,function(n,o){i[d(k,m,n)]=o;
});});}this.BEM=f.inherit(f.observable,{__constructor:function(j,k,i){var l=this;
l._modCache=j||{};
l._processingMods={};
l.params=f.extend(l.getDefaultParams(),k);
l._uniqId=l.params.uniqId||f.identify(l);
b[l._uniqId]=l;
i!==false?l._init():l.afterCurrentEvent(l._init);
},_init:function(){var i=this;
if("_uniqId" in i&&!i.hasMod("js","inited")){i.setMod("js","inited").trigger("init");
}return i;},changeThis:function(j,i){var k=this;
return function(){return j.apply(i||k,arguments);
};},afterCurrentEvent:function(j,i){this.__self.afterCurrentEvent(this.changeThis(j,i));
},trigger:function(j,i){this.__base(j=this.buildEvent(j),i).__self.trigger(j,i);
return this;
},buildEvent:function(i){typeof i=="string"&&(i=f.Event(i));
i.block=this;
return i;},hasMod:function(j,k,i){if(arguments.length==2){i=k;
k=j;j=h;}return this.getMod(j,k)===i;
},getMod:function(k,l){var i=typeof k;
if(i==="string"||i==="undefined"){l=k||l;
var j=this._modCache;
return l in j?j[l]:j[l]=this._extractModVal(l);
}return this._getElemMod(l,k);
},_getElemMod:function(k,i,j){return this._extractModVal(k,i,j);
},getMods:function(l){var j=l&&typeof l!="string",m=this,i=[].slice.call(arguments,j?1:0),k=m._extractMods(i,j?l:h);
if(!j){i.length?f.each(i,function(o,n){m._modCache[n]=k[n];
}):m._modCache=k;
}return k;},setMod:function(l,p,q){if(typeof q=="undefined"){q=p;
p=l;l=h;}var m=this;
if(!l||l[0]){var n=(l&&l[0]?f.identify(l[0]):"")+"_"+p;
if(this._processingMods[n]){return m;
}var k,j=l?m._getElemMod(p,l,k=m.__self._extractElemNameFrom(l)):m.getMod(p);
if(j===q){return m;
}this._processingMods[n]=true;
var i=true,o=[p,q,j];
l&&o.unshift(l);
f.each([["*","*"],[p,"*"],[p,q]],function(){i=m._callModFn(k,this[0],this[1],o)!==false&&i;
});!l&&i&&(m._modCache[p]=q);
i&&m._afterSetMod(p,q,l,k);
delete this._processingMods[n];
}return m;},_afterSetMod:function(k,i,j){},toggleMod:function(k,l,j,n,m){if(typeof k=="string"){m=n;
n=j;j=l;l=k;
k=h;}if(typeof n=="undefined"){n="";
}else{if(typeof n=="boolean"){m=n;
n="";}}var i=this.getMod(k,l);
(i==j||i==n)&&this.setMod(k,l,typeof m==="boolean"?(m?j:n):this.hasMod(k,l,j)?n:j);
return this;
},delMod:function(i,j){if(!j){j=i;
i=h;}return this.setMod(i,j,"");
},_callModFn:function(l,k,i,j){var m=d(l,k,i);
return this[m]?this[m].apply(this,j):h;
},_extractModVal:function(j,i){return"";
},_extractMods:function(i,j){return{};
},channel:function(j,i){return this.__self.channel(j,i);
},getDefaultParams:function(){return{};
},del:function(j){var i=[].slice.call(arguments);
typeof j=="string"&&i.unshift(this);
this.__self.del.apply(this.__self,i);
return this;
},destruct:function(){delete b[this.un()._uniqId];
delete this._uniqId;
}},{_name:"i-bem",blocks:g,_uniqIdToBlock:b,getBlockByUniqId:function(i){return b[i];
},decl:function(i,j,l){if(typeof i=="string"){i={block:i};
}else{if(i.name){i.block=i.name;
}}if(i.baseBlock&&!g[i.baseBlock]){throw ('baseBlock "'+i.baseBlock+'" for "'+i.block+'" is undefined');
}if(j.onSetMod){c(j.onSetMod,j);
delete j.onSetMod;
}if(j.onElemSetMod){f.each(j.onElemSetMod,function(o,n){c(n,j,o);
});delete j.onElemSetMod;
}var k=g[i.baseBlock||i.block]||this;
if(i.modName){f.each(j,function(n,o){f.isFunction(o)&&(j[n]=function(){var q;
if(this.hasMod(i.modName,i.modVal)){q=o;
}else{var p=k.prototype[n];
p&&p!==j[n]&&(q=this.__base);
}return q?q.apply(this,arguments):h;
});});}var m;
i.block==k._name?(m=f.inheritSelf(k,j,l))._processLive(true):(m=g[i.block]=f.inherit(k,j,l))._name=i.block;
return m;},_processLive:function(i){return false;
},create:function(j,i){typeof j=="string"&&(j={block:j});
return new g[j.block](j.mods,i);
},getName:function(){return this._name;
},_extractElemNameFrom:function(i){},afterCurrentEvent:function(j,i){e.push({fn:j,ctx:i})==1&&setTimeout(function(){var k,l=e.splice(0,e.length);
while(k=l.shift()){k.fn.call(k.ctx||this);
}},0);},changeThis:function(j,i){return function(){return j.apply(i||this,arguments);
};},del:function(m){var l=typeof m=="string",k=l?0:1,j=arguments.length;
l&&(m=this);
while(k<j){delete m[arguments[k++]];
}return this;
},channel:function(j,i){if(typeof j=="boolean"){i=j;
j=h;}j||(j="default");
if(i){if(a[j]){a[j].un();
delete a[j];
}return;}return a[j]||(a[j]=new f.observable());
}});})(jQuery);
(function(i,b,a){var g="_",c="__",d="[a-zA-Z0-9-]+";
function e(l,j,k){k.push(g,l,g,j);
}function f(l,m,j,k){k.push(l);
j&&e(m,j,k);
}function h(n,l,m,j,k){f(n,a,a,k);
k.push(c,l);
j&&e(m,j,k);
}i.INTERNAL={NAME_PATTERN:d,MOD_DELIM:g,ELEM_DELIM:c,buildModPostfix:function(m,j,k){var l=k||[];
e(m,j,l);return k?l:l.join("");
},buildClass:function(p,n,o,j,k){var m=typeof o;
if(m=="string"){if(typeof j!="string"){k=j;
j=o;o=n;n=a;
}}else{if(m!="undefined"){k=o;
o=a;}else{if(n&&typeof n!="string"){k=n;
n=a;}}}if(!(n||o||k)){return p;
}var l=k||[];
n?h(p,n,o,j,l):f(p,o,j,l);
return k?l:l.join("");
},buildClasses:function(n,m,l,j){var k=j||[];
m?h(n,m,a,a,k):f(n,a,a,k);
l&&b.each(l,function(p,o){if(o){k.push(" ");
m?h(n,m,p,o,k):f(n,p,o,k);
}});return j?k:k.join("");
}};})(BEM,jQuery);
(function(a){var b=a.event.special.leftclick={setup:function(){a(this).bind("click",b.handler);
},teardown:function(){a(this).unbind("click",b.handler);
},handler:function(c){if(!c.button){c.type="leftclick";
a.event.handle.apply(this,arguments);
c.type="click";
}}};})(jQuery);
(function(a,d){if(typeof JSON!="undefined"){return a.stringify=JSON.stringify;
}var c=Object.prototype.toString,e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
a.stringify=function(l){if(l===null){return"null";
}if(typeof l==="undefined"){return d;
}switch(c.call(l)){case"[object String]":return'"'+(e.test(l)?l.replace(e,function(i){var m=b[i];
return typeof m==="string"?m:"\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4);
}):l)+'"';case"[object Number]":case"[object Boolean]":return""+l;
case"[object Array]":var k="[",j=0,f=l.length,h;
while(j<f){h=a.stringify(l[j]);
k+=(j++?",":"")+(typeof h=="undefined"?"null":h);
}return k+"]";
case"[object Object]":var k="{",j=0,h;
for(var g in l){if(l.hasOwnProperty(g)){h=a.stringify(l[g]);
typeof h!="undefined"&&(k+=(j++?",":"")+'"'+g+'":'+h);
}}return k+"}";
default:return d;
}};})(jQuery);
(function(k,d,c){var g=k.INTERNAL,f=g.ELEM_DELIM,h={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},i=g.buildClasses,j={};
function e(l,m,n){(l[m]||(l[m]=[])).unshift(n);
}function b(l,m){return m.modName?function(n){(n._currBlock.mods||{})[m.modName]===m.modVal&&l(n);
}:l;}function a(m,l){var o=d.isArray(l),n;
d.isArray(m)?o?n=m.concat(l):(n=m).push(l):o?(n=l).unshift(m):n=[m,l];
return n;}k.HTML={decl:function(n,m){typeof n=="string"&&(n={name:n});
var l=j[n.name]||(j[n.name]={});
m.onBlock&&e(l,"_block",b(m.onBlock,n));
if(m.onElem){d.isFunction(m.onElem)?e(l,"_elem",b(m.onElem,n)):d.each(m.onElem,function(p,o){e(l,"_elem"+(p==="*"?"":f+p),b(o,n));
});}},build:function(m){var l=new this.Ctx(m);
l._buildAll();
return l._flush();
},Ctx:d.inherit({__constructor:function(l){this._buffer=[];
this._params=l;
this._tParams=null;
this._tParamsChanges=null;
this._currBlock=c;
},pos:function(){return this._params._pos;
},isFirst:function(){return this._params._pos===1;
},isLast:function(){var l=this._params;
return l._pos===l._siblingsCount;
},params:function(l){var m=this;
if(typeof l=="undefined"){return m._params;
}m._params=l;
return m;},param:function(l,o,m,q){var p=this,n=p._params;
if(typeof o=="undefined"){return n[l];
}if(m||!(l in n)){n[l]=o;
}else{if(q){n[l]=d.extend(o,n[l]);
}}return p;
},attrs:function(m,l){return this.param("attrs",m,l,true);
},attr:function(m,o,n){var p=this;
if(typeof o=="undefined"){return(p._params.attrs||{})[m];
}var l=p._params.attrs;
l?(n||!(m in l))&&(l[m]=o):(p._params.attrs={})[m]=o;
return p;},tag:function(m,l){return this.param("tag",m,l);
},cls:function(m,l){return this.param("cls",m,l);
},mods:function(m,l){return this.param("mods",m,l,true);
},mod:function(l,o,n){var p=this;
if(typeof o=="undefined"){return(p._params.mods||{})[l];
}var m=p._params.mods;
m?(n||!(l in m))&&(m[l]=o):(p._params.mods={})[l]=o;
return p;},mix:function(n,l){var o=this,m=o._params;
if(typeof n=="undefined"){return m.mix;
}if(l||!("mix" in m)){m.mix=n;
}else{m.mix=m.mix.concat(n);
}return o;},js:function(l){return this.param("js",l);
},content:function(m,l){return this.param("content",m,l);
},wrapContent:function(l){var n=this,m=n._params;
l.content=m.content;
m.content=l;
return n;},beforeContent:function(l){var n=this,m=n._params;
m.content=a(l,m.content);
return n;},afterContent:function(l){var n=this,m=n._params;
m.content=a(m.content,l);
return n;},wrap:function(l){var n=this,m=n._params;
l.block||(l._currBlock=n._currBlock);
l.content=m._wrapper?m._wrapper:m;
m._wrapper=l;
return n;},tParam:function(l,o){var p=this,n=p._tParams||(p._tParams={});
if(typeof o=="undefined"){return n[l];
}var m=p._tParamsChanges||(p._tParamsChanges={});
l in m||(m[l]=n[l]);
n[l]=o;return p;
},generateId:function(){return d.identify();
},_buildAll:function(){var s=this,m=s._buffer,r=s._params,p=typeof r;
if(p=="string"||p=="number"){m.push(r);
}else{if(d.isArray(r)){var o=0,l=r.length,n,q;
while(o<l){s._params=n=r[o++];
q=typeof n;
if(q=="string"||q=="number"){m.push(n);
}else{if(n){n._pos=o;
n._siblingsCount=l;
s._buildByDecl();
}}}}else{if(r){s._params._pos=s._params._siblingsCount=1;
s._buildByDecl();
}}}},_build:function(){var q=this,m=q._buffer,p=q._params,l=p.tag||"div",o,n=p.block||p.elem;
p.js&&((o={})[p.block]=p.js===true?{}:p.js);
m.push("<",l);
if(n||p.cls){m.push(' class="');
if(n){i(p.block||q._currBlock.block,p.elem,p.mods,m);
p.mix&&d.each(p.mix,function(r,s){if(s){m.push(" ");
i(s.block,s.elem,s.mods,m);
s.js&&((o||(o={}))[s.block]=s.js===true?{}:s.js);
}});}p.cls&&m.push(n?" ":"",p.cls);
o&&m.push(" i-bem");
m.push('"');
}o&&m.push(' onclick="return ',d.stringify(o).replace(/'/g,"\\'").replace(/"/g,"'"),'"');
p.attrs&&d.each(p.attrs,function(r,s){typeof s!="undefined"&&s!==null&&s!==false&&m.push(" ",r,'="',s.toString().replace(/"/g,"&quot;"),'"');
});if(h[l]){m.push("/>");
}else{m.push(">");
if(typeof p.content!="undefined"){q._params=p.content;
q._buildAll();
}m.push("</",l,">");
}},_flush:function(){var l=this._buffer.join("");
delete this._buffer;
return l;},_buildByDecl:function(){var o=this,r=o._currBlock,l=o._params;
l._currBlock&&(o._currBlock=l._currBlock);
l.block&&(o._currBlock=l);
if(!l._wrapper){if(l.block||l.elem){var q=j[o._currBlock.block];
if(q){var s;
if(l.elem){s=q["_elem"+f+l.elem];
q._elem&&(s=(s?s.concat(q._elem):q._elem));
}else{s=q._block;
}if(s){var m=0,p;
while(p=s[m++]){p(o);
}}}}if(l._wrapper){l._currBlock=o._currBlock;
o._params=l._wrapper;
return o._buildAll();
}}var t=o._tParamsChanges;
o._tParamsChanges=null;
o._build();
o._currBlock=r;
if(t){var n=o._tParams;
d.each(t,function(u,v){typeof v=="undefined"?delete n[u]:n[u]=v;
});}}})};})(BEM,jQuery);
(function(i,e,h){var d=e(window),x=e(document),m={},z={},f={},p={},u=i.blocks,v=i._uniqIdToBlock,b=i.INTERNAL,k=b.NAME_PATTERN,o=b.MOD_DELIM,j=b.ELEM_DELIM,y=b.buildModPostfix,s=b.buildClass;
function q(C,A){var B=C[0];
e.each(r(B),function(D,F){c(F,B,D,A);
var E=v[F.uniqId];
if(E){E.domElem=E.domElem.add(C);
e.extend(E.params,F);
}else{a(D,C,F);
}});}function a(H,D,C,A,I){if(typeof C=="boolean"){I=A;
A=C;C=h;}var E=D[0];
C=c(C||r(E)[H],E,H);
var G=C.uniqId;
if(v[G]){return v[G]._init();
}m[G]=m[G]?m[G].add(D):D;
var F=u[H]||t.decl(H,{},{live:true});
if(!(F._liveInitable=!!F._processLive())||A||C.live===false){var B=new F(m[G],C,!!A);
delete m[G];
I&&I.apply(B,Array.prototype.slice.call(arguments,4));
return B;}}function c(F,C,B,A){(F||(F={})).uniqId||(F.uniqId=(F.id?B+"-id-"+F.id:e.identify())+(A||e.identify()));
var E=e.identify(C),D=z[E]||(z[E]={});
D[B]||(D[B]=F);
return F;}function w(B,A,D){var C=B.find(A);
return D?C:C.add(B.filter(A));
}function r(A){var B=e.identify(A);
return z[B]||(z[B]=g(A));
}function g(C){var B=C.onclick||C.ondblclick;
if(!B&&C.tagName.toLowerCase()=="body"){var D=e(C),A=D.attr("onclick")||D.attr("ondblclick");
A&&(B=Function(A));
}return B?B():{};
}function l(A){delete z[e.identify(A)];
}function n(){return x[0][e.support.boxModel?"documentElement":"body"];
}e.fn.bem=function(A,B){return a(A,this,B,true);
};var t=i.DOM=i.decl("i-bem__dom",{__constructor:function(B,C,A){this.domElem=B;
this._eventNameCache={};
this._elemCache={};
this._needSpecialUnbind=false;
this.__base(null,C,A);
},_removeDomElem:function(A){!(this.domElem=this.domElem.not(A))[0]&&this.destruct();
},findBlocksInside:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("find",A,B));
},findBlockInside:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("find",A,B,true));
},findBlocksOutside:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("parents",A,B));
},findBlockOutside:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("closest",A,B))[0];
},findBlocksOn:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("",A,B));
},findBlockOn:function(A,B){return this._doBlocksMethod(this._buildFindBlocksParams("",A,B,true));
},_buildFindBlocksParams:function(A,B,D,C){return{select:A,elem:D?B:h,block:D||B,onlyFirst:C};
},doBlocksMethodInside:function(B,C,D,A){return this._doBlocksMethod(this._buildDoBlocksMethodParams("find",B,C,D,A));
},doBlocksMethodOutside:function(B,C,D,A){return this._doBlocksMethod(this._buildDoBlocksMethodParams("closest",B,C,D,A));
},doBlocksMethodOn:function(B,C,D,A){return this._doBlocksMethod(this._buildDoBlocksMethodParams("",B,C,D,A));
},doBlocksMethod:function(B,C,A){return this._doBlocksMethod({blocks:B,method:C,args:A});
},_buildDoBlocksMethodParams:function(A,D,E,F,C){var B=typeof F=="string";
return{select:A,elem:B?D:h,block:B?E:D,method:B?F:E,args:B?C:F};
},_doBlocksMethod:function(B){var E=this;
if(B.blocks){return e.map(B.blocks,function(J){return E._doBlockMethod(J,B.method,B.args);
});}var D=B.elem?(typeof B.elem=="string"?this.findElem(B.elem):B.elem):this.domElem,C=typeof B.block=="string",I=C?B.block:B.block.blockName,A="."+(C?s(I):s(I,B.block.modName,B.block.modVal))+(B.onlyFirst?":first":""),F=D.filter(A);
B.select&&(F=F.add(D[B.select](A)));
if(B.onlyFirst){return F[0]?this._doBlockMethod(a(I,F.eq(0),true),B.method,B.args):null;
}if(B.method){return e.map(F,function(J){return E._doBlockMethod(a(I,e(J),true),B.method,B.args);
});}var H=[],G={};
e.each(F,function(J,K){var L=a(I,e(K),true);
if(!G[L._uniqId]){G[L._uniqId]=true;
H.push(L);}});
return H;},_doBlockMethod:function(B,C,A){return C?B[C].apply(B,A||[]):B;
},bindToDomElem:function(B,C,A){var D=this;
A?B.bind(D._buildEventName(C),function(E){(E.data||(E.data={})).domElem=e(this);
return A.apply(D,arguments);
}):e.each(C,function(F,E){D.bindToDomElem(B,F,E);
});return D;
},bindToDoc:function(B,A){this._needSpecialUnbind=true;
return this.bindToDomElem(x,B,A);
},bindToWin:function(B,A){this._needSpecialUnbind=true;
return this.bindToDomElem(d,B,A);
},bindTo:function(C,B,A){if(!B||e.isFunction(B)){A=B;
B=C;C=this.domElem;
}else{if(typeof C=="string"){C=this.elem(C);
}}return this.bindToDomElem(C,B,A);
},unbindFromDomElem:function(A,B){A.unbind(this._buildEventName(B));
return this;
},unbindFromDoc:function(A){return this.unbindFromDomElem(x,A);
},unbindFromWin:function(A){return this.unbindFromDomElem(d,A);
},unbindFrom:function(B,A){if(!A){A=B;
B=this.domElem;
}else{if(typeof B=="string"){B=this.elem(B);
}}return this.unbindFromDomElem(B,A);
},_buildEventName:function(A){var B=this;
return A.indexOf(" ")>1?e.map(A.split(" "),function(C){return B._buildOneEventName(C);
}).join(" "):B._buildOneEventName(A);
},_buildOneEventName:function(C){var E=this,A=E._eventNameCache;
if(C in A){return A[C];
}var D="."+E._uniqId;
if(C.indexOf(".")<0){return A[C]=C+D;
}var B=".bem_"+E.__self._name;
return A[C]=e.map(C.split("."),function(G,F){return F==0?G+B:B+"_"+G;
}).join("")+D;
},trigger:function(B,A){this.__base(B=this.buildEvent(B),A).domElem&&this._ctxTrigger(B,A);
return this;
},_ctxTrigger:function(B,A){var E=this,D=f[E.__self._buildCtxEventName(B.type)],C={};
D&&E.domElem.each(function(){var G=this,F=D.counter;
while(G&&F){var I=e.identify(G,true);
if(I){if(C[I]){break;
}var H=D.ctxs[I];
if(H){e.each(H,function(K,J){J.fn.call(J.ctx||E,B,A);
});F--;}C[I]=true;
}G=G.parentNode;
}});},setMod:function(B,C,A){if(B&&typeof A!="undefined"&&B.length>1){var D=this;
B.each(function(){D.setMod(e(this),C,A);
});return D;
}return this.__base(B,C,A);
},_extractModVal:function(E,B,D){var A=(B||this.domElem)[0],C;
A&&(C=A.className.match(this.__self._buildModValRE(E,D||B)));
return C?C[2]:"";
},_extractMods:function(A,E){var D={},B=!A.length,C=0;
e.each((E||this.domElem)[0].className.match(this.__self._buildModValRE("("+(B?k:A.join("|"))+")",E,"g"))||[],function(F,G){var I=(G=e.trim(G)).lastIndexOf(o),H=G.substr(0,I-1).lastIndexOf(o);
D[G.substr(H+1,I-H-1)]=G.substr(I+1);
++C;});C<A.length&&e.each(A,function(F,G){G in D||(D[G]="");
});return D;
},_afterSetMod:function(G,C,E,F){var B=this.__self,A=B._buildModClassPrefix(G,F),D=B._buildModValRE(G,F),H=C==="";
(E||this.domElem).each(function(){var I=this.className;
I.indexOf(A)>-1?this.className=I.replace(D,(H?"":"$1"+A+C)+"$3"):H||e(this).addClass(A+C);
});F&&this.dropElemCache(F,G,C);
},findElem:function(D,F,E,C){if(arguments.length%2){C=E;
E=F;F=D;D=this.domElem;
}else{if(typeof D=="string"){D=this.findElem(D);
}}var B=this.__self,A="."+e.map(F.split(" "),function(G){return s(B._name,G,E,C);
}).join(",.");
return w(D,A);
},_elem:function(B,D,A){var C=B+y(D,A);
return this._elemCache[C]||(this._elemCache[C]=this.findElem(B,D,A));
},elem:function(D,C,A){if(D.indexOf(" ")<0){return this._elem(D,C,A);
}var B=e([]),E=this;
e.each(D.split(" "),function(){B=B.add(E._elem(this,C,A));
});return B;
},dropElemCache:function(D,C,A){if(D){var E=this,B=y(C,A);
D.indexOf(" ")<0?delete E._elemCache[D+B]:e.each(D.split(" "),function(G,F){delete E._elemCache[F+B];
});}else{this._elemCache={};
}return this;
},containsDomElem:function(A){return A.parents().andSelf().index(this.domElem)>-1;
},buildSelector:function(B,C,A){return this.__self.buildSelector(B,C,A);
},destruct:function(B){var C=this,A=C.__self;
C._needSpecialUnbind&&A.doc.add(A.win).unbind("."+C._uniqId);
C.__base();
C.dropElemCache().domElem.each(function(D,E){e.each(r(E),function(F,G){var H=v[G.uniqId];
H&&H._removeDomElem(E);
});l(E);});
B||C.domElem.remove();
delete C.domElem;
delete C._elemCache;
}},{doc:x,win:d,_processLive:function(B){var D=this,C=D._liveInitable;
if("live" in D){var A=typeof C=="undefined";
if(A^B){if(e.isFunction(D.live)){C=D.live()!==false;
D.live=function(){};
}else{C=D.live;
}}}return C;
},init:function(B,D,C){if(!B||e.isFunction(B)){C=D;
D=B;B=x;}var A=e.identify();
w(B,".i-bem").each(function(){q(e(this),A);
});D&&this.afterCurrentEvent(function(){D.call(C||this,B);
});},destruct:function(B,A,C){if(typeof B!="boolean"){C=A;
A=B;B=h;}w(A,".i-bem",C).each(function(){e.each(r(this),function(D,E){if(E.uniqId){var F=v[E.uniqId];
F&&F.destruct(true);
}});l(this);
});B||(C?A.empty():A.remove());
},update:function(A,B,D,C){this.destruct(A,true);
this.init(A.html(B),D,C);
},_buildCtxEventName:function(A){return this._name+":"+A;
},_liveClassBind:function(C,D,H,A){var G=this;
if(D.indexOf(" ")>-1){e.each(D.split(" "),function(I,J){G._liveClassBind(C,J,H,A);
});}else{var B=G._buildCtxEventName(D),F=p[B],E=e.identify(H);
if(!F){F=p[B]={};
x.bind(D,G.changeThis(G._liveClassTrigger,G));
}F=F[C]||(F[C]={uniqIds:{},fns:[]});
if(!(E in F.uniqIds)){F.fns.push({uniqId:E,fn:G._buildLiveEventFn(H,A)});
F.uniqIds[E]=F.fns.length-1;
}}return this;
},_liveClassUnbind:function(D,E,H){var C=this._buildCtxEventName(E),G=p[C];
if(G){if(H){if(G=G[D]){var F=e.identify(H);
if(F in G.uniqIds){var B=G.uniqIds[F],A=G.fns.length-1;
G.fns.splice(B,1);
while(B<A){G.uniqIds[G.fns[B++].uniqId]=B-1;
}delete G.uniqIds[F];
}}}else{delete G[D];
}}return this;
},_liveClassTrigger:function(G){var F=p[this._buildCtxEventName(G.type)];
if(F){var C=G.target,A=[];
for(var H in F){F.hasOwnProperty(H)&&A.push(H);
}do{var B=" "+C.className+" ",E=0;
while(H=A[E++]){if(B.indexOf(" "+H+" ")>-1){var D=0,J=F[H].fns,I;
while(I=J[D++]){I.fn.call(e(C),G);
}if(G.isPropagationStopped()){return;
}A.splice(--E,1);
}}}while(A.length&&(C=C.parentNode));
}},_buildLiveEventFn:function(C,A){var B=this;
return function(E){var D=[B._name,((E.data||(E.data={})).domElem=e(this)).closest(B.buildSelector()),true],F=a.apply(null,A?D.concat([C,E]):D);
F&&(A||C.apply(F,arguments));
};},liveInitOnEvent:function(B,A,C){return this.liveBindTo(B,A,C,true);
},liveBindTo:function(E,B,D,A){if(!D){D=B;
B=E;E=h;}if(!E||typeof E=="string"){E={elemName:E};
}var C=this;
if(E.elemName&&E.elemName.indexOf(" ")>1){e.each(E.elemName.split(" "),function(F,G){C._liveClassBind(s(C._name,G,E.modName,E.modVal),B,D,A);
});return C;
}return C._liveClassBind(s(C._name,E.elemName,E.modName,E.modVal),B,D,A);
},liveUnbindFrom:function(B,A,D){var C=this;
if(B.indexOf(" ")>1){e.each(B.split(" "),function(E,F){C._liveClassUnbind(s(C._name,F),A,D);
});return C;
}return C._liveClassUnbind(s(C._name,B),A,D);
},_liveInitOnBlockInit:function(B,D,C){var A=this._name;
u[B].on("init",function(E){var F=E.block[C](A);
D&&e.each(F,function(){D.call(this);
});});return this;
},liveInitOnBlockInit:function(A,B){return this._liveInitOnBlockInit(A,B,"findBlocksOn");
},liveInitOnBlockInsideInit:function(A,B){return this._liveInitOnBlockInit(A,B,"findBlocksOutside");
},on:function(A,E,D,C,B){return A.jquery?this._liveCtxBind(A,E,D,C,B):this.__base(A,E,D,C);
},un:function(A,D,C,B){return A.jquery?this._liveCtxUnbind(A,D,C,B):this.__base(A,D,C);
},liveCtxBind:function(A,E,D,C,B){return this._liveCtxBind(A,E,D,C,B);
},_liveCtxBind:function(A,F,E,D,C){if(e.isFunction(E)){C=D;
D=E;E=h;}var H=this;
if(F.indexOf(" ")>-1){e.each(F.split(" "),function(I,J){H._liveCtxBind(A,J,E,D,C);
});}else{var B=H._buildCtxEventName(F),G=f[B]||(f[B]={counter:0,ctxs:{}});
A.each(function(){var J=e.identify(this),I=G.ctxs[J];
if(!I){I=G.ctxs[J]={};
++G.counter;
}I[e.identify(D)+(C?e.identify(C):"")]={fn:D,data:E,ctx:C};
});}return H;
},liveCtxUnbind:function(A,D,C,B){return this._liveCtxBind(A,D,C,B);
},_liveCtxUnbind:function(A,D,C,B){var F=this,E=f[D=F.buildEventName(D)];
if(E){A.each(function(){var H=e.identify(this,true),G;
if(H&&(G=E.ctxs[H])){C&&delete G[e.identify(C)+(B?e.identify(B):"")];
if(!C||e.isEmptyObject(G)){E.counter--;
delete E.ctxs[H];
}}});E.counter||delete f[D];
}return F;},_extractElemNameFrom:function(A){var B=A[0].className.match(this._buildElemNameRE());
return B?B[1]:h;
},extractParams:g,_buildModClassPrefix:function(B,A){return s(this._name)+(A?j+(typeof A==="string"?A:this._extractElemNameFrom(A)):"")+o+B+o;
},_buildModValRE:function(B,A,C){return new RegExp("(\\s?)"+this._buildModClassPrefix(B,A)+"("+k+")(\\s|$)",C);
},_buildElemNameRE:function(){return new RegExp(this._name+j+"("+k+")(?:\\s|$)");
},buildSelector:function(B,C,A){return"."+s(this._name,B,C,A);
},getWindowSize:function(){var A=d[0];
if(typeof A.innerWidth!="undefined"){return{width:A.innerWidth,height:A.innerHeight};
}var B=n();
return{width:B.clientWidth,height:B.clientHeight};
}});})(BEM,jQuery);
var Ya=Ya||{};
Ya.monthAbr=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];
Ya.dayOfWeekAbr=["su","mo","tu","we","th","fr","sa"];
Ya.Time={Settings:{domain:location.hostname}};
BEM.DOM.decl("b-time",{onSetMod:{dragndrop:function(b,a,c){switch(a){case"started":$(this.domElem[0]).addClass("b-time_drag_yes").attr("draggable","true");
this._dragging=true;
break;case"finished":$(this.domElem[0]).removeClass("b-time_drag_yes").attr("draggable","false");
this._dragging=false;
break;case"over":$(this.domElem[0]).addClass("b-time_drop_yes");
break;case"leave":$(this.domElem[0]).removeClass("b-time_drop_yes");
break;}}},init:function(b){var a=this;
a._offset=0;
a._widgetRedirectUrl="http://"+location.hostname+"/pages/widget/redirect/";
if(b.layout=="horiz"){a.setMod("layout","horiz");
}a._timestamp=b.now!==undefined?b.now:Date.now();
a._syncUrl=b.syncUrl;
a._defaultOffset=null;
a._geoid=null;
a._city="";
a._country=[""];
a._tzCountries=null;
a._weather={t:null,ico:null,link:null};
a._commentEmptyText=a.elem("comment").text();
a._cityChangerIsVisible=false;
a._commentEditorIsVisible=false;
a._settingsIsVisible=false;
a._timezoneDescriptionIsVisible=false;
a.clock=a.findBlockInside("b-clock");
a.clock.setMod("type",a.getMod("type")||"analog");
a.comment(b.comment||"");
a.setEventsHandlers().setGeoData(b).setDefaultLocationOffset(b.flaggedOffset).setMod("state","inited");
return a;},setEventsHandlers:function(){var a=this;
a.bindTo("city","click",function(b){if(this.getMod("widget")){return this;
}this.toggleCityChanger(b);
});a.bindTo(this.clock.elem("flag"),"click",function(b){if(this.getMod("widget")){return this;
}this.toggleFlag();
});return a;
},remove:function(){var a=this;
a.unbindFrom(this.clock.elem("flag"),"click");
if(a.getMod("default")=="yes"){a.toggleFlag();
}a.trigger("time:remove",this);
setTimeout(function(){a.destruct(false);
},100);return;
},getPopup:function(a){return this.findBlockInside($(document),{blockName:"b-popupa",modName:"type",modVal:a});
},comment:function(c){var a=this;
if(c!==undefined){a._comment=c;
var b=a.elem("comment");
if(c===""){b.text(a._commentEmptyText);
a.setMod(b,"empty","yes");
}else{b.text(a._comment);
a.delMod(b,"empty");
}a.trigger("time:changeComment");
}return a._comment;
},toggleFlag:function(){var a=this;
if(!a._flag){a._flag=a.clock.elem("flag");
}if(a.getMod("default")=="yes"){a._flag.attr("title","");
a.delMod("default");
a.trigger("time:changeDefaultLocation",{offset:null});
$(document).trigger("time:setFlagOnFirstClock");
}else{a._flag.attr("title",_i18n("flag title"));
a.setMod("default","yes");
a.trigger("time:changeDefaultLocation",{offset:a.offset(),block:a});
a.updateOffsetDiff();
$(".l-time").bem("l-time").trigger("set-default-time");
}return a;},setDefaultLocationOffset:function(b){var a=this;
if(b!==undefined){a._defaultOffset=b;
}a.delMod("default");
a.updateOffsetDiff();
return a;},updateOffsetDiff:function(){var a=this;
var e="";if(a.getMod("default")!=="yes"&&a._defaultOffset!==null){var f=a.offset()-a._defaultOffset;
var d={hours:0,mins:0};
var b=(f<0);
f=(new Date((b)?(-f):f));
d.hours=f.getUTCHours();
d.mins=Math.round(f.getUTCMinutes()/15);
var c=["","&#188;","&#189;","&#190;"];
e=((b)?"-":(d.hours!=0||d.mins!=0)?"+":"")+d.hours+c[d.mins]+"&nbsp;"+_i18n("h");
}this.clock.elem("diff__i").html(e);
return this;
},offset:function(b){var a=this;
if(b!==undefined&&a._offset!==b){a._offset=b;
a.updateOffsetDiff();
}return a._offset;
},timestamp:function(a){if(a!==undefined&&this._timestamp!==a){this._timestamp=a;
this.clock.set(this._timestamp,true);
}return this._timestamp;
},updatePageTitle:function(a){this.clock.updatePageTitle(a);
},geoid:function(a){if(a!==undefined){this._geoid=a;
}return this._geoid;
},setTimezoneDescripion:function(c,e,a){var b=this;
b._city=c;b._country=e;
b._tzCountries=a;
var d=b.findBlockInside("b-pseudo-link");
if(d){d.domElem.text(c);
}else{b.elem("city").text(c);
}if(e){b.setMod(b.elem("country"),"type","small");
e=e.join(", ");
e=(e.length>0)?e+", ":"";
var f=BEM.HTML.build([e,{block:"b-pseudo-link",tag:"span",content:_i18n("countries")}]);
b.elem("country").html(f);
}return b;},setLocationDescripion:function(d,c){var a=this;
a._city=d;var b=a.findBlockInside("b-pseudo-link");
if(b){b.domElem.text(d);
}else{a.elem("city").text(d);
}a._country=c;
a.delMod(a.elem("country"),"type");
if(c){a.elem("country").text(c.join(", "));
}return a;},getLocationDescripion:function(){var a=this;
return a._country.join(", ")+", "+a._city;
},changeDay:function(){var a=this;
var b=new Date(a._timestamp+a._offset);
a.elem("date").text(b.getUTCDate()+" "+_i18n([Ya.monthAbr[b.getUTCMonth()]])+", "+_i18n([Ya.dayOfWeekAbr[b.getUTCDay()]]));
return a;},toJSON:function(){var a=this;
return{geoid:a._geoid,comment:a._comment,defaultLocation:(a.getMod("default")=="yes")?true:undefined};
},setClockType:function(a){this.clock.setMod("type",a);
this.clock.init();
return this;
},setWeather:function(g){var b=this;
g=(g!==undefined)?g:{t:"",ico:"",link:""};
b._weather=g;
if(b._weather.dontShow){return b;
}var f=b.elem("weather"),e=f.find("img");
if(g.ico){e.attr({alt:g.t,src:g.ico}).show();
}else{e.hide();
}var a=b.findBlockInside(f,"b-link");
var c=Ya.Time.Settings.domain.replace(/.*?yandex/,"yandex");
var d="http://pogoda."+c+g.link;
if(/\.com$/.test(Ya.Time.Settings.domain)){d="http://weather."+c+g.link;
}if(/\.com\.tr$/.test(Ya.Time.Settings.domain)){d="http://hava."+c+g.link;
}if(a){a.domElem.attr({href:d,title:g.t,target:"_blank"});
}return b;},setSunriseSunset:function(b){var a=this;
if(b.showSunriseSunset&&a.elem("sunrise-sunset").length){if(b.sunrise>0&&b.sunset>0){var d=b.sunrise/1000,c=b.sunset/1000,d=[Math.floor(d/3600),(d%3600)/60,Math.floor(c/3600),(c%3600)/60];
d=$.map(d,function(f){if(f<10){return"0"+f;
}return f;});
var e=_i18n("sunrise")+": "+d.slice(0,2).join(":");
e+=", "+_i18n("sunset")+": "+d.slice(2,4).join(":");
a.elem("sunrise-sunset").text(e);
}}return a;
},setGeoData:function(b){var a=this;
a._sunrise=b.sunrise;
a._sunset=b.sunset;
a._tzCountries=b.countries;
b.today=new Date(a._timestamp+a._offset).getDate();
a.offset(b.offset);
a.clock.init(b);
a.geoid(b.geoid);
var c=a.findBlockInside(a.elem("country"),"b-pseudo-link");
if(c){a.unbindFrom(c.domElem,"click",a.showTimezoneDescription);
}if(b.countries&&b.countries.length){a.setTimezoneDescripion(b.name,b.parent,b.countries);
a.bindTo(a.findBlockInside(a.elem("country"),"b-pseudo-link").domElem,"click",a.showTimezoneDescription);
}else{a.setLocationDescripion(b.name,b.parent);
}a.setSunriseSunset(b).setWeather(b.weather).changeDay().trigger("time:changeLocation");
return a;},toggleCityChanger:function(a){var b=this;
if(b._cityChangerIsVisible){b.hideCityChanger(a);
}else{b.showCityChanger(a);
}},showCityChanger:function(b){var d=this;
var a=d.getPopup("city-changer");
var c=a.findBlockInside("b-form-input");
d._cityChangerIsVisible=true;
if($.browser.msie){setTimeout(function(){$("label",c.domElem[0]).hide();
var e=$("input",c.domElem[0]);
e.val("").show().focus().bind("keyup.IETT",{},function(f){if(f.which===27){$(this).hide().unbind("keyup.IETT");
}});},50);}else{c.val("");
}a.on("hide",d.hideCityChanger,d).show(d.elem("city"));
c.on("pressEnter",d.selectFromCityChanger,d).setMod("focused","yes");
$(".i-popup.b-form-input__popup").css("display","");
return d;},hideCityChanger:function(b){var d=this;
var a=d.getPopup("city-changer");
var c=a.findBlockInside("b-form-input");
d._cityChangerIsVisible=false;
c.un("pressEnter",d.selectFromCityChanger,d)._getPopup().hide();
a.un("hide",d.hideCityChanger,d).hide();
$(".i-popup.b-form-input__popup").css("display","none");
return d;},selectFromCityChanger:function(a,c){var b=this;
if(!(c&&c.geoid)){return false;
}$.ajax({url:b._syncUrl,dataType:"json",type:"GET",data:{geo:c.geoid},timeout:1000,context:b,success:function(d){this.setGeoData(d[1]);
this.hideCityChanger(a);
if(b.getMod("default")){b.trigger("time:changeDefaultLocation",{offset:b.offset(),block:b});
b.updateOffsetDiff();
}},error:function(){}});
},hideCode:function(){var a=this;
a.getPopup("code").cleanUp().un("hide",a.hideCode,a);
},showCode:function(){var b=this;
var a=b.getPopup("code");
a.on("hide",b.hideCode,b);
a.show();a.initClock({geoid:b._geoid,offset:b._offset,sunrise:b._sunrise,sunset:b._sunset,comment:b._comment,type:b.clock.getMod("type"),name:b._city,parent:b._country,now:b._timestamp,syncUrl:b._syncUrl,isNight:b.clock.isNight});
return b;},_clearShareStuff:function(b){var a=this;
$(document).unbind("keyup.timeShare");
if(a._clockShare._block){$(a._clockShare._block).remove();
}if(a._clockShare._popup){$(a._clockShare._popup).remove();
}a._shareHolder.remove();
delete a._shareHolderVisible;
},showShare:function(){var b=this;
b._shareHolder=$(".shareBlock",b.domElem);
b._shareHolderVisible=true;
if(b._shareHolder.length!=0){b._shareHolder.remove();
}b._shareHolder=$("<div></div>").addClass("shareBlock").attr("id",Math.ceil(Math.random(55)*10000)).css({width:"117px",height:"0px",overflow:"hidden",position:"absolute",left:40+"px",top:(b.clock.getMod("type")=="analog"?100:65)+"px"}).insertAfter(b.clock.domElem);
var d=($.inArray(Ya.Time.Settings.lang,["en","tr"])>-1)?["facebook","twitter","lj","friendfeed","greader"]:undefined;
b._clockShare=Ya.share({elementID:b._shareHolder.get(0),l10n:Ya.Time.Settings.lang,type:"link",popupStyle:{input:true,blocks:d},title:b._city+": "+_i18n("share question"),description:_i18n("site description"),image:"http://"+Ya.Time.Settings.domain+"/pages/widget/img/yandex_time.png",link:"http://"+Ya.Time.Settings.domain+"/?city1="+encodeURIComponent(b._geoid)});
var c=$(".b-share__handle",b._shareHolder);
if(document.createEvent){var e=document.createEvent("MouseEvents");
e.initMouseEvent("click",true,true,window,0,0,0,0,0,false,false,false,false,0,null);
c.get(0).dispatchEvent(e);
}else{if(document.createEventObject){var a=document.createEventObject(window.event);
a.button=1;
c.get(0).fireEvent("onclick");
}}setTimeout(function(){if($(b._clockShare._popup).hasClass("b-share-popup-wrap_state_hidden")){b._clearShareStuff();
}else{setTimeout(arguments.callee,100);
}},200);$(document).bind("keyup.timeShare",{self:b},function(f){if(f.which==27){f.data.self._clockShare.closePopup();
f.data.self._clearShareStuff();
}});b.getPopup("settings").un("time:showShare",b.showShare,b);
return b;},addWidget:function(){var a=this;
var f={theme:a.clock.getMod("type"),geoid:encodeURIComponent(a._geoid),comment:a._comment.replace(/&/g,"_amp_")};
var b=a._widgetRedirectUrl+"?lang="+Ya.Time.Settings.lang;
for(var d in f){if(f.hasOwnProperty(d)){b+="&"+d+"="+f[d];
}}try{window.open(b,"addwidget");
}catch(c){}return a;
},toggleCommentEditor:function(a){var b=this;
if(b._commentEditorIsVisible){b.hideCommentEditor(a);
}else{b.showCommentEditor(a);
}return b;},showCommentEditor:function(b){var c=this;
var a=c.getPopup("comment");
a.on("hide",c.hideCommentEditor,c).on("time:setComment",c.setCommentHandler,c).show(c.elem("comment"),c.getLocationDescripion(),c.comment());
c.delMod(c.elem("comment"),"empty");
c._commentEditorIsVisible=true;
return c;},hideCommentEditor:function(b){var c=this;
var a=c.getPopup("comment");
a.un("hide",c.hideCommentEditor,c).un("time:setComment",c.setCommentHandler,c).hide();
if(c.comment().length===0){c.setMod(c.elem("comment"),"empty","yes");
}c._commentEditorIsVisible=false;
return c;},setCommentHandler:function(a,c){var b=this;
b.comment(c.value);
return b;},toggleSettings:function(a){var b=this;
if(b._settingsIsVisible){b.hideSettings(a);
}else{b.showSettings(a);
}},showSettings:function(a){var b=this;
var c=b.elem("setting");
b.getPopup("settings").on("hide",b.hideSettings,b).on("time:createComment",b.showCommentEditor,b).on("time:createWidget",b.addWidget,b).on("time:showCode",b.showCode,b).on("time:showShare",b.showShare,b).on("time:delete",b.remove,b).show(c);
b._settingsIsVisible=true;
return b.setMod(b.elem("setting"),"state","active");
},hideSettings:function(a){var b=this;
var c=b.elem("setting");
b.getPopup("settings").un("hide",b.hideSettings,b).un("time:createComment",b.showCommentEditor,b).un("time:createWidget",b.addWidget,b).un("time:showCode",b.showCode,b).un("time:showShare",b.showShare,b).un("time:delete",b.remove,b);
b._settingsIsVisible=false;
return b.delMod(b.elem("setting"),"state");
},toggleTimezoneDescription:function(a){var b=this;
if(b._timezoneDescriptionIsVisible){b.showTimezoneDescription(a);
}else{b.hideTimezoneDescription(a);
}},showTimezoneDescription:function(a){var b=this;
var c=b._country.join(", ");
c=(c.length>0)?c+", ":"";
c+=b._city;
b.getPopup("timezone").on("time:selectGeo",b.selectFromCityChanger,b).on("hide",b.hideTimezoneDescription,b).show(b.elem("country"),c,b._tzCountries);
b._timezoneDescriptionIsVisible=true;
return b;},hideTimezoneDescription:function(a){var b=this;
b.getPopup("timezone").un("time:selectGeo",b.selectFromCityChanger,b).un("hide",b.hideTimezoneDescription,b);
b._timezoneDescriptionIsVisible=false;
return b;}},{live:function(){this.liveBindTo("setting","leftclick",function(a){if(!this.getMod("widget")){a.preventDefault();
this.toggleSettings(a);
}});this.liveBindTo("comment","leftclick",function(a){if(!this.getMod("widget")){a.preventDefault();
this.toggleCommentEditor(a);
}});}});BEM.DOM.decl("b-clock",{onSetMod:{type:function(b,a,c){this.clearDom();
}},init:function(d,c){var a=this;
if(a.setInitiated===undefined){a.now=0;
a.sunrise=null;
a.sunset=null;
a.isNight=null;
a.today=null;
}if($.browser.msie){var b=navigator.userAgent;
if(b!==undefined){b=b.toLowerCase();
}else{a._isBrokenIE=true;
}if(parseFloat(b.match(/msie ([\d\.]+);/)[1])<9){a._isBrokenIE=true;
}}d=d||{};a.today=d.today!==undefined?d.today:a.today;
a.now=d.now!==undefined?d.now:a.now;
a.city=d.name!==undefined?d.name:a.city;
a.country=d.parent!==undefined?d.parent:a.country;
if((d.sunrise!==undefined&&a.sunrise!=d.sunrise)||(d.sunset!==undefined&&a.sunset!=d.sunset)){if(a.sunrise==0&&a.sunset==0){a.isNight=d.isNight!==undefined?d.isNight:false;
}else{a.sunrise=d.sunrise!==undefined?d.sunrise:a.sunrise;
a.sunset=d.sunset!==undefined?d.sunset:a.sunset;
}}d.isNight=a.parseTimestamp(a.now,d.offset||a.offset).isNight;
a.useInPageTitle=d.useInPageTitle!==undefined?d.useInPageTitle:a.useInPageTitle;
a.setUTCPopup(d.offset);
a.reinit(d,c);
return a;},createDom:function(){},clearDom:function(){},reinit:function(a){},animate:function(a){},parseTimestamp:function(h,f){var c=this;
if(!h){throw {name:"b-clock fail",message:"b-clock parseTimestamp called without mandatory ts param"};
}if(f===undefined){f=0;
}var b=new Date(h+f),a=b.getUTCHours(),e=b.getUTCMinutes(),g=a*3600000+e*60000+b.getSeconds()*1000,d=g<c.sunrise||g>c.sunset;
if(b.getUTCDate()!=c.today){c.today=b.getUTCDate();
c.findBlockOutside("b-time").changeDay();
}if(c.isNight!==null&&d!==c.isNight){if(!c.__animationTimeout){c.__animationTimeout=1;
setTimeout(function(){if(!c.animationActive){c.changeDayNight(d,a,e,b.getSeconds());
delete c.__animationTimeout;
}},100);}}return{hours:a,minutes:e,seconds:b.getSeconds(),dayofmonth:b.getUTCDate(),isNight:d};
},changeDayNight:function(a){},getTitleData:function(){var b=this,d=b.parseTimestamp(b.now,b.offset),c=d.hours>0?((d.hours<10)?"0"+d.hours:d.hours):24-Math.abs(d.hours),a=Math.abs(d.minutes)<10?"0"+Math.abs(d.minutes):Math.abs(d.minutes);
if(c==24){c=0;
}return{time:c+":"+a,geo:b.city+" ("+b.country.join(", ")+")"};
},setUTCPopup:function(d){if(d===undefined){return this;
}d=d/60000;
var a=Math.round(d/60),c=Math.abs(Math.floor(d%60)),b=(a>0)?"+"+a:a;
b+=(c!=0)?":"+c:"";
$(this.domElem[0]).attr({title:(d===0)?"UTC":"UTC"+b});
return this;
},set:function(c,b){var a=this;
var e=a.parseTimestamp(a.now,a.offset),d=a.parseTimestamp(c,a.offset);
if(e.dayofmonth!==d.dayofmonth){$(a.domElem).trigger("dayChanged",{});
}a.now=c;a.animate(a.now,b);
return c;}});
BEM.DOM.decl({name:"b-clock",modName:"type",modVal:"digital"},{createDom:function(){var a=this;
if(!a.clock){a.findBlockInside($(document),{blockName:"b-clock-digital",modName:"state",modVal:"template"}).domElem.clone().appendTo(a.domElem);
a.clock=a.findBlockInside("b-clock-digital");
a.clock.delMod("state");
}a.$h1=a.clock.elem("digital","type","1000");
a.$h2=a.clock.elem("digital","type","0100");
a.$m1=a.clock.elem("digital","type","0010");
a.$m2=a.clock.elem("digital","type","0001");
a.$s=a.clock.elem("digital","type","sep");
a.h1=null;a.h2=null;
a.m1=null;a.m2=null;
a.DomInitiated=true;
return a;},clearDom:function(){var a=this;
a.clock=a.findBlockInside("b-clock-digital");
if(a.clock){a.clock.domElem.remove();
}delete a.clock;
delete a.$h1;
delete a.$h2;
delete a.$m1;
delete a.$m2;
delete a.DomInitiated;
return a;},reinit:function(b){var a=this;
if(a.DomInitiated===undefined){a.createDom();
}if(b.offset!==undefined){a.offset=b.offset;
}if(b.now!==undefined){a.now=b.now;
}if(b.isNight!==undefined){a.isNight=b.isNight;
}a.set(a.now);
},animate:function(h){var b=this,f=(h===undefined)?b.now:h,e=b.parseTimestamp(f,b.offset);
b.setInitiated=true;
if(!b.$h1||!b.$h1.length){throw {name:"b-clock fail",message:"b-clock-digital animate called on uninitialized clock. Can't find $h1 property"};
}b.$s.css({opacity:e.seconds%2===0?"0.7":"1"});
var g=Math.floor(e.hours/10),d=Math.floor(e.hours%10),c=Math.floor(e.minutes/10),a=Math.floor(e.minutes%10);
if(d!==b.h2){b._replaceClass(b.$h2,d);
b.h2=d;if(g!==b.h1){b._replaceClass(b.$h1,g);
b.h1=g;}}if(a!==b.m2){b._replaceClass(b.$m2,a);
b.m2=a;if(c!==b.m1){b._replaceClass(b.$m1,c);
b.m1=c;}if(b.findBlockOutside({blockName:"b-time",modName:"default",modVal:"yes"})){$(document).trigger("time:shoutTime",b.getTitleData());
}}},_replaceClass:function(b,c){var a=this,d=b.attr("class");
b.attr("class",d.replace(/(b-clock-digital__digital_num_)[0-9]/,"$1"+c));
}});BEM.DOM.decl({name:"b-clock",modName:"type",modVal:"analog"},{createDom:function(){var a=this;
a.clock=a.findBlockInside("b-clock-analog");
if(!a.clock){a.findBlockInside($(document),{blockName:"b-time",modName:"state",modVal:"template"}).findBlockInside("b-clock-analog").domElem.clone().appendTo(a.domElem);
a.clock=a.findBlockInside("b-clock-analog");
}a.transparent=$.browser.msie?0.0001:0;
if(!a.R){a.R=Raphael(a.clock.elem("dial-arrows")[0],117,117);
a.dial={night:a.clock.elem("dial-night"),day:a.clock.elem("dial-day")};
}if(a.isNight){a.clock.setMod("state","night");
a.dial.day.css({display:"",opacity:""}).hide();
a.dial.night.css({display:"",opacity:""}).show();
}else{a.clock.setMod("state","day");
a.dial.day.css({display:"",opacity:""}).show();
a.dial.night.css({display:"",opacity:""}).hide();
}if(!a.arrows){a.arrows={night:{hour:a.R.path("M59,61 60.5,59 59.5,32 58,29 56.5,32 55.5,59 57,61").attr({stroke:"none",fill:"#FFF"}),min:a.R.path("M58.5,63 59.5,61 58,24 57.8,24 56.5,61 58,63").attr({stroke:"none",fill:"#FFF"})},day:{hour:a.R.path("M59,61 60.5,59 59.5,32 58,29 56.5,32 55.5,59 57,61").attr({stroke:"none",fill:"#000"}),min:a.R.path("M58.5,63 59.5,61 58,24 57.8,24 56.5,61 58,63").attr({stroke:"none",fill:"#000"})},sec:a.R.path("M58,22v42").attr({stroke:"#a8577d"})};
a.arrows.night.dot=a.R.image("/blocks/b-clock-analog/arrows/night_dot.png",55,55,9,8);
a.arrows.day.dot=a.R.image("/blocks/b-clock-analog/arrows/day_dot.png",54,55,9,8);
var b=a.R.set();
if(a._isBrokenIE){a.arrows[a.isNight?"day":"night"].hour.hide();
a.arrows[a.isNight?"day":"night"].min.hide();
a.arrows[a.isNight?"day":"night"].dot.hide();
}else{a.arrows[a.isNight?"day":"night"].hour.attr({opacity:a.transparent});
a.arrows[a.isNight?"day":"night"].min.attr({opacity:a.transparent});
a.arrows[a.isNight?"day":"night"].dot.attr({opacity:a.transparent});
}}else{if(a._isBrokenIE){a.arrows[a.isNight?"day":"night"].min.hide();
a.arrows[a.isNight?"day":"night"].hour.hide();
a.arrows[a.isNight?"night":"day"].min.show();
a.arrows[a.isNight?"night":"day"].hour.show();
}else{a.arrows[a.isNight?"day":"night"].min.attr({opacity:a.transparent});
a.arrows[a.isNight?"day":"night"].hour.attr({opacity:a.transparent});
a.arrows[a.isNight?"night":"day"].min.attr({opacity:1});
a.arrows[a.isNight?"night":"day"].hour.attr({opacity:1});
}}a.DomInitiated=true;
return a;},clearDom:function(){var a=this;
a.clock=a.findBlockInside("b-clock-analog");
if(a.clock){a.clock.domElem.remove();
}delete a.clock;
delete a.R;
delete a.dial;
delete a.arrows;
delete a.DomInitiated;
return a;},reinit:function(b){var a=this;
if(a.DomInitiated===undefined){if(a.setInitiated===undefined){a.isNight=b.isNight;
a.offset=b.offset;
}a.createDom();
a.animate(a.now,1,"noInit");
}if(b.offset!==undefined&&a.offset!==b.offset){if(a.setInitiated===undefined){a.isNight=b.isNight;
a.offset=b.offset;
a.set(a.now);
}else{a.animateOffset(b.offset,b.isNight);
}}else{if(b.now!==undefined){a.set(b.now+1);
}}},animateOffset:function(g,c){var l=this;
l.animationActive=1;
var e=l.now,a=l.parseTimestamp(e,g);
var b=a.hours>12?a.hours-12:a.hours;
var f=b*30;
var h=b>3?720+a.minutes*6:b*360+a.minutes*6;
if(l.offset>g){f=-(360-f-Math.ceil(a.minutes/2));
h=-720+a.minutes*6;
}else{f+=Math.ceil(a.minutes/2);
}var k=function(d,n,m){d.animationActive=0;
d.offset=n;
if(m!==undefined){d.isNight=m=="night"?true:false;
d.clock.setMod("state",m);
if(!d._isBrokenIE&&d.dial){d.dial.day.css({display:d.isNight?"none":"",opacity:d.isNight?d.transparent:1});
d.dial.night.css({display:d.isNight?"":"none",opacity:d.isNight?1:d.transparent});
}}};var j=l.clock.getMod("state");
var i=c?"night":"day";
if(!l.dial){return false;
}if(j!==i){if(!l._isBrokenIE){l.dial[i=="day"?"day":"night"].css({display:"block",opacity:1});
l.dial[i=="day"?"night":"day"].animate({opacity:l.transparent},700);
l.arrows[j].dot.animate({opacity:l.transparent},700,">");
l.arrows[i].dot.animate({opacity:1},700,">");
l.arrows[j].min.animate({rotation:h+" 58 58",opacity:l.transparent},300,">");
l.arrows[j].hour.animate({rotation:f+" 58 58",opacity:l.transparent},300,">");
l.arrows[i].min.animate({rotation:h+" 58 58",opacity:1},2500,">");
l.arrows[i].hour.animate({rotation:f+" 58 58",opacity:1},2500,">",function(){k(l,g,i);
});}else{l.dial[j].hide();
l.dial[i].show();
l.arrows[j].dot.hide();
l.arrows[i].dot.show();
l.arrows[j].min.hide();
l.arrows[i].min.show().animate({rotation:h+" 58 58"},2500,">");
l.arrows[j].hour.hide();
l.arrows[i].hour.show().animate({rotation:f+" 58 58"},2500,">",function(){k(l,g,i);
});}}else{l.arrows[j].min.animate({rotation:h+" 58 58"},2500,">");
l.arrows[j].hour.animate({rotation:f+" 58 58"},2500,">",function(){k(l,g);
});}},changeDayNight:function(f,b,e,h){var c=this;
if(c.DomInitiated===undefined||c.animationActive||!c.dial){return false;
}var g=c.isNight?"night":"day";
var a=g=="day"?"night":"day";
c.clock.setMod("state",g);
if(c._isBrokenIE){c.dial[g].hide();
c.dial[a].show();
c.arrows[g].dot.hide();
c.arrows[a].dot.show();
c.arrows[g].min.hide();
c.arrows[g].hour.hide();
c.arrows[a].min.rotate(e*6+h/10,58,58).show();
c.arrows[a].hour.rotate(b*30+e/2,58,58).show();
}else{c.dial[g].animate({opacity:c.transparent},700);
c.dial[a].css({display:"block",opacity:1});
c.arrows[g].dot.animate({opacity:c.transparent},300,">");
c.arrows[a].dot.animate({opacity:1},300,">");
c.arrows[a].min.rotate(e*6+h/10,58,58).animate({opacity:1},500,">");
c.arrows[a].hour.rotate(b*30+e/2,58,58).animate({opacity:1},500,">");
c.arrows[g].min.animate({opacity:c.transparent},300,">");
c.arrows[g].hour.animate({opacity:c.transparent},300,">");
}c.isNight=f;
},animate:function(e,b,d){var a=this,c=a.parseTimestamp(e,a.offset);
a.arrows.sec.rotate(c.seconds*6,58,58);
if((c.seconds%5==0||!a.setInitiated||b)&&!a.animationActive){if(c.hours>11){c.hours-=12;
}a.arrows[a.isNight?"night":"day"].min.rotate(c.minutes*6+c.seconds/10,58,58);
a.arrows[a.isNight?"night":"day"].hour.rotate(c.hours*30+c.minutes/2,58,58);
if(!d){a.setInitiated=true;
}}}});BEM.DOM.decl("l-time",{_times:[],_syncUrl:"/async/sync.json.xml",init:function(c,b){var a=this;
a._syncUrl+="?lang="+b||Ya.Time.Settings.lang;
if(typeof Date.now!=="function"){Date.now=function(){return new Date().getTime();
};}a._noSVG=c.noSVG;
a._needSave=false;
a.fromJSON(c);
a._needSave=true;
a._newClockButton=a.findBlockInside({blockName:"b-time",modName:"state",modVal:"new"});
a._bindHoverEvents($(a._newClockButton.domElem),a._newClockButton);
a._shareDOM=$(".b-share");
a._shareBlock=a._shareDOM.bem("b-share");
a._shareBlock.init(a._shareDOM.get(0),b);
},syncData:function(){var b=this,a=[],c=0,d=Date.now();
for(c=b._times.length-1;
c>-1;c--){a.push(b._times[c]._geoid);
}$.ajax({url:b._syncUrl,dataType:"json",type:"GET",data:{geo:a.join(",")},timeout:2500,context:b,success:function(h){var f={},e,g=0;
b.now=h[0]+Math.round((Date.now()-d)/2);
$.each(h.slice(1),function(j,k){f[k.geoid]=k;
});for(g=b._times.length-1;
g>-1;g--){if(f[b._times[g]._geoid]){b._times[g].setWeather(f[b._times[g]._geoid].weather);
b._times[g]._sunrise=f[b._times[g]._geoid].sunrise;
b._times[g]._sunset=f[b._times[g]._geoid].sunset;
b._times[g]._offset=f[b._times[g]._geoid].offset;
}}}});},setFlagOnFirstClock:function(b){var a=this;
if(a._times.length>0){a._times[0].toggleFlag();
}},wizardClenup:function(){var a=this;
a._wizardContainer.elem("content").html("");
a._wizardContainer.setMod("state","template");
a._wizardFader.hide();
a._wizardConfirm.un("hide");
a._wizardTimer.elem("item","type","add").unbind("click.wizardAdd");
a.unbindFrom(a._wizardTimer.elem("item","type","drop"),"click");
delete a._wizardKeepClock;
},wizardSaveClocks:function(a,e){var b=a.data.s;
b._wizardKeepClock=true;
for(var c=0;
c<b._wizardClocks.length;
c++){var d=b._wizardClocks[c];
d.domElem.insertBefore(b._newClockButton.domElem);
d.findBlockInside("b-time__setting").domElem.css("display","");
d.findBlockInside("b-time__comment").domElem.css("display","");
d.delMod("widget");
}b._needSave=true;
b.save();b._wizardConfirm.hide();
},wizardHidePopup:function(){var a=this;
if(!a._wizardKeepClock){for(var b=0;
b<a._wizardClocks.length;
b++){a.unshiftInstance(a._wizardClocks[b]);
}if(a._oldFlaggedClock){a._oldFlaggedClock.toggleFlag();
a.changeDefaultLocation(a._oldFlaggedClock.offset(),a._oldFlaggedClock);
}else{a.changeDefaultLocation(null);
}}a.wizardClenup();
a.__base.apply(a,arguments);
},wizardShowPopup:function(d){var b=this;
if(!b._wizardContainer){b._wizardContainer=b.findBlockInside("l-double");
b._wizardContainer.delMod("state").domElem.insertBefore(b._newClockButton.domElem);
b._wizardFader=$(".b-paranja").css({background:"#333",opacity:0.9}).show();
b._wizardConfirm=$(".b-popupa_type_new-timer").bem("b-popupa");
b._wizardConfirm.show(b._wizardContainer.domElem);
b._wizardConfirm.on("hide",b.wizardHidePopup,b);
b._wizardTimer=b._wizardConfirm.findBlockInside("b-add-timer");
b._wizardTimer.elem("item","type","add").bind("click.wizardAdd",{s:b},b.wizardSaveClocks);
b.bindTo(b._wizardTimer.elem("item","type","drop"),"click",function(){this._wizardConfirm.hide();
});}d.now=b.now;
d.syncUrl=b._syncUrl;
var c=function(g){var f=b.findBlockInside({blockName:"b-time",modName:"state",modVal:"template"}).domElem.clone();
b._wizardContainer.elem("content").append(f);
var e=b.findBlockInside(f,"b-time");
e.setMod("widget","static");
e.init(g);e.findBlockInside("b-time__setting").domElem.hide();
e.findBlockInside("b-time__comment").domElem.hide();
return e;};
var a=c(d);
if(!b._wizardClocks){b._wizardClocks=[];
if(!b._thereCanBeOnlyOne){b._oldFlaggedClock=b.flaggedClock;
b.flaggedClock=a;
}}b.injectInstance(a);
b._wizardClocks.push(a);
if(b.flaggedClock){b.changeDefaultLocation(b.flaggedClock.offset(),b.flaggedClock);
}$("body").trigger("resize");
return b;},showInformer:function(){var a=this;
if(a._times.length>0){a._times[0].showCode();
}},startTimer:function(b){var a=this;
a._syncInterval=setInterval(function(){if(!Ya.Time.debugNoSync){a.syncData();
}},60000);var c=function(){a.now+=1000;
for(var d=a._times.length-1;
d>-1;d--){a._times[d].timestamp(a.now,true);
if(a.flaggedClock&&a._times[d]===a.flaggedClock&&Math.ceil(a.now/1000)%10===0){$(document).trigger("time:shoutTime",a._times[d].clock.getTitleData());
}}a.now1=Date.now();
};c();a.timer=setInterval(c,1000);
return this;
},stopTimer:function(){clearInterval(this.timer);
return this;
},shoutTime:function(a){var b=_i18n("yandex time").replace(/\n/g,"");
if(!a){document.title=b;
}else{document.title=a.time+" - "+a.geo+" - "+b;
}},createTimeInstance:function(g,e){var b=this;
var f=g.offset||0;
var c=b.findBlockInside({blockName:"b-time",modName:"state",modVal:"template"}).domElem.clone();
var d=b._newClockButton.domElem;
if(e){b._urlTimeBackground.elem("content").append(c);
}else{c.insertBefore(d);
}g.now=b.now;
g.syncUrl=b._syncUrl;
g.flaggedOffset=b._flaggedOffset;
var a=this.findBlockInside(c,"b-time").init(g);
a.on("time:changeDefaultLocation",function(h,i){if(!i.block){this._flaggedOffset=null;
}this.changeDefaultLocation(i.offset,i.block);
this.save();
},b);a.on("time:changeLocation",function(){this.save();
},b);a.on("time:changeComment",function(){this.save();
},b);a.on("time:remove",function(){this.removeInstance(a);
this.save();
},b);a.on("time:changePosition",function(){this.save();
},b);if(!a.getMod("widget")){b.dragAndDrop(a);
}if(b._times.length===0){g.useInPageTitle=1;
}b._times.push(a);
if(b._times.length===1){b.setFlagOnFirstClock();
}if(b._flaggedOffset){a.updateOffsetDiff(g.offset);
}b.save();return a;
},dragAndDrop:function(a){var b=this;
b._drag={element:false,over:false,mousePos:{}};
var c=$(a.domElem[0]);
c.bind("mousedown.drag",{bem:a},function(d){b._drag.mousePos={x:d.pageX,y:d.pageY};
$(document).bind("mousemove.drag",{bem:d.data.bem},function(f){if(window.getSelection){window.getSelection().removeAllRanges();
}else{if(document.selection&&document.selection.clear){document.selection.clear();
}}if(Math.abs(b._drag.mousePos.x-f.pageX)>18||Math.abs(b._drag.mousePos.y-f.pageY)>18){b._drag.element=f.data.bem;
f.data.bem.setMod("dragndrop","started");
}});$(document).bind("mouseup.drag",{bem:d.data.bem},function(h){if(b._drag.element){if(b._drag.over&&b._drag.over!==b._drag.element){$(h.data.bem.domElem[0]).insertBefore(b._drag.over.domElem[0]);
if(h.data.bem._geoid!==b._drag.over._geoid){var j={elem:null,over:null};
for(var f=0;
f<b._times.length;
f++){if(b._times[f]._geoid===h.data.bem._geoid){j.elem=f;
}if(b._times[f]._geoid===b._drag.over._geoid){j.over=f;
}if(j.elem>0&&j.over>0){break;
}}var g=b._times.splice(j.elem,1)[0];
b._times.splice(j.elem>j.over?j.over:j.over-1,0,g);
h.data.bem.trigger("time:changePosition",{});
}}b._drag.element=null;
h.data.bem.setMod("dragndrop","finished");
for(var f=b._times.length-1;
f>-1;f--){$(b._times[f].domElem[0]).removeClass("b-time_drop_yes");
}$(b._newClockButton.domElem[0]).removeClass("b-time_drop_yes");
}$(document).unbind("mouseup.drag");
$(document).unbind("mousemove.drag");
});return false;
},true);b._bindHoverEvents(c,a);
return b;},_bindHoverEvents:function(c,a){var b=this;
c.bind("mouseenter.drag",{bem:a},function(d){if(b._drag){b._drag.over=d.data.bem;
if(b._drag.element){d.data.bem.setMod("dragndrop","over");
}}},true).bind("mouseleave.drag",{bem:a},function(d){if(b._drag){b._drag.over=null;
if(b._drag.element){d.data.bem.setMod("dragndrop","leave");
}}},true);return b;
},injectInstance:function(a){this._times.push(a);
},unshiftInstance:function(a){this.removeInstance(a,true);
},changeDefaultLocation:function(c,a){for(var b=0;
b<this._times.length;
b++){if(this._times[b]!==a){this._times[b].setDefaultLocationOffset(c,a);
}else{this.flaggedClock=a;
this._flaggedOffset=c;
$(document).trigger("time:shoutTime",c?a.clock.getTitleData():undefined);
}}return this;
},setClockType:function(b){var a=this;
if(a._noSVG){console.warn("no SVG in l-time");
return a;}$.each(a._times,function(){this.setClockType(b);
});a.findBlockInside({blockName:"b-time",modName:"state",modVal:"template"}).setMod("type",b);
a.findBlockInside({blockName:"b-time",modName:"state",modVal:"new"}).setMod("type",b);
return a;},toJSON:function(){var a=this;
var c={times:[]};
for(var b=0;
b<a._times.length;
b++){c.times.push(a._times[b].toJSON());
}return c;},fromJSON:function(c){var b=this;
var a=$.map(c.times,function(d){return d.geoid;
});if(c.urlTimes){a=$.merge(a,c.urlTimes);
}$.each(b._times,function(d,e){e.remove();
});b._times=[];
$.ajax({url:b._syncUrl,dataType:"json",type:"GET",data:{geo:a.join(",")},timeout:2500,context:b,success:function(g){b._needSave=false;
var e={};b.flaggedClock=false;
b.now=g[0];
$.each(g.slice(1),function(h,j){e[j.request_geoid||j.geoid]=j;
});var d;for(var f=0;
f<c.times.length;
f++){d=e[c.times[f].geoid];
if(!d){console.warn("can't find data for geoid =="+c.times[f].geoid);
continue;}d.comment=c.times[f].comment;
d.syncUrl=b._syncUrl;
if(c.times[f].defaultLocation){b._flaggedOffset=c.times[f].defaultLocation;
b.flaggedClock=b.createTimeInstance(d);
}else{b.createTimeInstance(d);
}}if(c.urlTimes&&c.urlTimes.length>0){if(c.urlTimes.length==1){b._thereCanBeOnlyOne=true;
}for(var f=0;
f<c.urlTimes.length;
f++){b.wizardShowPopup(e[c.urlTimes[f]]);
}}if(Ya.Time.showInformer){b.showInformer();
}if(b.flaggedClock){b.flaggedClock.toggleFlag();
}else{if(b._times.length>0){b._times[0].trigger("time:changeDefaultLocation",{offset:null});
}}b.startTimer();
b._needSave=true;
},error:function(){}});
},debugSetTime:function(e){var a=this;
var c=e.split(" "),f=c[0].split("/"),b=c[1].split(":");
a.now=new Date(f[2],f[1]-1,f[0],b[0],b[1],55,0).getTime();
return a;},removeInstance:function(a,c){var b=this;
b._times=$.grep(b._times,function(d){return(d!==a);
});if(a==b.flaggedClock){b._flaggedOffset=null;
b._flaggedClock=null;
b.setFlagOnFirstClock();
}if(c!==undefined){return a;
}a.un("time:changeDefaultLocation").un("time:changeLocation").un("time:changeComment").un("time:remove");
$(a.domElem[0]).unbind("mousedown.drag").unbind("mouseenter.drag").unbind("mouseleave.drag");
return a;},save:function(b){var a=this;
b=(b!==undefined)?b:a.toJSON();
if(a._needSave){$(document).trigger("time:save",b);
}return a;}},{live:function(){var a=this;
$(document).bind("time:changeClockType",function(b,c){$(".l-time").bem("l-time").setClockType(c.clockType);
});$(document).bind("time:createTime",function(b,c){$(".l-time").bem("l-time").createTimeInstance(c);
});$(document).bind("time:injectInstance",function(b,c){$(".l-time").bem("l-time").injectInstance(c);
});$(document).bind("time:unshiftInstance",function(b,c){$(".l-time").bem("l-time").unshiftInstance(c);
});$(document).bind("time:shoutTime",function(b,c){$(".l-time").bem("l-time").shoutTime(c);
});$(document).bind("time:setFlagOnFirstClock",function(b,c){$(".l-time").bem("l-time").setFlagOnFirstClock(c);
});$(document).bind("time:debugSetTime",function(b,c){$(".l-time").bem("l-time").debugSetTime(c);
});}});