function Check()
{
    //  Description: XXX fix this
    //  Parameters: There can be any number (n) of parameters.
    //              parm 1..n-2 - the form objects to be checked
    //              parm n-1 - the type of check to perform
    //              parm n - the message to display if the check fails

    //              Current check types:
    //              - blank
    //              - blankor
    //              - blankand
    //              - email
    //              - date
    //              - number

    //  Date        Description of change
    //  12/19/02    Sylvan - Created
    //  12/19/02    Sylvan - modified to use variable parameter list

    var bCheckedOK;
    var obFormObject;

    //  Get the list of supplied parameters - make sure there are at least 3
    var aArgumentList = Check.arguments;
    var nArguments = aArgumentList.length;
    var nLastArgumentIndex = nArguments - 3;

    if (nArguments < 3)
    {
        // - there must be at least 3 parameters.
        sMsg = "\nSupport: wrong number of required arguments to Check()"
        return sMsg;
    }
    else
    {
        obFormObject = aArgumentList[0];
    }

    var sMsg = aArgumentList[nArguments - 1];
    var sCheckType = aArgumentList[nArguments - 2];


    switch (sCheckType)
    {
        case "blank":
            //  Checks that a value is not blank
            bCheckedOK = (obFormObject.value != "");
            break;

        case "blankor":
            //  Checks that multiple values have at least one non-blank - uses logical OR
            //  intitialize bCheckedOK to false so logical AND will work - first non-blank value will switch it to true
            bCheckedOK = false;
            var i = 0
            while (bCheckedOK == false && i <= nLastArgumentIndex)
            {
                obFormObject = aArgumentList[i]
                bCheckedOK = (bCheckedOK || (obFormObject.value != ""));
                i++;
            }
            break;

        case "blankand":
            //  Checks that multiple values are ALL not blank - uses logical AND
            //  intitialize bCheckedOK to true so logical AND will work - first blank value will switch it to false
            bCheckedOK = true;
            var i = 0
            while (bCheckedOK == true && i <= nLastArgumentIndex)
            {
                obFormObject = aArgumentList[i]
                bCheckedOK = (bCheckedOK && (obFormObject.value != ""));
                i++;
            }
            break;

        case "email":
            //  Date        Description of change
            //  12/18/02    Sylvan - copied from http://www.xs4all.nl/~ppk/js/mailcheck.html
            //  12/18/02    Sylvan - disallowed numerics in top-level domain
            //  12/18/02    Sylvan - forced domains to begin with an alphanumeric

            //  Notes:
            //  regular expression checks:
            //      username: alphanumeric, hyphen, underscore or period followed by @
            //      domain: at least one alphanumeric, followed by alphanumerics or hyphens,
            //          followed by a period, followed by 2-4 alphabeticals

            //  Original reg exp:
            //  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

            var sEmail = obFormObject.value;

            if (sEmail == "")
            {
                bCheckedOK = true;
            }
            else
            {
                var filter  = /^([a-zA-Z0-9_\.\-])+\@+([a-zA-Z0-9])+(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,4})+$/;
                bCheckedOK = filter.test(sEmail);
            }
            break;

        case "date":
            // Checks for the following valid date formats:
            // MM/DD/YYYY
            // Also separates date into month, day, and year variables

            var dDate = obFormObject.value;

            if (dDate == "")
            {
                bCheckedOK = true;
            }
            else
            {
                //  if the programmer supplied a message string, use it as a prefix
                //  for the messages generated by this function.
                //  useful for identifying the field with the error.
                var sDatePrefix = sMsg;
                if (sDatePrefix != "")
                {
                    sDatePrefix = " - " + sDatePrefix;
                }

                sMsg = "";
                var dateStr = obFormObject.value;
                var datePat = /^(\d{1,2})(\/)(\d{1,2})\2(\d{4})$/;
                var matchArray = dateStr.match(datePat); // is the format ok?

                if (matchArray == null)
                {
                    sMsg = "\n" + sDatePrefix + " - Make sure all dates are in the format: mm/dd/yyyy";
                }
                else
                {
                    month = matchArray[1]; // parse date into variables
                    day = matchArray[3];
                    year = matchArray[4];

                    if (month < 1 || month > 12)    // check month range
                    {
                        sMsg = "\n" + sDatePrefix + " - Month must be between 1 and 12.";
                    }

                    if (day < 1 || day > 31)
                    {
                        sMsg = "\n - " + sDatePrefix + " - Day must be between 1 and 31.";
                    }

                    if ((month==4 || month==6 || month==9 || month==11) && day==31)
                    {
                        sMsg = "\n - " + sDatePrefix + " - Month "+month+" doesn't have 31 days!";
                    }

                    if (month == 2) // check for february 29th
                    {
                        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));

                        if (day>29 || (day==29 && !isleap))
                        {
                            sMsg = "\n - " + sDatePrefix + " - February " + year + " doesn't have " + day + " days!";
                        }
                    }
                }
                bCheckedOK = (sMsg == "");
            }
            break;

        case "number":
            //
            var sTestNumber = obFormObject.value;
            var sValidCharacters = "0123456789-.";
            var bNumeric = true;

            i = 0;
            while (bNumeric && i < sTestNumber.length)
            {
                sCharacter = sTestNumber.charAt(i);
                bNumeric = (bNumeric && (sValidCharacters.indexOf(sCharacter) != -1));
                i++
                if  (i == 1)
                {
                    sValidCharacters = "0123456789.,"
                }
            }
            bCheckedOK = bNumeric;
            break;

        default:
            bCheckedOK = false;
            sMsg = "\nSupport: invalid check type."
    }

    if (bCheckedOK)
    {
        return("");
    }
    else
    {
        return(sMsg);
    }
}