0e39237130db623a201504f85b7af6600061bc73
1 var browserType;
3 if (document.layers) {browserType = "nn4"}
4 if (document.all) {browserType = "ie"}
5 if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
7 netscape = "";
8 ver= navigator.appVersion; len = ver.length;
10 for (iln = 0; iln < len; iln++){
11 if (ver.charAt(iln) == "("){
12 break;
13 }
14 }
15 netscape= (ver.charAt(iln+1).toUpperCase() != "C");
18 function keyPress(DnEvents) {
19 // determines whether Netscape or Internet Explorer
20 k = (netscape) ? DnEvents.keyCode : window.event.keyCode;
21 if (k == 13) { // enter key pressed
22 if(typeof(nextfield)!='undefined') {
23 if(nextfield == 'login') {
24 return true; // submit, we finished all fields
25 } else { // we're not done yet, send focus to next box
26 eval('document.mainform.' + nextfield + '.focus()');
27 return false;
28 }
29 } else {
30 if(netscape) {
31 if(DnEvents.target.type == 'textarea') {
32 return true;
33 } else if (DnEvents.target.type != 'submit') {
34 // TAB
35 var thisfield = document.getElementById(DnEvents.target.id);
36 for (i = 0; i < document.forms[0].elements.length; i++) {
37 if(document.forms[0].elements[i].id==thisfield.id) {
38 // Last form element on page?
39 if(i!=document.forms[0].elements.length-1) {
40 document.forms[0].elements[i+1].focus();
41 }
42 }
43 }
44 return false;
45 } else {
46 return true;
47 }
48 // Check for konqueror
49 } else if(document.clientWidth) {
50 // do nothing ATM
51 } else {
52 if(window.event.srcElement.type == 'textarea') {
53 return true;
54 } else if (window.event.srcElement.type != 'submit') {
55 // TAB
56 var thisfield = document.getElementById(window.event.srcElement.id);
57 for (i = 0; i < document.forms[0].elements.length; i++) {
58 if(document.forms[0].elements[i].id==thisfield.id) {
59 // Last form element on page?
60 if(i!=document.forms[0].elements.length-1) {
61 document.forms[0].elements[i+1].focus();
62 }
63 }
64 }
65 return false;
66 } else {
67 return true;
68 }
69 }
70 }
71 } else if (k==9) {
72 // Tab key pressed
73 if(netscape) {
74 if(DnEvents.target.type == 'textarea') {
75 document.getElementById(DnEvents.target.id).value+="\t";
76 return false;
77 }
78 // Check for konqueror
79 } else if(document.clientWidth) {
80 // do nothing ATM
81 } else {
82 if(window.event.srcElement.type == 'textarea') {
83 document.getElementById(window.event.srcElement.id).value+="\t";
84 return false;
85 }
86 }
87 }
88 }
90 function changeState(myField) {
91 if(document.getElementById(myField) != null){
92 document.getElementById(myField).disabled=(document.getElementById(myField).disabled)?false:true;
93 }
94 }
96 function setHidden(str) {
97 type = document.getElementById(str).style.display;
98 if((type=='')||(type=='block')) {
99 document.getElementById(str).style.display='none';
100 }else{
101 document.getElementById(str).style.display='block';
102 }
103 }
104 function changeSelectState(triggerField, myField) {
105 if (document.getElementById(triggerField).value != 2){
106 document.getElementById(myField).disabled= true;
107 } else {
108 document.getElementById(myField).disabled= false;
109 }
110 }
112 function changeSubselectState(triggerField, myField) {
113 if (document.getElementById(triggerField).checked == true){
114 document.getElementById(myField).disabled= false;
115 } else {
116 document.getElementById(myField).disabled= true;
117 }
118 }
120 function changeTripleSelectState(firstTriggerField, secondTriggerField, myField) {
121 if (
122 document.getElementById(firstTriggerField).checked == true &&
123 document.getElementById(secondTriggerField).checked == true){
124 document.getElementById(myField).disabled= false;
125 } else {
126 document.getElementById(myField).disabled= true;
127 }
128 }
130 <!-- Second field must be non-checked -->
131 function changeTripleSelectState_2nd_neg(firstTriggerField, secondTriggerField, myField) {
132 if (
133 document.getElementById(firstTriggerField).checked == true &&
134 document.getElementById(secondTriggerField).checked == false){
135 document.getElementById(myField).disabled= false;
136 } else {
137 document.getElementById(myField).disabled= true;
138 }
139 }
140 // work together to analyze keystrokes
141 if (netscape){
142 document.captureEvents(Event.KEYPRESS);
143 document.onkeypress= keyPress;
144 } else {
145 document.onkeydown= keyPress;
146 }
148 function hide(element) {
149 if (browserType == "gecko" )
150 document.poppedLayer = document.getElementById(element);
151 else if (browserType == "ie")
152 document.poppedLayer = document.all[element];
153 else
154 document.poppedLayer = document.layers[element];
155 document.poppedLayer.style.visibility = "hidden";
156 }
158 function show(element) {
159 if (browserType == "gecko" )
160 document.poppedLayer = document.getElementById(element);
161 else if (browserType == "ie")
162 document.poppedLayer = document.all[element];
163 else
164 document.poppedLayer = document.layers[element];
165 document.poppedLayer.style.visibility = "visible";
166 }
168 function toggle(element) {
169 if (browserType == "gecko" )
170 document.poppedLayer = document.getElementById(element);
171 else if (browserType == "ie")
172 document.poppedLayer = document.all[element];
173 else
174 document.poppedLayer = document.layers[element];
176 if (document.poppedLayer.style.visibility == "visible")
177 hide (element);
178 else
179 show (element);
181 }
183 function popup(target, name) {
184 var mypopup=
185 window.open(
186 target,
187 name,
188 "width=600,height=700,location=no,toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes"
189 );
190 mypopup.focus();
191 return false;
192 }
194 function js_check(form) {
195 form.javascript.value = 'true';
196 }
198 // vim:ts=2:syntax