308
|
1 function checkBrowser() {
|
|
2
|
|
3 this.ua = navigator.userAgent;
|
|
4 this.ver = navigator.appVersion;
|
|
5 this.dom = ( document.getElementById );
|
|
6 this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 );
|
|
7 this.ie4 = ( document.all ) && ( !this.dom );
|
|
8 this.ie5 = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom );
|
|
9 this.ie6 = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom );
|
|
10 this.ns4 = ( document.layers ) && ( !this.dom );
|
|
11 this.ns6 = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera );
|
|
12 this.ns = this.ns4 || this.ns6;
|
|
13 this.ie = this.ie4 || this.ie5 || this.ie6;
|
|
14
|
|
15 return this;
|
|
16 }
|
|
17
|
|
18 browser = new checkBrowser();
|
|
19
|
|
20 function changeBc(obj, color){
|
|
21 var div;
|
|
22
|
|
23 if (color == '' && browser.ns4) color = null;
|
|
24
|
|
25 if (browser.ns4) div = document.layers[obj];
|
|
26 else if (browser.dom) div = document.getElementById(obj).style;
|
|
27 else if (browser.ie) div = document.all[obj].style;
|
|
28
|
|
29 if (browser.dom || browser.ie) div.backgroundColor = color;
|
|
30 if (browser.ns4) div.bgColor = color;
|
|
31 }
|
|
32
|
|
33 function makeArray(n){
|
|
34 this.length = n;
|
|
35 for (var i = 0; i < n; i++) {
|
|
36 this[i] = new Image();
|
|
37 }
|
|
38
|
|
39 return this;
|
|
40 }
|
|
41
|
|
42 function preloadImages() {
|
|
43 over = new makeArray(document.images.length);
|
|
44 away = new makeArray(document.images.length);
|
|
45
|
|
46 for (i = 0; i < document.images.length; i++) {
|
|
47 currName = document.images[i].src.slice(0, document.images[i].src.lastIndexOf('.')-1);
|
|
48 away[i].src = currName + "0.gif";
|
|
49 over[i].src = currName + "1.gif";
|
|
50 }
|
|
51 }
|
|
52
|
|
53 function overButton(n) {
|
|
54 currButton = document.images[n];
|
|
55
|
|
56 currButton.src = over[n].src;
|
|
57 if (showHelp) contextHelp(n);
|
|
58 }
|
|
59
|
|
60 function awayButton(n) {
|
|
61 currButton = document.images[n];
|
|
62
|
|
63 currButton.src = away[n].src;
|
|
64 }
|
|
65
|
|
66 function overItem(obj) {
|
|
67 changeBc("menu" + obj, '#770000');
|
|
68 clearTimeout(timeID);
|
|
69 }
|
|
70
|
|
71 function awayItem(obj) {
|
|
72 changeBc("menu" + obj, '#666666');
|
|
73 timeID = setTimeout("hideMenu()", 700);
|
|
74 }
|
|
75
|
|
76 var timeID = null;
|
|
77
|
|
78 function changeMark(obj) {
|
|
79 var object;
|
|
80
|
|
81 if (browser.ns4) object = document.layers["menu" + obj].document.images[0];
|
|
82 else if (browser.dom) object = document.getElementById("mark" + obj);
|
|
83 else if (browser.ie) object = document.all["mark" + obj];
|
|
84
|
|
85 var path = object.src.slice(0, object.src.lastIndexOf('/')+1);
|
|
86
|
|
87 object.src = (object.src.indexOf("nomark") > -1) ? path + "mark.gif" : path + "nomark.gif";
|
|
88 }
|
|
89
|
|
90 function showMenu(obj) {
|
|
91 menu(obj, true);
|
|
92 }
|
|
93
|
|
94 function menu(obj, show) {
|
|
95 var currObj = "menu" + obj;
|
|
96 var idx = 0;
|
|
97 while(true) {
|
|
98 if (browser.ns4 && document.layers[currObj]) document.layers[currObj].visibility = (show) ? "show" : "hide";
|
|
99 else if (browser.dom && document.getElementById(currObj)) document.getElementById(currObj).style.visibility = (show) ? "visible" : "hidden";
|
|
100 else if (browser.ie && document.all[currObj]) document.all[currObj].style.visibility = (show) ? "visible" : "hidden";
|
|
101 else break;
|
|
102
|
|
103 currObj = "menu" + obj + (++idx);
|
|
104 }
|
|
105 if (!show) activeMenu = '';
|
|
106 else activeMenu = obj;
|
|
107
|
|
108 timeID = setTimeout("hideMenu()", 2000);
|
|
109 }
|
|
110
|
|
111 function hideMenu() {
|
|
112 if (activeMenu != '') menu(activeMenu, false);
|
|
113 clearTimeout(timeID);
|
|
114 }
|
|
115
|
|
116 var activeMenu = '';
|
|
117
|
|
118
|
|
119 // just to be sure, that no buffer overflow can arrive
|
|
120 var semaphor = true;
|
|
121
|
|
122 function contextHelp(n) {
|
|
123
|
|
124 if (helpWindow.closed) {
|
|
125 changeMark(31);
|
|
126 changeHelp();
|
|
127 return;
|
|
128 }
|
|
129
|
|
130 if ((navigator.appVersion.indexOf("Macintosh") < 0) && semaphor) {
|
|
131 semaphor = false;
|
|
132 var help = helpText[n].split("|");
|
|
133
|
|
134 helpWindow.focus();
|
|
135 helpWindow.document.open();
|
|
136 helpWindow.document.write('<html><head><title>Context Help</title>');
|
|
137 helpWindow.document.write('<style type="text/css">');
|
|
138 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
139 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
140 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7" onload="opener.semaphor = true;">');
|
|
141 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">');
|
|
142 helpWindow.document.write(help[0] + '</tr><tr><td class="text">');
|
|
143 helpWindow.document.write(help[1] + '</tr></td></table></body></html>');
|
|
144 helpWindow.document.close();
|
|
145
|
|
146 // stupid workaround because of netscape 6, that doesen't know the opener property
|
|
147 // this workaround is still ok because netscape 6 has eventbuffer checks so no overflow
|
|
148 if (browser.ns6) {
|
|
149 semaphor = true;
|
|
150 }
|
|
151
|
|
152 // next stupid workaround because of opera 6, that somehow don't start the 'onLoad'-
|
|
153 // attribute in the body tag (the helpwindow does not finish loading)
|
|
154 if (browser.opera) {
|
|
155 setTimeout("semaphor = true;", 50);
|
|
156 }
|
|
157
|
|
158 }
|
|
159 }
|
|
160
|
|
161 function openContextHelp() {
|
|
162 if (navigator.appVersion.indexOf("Macintosh") > -1) {
|
|
163 openContextHelpMac();
|
|
164 return;
|
|
165 }
|
|
166
|
|
167 semaphor = false;
|
|
168
|
|
169 var winWidth = 270;
|
|
170 var winHeight = 130;
|
|
171
|
|
172 var xScreen = 0.9*(screen.width-winWidth);
|
|
173 var yScreen = 0.8*(screen.height-winHeight);
|
|
174
|
|
175 helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen);
|
|
176
|
|
177 helpWindow.focus();
|
|
178 helpWindow.document.open();
|
|
179 helpWindow.document.write('<html><head><title>Context Help</title>');
|
|
180 helpWindow.document.write('<style type="text/css">');
|
|
181 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
182 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
183 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">');
|
|
184 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">');
|
|
185 helpWindow.document.write('Context Help</tr><tr><td class="text">');
|
|
186 helpWindow.document.write('Move over any button to get some more information about its function</tr></td></table></body></html>');
|
|
187 helpWindow.document.close();
|
|
188
|
|
189 // for some safety reason help-requests have to be blocked while opening the window
|
|
190 setTimeout("semaphor = true;", 200);
|
|
191 }
|
|
192
|
|
193 // because macs have a strange window focus behaviour we have to go a special
|
|
194 // way for them - just opening a window that contains all button-descriptions
|
|
195 function openContextHelpMac() {
|
|
196
|
|
197 var winWidth = 270;
|
|
198 var winHeight = 600;
|
|
199
|
|
200 var xScreen = 0.9*(screen.width-winWidth);
|
|
201 var yScreen = 0.8*(screen.height-winHeight);
|
|
202
|
|
203 helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen + ",scrollbars");
|
|
204
|
|
205 helpWindow.focus();
|
|
206 helpWindow.document.open();
|
|
207 helpWindow.document.write('<html><head><title>Context Help Macintosh</title>');
|
|
208 helpWindow.document.write('<style type="text/css">');
|
|
209 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
210 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
211 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">');
|
|
212 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3">');
|
|
213
|
|
214 for (n = 0; n < helpText.length; n++) {
|
|
215
|
|
216 help = helpText[n].split("|");
|
|
217 helpWindow.document.write('<tr><td bgcolor="#666666" class="title">');
|
|
218 helpWindow.document.write(help[0] + '</tr><tr><td class="text">');
|
|
219 helpWindow.document.write('<p>' + help[1] + '<br> </p></tr></td>');
|
|
220 }
|
|
221 helpWindow.document.write('</table></body></html>');
|
|
222 helpWindow.document.close();
|
|
223 }
|
|
224
|
|
225
|
|
226 function closeContextHelp() {
|
|
227 if (helpWindow != '' && !helpWindow.closed) {
|
|
228 helpWindow.close();
|
|
229 }
|
|
230 helpWindow = '';
|
|
231 }
|
|
232
|
|
233 function changeHelp() {
|
|
234 showHelp = !showHelp;
|
|
235 showHelp ? openContextHelp() : closeContextHelp();
|
|
236 }
|
|
237
|
|
238
|
|
239 // variable containing the contextwindow
|
|
240 var helpWindow = ''; |