$(document).ready(function()
{
	//jQuery.ajaxSetup ({cache: false});
	$(".buy").click(function()
    {		
		var link = ($(this).attr('name'));
		var arr = link.split('|');
		
		var price = arr[0]; // Цена
		var id 	= arr[1]; // ID
		var id2 	= arr[2]; // ID2
		var kolich = $("#"+id2).val();
		
		//alert($("#kolich").val());
		
		//$('#basket').load("/includes/shoppingcart.php?" + Math.floor(Math.random()*99999));
		//$('#basket').load("/includes/shoppingcart.php");
		//$('#basket').load("/includes/shoppingcart.php");
		//alert("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		
		$(this).parent().hide();
		$(this).parent().after('<p><b>Добавлено</b>');
	/*
		 $('<div style=clear:both>добавлено</div>')
			 .insertAfter( $(this) )
			 .fadeIn('slow')
			 .animate({opacity: 1.0}, 400)
			 .fadeIn('slow', function() {
				//$(this).remove();
				$("#item" + id).html('<div style=clear:both>добавлено</div>');
		 });
		*/

		$.get("/includes/addtocart.php?rnd=" + String((new Date()).getTime()).replace(/\D/gi, ''), {id: id, price: price, kolich:kolich});
		//alert('Позиция добавлена в корзину');
		
		$('#basket').load("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		$('#basket').load("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		$('#basket').load("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		$('#basket').load("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		$('#basket').load("/includes/shoppingcart/"+Math.floor(Math.random()*99999)+".php");
		
		return false;
    });
    
});
