jQuery(document).ready(function($) {
	// Верхнее выпадающее меню
		$('.main_nav>ul>li').hover(
			function() {
				$(this).find('.subnav').show();
			},
			function() {
				$(this).find('.subnav').hide();
			}
		);
		
		$('.main_nav .subnav li:last-child').css({'border':'none', 'background':'url(/design/images/bg/subnav_bg.png) 0 100% no-repeat'});
		$('.main_nav li:nth-child(1) .subnav').css({'left':'-3px'});
		$('.main_nav li:nth-child(2) .subnav').css({'left':'-6px'});
		$('.main_nav li:nth-child(3) .subnav').css({'left':'2px'});
		$('.main_nav li:nth-child(4) .subnav').css({'left':'-4px'});
		$('.main_nav li:nth-child(5) .subnav').css({'left':'-9px'});
	// end
	
	$(window).load(function () {
		// Колонки одинаковой высоты на главной странице
			var divsHeight = $('.main .content').height();
			$('.main .content_block').css({'height':divsHeight -18}); // суммарная высота вертикальных отступов
		// end
	});
	
	// Минимальная высота главной колонки на внутренних страницах
		function mainMinHeight() {
			var sbHeight = $('.sidebar').height();
			var h2 = $('.catalog_page > h2');
			var h2H;
			if (h2.length) {
				h2H = h2.outerHeight() + parseInt(h2.css('margin-top')) + parseInt(h2.css('margin-bottom'));
			} else {
				h2H = 0;
			}
			var inWr = $('.catalog_page .inner_wrap');
			var inWrMinH = sbHeight - (h2H + (inWr.outerHeight() - inWr.height()) + parseInt(inWr.css('margin-top')) + parseInt(inWr.css('margin-bottom')));
			inWr.css({'min-height':inWrMinH});
		};
		
		$(window).load(function () {mainMinHeight();});
		$('.sidebar .nav_list a').click(function(){mainMinHeight();});
	// end
	
	// Стили таблиц
		$('.zebra').each(function(){
			$(this).find('tr:even').addClass('colored');
		});
		$('.combined th').addClass('colored');
		$('.combined thead th:first-child').css({'background':'#fff'});
		$('.combined td[rowspan]').addClass('colored');
		$('.manuals_vis tr:nth-child(odd)').css({'background':'#e9f2f5'});
	// end
	
	// Корректировка перемещения по якорям (тикет: 25544)
	$(".series_items a").click(function() {
		var objClick = $(this);
		var headHeight = $('.schedule_table_classic thead').height();
		headHeight += 3;
		var elem = $("span[id="+objClick.html()+"]").offset();
		window.scrollTo(0,elem.top-headHeight);
		return false; // Отменяем стандартное поведение браузеров
	});
	//end

		$('.schedule_table_classic').fixedtableheader();
});
