
// Begin EditList.js
// Created by:  Steve Seaquist
//
function EditList			(pFNam, pFVal, pMask, pReqd, pMinLen, pMaxLen, pMaxLenTotal)
{
if  (gDataValidation == 0)
	return true;

var  sFLen	= pFVal.length;
if ((sFLen == 0) && (pReqd == 0))
	return true;

if  (!EditMask (pFNam, pFVal, 'X', 1, 1, pMaxLenTotal))
	return false;

//  It's tempting to say at this point:  var sArray    = pFVal.split(",");
//  But that's JavaScript 1.1, and we want our data validation routines to work under 
//  Netscape 2.x and MSIE 3.x too.  Therefore, we do "lowest common denominator" coding:  

var i;
var sFCtr	= 0;
var sFNam	= "";
var sFVal	= "";
var sFValLen	= 0;				// See comment in EditMask about comparing lengths directly.

for (i = 0; i < sFLen; i++)
	{
	var j	= i + 1;			// (in case charAt() is JavaScript 1.1 also)
	var c	= pFVal.substring (i, j);	// (in case charAt() is JavaScript 1.1 also)

	if  (c == ",")
		{
		sFCtr++;
		if (sFCtr > 25)
			{
			alert ("ERROR.  " + pFNam + " contains more than 25 items.");
			return false;
			}

		sFValLen	= sFVal.length;
		if  ((sFValLen == 0) && (pReqd == 0))
			{
			sFVal	= "";
			continue;
			}

		sFNam	= pFNam + " #" + sFCtr + " ('" + sFVal + "')";	// Name  of the sFCtr-th subfield.

		if  (!EditMask (sFNam, sFVal, pMask, pReqd, pMinLen, pMaxLen))
			return false;

		sFVal	= "";
		}
	else if ((c == " ") && (sFVal == ""))	// This if trims off leading spaces.  (Can't trim off other 
		continue;			// spaces because they're allowed in keywords, for example.)
	else
		sFVal	= sFVal + c;
	}

sFCtr++;
if (sFCtr > 25)
	{
	alert ("ERROR.  " + pFNam + " contains more than 25 items.");
	return false;
	}

sFValLen	= sFVal.length;
if  ((sFValLen == 0) && (pReqd == 0))
	return true;

sFNam		= pFNam + " #" + sFCtr + " ('" + sFVal + "')";	// Name  of the last subfield.

if  (!EditMask (sFNam, sFVal, pMask, pReqd, pMinLen, pMaxLen))
	return false;

return true;
}
// End EditList.js


