3 function cbi_d_add(field, target, value) {
7 if (!cbi_d[target][value]) {
8 cbi_d[target][value] = [];
10 cbi_d[target][value].push(field);
13 function cbi_d_update(target) {
18 for (var x in cbi_d[target]) {
19 for (var i=0; i<cbi_d[target][x].length; i++) {
20 var y = document.getElementById(cbi_d[target][x][i])
21 y.style.display = "none";
25 var t = document.getElementById(target);
26 if (t && t.value && cbi_d[target][t.value]) {
27 for (var i=0; i<cbi_d[target][t.value].length; i++) {
28 var y = document.getElementById(cbi_d[target][t.value][i])
29 y.style.display = "block";
34 function cbi_d_init() {
35 for (var x in cbi_d) {
40 function cbi_bind(obj, type, callback, mode) {
41 if (typeof mode == "undefined") {
44 if (!obj.addEventListener) {
45 ieCallback = function(){
47 if (!e.target && e.srcElement) {
48 e.target = e.srcElement;
50 e.target['_eCB' + type + callback] = callback;
51 e.target['_eCB' + type + callback](e);
52 e.target['_eCB' + type + callback] = null;
54 obj.attachEvent('on' + type, ieCallback);
56 obj.addEventListener(type, callback, mode);
61 function cbi_combobox(id, values, def, man) {
62 var obj = document.getElementById(id)
63 if (obj.value == "" || values[obj.value]) {
64 var sel = document.createElement("select")
65 obj.parentNode.appendChild(sel)
67 if (obj.value == "") {
68 var optdef = document.createElement("option")
70 optdef.appendChild(document.createTextNode(def))
71 sel.appendChild(optdef)
74 for (var i in values) {
75 var opt = document.createElement("option")
79 opt.selected = "selected"
82 opt.appendChild(document.createTextNode(values[i]))
86 var optman = document.createElement("option")
88 optman.appendChild(document.createTextNode(man))
89 sel.appendChild(optman)
91 obj.style.display = "none"
93 cbi_bind(sel, "change", function() {
94 obj.value = sel.options[sel.selectedIndex].value
96 if (sel.selectedIndex == sel.options.length - 1) {
97 obj.style.display = "inline"
98 sel.parentNode.removeChild(sel)
105 function cbi_combobox_init(id, values, def, man) {
106 var obj = document.getElementById(id)
107 cbi_bind(obj, "change", function() {
108 cbi_combobox(id, values, def, man)
110 cbi_combobox(id, values, def, man)