Jacek Kowalski
2012-06-23 175a52e78df3f3462927885ce6d732cb1b36a818
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
function keypress(e) {
    if(!e) {
        e = window.event;
    }
    
    switch(e.keyCode) {
        case 112:
            setTimeout('window.location.replace("index.php");', 10);
            return false;
        break;
        case 113:
            setTimeout('window.location.replace("add.php");', 10);
            return false;
        break;
        case 114:
            setTimeout('window.location.replace("place.php");', 10);
            return false;
        break;
        case 115:
            setTimeout('window.location.replace("generate.php");', 10);
            return false;
        break;
    }
}
 
function ffalse(ids) {
    i=1;
    while(true) {
        obj = document.getElementById(ids+i);
        if(!obj) break;
        
        if((obj.hasAttribute('required') || obj.className=='focus') && obj.value=='') {
            obj.focus();
            return false;
        }
        i++;
    }
    
    return true;
}
 
function ffalse_focus() {
    el = document.getElementsByClassName('focus');
    
    for(i=0; i<el.length; i++) {
        el.item(i).onfocus = "this.className=''";
    }
}
 
function uc_all(ids, check) {
    list = document.getElementById(ids).getElementsByTagName('input');
    
    for(i=0; i<list.length; i++) {
        box = list.item(i);
        if(box.type == 'checkbox') {
            box.checked = check;
        }
    }
}
 
function pups_init() {
    an = document.getElementsByTagName('a');
    
    for(i=0; i<an.length; i++) {
        if((an.item(i).href+'').match('cover.php\?')) {
            an[i].onclick = pups;
        }
    }
}
 
function pups(an) {
    an = an.target.parentNode;
    if(an) {
        win = window.open(an.href+'&pop', '_blank', 'dependent=yes,toolbar=no,resizable=yes');
        return false;
    }
}
 
function on_loaded() {
    ffalse_focus();
    pups_init();
}
 
document.onkeydown = keypress;
window.onload = on_loaded();