- e_h = document.getElementById("ongh");
- e_m = document.getElementById("ongm");
- e_s = document.getElementById("ongs");
-
- if (e_h == null || e_m == null || e_s == null) {
- // window.alert("NUL");
- return;
+ for (var i=0; ; ++i) {
+ var ind = i;
+ if (ind == 0)
+ ind = '';
+ e_h[i] = document.getElementById("ongh"+ind);
+ e_m[i] = document.getElementById("ongm"+ind);
+ e_s[i] = document.getElementById("ongs"+ind);
+
+ if (e_h[i] == null || e_m[i] == null || e_s[i] == null) {
+ // window.alert("NUL "+i);
+ break;
+ }
+
+ h[i] = e_h[i].innerHTML;
+ m[i] = e_m[i].innerHTML;
+ s[i] = e_s[i].innerHTML;
+
+ if (h[i].length != 2 || m[i].length != 2 || s[i].length != 2) {
+ // window.alert("LENGTH "+i);
+ break;
+ }
+
+ timer[i] = document.getElementById("timer"+ind);
+ timer[i].onclick = function () {
+ enabled = !enabled;
+ if (!(enabled && valid))
+ return;
+ for (var j=x; j > 0; --j) {
+ if (j > n) {
+ var block = timer[j].parentNode;
+ var br = timer[j].nextSibling;
+ block.removeChild(timer[j]);
+ block.removeChild(br);
+ --x;
+ continue;
+ }
+ e_h[j].innerHTML = h[j];
+ e_m[j].innerHTML = m[j];
+ e_s[j].innerHTML = s[j];
+ }
+ };
+ n = i;
+ x = n;