/*
 * 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("txtfirstname", "first name", false, Any, 0, 128, "Please enter first name."),
  new Array("txtlastname", "last name", false, Any, 0, 128, "Please enter last name."),
  new Array("txtemail", "email", true, Any, 6, 128, "Please enter email."),
  new Array("txtaddress", "address", false, Any, 0, 128, "Please enter address."),
  new Array("txtcity", "city", false, Any, 0, 128, "Please enter city."),
  new Array("txtstate", "state", false, Any, 0, 64, "Please enter state."),
  new Array("txtzipcode", "zipcode", false, Any, 0, 32, "Please enter zipcode."),
  new Array("txtstate", "state", false, Any, 0, 64, "Please enter state."),
  new Array("txtphone", "phone", false, Any, 0, 64, "Please enter phone."),
  new Array("commentbox", "comment", false, Any, 0, 2048, "Please enter a comment."),
/*
  new Array("Annaleedollsfor", "Who do you buy Annalee dolls for?", false, Any, 0, 128, "Please select who you by Annalee dolls for."),
  new Array("shopAnnaleedolls", "How do you prefer to shop for Annalee dolls?", false, Any, 0, 128, "Please enter select how you shop for Annalee dolls."),
  new Array("maritalstatus", "What is your marital status?", false, Any, 0, 128, "Please select marital status."),
  new Array("children", "Do you have children living with you?", false, Any, 0, 128, "Please select whether you have children."),
  new Array("President", "President", false, Any, 0, 128, "Please select President."),
*/
  new Array("txttype", "type", false, Any, 0, 128, "Please enter type.")
);