function basketPlus(productId)
{
	var val = jQuery('#p' + productId).val();
	var qunatity = parseInt(val);

    if(qunatity > 99)
    {
        qunatity = 99;
    }

	jQuery('#p' + productId).val(qunatity + 1);

    return false;
}

function basketMinus(productId)
{
	var val = jQuery('#p' + productId).val();
	var qunatity = parseInt(val);

	if(qunatity < 1)
    {
        qunatity = 1;
    }

    jQuery('#p' + productId).val(qunatity - 1);

    return false;
}

function basketRemove(cartProductId)
{
    jQuery('#cartRow' + cartProductId).fadeOut('1000', function()
    {
        jQuery.ajax(
        {
            type: "POST",
            url: baseUrl + "/shop/shopcart/remove/id/" + cartProductId,
            success: function(response)
            {
                jQuery("#cartBox").html(response);

                jQuery('#p' + cartProductId).val('0');
            }
        });
    })

    return false;
}

function basketRefesh()
{
    jQuery.ajax(
    {
		type: "POST",
		url: baseUrl + "/shop/shopcart/box/",
		success: function(response)
        {
			jQuery("#cartBox").html(response);
		}
	});
}

function basketAdd(productId)
{

    var dataString = '';
    var quantity = jQuery('#p' + productId).val();
   
    quantity = parseInt(quantity);

    if(quantity != '0' && quantity != 0)
    {
        dataString += '&quantity=' + quantity;
    }

	jQuery.ajax(
    {
		type: "POST",
		url: baseUrl + "/shop/shopcart/add/id/" + productId,
		data: dataString,
		success: function(response)
        {
			jQuery("#cartBox").html(response);
		}
	});
	//jQuery('.' + id).html(0);

    return false;
}


