$(document).ready(function()
{
	
//banners	
	
$('.bann').hover(function()
{
   var temp = $(this).attr('src');
   $(this).attr( { src: $(this).attr('more'), more: temp } ).css({left: (parseInt($(this).position().left) - 110), top: (parseInt($(this).position().top) - 65), zIndex: 10, width: '224px', height: '156px'});
   $(this).css({position: 'absolute'});
}, function()
{
   var temp = $(this).attr('src');
   $(this).removeAttr('style').attr( { src: $(this).attr('more'), more: temp } );
});       
	
//end_banners	
	
	
	$('.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();
	});
	
     // ???????? ????? ????????
     $('.table tr').hover(function()
     {
          $(this).css({background:'#ffffff'});
     }, function()
     {
          $(this).css({background:'#cecccc'});
     });	
	 
	 
	 //??????????
$('.imgcenter').click(function()
{
     $('.tn_img_preview').remove();
     $('body').append('<img src="'+$(this).parent().attr('href')+'" width="700" height="600" class="tn_img_preview" />');

     $('.tn_img_preview').css(
     {
          position:'absolute',
          zIndex : '1999',
          left: (($(window).width() - $('.tn_img_preview').width()) / 2),
          top: (($(window).height() - $('.tn_img_preview').height()) / 2 + $(document).scrollTop())
     }).click(function()
     {
          $('.tn_img_preview').remove();
     });
     return false;
});

    $('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;
	});
});
