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 var sel = document.createElement("select");
64 obj.parentNode.appendChild(sel);
66 if (obj.value == "") {
67 var optdef = document.createElement("option");
69 optdef.appendChild(document.createTextNode(def));
70 sel.appendChild(optdef);
71 } else if (!values[obj.value]) {
72 var opt = document.createElement("option");
73 opt.value = obj.value;
74 opt.selected = "selected";
75 opt.appendChild(document.createTextNode(obj.value));
79 for (var i in values) {
80 var opt = document.createElement("option");
84 opt.selected = "selected";
87 opt.appendChild(document.createTextNode(values[i]));
91 var optman = document.createElement("option");
93 optman.appendChild(document.createTextNode(man));
94 sel.appendChild(optman);
96 obj.style.display = "none";
98 cbi_bind(sel, "change", function() {
99 obj.value = sel.options[sel.selectedIndex].value;
101 if (sel.selectedIndex == sel.options.length - 1) {
102 obj.style.display = "inline";
103 sel.parentNode.removeChild(sel);
109 function cbi_combobox_init(id, values, def, man) {
110 var obj = document.getElementById(id)
111 cbi_bind(obj, "blur", function() {
112 cbi_combobox(id, values, def, man)
114 cbi_combobox(id, values, def, man)