$(function(){$(document).on("click","a[href='#']",function(e){e.preventDefault();});var headerHeight=function(){if($("header .menu").length){$("header .menu").parent().height("auto");$("header .menu").parent().height($("header .menu").parent().height());$(window).off('.affix')
$("header .menu").removeData('bs.affix').removeClass("affix affix-top affix-bottom");$("header .menu").affix({offset:{top:$("header .menu").offset().top+$("header .menu").height()}});}};headerHeight();$(window).on("resize scroll",function(){if(!$("header .menu").hasClass("affix"))
headerHeight();});var menuCallbacksExecution=function(){if(pinky2&&pinky2.callbacks&&pinky2.callbacks.menu&&pinky2.callbacks.menu.length){for(var i in pinky2.callbacks.menu)
pinky2.callbacks.menu[i]();}};if(typeof $.cookie(pinky2.config.cookies.session)!="undefined"){var data2load={like:[],bookmark:[],__method:"get"};$("[data-action='like']").each(function(i,el){data2load.like.push([$(el).data("content-type"),$(el).data("content-id")]);});$("[data-action='bookmark']").each(function(i,el){data2load.bookmark.push([$(el).data("content-type"),$(el).data("content-id")]);});$.post($("header .menu .user").data("source"),data2load,function(response){$("header .menu .user").html(response);menuCallbacksExecution();}).fail(function(){$("header .menu .user").html(tmpl("tmpl-session-menu",[]));menuCallbacksExecution();});}else{$("header .menu .user").html(tmpl("tmpl-session-menu",[]));menuCallbacksExecution();}
$(document).on("click","[data-action='session-start']",function(e){if($("#tmpl-modal-session-start").length){e.preventDefault();$("#modal").html(tmpl("tmpl-modal-session-start",[])).modal("show");}});pinky2.url=function(url){if(pinky2.config&&pinky2.config.language&&pinky2.config.language.url)
url="/"+pinky2.config.language.tag+url;return url;};if($(".img-bb").length){$(".img-bb").each(function(){if($(this).parent().get(0).tagName!="A"){var source=$(this).attr("src");var matches=source.match("attachments\/(?:[a-z0-9]{32}/|)[0-9-]{7}\/([a-z-]+)\/[a-z0-9]+\/");if(matches)
$(this).wrap('');}})}
if($(".media-preview a").length&&jQuery().fancybox){$(".media-preview a").fancybox({padding:5,helpers:{media:{},title:{type:"outside"}},afterShow:function(){var fbox=this;var wToMake=fbox.origWidth;var hToMake=fbox.origHeight;var cWidth=(fbox.inner[0].clientWidth-0);var cHeight=(fbox.inner[0].clientHeight-0);if(cWidth=wToMake||cHeight>=hToMake)
expand.css({"display":"none"});else
expand.css({"display":"block"});},tpl:{image:'
'}});}
if($(".spoiler").length){$(".spoilerTitle a").click(function(e){e.preventDefault();$(this).parents("div.spoiler").find(".spoilerTitle span, .spoilerText").toggle();});}
if($(".catalog .banner.catalog-banner-item").length){$(window).resize(function(){$(".banner.catalog-banner-item").css("height",$("article.catalog-content").height()+"px");});var interval=setInterval(function(){if(Math.max.apply(Math,$("article.catalog-content").map(function(){return $(this).height();}))>313){$(window).trigger("resize");clearInterval(interval);}},500);}
if($(".scroller-top").length){$(window).bind("resize scroll",function(){if($(this).scrollTop()>200&&$(document).width()>1210){$(".scroller-top").fadeIn();}else{$(".scroller-top").fadeOut();}});}
$(document).on("click",".scroller",function(e){e.preventDefault();var target=$(this).attr("href");var destination=$(target).offset().top;$("html:not(:animated), body:not(:animated)").animate({scrollTop:destination},400);return false;});if($("[data-toggle='tooltip']").length){$("[data-toggle='tooltip']").tooltip();}
if($("[role='banner'][data-float='true']").length){var maxHeight=$(".column.column-center").height();if($(".column.column-sidebar-right").height()>maxHeight)
maxHeight=$(".column.column-sidebar-right").height();if($(".column.column-sidebar-left").height()>maxHeight)
maxHeight=$(".column.column-sidebar-left").height();var colBannerCallbacks={};var colBannerChecks={};$(".column.column-sidebar-right, .column.column-sidebar-left").each(function(i,el){if(maxHeight>$(el).height()){var colHeigth=$(el).height();var $banner=$("[data-float='true']:first",this);if($banner.length){var bannerTop=$banner.offset().top;colBannerChecks[i]=null;colBannerCallbacks[i]=function(){if(colBannerChecks[i]==null){colBannerChecks[i]=setTimeout(function(){bannerTop=$banner.offset().top-parseInt($banner.css("margin-top"));clearTimeout(colBannerChecks[i]);colBannerChecks[i]=null;},1000);}
var scrollTop=$(window).scrollTop();var margin=0;if((scrollTop+65)>bannerTop)
margin=scrollTop-bannerTop+65;var maxMargin=$(".column.column-center").height()-$banner.height()-bannerTop+$(".column.column-sidebar-right").offset().top;if(margin>maxMargin)
margin=maxMargin;if(margin<5)
margin=5;$banner.css("margin-top",margin);};colBannerCallbacks[i]();if(($(".column.column-center").height()-colHeigth)>0){$(window).on("resize scroll",colBannerCallbacks[i]);$(document).ready(colBannerCallbacks[i]);}}}});}});