/**
 * Decreases the levels of an item in the shopping basket by 1.
 * @param itemsForm The form containing the field.
 * @param fieldName The name of the field containing the quantity for the item.
 */
function decreaseItemLevel(itemsForm, fieldName) {
	var itemsField = itemsForm.elements[fieldName];
	if(!isNaN(itemsField.value)) {
		var quantity = parseInt(itemsField.value);
		if(quantity > 1 || confirm('Decreasing the quantity by one will remove the item from your basket.\n\nDo you wish to continue?')) {
			itemsField.value = quantity - 1;
		}
	}
}

/**
 * Increases the levels of an item in the shopping basket by 1.
 * @param itemsForm The form containing the field.
 * @param fieldName The name of the field containing the quantity for the item.
 */
function increaseItemLevel(itemsForm, fieldName) {
	var itemsField = itemsForm.elements[fieldName];
	if(!isNaN(itemsField.value)) {
		itemsField.value = parseInt(itemsField.value) + 1;
	}
}

/**
 * Removes the item from the shopping basket.
 * @param itemsForm The form containing the field.
 * @param fieldName The name of the field containing the quantity for the item.
 */
function removeItem(itemsForm, fieldName) {
	if(confirm('Are you sure you wish to remove this item?')) {
		itemsForm.elements[fieldName].value = 0;
	}
}

/**
 * Sets the specified value of the voucher to be removed from the basket.
 * @param voucherForm The form containing the field.
 * @param voucherValue The value of the voucher to remove.
 */
function removeVoucher(voucherForm, voucherValue) {
	voucherForm.elements['value'].value = voucherValue;
}

/**
 * Sets the specified value of the discount to be removed from the basket.
 * @param discountForm The form containing the field.
 * @param discountCode The code for the discount to remove.
 */
function removeDiscount(discountForm, discountCode) {
	discountForm.elements['code'].value = discountCode;
}			