/*

	Order Form JavaScript Library -- Version 1.2.0
	By Jeremy Clifton <jeremy@tvinteract.com>
	Last Modified 2008.04.24

*/

function calcQty(inPack, itemNum, max, e)
{
	fld = getTarget(e);
	qty = getElement(itemNum+'_Qty');
	
	// Check to make sure they haven't asked for more than the max number
	// number of this item ...
	if ( ((fld.value*inPack) > max) && (max != 0) ) {
		fld.value = (max/inPack);
		alert(qtyWarningA+max+qtyWarningB);
	}
	
	if (fld.value == 0) {
		// Only if the browser supports this ...
		if (qty) {
			qty.innerHTML = '';
		}
		fld.value = '';
	} else {
		// Make sure the value is numeric; if not set it to zero ...
		if (isNaN(fld.value)) {
			fld.value = '';
		} else {
			// Only if the browser supports this ...
			if (qty) {
				qty.innerHTML = fld.value*inPack;
			}
		}
	}
	
}

function checkQty(itemNum, max, e)
{

	fld = getElement(itemNum+'_Qty');
	if (fld.value > max && max != 0) {
		fld.value = max;
		alert(qtyWarningA+max+qtyWarningB);
	}

}