(function(e,t,n){function a(t){var a=e[t];return e[t]=n,a}function r(e,t){return a("yandex_"+(t?t+"_":"")+e)}function o(e,t,n){for(var a=0;t.length>a;a++)e[t[a]]=r(t[a],n)}function c(){e.name||(e.name='{"yandex_timeout":'+new Date+"}")}function l(){var t=(e.name+"").match(/"yandex_timeout":(\d+)/);return t?t[1]+1>new Date-9e5:n}var _=e.Ya=e.Ya||{};if(!_.Context){_.Context={_callbacks:[],_asyncIdCounter:0,_asyncModeOn:!1,_init:function(){for(var e=0;this._callbacks.length>e;e++)this._callbacks[e]();this._callbacks=[]}},_.Direct={insertInto:function(e,t,n,a){_.Context._asyncModeOn||(_.Context._asyncModeOn=!0),_.Context.AdvManager?_.Context.AdvManager.renderDirect(e,t,n,a):_.Context._callbacks.push(function(){_.Context.AdvManager.renderDirect(e,t,n,a)})}};_.codeVer||(_.loaderVer=648,_.codeVer=.05>=Math.random()?648:646)}for(var s=["yandex_context_callbacks","yandexContextAsyncCallbacks"],i=0;s.length>i;i++){var d=a(s[i]);if(d){_.Context._asyncModeOn||(_.Context._asyncModeOn=!0);for(var x=0;d.length>x;x++)_.Context._callbacks.push(d[x])}}if(e.yandexContextSyncCallbacks)for(var d=a("yandexContextSyncCallbacks"),i=0;d.length>i;i++)_.Context._callbacks.push(d[i]);var y=["ad_format","site_bg_color","font_size","font_family","stat_id","no_sitelinks","search_text","search_page_number","lang"],u=["type","border_type","header_position","bg_color","border_radius","bg_start_color","bg_end_color","border_color","header_bg_color","title_color","text_color","category_color","url_color","hover_color","limit","place","favicon","title_font_size","grab","c11n"];if(e.yandex_ad_format){var f={};o(f,y),o(f,u,f.ad_format);var C=f.place;C&&t.getElementById(C)||(C="Ya_sync_"+_.Context._asyncIdCounter++,t.write('<div id="'+C+'"></div>'));var h=r("partner_id");_.Context._callbacks.push(function(){_.Context.AdvManager.renderDirect(h,C,f)})}var v="https:"===e.location.protocol?"https:":"http:",g="<%= PROTOCOL %>//an.yandex.ru/resource/context_static_r<%= CODE_VER %>.js".replace("<%= CODE_VER %>",_.codeVer).replace("<%= PROTOCOL %>",v);if(_.Context._asyncModeOn){var p=t.createElement("script"),b=t.getElementsByTagName("script")[0];p.charset="utf-8",p.src=g,b.parentNode.insertBefore(p,b)}else setTimeout(function(){var n=t.getElementsByTagName("script"),a=n?n[n.length-1]:null;a&&!e.Ya.Context.AdvManager&&"yes"==a.getAttribute("yandex_load_check")&&(a.parentNode.removeChild(a),c())},8e3),l()||t.write('<script type="text/javascript" src="'+g+'" yandex_load_check="yes"></sc'+"ript>")})(this,this.document);