//function fix_size()
//{
//      if($('body').height() > $(window).height())
//$('.down').removeAttr('style').css({top: ($('body').height())});
//else
//{
//$('.down').css({bottom: 0});
//$('.center, .center_left').css({height: ($(window).height() - 200 - 28 - 45)});
//}
//}



$(document).ready(function()
{
	
//    $(window).resize(function(){fix_size();});
//    $(window).click(function(){fix_size();});
//    fix_size();
	
	$('.menu_tree li').each(function()
	{
		if($(this).children('ul').html())
		{
			$(this).children('ul').hide();
			$(this).prepend('<div class="menu_tree_plus"></div>');
		} else {
			$(this).prepend('<div class="menu_tree_blank"></div>');
		}
	});

	$('.menu_tree_plus').click(function()
	{
		if($(this).attr('class') == 'menu_tree_plus')
			$(this).removeClass('menu_tree_plus').addClass('menu_tree_minus').next().next().show();
		else
			$(this).removeClass('menu_tree_minus').addClass('menu_tree_plus').next().next().hide();
	});
	
    $('a[href="/'+curent_url+'/"]').attr({actived:'actived'});
    $('.menu_tree [actived="actived"]').addClass('menu_tree_actived').next().show(); // ??????? ???? ??.
    $('.menu_tree [actived="actived"]').prev().removeClass('menu_tree_plus').addClass('menu_tree_minus'); // ???????? ???? ?? ?????
    $('.menu_tree [actived="actived"]').parents('ul').show(); // ??????? ??? ???????????? ??????
	
	
	//if(curent_url) $('.menu_tree a[href="/'+curent_url+'/"]').addClass('menu_tree_actived').parent('li').parents('ul').show().prev().prev().removeClass('menu_tree_plus').addClass('menu_tree_minus');
	
	$('.discounts nobr a').each(function()
	{
		$(this).append('<br />'+$(this).children('img').attr('alt'));
	});
	
	$('.discounts_left, .discounts_right').click(function()
	{
		if($(this).attr('class') == 'discounts_left')
			$('.discounts').scrollTo({top:$('.discounts').scrollTop(),left:'-=400'},'slow');

		if($(this).attr('class') == 'discounts_right')
			$('.discounts').scrollTo({top:$('.discounts').scrollTop(),left:'+=400'},'slow');

		// Фиксы
		document.body.focus();
		document.onselectstart = function () { return false; };
		$(this).ondragstart = function() { return false; };
		return false;
	});
});

