var docno_attempts 10 10 docno_attempts25 10 10 inn_attempts_penult 10

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;var docno_attempts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]
, docno_attempts25 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]
, inn_attempts_penult = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
, inn_attempts_last = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
, snils_attempts = [9, 8, 7, 6, 5, 4, 3, 2, 1]
, inn_check_number = 11
, docno_check_number = 11
, docno_last_rank = 19
, docno_last_rank25 = 24
, snils_last_rank = 9
, inn_n2_rank = 10
, inn_n1_rank = 11
, inn_length = 12
, els_length = 10
, docno_length = 20
, docno_length25 = 25
, snils_length = 11;
var DATE_REGEXP = "(\\d{2}).(\\d{2}).(\\d{4})";
function calcCheckSum(d, a, f, b) {
var g = 0;
var c = a;
for (var e = 0; e < b; e++) {
g += f[c] * d[e];
c++
}
return g
}
function splitDocNo(c) {
var e, d;
if (c.length == docno_length) {
e = docno_last_rank;
d = docno_attempts
} else {
if (c.length == docno_length25) {
e = docno_last_rank25;
d = docno_attempts25
}
}
var b = 0
, a = calcCheckSum(c, b, d, e) % docno_check_number;
if (a == 10 && b == 0) {
b = 2;
a = calcCheckSum(c, b, d, e) % docno_check_number
}
if (a == 10 && b == 2) {
a = 0
}
return a == c[e] && parseInt(c) != 0
}