/*
 * Javascript form validator
 * Field specification array.
 * Ray Taylor
 */

/*
 * Field array structure:
 * FieldArray[n] = (ID, Name, Required, Format, MinLength, MaxLength ErrorMessage)
 *      HTML ID of element,
 *      User-friendly name of input, 
 *      required (true or false), 
 *      regular expression to check format, one of:
 *        Any -- allows anything; used for required fields of no specific format
 *        Alpha -- allows only letters and spaces
 *        AlphaNumeric -- allows letters, digits, and underscores, but no spaces
 *        Numeric -- allows digits only
 *        RealNumeric -- allows digits and one decimal
 *        Email -- e-mail address
 *        URL -- allows anything, but not ://, so no http://, https://, or ftp:// prefix.
 *      minimum length, 
 *      maximum length,
 *      error message for invalid format);
 */
var ID = 0, NAME = 1, REQUIRED = 2, FORMAT = 3, MINLENGTH = 4, MAXLENGTH = 5, ERRORMESSAGE = 6;

var FieldArray = new Array(
  new Array("date",       "Today's Date",             false, Any,  0,  64, "Please enter today's date."),
  new Array("serial",     "Serial Number",            true,  Any,  0,  32, "Please enter your serial number."),
  new Array("datecode",   "Date Code",                true,  Any,  0,  64, "Please your date code."),
  new Array("part",       "Item or Part Number",      true,  Any,  0,  32, "Please enter the item or part number."),
  new Array("company",    "Company",                  true,  Any,  1, 128, "Please enter your company name."),
  new Array("address",    "Address",                  true,  Any,  1, 255, "Please enter your company address."),
  new Array("fieldcontactname",       "Contact Name", true,  Any,  1,  48, "Please enter the contact name."),
  new Array("fieldcontactphone",      "Contact Phone",true,  Any,  7,  32, "Please enter the contact phone number."),
  new Array("fieldcontactfax",      "Contact Fax",    false,  Any,  7,  32, "Please enter the contact fax number."),
  new Array("fieldcontactemail",      "Contact Email",    true,  Email,  6,  128, "Please enter your contact email."),
  new Array("po",         "Provided PO Number",       true,  Any,  0,  32, "Please enter your PO number."),
  new Array("yourname",       "Your Name",                true,  Any,  1,  48, "Please enter your name."),
  new Array("yourtitle",      "Your Title",              true,  Any,  1,  48, "Please enter your title.")
);


