(function(b,a){if(!a){a=window.Lego={}}a.messages=a.messages||{};a.message=function(d,c){return a.params.locale=="ru"?c:(a.messages[d]||c)}})(jQuery,window.Lego);(function(b,a){a.block["b-head-tabs"]=function(e){var h=b(this),f=h.next(".b-head-search"),c=f.find(".b-search .b-input input:first"),i=f.find(".advanced"),l=(i.attr("href")||"").replace(/([?&])text=[^&]*/g,""),g=b.map(document.location.search.substr(1).split("&"),function(o){var q=o.split("=");return q[0]=="noreask"?q[1]:""}).join(""),n=(function(){var o=a.block["b-head-tabs"].getHostToUrlMap();g&&b.each(o,function(q){o[q]=o[q]+j(o[q])+"noreask="+g});return o})(),m=b.grep(b.map(h.find(":not(strong)>a.b-head-tabs__link:not([href$=yandex.ru/all])"),function(q){var o=q.host.split(".")[0];return{node:b(q),clid:(b(q).attr("search").match(/[&?]clid=(\d+)/)||[])[1],service:o,url:n[o]}}),function(o){return typeof o.url!="undefined"}),d={www:505,search:521,images:526}[a.params.id]||527,k;setInterval((function(){var o=encodeURIComponent(b.trim(c.val())||e["default"]);if(k===o){return arguments.callee}k=o;if(!!i.length){i.attr("href",l+(!!o?j(l)+"text="+o:""))}b.each(m,function(){var q=!!o?(this.service=="market"?this.url.replace("%clid%",d):this.url)+j(this.url)+a.block["b-head-tabs"].getSearchParamName(this.service)+"="+o:this.service=="market"?"?clid="+d+"&cvredirect=1":"",r=this.node[0];r.href=r.protocol+"//"+r.host+"/"+q+((this.clid&&this.service!="market"&&!(this.service=="www"&&!!o))?j(q)+"clid="+this.clid:"")});return arguments.callee})(),200);function j(o){return o.indexOf("?")!=-1?"&":"?"}};a.block["b-head-tabs"].getHostToUrlMap=function(){var c={www:"yandsearch",news:"yandsearch?rpt=nnews&grhow=clutop",yaca:"yandsearch?rpt=rs2",market:"search.xml?clid=%clid%&cvredirect=1",blogs:"search.xml?ft=blog",maps:"",auto:"search.xml"};c.images=c.www;c.adresa=c.video=c.fotki=c.slovari=c.auto;return c};a.block["b-head-tabs"].getSearchParamName=function(c){return"text"}})(jQuery,window.Lego);(function(b,a){a.block["b-dropdown"]=function(i){var g=b(this),d=g.find(".b-dropdown__list"),c=b('<div class="b-dropdown__popup"><iframe class="b-dropdown__iframe" frameborder="0" src="javascript:\'<body style=\\\'background:none;overflow:hidden\\\'>\'"></iframe></div>'),h=d.clone(true).addClass("b-dropdown__list_clone").hide(),f=false,e=(function(){if(f){return}c.css("visibility","hidden").before(d).hide();h.hide();f=true});d.before(c);c.after(h);e();b(document).keydown(function(j){if(j.keyCode==27&&!(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)){e()}}).click(function(j){if(!b(j.target).is(".b-dropdown *")){e()}}).bind("popupsClose.lego",e);b(this).find(".b-dropdown__or").click(function(k){k.preventDefault();if(g.hasClass("b-dropdown_disabled")){g.trigger("popupDisabled.lego");return}if(f){b(document).trigger("popupsClose.lego");var l=b.Event("popupOpen.lego");g.trigger(l);if(!l.isDefaultPrevented()){h.css("display","");c.append(d).css("visibility","");if(i.direction=="up"){h.css("top",h.superOffset().top-h.height());var j=(b.browser.opera&&b.browser.version<=9.27)?22:b(window).superScrollTop()-c.superOffset().top+22;c.css("top",j-c.height())}c.css("display","");f=false}}else{e()}})}})(jQuery,window.Lego);if(document.documentElement.getBoundingClientRect){jQuery.fn.superOffset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.superOffset.bodyOffset(this[0])}var c=this[0].getBoundingClientRect(),f=this[0].ownerDocument,b=f.body,a=f.documentElement,h=a.clientTop||b.clientTop||0,g=a.clientLeft||b.clientLeft||0,e=c.top+(self.pageYOffset||jQuery.boxModel&&a.scrollTop||b.scrollTop)-h,d=c.left+(self.pageXOffset||jQuery.boxModel&&a.scrollLeft||b.scrollLeft)-g;return{top:e,left:d}}}else{if(document.getBoxObjectFor){jQuery.fn.superOffset=function(){if(this[0]===document){return{top:0,left:0}}var f=document.getBoxObjectFor(this[0]),e=0,h=0,d=this[0],g=d.ownerDocument,b=g.documentElement,a=g.body;var c=g.defaultView.getComputedStyle(d,null);while((d=d.parentNode)&&d!==a&&d!==b){e+=d.scrollTop;h+=d.scrollLeft}return{top:f.y-parseInt(c.borderTopWidth,10)-e,left:f.x-parseInt(c.borderLeftWidth,10)-h}}}else{jQuery.fn.superOffset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.superOffset.bodyOffset(this[0])}jQuery.superOffset.initialized||jQuery.superOffset.initialize();var f=this[0],c=f.offsetParent,b=f,k=f.ownerDocument,i,d=k.documentElement,g=k.body,h=k.defaultView,a=h.getComputedStyle(f,null),j=f.offsetTop,e=f.offsetLeft;while((f=f.parentNode)&&f!==g&&f!==d){i=h.getComputedStyle(f,null);if(!jQuery.browser.opera||jQuery.browser.version>9.27||(f.tagName!="TR"&&f.tagName!="TBODY")){j-=f.scrollTop,e-=f.scrollLeft}if(f===c){j+=f.offsetTop,e+=f.offsetLeft;if(jQuery.superOffset.doesNotAddBorder&&!(jQuery.superOffset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(f.tagName))){j+=parseInt(i.borderTopWidth,10)||0,e+=parseInt(i.borderLeftWidth,10)||0}b=c,c=f.offsetParent}if(jQuery.superOffset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){j+=parseInt(i.borderTopWidth,10)||0,e+=parseInt(i.borderLeftWidth,10)||0}a=i}if(a.position==="relative"||a.position==="static"){j+=g.offsetTop,e+=g.offsetLeft}if(a.position==="fixed"){j+=Math.max(d.scrollTop,g.scrollTop),e+=Math.max(d.scrollLeft,g.scrollLeft)}return{top:j,left:e}}}}jQuery.superOffset={initialize:function(){if(this.initialized){return}var h=document.body,b=document.createElement("div"),d,c,j,e,i,a,f=h.style.marginTop,g='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';i={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(a in i){b.style[a]=i[a]}b.innerHTML=g;h.insertBefore(b,h.firstChild);d=b.firstChild,c=d.firstChild,e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(c.offsetTop!==5);this.doesAddBorderForTableAndCells=(e.offsetTop===5);d.style.overflow="hidden",d.style.position="relative";this.subtractsBorderForOverflowNotVisible=(c.offsetTop===-5);h.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(h.offsetTop===0);h.style.marginTop=f;h.removeChild(b);this.initialized=true},bodyOffset:function(a){jQuery.superOffset.initialized||jQuery.superOffset.initialize();var c=a.offsetTop,b=a.offsetLeft;if(jQuery.superOffset.doesNotIncludeMarginInBodyOffset){c+=parseInt(jQuery.curCSS(a,"marginTop",true),10)||0,b+=parseInt(jQuery.curCSS(a,"marginLeft",true),10)||0}return{top:c,left:b}}};jQuery.fn.extend({position:function(){function b(h,i){return h[0]&&parseInt(jQuery.curCSS(h[0],i,true),10)||0}var f=0,e=0,c;if(this[0]){var d=this.offsetParent(),g=this.superOffset(),a=/^body|html$/i.test(d[0].tagName)?{top:0,left:0}:d.superOffset();g.top-=b(this,"marginTop");g.left-=b(this,"marginLeft");a.top+=b(d,"borderTopWidth");a.left+=b(d,"borderLeftWidth");c={top:g.top-a.top,left:g.left-a.left}}return c},offsetParent:function(){var a=this[0].offsetParent||document.body;while(a&&(!/^body|html$/i.test(a.tagName)&&jQuery.css(a,"position")=="static")){a=a.offsetParent}return jQuery(a)}});var usePageOffset=typeof window.pageXOffset=="number";jQuery.each(["Left","Top"],function(b,a){var c="superScroll"+a;jQuery.fn[c]=function(d){if(!this[0]){return null}return d!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!b?d:jQuery(window).superScrollLeft(),b?d:jQuery(window).superScrollTop()):this[c]=d}):this[0]==window||this[0]==document?(usePageOffset?self[b?"pageYOffset":"pageXOffset"]:jQuery.boxModel&&document.documentElement[(c=="superScrollLeft")?"scrollLeft":"scrollTop"]||document.body[(c=="superScrollLeft")?"scrollLeft":"scrollTop"]):this[0][c]}});(function(b,a){a.block["b-head-user"]=function(){var c=b(this);if(a.params.login!=""){b.getJSON("//pass.yandex.ru/services?callback=?",{locale:a.params.locale,login:"yes"},function(f){if(!f||!f.services){return}var d=f.login||a.params.login;var e='<div class="g-js b-dropdown" onclick="return {name:\'b-dropdown\'}"><ul class="b-dropdown__list"><li class="b-dropdown__item b-dropdown__visible"><a href="http://i.yandex.ru" class="b-dropdown__or"><span class="b-pseudo-link"><b class="b-user"><b class="b-user__first-letter">'+d.substring(0,1)+"</b>"+d.substring(1)+"</b></span></span></a></li>";b.each(f.services,function(){e+='<li class="b-dropdown__item">';if(a.params.id==this.id&&a.params.index){e+="<strong>"+this.title+"</strong>"}else{e+='<a class="b-dropdown__link"href="'+this.url+'"onmousedown="Lego.ch(\''+a.params.id+".login.myservices."+this.id+"',this)\">"+this.title+"</a>"}e+="</li>"});e+='<li class="b-dropdown__item b-dropdown__line"><a href="//passport.yandex.ru/">'+a.message("b-head-userinfo.user:passport","Паспорт")+"</a></li>";e+='<li class="b-dropdown__item"><a href="//passport.yandex.ru/passport?mode=changepass&retpath=http://i.yandex.ru/">'+a.message("b-head-userinfo.user:change-password","Сменить пароль")+"</a></li>";e+="</ul></div>";c.find(".b-user").replaceWith(e);a.blockInit(c,".b-dropdown")})}}})(jQuery,window.Lego);(function(b,a){a.block["b-hint-input"]=function(){var i=b(this),e=b("#"+i.attr("for")),g=function(){i.hide()},d=function(){i.show()},c=function(){h||e.val()?g():d()},h=false;e.focus(function(){h=true;c()}).blur(function(){h=false;c()}).bind("change mouseover",c);i.click(function(){e.focus()});e.change();var f=e.val();(function(){if(e.val()!=f){b(e).trigger("change");f=e.val()}setTimeout(arguments.callee,200)})()}})(jQuery,window.Lego);(function(b,a){a.block["b-auth"]=function(h){var e=b(this),d=false,f=b('<input type="hidden" name="timestamp"/>');e.append(f).submit(function(){if(d){return false}f.val(new Date().getTime())});var c=e.find("input[name=login], input[name=passwd]"),g=e.find("input[type=submit]");c.change(function(){d=false;c.each(function(){if(!b.trim(b(this).val())){d=true}});g.attr("disabled",d)});c.change()}})(jQuery,window.Lego);(function(b,a){a.block["b-auth-domik_popup"]=function(h){var e=b(this),d;b(".b-head-userinfo__entry .b-pseudo-link").click(function(){c();return false});function c(j){if(!d){g()}var i="&from="+a.params["passport-msg"]+"&retpath="+encodeURIComponent(j||a.params.retpath);d.attr("action",a.params["passport-host"]+"/passport?mode=auth"+i).find(".b-auth-domik__register .b-auth-domik__link").attr("href",a.params["passport-host"]+"/passport?mode="+(h.regMode||"register")+i);b(document).bind("keyup.b-auth-domik",function(k){if(k.keyCode==27){f()}}).bind("click.b-auth-domik",function(k){if(b(k.target).parents().andSelf().index(d)==-1||b(k.target).is("input[type=button]")){f()}});!d.hasClass("b-auth-domik_popup-50-50")&&window.scrollTo(0,0);d.show().find("input[name=login]").focus();b(document).trigger("show.b-auth-domik_popup")}function f(){b(document).unbind(".b-auth-domik");d.hide()}function g(){d=b('<form class="'+e.attr("class").replace("g-hidden","")+'" method="post"><i class="b-auth-domik__roof"></i><table class="b-auth-domik__shadow"><tr><td class="b-auth-domik__shadow__lt">&nbsp;</td><td class="b-auth-domik__shadow__t"></td><td class="b-auth-domik__shadow__rt">&nbsp;</td></tr><tr><td class="b-auth-domik__shadow__l">&nbsp;</td><td class="b-auth-domik__shadow__m"><div class="b-auth-domik__form"><div class="b-auth-domik__title">'+h.title+'</div><div class="b-auth-domik__username"><label for="b-auth-domik_popup-username" class="b-hint-input g-js" onclick="return {name:\'b-hint-input\'}">'+a.message("b-auth:login","логин")+'</label><div class="b-input"><input class="b-input__text" id="b-auth-domik_popup-username" name="login" tabindex="11"/></div></div><div class="b-auth-domik__password"><label for="b-auth-domik_popup-password" class="b-hint-input g-js" onclick="return {name:\'b-hint-input\'}">'+a.message("b-auth:password","пароль")+'</label><div class="b-input"><input class="b-input__text" id="b-auth-domik_popup-password" name="passwd" type="password" tabindex="11"/></div></div><div class="b-auth-domik__permanent"><input class="b-auth-domik__check" id="b-auth-domik_popup-permanent" name="twoweeks" type="checkbox" value="yes" tabindex="11"/><label for="b-auth-domik_popup-permanent">'+a.message("b-auth:permanent","Запомнить меня")+'</label> <span class="b-auth-domik__help">(<a class="b-auth-domik__link" href="http://help.yandex.ru/passport/?id=922493" tabindex="12">'+a.message("b-auth:help","что&nbsp;это")+'</a>)</span></div><div class="b-auth-domik__button"><input class="b-auth-domik__submit" type="submit" value="'+a.message("b-auth:logon","Войти")+'" tabindex="11"/><input class="b-auth-domik__submit" type="button" value="'+a.message("b-auth:cancel","Отмена")+'" tabindex="11"/></div><div class="b-auth-domik__register"><a class="b-auth-domik__link" href="" tabindex="11">'+(h.register||a.message("b-auth:register","Зарегистрироваться"))+'</a></div><div class="b-auth-domik__remember"><a class="b-auth-domik__remind" href="'+a.params["passport-host"]+'/passport?mode=remember" tabindex="11">'+a.message("b-auth:remember","Напомнить пароль")+'</a></div></div></td><td class="b-auth-domik__shadow__r">&nbsp;</td></tr><tr><td class="b-auth-domik__shadow__lb">&nbsp;</td><td class="b-auth-domik__shadow__b"></td><td class="b-auth-domik__shadow__rb">&nbsp;</td></tr></table><iframe class="b-popup-under"></iframe></form>');if(a.block["b-auth"]){a.block["b-auth"].call(d)}b("body").append(d);a.blockInit(d)}arguments.callee.login=c}})(jQuery,window.Lego);(function(b,a){a.block["b-vmenu"]=function(){b(">.item>.switcher>.b-pseudo-link , >.item>.switcher>.switcher-icon",this).click(function(){var c=b(this).parents(".switcher:first");c.toggleClass("switcher-on");c.find("img").attr("alt",c.hasClass("switcher-on")?"-":"+");b(".b-vmenu:first",b(this).parents(".item:first")).toggleClass("g-hidden")})}})(jQuery,window.Lego);(function(c,b){var d;function a(e){e[0]&&!!e.attr("href")&&(window.location.href=e.attr("href"))}b.block["b-pager"]=function(e){if(d){return e.override&&(d=c(this))}d=c(this);c(document).keydown(function(f){if(!f.ctrlKey||c(f.target).is("input, textarea")){return}if(f.keyCode==37){a(d.find(".b-pager__prev"))}else{if(f.keyCode==39){a(d.find(".b-pager__next"))}}})}})(jQuery,window.Lego);(function(c,b){function a(d){swfobject.embedSWF("http://flv.video.yandex.ru/direct/direct/jxjvhraa3d.1813/","video-lesson",800,450,"9.0.28","//swf.static.yandex.net/swfobject/2.2/expressInstall.swf",{"is-hq":true,code:"8-800-333-96-39",url:"http://direct.yandex.ru/registered/main.pl?cmd=newCamp%26mediaType=text%26firstbanner=easy%26id=videonew",date:"support@direct.yandex.ru",time:"258",autostart:d===false?"no":"yes",tn1:"FLV-DIRECT-ADDADV",tn2:"FLV-DIRECT-RELOAD",tn3:"FLV-DIRECT-DONE",cid:"191494"},{allowFullScreen:true,scale:"noscale",allowScriptAccess:"always"})}b.block["b-movie-popup"]=function(h){var g=c(".b-movie-popup");var f="828",d="478";c(document).ready(function(){if(window.location.hash.toString().indexOf("video")>-1){e(false)}});this.click(e);c(".b-movie-popup__close").click(i);function e(l){a(l);var k,m;g.css({top:"-5000px",left:"-5000px"});g.removeClass("g-hidden");function j(){k=(c(window).width()/2)-(f/2);if(c.browser.msie){m=(c(window).height()/2)-(d/2)+c(document).scrollTop()}else{m=(c(window).height()/2)-(d/2);g.css({position:"fixed"})}return{x:k,y:m}}p=j();g.css({top:p.y,left:p.x});if(c.browser.msie){c(window).bind("scroll.popup",function(){p=j();g.css({top:p.y,left:p.x})})}c(window).bind("resize.popup",function(){p=j();g.css({top:p.y,left:p.x})});if(c.isFunction(h.counter)){h.counter()}return false}function i(k){k.preventDefault();g.css({top:"-5000px",left:"-5000px"});g.addClass("g-hidden");c(window).unbind(".popup");var j=c("#video-lesson").parent();swfobject.removeSWF("video-lesson");j.html('<div style="height:450px;width:800px;" id="video-lesson"></div>');if(window.location.hash==="#video"){window.location.hash=""}return false}}})(jQuery,window.Lego);(function(b,a){a.block["b-ausfallen"]=function(f){var d=b(".b-ausfallen");this.click(e);d.find(".b-ausfallen__close").click(c);if(window.location.hash.substr(1)==f.hash){e()}function e(){var i=f.link;if(b.isFunction(f.link)){i=f.link()}d.find(".b-ausfallen-border").html('<iframe class="b-ausfallen__frame" src="'+i+'" frameborder="0"></iframe>');var h,j;d.css({top:"-5000px",left:"-5000px"});d.removeClass("g-hidden");function g(){h=(b(window).width()/2)-(d.width()/2);if(b.browser.msie){j=(b(window).height()/2)-(d.height()/2)+b(document).scrollTop()}else{j=(b(window).height()/2)-(d.height()/2);d.css({position:"fixed"})}return{x:h,y:j}}p=g();d.css({top:p.y,left:p.x});if(b.browser.msie){b(window).bind("scroll.popup",function(){p=g();d.css({top:p.y,left:p.x})})}b(window).bind("resize.popup",function(){p=g();d.css({top:p.y,left:p.x})});if(b.isFunction(f.counter)){f.counter()}if(f.hash){window.location.hash="#"+f.hash}return false}function c(){d.css({top:"-5000px",left:"-5000px"}).addClass("g-hidden").find(".b-ausfallen-border").empty();b(window).unbind(".popup");window.location.hash="";return false}}})(jQuery,window.Lego);(function(b,a){a.block["b-cut"]=function(){var c=b(".h-cut"),d=b(".b-cut");this.click(function(){c.show();d.hide();return false})}})(jQuery,window.Lego);(function(b,a){a.block["b-give-adv"]=function(){var g=b(".b-give-adv__login-text"),f=300,h=null;if(g){b(this).hover(function(){g.show();e()},d);g.hover(e,d)}function e(){if(h){window.clearTimeout(h)}h=null}function c(){g.hide()}function d(){e();h=window.setTimeout(c,f)}}})(jQuery,window.Lego);function _print(){window.print();return false}function openAuthForm(c,a){var b=jQuery.Event(c);b.preventDefault();b.stopPropagation();Lego.block["b-auth-domik_popup"].login(a)}function toggleBlocks(b){if(b.hash==="#what"){$("#tuk-tuk .h-about, #111, #222, #333").show();$("#tuk-tuk .b-how").hide();$(b.parentNode.parentNode).addClass("b-tabs_what");$(b.parentNode.parentNode).removeClass("b-tabs_how")}else{$("#tuk-tuk .h-about, #111, #222, #333").hide();$("#tuk-tuk .b-how").show();$(b.parentNode.parentNode).addClass("b-tabs_how");$(b.parentNode.parentNode).removeClass("b-tabs_what")}};
