/*
 * 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("firstname",		"First Name",		true,	Any,	0,	128,	"Please enter your first name."),
  new Array("lastname",		"Last Name",		true,	Any,	0,	128,	"Please enter your last name."),
  new Array("address1",		"Address Line 1",		false,	Any,	0,	128,	"Please enter your address."),
  new Array("address2",		"Address Line 2",		false,	Any,	0,	128,	""),
  new Array("city",		"City",		false,	Any,	0,	128,	"Please enter your city."),
  new Array("state",		"State",		false,	Any,	0,	32,	"Please enter your state."),
  new Array("zipcode",		"Zipcode",		false,	Any,	0,	128,	"Please enter your zipcode."),
  new Array("country",		"Country",		false,	Any,	0,	128,	"Please enter your country."),

  new Array("phone",	"Phone",	false,	Any,	7,	32,		"Please enter a valid phone number."),
  new Array("email",	"Email",	true,	Email,	6,	128,	"Please enter a valid Email address."),
  new Array("time",		"Time",		false,	Any,	0,	128,	"Please enter the best time for us to contact you."),

  new Array("info",	"Info",	false,	Any,	0,	2048,	"Please enter a message.")
);

