	
	var win = null;
	function MM_openBrWindow(mypage,myname,w,h,scroll){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings =
		'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
		win = window.open(mypage,myname,settings)
	}
	
	function get(targetPath, targetContainer, targetWait) {
		if (targetWait) {
			$('#blockLoaderDiv').fadeIn();
		}
		$.ajax({
			url: targetPath,
			success: function(data) {
				$(targetContainer).html(data);
			},
			complete: function(xhr){
				if (targetWait) {
					$('#blockLoaderDiv').fadeOut();
				}
			}
		});
	}
	
	function post(targetPath, targetForm, targetContainer, targetWait) {
		if (targetWait) {
			$('#blockLoaderDiv').fadeIn();
		}
		$.ajax({
		    type: "POST",
		    url: targetPath,
		    data: $(targetForm).serialize(),
		    success: function(data) {
		        $(targetContainer).html(data);
		    },
		    complete: function(xhr){
				if (targetWait) {
					$('#blockLoaderDiv').fadeOut();
				}
		    }
		});
	}
	
	function closeDialogBox() {
		$('#blockTableDiv').fadeOut('fast');
		if ($('#targetField').val()) {
			$($('#targetField').val()).focus();
		}
	}
	
	function openDialogBox(targetDiv_1, targetDiv_2, targetField) {
		$('#targetField').val('');
		$('#blockTableDiv').fadeIn('fast');
		$('#dialogTitle').html(targetDiv_1)
		$('#dialogContent').html(targetDiv_2)
		if (targetField) {
			$('#targetField').val(targetField);
		}
	}
	
	function resizeBoxes() {
		if ($('#blockDiv').length) {
			$('#blockDiv').css('height', document.body.clientHeight+'px');
			$('#blockTable').css('height', document.body.clientHeight+'px');
			$('#blockTableDiv').css('height', document.body.clientHeight+'px');
		}
	}
	
	$(window).scroll(function() {
		if ($('#header .resize').length) {
			var scroll = $(window).scrollTop()
			if (scroll > 140) {
				$('#header').addClass('min');
				$('#header .nav').addClass('min');
				$('.yttcat-btn').hide(100);
			} else {
				$('#header').removeClass('min');
				$('#header .nav').removeClass('min');
				$('.yttcat-btn').show(100);
			}
		}
	});
	
	window.onresize = resize;
	function resize() {
		resizeBoxes();
	}
	
	$(document).ready(function(){
		resize();
		
		if ($('.main-slider').length) {
			slider = $('.main-slider').bxSlider({
				mode		: 'horizontal',
				minSlides	: 1,
				maxSlides	: 1,
				moveSlides	: 1,
				slideMargin	: 0,
				infiniteLoop  : false,
				pager		: true,
				auto		: false,
				autoHover	: false,
				pause		: 5000,
				speed		: 250,
				prevSelector	: '.ms-prev',
				nextSelector	: '.ms-next',
				pagerCustom	: '.ms-pager'
			});
			$('.ms-prev,.ms-next').hide();
		}
		
		if ($('.history-slider').length) {
			if (document.body.clientWidth <= 768) {
				slideWidB  = 340;
				slideMarB  = 0;
				minMaxValB = 1;
			} else {
				slideWidB  = (document.body.clientWidth)/3;
				slideMarB  = 0;
				minMaxValB = 3;
			}
			
			slider = $('.history-slider').bxSlider({
				mode		: 'horizontal',
				slideWidth	: slideWidB,
				slideHeight	: 400,
				minSlides	: minMaxValB,
				maxSlides	: minMaxValB,
				moveSlides	: 1,
				slideMargin	: slideMarB,
				infiniteLoop  : false,
				pager		: false,
				auto		: false,
				autoHover	: false,
				pause		: 5000,
				speed		: 250,
				prevSelector	: '.hs-prev',
				nextSelector	: '.hs-next',
				prevText	: '<img src="images/icon_sliderArrow_1Invert.png" border="0" width="16" alt="" style="display:block;" />', 
				nextText	: '<img src="images/icon_sliderArrow_2Invert.png" border="0" width="16" alt="" style="display:block;" />'
			});
		}
		
		$("a").on('click', function(event) {
			if (this.hash !== "") {
				event.preventDefault();
				var hash = this.hash;
				if ($(hash).length) {
					$('html, body').animate({
						scrollTop: ($(hash).offset().top-120)
					}, 800, function(){
						window.location.hash = hash;
						$('html, body').animate({
							scrollTop: ($(hash).offset().top-120)
						}, 0);
					});
				} else {
					window.location.href=$(this).attr('href');
				}
			}
		});
		
		if (window.location.href.indexOf('#') > 0) {
			setTimeout(function(){
				var hash = window.location.href;
				hash = hash.split("#");
				hash = "#"+hash[1];
				$('html, body').animate({
					scrollTop: ($(hash).offset().top-120)
				}, 0);
			}, 0);
		}
		
		if ($('.fancybox').length) {
			$('.fancybox').fancybox();
			$(".various").fancybox({
				fitToView   : true,
				autoSize    : true
			});
		}
	});
	