/*

	Order Form JavaScript Library -- Version 1.2.0
	By Jeremy Clifton <jeremy@tvinteract.com>
	Last Modified 2011.01.04

*/

var errorMsg = "I'm sorry, but we are not able to process your order. Please check the following items:"
var qtyWarningA	= "You may order no more than ";
var qtyWarningB = " of this item.";

var required = {
	'name':		'* Name',
	'address':	'* Address',
	'city':		'* City',
	'county':	'* County',
	'zip':		'* Zip',
	'phone1':	'* Phone Number',
	'phone2':	'* Phone Number',
	'phone3':	'* Phone Number',
	'email':	'* Email'
};	

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);
	}

}
