\r\n\r\n\r\n\t//If there are more than v this v number of demo-test-value\r\n\t//functions, print a drop-down box instead of individual\r\n\t//buttons.\r\n\tvar iBUTTON_THRESHOLD = 10;\r\n\tvar sDDB_DIVIDER = "[__DDB_DIVIDER__]";\r\n\r\n\tvar bDBG_TEST_FUNC_CALLS = false;\r\n\tvar bTST_FUNCS_ELIM_TYPE_POSTS = false;\r\n\tvar bTST_FUNCS_pppp_TO_POINT = false;\r\n\tvar bTST_FUNCS_dddd_TO_DASH = false;\r\n\tvar bTST_FUNCS___TO_SPACE = false;\r\n\tvar bCRSH_ALRT = true;\r\n\tvar bCRSH_DGNSTCS = true;\r\n\tvar bCRSH_THROW = true;\r\n\r\n\t//If this is a 'concept' page, then set this to true.\r\n\t//\r\n\t//In the demo testing value buttons/ddb values, the\r\n\t//'_txt'/'_pwd'/... will be suppressed from displaying. It\r\n\t//is *assumed* that there is a type prefix, and the last four\r\n\t//characters are blindly eliminated.\r\n\t//\r\n\t//This also changes...\r\n\t// 'neg' to '-'\r\n\t// 'neg' is expected to be lowercase, and the first\r\n\t// three characters. Any other instances are not\r\n\t// replaced.\r\n\t// 'p' to '.'\r\n\t// 'p' is only expected to exist once. Only the first\r\n\t// 'p' is replaced.\r\n\tvar bCONCEPT_DOC_PAGE = false;\r\n\r\n\t//Truly global among all forms.\r\n\t\tvar sJSDIR;\r\n\t\tvar sSifCfgUrl;\r\n\t\tvar bDbgJSLoads;\r\n\r\n\t\tvar bLDD_VFPD = false;\r\n\t\tvar bLDD_CIBC = false;\r\n\t\tvar bLDD_DBG = false;\r\n\t\tvar bLDD_OD = false;\r\n\t\tvar bLDD_STASIF = false;\r\n\t\tvar bLDD_SIF_CFG = false;\r\n\t\tvar bLDD_CI = false;\r\n\r\n\t\tvar bVFPDInUrl = false;\r\n\r\n\t\tvar aVfbc = [];\r\n\r\n\t\tvar sSifCfgUrl;\r\n\t\tvar bDbgJSLoads;\r\n\r\n\tvar sDMOV_FUNC_PRE = "vfpdtf__";\r\n\tvar sURLP_VFPD = "vfpd";\r\n\tvar sURLP_CIBC = "load_cibc";\r\n\tvar sFRM_NM_VFPD = "form_vfpd__";\r\n\r\n\r\nvar bLVFCalled = false; //XCMAX\r\n\r\n\r\nfunction loadVF(s_jsDirUrl, s_sifCfgUrl, b_dbgJSLoads) {\r\n\tif(bLVFCalled) { //XCMAX\r\n\t\tcrsh("vf.lvf1", loadVF, "loadVF (XCMAX): This function was already called.");\r\n\t} //XCMAX\r\n\tbLVFCalled = true; //XCMAX\r\n\r\n\tciMissing(loadVF, "loadVF (XCMAX)", "s_jsDirUrl", s_jsDirUrl);\r\n\r\n\tif(s_jsDirUrl.substring((s_jsDirUrl.length - 1), s_jsDirUrl.length) != "/") { //XCMAX\r\n\t\tcrsh("vf.lvf1", loadVF, "loadVF (XCMAX): s_jsDirUrl must end with a url slash ('/'). Currently '" + s_jsDirUrl + "'.");\r\n\t} //XCMAX\r\n\r\n\tsJSDIR = s_jsDirUrl;\r\n\tsSifCfgUrl = s_sifCfgUrl;\r\n\tbDbgJSLoads = (df(b_dbgJSLoads) && b_dbgJSLoads);\r\n\r\n\tif(df(sSifCfgUrl)) {\r\n\t\tloadJS(bLDD_STASIF, true, sJSDIR, "vf_stASIF.js");\r\n\r\n\t\t//false: It always needs to be loaded. It's only loaded\r\n\t\t//once per loadVF() call.\r\n\t\tloadJS(false, true, "", sSifCfgUrl);\r\n\t}\r\n}\r\n\r\n\r\nvar bCVFLCalled = false; //XCMAX\r\n\r\n\r\nfunction completeVFLoad() {\r\n\tvar f = completeVFLoad;\r\n\tvar sF_XCMAX = "completeVFLoad (XCMAX): ";\r\n\tciNotLoaded(sF_XCMAX, undefined);\r\n\tif(bCVFLCalled) { //XCMAX\r\n\t\tcrsh("vf.cvfl1", f, sF_XCMAX + "This function was already called.");\r\n\t\tbCVFLCalled = true; //XCMAX\r\n\t} //XCMAX\r\n\tif(aVfbc.length == 0) {//XCMAX\r\n\t\tcrsh("vf.cvfl2", f, sF_XCMAX + "Must call configVF().");\r\n\t} //XCMAX\r\n\r\n\t//Length is at least one\r\n\r\n\tif(!df(aVfbc[0].sFrmNm) && aVfbc.length > 1) { //XCMAX\r\n\t\tcrsh("vf.cvf3", f, sF_XCMAX + "aVfbc.length is greater than one (" + aVfbc.length + "), but aVfbc[0].sFrmNm is.[undefined].");\r\n\t} //XCMAX\r\n\r\n\tfor(var i = 0; i < aVfbc.length; i++) {\r\n\t\tvar sFnm = aVfbc[i].sFrmNm;\r\n\r\n\t\tfor(var j = (i + 1); j < aVfbc.length; j++) { //XCMAX\r\n\t\t\tif(sFnm == aVfbc[j].sFrmNm) { //XCMAX\r\n\t\t\t\tcrsh("vf.cvfl4", f, sF_XCMAX + ": configVF was called twice for the form named '" + sFnm + "'. [i=" + i + ", j=" + j + "]");\r\n\t\t\t} //XCMAX\r\n\t\t} //XCMAX\r\n\r\n\t\tif(aVfbc.length > 1 || df(aVfbc[0].sFnm)) { //XCMAX\r\n\t\t\t//[undefined] is a legal form name when the length equals zero.\r\n\r\n\t\t\tif(!df(sFnm)) { //XCMAX\r\n\t\t\t\tcrsh("vf.cvfl5", f, sF_XCMAX + "configVF was called multiple times, but call number " + (i + 1) + ", has a form name of [undefined]. [undefined] is a legal form name only when configVF is called a single time.");\r\n\t\t\t} //XCMAX\r\n\r\n\t\t\t//These tests will fail (actually or conceptually) when\r\n\t\t\t//the name is undefined.\r\n\t\t\t\tif(eval("!df(document." + sFnm + ")")) { //XCMAX\r\n\t\t\t\t\tcrsh("vf.cvfl6", f, sF_XCMAX + ": configVF was called for a form named '" + sFnm + "', but no form having that name exists.");\r\n\t\t\t\t} //XCMAX\r\n\r\n\t\t\t\tif(sFnm.substring(0, sFRM_NM_VFPD.length) == sFRM_NM_VFPD) {//XCMAX\r\n\t\t\t\t\tcrsh("vf.cvfl7", f, sF_XCMAX + "configVF was called for a form named '" + sFnm + "'. No form name may start '" + sFRM_NM_VFPD + "'.");\r\n\t\t\t\t} //XCMAX\r\n\t\t} //XCMAX\r\n\t}\r\n\r\n\tcommitVFPDValues();\r\n}\r\n\r\n\r\nfunction configVF(sb_cibcOnOff, i_dfltDbgPerScr, s_formName) {\r\n\tif(!bLVFCalled) { //XCMAX\r\n\t\tcrsh("vf.cvf1", configVF, "configVF (XCMAX): Must call loadVF() first.");\r\n\t} //XCMAX\r\n\r\n\t//Add a new element to the end of aVfbc.\r\n\tvar vfbc = new VFBCfg(sb_cibcOnOff, i_dfltDbgPerScr, s_formName);\r\n\taVfbc[aVfbc.length] = vfbc;\r\n\r\n\tbVFPDInUrl = (window.location.search.indexOf(sURLP_VFPD) != -1);\r\n\r\n\tif(i_dfltDbgPerScr != -1) {\r\n\t\t//Debugging is definitely needed when debugging is not -1.\r\n\t\tloadDBG();\r\n\t}\r\n\r\n\tloadCIBC(vfbc.isCIBCOn());\r\n}\r\n\r\nfunction loadObjDgnstcs() {\r\n\tloadJS(bLDD_OD, true, sJSDIR, "vf_obj_dgnstcs.js");\r\n}\r\n\r\nfunction loadCrashIf() {\r\n\tloadJS(bLDD_CI, true, sJSDIR, "crash_if.js");\r\n}\r\n\r\nfunction loadCIBC(b_doLoad) {\r\n\t//cibc is loaded only once per *page*, not per form.\r\n\tif(b_doLoad || window.location.search.indexOf(sURLP_CIBC) != -1) {\r\n\t\tloadJS(bLDD_CIBC, true, sJSDIR, "vf_cibVFCfg.js");\r\n\t\tloadObjDgnstcs();\r\n\t\tloadCrashIf();\r\n\t}\r\n}\r\n\r\n\r\nfunction configVFPD(sb_on, sb_cibcOnOff, sb_onLink, sb_offLink, sb_resetLink, sb_successDDB, sb_cibcSection, sb_cibcCrshDdb, ai_dbgPerScrDDB, as_tstVFuncPosts, s_formName) {\r\n\tvar vfbc = gtVfbc(configVFPD, "configVFPD", s_formName);\r\n\tvfbc.stVfpdc(sb_on, sb_cibcOnOff, sb_onLink, sb_offLink, sb_resetLink, sb_successDDB, sb_cibcSection, sb_cibcCrshDdb, ai_dbgPerScrDDB, as_tstVFuncPosts, s_formName);\r\n\r\n\tloadVFPD(vfbc.isVfpdOn());\r\n\r\n\tif(vfbc.isVfpdOn() && vfbc.bDCIBCOnOff) {\r\n\t\tloadCIBC(true);\r\n\t}\r\n}\r\n\r\nfunction gtSB(s_callingFunc, s_sbName, string_boolean, s_true, s_false) {\r\n\tciMissing(gtSB, s_callingFunc, s_sbName, string_boolean); //XCMAX\r\n\r\n\tif(string_boolean == s_true) {\r\n\t\treturn true;\r\n\t} else if(string_boolean == s_false) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tcrsh("vf.gsb1", gtSB, s_callingFunc + " (XCMAX): The string_boolean parameter " + s_sbName + " must equal either s_true ([" + s_true + "]), or s_false ([" + s_false + "]).");\r\n}\r\n\r\n\r\n\r\n\r\nfunction getFormErrorMsgs(f_orm, s_userErrPre, b_crshAlert, b_crshDgnstcs, b_crshThrow) {\r\n\tvar sF_XCMAX = "getFormErrorMsgs (XCMAX)";\r\n\tvar f = getFormErrorMsgs;\r\n\r\n\t//If vfpd is active, and CRSH is selected, then\r\n\t//that needs to be refreshed. It's successfully\r\n\t//updated on page load, but not otherwise.\r\n\tcommitVFPDValues();\r\n\r\n\tif(getFormErrorMsgs.arguments.length > 2) { //XCMAX\r\n\t\tcrsh("vf.gfem1", f, sF_XCMAX + ": " + getFormErrorMsgs.arguments.length + " parameters have been provided to this function, but only two are expected.");\r\n\t} //XCMAX\r\n\r\n\tciMissing(getFormErrorMsgs, sF_XCMAX, "f_orm", f_orm);\r\n\tciMissing(getFormErrorMsgs, sF_XCMAX, "s_userErrPre", s_userErrPre);\r\n\r\n\tif(!df(f_orm.name) || f_orm.name == "") {\r\n\t\tcrsh("vf.gfem1", f, sF_XCMAX + ": f_orm.name is undefined or zero characters in length.");\r\n\t}\r\n\r\n\tif(aVfbc.length == 0) {\r\n\t\tcrsh("vf.gfem2", f, sF_XCMAX + ": Must call configVF() first.");\r\n\t}\r\n\r\n\tvar vfbc = gtVfbc(getFormErrorMsgs, "getFormErrorMsgs", f_orm.name);\r\n\r\n\t//Set utility.crsh() behavior\r\n\tbCRSH_ALRT = df(b_crshAlert)? b_crshAlert : vfbc.bCrshAlrt;\r\n\tbCRSH_DGNSTCS = df(b_crshDgnstcs)? b_crshDgnstcs : vfbc.bCrshDgnstcs;\r\n\tbCRSH_THROW = df(b_crshThrow)? b_crshThrow : vfbc.bCrshThrow;\r\n\r\n\tciNotLoaded(sF_XCMAX, vfbc);\r\n\r\n\t//Get the array of FLStats for this form.\r\n\tvar aFLS4Frm = gtAFLSvf(vfbc.sFrmNm);\r\n\r\n\t//Should configuration be analyzed, and then should we crash\r\n\t//if there's a problem with it?\r\n\tvar bCIBC = false;\r\n\r\n\tif(!df(aFLS4Frm)) {\r\n\t\t//The form has not yet been analyzed.\r\n\r\n\t\t//We need to re-analyze the form.\r\n\t\tbCIBC = true;\r\n\r\n\t\t//fl_stats.gtAFLS()\r\n\t\tvar aFLS = gtAFLS(f_orm);\r\n\r\n\t\t//We've made it this far, so the form's vf configuration\r\n\t\t//is good. If it's not good, we would have not made it\r\n\t\t//past the previous line.\r\n\t\taFLS4Frm = aFLS;\r\n\r\n\t\t//Now the form's statistics exist in the global aFLStats.\r\n\t}\r\n\r\n\tif(bLDD_DBG) {\r\n\t\t//vf_cib_cfg.js has been imported, so this function has\r\n\t\t//been defined. The only way this is defined is when\r\n\t\t//i_dps has been set, at some point to something other\r\n\t\t//than -1. Even if it is -1 now, it's so fast it's not\r\n\t\t//worth *not* calling this.\r\n\t\tdbgVF(aFLS4Frm, vfbc.iDDPS, false);\r\n\t}\r\n\r\n\r\n\t//We need to under normal circumstances &&\r\n\t//The code is available &&\r\n\t//They want to\r\n\tif(bLDD_CIBC && bCIBC && vfbc.isCIBCOn()) {\r\n\t\tcibVFCfg(aFLS4Frm);\r\n\t}\r\n\r\n\t//fl_stats.gtAFLSUsrErrs()\r\n\treturn (gtUsrErrCnt(aFLS4Frm) > 0)\r\n\t\t? gtAFLSUsrErrs(aFLS4Frm, "", s_userErrPre, "")\r\n\t\t: "";\r\n}\r\n\r\n\r\nfunction loadVFPD(b_on) {\r\n\tloadJS(bLDD_VFPD, b_on, sJSDIR, "vf_perm_diagnostics.js");\r\n}\r\n\r\n\r\nfunction loadDBG() {\r\n\tloadJS(bLDD_DBG, true, sJSDIR, "vf_dbgVF.js");\r\n\tloadObjDgnstcs();\r\n\tloadCrashIf();\r\n}\r\n\r\n\r\nfunction loadJS(b_alreadyLoaded, b_doLoad, s_dir, s_jsFile) {\r\n\tif(b_alreadyLoaded || !b_doLoad) {\r\n\t\t//It was already loaded, or we don't want to load it.\r\n\t\treturn;\r\n\t}\r\n\r\n\t//We want to load it, and it's not yet been loaded.\r\n\r\n\tvar sLoad = '[vfpd on]
');\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n\r\nfunction commitVFPDValues() {\r\n\tif(bLDD_VFPD) {\r\n\t\tupdateVFPDCRaw();\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction stAFLSvf(a_flStats, s_formName) {\r\n\tvar vfbc = gtVfbc(stAFLSvf, "stAFLSvf", s_formName);\r\n\tvfbc.aFLStats = a_flStats;\r\n}\r\n\r\n\r\nfunction gtAFLSvf(s_formName) {\r\n\treturn gtVfbc(gtAFLSvf, "gtAFLSvf", s_formName).aFLStats;\r\n}\r\n\r\n\r\n\r\nfunction gtDUrl(b_vfpdP, b_cibcP, b_resetLink) {\r\n\tvar url = window.location;\r\n\tvar sq = url.search;\r\n\r\n\tsq = addDelUrlP(sq, b_vfpdP, sURLP_VFPD);\r\n\tsq = addDelUrlP(sq, b_cibcP, sURLP_CIBC);\r\n\r\n\tif(b_resetLink) {\r\n\t\t//Forces a reload. When the link url is exactly the same as\r\n\t\t//the current url, the link does nothing.\r\n\r\n\t\t//What's the previous random link?\r\n\t\tvar sRND_PRE = "vfrndp_";\r\n\t\tvar iPOST_LEN = 4;\r\n\r\n\t\tvar iIdxPrevRnd = sq.indexOf(sRND_PRE);\r\n\t\tif(iIdxPrevRnd != -1) {\r\n\t\t\tsq = addDelUrlP(sq, false, sq.substring(iIdxPrevRnd, iIdxPrevRnd + sRND_PRE.length + iPOST_LEN));\r\n\t\t}\r\n\r\n\t\t//And now add a new random link.\r\n\t\tvar sRnd = ((new Date()).getTime() + "");\r\n\t\tsRnd = sRnd.substring((sRnd.length - iPOST_LEN), sRnd.length);\r\n\t\tsq = addDelUrlP(sq, true, sRND_PRE + sRnd);\r\n\t}\r\n\r\n\t//MUST SPLIT "//" IN THE URL, OR IT AND THE REST OF THE LINE\r\n\t//WILL BE OBLITERATED AS A COMMENT.\r\n\treturn url.protocol + "/" + "/" + url.host + url.pathname + sq;\r\n}\r\n\r\n\r\n\r\nfunction doSubmitOnSuccess(f_orm) {\r\n\tciMissing(doSubmitOnSuccess, "doSubmitOnSuccess (XCMAX)", "f_orm", f_orm);\r\n\treturn gtVfbc(doSubmitOnSuccess, "doSubmitOnSuccess", f_orm.name).bSbmtOnSuccess;\r\n}\r\n\r\n\r\n\r\nfunction VFBCfg(sb_cibcOnOff, i_dfltDbgPerScr, s_formName) {\r\n\tvar sF = "VFBCfg";\r\n\tvar sF_XCMAX = sF + " (XCMAX)";\r\n\tciMissing(VFBCfg, sF_XCMAX, "sb_cibcOnOff", sb_cibcOnOff);\r\n\tciMissing(VFBCfg, sF_XCMAX, "i_dfltDbgPerScr", i_dfltDbgPerScr);\r\n\r\n\tthis.bCIBCOnOff = gtSB(sF, "sb_cibcOnOff", sb_cibcOnOff, "CIBC_ON", "CIBC_OFF");;\r\n\tthis.iDfltDPS = i_dfltDbgPerScr;\r\n\r\n\t//May be undefined, meaning 'form_vfpd__undefined'!!!\r\n\t//\r\n\tthis.sFrmNm = s_formName;\r\n\r\n\t//VFPD\r\n\t\tthis.stVfpdc = pb_stVfpdc;\r\n\r\n\t\t//Config\r\n\t\t\tthis.bDOnDflt;\r\n\t\t\tthis.bDCIBCOnOff = false;\r\n\t\t\tthis.bOnLnk = false;\r\n\t\t\tthis.bOffLnk = false;\r\n\t\t\tthis.bResetLnk = false;\r\n\t\t\tthis.bSuccessDDB = false;\r\n\t\t\tthis.bCIBCSctn = false;\r\n\t\t\tthis.bCIBCCrshDdb = false;\r\n\t\t\tthis.asTstngVFuncPost;\r\n\t\t\tthis.aiDPSddb;\r\n\r\n\t\t//State\r\n\t\t\tthis.bDOn;\r\n\t\t\tthis.bCIBCDoCrsh;\r\n\t\t\tthis.bSbmtOnSuccess;\r\n\t\t\tthis.iDDPS;\r\n\t\t\tthis.bCrshAlrt;\r\n\t\t\tthis.bCrshDgnstcs;\r\n\t\t\tthis.bCrshThrow;\r\n\t\t\tthis.bOrigCrshAlrt = bCRSH_ALRT;\r\n\t\t\tthis.bOrigCrshDgnstcs = bCRSH_DGNSTCS;\r\n\t\t\tthis.bOrigCrshThrow = bCRSH_THROW;\r\n\r\n\t\tthis.turnDOnOff = pb_turnDOnOff;\r\n\t\tthis.isCIBCOn = pb_isCIBCOn;\r\n\t\tthis.isVfpdOn = pb_isVfpdOn;\r\n\r\n\t\tthis.turnDOnOff(false);\r\n}\r\n\r\n\r\nfunction pb_turnDOnOff(b_onOff) {\r\n\tthis.bCIBCDoCrsh = false;\r\n\r\n\t//If on: Don't submit (by default)\r\n\t//If off: Do submit.\r\n\tthis.bSbmtOnSuccess = !b_onOff;\r\n\tthis.iDDPS = this.iDfltDPS;\r\n\tthis.bDOn = b_onOff;\r\n\r\n\tif(b_onOff && this.bCIBCCrshDdb) {\r\n\t\tthis.bCrshAlrt = true;\r\n\t\tthis.bCrshDgnstcs = false;\r\n\t\tthis.bCrshThrow = false;\r\n\t} else {\r\n\t\tthis.bCrshAlrt = this.bOrigCrshAlrt;\r\n\t\tthis.bCrshDgnstcs = this.bOrigCrshDgnstcs;\r\n\t\tthis.bCrshThrow = this.bOrigCrshThrow;\r\n\t}\r\n}\r\n\r\nfunction pb_isCIBCOn() {\r\n\tvar b = ((!this.bDOn && this.bCIBCOnOff) ||\r\n\t\t(this.bDOn && this.bCIBCSctn && this.bCIBCDoCrsh));\r\n\r\n\tif(!df(b)) {\r\n\t\tcrsh("vf.vfbc.icibco1", this.isCIBCOn, "isCIBCOn (XCMAX sanity check): b is undefined?! [this.bDOn=" + this.bDOn + ", this.bCIBCOnOff=" + this.bCIBCOnOff + ", this.bCIBCDoCrsh=" + this.bCIBCDoCrsh + "]");\r\n\t}\r\n\r\n\treturn b;\r\n}\r\n\r\n\r\n\r\nfunction pb_isVfpdOn() {\r\n\treturn (df(this.bDOnDflt) && this.bDOnDflt != bVFPDInUrl);\r\n}\r\n\r\n\r\nfunction pb_stVfpdc(sb_on, sb_cibcOnOff, sb_onLink, sb_offLink, sb_resetLink, sb_successDDB, sb_cibcSection, sb_cibcCrshDdb, ai_dbgPerScrDDB, as_tstVFuncPosts, s_formName) {\r\n\tvar sF = "configVFPD";\r\n\r\n\tif(df(this.bDOnDflt)) { //XCMAX\r\n\t\tcrsh("vfbc.svfpdc1", this.stVfpdc, sF + " (XCMAX): Already called " + sF + "() for s_formName ('" + s_formName + "').");\r\n\t} //XCMAX\r\n\r\n\tthis.aFLStats;\r\n\tthis.bDOnDflt = gtSB(sF, "sb_on", sb_on, "ON", "OFF");\r\n\tthis.bDCIBCOnOff = gtSB(sF, "sb_cibcOnOff", sb_cibcOnOff, "CIBC_ON", "CIBC_OFF");\r\n\tthis.bOnLnk = gtSB(sF, "sb_onLink", sb_onLink, "ON_LNK", "NO_ON_LNK");\r\n\tthis.bOffLnk = gtSB(sF, "sb_offLink", sb_offLink, "OFF_LNK", "NO_OFF_LNK");\r\n\tthis.bResetLnk = gtSB(sF, "sb_resetLink", sb_resetLink, "RESET_LNK", "NO_RESET_LNK");\r\n\tthis.bSuccessDDB = gtSB(sF, "sb_successDDB", sb_successDDB, "SUCCESS_DDB", "NO_SUCCESS_DDB");\r\n\tthis.bCIBCSctn = gtSB(sF, "sb_cibcSection", sb_cibcSection, "CIBC_SCTN", "NO_CIBC_SCTN");\r\n\tthis.bCIBCCrshDdb = gtSB(sF, "sb_cibcCrshDdb", sb_cibcCrshDdb, "CIBC_CRSH_DDB", "NO_CIBC_CRSH_DDB");\r\n\r\n\tif(df(as_tstVFuncPosts)) { //XCMAX\r\n\t\tcibRA(sF + " (XCMAX)", "as_tstVFuncPosts", as_tstVFuncPosts);\r\n\t\tfor(var i = 0; i < as_tstVFuncPosts.length; i++) { //XCMAX\r\n\t\t\tfor(var j = (i + 1); j < as_tstVFuncPosts.length; j++) { //XCMAX\r\n\t\t\t\tif(as_tstVFuncPosts[i] == as_tstVFuncPosts[j] && //XCMAX\r\n\t\t\t\t \tas_tstVFuncPosts[i] != sDDB_DIVIDER && //XCMAX\r\n\t\t\t\t \tas_tstVFuncPosts[j] != sDDB_DIVIDER) { //XCMAX\r\n\t\t\t\t\tcrsh("vfbc.svfpdc2", this.stVfpdc, sF + " (XCMAX): as_tstVFuncPosts[" + i + "] and as_tstVFuncPosts[" + j + "] are the same: '" + as_tstVFuncPosts[i] + "'. Form name='" + this.sFrmNm + "'");\r\n\t\t\t\t} //XCMAX\r\n\t\t\t} //XCMAX\r\n\t\t} //XCMAX\r\n\t} //XCMAX\r\n\r\n\tif(df(ai_dbgPerScrDDB)) { //XCMAX\r\n\t\tcibRA(sF, "ai_dbgPerScrDDB", ai_dbgPerScrDDB); //XCMAX\r\n\t\tfor(var i = 0; i < ai_dbgPerScrDDB.length; i++) { //XCMAX\r\n\t\t\tif(!df(ai_dbgPerScrDDB) || !isNum(ai_dbgPerScrDDB[i], "false")) { //XCMAX\r\n\t\t\t\tcrsh("vfbc.svfpdc2", this.stVfpdc, sF_XCMAX + ": ai_dbgPerScrDDB[" + i + "] (" + ai_dbgPerScrDDB[i] + ") must be defined, and an integer.");\r\n\t\t\t} //XCMAX\r\n\t\t} //XCMAX\r\n\t} //XCMAX\r\n\r\n\tthis.asTstngVFuncPost = as_tstVFuncPosts;\r\n\tthis.aiDPSddb = ai_dbgPerScrDDB;\r\n\r\n\t//May be undefined, meaning 'form_vfpd__undefined'!!!\r\n\t//\r\n\t//Must have this same variable in VFBCfg\r\n\tthis.sFrmNm = s_formName;\r\n\r\n\tthis.turnDOnOff(this.bDOnDflt);\r\n}\r\n\r\nfunction gtVfbc(f_calling, s_callingFunc, s_formName) {\r\n\tif(!df(aVfbc[0].sFrmNm)) {\r\n\t\t//A form "named" undefined may only be when there's a\r\n\t\t//single call to configVF per page. This is verified in\r\n\t\t//completeVFLoad()\r\n\t\treturn aVfbc[0];\r\n\t}\r\n\r\n\t//There's at least one other element.\r\n\r\n\tvar sFrmNmLst = " Form names: ['";\r\n\tfor(var i = 0; i < aVfbc.length; i++) {\r\n\t\tif(i > 0) {\r\n\t\t\tsFrmNmLst += "', '";\r\n\t\t}\r\n\t\tsFrmNmLst += aVfbc[i].sFrmNm;\r\n\t\tif(s_formName == aVfbc[i].sFrmNm) {\r\n\t\t\treturn aVfbc[i];\r\n\t\t}\r\n\t}\r\n\tsFrmNmLst += "']";\r\n\r\n\tcrsh("vf.gc1", f_calling, s_callingFunc + " (XCMAX): No VFBCfg exists for a form named s_formName ('" + s_formName + "'). Must call loadVF(), configVF() and/or configVFPD() before calling this function. [aVfbc.length=" + aVfbc.length + "]" + sFrmNmLst);\r\n}\r\n\r\nfunction pb_setAFLS(a_flStats) {\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction wrt(s_tring) {\r\n\tdocument.writeln(s_tring);\r\n\treturn s_tring + '\n';\r\n}\r\n\r\nfunction wrtnl(s_tring) {\r\n\tdocument.write(s_tring);\r\n\treturn s_tring;\r\n}\r\n\r\n\r\nfunction df(v_ariable) {\r\n\treturn (v_ariable != undefined);\r\n}\r\n\r\n\r\n\r\nfunction addDelUrlP(s_urlq, b_pNeeded, s_urlp) {\r\n\tif(b_pNeeded == (s_urlq.indexOf(s_urlp) != -1)) {\r\n\t\t//Needed and already there...OR...\r\n\t\t//Not needed and already not there.\r\n\t\t//Done!\r\n\t\treturn s_urlq;\r\n\t}\r\n\r\n\t//They're opposite values.\r\n\r\n\tif(b_pNeeded) {\r\n\t\t//Needed, but not in url.\r\n\t\tif(s_urlq.length > 0) {\r\n\t\t\t//Preserve existing url params\r\n\t\t\treturn s_urlq + "&" + s_urlp;\r\n\t\t} else {\r\n\t\t\treturn "?" + s_urlp;\r\n\t\t}\r\n\r\n\t} else {\r\n\t\t//Not needed, but in url.\r\n\t\tvar iIdx = s_urlq.indexOf(s_urlp);\r\n\t\tvar iLen = s_urlp.length;\r\n\r\n\t\t//-1 is okay, because if length > 0, then it's at least ?vfpd\r\n\t\tif(s_urlq.substring((iIdx - 1), iIdx) == "&") {\r\n\t\t\tiIdx--;\r\n\t\t\tiLen++;\r\n\t\t}\r\n\r\n\t\tvar s = s_urlq.substring(0, iIdx) + s_urlq.substring((iIdx + iLen), s_urlq.length);\r\n\t\tif(s.substring(0, 2) == "?&") {\r\n\t\t\ts = "?" + s.substring(2, s.length);\r\n\t\t}\r\n\r\n\t\treturn (s == "?")\r\n\t\t\t? ""\r\n\t\t\t: s;\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\tvar sCNSTR_XCMAX = "SIFmt.constructor (XCMAX)";\r\n\r\n\r\n\r\nfunction SIFmt(s_msgTxtPostfix, si_rqdMin, si_rqdMax, si_altMin, si_altMax) {\r\n\tciMissing(SIFmt, sCNSTR_XCMAX, "s_msgTxtPostfix", s_msgTxtPostfix);\r\n\tciMissing(SIFmt, sCNSTR_XCMAX, "si_rqdMin", si_rqdMin);\r\n\tciMissing(SIFmt, sCNSTR_XCMAX, "si_rqdMax", si_rqdMax);\r\n\r\n\tif(s_msgTxtPostfix == 'Dec' || //XCMAX\r\n\t \ts_msgTxtPostfix == 'Email' || //XCMAX\r\n\t \ts_msgTxtPostfix == 'Int') { //XCMAX\r\n\t\tcrsh("snf.cnstr1", SIFmt, sCNSTR_XCMAX + ": s_msgTxtPostfix (currently '" + s_msgTxtPostfix + "') must not equal 'Dec', 'Email', or 'Int'.");\r\n\t} //XCMAX\r\n\r\n\t//Ascending order: Numbers, then _, then letters\r\n\tvar acLtrsDgtsUndrscr = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0']; //XCMAX\r\n\tfor(var i = 0; i < (s_msgTxtPostfix.length - 1); i++) { //XCMAX\r\n\t\tvar c = s_msgTxtPostfix.substring(i, (i + 1)).toLowerCase(); //XCMAX\r\n\t\tif(isInAscRA(c, acLtrsDgtsUndrscr)) { //XCMAX\r\n\t\t\tcontinue; //XCMAX\r\n\t\t} else { //XCMAX\r\n\t\t\tcrsh("snf.cnstr2", SIFmt, sCNSTR_XCMAX + ": s_msgTxtPostfix (currently '" + s_msgTxtPostfix + "') may not contain anything but letters, digits, and underscores. Character at index " + i + " ('" + c + "') is illegal.");\r\n\t\t} //XCMAX\r\n\t} //XCMAX\r\n\r\n\tif(df(si_altMin) ^ df(si_altMax)) { //XCMAX\r\n\t\t//Exactly one is defined, but not both.\r\n\t\tcrsh("snf.cnstr2", SIFmt, sCNSTR_XCMAX + ": si_altMin ('" + si_altMin + "') and si_altMax ('" + si_altMax + "') must both be either undefined or defined.");\r\n\t} //XCMAX\r\n\t//The alternate bounds are either both provided, or not.\r\n\r\n\tcibLnRng(si_rqdMin, si_rqdMax, "si_rqdMin", "si_rqdMax", ""); //XCMAX\r\n\tcibLnRng(si_altMin, si_altMax, "si_altMin", "si_altMax", "When provided, ");//XCMAX\r\n\r\n\r\n\t//Internal variables\r\n\t\tthis.sMTPost = s_msgTxtPostfix;\r\n\t\tthis.siRqMn = si_rqdMin;\r\n\t\tthis.siRqMx = si_rqdMax;\r\n\t\tthis.siLtMn = si_altMin;\r\n\t\tthis.siLtMx = si_altMax;\r\n\r\n\t\tthis.gtFmtV = pb_gtFmtV;\r\n\t\tthis.isFmtEq = pb_isFmtEq;\r\n\r\n\t\tthis.type = "SIFmt";\r\n}\r\n\r\n\r\nfunction pb_isFmtEq(si_fmt) {\r\n\tciMissing(this.isFmtEq, "isFmtEq (XCMAX)", "si_fmt", si_fmt);\r\n\r\n\treturn (si_fmt.siRqMn == this.siRqMn &&\r\n\t \tsi_fmt.siRqMx == this.siRqMx &&\r\n\t \tsi_fmt.siLtMn == this.siLtMn &&\r\n\t \tsi_fmt.siLtMx == this.siLtMx);\r\n}\r\n\r\n\r\n\r\nfunction gtDgts(s_tring) {\r\n\tciMissing(gtDgts, "gtDgts (XCMAX)", "s_tring", s_tring);\r\n\r\n\tif(/^\D$/.test(s_tring)) {\r\n\t\t//There are no numbers at all.\r\n\t\treturn "";\r\n\t}\r\n\t//There is at least one number.\r\n\r\n\tvar asNumberParts = s_tring.split(/\D/);\r\n\r\n\tvar sNumber = asNumberParts[0];\r\n\tfor(var i = 1; i < asNumberParts.length; i++) {\r\n\t\tsNumber += asNumberParts[i];\r\n\t}\r\n\r\n\treturn sNumber;\r\n}\r\n\r\n\r\n\r\nfunction pb_gtFmtV(s_value) {\r\n\tciMissing(this.gtFmtV, "gtSIFromFormat (XCMAX)", "s_value", s_value);\r\n\r\n\t//util_string.gtDgts()\r\n\tvar sDigits = gtDgts(s_value);\r\n\r\n\tvar siRqdPart;\r\n\tvar siAltPart;\r\n\tvar iStrippedLen = sDigits.length;\r\n\r\n\t//We're only comparing against the "minimum" bound, because\r\n\t//we know that the minimum and maximum formats are the same\r\n\t//length.\r\n\tif(iStrippedLen < this.siRqMn.length) {\r\n\t\t//The value is shorter than it is required to be.\r\n\t\treturn undefined;\r\n\r\n\t} //ELSE: The value is at least as long as required..\r\n\r\n\r\n\tif(iStrippedLen > this.siRqMn.length) {\r\n\t\t//The length of the value is greater than required, but\r\n\t\t//that's okay if there's an alternate format.\r\n\r\n\t\tif(!df(this.siLtMn)) {\r\n\t\t\t//No alternate format. The length is illegal.\r\n\t\t\treturn undefined;\r\n\r\n\t\t} //ELSE: There is an alternate format...\r\n\r\n\t\tif(iStrippedLen !=\r\n\t\t \t(this.siRqMn.length + this.siLtMn.length)) {\r\n\t\t\t//...but the length of the value is not equal to either\r\n\t\t\t//the required or required-plus-alternate formats length.\r\n\t\t\treturn undefined;\r\n\r\n\t\t} //ELSE: ...and it is equal to the required-plus-\r\n\t\t // alternate length.\r\n\r\n\t\tsiRqdPart = sDigits.substring(0, this.siRqMn.length);\r\n\t\tsiAltPart = sDigits.substring(this.siRqMn.length, iStrippedLen);\r\n\r\n\t} else { //The value's length is exactly the required\r\n\t //length.\r\n\t\tsiRqdPart = sDigits;\r\n\t\tsiAltPart = undefined;\r\n\t}\r\n\r\n\r\n\tif(!isInFrmtRng(siRqdPart, this.siRqMn, this.siRqMx)) {\r\n\t\t//The required part of the value is out of range.\r\n\t\treturn undefined;\r\n\r\n\t}\r\n\r\n\tif(df(siAltPart) &&\r\n\t \t!isInFrmtRng(siAltPart, this.siLtMn, this.siLtMx)) {\r\n\t\t//The alternate part has been provided, and that part of\r\n\t\t//the value is out of range.\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\t//The format is totaly valid for this SIFmt.\r\n\treturn sDigits;\r\n}\r\n\r\nfunction isInFrmtRng(si_valuePart, si_frmtPartMin, si_frmtPartMax) {\r\n\tvar iValuePart = parseInt(si_valuePart, 10);\r\n\tvar iFPartMin = parseInt(si_frmtPartMin, 10);\r\n\tvar iFPartMax = parseInt(si_frmtPartMax, 10);\r\n\r\n\treturn (iValuePart >= iFPartMin &&\r\n\t iValuePart <= iFPartMax);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction FLStats(frm_frmLmnt, fls_frm, a_prevFLS) {\r\n\tvar ffl = frm_frmLmnt;\r\n\tvar f = FLStats;\r\n\tvar sFLSC_XCMAX = "FLStats.constructor (XCMAX): ";\r\n\r\n\t//Parameter checking...START\r\n\t\t//Note that "sXCMAX" is part of these variables' names.\r\n\t\tciMissing(FLStats, sFLSC_XCMAX, "frm_frmLmnt", ffl);\r\n\r\n\t\t//Get the type of frm_frmLmnt...START\r\n\t\t\t//(This section is not a sanity check, but must be right here.)\r\n\t\t\tvar iFflTypeIdx = gtVRAIdx("fls.c0", ffl.type, asOBJ_TYPES);\r\n\t\t\tif(iFflTypeIdx == -1 &&\r\n\t\t\t \tdf(ffl.elements) &&\r\n\t\t\t \tdf(ffl.elements.length) &&\r\n\t\t \tdf(ffl.reset)) {\r\n\t\t\t\t//Forms have no "type" attribute, but they all have an\r\n\t\t\t\t//elements array, and a reset function. Hey, it's the\r\n\t\t\t\t//least I could do. :' )\r\n\r\n\t\t\t\t//asOBJ_TYPES[0]="form"\r\n\t\t\t\tiFflTypeIdx = 0;\r\n\t\t\t}\r\n\r\n\t\t\t//iFflTypeIdx now equals...\r\n\t\t\t//...-1 when it is a form element, but one we don't\r\n\t\t\t// care about.\r\n\t\t\t//...0 when it's the form (fls_frm must be undefined)\r\n\t\t\t//...[Some other asOBJ_TYPES array index] when it is a\r\n\t\t\t// form element and we do care about it.\r\n\t\t//Get the type of frm_frmLmnt...END\r\n\r\n\t\tif(df(fls_frm)) { //XCMAX\r\n\t\t if(iFflTypeIdx == 0) { //XCMAX\r\n\t\t\t\tcrsh("fls.c1", f, sFLSC_XCMAX + "fls_frm is provided, but frm_frmLmnt is also a 'form' object.");\r\n\t\t\t} //XCMAX\r\n\r\n\t\t\tciNotFLStats(sFLSC_XCMAX, "fls_frm", fls_frm);\r\n\t\t\tif(fls_frm.sType != "form") {//XCMAX\r\n\t\t\t\tcrsh("fls.c2", f, sFLSC_XCMAX + "fls_frm, when provided, must have an 'sType' equal to 'form'. Currently, fls_frm.sType='" + fls_frm.sType + "'.");\r\n\t\t\t} //XCMAX\r\n\t\t//ELSE: fls_frm is undefined\r\n\t\t} else { //XCMAX\r\n\t\t\tif(df(a_prevFLS)) { //XCMAX\r\n\t\t\t\tcrsh("fls.c3", f, sFLSC_XCMAX + "When fls_frm is not provided, a_prevFLS must also be undefined. Currently, a_prevFLS=['" + a_prevFLS.join("', '") + "'].");\r\n\t\t\t} //XCMAX\r\n\r\n\t\t\tif(iFflTypeIdx != 0) { //XCMAX\r\n\t\t\t\tcrsh("fls.c4", f, sFLSC_XCMAX + "When fls_frm is not provided, frm_frmLmnt must be a form object. Currently, frm_frmLmnt.type=" + ffl.type + ", frm_frmLmnt.toString()=[" + ffl.toString() + "].");\r\n\t\t\t} //XCMAX\r\n\t\t} //XCMAX\r\n\r\n\r\n\t\tif(df(a_prevFLS)) { //XCMAX\r\n\t\t\tcibRA(sFLSC_XCMAX, "a_prevFLS", a_prevFLS);\r\n\t\t} //XCMAX\r\n\t//Parameter checking...END\r\n\r\n\t//Everything seems good now...\r\n\r\n\t//Variables and functions...START\r\n\t\t//Basic info\r\n\t\t\tthis.sNm;\r\n\t\t\tthis.sType;\r\n\t\t\tthis.obj;\r\n\t\t\tthis.sAftrFrmNm;\r\n\t\t\tthis.sAftrAttrNm;\r\n\t\t\tthis.iTotOpts;\r\n\t\t\tthis.flsFrm; //A pointer to the form's FLStats\r\n\t\t\tthis.sUsrErr;\r\n\r\n\t\tthis.bUseThisFLS = false;\r\n\t\tthis.type = "FLStats";\r\n\r\n\t\tthis.useThisFLS = pb_useThisFLS;\r\n\t\tthis.gtCd4Attr = pb_gtCd4Attr;\r\n\t\tthis.gtCdAttrNm = pb_gtCdAttrNm;\r\n\t\tthis.gtCdFLSNm = pb_gtCdFLSNm;\r\n\t\tthis.gtAttrVRaw = pb_gtAttrVRaw;\r\n\t\tthis.gtEvlCdLmntAttrNm = pb_gtEvlCdLmntAttrNm;\r\n\t\tthis.gtEvlCdObjNm = pb_gtEvlCdObjNm;\r\n\t\tthis.gtEvalCode = pv_gtEvalCode;\r\n\t\tthis.isAttrAssc2Lmnt = pb_isAttrAssc2Lmnt;\r\n\t\tthis.gtAttrV = pb_gtAttrV;\r\n\t\tthis.isLmntVal1OrMore = pb_isLmntVal1OrMore;\r\n\t\tthis.gtLmntValSnglr = pb_gtLmntValSnglr;\r\n\t\tthis.gtLmntOptsTotal = pb_gtLmntOptsTotal;\r\n\t\tthis.gtLmntOptsChosen = pb_gtLmntOptsChosen;\r\n\t\tthis.ciFrm1OrMore = pv_ciFrm1OrMore; //XCMAX\r\n\t\tthis.gtFLS4Frm = pv_gtFLS4Frm;\r\n\t\tthis.gtLmntStats = pv_gtLmntStats;\r\n\t\tthis.unassociateFalseBS = pv_unassociateFalseBS;\r\n\t//Variables and functions...END\r\n\r\n\tif(df(fls_frm)) {\r\n\t\t//This is a form element, not the form itself. All form\r\n\t\t//elements have a pointer to the FLStats for the form.\r\n\t\tthis.flsFrm = fls_frm;\r\n\t}\r\n\r\n\t//validate_form.gtStrIdx() and .asOBJ_TYPES\r\n\tif(iFflTypeIdx == -1) {\r\n\t\t//This is a form element (as best we can determine above),\r\n\t\t//but it's a type we don't care about. Perhaps it's a\r\n\t\t//submit or reset or button or hidden...\r\n\t\tthis.bUseThisFLS = false;\r\n\r\n\r\n\t//ELSE: We care about this type of element.\r\n\r\n\t} else if(!df(fls_frm)) {\r\n\t\t//This is the form itself.\r\n\t\tthis.gtFLS4Frm(ffl);\r\n\t\tthis.bUseThisFLS = true;\r\n\r\n\t} else {\r\n\t\t//This is an element in the form\r\n\t\tthis.bUseThisFLS = this.gtLmntStats(ffl, a_prevFLS);\r\n\t}\r\n\r\n\tif(!this.bUseThisFLS) {\r\n\t\t//If you don't return now, the below sanity checks and\r\n\t\t//unassociateFalseBS() calls will crash.\r\n\t\treturn;\r\n\t}\r\n\r\n\t//Must be after this.bUseThisFLS is known to be true.\r\n\tif(!df(ffl.name) || //XCMAX\r\n\t \tffl.name == "") { //XCMAX\r\n\t\tcrsh("fls.c5", f, sFLSC_XCMAX + "frm_frmLmnt.name ([" + ffl.name + "]) must be defined, at least one character in length, and unique among all forms in this web page.");\r\n\t} //XCMAX\r\n\r\n\tthis.sNm = ffl.name;\r\n\r\n\tif(gtVRAIdx("fls.c6", this.sType, asOBJ_TYPES) == -1) {//XCMAX\r\n\t\tcrsh("fls.c7", f, sFLSC_XCMAX + "this.sType ('" + this.sType + "') is not one of these valid types: '" + asOBJ_TYPES.join("', '") + "'.");\r\n\t}//XCMAX\r\n\r\n\tif(df(this.iTotOpts) && //XCMAX\r\n\t \tthis.iTotOpts < 2) { //XCMAX\r\n\t\tcrsh("fls.c1", f, sFLSC_XCMAX + " (this.sNm='" + this.sNm + "'): This element is a multiple-value element, but there are less than two options?! One checkbox checkbox sets should be considered singular.\n\n" + sXCMAX);\r\n\t} //XCMAX\r\n\r\n\t//Regarding all boolean string attributes that happen to\r\n\t//both undefined and equal to "false": Undefine them\r\n\t//entirely. A boolean sting attribute equal to "false" is\r\n\t//one that might as well not be associated at all. This\r\n\t//makes the actual value consistent with the\r\n\t//documentation, that boolean strings are only recognized\r\n\t//when equal to "true" (assuming a legal boolean string\r\n\t//value).\r\n\r\n\t//validate_form.asVF_ATTRS\r\n\t//asVF_ATTRS[7]="bsNoBadSubStrs"\r\n\tthis.unassociateFalseBS(7);\r\n\t//asVF_ATTRS[10]="bsGlobalTrimSpaces"\r\n\tthis.unassociateFalseBS(10);\r\n\t//asVF_ATTRS[11]="bsTrimSpaces"\r\n\tthis.unassociateFalseBS(11);\r\n\t//asVF_ATTRS[12]="bsDontTrimSpaces"\r\n\tthis.unassociateFalseBS(12);\r\n}\r\n\r\n\r\n\r\n\r\nfunction gtAFLSUsrErrs(a_flStats, s_header, s_linePre, s_footer) {\r\n\tvar sF_XCMAX = "gtAFLSUsrErrs (XCMAX)";\r\n\tcibAFLS(sF_XCMAX, "a_flStats", a_flStats);\r\n\tciMissing(gtAFLSUsrErrs, sF_XCMAX, "s_header", s_header);\r\n\tciMissing(gtAFLSUsrErrs, sF_XCMAX, "s_linePre", s_linePre);\r\n\tciMissing(gtAFLSUsrErrs, sF_XCMAX, "s_footer", s_footer);\r\n\r\n\tvar sErrors = "";\r\n\tfor(var i = 0; i < a_flStats.length; i++) {\r\n\t\tif(df(a_flStats[i].sUsrErr)) {\r\n\t\t\tsErrors += s_linePre + a_flStats[i].sUsrErr;\r\n\r\n\t\t\tif(i < (a_flStats.length - 1)) {\r\n\t\t\t\tsErrors += "\n";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif(sErrors == "") { //XCMAX\r\n\t\tcrsh("os.guefaos1", gtAFLSUsrErrs, sF_XCMAX + "No element in a_flStats has a defined value for sUsrErr.");\r\n\t} //XCMAX\r\n\r\n\treturn s_header + sErrors + s_footer;\r\n}\r\n\r\n\r\n\r\nfunction gtAFLS(f_orm) {\r\n\tciMissing(gtAFLS, "gtAFLS (XCMAX)", "f_orm", f_orm);\r\n\r\n\tvar aFLStats = new Array(1);\r\n\r\n\taFLStats[0] = new FLStats(f_orm);\r\n\r\n\t//...and then each element within.\r\n\tfor(var i = 0; i < f_orm.elements.length; i++) {\r\n\t\t//Passing in aFLStats is how we keep track of array\r\n\t\t//elements (chk/rdo/slm) as a whole, rather than each\r\n\t\t//array element in it.\r\n\t\tvar fls = new FLStats(f_orm[i], aFLStats[0], aFLStats);\r\n\t\tif(fls.useThisFLS()) {\r\n\t\t\taFLStats[aFLStats.length] = fls;\r\n\t\t}\r\n\t}\r\n\r\n\treturn aFLStats;\r\n}\r\n\r\n\r\nfunction pb_useThisFLS() {\r\n\tciMissing(this.useThisFLS, "useThisFLS (XCMAX) [This function may only be called once per object, after which time this.bUseThisFLS is undefined.]", "this.bUseThisFLS", this.bUseThisFLS);\r\n\r\n\tvar b = this.bUseThisFLS;\r\n\tthis.bUseThisFLS = undefined;\r\n\treturn b;\r\n}\r\n\r\n\r\n\r\nfunction pb_gtCd4Attr(s_attrNm) {\r\n\t//util_string.gtCd4V()\r\n\treturn this.gtCdAttrNm(s_attrNm) + " = " + gtCd4V(this.gtAttrV(s_attrNm)) + ";\n";\r\n}\r\n\r\n\r\nfunction pb_gtCdAttrNm(s_attrNm) {\r\n\tciMissing(this.gtCdAttrNm, "gtCdAttrNm (XCMAX)", "s_attrNm", s_attrNm);\r\n\r\n\tif(this.sType == "form") {\r\n\t\treturn this.sNm + "." + s_attrNm;\r\n\t} else {\r\n\t\treturn this.flsFrm.sNm + this.sAftrFrmNm + this.sNm + "." + s_attrNm + this.sAftrAttrNm;\r\n\t}\r\n}\r\n\r\n\r\nfunction pb_gtCdFLSNm() {\r\n\tif(this.sType == "form") {\r\n\t\treturn this.sNm;\r\n\t} else {\r\n\t\treturn this.flsFrm.sNm + this.sAftrFrmNm + this.sNm + this.sAftrAttrNm;\r\n\t}\r\n}\r\n\r\n\r\nfunction pb_gtAttrVRaw(s_attrNm) {\r\n\treturn eval(this.gtEvlCdLmntAttrNm(s_attrNm));\r\n}\r\n\r\n\r\nfunction pb_isAttrAssc2Lmnt(s_attrNm) {\r\n\treturn df(this.gtAttrVRaw(s_attrNm));\r\n}\r\n\r\n\r\nvar asSUB_RNG_ATTRS = ['dDecMin', 'dDecMax', 'iIntMin', 'iIntMax', 'iMinLength', 'iMaxLength', 'maxLength', 'iMCMin', 'iMCMax']; //XCMAX\r\n\r\n\r\n\r\nfunction pb_gtAttrV(s_attrNm) {\r\n\t//validate_form.asVF_ATTRS and gtVRAIdx()\r\n\tif(gtVRAIdx("gtAttrV", s_attrNm, asVF_ATTRS) == -1 &&//XCMAX\r\n\t \tgtVRAIdx("gtAttrV", s_attrNm, asSUB_RNG_ATTRS) == -1) {//XCMAX\r\n\t\tcrsh("fls.gav1", this.gtAttrV, "gtAttrV (XCMAX): s_attrNm ('" + s_attrNm + "') is not a legal attribute. Must exist in either validate_form.asVF_ATTRS or fl_stats.asSUB_RNG_ATTRS.\n\n asVF_ATTRS=\n['" + asVF_ATTRS.join("', '") + "'])\n\nasSUB_RNG_ATTRS=\n(['" + asSUB_RNG_ATTRS.join("', '") + "'])");\r\n\t} //XCMAX\r\n\r\n\tif(!this.isAttrAssc2Lmnt(s_attrNm)) { //XCMAX\r\n\t\tcrsh("fls.gav2", this.gtAttrV, "gtAttrV (XCMAX): isAttrAssc2Lmnt(s_attrNm) equals false. s_attrNm='" + s_attrNm + "', this.sNm='" + this.sNm + "', this.sType='" + this.sType + "'.");\r\n\t} //XCMAX\r\n\r\n\treturn this.gtAttrVRaw(s_attrNm);\r\n}\r\n\r\n\r\nfunction pb_isLmntVal1OrMore() {\r\n\treturn (!df(this.iTotOpts));\r\n}\r\n\r\n\r\nfunction pb_gtLmntValSnglr() {\r\n\tthis.ciFrm1OrMore("gtLmntValSnglr", false);//XCMAX\r\n\r\n\t//This element can have only one value, and is one of the\r\n\t//following types:\r\n\t// - text\r\n\t// - textarea\r\n\t// - radio\r\n\t// - select-one\r\n\t// - checkbox (with one element only)\r\n\r\n\tvar vValSnglr;\r\n\tif(this.sType == "select-one" &&\r\n\t\t\tthis.obj.selectedIndex != -1) {\r\n\t\tvValSnglr = this.obj.options[this.obj.selectedIndex].value;\r\n\r\n\t} else if(this.sType == "radio") {\r\n\t\tvar rdo = eval(this.gtEvlCdObjNm());\r\n\r\n\t\tfor(var i = 0; i < rdo.length; i++) {\r\n\t\t\tif(rdo[i].checked) {\r\n\t\t\t\tvValSnglr = rdo[i].value;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t} else if(this.sType == "checkbox") {\r\n\t\t//This is the only element in this checkbox set.\r\n\t\tif(this.checked) {\r\n\t\t\tvValSnglr = this.obj.value;\r\n\t\t}\r\n\r\n\t} else {\r\n\t\tvValSnglr = this.obj.value;\r\n\t}\r\n\r\n\treturn (vValSnglr == "")\r\n\t\t? undefined\r\n\t\t: vValSnglr;\r\n}\r\n\r\n\r\nfunction pb_gtLmntOptsTotal() {\r\n\tthis.ciFrm1OrMore("gtLmntOptsTotal", true);//XCMAX\r\n\treturn this.iTotOpts;\r\n}\r\n\r\n\r\nfunction pb_gtLmntOptsChosen() {\r\n\tthis.ciFrm1OrMore("gtLmntOptsChosen", true);//XCMAX\r\n\r\n\tvar iOptsChosen = 0;\r\n\r\n\tif(this.sType == "checkbox" &&\r\n\t \tthis.flsFrm.obj.elements[this.sNm].length > 1) {\r\n\t\t//Definitely more than one checkbox element in this\r\n\t\t//checkbox set. Checkbox sets with only one element in it\r\n\t\t//are single-valued.\r\n\t\tfor(var i = 0; i < this.iTotOpts; i++) {\r\n\t\t\tif(this.flsFrm.obj.elements[this.sNm][i].checked) {\r\n\t\t\t\tiOptsChosen++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t} else\tif(this.sType == "select-multiple") {\r\n\t\tfor(var i = 0; i < this.iTotOpts; i++) {\r\n\t\t\tif(this.obj.options[i].selected) {\r\n\t\t\t\tiOptsChosen++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn iOptsChosen;\r\n}\r\n\r\nfunction pv_ciFrm1OrMore(s_callingFunc, b_1OrMore) {//XCMAX\r\n\tif(this.sType == "form" || //XCMAX\r\n\t \tthis.isLmntVal1OrMore() == b_1OrMore) { //XCMAX\r\n\t\tcrsh("fls.cif1om", ciFrm1OrMore, s_callingFunc + " (XCMAX) ('" + this.sNm + "'): sType may not equal 'form', and/or b_1OrMore=" + b_1OrMore + " must equal isLmntVal1OrMore() (" + isLmntVal1OrMore() + ").");\r\n\t} //XCMAX\r\n} //XCMAX\r\n\r\n\r\nfunction pv_gtFLS4Frm(f_orm) {\r\n\tthis.obj = f_orm;\r\n\tthis.sType = "form";\r\n\tthis.sAftrFrmNm = undefined;\r\n\tthis.sAftrAttrNm = undefined;\r\n\tthis.iTotOpts = undefined;\r\n\r\n\t//This enforces the uniqueness restriction noted in the\r\n\t//frm_frmLmnt parameter documentation of the FLStats\r\n\t//constructor.\r\n\tvar bNameFound = false;\r\n\tfor(var i = 0; i < document.forms.length; i++) {\r\n\t\tif(!bNameFound) {\r\n\t\t\tif(document.forms[i].name == f_orm.name) {\r\n\t\t\t\t//Found the first form having this form's name.\r\n\t\t\t\tbNameFound = true;\r\n\t\t\t}\r\n\r\n\t\t\t//Still have yet to find a form having this form's\r\n\t\t\t//name.\r\n\r\n\t\t} else if(document.forms[i].name == f_orm.name) {//XCMAX\r\n\t\t\t//A form with this name was already found. It is, but\r\n\t\t\t//shouldn't be found again.\r\n\t\t\tcrsh("fls.gosff", this.gtFLS4Frm, "FLStats.constructor (XCMAX): The name of this form is '" + f_orm.name + "', but at least one other form on this page has that same name.");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nfunction pv_gtLmntStats(frm_lmnt, a_prevFLS) {\r\n\tthis.sType = frm_lmnt.type;\r\n\r\n\t//All the element types: text, textarea, radio,\r\n\t//select-one, checkbox, select-multiple\r\n\r\n\tthis.iTotOpts = undefined;\r\n\tif(this.sType == "checkbox" &&\r\n\t \tthis.flsFrm.obj.elements[frm_lmnt.name].length > 1) {\r\n\t\tthis.iTotOpts = this.flsFrm.obj.elements[frm_lmnt.name].length;\r\n\r\n\t} else\tif(this.sType == "select-multiple") {\r\n\t\tthis.iTotOpts = frm_lmnt.options.length;\r\n\t}\r\n\r\n\t//If only one possible choice, then this.iTotOpts remain\r\n\t//undefined.\r\n\r\n\tif(this.sType == "radio" ||\r\n\t \t(df(this.iTotOpts) && this.sType == "checkbox")) {\r\n\t\tfor(var i = 0; i < a_prevFLS.length; i++) {\r\n\t\t\tif(a_prevFLS[i].sNm == frm_lmnt.name) {\r\n\t\t\t\t//Already analyzed.\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif(this.sType == "radio" ||\r\n\t \tthis.sType == "checkbox") {\r\n\t\tthis.obj = this.flsFrm.obj[frm_lmnt.name];\r\n\t\tthis.sAftrFrmNm = "['";\r\n\t\tthis.sAftrAttrNm = "']";\r\n\r\n\t} else {\r\n\t\tthis.obj = frm_lmnt;\r\n\t\tthis.sAftrFrmNm = ".";\r\n\t\tthis.sAftrAttrNm = "";\r\n\t}\r\n\r\n\t//If this.iTotOpts is undefined, then this is a singular\r\n\t//value element. Otherwise, it is a multiple-value object.\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\nfunction pv_unassociateFalseBS(i_attrIdx) {\r\n\tvar sAttrNm = asVF_ATTRS[i_attrIdx];\r\n\tif(this.isAttrAssc2Lmnt(sAttrNm) &&\r\n\t \tthis.gtAttrV(sAttrNm) == "false") {\r\n\t\teval(this.gtEvlCdLmntAttrNm(sAttrNm) + " = undefined;\n");\r\n\t}\r\n}\r\n\r\n\r\nfunction pb_gtEvlCdLmntAttrNm(s_attrNm) {\r\n\tciMissing(this.gtEvlCdLmntAttrNm, "gtEvlCdLmntAttrNm (XCMAX)", "s_attrNm", s_attrNm);\r\n\treturn this.gtEvalCode(s_attrNm);\r\n}\r\n\r\n\r\nfunction pb_gtEvlCdObjNm() {\r\n\treturn this.gtEvalCode(undefined);\r\n}\r\n\r\n\r\n\r\nfunction pv_gtEvalCode(s_attrNm) {\r\n\tvar sAttrCd;\r\n\tif(!df(s_attrNm)) {\r\n\t\tsAttrCd = "";\r\n\t} else {\r\n\t\tsAttrCd = "." + s_attrNm;\r\n\t}\r\n\r\n\tif(this.sType == "form") {\r\n\t\t//this.flsFrm may not exist if this is the\r\n\t\t//cnstr!\r\n\t\treturn "document." + this.sNm + sAttrCd;\r\n\r\n\t} else {\r\n\t\t//this.flsFrm should exist, since the form should be\r\n\t\t//created before any elements.\r\n\t\treturn "document." + this.flsFrm.sNm + this.sAftrFrmNm + this.sNm + sAttrCd + this.sAftrAttrNm;\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t\r\n\r\n\r\n\t//Private variables...START\r\n\t\tvar cSS_DELIM = "\~";\r\n\t\tvar sSS_CURRLEN = 'CURRLEN';\r\n\t\tvar sSS_BOUND_MIN = 'RANGE_MIN';\r\n\t\tvar sSS_BOUND_MAX = 'RANGE_MAX';\r\n\t\tvar sSS_BSS_LIST = 'BSS_LIST';\r\n\t\tvar sSS_BSS_FOUND = 'BSS_FOUND';\r\n\t\tvar sSS_OPTS_TOT = 'OPTS_TOTAL';\r\n\t\tvar sSS_OPTS_CHSN = 'OPTS_CHOSEN';\r\n\r\n\t\tvar aFLStats = undefined;\r\n\t//Private variables...END\r\n\r\n\t//As defined in validate_form.js. This notifies all other\r\n\t//code that this JavaScript file has indeed been loaded.\r\n\tbLDD_GUEC = true;\r\n\r\n\r\nfunction gtUsrErrCnt(a_flStats) {\r\n\r\n\t//Start off with no errors.\r\n\tvar iTotalErrors = 0;\r\n\r\n\t//"i = 1" because a_flStats[0] is the form, and therefore has no value.\r\n\tfor(var i = 1; i < a_flStats.length; i++) {\r\n\t\tvar fls = a_flStats[i];\r\n\r\n\t\t//Assume no error. Eliminate previous ones.\r\n\t\tfls.sUsrErr = undefined;\r\n\r\n\r\n\t\tvar bTxtPwd = (fls.sType == "text" ||\r\n\t\t\tfls.sType == "password");\r\n\t\tvar bString = (bTxtPwd || fls.sType == "textarea");\r\n\r\n\r\n\t\tif(bString) {\r\n\t\t\t//Trimming has highest precedence.\r\n\t\t\ttrimStringLmnt(fls);\r\n\t\t}\r\n\r\n\r\n\t\t//Get the current value for this form elements.\r\n\t\t\tvar iOptsChosen;\r\n\t\t\tvar vValSnglr;\r\n\t\t\tif(fls.isLmntVal1OrMore()) {\r\n\t\t\t\tvValSnglr = fls.gtLmntValSnglr();\r\n\t\t\t} else {\r\n\t\t\t\tiOptsChosen = fls.gtLmntOptsChosen();\r\n\t\t\t}\r\n\r\n\t\t\t//If iOptsChosen is undefined, then this element is a\r\n\t\t\t//singular-value element, even if vValSnglr is\r\n\t\t\t//undefined. No value (or "") in a text box, for\r\n\t\t\t//instance, is fine.\r\n\r\n\t\t//Required has second-highest precedence.\r\n\t\tif(hasRequiredError(fls, iOptsChosen, vValSnglr)) {\r\n\t\t\t//The error message has been set into fls.sUsrErr.\r\n\t\t\tiTotalErrors++;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\t//If we've reached here, then...\r\n\t\t//...the value is not required and is...\r\n\t\t// ...not missing\r\n\t\t// ...missing\r\n\t\t//...the value is required and is not missing\r\n\r\n\t\tif((!df(vValSnglr) && !df(iOptsChosen)) ||\r\n\t\t \t(df(iOptsChosen) && iOptsChosen == 0)) {\r\n\t\t\t//(DON'T TOUCH OR RE-FORMAT THIS COMMENT)\r\n\t\t\t//Nothing further to check, because there's no\r\n\t\t\t//value. Go onto the next element.\r\n\r\n\t\t\t//This is *not* an error, which is why\r\n\t\t\t//"iTotalErrors++" is not here!\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\r\n\t\t//This is not applicable with sif text/password\r\n\t\t//elements, so it can be done before sif attributes are\r\n\t\t//analyzed.\r\n\t\tif(bString && hasStrLnError(fls, vValSnglr)) {\r\n\t\t\tiTotalErrors++;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\r\n\t\tif(bTxtPwd) {\r\n\t\t\tif(hasTxtPwdError(fls, vValSnglr)) {\r\n\t\t\t\tiTotalErrors++;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t} else if(fls.sType == "textarea") { //XCSTD (with below)\r\n\t\t\t//Nothing txa-specific to check.\r\n\r\n\t\t} else if(fls.sType == "radio" || fls.sType == "select-one") { //XCSTD (with below)\r\n\t\t\t//Nothing rdo/sl1-specific to check.\r\n\r\n\t\t} else if(fls.sType == "checkbox" || fls.sType == "select-multiple") {\r\n\r\n\t\t\t//A checkbox set with one element is singular.\r\n\t\t\t//A checkbox set with more than one element is multiple\r\n\t\t\t//A radio set is always singular.\r\n\t\t\tif(hasChkSlmError(fls, iOptsChosen, vValSnglr)) {\r\n\t\t\t\tiTotalErrors++;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t} else { //XCSTD (with two above)\r\n\t\t\tcrsh("gue1", gtUsrErrCnt, "gtUsrErrCnt (XCSTD): Unknown type: a_flStats[" + i + "].sType='" + fls.sType + "'.");\r\n\t\t}\r\n\r\n\t\t//Bad sub-strings has the lowest priority of all.\r\n\t\tif(bString) {\r\n\t\t\tif(hasBSSError(fls, vValSnglr)) {\r\n\t\t\t\tiTotalErrors++;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn iTotalErrors;\r\n}\r\n\r\n\r\n\r\nfunction initVF() {\r\n\tfor(var i = 0; i < aVfbc.length; i++) {\r\n\t\tstAFLSvf(undefined, aVfbc[i].sFrmNm)\r\n\t}\r\n\r\n\t//utility.js\r\n\t\tbCrshd = false;\r\n\t\tsCrshCd = undefined;\r\n\t\tsCrshMsg = undefined;\r\n\t\tfCrsh = undefined;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n//Compatibility configuration...START\r\n\t//documentation/unit_test/unit_tests.html#attribute_compatibility\r\n\r\n\t//Every object-type recognized be validate_form.js\r\n\t\tvar cotFrm = new CmptblOTA(true, "form");\r\n\t\tvar cotTxt = new CmptblOTA(true, "text");\r\n\t\tvar cotPwd = new CmptblOTA(true, "password");\r\n\t\tvar cotTxa = new CmptblOTA(true, "textarea");\r\n\t\tvar cotRdo = new CmptblOTA(true, "radio");\r\n\t\tvar cotSl1 = new CmptblOTA(true, "select-one");\r\n\t\tvar cotChk = new CmptblOTA(true, "checkbox");\r\n\t\tvar cotSlm = new CmptblOTA(true, "select-multiple");\r\n\r\n\t\tvar asOBJ_TYPES = ["form", "text", "password", "textarea", "radio", "select-one", "checkbox", "select-multiple"];\r\n\t\tvar aCMPTBL_OBJ_TYPES = [cotFrm, cotTxt, cotPwd, cotTxa, cotRdo, cotSl1, cotChk, cotSlm];\r\n\t//Every attribute type (except "sMsgTxt[SIFmt]" ones)\r\n\t//recognized by validate_form.js\r\n\t\tvar ca_sMr = new CmptblOTA(false, "sMsgRequired");\r\n\t\tvar ca_sMtd = new CmptblOTA(false, "sMsgTxtDec");\r\n\t\tvar ca_sMte = new CmptblOTA(false, "sMsgTxtEmail");\r\n\t\tvar ca_sMti = new CmptblOTA(false, "sMsgTxtInt");\r\n\t\tvar ca_sMbl = new CmptblOTA(false, "sMsgBadLength");\r\n\t\tvar ca_sMmcr = new CmptblOTA(false, "sMsgMCRange");\r\n\t\tvar ca_asGbss = new CmptblOTA(false, "asGlobalBadSubStrs");\r\n\t\tvar ca_bsNbss = new CmptblOTA(false, "bsNoBadSubStrs");\r\n\t\tvar ca_asBss = new CmptblOTA(false, "asBadSubStrs");\r\n\t\tvar ca_sMbss = new CmptblOTA(false, "sMsgBadSubStr");\r\n\t\tvar ca_bsGts = new CmptblOTA(false, "bsGlobalTrimSpaces");\r\n\t\tvar ca_bsDts = new CmptblOTA(false, "bsDontTrimSpaces");\r\n\t\tvar ca_bsTs = new CmptblOTA(false, "bsTrimSpaces");\r\n\r\n\t\tvar aCMPTBL_ATTRS = [ca_sMr, ca_sMtd, ca_sMte, ca_sMti, ca_sMbl, ca_sMmcr, ca_asGbss, ca_bsNbss, ca_asBss, ca_sMbss, ca_bsGts, ca_bsDts, ca_bsTs];\r\n\t\tvar asVF_ATTRS = //idx\r\n\t\t\t[ca_sMr.sNm, //0,\r\n\t\t\t ca_sMtd.sNm, //1,\r\n\t\t\t ca_sMte.sNm, //2,\r\n\t\t\t ca_sMti.sNm, //3,\r\n\t\t\t ca_sMbl.sNm, //4,\r\n\t\t\t ca_sMmcr.sNm, //5,\r\n\t\t\t ca_asGbss.sNm, //6,\r\n\t\t\t ca_bsNbss.sNm, //7,\r\n\t\t\t ca_asBss.sNm, //8,\r\n\t\t\t ca_sMbss.sNm, //9,\r\n\t\t\t ca_bsGts.sNm, //10,\r\n\t\t\t ca_bsDts.sNm, //11,\r\n\t\t\t ca_bsTs.sNm]; //12,\r\n\r\n\t\t//\r\n\t\t//(sMsgTxt[SIFmt], too: "sif")\r\n\t\t//\r\n\r\n\t//Define which attributes are compatible with a given\r\n\t//object-type\r\n\t\t//The length of ca4TxtPwd is used by stASIF()\r\n\t\tvar ca4TxtPwd = [ca_sMr, ca_sMtd, ca_sMte, ca_sMti, ca_sMbl, ca_bsNbss, ca_asBss, ca_sMbss, ca_bsDts, ca_bsTs];\r\n\t\tvar ca4ChkSlm = [ca_sMr, ca_sMmcr];\r\n\r\n\t\tcotFrm.addGdAtts4OT([ca_bsGts, ca_asGbss]);\r\n\r\n\t\tcotTxt.addGdAtts4OT(ca4TxtPwd); //sif\r\n\t\tcotPwd.addGdAtts4OT(ca4TxtPwd); //sif\r\n\r\n\t\tcotTxa.addGdAtts4OT([ca_sMr, ca_sMbl, ca_bsNbss, ca_asBss, ca_sMbss, ca_bsDts, ca_bsTs]);\r\n\t\tcotRdo.addGdAtts4OT([ca_sMr]);\r\n\t\tcotSl1.addGdAtts4OT([ca_sMr]);\r\n\t\tcotChk.addGdAtts4OT(ca4ChkSlm);\r\n\t\tcotSlm.addGdAtts4OT(ca4ChkSlm);\r\n\r\n\t//Define which object-types are compatible with a given\r\n\t//attribute.\r\n\t\tvar acotTxtPwd = [cotTxt, cotPwd];\r\n\t\tvar acotStrings = [cotTxt, cotPwd, cotTxa];\r\n\r\n\t\tca_sMr.stGoodOTs4Attr([cotTxt, cotPwd, cotTxa, cotRdo, cotSl1, cotChk, cotSlm]);\r\n\t\tca_sMtd.stGoodOTs4Attr(acotTxtPwd);\r\n\t\tca_sMte.stGoodOTs4Attr(acotTxtPwd);\r\n\t\tca_sMti.stGoodOTs4Attr(acotTxtPwd);\r\n\t\tca_sMbl.stGoodOTs4Attr(acotStrings);\r\n\t\tca_asBss.stGoodOTs4Attr(acotStrings);\r\n\t\tca_sMbss.stGoodOTs4Attr(acotStrings);\r\n\t\tca_bsDts.stGoodOTs4Attr(acotStrings);\r\n\t\tca_bsTs.stGoodOTs4Attr(acotStrings);\r\n\t\tca_bsNbss.stGoodOTs4Attr(acotStrings);\r\n\t\tca_sMmcr.stGoodOTs4Attr([cotChk, cotSlm]);\r\n\t\tca_asGbss.stGoodOTs4Attr([cotFrm]);\r\n\t\tca_bsGts.stGoodOTs4Attr([cotFrm]);\r\n\r\n\t//Define which (other) attributes are *in*compatible with\r\n\t//a given attribute.\r\n\t\t//Adding [] is not possible, so commented out. Still\r\n\t\t//listed though, for completeness.\r\n\t\t//ca_sMr.addBdAtts4Att([]);\r\n\t\tca_sMtd.addBdAtts4Att([ca_sMte, ca_sMti]); //sif\r\n\t\tca_sMte.addBdAtts4Att([ca_sMtd, ca_sMti]); //sif\r\n\t\tca_sMti.addBdAtts4Att([ca_sMtd, ca_sMte, ca_sMbl]); //sif\r\n\t\tca_sMbl.addBdAtts4Att([ca_sMti]); //sif\r\n\t\t//ca_sMmcr.addBdAtts4Att([]);\r\n\t\t//ca_asGbss.addBdAtts4Att([]);\r\n\t\tca_bsNbss.addBdAtts4Att([ca_asBss, ca_sMbss]);\r\n\t\tca_asBss.addBdAtts4Att([ca_bsNbss]);\r\n\t\tca_sMbss.addBdAtts4Att([ca_bsNbss]);\r\n\t\t//ca_bsGts.addBdAtts4Att([]);\r\n\t\tca_bsTs.addBdAtts4Att([ca_bsDts]); //sif\r\n\t\tca_bsDts.addBdAtts4Att([ca_bsTs]); //sif\r\n//Compatibility configuration...START\r\n\r\n\tfunction gtCOTA(a_cota, s_name) {\r\n\t\tfor(var i = 0; i < a_cota.length; i++) {\r\n\t\t\tif(s_name == a_cota[i].sNm) {\r\n\t\t\t\treturn a_cota[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n//Get form-value error messages...START\r\n\tfunction gtMsgSSBounds(s_message, i_min, i_max) {\r\n\t\tif(df(i_min)) {\r\n\t\t\ts_message = gtMsgRplcSpclStr(s_message, cSS_DELIM, sSS_BOUND_MIN, i_min);\r\n\t\t}\r\n\r\n\t\tif(df(i_max) && i_max != -1) {\r\n\t\t\t//For a text element, "MAXLENGTH" equals -1 when not defined (or bogus).\r\n\t\t\ts_message = gtMsgRplcSpclStr(s_message, cSS_DELIM, sSS_BOUND_MAX, i_max);\r\n\t\t}\r\n\r\n\t\treturn s_message;\r\n\t}\r\n\r\n\tfunction gtMsgRplcSpclStr(s_message, c_delimiter, s_toReplace, s_replaceWith) {\r\n\t\tvar sss = c_delimiter + s_toReplace + c_delimiter;\r\n\t\tif(!df(s_message)) {\r\n\t\t\t//Special case, when an error occured previously in the\r\n\t\t\t//code, but throw didn't occur. If we don't do this,\r\n\t\t\t//we'll get another throw, because the below will\r\n\t\t\t//cause an "s_message has no properties"\r\n\t\t\t//\r\n\t\t\ts_message = "";\r\n\t\t}\r\n\t\tvar iSSIdx = s_message.indexOf(sss);\r\n\t\tif(iSSIdx != -1) {\r\n\t\t\treturn s_message.substring(0, iSSIdx) + s_replaceWith + s_message.substring((iSSIdx + sss.length), (s_message.length + 1));\r\n\t\t} else {\r\n\t\t\treturn s_message;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tfunction trimStringLmnt(fls_tpta) {\r\n\t\t//This is a string element.\r\n\t\tvar v = fls_tpta.obj.value;\r\n\r\n\t\tif(!df(v)) {\r\n\t\t\t//No value to trim\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(fls_tpta.isAttrAssc2Lmnt(ca_bsDts.sNm)) {\r\n\t\t\t//Explicitely should not trim.\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(fls_tpta.flsFrm.isAttrAssc2Lmnt(ca_bsGts.sNm) ||\r\n\t\t \tfls_tpta.isAttrAssc2Lmnt(ca_bsTs.sNm)) {\r\n\t\t\t//Trim it!\r\n\t\t\tv = trmChr(' ', v);\r\n\t\t\tfls_tpta.obj.value = trmChr('\t', v);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction hasRequiredError(fls_lmnt, i_optsChosen, v_valSnglr) {\r\n\t\tciMissing(hasRequiredError, "hasRequiredError (XCSTD)", "fls_lmnt", fls_lmnt);\r\n\t\tif(fls_lmnt.sType == "form") { //XCSTD\r\n\t\t\tcrsh("guer1", hasRequiredError, "hasRequiredError (XCSTD): fls_lmnt.sType equals 'form'?! fls_lmnt.sNm='" + fls_lmnt.sNm + "'");\r\n\t\t} //XCSTD\r\n\r\n\t\tif(!fls_lmnt.isAttrAssc2Lmnt(ca_sMr.sNm)) {\r\n\t\t\t//Missing is a non-issue. Good (false, no error)\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//If missing, bad.\r\n\t\tif((fls_lmnt.isLmntVal1OrMore() &&\r\n\t\t \t!df(v_valSnglr)) ||\r\n\t\t \ti_optsChosen == 0) {\r\n\r\n\t\t\tfls_lmnt.sUsrErr = fls_lmnt.gtAttrV(ca_sMr.sNm);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\t//Not missing. Good (false, no error).\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tfunction hasTxtPwdError(fls_txtpwd, v_valSnglr) {\r\n\t\tciMissing(hasTxtPwdError, "hasTxtPwdError (XCSTD)", "fls_txtpwd", fls_txtpwd);\r\n\r\n\t\t//It is assumed/expected that there is only one "sMsgTxt"\r\n\t\t//variables associated to this text/password element.\r\n\r\n\t\tif(fls_txtpwd.isAttrAssc2Lmnt(ca_sMte.sNm)) {\r\n\t\t\t//util_string.isEml()\r\n\t\t\tif(!isEml(fls_txtpwd.gtLmntValSnglr())) {\r\n\t\t\t\tfls_txtpwd.sUsrErr = fls_txtpwd.gtAttrV(ca_sMte.sNm);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(fls_txtpwd.isAttrAssc2Lmnt(ca_sMti.sNm)) {\r\n\t\t\treturn hasDecIntErr("false", fls_txtpwd, ca_sMti.sNm, "iIntMin", "iIntMax");\r\n\t\t}\r\n\r\n\r\n\t\tif(fls_txtpwd.isAttrAssc2Lmnt(ca_sMtd.sNm)) {\r\n\t\t\treturn hasDecIntErr("true", fls_txtpwd, ca_sMtd.sNm, "dDecMin", "dDecMax");\r\n\r\n\t\t}\r\n\r\n\t\t//sMsgTxt* (sif, not dec/email/int) attributes exist/were\r\n\t\t//added at indexes 13 and up.\r\n\t\tfor(var i = 13; i < aCMPTBL_ATTRS.length; i++) {\r\n\t\t\tif(fls_txtpwd.isAttrAssc2Lmnt(aCMPTBL_ATTRS[i].sNm)) {\r\n\r\n\t\t\t\t//".sif" is set in stASIF()\r\n\t\t\t\tvar sStrpdAndValid = aCMPTBL_ATTRS[i].sif.gtFmtV(fls_txtpwd.obj.value);\r\n\t\t\t\tif(df(sStrpdAndValid)) {\r\n\t\t\t\t\tfls_txtpwd.obj.value = sStrpdAndValid;\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfls_txtpwd.sUsrErr = fls_txtpwd.gtAttrV(aCMPTBL_ATTRS[i].sNm);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//None of these attributes were associated to this\r\n\t\t//text/password element, so no error.\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tfunction hasDecIntErr(bs_decInt, fls_txtpwd, s_msgAttrNm, v_minBound, v_maxBound) {\r\n\t\tvar vMin = fls_txtpwd.gtAttrVRaw(v_minBound);\r\n\t\tvar vMax = fls_txtpwd.gtAttrVRaw(v_maxBound);\r\n\t\tvar vValue = fls_txtpwd.obj.value;\r\n\r\n\t\t//util_string.isNum()\r\n\t\tif(!isNum(fls_txtpwd.obj.value, bs_decInt) ||\r\n\t\t\t\t(df(vMin) && vMin > vValue) ||\r\n\t\t\t\t(df(vMax) && vMax < vValue)) {\r\n\t\t\tfls_txtpwd.sUsrErr = gtMsgSSBounds(\r\n\t\t\t\tfls_txtpwd.gtAttrV(s_msgAttrNm), vMin, vMax);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tfunction hasStrLnError(fls_tpta, v_valSnglr) {\r\n\t\tif(fls_tpta.sType != "text" && fls_tpta.sType != "password" &&\r\n\t\t\t\tfls_tpta.sType != "textarea") {\r\n\t\t\t//Only string elements have length.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//This is a string element\r\n\r\n\t\tif(!fls_tpta.isAttrAssc2Lmnt(ca_sMbl.sNm)) {\r\n\t\t\t//No value, so no bad length.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//Value, so possibly bad length.\r\n\r\n\t\tvar iCurrLen = fls_tpta.gtLmntValSnglr().length;\r\n\r\n\t\tif(fls_tpta.isAttrAssc2Lmnt("iMinLength") &&\r\n\t\t\t\t(iCurrLen < fls_tpta.gtAttrV("iMinLength"))) {\r\n\t\t\tstBadLnMsg(fls_tpta, iCurrLen);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tvar iMx = fls_tpta.gtAttrVRaw("iMaxLength");\r\n\r\n\t\tif(df(iMx) && iMx != -1 &&\r\n\t\t\t\t(iCurrLen > iMx)) {\r\n\t\t\tstBadLnMsg(fls_tpta, iCurrLen);\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfunction stBadLnMsg(fls_tpta, i_currLen) {\r\n\t\tvar sErr = gtMsgRplcSpclStr(\r\n\t\t\t\t\tfls_tpta.gtAttrV(ca_sMbl.sNm),\r\n\t\t\t\t\tcSS_DELIM, sSS_CURRLEN,\r\n\t\t\t\t\ti_currLen);\r\n\r\n\t\tfls_tpta.sUsrErr = gtMsgSSBounds(sErr,\r\n\t\t\t\tfls_tpta.gtAttrVRaw("iMinLength"),\r\n\t\t\t\tfls_tpta.gtAttrVRaw("iMaxLength"));\r\n\t}\r\n\r\n\r\n\tfunction hasChkSlmError(fls_chkslm, i_optsChosen, v_valSnglr) {\r\n\t\tif(!fls_chkslm.isAttrAssc2Lmnt(ca_sMmcr.sNm)) {\r\n\t\t\t//The number of selected options doesn't matter.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//...oh yes it does...\r\n\r\n\t\tvar iMn = fls_chkslm.gtAttrVRaw("iMCMin");\r\n\t\tvar iMx = fls_chkslm.gtAttrVRaw("iMCMax");\r\n\r\n\t\tif((df(iMn) &&\r\n\t\t \ti_optsChosen < iMn) ||\r\n\t\t \t(df(iMx) &&\r\n\t\t \t iMx < i_optsChosen)) {\r\n\r\n\t\t\tvar sErr = gtMsgSSBounds(\r\n\t\t\t\tfls_chkslm.gtAttrVRaw(ca_sMmcr.sNm), iMn, iMx);\r\n\t\t\tsErr = gtMsgRplcSpclStr(sErr,\r\n\t\t\t\tcSS_DELIM, sSS_OPTS_TOT, fls_chkslm.iTotOpts);\r\n\t\t\tfls_chkslm.sUsrErr = gtMsgRplcSpclStr(sErr,\r\n\t\t\t\tcSS_DELIM, sSS_OPTS_CHSN, fls_chkslm.gtLmntOptsChosen());\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tfunction hasBSSError(fls_tpta, v_valSnglr) {\r\n\t\tif(!df(v_valSnglr)) { //XCSTD\r\n\t\t\tcrsh("gbsse1", hasBSSError, "hasBSSError (XCSTD): v_valSnglr is undefined?! I thought there was 'Nothing further to check' (seach for that in the code to see what this error relates to)...");\r\n\t\t} //XCSTD\r\n\r\n\t\tif(fls_tpta.flsFrm.isAttrAssc2Lmnt(ca_asBss.sNm)) {\r\n\t\t\t//This element is exempt.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar asBSS;\r\n\t\tif(fls_tpta.isAttrAssc2Lmnt(ca_asBss.sNm)) {\r\n\t\t\t//The element's list has higher priority than the\r\n\t\t\t//form's list, which is why this block comes before...\r\n\t\t\tasBSS = fls_tpta.gtAttrV(ca_asBss.sNm)\r\n\r\n\t\t} else if(fls_tpta.flsFrm.isAttrAssc2Lmnt(ca_asGbss.sNm)) {\r\n\t\t\t//...this one.\r\n\t\t\tasBSS = fls_tpta.flsFrm.gtAttrV(ca_asGbss.sNm)\r\n\r\n\t\t} else {\r\n\t\t\t//No bad sub strings are defined.\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//There are illegal sub-strings.\r\n\r\n\t\tfor(var i = 0; i < asBSS.length; i++) {\r\n\t\t\tif(v_valSnglr.indexOf(asBSS[i]) != -1) {\r\n\t\t\t\tvar sErr = gtMsgRplcSpclStr(\r\n\t\t\t\t\tfls_tpta.gtAttrV(ca_sMbss.sNm),\r\n\t\t\t\t\tcSS_DELIM, sSS_BSS_LIST,\r\n\t\t\t\t\t"['" + asBSS.join("', '") + "']");\r\n\r\n\t\t\t\tfls_tpta.sUsrErr = gtMsgRplcSpclStr(sErr,\r\n\t\t\t\t\tcSS_DELIM, sSS_BSS_FOUND,\r\n\t\t\t\t\tasBSS[i]);\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//No bad sub-strings found in the value.\r\n\t\treturn false;\r\n\t}\r\n//Get user error messages...END\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction pb_addGdAtts4OT(a_cvfAttribute) {\r\n\tthis.addCVFAttrs("addGdAtts4OT", true, a_cvfAttribute);\r\n}\r\nfunction pb_addBdAtts4Att(a_cvfAttribute) {\r\n\tthis.addCVFAttrs("addBdAtts4Att", false, a_cvfAttribute);\r\n}\r\nfunction pv_addCVFAttrs(s_callingFunc, b_objTypeOrAttr, a_cvfAttribute) {\r\n\tthis.add2RA(s_callingFunc, b_objTypeOrAttr, this.aACAttrs_G4OT_B4A, a_cvfAttribute);\r\n}\r\nfunction pb_stGoodOTs4Attr(a_cvfAttribute) {\r\n\tif(this.aCObjTypes_G4A.length > 1) { //XCMAX\r\n\t\tcrsh("cota.sgot4a1", this.stGoodOTs4Attr, "stGoodOTs4Attr (XCMAX): this.aCObjTypes_G4A.length=" + this.aCObjTypes_G4A.length + ". Can only call this function once. Note the name of this function starts 'st' (meaning 'set'), not 'add'.");\r\n\t} //XCMAX\r\n\tthis.add2RA("stGoodOTs4Attr", false, this.aCObjTypes_G4A, a_cvfAttribute);\r\n}\r\n\r\n\r\nfunction pb_add2RA(s_callingFunc, b_objTypeOrAttr, a_dest, a_cvfAttribute) {\r\n\tcibRA(s_callingFunc + " (XCMAX)", "a_cvfAttribute", a_cvfAttribute);\r\n\r\n\tif(b_objTypeOrAttr != this.bOTorA) { //XCMAX\r\n\t\tcrsh("cota.cincvfa", this.add2RA, s_callingFunc + " (XCMAX): This function is only applicable for " + (b_objTypeOrAttr?"object-types":"vf-attributes") + ". This object represents " + (this.bOTorA?"object-types":"vf-attributes") + ".");\r\n\t} //XCMAX\r\n\r\n\tfor(var i = 0; i < a_cvfAttribute.length; i++) {\r\n\t\ta_dest[a_dest.length] = a_cvfAttribute[i];\r\n\t}\r\n}\r\n\r\nfunction pb_hasAttr(s_attribute) {\r\n\tciMissing(this.hasAttr, "hasAttr (XCMAX)", "s_attribute", s_attribute);\r\n\r\n\tfor(var i = 0; i < this.aACAttrs_G4OT_B4A.length; i++) {\r\n\t\tif(s_attribute == this.aACAttrs_G4OT_B4A.sNm) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nfunction pb_hasOT(s_objType) {\r\n\tciMissing(this.hasOT, "hasOT (XCMAX)", "s_objType", s_objType);\r\n\r\n\tfor(var i = 0; i < this.aCObjTypes_G4A.length; i++) {\r\n\t\tif(s_objType == this.aCObjTypes_G4A[i].sNm) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\n\r\nfunction CmptblOTA(b_objTypeOrAttr, s_name) {\r\n\tciMissing(CmptblOTA, "CmptblOTA (XCMAX)", "b_objTypeOrAttr", b_objTypeOrAttr);\r\n\tciMissing(CmptblOTA, "CmptblOTA (XCMAX)", "s_name", s_name);\r\n\tif(s_name.length < 1) { //XCMAX\r\n\t\tcrsh("coa.cnstr1", CmptblOTA, "CmptblOTA.constructor (XCMAX): s_name is zero characters in length.");\r\n\t} //XCMAX\r\n\r\n\r\n\tthis.sNm = s_name;\r\n\tthis.bOTorA = b_objTypeOrAttr;\r\n\r\n\tthis.aCObjTypes_G4A = [];\r\n\t\tthis.stGoodOTs4Attr = pb_stGoodOTs4Attr;\r\n\r\n\t//Both object-types and attributes keep track of attributes,\r\n\t//for one reason or another.\r\n\tthis.aACAttrs_G4OT_B4A = [];\r\n\t\tthis.addBdAtts4Att = pb_addBdAtts4Att;\r\n\t\tthis.addGdAtts4OT = pb_addGdAtts4OT;\r\n\r\n\tthis.addCVFAttrs = pv_addCVFAttrs;\r\n\tthis.add2RA = pb_add2RA;\r\n\tthis.hasAttr = pb_hasAttr;\r\n\tthis.hasOT = pb_hasOT;\r\n\r\n\t//For ca-s that are representing SIFmt attributes.\r\n\t//Used in hasTxtPwdError()\r\n\t//".sif" is set in stASIF()\r\n\tthis.sif = undefined;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction gtVRAIdx(s_callingFunc, v_alue, a_value) {\r\n\tcibRA(s_callingFunc + " (XCMAX) [NOTE THAT THERE ARE THREE PARAMETERS, THE FIRST BEING THE 'CALLING FUNCTION']", "a_value", a_value);\r\n\r\n\tfor(var i = 0; i < a_value.length; i++) {\r\n\t\tif(v_alue == a_value[i]) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\r\n\treturn -1;\r\n}\r\n\r\n\r\nfunction isInAscRA(v_alue, a_value) {\r\n\tcibRA("isInAscRA (XCMAX)", "a_value", a_value);\r\n\r\n\tfor(var i = 0; i < a_value.length; i++) {\r\n\t\tif(v_alue < a_value[i]) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif(v_alue == a_value[i]) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction isRA(o_potentialArray) {\r\n\tciMissing(isRA, 'util_array.isRA (XCMAX)', 'o_potentialArray', o_potentialArray);\r\n\r\n\tif(typeof o_potentialArray != 'object') {\r\n\t\treturn false;\r\n\t}\r\n\t//It is definitely an object.\r\n\treturn (o_potentialArray.constructor.toString().match(/array/i) != null);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfunction isNum(s_potential, bs_decimalAllowed) {\r\n\tciMissing(isNum, 'util_string.isNum [XCMAX]', 's_potential', s_potential);\r\n\tcibBoolStr('util_string.isNum [XCMAX]', 'bs_decimalAllowed', bs_decimalAllowed);\r\n\r\n\tif(s_potential.length < 1) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(s_potential == '-') {\r\n\t\t//A negative sign only makes no sense.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(/^-[0]+$/.test(s_potential)) {\r\n\t\t//Negative zero makes no sense.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(/^[0]+$/.test(s_potential)) {\r\n\t\t//Zero is a legal number:\r\n\t\t//0 == 0000000000000 == 000\r\n\t\treturn true;\r\n\t}\r\n\t//It is definitely not zero.\r\n\r\n\t//^ The start of the line.\r\n\t//[-]{0,1} Zero or one dashes.\r\n\t//[0-9]+ One or more of any digit.\r\n\t//$ The end of the line.\r\n\tif(/^[-]{0,1}[0-9]+$/.test(s_potential)) {\r\n\t\t//No matter what, this is valid. This is a leagal integer\r\n\t\t//and decimal.\r\n\t\treturn true;\r\n\t}\r\n\t//It's not an integer...\r\n\r\n\tif(bs_decimalAllowed == 'false') {\r\n\t\t//...but it must be.\r\n\t\treturn false;\r\n\t}\r\n\t//...and that's okay. It might be a decimal\r\n\r\n\t//Due to precision:\r\n\t//10.0000000000001 is legal (12 zeros)\r\n\t//10.00000000000001 is not (13 zeros)\r\n\r\n\t//^ The start of the line.\r\n\t//[-]{0,1} Zero or one dashes.\r\n\t//[0-9]* Zero or more digits.\r\n\t//[.] \t\tA decimal point.\r\n\t//[0-9]+ One or more digits.\r\n\t//$ The end of the line.\r\n\tif(/^[-]{0,1}[0-9]*[.][0-9]+$/.test(s_potential)) {\r\n\t\t//It is a "raw" decimal. The only thing that would make\r\n\t\t//this illegal is if it were -0.0 or -.0, or -0.0000 or\r\n\t\t//-.0000 or ...\r\n\r\n\t\treturn !(/^-0*[.]0+$/.test(s_potential));\r\n\t}\r\n\r\n\t//It is not a legal decimal number.\r\n\treturn false;\r\n}\r\n\r\n\r\n\r\n\r\nfunction isEml(s_potentialEmail) {\r\n\tif(!df(s_potentialEmail) || //XCMAX\r\n\t \ts_potentialEmail.length < 1) {//XCMAX\r\n\t\tcrsh("us.ie1", isEml, "isEml (XCMAX): s_potentialEmail must be defined, and at least one character in length.");\r\n\t} //XCMAX\r\n\r\n\tif(s_potentialEmail.indexOf(" ") != -1 ||\r\n\t s_potentialEmail.indexOf("/") != -1 ||\r\n\t s_potentialEmail.indexOf("\\\\") != -1 ||\r\n\t s_potentialEmail.indexOf(",") != -1) {\r\n\t\t//A space, slash or comma was found.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(/[@.][@.]/.test(s_potentialEmail)) {\r\n\t\t//An @ or dot is followed by an @ or dot.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(/^[@.]/.test(s_potentialEmail)) {\r\n\t\t//The first character is an @ or dot.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(/[@.]$/.test(s_potentialEmail)) {\r\n\t\t//The last character may not be an @ or dot.\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(!/^[^@]+@[^@]+$/.test(s_potentialEmail)) {\r\n\t\t//Only one @ allowed\r\n\t\t//\t\t(Negative of:\r\n\t\t//\t\t Must have one or more non-@ starting the line,\r\n\t\t//\t\t exactly one @, and then\r\n\t\t//\t\t one or more non-@ ending the line.)\r\n\t\treturn false;\r\n\t}\r\n\t//There is exactly one @.\r\n\r\n\tif(!/@.*[.]/.test(s_potentialEmail)) {\r\n\t\t//At least one dot must follow the (single) @.\r\n\t\treturn false;\r\n\t}\r\n\t//At least one dot follows the @. We already determined\r\n\t//above that it does not immediately follow it,\r\n\r\n\r\n\t//No negative conditions were met. This is a legal email address.\r\n\t//Cool, eh? : )\r\n\treturn true;\r\n}\r\n\r\n\r\n\r\n\r\nfunction trmChr(c_harToTrim, s_tring) {\r\n\tif(!c_harToTrim || c_harToTrim.length != 1) {//XCMAX\r\n\t\tcrsh("us.tc1", trmChr, "us.trmChr (XCMAX): c_harToTrim must be provided, and must be exactly one character in length. Currently '" + c_harToTrim + "'.");\r\n\t} //XCMAX\r\n\r\n\tciMissing(trmChr, 'us.trmChr [XCMAX]', 's_tring', s_tring);\r\n\r\n\tvar i = 0;\r\n\tvar iStartingSpaces = 0;\r\n\twhile(s_tring.substring(i, (i + 1)) == c_harToTrim) {\r\n\t\tiStartingSpaces++;\r\n\t\ti++;\r\n\t}\r\n\r\n\tif(iStartingSpaces == s_tring.length) {\r\n\t\treturn "";\r\n\t}\r\n\r\n\ti = 0;\r\n\tvar iEndingSpaces = 0;\r\n\twhile(s_tring.substring((s_tring.length - i), (s_tring.length - (i + 1))) == c_harToTrim) {\r\n\t\tiEndingSpaces++;\r\n\t\ti++;\r\n\t}\r\n\r\n\tif(iStartingSpaces == 0 && iEndingSpaces == 0) {\r\n\t\treturn s_tring;\r\n\t}\r\n\r\n\treturn s_tring.substring(iStartingSpaces, (s_tring.length - iEndingSpaces));\r\n}\r\n\r\n\r\n\r\nfunction gtCd4V(s_value) {\r\n\tif(!df(s_value)) {\r\n\t\treturn "undefined";\r\n\r\n\t//util_string.isNum()\r\n\t} else if(isNum(s_value, "true")) {\r\n\t\treturn s_value;\r\n\r\n\t//util_array.isRA()\r\n\t} else if(isRA(s_value)) {\r\n\t\treturn "['" + s_value.join("', '") + "']";\r\n\r\n\t} else {\r\n\t\t//This is a boolean string or plain string.\r\n\t\treturn "'" + s_value + "'";\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n//[crsh() ids used in this js file: 1..4]\r\n\r\n//Global variables...START\r\n\t//As defined in validate_form.js. This notifies all other\r\n\t//code that this JavaScript file has indeed been loaded.\r\n\tbLDD_CI = true;\r\n\r\n\t//Initialized in validate_form.js\r\n\t\t//A secret public global variable. For testing purposes, you\r\n\t\t//may want to avoid re-displaying the error after the alert\r\n\t\t//box (within H1 tags). This gives you access to the error id\r\n\t\t//\r\n\t\t//bCRSH_ALRT: If 'true', then an alert box is displayed\r\n\t\t//when the crash function is called. If 'false', no alert box\r\n\t\t//is displayed. Should default to 'true'.\r\n\t\tbCRSH_ALRT = true;\r\n\r\n\t\t//bCRSH_DGNSTCS: If 'true', then the error message is\r\n\t\t//displayed on a new web page, to make it truly clear that an\r\n\t\t//error occured. If 'false', the error message is not\r\n\t\t//displayed on a new page. Should default to 'true'.\r\n\t\tbCRSH_DGNSTCS = true;\r\n\r\n\t\t//bCRSH_THROW\r\n\t\tbCRSH_THROW = true;\r\n\r\n\t//This is automatically manipulated by this js file. It is private\r\n\t//and should never be altered.\r\n\tvar bCrshd = false;\r\n\r\n\t//The id of the error.\r\n\tvar sCrshCd = undefined;\r\n\r\n\tvar fCrsh = undefined;\r\n\r\n\t//The full text of the error.\r\n\tvar sCrshMsg = undefined;\r\n//Global variables...END\r\n\r\n\r\n\r\nfunction crsh(s_code, f_unc, s_error) {\r\n\tif(!df(f_unc)) {\r\n\t\treturn alert("ERROR in utility.crsh: f_unc is undefined. [crsh.caller=" + crsh.caller.name + ", s_code='" + s_code + "', s_error='" + s_error + "']");\r\n\t}\r\n\tif(!df(f_unc.arguments)) {\r\n\t\treturn alert("ERROR in utility.crsh: f_unc.arguments is undefined. Make sure f_unc is a function reference. [crsh.caller=" + crsh.caller.name + ", s_code='" + s_code + "', s_error='" + s_error + "']");\r\n\t}\r\n\tif(!s_code) {\r\n\t\treturn alert("ERROR in utility.crsh: s_code is required and must not equal zero or empty string. [crsh.caller=" + crsh.caller.name + ", f_unc='" + f_unc + "', s_error='" + s_error + "']");\r\n\t}\r\n\r\n\tvar sHdr = "u.crsh() ERROR. ";\r\n\tvar sFncNm = "Function: " + f_unc.name + "()";\r\n\tvar sCode = "Code: " + s_code;\r\n\r\n\tvar sClrNm = "Caller: ";\r\n\tif(df(f_unc.caller)) {\r\n\t\t//This block cannot be a ()?: line, because you'll get\r\n\t\t//a "f_unc.caller has no properties" exception when this\r\n\t\t//error is from a top-level function call.\r\n\t\tsClrNm += f_unc.caller.name + "()"\r\n\t} else {\r\n\t\tsClrNm += "[TOP LEVEL CALL. Called by the document itself]";\r\n\t}\r\n\r\n\tvar sCrshClr = "crsh() caller: " + crsh.caller.name;\r\n\r\n\r\n\tvar sArgs = "";\r\n\tvar aFrgs = f_unc.arguments;\r\n\tif(!isRA(aFrgs)) {\r\n\t\tsArgs = "COULD NOT DETERMINE ARGUMENTS. f_unc.arguments is not of type 'array'. WHY?!";\r\n\r\n\t} else {\r\n\t\tfor(var i = 0; i < aFrgs.length; i++) {\r\n\t\t\tsArgs += i + " [" + aFrgs[i] + "]\n";\r\n\t\t}\r\n\t}\r\n\tsArgs = "Argument(s):\n" + sArgs;\r\n\r\n\t//This must precede the "wrt" line. Otherwise you'll get\r\n\t//a "not defined" exception for either getEMsg() or\r\n\t//bCRSH_ALRT...START\r\n\t\tvar sLrt = sHdr + sCode + "\nbCRSH_DGNSTCS=" + bCRSH_DGNSTCS + " bCRSH_ALRT=" + bCRSH_ALRT + " bCRSH_THROW=" + bCRSH_THROW + "\n";\r\n\t\tif(bCRSH_DGNSTCS) {\r\n\t\t\tsLrt += "\n(About to write this error and code to the document)";\r\n\t\t} else if(bCRSH_ALRT && window.location.hash.length > 0) {\r\n\t\t\tif(bCRSH_THROW) {\r\n\t\t\t\tsLrt += "\n[[[ NOTE: The page may reload to '" + window.location.hash + "', and form values may revert to their defaults. ANYONE KNOW WHY THIS RELOADS IN UNPREDICTABLE LOCATIONS???? ]]]";\r\n\t\t\t} else {\r\n\t\t\t\tsLrt += "\n[[[ NOTE: bCRSH_THROW equals false. Unpredictable behavior may follow this dialog... ]]]";\r\n\t\t\t}\r\n\t\t}\r\n\t\tsLrt += "\n------------------------" +\r\n\t\t\t"\n" + s_error +\r\n\t\t\t"\n---------------------\n" + sFncNm +\r\n\t\t\t"\n" + sClrNm +\r\n\t\t\t"\n" + sCrshClr;\r\n\r\n\t\t//For debugging purposes.\r\n\t\t\tsCrshCd = s_code;\r\n\t\t\tsCrshMsg = sLrt;\r\n\t\t\tfCrsh = f_unc;\r\n\r\n\t\tif(bCRSH_ALRT) {\r\n\t\t\talert(sLrt);\r\n\t\t}\r\n\t//This must precede the "wrt" line. Otherwise you'll get\r\n\t//a "not defined" exception for either getEMsg() or\r\n\t//bCRSH_ALRT...END\r\n\r\n\tvar sDgnstcs;\r\n\tif(bCRSH_DGNSTCS) {\r\n\t\tvar sb = "\n
";\r\n\t\tvar sTop = "
" + sHdr + sCode + "...";\r\n\t\tvar sBtm = " |
" + s_error + "
" + sCode + sb + sFncNm + sb + sClrNm + sb + sCrshClr + "
\n" + sArgs + "\n" +\r\n\t\t\t"
" + f_unc + "\n
" + f_unc.caller + "\n" +\r\n\t\t\tsTop + "END\n" + sBtm;\r\n\t}\r\n\r\n\t//Divided into two functions, which for some reason seems to\r\n\t//prevent errors.\r\n\tif(bCRSH_THROW) {\r\n\t\tcrshAndThrow(sDgnstcs, sLrt);\r\n\t} else {\r\n\t\tcrshNoThrow(sDgnstcs);\r\n\t}\r\n}\r\nfunction crshAndThrow(s_dgnstcs, s_throwMsg) {\r\n\tif(bCRSH_DGNSTCS) {\r\n\t\twrt(s_dgnstcs);\r\n\t}\r\n\r\n\tthrow s_throwMsg;\r\n}\r\nfunction crshNoThrow(s_dgnstcs) {\r\n\tif(bCRSH_DGNSTCS) {\r\n\t\twrt(s_dgnstcs);\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\nfunction ciMissing(f_calling, s_callingFileFunc, s_varName, v_required) {\r\n\tif(!df(v_required)) {\r\n\t\tcrsh("u.cim1", f_calling, s_callingFileFunc + ': Required parameter ' + s_varName + ' is undefined.');\r\n\t}\r\n}\r\n\r\n\r\nfunction cibBoolStr(s_callingFunc, s_bsName, bs_shouldBe) {\r\n\tciMissing(cibBoolStr, "u.cibBoolStr (s_callingFunc='" + s_callingFunc + "', s_bsName='" + s_bsName + "')", "bs_shouldBe", bs_shouldBe);\r\n\r\n\tif(bs_shouldBe == 'true' || bs_shouldBe == 'false') {\r\n\t\t//It's all good.\r\n\t\treturn;\r\n\t}\r\n\r\n\tcrsh("u.cibbs1", cibBoolStr, s_callingFunc + ": " + s_bsName + " must be a *string* equal to either 'true' or 'false'. EXTRA INFO: bs_shouldBe.toString()='" + bs_shouldBe.toString() + "', bs_shouldBe.type='" + bs_shouldBe.type + "' , value='" + bs_shouldBe + "'.");\r\n}\r\n\r\n\r\n\r\n\r\n\r\nfunction cibAFLS(s_callingFunc, s_aosName, a_flStats) {\r\n\tcibRA(s_callingFunc, s_aosName, a_flStats);\r\n\r\n\tfor(var i = 0; i < a_flStats.length; i++) {\r\n\t\tciNotFLStats(s_callingFunc, s_aosName + "[" + i + "]", a_flStats[i]);\r\n\t}\r\n}\r\n\r\n\r\nfunction ciNotFLStats(s_callingFunc, s_flsName, v_shouldBeFLS) {\r\n\tciMissing(ciNotFLStats, s_callingFunc, s_flsName, v_shouldBeFLS);\r\n\r\n\tif(!df(v_shouldBeFLS.type) ||\r\n\t\t\t\tv_shouldBeFLS.type != "FLStats") {\r\n\t\tcrsh("os.cinos1", ciNotFLStats, s_callingFunc + ": " + s_flsName + " is not of type 'FLStats'. Currently, [" + v_shouldBeFLS + "].");\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n//Intended for validate_form.js\r\nfunction ciNotLoaded(s_callingFunc, vfb_cfg) {\r\n\tvar f = ciNotLoaded;\r\n\tvar sF = s_callingFunc;\r\n\tvar sDgnstcsStart = ".\n----------\nDiagnostics:\ns_jsDirUrl='" + sJSDIR + "' (as you provided to loadVF())\n";\r\n\r\n\tif(df(vfb_cfg)) {\r\n\t\tif(vfb_cfg.isVfpdOn() && !bLDD_VFPD) {\r\n\t\t\tcrsh("vf.gfem8", f, sF + "Permanent VF-Diagnostics are currently active, but '" + sJSDIR + "vf_perm_diagnostics.js'could not be loaded" + sDgnstcsStart + "bLDD_VFPD=" + bLDD_VFPD + "\nvfb_cfg.isVfpdOn()=" + vfb_cfg.isVfpdOn() + ", vfb_cfg.bDOnDflt=" + vfb_cfg.bDOnDflt + ", bVFPDInUrl=" + bVFPDInUrl + ", vfb_cfg.sFrmNm='" + vfb_cfg.sFrmNm + "'\nwindow.location.search='" + window.location.search + "'\nvfb_cfg.isVfpdOn()=" + vfb_cfg.isVfpdOn() + "'\nbLDD_VFPD=" + bLDD_VFPD);\r\n\r\n\t\t} else if(vfb_cfg.isCIBCOn() && !bLDD_CIBC) {\r\n\t\t\tcrsh("vf.gfem9", f, sF + "vfb_cfg.isCIBCOn() equals true, but '" + sJSDIR + "vf_cib_config.js' or '" + sJSDIR + " could not be loaded" + sDgnstcsStart + "vfb_cfg.sFrmNm='" + vfb_cfg.sFrmNm + "'\nbLDD_CIBC=" + bLDD_CIBC);\r\n\r\n\r\n\t\t} else if(vfb_cfg.iDDPS != -1 &&\r\n\t\t !bLDD_DBG) {\r\n\t\t\tcrsh("vf.gfem10", f, sF + "vfb_cfg.iDDPS equals something other than -1 (" + vfb_cfg.iDDPS + "), but '" + sJSDIR + "vf_dbgVF.js' could not be loaded" + sDgnstcsStart + "vfb_cfg.sFrmNm='" + vfb_cfg.sFrmNm + "'");\r\n\t\t}\r\n\t}\r\n\r\n\tif((bLDD_CIBC || bLDD_DBG) &&\r\n\t !bLDD_OD) {\r\n\t\tcrsh("vf.gfem11", f, sF + "Either " + sJSDIR + "vf_cib_config.js (" + bLDD_CIBC + ") or " + sJSDIR + "vf_dbgVF.js (" + bLDD_DBG + ") were loaded, but the required sub-file '" + sJSDIR + "vf_obj_dgnstcs.js' could not be loaded" + sDgnstcsStart);\r\n\r\n\t} else if(df(sSifCfgUrl) &&\r\n\t \t(!bLDD_STASIF || !bLDD_SIF_CFG ||\r\n\t \t (aCMPTBL_ATTRS.length == 13))) {\r\n\t\tcrsh("vf.gfem12", f, sF + "s_relUrl2ASIFmt ('" + sSifCfgUrl + "') has at least one of the following problems:\n - It could not be loaded. Verify the path.\n - It does not call stASIF().\n - It does not contain the required variable and value 'bLDD_SIF_CFG=true;'" + sDgnstcsStart + "bLDD_STASIF=" + bLDD_STASIF + "\naCPMTBL_ATTRS.length=" + aCMPTBL_ATTRS.length + "\nbLDD_SIF_CFG=" + bLDD_SIF_CFG);\r\n\t}\r\n}\r\n\r\n\r\n\r\nfunction cibRA(s_callingFunc, s_arrayNm, a_rray) {\r\n\tciMissing(cibRA, s_callingFunc, s_arrayNm, a_rray);\r\n\r\n\tif(!isRA(a_rray)) {\r\n\t\tcrsh("ua.ciba1", cibRA, s_callingFunc + ": " + s_arrayNm + " is not an array according to util_array.isRA(). " + s_arrayNm + "=[" + a_rray.toString() + "].");\r\n\t}\r\n\r\n\tif(a_rray.length < 1) {\r\n\t\tcrsh("ua.ciba2", cibRA, s_callingFunc + ": " + s_arrayNm + " is zero elements in length.");\r\n\t}\r\n\r\n\tfor(var i = 0; i < a_rray.length; i++) {\r\n\t\tif(!df(a_rray[i])) {\r\n\t\tcrsh("ua.ciba3", cibRA, s_callingFunc + ": " + s_arrayNm + "[" + i + "] is undefined. " + s_arrayNm + "=['" + a_rray.join("', '") + "']");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n\r\n//Intended for si_fmt.js\r\nfunction cibLnRng(si_min, si_max, s_minName, s_maxName, s_whenProvided) {\r\n\tcibInt(s_minName, si_min);\r\n\tcibInt(s_maxName, si_max);\r\n\r\n\tif(!df(si_min)) {\r\n\t\t//This is the alternate minimum bound. We also know the\r\n\t\t//max alt bound is undefined.\r\n\t\treturn;\r\n\t}\r\n\r\n\t//Both rqd/alt bounds have been provided.\r\n\r\n\tif(si_min.length != si_max.length) {\r\n\t\tcrsh("snf.cnstr1", cibLnRng, "cibLnRng: " + s_whenProvided + s_minName + " ('" + si_min + "') and " + s_maxName + " ('" + si_max + "') must be the same length.");\r\n\t}\r\n\r\n\tif(parseInt(si_min, 10) > parseInt(si_max, 10)) {\r\n\t\tcrsh("snf.cnstr1", cibLnRng, "cibLnRng: " + s_whenProvided + s_minName + " ('" + si_min + "') must be (numerically) less than or equal to " + s_maxName + " ('" + si_max + "').");\r\n\t}\r\n}\r\n\r\n//Intended for si_fmt.js\r\nfunction cibInt(s_boundName, si_frmtBound) {\r\n\tif(df(si_frmtBound) && !isNum(si_frmtBound, "false") ||\r\n\t \tsi_frmtBound < 0) {\r\n\t\tcrsh("snf.cnstr4", cibInt, "cibLnRng: The value of " + s_boundName + " ('" + si_frmtBound + "') must be an *integer* greater than -1.");\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n