$(document).ready(function(){
		
		// main page - spoilers 
		$('.groups_on_main td:has(div)').css('width', '24%')
		/*
		$('.blue_ul li:has(div)').children('a').click(function(event) {
 			 //event.preventDefault();
			 $(this).next('div').toggle();
			 }
		)
		*/
		$('.shown').show()
		
		
	//cufon смена некрасивых заголовков на красивые
	Cufon.replace(['.myriad'],{hover:true}, { fontFamily: 'Myriad Pro' });				   
		//opera gradients					   
		if($.browser.opera){
			$(".search_field").css("background", "#73c436 url(pic/search_field.png) repeat-x top");
		}
						   
    $(".lightbox").lightBox();
	$('#sub_table td').hover( function(){
				var td_width = $(this).width() + 41;						   
				$('.sub_menu').hide();
				$(this).find('.sub_menu').show().css('width', td_width + 'px');
				$(this).find('.sub').show();
				$(this).find('.trig').css('background-position','bottom');
				
					
		}, function(){
				$('.sub_menu').hide().css('margin-left','0' );
				$(this).find('.trig').css('background-position','top');
			}
		);
		
				$('.spisok1 li').hover( function(){
				$(this).children('.spisok2').show();
				var sub_menu_width = $(this).parent('.spisok1').parent('.sub').width();
				
				//уравниваем высоту
				var height1=$(this).parent('.spisok1').parent('.sub').height();
				var height2=$(this).children('.spisok2').height();
				var height3 = Math.max(height1, height2);
				$(this).parent('.spisok1').parent('.sub').parent('.sub_menu').css('width', sub_menu_width + 250 +'px').css('height', height3 +'px').css('margin-left','0 px');
				$(this).children('.spisok2').css('height', height3 + 'px');
				
				//делаем оступ
				
				var shirina =  $('#menublock').width();
				var left_otstup = $(this).parent('.spisok1').parent('.sub').parent('.sub_menu').offset().left;
				var shirina_menu = $(this).parent('.spisok1').parent('.sub').parent('.sub_menu').width();
				
				var new_otstup = shirina_menu + left_otstup - shirina -40;
				if (new_otstup > 0){
					$(this).parent('.spisok1').parent('.sub').parent('.sub_menu').css('margin-left','-' +new_otstup  + 'px' );
					return false;
				}
				
				
				
			}, function(){
				$(this).children('.spisok2').hide();
				//$(this).parent('.spisok1').parent('.sub').parent('.sub_menu').css('width', sub_menu_width - 220 + 'px');
			}
		);
		
		

	var my_new_width = $('.adress_line').width();					   
	$('.content').css('width', my_new_width +'px');
	$('table.spisok_tovarov').css('width', my_new_width -10 +'px')
	$('table.spisok_tovarov table').css('width', my_new_width -11 +'px')

	//alert($('table.spisok_tovarov th:last-child').width());
	$('table.spisok_tovarov table th:last-child').prev().css('width', $('table.spisok_tovarov th:last-child').width())
	$('table.spisok_tovarov table th:last-child').css('width', $('table.spisok_tovarov th:last-child').prev().width())
	$('table.spisok_tovarov table th:last-child').prev().prev().css('width', $('table.spisok_tovarov th:last-child').prev().prev().width())
	$('table.spisok_tovarov table th:last-child').prev().prev().prev().css('width', $('table.spisok_tovarov th:last-child').prev().prev().prev().width())
	$('table.spisok_tovarov table th:last-child').prev().prev().prev().prev().css('width', $('table.spisok_tovarov th:last-child').prev().prev().prev().prev().width())
	
	$('table.spisok_tovarov table th:first-child').css('width', $('table.spisok_tovarov th:first-child').width());
	$('table.spisok_tovarov table th:first-child').next().css('width', $('table.spisok_tovarov th:first-child').next().width());


	var my_new_width2 = $('.spisok_tovarov').width();
	$('.long').css('width', my_new_width2  +'px');

	//dropdown megamenu
	

		
		

		


		//table with tovar's information spoilers
			$('.spisok_tovarov tr th:last-child').css('border-right','none');
			$('.spisok_tovarov tr td:last-child').css('border-right','none');
		
			//$('tr.opisanie').hide();

			
			$('.spisok_tovarov tr .show_descr').toggle( 
					function () {
						$(this).parent().addClass('active');
						$(this).parent().next('tr.opisanie').show();
					}, function(){
						$(this).parent().removeClass('active')
						$(this).parent().next('tr.opisanie').hide();
					}
			);
			
			$('.show_packing').toggle( 
					function () {
						$(this).parent().addClass('active');
						$(this).parent().parent().next().next().show();
					}, function(){
						$(this).parent().removeClass('active')
						$(this).parent().parent().next().next().hide();
					}
			);

		
	
});//end ready


$(document).ready(function(){
						   
		$('.interest_link').each( function(){
			var interest_height = $(this).height();
			if (interest_height < 18){$(this).css('padding-top','8px')}
	})			
						   
						   
	$('.answer_head:first').css('margin', '0');
	$('.answer_head').css('width', $('.adress_line').width() +'px')
	$('.answer_body').hide();
	$('.answer_head').toggle(
		function () {
			$(this).children(".slider_pic").css("background-position", "bottom");
			$(this).next('.answer_body').show();
		},
		function () {
			$(this).children(".slider_pic").css("background-position", "top");
			$(this).next('.answer_body').hide();
		}
	)
});



