$(document).ready(function(){
	$("a[href$=jpg]").click( function(){ hs.expand(this); return false;});
	$("a[href$=gif]").click( function(){ hs.expand(this); return false;});
	$("a[href$=png]").click( function(){ hs.expand(this); return false;});
	$("a[href$=jpeg]").click( function(){ hs.expand(this); return false;});

	$("#scroll_area").jCarouselLite({
		btnNext: ".aright",
		btnPrev: ".aleft",
		visible: 1
	});

	$(".table_tech_info").find('tr:even').addClass('tr_gray');


    $('textarea[rel]').each(function(){
        $(this).text($(this).attr('rel'));
    })

});

function CheckMKAD()
{
	if (($('#km').val() == '') && ($('input[name=cond_of_delivery]:checked').val() == 3))
	{
		alert('Впишите кол-во километров');
		$('#km').focus();
		return false;
	}
	if ($('input[name=cond_of_delivery]:checked').val() == 3)
	{
		AddIntoCart('/shop/', 897, parseInt($('#km').val()));
	}
}

function ChangeKM()
{
	var km = parseInt($('#km').val());
	if (!isNaN(km))
	{
		$('#price_delivery').html(km * km_price);
		$('#price_total').html(km * km_price + parseFloat($('#price_goods').html()));
	}
}

function ProcessCompare()
{
	var query = '';
	$('input[name^=compare_id_]').each
	(
		function()
		{
			if ($(this).attr('checked'))
			{
				query += '&'+$(this).attr('name')+'=1';
			}
		}
	)
	if (query != '')
	{
		query = '/shop/?nodesign=1&add_compare=1' + query;
		$.get
		(query, function(data)
			{
				aaa = 1;
			}
		);
	}
	window.open('/compare_items/', 'displayWindow');
	return false;
}

function DeleteCompare(id)
{
	query = '/shop/?nodesign=1&delete_compare=1&del_compare_id_'+id+'=1';
		$.get
		(query, function(data)
			{
				aaa = 1;
			}
		);
	window.location = '/compare_items/';
	return false;
}

function BuySelectedTying()
{
	query = '/shop/cart/?nodesign=1&action=addmany';
	$('input[name^=item_id_add_]').each
	(
		function()
		{
			if ($(this).attr('checked'))
			{
				query += '&item_id_add_' + $(this).attr('value') + '=' + $(this).attr('value');
			}
		}
	)
	$.get
	(query, function(data)
		{
			aaa = 1;
		}
	);
	window.location = '/cart/';
	return false;
}
