$(function(){
	$('.toCart').click(function(){
		//alert(11);
		var id = $(this).attr('value');
		var count = 1;
		
		if ($(this).hasClass('c')){
			count = getObj('count').value;
		}
		//alert(count);
		if (id && count>0)
			doLoad('','/ajax/addCart/'+id+'/'+count+'/');
	});
	
/*		
	$('.minus').click(function(){
		
			var count = getObj('count').value;
			
			if (count>0){
				getObj('count').value = parseInt(count)-1;
			}
	});
	
	$('.plus').click(function(){
		var count = getObj('count').value;
		if (count=='') count=0;
			
		getObj('count').value = parseInt(count)+1;
	});
*/	
	
	$('.Incart').click(function(){
		document.location.href='/basket/';
	});
});

function diffCount(id,act){
	doLoad('','/ajax/difCart/'+id+'/'+act+'/');
}

function del(id){
	if (id>0){
		if(confirm("Удалить товар?"))
			doLoad('','/ajax/delCart/'+id+'/');
	}
}

function create_advice(title, price)
{
$('body').append('<div id="advice1" class="advice"> <div class="t">Добавлено в корзину</div><p>Товар:'+ title + '</p><p>Цена: <span>'+price+'</span></p><p><a href="#" onclick="closss();return false;">Продолжить покупки</a> <span style="margin: 0 20px;">или</span> <a href="/basket" onclick="closss();">Оформить заказ</a></p></div>');	
var wid=((parseInt(document.body.clientWidth))/5)+document.body.scrollTop;
$('#advice1').css({'margin' : wid+'px 500px'});
$('#advice1').show();		 
$('body').append('<div id="fade1"></div>');		
$('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn();
return false;	
}
function closss()
{				
$('#fade1').remove();	
$('#advice1').remove();		
$('#fade').css({'display' : 'none'});

return false;			
}
