/*
 * 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("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 the contact email."),

  new Array("project",       "Project",               true,  Any,  1,  64, "Please enter your project name."),
  new Array("equipment",      "Requested Equipment",  true,  Any,  1,  1024, "Please enter your requested equipment."),

  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."),

  new Array("equipmentUndamaged",      "Equipment Undamaged",           true,  Any,  1,  6, "Please specify: Equipment undamaged?"),
  new Array("mechanicalConnections",      "Mechanical Connections",           true,  Any,  1,  6, "Please specify: Mechanical connections made?"),
  new Array("baseMounted",      "Base Mounted",           true,  Any,  1,  6, "Please specify: Base mounted?"),
  new Array("baseGrouted",      "Base Grouted",           true,  Any,  1,  6, "Please specify: Base grouted?"),
  new Array("hydronicFilled",      "Hydronic Filled",           true,  Any,  1,  6, "Please specify: Hydronic system filled?"),
  new Array("waterConnected",      "Water Connected",           true,  Any,  1,  6, "Please specify: Water connected?"),
  new Array("vented",      "Hydronic System Vented",           true,  Any,  1,  6, "Please specify: Hydronic system vented?"),
  new Array("steam",      "Steam Available",           true,  Any,  1,  6, "Please specify: Steam available?"),
  new Array("electricalConnections",      "Electrical Connections",           true,  Any,  1,  6, "Please specify: Electrical connections made?"),
  new Array("airConnected",      "Air Connected",           true,  Any,  1,  6, "Please specify: Air connected?"),
  new Array("BAS",      "BAS System",           true,  Any,  1,  6, "Please specify: BAS connections made?"),
  new Array("trimComponents",      "Trim Components",           true,  Any,  1,  6, "Please specify: Trim components installed and connected?"),
  new Array("loadCapacity",      "Load Established",           true,  Any,  1,  6, "Please specify: Load established?"),
  new Array("equipmentReady",      "Equipment Ready",           true,  Any,  1,  6, "Please specify: Equipment ready?"),

  new Array("comments",    "Comments",                false,  Any,  1, 4096, "Please explain any 'no' answers.")
);


