Your IP : 216.73.216.170


Current Path : /home/bitrix/ext_www/vebeng.yacl.site/js/
Upload File :
Current File : /home/bitrix/ext_www/vebeng.yacl.site/js/main.js

function gotoContact() {
	location.href = '/contacts/';
}

$(document).ready(function () {
	$('.chat_right_corner img').click(function() {
		if ($(window).width() > 1023) {
            $(this).closest('.chat_right_corner').addClass('chat_active');
        } else {
			location.href = '/jsbot/';
		}
	});

	$('.chat-card-buttons-button').click(function () {
        $('.chat_right_corner').removeClass('chat_active');
    });

	if($.fn.fancybox)
	{
        $('.fancybox-images').fancybox({
			
            padding: 0,
            type: 'image',
            helpers: {
                overlay: {
                    locked: true
                }
            }
        });

	}



	jQuery.each(jQuery('textarea[data-autoresize]'), function () {
		var offset = this.offsetHeight - this.clientHeight;

		var resizeTextarea = function (el) {
			jQuery(el).css('height', 'auto').css('height', el.scrollHeight + offset);
		};
		jQuery(this).on('keyup input', function () {
			resizeTextarea(this);
		}).removeAttr('data-autoresize');
	});

	$(window).on('load', function () {
		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}
		$('.project').css('min-height', $('.project').height());

		var mh = 0;
		$('.press_center .press_wrap .wrap_1 .item .mob_anons').each(function () {
			var h_block = parseInt($(this).height());
			if (h_block > mh) {
				mh = h_block;
			};
		});
		$('.press_center .press_wrap .wrap_1 .item .mob_anons').css('height', mh + 20);
		var mh2 = 0;
		$('.item_w_blue .mob_anons').each(function () {
			var h_block2 = parseInt($(this).height());
			if (h_block2 > mh2) {
				mh2 = h_block2;
			};
		});
		$('.item_w_blue .mob_anons').css('height', mh2 + 20);
		var mh3 = 0;
		$('.smi .smi_wrap .item .mob_anons').each(function () {
			var h_block3 = parseInt($(this).height());
			if (h_block3 > mh3) {
				mh3 = h_block3;
			};
		});
		$('.smi .smi_wrap .item .mob_anons').css('height', mh3 + 20);
	});
	/*window.addEventListener("orientationchange", function () {
		$('.project').css('min-height', 'auto');
		$('.project').css('min-height', $('.project').height());
		if ($('.wrapper').height() < $(window).height()) {
			$('.wrapper').css({
				minHeight: $(window).height() + 'px'
			});
		} else {
			$('.wrapper').css({
				minHeight: 'inherit'
			});
		}
	}, false);*/

	/*if ($('.wrapper').height() < $(window).height()) {
		$('.wrapper').css({
			minHeight: $(window).height() + 'px'
		});
	} else {
		$('.wrapper').css({
			minHeight: 'inherit'
		});
	}*/

	$(window).resize(function () {
		var mh = 0;
		$('.press_center .press_wrap .wrap_1 .item .mob_anons').css('height', 'auto');
		$('.press_center .press_wrap .wrap_1 .item .mob_anons').each(function () {
			var h_block = parseInt($(this).height());
			if (h_block > mh) {
				mh = h_block;
			};
		});
		$('.press_center .press_wrap .wrap_1 .item .mob_anons').css('height', mh + 20);
		var mh2 = 0;
		$('.item_w_blue .mob_anons').css('height', 'auto');
		$('.item_w_blue .mob_anons').each(function () {
			var h_block2 = parseInt($(this).height());
			if (h_block2 > mh2) {
				mh2 = h_block2;
			};
		});
		$('.item_w_blue .mob_anons').css('height', mh2 + 20);
		var mh3 = 0;
		$('.smi .smi_wrap .item .mob_anons').css('height', 'auto');
		$('.smi .smi_wrap .item .mob_anons').each(function () {
			var h_block3 = parseInt($(this).height());
			if (h_block3 > mh3) {
				mh3 = h_block3;
			};
		});
		$('.smi .smi_wrap .item .mob_anons').css('height', mh3 + 20);
		$('.project').css('min-height', 'auto');
		$('.project').css('min-height', $('.project').height());
		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}
		/*if ($('.wrapper').height() < $(window).height()) {
			$('.wrapper').css({
				minHeight: $(window).height() + 'px'
			});
		} else {
			$('.wrapper').css({
				minHeight: 'inherit'
			});
		}*/
	})


	/*$('.image_disabled').click(function () {
		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}
	})*/
	$('map').imageMapResize();
	//var ths_font_size;
	//var cur_resize = 2;
	//var font_massive = $('p:not(.spis_wrap .item .p-1):not(.spis_wrap .item .read_more),a,span,li,input,textarea,select');


	/*if ($('body').hasClass('font_1')) {
		font_massive.each(function () {
			ths_font_size = $(this).css('font-size');
			ths_font_size = parseFloat(ths_font_size);
			$(this).css('font-size', ths_font_size * 0.8 + 'px');
		})
		cur_resize = 1;
	}*/
	/*if ($('body').hasClass('font_2')) {
		font_massive.each(function () {
			ths_font_size = $(this).css('font-size');
			ths_font_size = parseFloat(ths_font_size);
			$(this).css('font-size', ths_font_size * 1 + 'px');
		})
		cur_resize = 2;
	}*/
	/*if ($('body').hasClass('font_3')) {
		font_massive.each(function () {
			ths_font_size = $(this).css('font-size');
			ths_font_size = parseFloat(ths_font_size);
			$(this).css('font-size', ths_font_size * 1.2 + 'px');
		})
		cur_resize = 3;
	}*/

	/*$('#panelLimited .version_link').click(function () {
		if (cur_resize == 3) {
			font_massive.each(function () {
				ths_font_size = $(this).css('font-size');
				ths_font_size = parseFloat(ths_font_size);
				$(this).css('font-size', (ths_font_size / 1.2) + 'px');
			})
		}
		if (cur_resize == 1) {
			font_massive.each(function () {
				ths_font_size = $(this).css('font-size');
				ths_font_size = parseFloat(ths_font_size);
				$(this).css('font-size', (ths_font_size / 0.8) + 'px');
			})
		}
		cur_resize = 2;

		$('#panelLimited  .font_size li').removeClass('cur');
		$('#panelLimited  .font_size .type_2').addClass('cur');
	})*/


	/*$('#panelLimited .font_size .type_1').click(function () {
		if (cur_resize != 1) {
			if (cur_resize == 3) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', (ths_font_size / 1.2) + 'px');
				})
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', ths_font_size * 0.8 + 'px');
				})
			}
			if (cur_resize == 2) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', ths_font_size * 0.8 + 'px');
				})
			}
			cur_resize = 1;
		}

		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}

	})*/



	/*$('#panelLimited .font_size .type_2').click(function () {
		if (cur_resize != 2) {
			if (cur_resize == 3) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', (ths_font_size / 1.2) + 'px');
				})
			}
			if (cur_resize == 1) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', (ths_font_size / 0.8) + 'px');
				})
			}
			cur_resize = 2;
		}

		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}
	})*/
	/*$('#panelLimited .font_size .type_3').click(function () {
		if (cur_resize != 3) {
			if (cur_resize == 2) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size);
					$(this).css('font-size', ths_font_size * 1.2 + 'px');
				})
			}
			if (cur_resize == 1) {
				font_massive.each(function () {
					ths_font_size = $(this).css('font-size');
					ths_font_size = parseFloat(ths_font_size) / 0.8;
					$(this).css('font-size', ths_font_size * 1.2 + 'px');
				})
			}
			cur_resize = 3;
		}

		if ((window.innerWidth > 1000) && ($('body').hasClass('iHidden') == false)) {
			$('.press_center .press_wrap .wrap_1').css('height', $('.press_center .press_wrap').height());
		} else {
			$('.press_center .press_wrap .wrap_1').css('height', 'auto');
		}
	})*/

	/*$('.zagruz_more').bind('click', function (e) {


	})*/

	$('.press_center .press_wrap .big_item .vid .poster').click(function () {
		$(this).fadeOut();
		$("#pres_vid")[0].src += "?rel=0&amp;autoplay=1";
	})

	if ((device.mobile() == true) || (device.tablet() == true)) {
		$('body').addClass('anons_mob_on');

		$('.under_map_it').click(function (event) {
			if (!$(this).hasClass('active')) {
				event.preventDefault();
				var th_dat = $(this).data('mapars');
				var th_dat2 = $(this).data('zones');
				$('.map_content_default').hide();
				$('.proj_map .under_map_it').removeClass('active');
				$(this).addClass('active');
				$('.proj_map .map_zone').removeClass('active');
				$('.map_zone[data-mpzone="' + th_dat2 + '"]').addClass('active');
				$('.proj_map_content .map_content').removeClass('active');
				$('.proj_map_content .map_content[data-map_content="' + th_dat + '"]').addClass('active');
			}
		})

		$('.map_ar').hover(function () {
			var th_dat = $(this).data('mapar');
			$('.proj_map .map_zone').removeClass('active');
			$('.under_map_it').removeClass('active');
			$('.map_zone[data-mpzone="' + th_dat + '"]').addClass('active');
		});

	} else {
		$('.map_ar').hover(function () {
			var th_dat = $(this).data('mapar');
			$('.proj_map .map_zone').removeClass('active');
			$('.map_zone[data-mpzone="' + th_dat + '"]').addClass('active');
		}, function () {
			$('.proj_map .map_zone').removeClass('active');
			$('.proj_map .under_map_it').removeClass('active');
			$('.proj_map_content .map_content').removeClass('active');

			$('.proj_map .map_zone.first_active').addClass('active');
			$('.proj_map .under_map_it.first_active').addClass('active');
			$('.proj_map_content .map_content.first_active').addClass('active');
		});

		$('.under_map_it').hover(function () {
			var th_dat = $(this).data('mapars');
			var th_dat2 = $(this).data('zones');
			$('.map_content_default').hide();

			$('.proj_map .under_map_it').removeClass('active');
			$(this).addClass('active');
			$('.proj_map .map_zone').removeClass('active');
			$('.map_zone[data-mpzone="' + th_dat2 + '"]').addClass('active');
			$('.proj_map_content .map_content').removeClass('active');
			$('.proj_map_content .map_content[data-map_content="' + th_dat + '"]').addClass('active');
		}, function () {
			$('.proj_map .map_zone').removeClass('active');
			$('.proj_map .under_map_it').removeClass('active');
			$('.proj_map_content .map_content').removeClass('active');

			$('.proj_map .map_zone.first_active').addClass('active');
			$('.proj_map .under_map_it.first_active').addClass('active');
			$('.proj_map_content .map_content.first_active').addClass('active');

			$('.map_content_default').show();
		})
	}

	$('.search_lupa').click(function () {
		$('.search_bl').addClass('active');
		$('.ser_open').show();
		$('.ser_open input').focus();
		$('body').addClass('ser_opne');
	})

	$(document).mouseup(function (e) {
		var container = $('.ser_open');
		if (container.has(e.target).length === 0) {
			$('.search_bl').removeClass('active');
			$('.ser_open').hide();
			$('body').removeClass('ser_opne');
		}
	});
	$('.company_control .item').click(function (event) {
		if ($(this).parent().hasClass('companyAbout') == false) {
			event.preventDefault();
			$('.company_control .item').removeClass('active');
			$(this).addClass('active');
			var ths_data = $(this).data('co_ind');
			$('.company_content').hide();
			$('.company_content[data-co_indx="' + ths_data + '"]').fadeIn();
		}
	})

	var index_prev = 1;
	var clicked_index;
	$('.project_control .item').click(function (event) {
		event.preventDefault();

		clicked_index = $(this).data('pr_ind');

		if (index_prev == clicked_index) {
			return false;
		} else {
			index_prev = clicked_index;

			$('.project_content.active .project_carousel').slick('unslick');
			$('.project_content.active .project_slide_content').slick('unslick');

			$('.project_control .item').removeClass('active');
			$(this).addClass('active');
			var ths_data = $(this).data('pr_ind');
			$('.project_content').hide().removeClass('active');
			$('.project_content .project_slide_content').removeClass('activatedSlider');
			$('.project_content .project_carousel').removeClass('activatedSlider');



			$('.project_content[data-pr_indx="' + ths_data + '"]').fadeIn().addClass('active');
			$('.project_content.active .project_carousel:not(.activatedSlider)').slick({
				infinite: true,
				slidesToShow: 1,
				slidesToScroll: 1,
				speed: 700,
				centerMode: true,
				arrows: false,
				dots: false,
				asNavFor: '.project_content.active .project_slide_content',
				variableWidth: true,
				responsive: [{
					breakpoint: 1200,
					settings: {
						slidesToShow: 1,
						slidesToScroll: 1
					}
				}]
			}).addClass("activatedSlider");

			$('.project_content.active .project_slide_content:not(.activatedSlider)').slick({
				infinite: true,
				slidesToShow: 1,
				slidesToScroll: 1,
				asNavFor: '.project_carousel',
				fade: true,
				cssEase: 'linear',
				arrows: false,
				dots: false
			}).addClass("activatedSlider");;

			$('.project_carousel').slick('setPosition', 0);
			$('.project_carousel').slick('slickGoTo', 0, true);
		}
	})

	$('.project_content.active .project_carousel').slick({
		autoplay: true,
		autoplaySpeed: 2000,
		infinite: true,
		slidesToShow: 1,
		slidesToScroll: 1,
		speed: 700,
		arrows: false,
		dots: false,
		centerMode: true,
		asNavFor: '.project_content.active .project_slide_content',
		variableWidth: true,
		responsive: [{
			breakpoint: 1200,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1
			}
		}]
	});

	var slick_enable = 0;
	setInterval(function () {
		if ($('html').hasClass('fancybox-enabled')) {
			$('.project_content.active .project_carousel').slick('slickPause');
			slick_enable = 1;
		} else {
			if (slick_enable == 1) {
				setTimeout(function () {
					$('.project_content.active .project_carousel').slick('slickPlay');
					slick_enable = 0;
				}, 1000)
			}
		}
	}, 1);



	$('.project_content.active .project_slide_content').slick({
		infinite: true,
		slidesToShow: 1,
		slidesToScroll: 1,
		asNavFor: '.project_carousel',
		fade: true,
		cssEase: 'linear',
		arrows: false,
		dots: false
	});

	$('.gall_prev').click(function () {
		$('.project_content.active .project_carousel').slick('slickPrev');
	})
	$('.gall_next').click(function () {
		$('.project_content.active .project_carousel').slick('slickNext');
	})

	setTimeout(function () {
		$('#map_canvas').animate({
			opacity: 1
		}, 500);
	}, 500)

	$('.js-popup').magnificPopup({
		type: 'inline',
		midClick: true,
		showCloseBtn: false,
		removalDelay: 300,
		mainClass: 'mfp-fade',
		fixedContentPos: false,
		fixedBgPos: false,
		autoFocusLast: false,
		closeOnBgClick: true
	});

	$('.js-popup-news').magnificPopup({
		type: 'inline',
		midClick: true,
		showCloseBtn: true,
		removalDelay: 300,
		mainClass: 'mfp-fade',
		fixedContentPos: true,
		fixedBgPos: true,
		autoFocusLast: false,
		closeOnBgClick: true
	});

	$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
		disableOn: 700,
		type: 'iframe',
		mainClass: 'mfp-fade',
		removalDelay: 160,
		preloader: false,
		fixedContentPos: false
	});

	$('.js-gallery').magnificPopup({
		delegate: 'a',
		type: 'image',
		closeOnContentClick: true,
		removalDelay: 300,
		mainClass: 'mfp-fade mfp-img-mobile',
		type: 'image',
		gallery:{
			enabled:true
		},
		image: {
			verticalFit: true
		}
	});


	$('.gallery-link').on('click', function () {
		$(this).next().magnificPopup('open');
	});

	$('.js-image').magnificPopup({
		type: 'image',
		closeOnContentClick: true,
		removalDelay: 300,
		mainClass: 'mfp-fade mfp-img-mobile',
		image: {
			verticalFit: true
		}
	});

	var mfpOption = {
		type: 'inline',
		midClick: true,
		showCloseBtn: false,
		removalDelay: 300,
		mainClass: 'mfp-fade',
		fixedContentPos: false,
		fixedBgPos: false,
		autoFocusLast: false,
		closeOnBgClick: true
	}

	$('.close_modal').on('click', function () {
		$.magnificPopup.close();
	});

	$('.burger_menu').click(function () {
		if ($('.hid_menu').hasClass('active') == false) {
			$('.hid_menu').addClass('active');
			$('.hid_menu').animate({
				"left": "0px"
			}, 300);
			$('.overlay2').show();
		} else {
			$('.hid_menu').removeClass('active');
			$('.hid_menu').animate({
				"left": "-300px"
			}, 300);
			$('.overlay2').hide();
		}
	})
	$('.hid_menu .burger').bind("click touchstart", function () {
		$('.hid_menu').removeClass('active');
		$('.hid_menu').animate({
			"left": "-300px"
		}, 300);
		$('.overlay2').hide();
	})
	$('.overlay2').bind("click", function () {
		$('.hid_menu').removeClass('active');
		$('.hid_menu').animate({
			"left": "-300px"
		}, 300);
		$('.overlay2').hide();
	})

	$(window).resize(function () {
		if ($(window).width() > 849) {
			$('.hid_menu').removeClass('active').animate({
				"left": "-300px"
			}, 0);;
		}
	})

	var touch = 'ontouchstart' in document.documentElement ||
		navigator.maxTouchPoints > 0 ||
		navigator.msMaxTouchPoints > 0;

	if (touch) { // remove all :hover stylesheets
		try { // prevent exception on browsers not supporting DOM styleSheets properly
			for (var si in document.styleSheets) {
				var styleSheet = document.styleSheets[si];
				if (!styleSheet.rules) continue;

				for (var ri = styleSheet.rules.length - 1; ri >= 0; ri--) {
					if (!styleSheet.rules[ri].selectorText) continue;

					if (styleSheet.rules[ri].selectorText.match(':hover')) {
						styleSheet.deleteRule(ri);
					}
				}
			}
		} catch (ex) {}
	}

	$('.select_input').select2({
		minimumResultsForSearch: Infinity
	});
	$('.main_select').select2({
		minimumResultsForSearch: Infinity
	});
	$('.branch_select').select2({
		minimumResultsForSearch: Infinity
	});

	$('.form-select').select2({
		minimumResultsForSearch: Infinity,
		placeholder: $('.form-select').attr('placeholder')
	});

	$('.anons_mob_on .main-block-link').on('click', function () {
		if (!$(this).hasClass('selected')) {
			$('.main-block-link').removeClass('selected');
			$(this).addClass('selected');

			return false;
		}
	});

	/* MAIN SLIDER */
	$('.hero-carousel-bg').on('init', function (event, slick) {
		$('.hero-carousel-bg .slick-current').addClass('hero-current');
	});

	$('.hero-carousel-bg').slick({
		infinite: true,
		arrows: false,
		fade: true,
		speed: 1500,
		pauseOnFocus: false,
		pauseOnHover: false,
		asNavFor: '.hero-carousel-content',
		waitForAnimate: false
	});

	$('.hero-carousel-content').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
		$('.hero-carousel-bg .hero-carousel-item').eq(currentSlide).removeClass('hero-current').addClass('hero-prev');
		$('.hero-carousel-bg .hero-carousel-item').eq(nextSlide).addClass('hero-current');
	});

	$('.hero-carousel-content').on('init', function (event, slick) {
		$('.hero-carousel-count').text(slick.slideCount);
		$('.hero-carousel-primary').addClass('hero-visible');
	});

	$('.hero-carousel-content').slick({
		infinite: true,
		arrows: true,
		autoplay: true,
		autoplaySpeed: 7000,
		fade: true,
		speed: 400,
		pauseOnFocus: false,
		pauseOnHover: false,
		asNavFor: '.hero-carousel-bg',
		prevArrow: '.hero-carousel-prev',
		nextArrow: '.hero-carousel-next',
		waitForAnimate: false
	});

	$('.hero-carousel-content').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
		$('.hero-carousel-current').text(nextSlide + 1);
	});

	$('.accordion-title').on('click', function () {
		$(this).closest('.accordion-item').toggleClass('opened');
	});

	/* LIMITED
	-------------------*/
	function updatePvSession($class) {
		if (typeof BX != 'undefined') {
			$.ajax({
				'url': '/local/ajax/pv_session.php',
				'data': {'class': $class, 'sessid': BX.bitrix_sessid()},
				'method': 'POST',
			})
		}
	}
	function prepareLogicElementsByBC() {

		if(location.pathname == '/projects/')
		{
            history.pushState('', document.title, 'list/');
		}

	}

	function sliderMain() {
		if ($('html').hasClass('pv-active-size_medium') || $('html').hasClass('pv-active-size_large')) {
			$('.hero-carousel').css({minHeight : window.innerHeight - 110});

			// $(window).on('resize', function () {
			// 	$('.hero-carousel').css({minHeight : window.innerHeight - 110});
			// });
		} else if ($('html').hasClass('pv-active-size_normal')) {
			$('.hero-carousel').css({height : window.innerHeight - 110});

			// $(window).on('resize', function () {
			// 	$('.hero-carousel').css({height : window.innerHeight - 110});
			// });
		} else if (!$('html').hasClass('pv-opened')) {
			// $('.hero-carousel').height(window.innerHeight);
			
			// $(window).on('resize', function () {
			// 	$('.hero-carousel').height(window.innerHeight);
			// });
		}

		$('.hero-carousel-content').slick('reinit');
		$('.hero-carousel-bg').slick('reinit'); 
	}

	$(window).on('resize', function() {
		sliderMain();
	});

	var $pv = {
		init: function () {
			var $this = this;
	
			if ($('html').hasClass('pv-opened')) {
				$this.setClassesToActiveTogglers();

				sliderMain();
			}
	
			$('.pv-button').on('click', function () {
				if ($('html').hasClass('pv-opened')) {
					$('html').removeClass('pv-opened');
					$this.removeBodyClasses();

					$('.text_logo').attr('src', '/img/logo_nadpis.png');

					if ($('html').hasClass('pv-active-color_blackwhite')) {
						$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bw.png');
					} else if ($('html').hasClass('pv-active-color_blue')) {
						$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bl.png');
					} else {
						$('.pfcc_button img').attr('src', '/img/pfcc_arrow.png');
					}

					sliderMain();
					updatePvSession($('html').attr('class'));
				} else {
					$('html').addClass('pv-opened');
					$this.setClassesToActiveTogglers();
					$this.setBodyClasses();
                    prepareLogicElementsByBC();
				}


				
				return false;
			});
		
			$('.pv-toggler').on('click', function () {
				$pv.setClassesToActiveTogglers();
				$pv.removeBodyClasses();
				$pv.setBodyClasses();
			});

			if ($('.wrap-wraper').hasClass('main_page')) {
				if ($('html').hasClass('pv-active-color_blackwhite')) {
					$('.text_logo').attr('src', '/img/logo_nadpis2.png');
				}
			}
			
			if ($('html').hasClass('pv-active-color_blackwhite')) {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bw.png');
			} else if ($('html').hasClass('pv-active-color_blue')) {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bl.png');
			} else {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow.png');
			}
		},
	
		setClassesToActiveTogglers: function () {
			$('.pv-toggler').each(function () {
				$(this).removeClass('pv-toggler_active');
	
				if ($(this).find('input').is(':checked')) {
					$(this).addClass('pv-toggler_active');
				}
			});

			if ( $('.pv-toggler-type-image').hasClass('pv-toggler_active') ) {
				$('.pv-toggler-type-image').find('label').each(function() {
					$(this).html($(this).data('return'));
				});
			} else {
				$('.pv-toggler-type-image').find('label').each(function() {
					$(this).html($(this).data('remove'));
				});
			}
		},
	
		setBodyClasses: function () {
			$('.pv-opened .pv-toggler_active').each(function () {
				var name = $(this).find('input, select').attr('name');
				var value = $(this).find('input, select').val();
	
				$('html').addClass('pv-active-' + name);
				$('html').addClass('pv-active-' + name + '_' + value);
			});

			sliderMain();
	
			updatePvSession($('html').attr('class'));

			if ($('.wrap-wraper').hasClass('main_page')) {
				if ($('html').hasClass('pv-active-color_blackwhite')) {
					$('.text_logo').attr('src', '/img/logo_nadpis2.png');
				} else {
					$('.text_logo').attr('src', '/img/logo_nadpis.png');
				}
			}

			if ($('html').hasClass('pv-active-color_blackwhite')) {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bw.png');
			} else if ($('html').hasClass('pv-active-color_blue')) {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow_bl.png');
			} else {
				$('.pfcc_button img').attr('src', '/img/pfcc_arrow.png');
			}
			
		},
	
		removeBodyClasses: function () {
			$('html').removeClass(function (index, css) {
				return (css.match(/\pv-active\S+/g) || []).join(' ');
			});
		}
	};
	
	if (window.innerWidth < 1371) {
		$pv.removeBodyClasses();
		$('html').removeClass('pv-opened');
		sliderMain();
	
	 	updatePvSession($('html').attr('class'));
	}
	

	$pv.init();

	$(window).on('load', function() {
		sliderMain();

		var currentWidth = window.innerWidth;
		var currentHeight = window.innerWidth;
		var lastWidth = currentWidth;
		var lastHeight = currentHeight;

		$(window).on('resize', function() {
			currentWidth = window.innerWidth;
			currentHeight = window.innerHeight;
	
			if (window.innerWidth < 1371) {
				$pv.removeBodyClasses();
				$('html').removeClass('pv-opened');
	
				if (lastWidth > currentWidth || lastWidth < currentWidth) {	
					sliderMain();
				}
	
				updatePvSession($('html').attr('class'));
			}
			
			lastWidth = currentWidth;
			lastHeight = currentHeight;
		});
	});
	
	$('.form-select').on('change', function() {
		if ($(this).val() == 'Другое') {

			setTimeout(function() {
				$('textarea[name="form_textarea_28"]').focus();
			}, 100)
		}
	});

	$(document).on('change', '.form-file input[type="file"]', function () {
		var value = $(this).val();
		var $label = $(this).closest('.form-file').find('strong');
		//var label = $label.data() || 'Выберите файл';

		if (value) {
		  value = value.split(/(\\|\/)/g).pop();
		  $label.html(value+' <i class="js-delete-file-form">x</i>');
		} else {
		  $label.text('');
		}
	});

	$(document).on('click', '.form-file .js-delete-file-form', function (e) {
		$('.form-file input[type="file"]').val('');
        $('.form-file strong').empty();
    });

	$(document).on('click', '.personal-text-drawdown', function() {
		$(this).addClass('visible');
	});

	$('.persons-holder').on('mouseleave', function() {
		$(this).find('.personal-text-drawdown').removeClass('visible');
	});

	if ($(window).width() <= 600) {
		
		if ($('.company_control.companyAbout').length) {
			var top = parseInt($('.company_control.companyAbout').offset().top) + $('.company_control.companyAbout').height();

			$('html, body').stop().animate({scrollTop: top}, 500);
			$(document).scrollTop(top);
		}
	}

	// $(window).on('resize', function() {
	// 	console.log(window.innerHeight);
	// });

	(function() {
		var magnificPopup = $.magnificPopup.instance;
	
		$('.gallery-link').click(function(e) {

			setTimeout(function() {
					$('.mfp-container').swipe( {
						swipeLeft:function(event, direction, distance, duration, fingerCount) {
							magnificPopup.next();
						},

						swipeRight:function(event, direction, distance, duration, fingerCount) {
							magnificPopup.prev();
						},
					});
			}, 500);
		});
	
	}).call(this);
});

