Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.event.browser");
13
dojo.provide("dojo.event.browser");
12
dojo.require("dojo.event.common");
14
dojo.require("dojo.event.common");
13
dojo._ie_clobber = new function () {
15
dojo._ie_clobber = new function () {
14
	this.clobberNodes = [];
16
	this.clobberNodes = [];
15
	function nukeProp(node, prop) {
17
	function nukeProp(node, prop) {
16
		try {
18
		try {
17
			node[prop] = null;
19
			node[prop] = null;
18
		}
20
		}
19
		catch (e) {
21
		catch (e) {
20
		}
22
		}
21
		try {
23
		try {
22
			delete node[prop];
24
			delete node[prop];
23
		}
25
		}
24
		catch (e) {
26
		catch (e) {
25
		}
27
		}
26
		try {
28
		try {
27
			node.removeAttribute(prop);
29
			node.removeAttribute(prop);
28
		}
30
		}
29
		catch (e) {
31
		catch (e) {
30
		}
32
		}
31
	}
33
	}
32
	this.clobber = function (nodeRef) {
34
	this.clobber = function (nodeRef) {
33
		var na;
35
		var na;
34
		var tna;
36
		var tna;
35
		if (nodeRef) {
37
		if (nodeRef) {
36
			tna = nodeRef.all || nodeRef.getElementsByTagName("*");
38
			tna = nodeRef.all || nodeRef.getElementsByTagName("*");
37
			na = [nodeRef];
39
			na = [nodeRef];
38
			for (var x = 0; x < tna.length; x++) {
40
			for (var x = 0; x < tna.length; x++) {
39
				if (tna[x]["__doClobber__"]) {
41
				if (tna[x]["__doClobber__"]) {
40
					na.push(tna[x]);
42
					na.push(tna[x]);
41
				}
43
				}
42
			}
44
			}
43
		} else {
45
		} else {
44
			try {
46
			try {
45
				window.onload = null;
47
				window.onload = null;
46
			}
48
			}
47
			catch (e) {
49
			catch (e) {
48
			}
50
			}
49
			na = (this.clobberNodes.length) ? this.clobberNodes : document.all;
51
			na = (this.clobberNodes.length) ? this.clobberNodes : document.all;
50
		}
52
		}
51
		tna = null;
53
		tna = null;
52
		var basis = {};
54
		var basis = {};
53
		for (var i = na.length - 1; i >= 0; i = i - 1) {
55
		for (var i = na.length - 1; i >= 0; i = i - 1) {
54
			var el = na[i];
56
			var el = na[i];
55
			try {
57
			try {
56
				if (el && el["__clobberAttrs__"]) {
58
				if (el && el["__clobberAttrs__"]) {
57
					for (var j = 0; j < el.__clobberAttrs__.length; j++) {
59
					for (var j = 0; j < el.__clobberAttrs__.length; j++) {
58
						nukeProp(el, el.__clobberAttrs__[j]);
60
						nukeProp(el, el.__clobberAttrs__[j]);
59
					}
61
					}
60
					nukeProp(el, "__clobberAttrs__");
62
					nukeProp(el, "__clobberAttrs__");
61
					nukeProp(el, "__doClobber__");
63
					nukeProp(el, "__doClobber__");
62
				}
64
				}
63
			}
65
			}
64
			catch (e) {
66
			catch (e) {
65
			}
67
			}
66
		}
68
		}
67
		na = null;
69
		na = null;
68
	};
70
	};
69
};
71
};
70
if (dojo.render.html.ie) {
72
if (dojo.render.html.ie) {
71
	dojo.addOnUnload(function () {
73
	dojo.addOnUnload(function () {
72
		dojo._ie_clobber.clobber();
74
		dojo._ie_clobber.clobber();
73
		try {
75
		try {
74
			if ((dojo["widget"]) && (dojo.widget["manager"])) {
76
			if ((dojo["widget"]) && (dojo.widget["manager"])) {
75
				dojo.widget.manager.destroyAll();
77
				dojo.widget.manager.destroyAll();
76
			}
78
			}
77
		}
79
		}
78
		catch (e) {
80
		catch (e) {
79
		}
81
		}
80
		if (dojo.widget) {
82
		if (dojo.widget) {
81
			for (var name in dojo.widget._templateCache) {
83
			for (var name in dojo.widget._templateCache) {
82
				if (dojo.widget._templateCache[name].node) {
84
				if (dojo.widget._templateCache[name].node) {
83
					dojo.dom.destroyNode(dojo.widget._templateCache[name].node);
85
					dojo.dom.destroyNode(dojo.widget._templateCache[name].node);
84
					dojo.widget._templateCache[name].node = null;
86
					dojo.widget._templateCache[name].node = null;
85
					delete dojo.widget._templateCache[name].node;
87
					delete dojo.widget._templateCache[name].node;
86
				}
88
				}
87
			}
89
			}
88
		}
90
		}
89
		try {
91
		try {
90
			window.onload = null;
92
			window.onload = null;
91
		}
93
		}
92
		catch (e) {
94
		catch (e) {
93
		}
95
		}
94
		try {
96
		try {
95
			window.onunload = null;
97
			window.onunload = null;
96
		}
98
		}
97
		catch (e) {
99
		catch (e) {
98
		}
100
		}
99
		dojo._ie_clobber.clobberNodes = [];
101
		dojo._ie_clobber.clobberNodes = [];
100
	});
102
	});
101
}
103
}
102
dojo.event.browser = new function () {
104
dojo.event.browser = new function () {
103
	var clobberIdx = 0;
105
	var clobberIdx = 0;
104
	this.normalizedEventName = function (eventName) {
106
	this.normalizedEventName = function (eventName) {
105
		switch (eventName) {
107
		switch (eventName) {
106
		  case "CheckboxStateChange":
108
		  case "CheckboxStateChange":
107
		  case "DOMAttrModified":
109
		  case "DOMAttrModified":
108
		  case "DOMMenuItemActive":
110
		  case "DOMMenuItemActive":
109
		  case "DOMMenuItemInactive":
111
		  case "DOMMenuItemInactive":
110
		  case "DOMMouseScroll":
112
		  case "DOMMouseScroll":
111
		  case "DOMNodeInserted":
113
		  case "DOMNodeInserted":
112
		  case "DOMNodeRemoved":
114
		  case "DOMNodeRemoved":
113
		  case "RadioStateChange":
115
		  case "RadioStateChange":
114
			return eventName;
116
			return eventName;
115
			break;
117
			break;
116
		  default:
118
		  default:
117
			var lcn = eventName.toLowerCase();
119
			var lcn = eventName.toLowerCase();
118
			return (lcn.indexOf("on") == 0) ? lcn.substr(2) : lcn;
120
			return (lcn.indexOf("on") == 0) ? lcn.substr(2) : lcn;
119
			break;
121
			break;
120
		}
122
		}
121
	};
123
	};
122
	this.clean = function (node) {
124
	this.clean = function (node) {
123
		if (dojo.render.html.ie) {
125
		if (dojo.render.html.ie) {
124
			dojo._ie_clobber.clobber(node);
126
			dojo._ie_clobber.clobber(node);
125
		}
127
		}
126
	};
128
	};
127
	this.addClobberNode = function (node) {
129
	this.addClobberNode = function (node) {
128
		if (!dojo.render.html.ie) {
130
		if (!dojo.render.html.ie) {
129
			return;
131
			return;
130
		}
132
		}
131
		if (!node["__doClobber__"]) {
133
		if (!node["__doClobber__"]) {
132
			node.__doClobber__ = true;
134
			node.__doClobber__ = true;
133
			dojo._ie_clobber.clobberNodes.push(node);
135
			dojo._ie_clobber.clobberNodes.push(node);
134
			node.__clobberAttrs__ = [];
136
			node.__clobberAttrs__ = [];
135
		}
137
		}
136
	};
138
	};
137
	this.addClobberNodeAttrs = function (node, props) {
139
	this.addClobberNodeAttrs = function (node, props) {
138
		if (!dojo.render.html.ie) {
140
		if (!dojo.render.html.ie) {
139
			return;
141
			return;
140
		}
142
		}
141
		this.addClobberNode(node);
143
		this.addClobberNode(node);
142
		for (var x = 0; x < props.length; x++) {
144
		for (var x = 0; x < props.length; x++) {
143
			node.__clobberAttrs__.push(props[x]);
145
			node.__clobberAttrs__.push(props[x]);
144
		}
146
		}
145
	};
147
	};
146
	this.removeListener = function (node, evtName, fp, capture) {
148
	this.removeListener = function (node, evtName, fp, capture) {
147
		if (!capture) {
149
		if (!capture) {
148
			var capture = false;
150
			var capture = false;
149
		}
151
		}
150
		evtName = dojo.event.browser.normalizedEventName(evtName);
152
		evtName = dojo.event.browser.normalizedEventName(evtName);
151
		if (evtName == "key") {
153
		if (evtName == "key") {
152
			if (dojo.render.html.ie) {
154
			if (dojo.render.html.ie) {
153
				this.removeListener(node, "onkeydown", fp, capture);
155
				this.removeListener(node, "onkeydown", fp, capture);
154
			}
156
			}
155
			evtName = "keypress";
157
			evtName = "keypress";
156
		}
158
		}
157
		if (node.removeEventListener) {
159
		if (node.removeEventListener) {
158
			node.removeEventListener(evtName, fp, capture);
160
			node.removeEventListener(evtName, fp, capture);
159
		}
161
		}
160
	};
162
	};
161
	this.addListener = function (node, evtName, fp, capture, dontFix) {
163
	this.addListener = function (node, evtName, fp, capture, dontFix) {
162
		if (!node) {
164
		if (!node) {
163
			return;
165
			return;
164
		}
166
		}
165
		if (!capture) {
167
		if (!capture) {
166
			var capture = false;
168
			var capture = false;
167
		}
169
		}
168
		evtName = dojo.event.browser.normalizedEventName(evtName);
170
		evtName = dojo.event.browser.normalizedEventName(evtName);
169
		if (evtName == "key") {
171
		if (evtName == "key") {
170
			if (dojo.render.html.ie) {
172
			if (dojo.render.html.ie) {
171
				this.addListener(node, "onkeydown", fp, capture, dontFix);
173
				this.addListener(node, "onkeydown", fp, capture, dontFix);
172
			}
174
			}
173
			evtName = "keypress";
175
			evtName = "keypress";
174
		}
176
		}
175
		if (!dontFix) {
177
		if (!dontFix) {
176
			var newfp = function (evt) {
178
			var newfp = function (evt) {
177
				if (!evt) {
179
				if (!evt) {
178
					evt = window.event;
180
					evt = window.event;
179
				}
181
				}
180
				var ret = fp(dojo.event.browser.fixEvent(evt, this));
182
				var ret = fp(dojo.event.browser.fixEvent(evt, this));
181
				if (capture) {
183
				if (capture) {
182
					dojo.event.browser.stopEvent(evt);
184
					dojo.event.browser.stopEvent(evt);
183
				}
185
				}
184
				return ret;
186
				return ret;
185
			};
187
			};
186
		} else {
188
		} else {
187
			newfp = fp;
189
			newfp = fp;
188
		}
190
		}
189
		if (node.addEventListener) {
191
		if (node.addEventListener) {
190
			node.addEventListener(evtName, newfp, capture);
192
			node.addEventListener(evtName, newfp, capture);
191
			return newfp;
193
			return newfp;
192
		} else {
194
		} else {
193
			evtName = "on" + evtName;
195
			evtName = "on" + evtName;
194
			if (typeof node[evtName] == "function") {
196
			if (typeof node[evtName] == "function") {
195
				var oldEvt = node[evtName];
197
				var oldEvt = node[evtName];
196
				node[evtName] = function (e) {
198
				node[evtName] = function (e) {
197
					oldEvt(e);
199
					oldEvt(e);
198
					return newfp(e);
200
					return newfp(e);
199
				};
201
				};
200
			} else {
202
			} else {
201
				node[evtName] = newfp;
203
				node[evtName] = newfp;
202
			}
204
			}
203
			if (dojo.render.html.ie) {
205
			if (dojo.render.html.ie) {
204
				this.addClobberNodeAttrs(node, [evtName]);
206
				this.addClobberNodeAttrs(node, [evtName]);
205
			}
207
			}
206
			return newfp;
208
			return newfp;
207
		}
209
		}
208
	};
210
	};
209
	this.isEvent = function (obj) {
211
	this.isEvent = function (obj) {
210
		return (typeof obj != "undefined") && (obj) && (typeof Event != "undefined") && (obj.eventPhase);
212
		return (typeof obj != "undefined") && (obj) && (typeof Event != "undefined") && (obj.eventPhase);
211
	};
213
	};
212
	this.currentEvent = null;
214
	this.currentEvent = null;
213
	this.callListener = function (listener, curTarget) {
215
	this.callListener = function (listener, curTarget) {
214
		if (typeof listener != "function") {
216
		if (typeof listener != "function") {
215
			dojo.raise("listener not a function: " + listener);
217
			dojo.raise("listener not a function: " + listener);
216
		}
218
		}
217
		dojo.event.browser.currentEvent.currentTarget = curTarget;
219
		dojo.event.browser.currentEvent.currentTarget = curTarget;
218
		return listener.call(curTarget, dojo.event.browser.currentEvent);
220
		return listener.call(curTarget, dojo.event.browser.currentEvent);
219
	};
221
	};
220
	this._stopPropagation = function () {
222
	this._stopPropagation = function () {
221
		dojo.event.browser.currentEvent.cancelBubble = true;
223
		dojo.event.browser.currentEvent.cancelBubble = true;
222
	};
224
	};
223
	this._preventDefault = function () {
225
	this._preventDefault = function () {
224
		dojo.event.browser.currentEvent.returnValue = false;
226
		dojo.event.browser.currentEvent.returnValue = false;
225
	};
227
	};
226
	this.keys = {KEY_BACKSPACE:8, KEY_TAB:9, KEY_CLEAR:12, KEY_ENTER:13, KEY_SHIFT:16, KEY_CTRL:17, KEY_ALT:18, KEY_PAUSE:19, KEY_CAPS_LOCK:20, KEY_ESCAPE:27, KEY_SPACE:32, KEY_PAGE_UP:33, KEY_PAGE_DOWN:34, KEY_END:35, KEY_HOME:36, KEY_LEFT_ARROW:37, KEY_UP_ARROW:38, KEY_RIGHT_ARROW:39, KEY_DOWN_ARROW:40, KEY_INSERT:45, KEY_DELETE:46, KEY_HELP:47, KEY_LEFT_WINDOW:91, KEY_RIGHT_WINDOW:92, KEY_SELECT:93, KEY_NUMPAD_0:96, KEY_NUMPAD_1:97, KEY_NUMPAD_2:98, KEY_NUMPAD_3:99, KEY_NUMPAD_4:100, KEY_NUMPAD_5:101, KEY_NUMPAD_6:102, KEY_NUMPAD_7:103, KEY_NUMPAD_8:104, KEY_NUMPAD_9:105, KEY_NUMPAD_MULTIPLY:106, KEY_NUMPAD_PLUS:107, KEY_NUMPAD_ENTER:108, KEY_NUMPAD_MINUS:109, KEY_NUMPAD_PERIOD:110, KEY_NUMPAD_DIVIDE:111, KEY_F1:112, KEY_F2:113, KEY_F3:114, KEY_F4:115, KEY_F5:116, KEY_F6:117, KEY_F7:118, KEY_F8:119, KEY_F9:120, KEY_F10:121, KEY_F11:122, KEY_F12:123, KEY_F13:124, KEY_F14:125, KEY_F15:126, KEY_NUM_LOCK:144, KEY_SCROLL_LOCK:145};
228
	this.keys = {KEY_BACKSPACE:8, KEY_TAB:9, KEY_CLEAR:12, KEY_ENTER:13, KEY_SHIFT:16, KEY_CTRL:17, KEY_ALT:18, KEY_PAUSE:19, KEY_CAPS_LOCK:20, KEY_ESCAPE:27, KEY_SPACE:32, KEY_PAGE_UP:33, KEY_PAGE_DOWN:34, KEY_END:35, KEY_HOME:36, KEY_LEFT_ARROW:37, KEY_UP_ARROW:38, KEY_RIGHT_ARROW:39, KEY_DOWN_ARROW:40, KEY_INSERT:45, KEY_DELETE:46, KEY_HELP:47, KEY_LEFT_WINDOW:91, KEY_RIGHT_WINDOW:92, KEY_SELECT:93, KEY_NUMPAD_0:96, KEY_NUMPAD_1:97, KEY_NUMPAD_2:98, KEY_NUMPAD_3:99, KEY_NUMPAD_4:100, KEY_NUMPAD_5:101, KEY_NUMPAD_6:102, KEY_NUMPAD_7:103, KEY_NUMPAD_8:104, KEY_NUMPAD_9:105, KEY_NUMPAD_MULTIPLY:106, KEY_NUMPAD_PLUS:107, KEY_NUMPAD_ENTER:108, KEY_NUMPAD_MINUS:109, KEY_NUMPAD_PERIOD:110, KEY_NUMPAD_DIVIDE:111, KEY_F1:112, KEY_F2:113, KEY_F3:114, KEY_F4:115, KEY_F5:116, KEY_F6:117, KEY_F7:118, KEY_F8:119, KEY_F9:120, KEY_F10:121, KEY_F11:122, KEY_F12:123, KEY_F13:124, KEY_F14:125, KEY_F15:126, KEY_NUM_LOCK:144, KEY_SCROLL_LOCK:145};
227
	this.revKeys = [];
229
	this.revKeys = [];
228
	for (var key in this.keys) {
230
	for (var key in this.keys) {
229
		this.revKeys[this.keys[key]] = key;
231
		this.revKeys[this.keys[key]] = key;
230
	}
232
	}
231
	this.fixEvent = function (evt, sender) {
233
	this.fixEvent = function (evt, sender) {
232
		if (!evt) {
234
		if (!evt) {
233
			if (window["event"]) {
235
			if (window["event"]) {
234
				evt = window.event;
236
				evt = window.event;
235
			}
237
			}
236
		}
238
		}
237
		if ((evt["type"]) && (evt["type"].indexOf("key") == 0)) {
239
		if ((evt["type"]) && (evt["type"].indexOf("key") == 0)) {
238
			evt.keys = this.revKeys;
240
			evt.keys = this.revKeys;
239
			for (var key in this.keys) {
241
			for (var key in this.keys) {
240
				evt[key] = this.keys[key];
242
				evt[key] = this.keys[key];
241
			}
243
			}
242
			if (evt["type"] == "keydown" && dojo.render.html.ie) {
244
			if (evt["type"] == "keydown" && dojo.render.html.ie) {
243
				switch (evt.keyCode) {
245
				switch (evt.keyCode) {
244
				  case evt.KEY_SHIFT:
246
				  case evt.KEY_SHIFT:
245
				  case evt.KEY_CTRL:
247
				  case evt.KEY_CTRL:
246
				  case evt.KEY_ALT:
248
				  case evt.KEY_ALT:
247
				  case evt.KEY_CAPS_LOCK:
249
				  case evt.KEY_CAPS_LOCK:
248
				  case evt.KEY_LEFT_WINDOW:
250
				  case evt.KEY_LEFT_WINDOW:
249
				  case evt.KEY_RIGHT_WINDOW:
251
				  case evt.KEY_RIGHT_WINDOW:
250
				  case evt.KEY_SELECT:
252
				  case evt.KEY_SELECT:
251
				  case evt.KEY_NUM_LOCK:
253
				  case evt.KEY_NUM_LOCK:
252
				  case evt.KEY_SCROLL_LOCK:
254
				  case evt.KEY_SCROLL_LOCK:
253
				  case evt.KEY_NUMPAD_0:
255
				  case evt.KEY_NUMPAD_0:
254
				  case evt.KEY_NUMPAD_1:
256
				  case evt.KEY_NUMPAD_1:
255
				  case evt.KEY_NUMPAD_2:
257
				  case evt.KEY_NUMPAD_2:
256
				  case evt.KEY_NUMPAD_3:
258
				  case evt.KEY_NUMPAD_3:
257
				  case evt.KEY_NUMPAD_4:
259
				  case evt.KEY_NUMPAD_4:
258
				  case evt.KEY_NUMPAD_5:
260
				  case evt.KEY_NUMPAD_5:
259
				  case evt.KEY_NUMPAD_6:
261
				  case evt.KEY_NUMPAD_6:
260
				  case evt.KEY_NUMPAD_7:
262
				  case evt.KEY_NUMPAD_7:
261
				  case evt.KEY_NUMPAD_8:
263
				  case evt.KEY_NUMPAD_8:
262
				  case evt.KEY_NUMPAD_9:
264
				  case evt.KEY_NUMPAD_9:
263
				  case evt.KEY_NUMPAD_PERIOD:
265
				  case evt.KEY_NUMPAD_PERIOD:
264
					break;
266
					break;
265
				  case evt.KEY_NUMPAD_MULTIPLY:
267
				  case evt.KEY_NUMPAD_MULTIPLY:
266
				  case evt.KEY_NUMPAD_PLUS:
268
				  case evt.KEY_NUMPAD_PLUS:
267
				  case evt.KEY_NUMPAD_ENTER:
269
				  case evt.KEY_NUMPAD_ENTER:
268
				  case evt.KEY_NUMPAD_MINUS:
270
				  case evt.KEY_NUMPAD_MINUS:
269
				  case evt.KEY_NUMPAD_DIVIDE:
271
				  case evt.KEY_NUMPAD_DIVIDE:
270
					break;
272
					break;
271
				  case evt.KEY_PAUSE:
273
				  case evt.KEY_PAUSE:
272
				  case evt.KEY_TAB:
274
				  case evt.KEY_TAB:
273
				  case evt.KEY_BACKSPACE:
275
				  case evt.KEY_BACKSPACE:
274
				  case evt.KEY_ENTER:
276
				  case evt.KEY_ENTER:
275
				  case evt.KEY_ESCAPE:
277
				  case evt.KEY_ESCAPE:
276
				  case evt.KEY_PAGE_UP:
278
				  case evt.KEY_PAGE_UP:
277
				  case evt.KEY_PAGE_DOWN:
279
				  case evt.KEY_PAGE_DOWN:
278
				  case evt.KEY_END:
280
				  case evt.KEY_END:
279
				  case evt.KEY_HOME:
281
				  case evt.KEY_HOME:
280
				  case evt.KEY_LEFT_ARROW:
282
				  case evt.KEY_LEFT_ARROW:
281
				  case evt.KEY_UP_ARROW:
283
				  case evt.KEY_UP_ARROW:
282
				  case evt.KEY_RIGHT_ARROW:
284
				  case evt.KEY_RIGHT_ARROW:
283
				  case evt.KEY_DOWN_ARROW:
285
				  case evt.KEY_DOWN_ARROW:
284
				  case evt.KEY_INSERT:
286
				  case evt.KEY_INSERT:
285
				  case evt.KEY_DELETE:
287
				  case evt.KEY_DELETE:
286
				  case evt.KEY_F1:
288
				  case evt.KEY_F1:
287
				  case evt.KEY_F2:
289
				  case evt.KEY_F2:
288
				  case evt.KEY_F3:
290
				  case evt.KEY_F3:
289
				  case evt.KEY_F4:
291
				  case evt.KEY_F4:
290
				  case evt.KEY_F5:
292
				  case evt.KEY_F5:
291
				  case evt.KEY_F6:
293
				  case evt.KEY_F6:
292
				  case evt.KEY_F7:
294
				  case evt.KEY_F7:
293
				  case evt.KEY_F8:
295
				  case evt.KEY_F8:
294
				  case evt.KEY_F9:
296
				  case evt.KEY_F9:
295
				  case evt.KEY_F10:
297
				  case evt.KEY_F10:
296
				  case evt.KEY_F11:
298
				  case evt.KEY_F11:
297
				  case evt.KEY_F12:
299
				  case evt.KEY_F12:
298
				  case evt.KEY_F12:
300
				  case evt.KEY_F12:
299
				  case evt.KEY_F13:
301
				  case evt.KEY_F13:
300
				  case evt.KEY_F14:
302
				  case evt.KEY_F14:
301
				  case evt.KEY_F15:
303
				  case evt.KEY_F15:
302
				  case evt.KEY_CLEAR:
304
				  case evt.KEY_CLEAR:
303
				  case evt.KEY_HELP:
305
				  case evt.KEY_HELP:
304
					evt.key = evt.keyCode;
306
					evt.key = evt.keyCode;
305
					break;
307
					break;
306
				  default:
308
				  default:
307
					if (evt.ctrlKey || evt.altKey) {
309
					if (evt.ctrlKey || evt.altKey) {
308
						var unifiedCharCode = evt.keyCode;
310
						var unifiedCharCode = evt.keyCode;
309
						if (unifiedCharCode >= 65 && unifiedCharCode <= 90 && evt.shiftKey == false) {
311
						if (unifiedCharCode >= 65 && unifiedCharCode <= 90 && evt.shiftKey == false) {
310
							unifiedCharCode += 32;
312
							unifiedCharCode += 32;
311
						}
313
						}
312
						if (unifiedCharCode >= 1 && unifiedCharCode <= 26 && evt.ctrlKey) {
314
						if (unifiedCharCode >= 1 && unifiedCharCode <= 26 && evt.ctrlKey) {
313
							unifiedCharCode += 96;
315
							unifiedCharCode += 96;
314
						}
316
						}
315
						evt.key = String.fromCharCode(unifiedCharCode);
317
						evt.key = String.fromCharCode(unifiedCharCode);
316
					}
318
					}
317
				}
319
				}
318
			} else {
320
			} else {
319
				if (evt["type"] == "keypress") {
321
				if (evt["type"] == "keypress") {
320
					if (dojo.render.html.opera) {
322
					if (dojo.render.html.opera) {
321
						if (evt.which == 0) {
323
						if (evt.which == 0) {
322
							evt.key = evt.keyCode;
324
							evt.key = evt.keyCode;
323
						} else {
325
						} else {
324
							if (evt.which > 0) {
326
							if (evt.which > 0) {
325
								switch (evt.which) {
327
								switch (evt.which) {
326
								  case evt.KEY_SHIFT:
328
								  case evt.KEY_SHIFT:
327
								  case evt.KEY_CTRL:
329
								  case evt.KEY_CTRL:
328
								  case evt.KEY_ALT:
330
								  case evt.KEY_ALT:
329
								  case evt.KEY_CAPS_LOCK:
331
								  case evt.KEY_CAPS_LOCK:
330
								  case evt.KEY_NUM_LOCK:
332
								  case evt.KEY_NUM_LOCK:
331
								  case evt.KEY_SCROLL_LOCK:
333
								  case evt.KEY_SCROLL_LOCK:
332
									break;
334
									break;
333
								  case evt.KEY_PAUSE:
335
								  case evt.KEY_PAUSE:
334
								  case evt.KEY_TAB:
336
								  case evt.KEY_TAB:
335
								  case evt.KEY_BACKSPACE:
337
								  case evt.KEY_BACKSPACE:
336
								  case evt.KEY_ENTER:
338
								  case evt.KEY_ENTER:
337
								  case evt.KEY_ESCAPE:
339
								  case evt.KEY_ESCAPE:
338
									evt.key = evt.which;
340
									evt.key = evt.which;
339
									break;
341
									break;
340
								  default:
342
								  default:
341
									var unifiedCharCode = evt.which;
343
									var unifiedCharCode = evt.which;
342
									if ((evt.ctrlKey || evt.altKey || evt.metaKey) && (evt.which >= 65 && evt.which <= 90 && evt.shiftKey == false)) {
344
									if ((evt.ctrlKey || evt.altKey || evt.metaKey) && (evt.which >= 65 && evt.which <= 90 && evt.shiftKey == false)) {
343
										unifiedCharCode += 32;
345
										unifiedCharCode += 32;
344
									}
346
									}
345
									evt.key = String.fromCharCode(unifiedCharCode);
347
									evt.key = String.fromCharCode(unifiedCharCode);
346
								}
348
								}
347
							}
349
							}
348
						}
350
						}
349
					} else {
351
					} else {
350
						if (dojo.render.html.ie) {
352
						if (dojo.render.html.ie) {
351
							if (!evt.ctrlKey && !evt.altKey && evt.keyCode >= evt.KEY_SPACE) {
353
							if (!evt.ctrlKey && !evt.altKey && evt.keyCode >= evt.KEY_SPACE) {
352
								evt.key = String.fromCharCode(evt.keyCode);
354
								evt.key = String.fromCharCode(evt.keyCode);
353
							}
355
							}
354
						} else {
356
						} else {
355
							if (dojo.render.html.safari) {
357
							if (dojo.render.html.safari) {
356
								switch (evt.keyCode) {
358
								switch (evt.keyCode) {
357
								  case 25:
359
								  case 25:
358
									evt.key = evt.KEY_TAB;
360
									evt.key = evt.KEY_TAB;
359
									evt.shift = true;
361
									evt.shift = true;
360
									break;
362
									break;
361
								  case 63232:
363
								  case 63232:
362
									evt.key = evt.KEY_UP_ARROW;
364
									evt.key = evt.KEY_UP_ARROW;
363
									break;
365
									break;
364
								  case 63233:
366
								  case 63233:
365
									evt.key = evt.KEY_DOWN_ARROW;
367
									evt.key = evt.KEY_DOWN_ARROW;
366
									break;
368
									break;
367
								  case 63234:
369
								  case 63234:
368
									evt.key = evt.KEY_LEFT_ARROW;
370
									evt.key = evt.KEY_LEFT_ARROW;
369
									break;
371
									break;
370
								  case 63235:
372
								  case 63235:
371
									evt.key = evt.KEY_RIGHT_ARROW;
373
									evt.key = evt.KEY_RIGHT_ARROW;
372
									break;
374
									break;
373
								  case 63236:
375
								  case 63236:
374
									evt.key = evt.KEY_F1;
376
									evt.key = evt.KEY_F1;
375
									break;
377
									break;
376
								  case 63237:
378
								  case 63237:
377
									evt.key = evt.KEY_F2;
379
									evt.key = evt.KEY_F2;
378
									break;
380
									break;
379
								  case 63238:
381
								  case 63238:
380
									evt.key = evt.KEY_F3;
382
									evt.key = evt.KEY_F3;
381
									break;
383
									break;
382
								  case 63239:
384
								  case 63239:
383
									evt.key = evt.KEY_F4;
385
									evt.key = evt.KEY_F4;
384
									break;
386
									break;
385
								  case 63240:
387
								  case 63240:
386
									evt.key = evt.KEY_F5;
388
									evt.key = evt.KEY_F5;
387
									break;
389
									break;
388
								  case 63241:
390
								  case 63241:
389
									evt.key = evt.KEY_F6;
391
									evt.key = evt.KEY_F6;
390
									break;
392
									break;
391
								  case 63242:
393
								  case 63242:
392
									evt.key = evt.KEY_F7;
394
									evt.key = evt.KEY_F7;
393
									break;
395
									break;
394
								  case 63243:
396
								  case 63243:
395
									evt.key = evt.KEY_F8;
397
									evt.key = evt.KEY_F8;
396
									break;
398
									break;
397
								  case 63244:
399
								  case 63244:
398
									evt.key = evt.KEY_F9;
400
									evt.key = evt.KEY_F9;
399
									break;
401
									break;
400
								  case 63245:
402
								  case 63245:
401
									evt.key = evt.KEY_F10;
403
									evt.key = evt.KEY_F10;
402
									break;
404
									break;
403
								  case 63246:
405
								  case 63246:
404
									evt.key = evt.KEY_F11;
406
									evt.key = evt.KEY_F11;
405
									break;
407
									break;
406
								  case 63247:
408
								  case 63247:
407
									evt.key = evt.KEY_F12;
409
									evt.key = evt.KEY_F12;
408
									break;
410
									break;
409
								  case 63250:
411
								  case 63250:
410
									evt.key = evt.KEY_PAUSE;
412
									evt.key = evt.KEY_PAUSE;
411
									break;
413
									break;
412
								  case 63272:
414
								  case 63272:
413
									evt.key = evt.KEY_DELETE;
415
									evt.key = evt.KEY_DELETE;
414
									break;
416
									break;
415
								  case 63273:
417
								  case 63273:
416
									evt.key = evt.KEY_HOME;
418
									evt.key = evt.KEY_HOME;
417
									break;
419
									break;
418
								  case 63275:
420
								  case 63275:
419
									evt.key = evt.KEY_END;
421
									evt.key = evt.KEY_END;
420
									break;
422
									break;
421
								  case 63276:
423
								  case 63276:
422
									evt.key = evt.KEY_PAGE_UP;
424
									evt.key = evt.KEY_PAGE_UP;
423
									break;
425
									break;
424
								  case 63277:
426
								  case 63277:
425
									evt.key = evt.KEY_PAGE_DOWN;
427
									evt.key = evt.KEY_PAGE_DOWN;
426
									break;
428
									break;
427
								  case 63302:
429
								  case 63302:
428
									evt.key = evt.KEY_INSERT;
430
									evt.key = evt.KEY_INSERT;
429
									break;
431
									break;
430
								  case 63248:
432
								  case 63248:
431
								  case 63249:
433
								  case 63249:
432
								  case 63289:
434
								  case 63289:
433
									break;
435
									break;
434
								  default:
436
								  default:
435
									evt.key = evt.charCode >= evt.KEY_SPACE ? String.fromCharCode(evt.charCode) : evt.keyCode;
437
									evt.key = evt.charCode >= evt.KEY_SPACE ? String.fromCharCode(evt.charCode) : evt.keyCode;
436
								}
438
								}
437
							} else {
439
							} else {
438
								evt.key = evt.charCode > 0 ? String.fromCharCode(evt.charCode) : evt.keyCode;
440
								evt.key = evt.charCode > 0 ? String.fromCharCode(evt.charCode) : evt.keyCode;
439
							}
441
							}
440
						}
442
						}
441
					}
443
					}
442
				}
444
				}
443
			}
445
			}
444
		}
446
		}
445
		if (dojo.render.html.ie) {
447
		if (dojo.render.html.ie) {
446
			if (!evt.target) {
448
			if (!evt.target) {
447
				evt.target = evt.srcElement;
449
				evt.target = evt.srcElement;
448
			}
450
			}
449
			if (!evt.currentTarget) {
451
			if (!evt.currentTarget) {
450
				evt.currentTarget = (sender ? sender : evt.srcElement);
452
				evt.currentTarget = (sender ? sender : evt.srcElement);
451
			}
453
			}
452
			if (!evt.layerX) {
454
			if (!evt.layerX) {
453
				evt.layerX = evt.offsetX;
455
				evt.layerX = evt.offsetX;
454
			}
456
			}
455
			if (!evt.layerY) {
457
			if (!evt.layerY) {
456
				evt.layerY = evt.offsetY;
458
				evt.layerY = evt.offsetY;
457
			}
459
			}
458
			var doc = (evt.srcElement && evt.srcElement.ownerDocument) ? evt.srcElement.ownerDocument : document;
460
			var doc = (evt.srcElement && evt.srcElement.ownerDocument) ? evt.srcElement.ownerDocument : document;
459
			var docBody = ((dojo.render.html.ie55) || (doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement;
461
			var docBody = ((dojo.render.html.ie55) || (doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement;
460
			if (!evt.pageX) {
462
			if (!evt.pageX) {
461
				evt.pageX = evt.clientX + (docBody.scrollLeft || 0);
463
				evt.pageX = evt.clientX + (docBody.scrollLeft || 0);
462
			}
464
			}
463
			if (!evt.pageY) {
465
			if (!evt.pageY) {
464
				evt.pageY = evt.clientY + (docBody.scrollTop || 0);
466
				evt.pageY = evt.clientY + (docBody.scrollTop || 0);
465
			}
467
			}
466
			if (evt.type == "mouseover") {
468
			if (evt.type == "mouseover") {
467
				evt.relatedTarget = evt.fromElement;
469
				evt.relatedTarget = evt.fromElement;
468
			}
470
			}
469
			if (evt.type == "mouseout") {
471
			if (evt.type == "mouseout") {
470
				evt.relatedTarget = evt.toElement;
472
				evt.relatedTarget = evt.toElement;
471
			}
473
			}
472
			this.currentEvent = evt;
474
			this.currentEvent = evt;
473
			evt.callListener = this.callListener;
475
			evt.callListener = this.callListener;
474
			evt.stopPropagation = this._stopPropagation;
476
			evt.stopPropagation = this._stopPropagation;
475
			evt.preventDefault = this._preventDefault;
477
			evt.preventDefault = this._preventDefault;
476
		}
478
		}
477
		return evt;
479
		return evt;
478
	};
480
	};
479
	this.stopEvent = function (evt) {
481
	this.stopEvent = function (evt) {
480
		if (window.event) {
482
		if (window.event) {
481
			evt.cancelBubble = true;
483
			evt.cancelBubble = true;
482
			evt.returnValue = false;
484
			evt.returnValue = false;
483
		} else {
485
		} else {
484
			evt.preventDefault();
486
			evt.preventDefault();
485
			evt.stopPropagation();
487
			evt.stopPropagation();
486
		}
488
		}
487
	};
489
	};
488
};
490
};
489
 
491