/**************************************************************
*  Purpose: Handles a change in qty field
*
*  Author: Marc Dula
*
***************************************************************
*  Revision History:
*  02/09/2004, MD, Created
**************************************************************/
function handleQtyChange(newQty, minQty, multiplier, piecePrice, resultQtyObj, resultPriceObj) {
	var nf;
	
	nf = new NumberFormat();
	nf.setNumber(newQty * multiplier);
	nf.setPlaces(0);
	nf.setCommas(true);
	nf.setCurrency(false);
	resultQtyObj.innerHTML = nf.toFormatted() + '&nbsp;pcs.';
	
	// Automatic price calculation is too complicated
	// with the price breaks, so user will just have to
	// update cart to see the correct price.
	/*
	nf = new NumberFormat();
	nf.setNumber(newQty * multiplier * piecePrice);
	nf.setPlaces(2);
	nf.setCommas(true);
	nf.setCurrency(true);
	resultPriceObj.innerHTML = nf.toFormatted();
	*/
}

/**************************************************************
*  Purpose: Checks for minimum qty in qty field
*
*  Author: Marc Dula
*
***************************************************************
*  Revision History:
*  02/10/2004, MD, Created
**************************************************************/
function handleQtyBlur(newQtyObj, minQty, multiplier, piecePrice, resultQtyObj, resultPriceObj) {
	if ((0 == newQtyObj.value.replace(/\D/g, '').length) || (parseInt(newQtyObj.value) < minQty)) {
		newQtyObj.value = minQty;
		handleQtyChange(parseInt(newQtyObj.value), minQty, multiplier, piecePrice, resultQtyObj, resultPriceObj);
	}
}