function ajax_basket(obj, q) {
	//alert("/bitrix/templates/index/ajax_basket.php?"+$(obj).attr("href").substr($(obj).attr("href").indexOf("?")+1)+"&q="+quantity);
	$.ajax({
		async: true,
		type: "POST",
		url: "/bitrix/templates/index/ajax.basket.php?" + $(obj).attr("href").substr($(obj).attr("href").indexOf("?")+1)+"&q="+q,
		data: "",
		beforeSend: function() {
			$(obj).hide();
			$(obj).parent().find('.b_process').show();
			$(obj).parent().find('.b_result').hide();
		},
		success: function(msg) {
			//alert(msg);
			$(obj).show();
			$(obj).parent().find('.b_process').hide();
			$(obj).parent().find('.b_result').show();
			$("a.basket > div").html(msg);
		}
	});

	return false;
}

$(document).ready(function() {
						   
	$("a[href*=ADD2BASKET]").unbind('click').click(function(){
		obj = this;
		q = parseInt($(obj).parent().parent().find("input.quantity").val());
		//alert(q);
		ajax_basket(obj, q);
		return false;
	});

})