$(function () {
	var limited_fix = setInterval(function () {
		if ($('body').hasClass('limited__version')) {
			$('.tools').find('li.cur').each(function () {
				$(this).click();
			});
			clearInterval(limited_fix);
		} else {}
	}, 1);
});

$('.news-detail table').wrap('<div class="table_wrap"></div>');

$(function() {
	$('.js-sponsor-news').click(function() {
		var data = {
			'iblockId': $(this).attr('data-iblockId'),
			'elementId': $(this).attr('data-elementId'),
		};
		var $view = $(this).find('.sponsor-article-view');
		$.ajax({
			'method' : 'POST',
			'url': '/local/ajax/update_element_views.php',
			'data': data,
			'success': function(returned) {
				$view.html(returned);
			}
		})
	});
});

// $(document).ready(function() {
// 	var desktopsnow;
// 	var mobilesnow;


// 	function snowAdd() {
// 		if (window.innerWidth > 767) {
// 			// mobilesnow = null;
// 			$('.showflake').remove();

// 			desktopsnow = $("#body").jSnow({
// 				vSize: window.innerHeight, // Размер области
// 				flakes: 150, // Количество снежинок
// 				flakeColor: ["#fff"], // Цвет
// 				flakeMinSize: 0, // Минимальный размер снежинки
// 				flakeMaxSize: 0, // Максимальный размер снежинки
// 				fallingSpeedMin: 2, // Минимальная скорость снежинки
// 				fallingSpeedMax: 3, // Максимальная скорость снежинки
// 				flakeCode:["/img/snowflake_2.png"] // Вид снежинки
// 			});
// 		} else {
// 			// desktopsnow = null;
// 			$('.showflake').remove();

// 			mobilesnow = $("#body").jSnow({
// 				vSize: window.innerHeight, // Размер области
// 				flakes: 50, // Количество снежинок
// 				flakeColor: ["#fff"], // Цвет
// 				flakeMinSize: 0, // Минимальный размер снежинки
// 				flakeMaxSize: 0, // Максимальный размер снежинки
// 				fallingSpeedMin: 2, // Минимальная скорость снежинки
// 				fallingSpeedMax: 3, // Максимальная скорость снежинки
// 				flakeCode:["/img/snowflake_3.png"] // Вид снежинки
// 			});
// 		}
// 	}

// 	snowAdd();

// 	// $(window).on('resize', function() {
// 	// 	snowAdd();
// 	// });
// });



// var hellopreloader = document.getElementById("hellopreloader_preload");function fadeOutnojquery(el){el.style.opacity = 1;var interhellopreloader = setInterval(function(){el.style.opacity = el.style.opacity - 0.05;if (el.style.opacity <=0.05){ clearInterval(interhellopreloader);hellopreloader.style.display = "none";}},16);}window.onload = function(){setTimeout(function(){fadeOutnojquery(hellopreloader);},1000);};