1 // initial values for either Nosy, Superseder, Topic and Waiting On,
2 // depending on which has called
4 original_field = window.opener.document.itemSynopsis[field].value;
7 // pop() and push() methods for pre5.5 IE browsers
9 function bName() {
10 // test for IE
11 if (navigator.appName == "Microsoft Internet Explorer")
12 return 1;
13 return 0;
14 }
16 function bVer() {
17 // return version number (e.g., 4.03)
18 msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
19 return(parseFloat(navigator.appVersion.substr(msieIndex,3)));
20 }
22 function pop() {
23 // make a pop method for old IE browsers
24 var lastElement = this[this.length - 1];
25 this.length--;
26 return lastElement;
27 }
29 function push() {
30 // make a pop method for old IE browsers
31 var sub = this.length;
32 for (var i = 0; i < push.arguments.length; ++i) {
33 this[sub] = push.arguments[i];
34 sub++;
35 }
36 }
38 // add the pop() and push() method to Array prototype for old IE browser
39 if (bName() == 1 && bVer() >= 5.5);
40 else {
41 Array.prototype.pop = pop;
42 Array.prototype.push = push;
43 }
45 function trim(value) {
46 var temp = value;
47 var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
48 if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
49 var obj = / /g;
50 while (temp.match(obj)) { temp = temp.replace(obj, " "); }
51 return temp;
52 }
54 function determineList() {
55 // generate a comma-separated list of the checked items
56 if (document.frm_help.check==undefined) { return; }
57 var list = new Array();
58 if (document.frm_help.check.length==undefined) {
59 if (document.frm_help.check.checked) {
60 list.push(document.frm_help.check.value);
61 }
62 } else {
63 for (box=0; box < document.frm_help.check.length; box++) {
64 if (document.frm_help.check[box].checked) {
65 list.push(document.frm_help.check[box].value);
66 }
67 }
68 }
69 return new String(list.join(','));
70 }
72 function updateList() {
73 // write back to opener window
74 if (document.frm_help.check==undefined) { return; }
75 window.opener.document.itemSynopsis[field].value = determineList();
76 }
78 function updatePreview() {
79 // update the preview box
80 if (document.frm_help.check==undefined) { return; }
81 writePreview(determineList());
82 }
84 function clearList() {
85 // uncheck all checkboxes
86 if (document.frm_help.check==undefined) { return; }
87 for (box=0; box < document.frm_help.check.length; box++) {
88 document.frm_help.check[box].checked = false;
89 }
90 }
92 function reviseList(vals) {
93 // update the checkboxes based on the preview field
94 if (document.frm_help.check==undefined) { return; }
95 var to_check;
96 var list = vals.split(",");
97 if (document.frm_help.check.length==undefined) {
98 check = document.frm_help.check;
99 to_check = false;
100 for (val in list) {
101 if (check.value==trim(list[val])) {
102 to_check = true;
103 break;
104 }
105 }
106 check.checked = to_check;
107 } else {
108 for (box=0; box < document.frm_help.check.length; box++) {
109 check = document.frm_help.check[box];
110 to_check = false;
111 for (val in list) {
112 if (check.value==trim(list[val])) {
113 to_check = true;
114 break;
115 }
116 }
117 check.checked = to_check;
118 }
119 }
120 }
122 function resetList() {
123 // reset preview and check boxes to initial values
124 if (document.frm_help.check==undefined) { return; }
125 writePreview(original_field);
126 reviseList(original_field);
127 }
129 function writePreview(val) {
130 // writes a value to the text_preview
131 document.frm_help.text_preview.value = val;
132 }
134 function focusField(name) {
135 for(i=0; i < document.forms.length; ++i) {
136 var obj = document.forms[i].elements[name];
137 if (obj && obj.focus) {obj.focus();}
138 }
139 }
141 function selectField(name) {
142 for(i=0; i < document.forms.length; ++i) {
143 var obj = document.forms[i].elements[name];
144 if (obj && obj.focus){obj.focus();}
145 if (obj && obj.select){obj.select();}
146 }
147 }