/* 
    Document   : cart
    Created on : 2010-10-14, 09:15:18
    Author     : Sławomir Wierzbiński
    Description: JS file for cart.
*/


function changeAmount(operation, id) {
	amount = $('#amount_'+id).val();

	if (operation == '+') {
		amount = parseInt(amount) + 1;
		$('#amount_'+id).val(amount);
	} else if (operation == '-' && amount > 1) {
		amount = parseInt(amount) - 1;
		$('#amount_'+id).val(amount);
	}
}

function checkAmount(id) {
	amount = $('#amount_'+id).val();

	amount = isNaN(amount) || amount < 1 ? 1 : Math.floor(amount);

	$('#amount_'+id).val(amount);
}

// funkcja zaznaczająca wszystkie checkboxy
function checkAll(class_name) {
	$('.' + class_name).attr('checked', $('#' + class_name + 'All').attr('checked'));
}

