// This validation is outdated. Colors are no longer needed; what IS needed is a
// warning if the customer has not entered a quantity or if the quantity equals 0, and
// another warning if the customer has not selected an option. However, I think the
// latter warning can be omitted if all options are made into radio buttons with one
//  checked default.

function getValueOfElem(elem_array, elem_name)
{
	retval = "";
	for (ea = 0; ea < elem_array.length; ea ++)
	{
		if (elem_array[ea].name == elem_name)
		{
			retval = elem_array[ea].value;
			break;
		}
	}
	return retval;
}
function validateInput(currentForm)
{
	// Check for correct colors and names.
	retval = true;
	i = 1;

	while ( (getValueOfElem(currentForm.elements, i + "_id") ) != "")
	{
     		elem_name = i + "_qty_3";
		value = getValueOfElem(currentForm.elements, elem_name);
		if ((value < 1) && (value > 0) && (value != ""))
		{
			alert ("Please enter a quantity of 1 or more");
			return false;
		}

		i++;
	}

	j = 1;
	while ( getValueOfElem(currentForm.elements, j + "_id") != "")
	{
		// Check for if any row has a value created.
	       	for (k = 1; k <= 3; k++)  // cycle over colors.
		{
			elem_name = j + "_qty_" + k;
			count = getValueOfElem(currentForm.elements, elem_name);
			if (count > 0)
			{
				color = getValueOfElem(currentForm.elements, j + "_color");
				if ("None" == color)
				{
					alert ("Please select a color");
					return false;
				}
				else
				{
					continue;
				}
			}
		}
		j++;
	}
	return retval;
}
