summaryrefslogtreecommitdiffhomepage
path: root/themes/fledermaus/contrib/media/cbi.js
blob: f9e463bca1720cacdd038d67c4d6629598a039f1 (plain)
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
var cbi_d = {};

function cbi_d_add(field, target, value) {
	if (!cbi_d[target]) {
		cbi_d[target] = {};
	}
	if (!cbi_d[target][value]) {
		cbi_d[target][value] = [];
	}
	cbi_d[target][value].push(field);
}

function cbi_d_update(target) {
	if (!cbi_d[target]) {
		return;
	}
	
	for (var x in cbi_d[target]) {
		for (var i=0; i<cbi_d[target][x].length; i++) {			
			document.getElementById(cbi_d[target][x][i]).style.display = "none";
		}
	}
	
	var t = document.getElementById(target);
	if (t && t.value && cbi_d[target][t.value]) {
		for (var i=0; i<cbi_d[target][t.value].length; i++) {			
			document.getElementById(cbi_d[target][t.value][i]).style.display = "block";
		}
	}
}

function cbi_d_init() {
	for (var x in cbi_d) {
		cbi_d_update(x);
	}
}