$.fn.value=$.fn.val;$.fn.val=function(b){var a=$.fn.value.apply(this,arguments);if(!b&&this.attr("placeholder")==a)return"";return a};$.fn.inputDefaults=function(d){return this.filter("input,textarea").each(function(){if(typeof d=="string")d={text:d};var a=$(this),b=$.extend({cl:"inactive",text:a.attr("placeholder")},d);b.text&&a.attr("placeholder",b.text).focusin(function(){var c=$.trim(a.value());if(c==""||c==b.text)a.val("");a.removeClass(b.cl)}).focusout(function(){var c=$.trim(a.value());if(c==""||c==b.text)a.val(b.text).addClass(b.cl)}).focusin().focusout()})};$(function(){var $window=$(window);$('input[placeholder],textarea[placeholder]').inputDefaults();$(".sitemap").find('h2').each(function(){var self=$(this),parent=self.parent(),cl='sitemap-grey';self.mouseover(function(){parent.addClass(cl)}).mouseout(function(){parent.removeClass(cl)});});$(".sitemap").find('a').each(function(){var self=$(this),parent=self.parent(),cl='sitemap-grey';self.mouseover(function(){parent.addClass(cl)}).mouseout(function(){parent.removeClass(cl)});});if($('#sitemap-search')){$('#sitemap-search').keyup(function(){var search_val=$(this).val();if(search_val.length>3){$(".sitemap").find('a').each(function(){var in_search=$(this).text();var reg=new RegExp(search_val,'gi');if(in_search.search(reg)!=-1)$(this).parent().addClass('sitemap-grey1')
else $(this).parent().removeClass('sitemap-grey1');});$(".sitemap").find('h2').each(function(){var in_search=$(this).text();var reg=new RegExp(search_val,'gi');if(in_search.search(reg)!=-1)$(this).addClass('sitemap-grey1')
else $(this).removeClass('sitemap-grey1');});}else $(".sitemap").find('a').each(function(){$(this).parent().removeClass('sitemap-grey1')});});}if(document.getElementById('mycarousel')){$("#mycarousel").carousel({loop:true,pagination:true,autoSlide:true,autoSlideInterval:5000});}$('.document-change-date-container').each(function(){var self=$(this).css('display','none');self.parent().parent('div:first').mouseover(function(){self.css('display','')});self.parent().parent('div:first').mouseout(function(){self.css('display','none')});});$('#search-button .fnd').click(function(){var form=$(this).prev('form');if($.trim(form.find('input').val())){form.submit();}else{alert('Вы не ввели текст для поиска');}});$('.search-form-main .fnd').click(function(){document.main_search_form.submit();});if(document.getElementById('main-search-select'))$('#main-search-select').selectbox();var jjsearch=$('#jj-search');if(jjsearch.length){jjsearch.keyup(function(){var search_val=$(this).val();if(search_val.length>2){$(".left-col1 .b-menu2").find('a').each(function(){var in_search=$(this).text(),reg=new RegExp(search_val,'gi');if(in_search.search(reg)!=-1)$(this).parent('li:first').removeClass('jj-search-display')
else
$(this).parent('li:first').addClass('jj-search-display');});}else $(".left-col1 .b-menu2").find('a').each(function(){$(this).parent('li:first').removeClass('jj-search-display')});});}$('.link_content').click(function(){indexContent=$('a.link_content').index(this);$('.content_node').hide();$('.content_node').eq(indexContent).show();});var $footer=$('#footer');function replaceFooter($footer,$window){var browserWindow=$window;if(browserWindow.width()<=1000){$footer.css('left',-browserWindow.scrollLeft()+'px');}else{$footer.css('left','auto');}}$window.scroll(function(event){replaceFooter($footer,$(this));});$window.resize(function(){replaceFooter($footer,$(this));});$('.js-date').unbind('click').click(function(){var thisElement=$(this),jPopup=$('.js-popup-event');$('.js-date').removeClass('date_active');thisElement.addClass('date_active');thisElement.tooltip({position:'center right',relative:true,effect:($.browser.msie)?'toggle':'fade',fadeInSpeed:300,fadeOutSpeed:100,opacity:1,tip:jPopup,tipClass:'popup',events:{def:'null,null',tooltip:'null,null'}});var popup=thisElement.data('tooltip');popup.show();$('.js-popup-close').click(function(){popup.hide();$('.js-date').removeClass('date_active');});});var $buttonsYear=$('.js-income-year-container'),$buttonsYearActive=$('.js-income-year-active'),$incomeData=$('.js-income-member-data');$buttonsYear.delegate('.js-income-year-item','click',function(){var $this=$(this),year=$this.get(0).onclick().year,$field=$incomeData.parent().find('[rel="'+year+'"]');$buttonsYearActive.removeClass('b-income-year-active js-income-year-active');$this.addClass('b-income-year-active js-income-year-active');$buttonsYearActive=$this;$incomeData.addClass('g-hidden');$field.removeClass('g-hidden');});var $info=$('#tab1'),$incomeFile=$('.js-card-income-file'),$content=$('#tab3'),top=0;if($info.css('display')=='none'){setIncomeFilePos();}function setIncomeFilePos(){var height={'incomeFile':$incomeFile.height(),'window':$window.height(),'footer':$footer.height(),'content':$content.height()},contentTop=$content.offset().top;top=height.window-height.footer-height.incomeFile-contentTop;top=(height.content<top)?top:height.content;$incomeFile.css('top',top);}$window.resize(function(){if($info.css('display')=='none'){setIncomeFilePos();}});$window.scroll(function(){if($info.css('display')=='none'){$incomeFile.css('top',top+this.scrollY);}});var cardTab=window.location.hash.replace(/#/,''),$cardTab=$('.b-cardTabs td.js-card-'+cardTab);if($cardTab.length){$cardTab.trigger('click');setIncomeFilePos();}$('.b-cardTabs td').click(function(){if($info.css('display')=='none'){setIncomeFilePos();}});if(parseInt($.browser.version)>7){var $container=$('.js-footer-translate'),translate={'$button':$('#translate-this'),'$buttonText':null,'$dropdown':$('.ttb-panel')}
if(translate.$button.length){editBlockTranslate();}$container.mouseenter(function(){if(!translate.$dropdown.length){translate.$dropdown=$('.ttb-panel');}translate.$buttonText[0].onclick=function(){};translate.$dropdown.children().last().addClass('ttb-panelBottom');translate.$dropdown.delegate('.ttb-cta','click',function(){var $this=$(this),lang=$this.attr('href').replace(/\#translate-/,'').toUpperCase();if(lang){translate.$buttonText.text(lang);}});});}function editBlockTranslate(){var text;translate.$buttonText=translate.$button.find('.translate-this-button');text=(translate.$buttonText.text()=='Translations')?'RU':'EN';$container.prepend(translate.$button);translate.$buttonText.attr('id','footer-translate-button').text(text);}});function func_number(num){var cnt=0;num=num.toString();for(var x=num.length;x>=0;x--){if(cnt%3==0&&cnt>0&&x>0)num=num.substr(0,x)+' '+num.substr(x,num.length);cnt++;}return num;}function Sum2Str(sum,is_cent){if(!sum)var sum='0';sum=sum.toString();sum=parseFloat(sum.replace(/,/,'.'));iSum=parseInt(sum);rSum=Math.round((sum-iSum)*100);if(is_cent==false)return'<span class="rub">'+func_number(iSum)+'</span> руб.';else
return'<span class="rub">'+func_number(iSum)+'</span> руб. <span class="kop">'+rSum+'</span> коп. ';}function formValidate(){var field=$('.b-popup-subscribe--select-field .b-field input');if(field.val()==''){field.attr('value','Укажите почту');field.addClass('error');}field.unbind('focusin').focusin(function(){$(this).unbind('focusin').removeClass('error')
field.attr('value','');});}