function cmfBasketDelete(id, type) 
{
	return cmfAjaxSend(cmfBaseUrl + '/mainAjax/basket/delete.php', {id: id, type: type});
}

SABUY=[];
function cmfBasketAdd(id,link,type) 
{
	if (link)
	{
		SABUY.push(link.nextSibling);
		link.nextSibling.style.display='block';
		setTimeout('SABUY.splice(0,1)[0].style.display="none"',1000);
	}

	if(!type)
	{
		type = null;
	}
	return cmfAjaxSend(cmfBaseUrl + '/mainAjax/basket/add.php', {id: id, type: type});
}

function cmfBasket() 
{
	var count = cmfGetCookie('main_basket_count');
	var price = cmfGetCookie('main_basket_price');
	cmfBasketHeader(count, price);
}

function cmfBasketHeader(count, price) 
{
	var html = '';
	while (price && price.match(/^\d\d{3}/))
	{
		price = price.replace(/(\d)(\d{3}(([., ])|($)|(&nbsp;)))/, '$1&nbsp;$2');
	}
	if(count) 
	{		
		html += '<div class="tit">Корзина</div><div class="volue_tovars">Товаров в корзине: <a href="/basket/">'+count+'&nbsp;шт.</a></div><div class="volue_price">На сумму: <a href="/basket/">'+price+'&nbsp;руб.</a></div><div class="add_basket_h"><a href="/basket/">оформить заказ</a></div>';
		html += '';				
	} 
	else 
	{		
		html += '<div class="tit">Корзина</div>';
		html += '';
	}
	
	$('#basket1').html(html);
}

function cmfBasketIsOrder() 
{
	cmfSetValue('isOrder', 1);
}


