var isNN = (navigator.appName.indexOf("Netscape")!=-1); function containsElement(arr, ele) { var found = false, index = 0; while(!found && index < arr.length) { if(arr[index] == ele) found = true; else index++; } return found; } function checkText(obj, req, len_min, len_max, base_type,specialChars, label) { return checkText(obj, req, len_min, len_max, base_type, specialChars, label, 0); } function checkText(obj, req, len_min, len_max, base_type, specialChars, label, check_status) { var ch = ""; var i = 0; var value; if (base_type != "PWD") obj.value = trim(obj.value); value=obj.value; if (!checkReq(obj, value, req, label, check_status)) return false; if (value.length < len_min) { errorMsg = "Input value for " + label + " must be at least " + len_min + " characters."; return handleError(obj, errorMsg, check_status); } if (value.length > len_max) { errorMsg = "Input value for " + label + " contains too many characters. Only " + len_max + " characters may be entered"; return handleError(obj,errorMsg, check_status); } if (base_type == "N" || base_type == "n") { return isValidNType(obj, value, specialChars, label, check_status); } else if (base_type == "AN") { return isValidANType(obj, value, specialChars, label, check_status); } else if (base_type == "X") { return true;} else if (base_type != "PWD" && base_type != "pwd") { errorMsg = "INTERNAL APPLICATION ERROR: " + label + " has invalid base_type " + base_type; return handleError(obj,errorMsg, check_status); } return true; } function isValidNType(obj,value, specialChars, label, check_status) { for (i=0; i=0 && value.charAt(c)==' ') c--; endPos=c+1; if (endPos<=startPos) value=''; else value=value.substring(startPos,endPos); return value; } function isNumChar(ch) { if (ch >= '0' && ch <= '9') return true; return false; } function isAlphaChar(ch) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) return true; return false; } function isAlphaNumChar(ch) { if (isNumChar(ch) || isAlphaChar(ch)) return true; return false; } function isLowerAlphaChar(ch) { if ((ch >= 'a' && ch <= 'z')) return true; return false; } function isLowerAlphaNumChar(ch) { if (isNumChar(ch) || isLowerAlphaChar(ch)) return true; return false; } function handleError(obj, str, check_status) { if (errorField == null && check_status == 1 && obj != "") errorField=obj; if (check_status != 1) { alert(str); } else { if (totalErrorCount >= totalErrorLimit) return true; totalErrorCount++; errorMsgBuffer += "\n\n(" + totalErrorCount + ") " + str; if (totalErrorCount >= totalErrorLimit) { //errorMsgBuffer += "\n\n... too many errors ..." return true; } } return false; } function checkReqValueOnly(obj, val, req, label) { if (req == 1 && (obj.value == null || obj.value =="")) { if (val != "nofocusset") { if (errorField == null) errorField=obj; } return false; } return true; } function checkReq(obj, val, req, label, check_status) { if (check_status == 1) { if (req == 1 && (obj.value == null || obj.value =="" || obj.value ==" ")) { if (missingFlds == "") { missingFlds = label; } else { missingFlds = missingFlds + ", " + label; } if (val != "nofocusset") { if (errorField == null) errorField=obj; } return false; } return true; } else { if (req == 1 && (val == null || val =="")) { errorMsg = "The " + label + " is required. Please enter a value for this field."; handleError(obj, errorMsg, check_status); return false; } if (req == 0 && (val == null || val =="")) { return false; } return true; } } function toDigits(str) { var ch = ""; var junk = ""; if (str != null && str != "") { for (i=0; i= '0' && ch <= '9') junk += ch; } } return junk; } function checkSelect(obj, val, req, label, check_status) { var i = 0; if ( req != 1) { return true; } if (! obj.options[0].selected) { return true; } else { if (check_status == 1) { if (missingFlds == "") { missingFlds = label; } else { missingFlds = missingFlds + ", " + label; } if (val != "nofocusset") { if (errorField == null) errorField=obj; } return false; } else { errorMsg = "The " + label + " field is required. Please select a value from the list."; return handleError(obj, errorMsg, 1); } } return false; } function checkCheckBox(obj, val, req, label, check_status) { var i = 0; if (obj.checked == true) { return true; } else { if (check_status == 1) { if (missingFlds == "") { missingFlds = label; } else { missingFlds = missingFlds + ", " + label; } if (val != "nofocusset") { if (errorField == null) errorField=obj; } alert ('false'); return false; } else { errorMsg = "Please select the check box to indicate acceptance of the " + label + " in order to proceed with the Registration process."; return handleError(obj, errorMsg, 1); } } return false; }