/** 
 * saf/conf.js 
 * SAF (Standard Action Forms)
 * Contains constant object declarations for configuring Standard Action Forms 
 *
 * @version 2.0
 *
 * @author Matt Dertinger
 * @author Yun Qian
 *
 */

/**
 * SAFTYPE
 * Array used to store Boolean values that indicate which form element types 
 * should call the validate() method.
 *
 * @see saf/safHandler.js for validation routines that use the 
 * SAFTYPE array.
 *
 */
var SAFTYPE = new Array();
SAFTYPE["text"] = true;
SAFTYPE["select-one"] = true;
SAFTYPE["radio"] = true;
SAFTYPE["checkbox"] = true;
SAFTYPE["textarea"] = true;

/**
 * SAFRULE
 * An Object containing Associative Arrays used to store 
 * SAF (Standard Action Forms) validation rules.
 *
 * _MASK[] items are Regular Expression Literals used to validate a 
 * field's value against.
 *
 * The class attribute of a form element (whose type is a member of the 
 * SAFTYPE array) determines which object within SAFRULE is to be used.
 *
 * @see the l10._ERRORMSG object within /j/06/l10n/messages_en.js for associated 
 * localized error messages in English
 * @see the l10._ERRORMSG object within /j/06/l10n/messages_es.js for associated 
 * localized error messages in Spanish
 * @see the l10._ERRORMSG object within /j/06/l10n/messages_zh-Hant.js for 
 * associated localized error messages in Chinese
 *
 */
var SAFRULE = new Object();
SAFRULE._MASK = {};
SAFRULE._MASK["SPACES"] = /\s/g;
SAFRULE._MASK["DIGITS"] = /\d/g;
SAFRULE._MASK["EMAIL"] = /^[^ @,]+@[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*(\.[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*)*\.[a-zA-Z]{2,}$/;
SAFRULE._MASK["PHONE"] = /^\(?([1-9]\d{2})[)-.]?\s?(\d{3})[-.\s]?(\d{4})$|^\(?([1-9]\d{2})[)-.]?\s?(\d{3})[-.\s]?(\d{4})\s?(\d{1,5})$/;
SAFRULE._MASK["ZIPCODEPLUS4"] = /(^\d{5}$)|(^\d{5}\d{4}$)/;
SAFRULE._MASK["DATEOFBIRTH"] = /^[0-1]\d(\-|\/|\.)[0-3]\d\1[1][9]\d{2}$/;
SAFRULE._MASK["DOWNPAYMENT"] =  /^\d{1,3}[,]?(\d{3})*\.\d{2}$/;
SAFRULE._MASK["VIN"] = /\w{17}$/;