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