Handle hostnames with upper-case letters
[webmin.git] / time / time.js
1 function timeInit(F) {
2         secs = new Array();
3         mins = new Array();
4         hours = new Array();
5         for(i=0; i<F.length; i++){
6                 secs[i]  = document.forms[F[i]].second;
7                 mins[i]  = document.forms[F[i]].minute;
8                 hours[i] = document.forms[F[i]].hour; }
9 }
10 function timeUpdate(F) {
11         for(i=0; i<F.length; i++){
12                 s = parseInt(secs[i].selectedIndex);
13                 s = s ? s : 0;
14                 s = s+5;
15                 if( s>59 ){
16                         s -= 60;
17                         m = parseInt(mins[i].selectedIndex);
18                         m= m ? m : 0;
19                         m+=1;
20                         if( m>59 ){
21                                 m -= 60;
22                                 h = parseInt(hours[i].selectedIndex);
23                                 h = h ? h : 0;
24                                 h+=1;
25                                 if( h>23 ){
26                                         h -= 24;
27                                 }
28                                 hours[i].selectedIndex  = h;
29                         }
30                         mins[i].selectedIndex  = m;
31                 }
32         secs[i].selectedIndex = s; }
33         setTimeout('timeUpdate(F)', 5000);
34 }
35 function packNum(t) {
36         return (t < 10 ? '0'+t : t);
37 }