var Page_ValidationVer = "125"; var Page_IsValid = true; var Page_BlockSubmit = false; var Page_InvalidControlToBeFocused = null; function ValidatorUpdateDisplay(val) { if (typeof(val.display) == "string") { if (val.display == "None") { return; } if (val.display == "Dynamic") { val.style.display = val.isvalid ? "none" : "inline"; return; } } if ((navigator.userAgent.indexOf("Mac") > -1) && (navigator.userAgent.indexOf("MSIE") > -1)) { val.style.display = "inline"; } val.style.visibility = val.isvalid ? "hidden" : "visible"; } function ValidatorUpdateIsValid() { Page_IsValid = AllValidatorsValid(Page_Validators); } function AllValidatorsValid(validators) { if ((typeof(validators) != "undefined") && (validators != null)) { var i; for (i = 0; i < validators.length; i++) { if (!validators[i].isvalid) { return false; } } } return true; } function ValidatorHookupControlID(controlID, val) { if (typeof(controlID) != "string") { return; } var ctrl = document.getElementById(controlID); if ((typeof(ctrl) != "undefined") && (ctrl != null)) { ValidatorHookupControl(ctrl, val); } else { val.isvalid = true; val.enabled = false; } } function ValidatorHookupControl(control, val) { if (typeof(control.tagName) != "string") { return; } if (control.tagName != "INPUT" && control.tagName != "TEXTAREA" && control.tagName != "SELECT") { var i; for (i = 0; i < control.childNodes.length; i++) { ValidatorHookupControl(control.childNodes[i], val); } return; } else { if (typeof(control.Validators) == "undefined") { control.Validators = new Array; var eventType; if (control.type == "radio") { eventType = "onclick"; } else { eventType = "onchange"; if (typeof(val.focusOnError) == "string" && val.focusOnError == "t") { ValidatorHookupEvent(control, "onblur", "ValidatedControlOnBlur(event); "); } } ValidatorHookupEvent(control, eventType, "ValidatorOnChange(event); "); if (control.type == "text" || control.type == "password" || control.type == "file") { ValidatorHookupEvent(control, "onkeypress", "if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } "); } } control.Validators[control.Validators.length] = val; } } function ValidatorHookupEvent(control, eventType, functionPrefix) { var ev; eval("ev = control." + eventType + ";"); if (typeof(ev) == "function") { ev = ev.toString(); ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}")); } else { ev = ""; } var func; if (navigator.appName.toLowerCase().indexOf('explorer') > -1) { func = new Function(functionPrefix + " " + ev); } else { func = new Function("event", functionPrefix + " " + ev); } eval("control." + eventType + " = func;"); } function ValidatorGetValue(id) { var control; control = document.getElementById(id); if (typeof(control.value) == "string") { return control.value; } return ValidatorGetValueRecursive(control); } function ValidatorGetValueRecursive(control) { if (typeof(control.value) == "string" && (control.type != "radio" || control.checked == true)) { return control.value; } var i, val; for (i = 0; i twoDigitCutoffYear) ? (cutoffYearCentury - 100 + year) : (cutoffYearCentury + year)); } var num, cleanInput, m, exp; if (dataType == "Integer") { exp = /^\s*[-\+]?\d+\s*$/; if (op.match(exp) == null) return null; num = parseInt(op, 10); return (isNaN(num) ? null : num); } else if(dataType == "Double") { exp = new RegExp("^\\s*([-\\+])?(\\d*)\\" + val.decimalchar + "?(\\d*)\\s*$"); m = op.match(exp); if (m == null) return null; if (m[2].length == 0 && m[3].length == 0) return null; cleanInput = (m[1] != null ? m[1] : "") + (m[2].length>0 ? m[2] : "0") + (m[3].length>0 ? "." + m[3] : ""); num = parseFloat(cleanInput); return (isNaN(num) ? null : num); } else if (dataType == "Currency") { var hasDigits = (val.digits > 0); var beginGroupSize, subsequentGroupSize; var groupSizeNum = parseInt(val.groupsize, 10); if (!isNaN(groupSizeNum) && groupSizeNum > 0) { beginGroupSize = "{1," + groupSizeNum + "}"; subsequentGroupSize = "{" + groupSizeNum + "}"; } else { beginGroupSize = subsequentGroupSize = "+"; } exp = new RegExp("^\\s*([-\\+])?((\\d" + beginGroupSize + "(\\" + val.groupchar + "\\d" + subsequentGroupSize + ")+)|\\d*)" + (hasDigits ? "\\" + val.decimalchar + "?(\\d{0," + val.digits + "})" : "") + "\\s*$"); m = op.match(exp); if (m == null) return null; if (m[2].length == 0 && hasDigits && m[5].length == 0) return null; cleanInput = (m[1] != null ? m[1] : "") + m[2].replace(new RegExp("(\\" + val.groupchar + ")", "g"), "") + ((hasDigits && m[5].length > 0) ? "." + m[5] : ""); num = parseFloat(cleanInput); return (isNaN(num) ? null : num); } else if (dataType == "Date") { var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([-/]|\\. ?)(\\d{1,2})\\4(\\d{1,2})\\s*$"); m = op.match(yearFirstExp); var day, month, year; if (m != null && (m[2].length == 4 || val.dateorder == "ymd")) { day = m[6]; month = m[5]; year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10)) } else { if (val.dateorder == "ymd"){ return null; } var yearLastExp = new RegExp("^\\s*(\\d{1,2})([-/]|\\. ?)(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$"); m = op.match(yearLastExp); if (m == null) { return null; } if (val.dateorder == "mdy") { day = m[3]; month = m[1]; } else { day = m[1]; month = m[3]; } year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10)) } month -= 1; var date = new Date(year, month, day); if (year < 100) { date.setFullYear(year); } return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null; } else { return op.toString(); } } function ValidatorCompare(operand1, operand2, operator, val) { var dataType = val.type; var op1, op2; if ((op1 = ValidatorConvert(operand1, dataType, val)) == null) return false; if (operator == "DataTypeCheck") return true; if ((op2 = ValidatorConvert(operand2, dataType, val)) == null) return true; switch (operator) { case "NotEqual": return (op1 != op2); case "GreaterThan": return (op1 > op2); case "GreaterThanEqual": return (op1 >= op2); case "LessThan": return (op1 < op2); case "LessThanEqual": return (op1 <= op2); default: return (op1 == op2); } } function CompareValidatorEvaluateIsValid(val) { var value = ValidatorGetValue(val.controltovalidate); if (ValidatorTrim(value).length == 0) return true; var compareTo = ""; if ((typeof(val.controltocompare) != "string") || (typeof(document.getElementById(val.controltocompare)) == "undefined") || (null == document.getElementById(val.controltocompare))) { if (typeof(val.valuetocompare) == "string") { compareTo = val.valuetocompare; } } else { compareTo = ValidatorGetValue(val.controltocompare); } var operator = "Equal"; if (typeof(val.operator) == "string") { operator = val.operator; } return ValidatorCompare(value, compareTo, operator, val); } function CustomValidatorEvaluateIsValid(val) { var value = ""; if (typeof(val.controltovalidate) == "string") { value = ValidatorGetValue(val.controltovalidate); if ((ValidatorTrim(value).length == 0) && ((typeof(val.validateemptytext) != "string") || (val.validateemptytext != "true"))) { return true; } } var args = { Value:value, IsValid:true }; if (typeof(val.clientvalidationfunction) == "string") { eval(val.clientvalidationfunction + "(val, args) ;"); } return args.IsValid; } function RegularExpressionValidatorEvaluateIsValid(val) { var value = ValidatorGetValue(val.controltovalidate); if (ValidatorTrim(value).length == 0) return true; var rx = new RegExp(val.validationexpression); var matches = rx.exec(value); return (matches != null && value == matches[0]); } function ValidatorTrim(s) { var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/); return (m == null) ? "" : m[1]; } function RequiredFieldValidatorEvaluateIsValid(val) { return (ValidatorTrim(ValidatorGetValue(val.controltovalidate)) != ValidatorTrim(val.initialvalue)) } function RangeValidatorEvaluateIsValid(val) { var value = ValidatorGetValue(val.controltovalidate); if (ValidatorTrim(value).length == 0) return true; return (ValidatorCompare(value, val.minimumvalue, "GreaterThanEqual", val) && ValidatorCompare(value, val.maximumvalue, "LessThanEqual", val)); } function ValidationSummaryOnSubmit(validationGroup) { if (typeof(Page_ValidationSummaries) == "undefined") return; var summary, sums, s; for (sums = 0; sums < Page_ValidationSummaries.length; sums++) { summary = Page_ValidationSummaries[sums]; summary.style.display = "none"; if (!Page_IsValid && IsValidationGroupMatch(summary, validationGroup)) { var i; if (summary.showsummary != "False") { summary.style.display = ""; if (typeof(summary.displaymode) != "string") { summary.displaymode = "BulletList"; } switch (summary.displaymode) { case "List": headerSep = "
"; first = ""; pre = ""; post = "
"; end = ""; break; case "BulletList": default: headerSep = ""; first = ""; break; case "SingleParagraph": headerSep = " "; first = ""; pre = ""; post = " "; end = "
"; break; } s = ""; if (typeof(summary.headertext) == "string") { s += summary.headertext + headerSep; } s += first; for (i=0; i