function validate(formObject)
{
	// Validate input on individual product pages
	// the form object on the pages is passed to this function.
	var toValidate=formObject.quantity.value;
	var formName=formObject.name;
	var correctEntry = 0  // 0 = valid, -1 = not valid

	if (isNaN(toValidate))
		{
		// If entry is NOT a number
		correctEntry=-1
		}

	if (toValidate<=0)
		{
		// if entry <= 0
		correctEntry=-1
		}

	if (toValidate%1>0)
		{
		// if entry modulus 1 give any fraction then show error
		correctEntry=-1
		alert("Only whole products can be ordered");
		}

	if (toValidate>=100)
	{
		// Allow a maximum entry of 99
		correctEntry=-1
		alert("For large quantities please e-mail");
	}

	if (correctEntry==-1)
	{
		// Show error box, clear forms entry and set focus back to form
		alert('Please enter a quantity');
		eval("document." + formName +".quantity.value=''");
		eval("document." + formName +".quantity.focus()");
		return false;
	}
}

function DrawCell(frmName, desc, amt)
{
	// Function begins form, displays table cell with text box for quantities to be entered
	// sets hidden form field values for description and amount, end table data
	// ends form.
	document.write('<form action="../cartfile/confirm.asp" target="_top" method="get" name="' + frmName + '" onSubmit="return validate(this)">'+
	'<td>'+
	'<input type="submit" value="BUY" title="Enter Quantity in Box and press BUY button">'+
	'<input type="hidden" value="' + desc + '" name="description">'+
	'<input type="hidden" value="' + amt  + '" name="amount">'+
	'<input type="text"   size=2        name="quantity" title="Enter Quantity and Press BUY button">'+
	'</td>'+
	'</form>')

}

