comparison Agendas/trunk/src/Agendas.Web/Scripts/MicrosoftAjax.debug.js @ 10:c62b77fc33f4

website inicial
author nelo@MTEySS.neluz.int
date Sun, 13 Mar 2011 18:51:06 -0300
parents
children
comparison
equal deleted inserted replaced
9:c90492faf268 10:c62b77fc33f4
1 // Name: MicrosoftAjax.debug.js
2 // Assembly: System.Web.Extensions
3 // Version: 4.0.0.0
4 // FileVersion: 4.0.20526.0
5 //-----------------------------------------------------------------------
6 // Copyright (C) Microsoft Corporation. All rights reserved.
7 //-----------------------------------------------------------------------
8 // MicrosoftAjax.js
9 // Microsoft AJAX Framework.
10
11 Function.__typeName = 'Function';
12 Function.__class = true;
13 Function.createCallback = function Function$createCallback(method, context) {
14 /// <summary locid="M:J#Function.createCallback" />
15 /// <param name="method" type="Function"></param>
16 /// <param name="context" mayBeNull="true"></param>
17 /// <returns type="Function"></returns>
18 var e = Function._validateParams(arguments, [
19 {name: "method", type: Function},
20 {name: "context", mayBeNull: true}
21 ]);
22 if (e) throw e;
23 return function() {
24 var l = arguments.length;
25 if (l > 0) {
26 var args = [];
27 for (var i = 0; i < l; i++) {
28 args[i] = arguments[i];
29 }
30 args[l] = context;
31 return method.apply(this, args);
32 }
33 return method.call(this, context);
34 }
35 }
36 Function.createDelegate = function Function$createDelegate(instance, method) {
37 /// <summary locid="M:J#Function.createDelegate" />
38 /// <param name="instance" mayBeNull="true"></param>
39 /// <param name="method" type="Function"></param>
40 /// <returns type="Function"></returns>
41 var e = Function._validateParams(arguments, [
42 {name: "instance", mayBeNull: true},
43 {name: "method", type: Function}
44 ]);
45 if (e) throw e;
46 return function() {
47 return method.apply(instance, arguments);
48 }
49 }
50 Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
51 /// <summary locid="M:J#Function.emptyMethod" />
52 }
53 Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) {
54 /// <summary locid="M:J#Function.validateParameters" />
55 /// <param name="parameters"></param>
56 /// <param name="expectedParameters"></param>
57 /// <param name="validateParameterCount" type="Boolean" optional="true"></param>
58 /// <returns type="Error" mayBeNull="true"></returns>
59 var e = Function._validateParams(arguments, [
60 {name: "parameters"},
61 {name: "expectedParameters"},
62 {name: "validateParameterCount", type: Boolean, optional: true}
63 ]);
64 if (e) throw e;
65 return Function._validateParams(parameters, expectedParameters, validateParameterCount);
66 }
67 Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) {
68 var e, expectedLength = expectedParams.length;
69 validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined");
70 e = Function._validateParameterCount(params, expectedParams, validateParameterCount);
71 if (e) {
72 e.popStackFrame();
73 return e;
74 }
75 for (var i = 0, l = params.length; i < l; i++) {
76 var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
77 paramName = expectedParam.name;
78 if (expectedParam.parameterArray) {
79 paramName += "[" + (i - expectedLength + 1) + "]";
80 }
81 else if (!validateParameterCount && (i >= expectedLength)) {
82 break;
83 }
84 e = Function._validateParameter(params[i], expectedParam, paramName);
85 if (e) {
86 e.popStackFrame();
87 return e;
88 }
89 }
90 return null;
91 }
92 Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) {
93 var i, error,
94 expectedLen = expectedParams.length,
95 actualLen = params.length;
96 if (actualLen < expectedLen) {
97 var minParams = expectedLen;
98 for (i = 0; i < expectedLen; i++) {
99 var param = expectedParams[i];
100 if (param.optional || param.parameterArray) {
101 minParams--;
102 }
103 }
104 if (actualLen < minParams) {
105 error = true;
106 }
107 }
108 else if (validateParameterCount && (actualLen > expectedLen)) {
109 error = true;
110 for (i = 0; i < expectedLen; i++) {
111 if (expectedParams[i].parameterArray) {
112 error = false;
113 break;
114 }
115 }
116 }
117 if (error) {
118 var e = Error.parameterCount();
119 e.popStackFrame();
120 return e;
121 }
122 return null;
123 }
124 Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
125 var e,
126 expectedType = expectedParam.type,
127 expectedInteger = !!expectedParam.integer,
128 expectedDomElement = !!expectedParam.domElement,
129 mayBeNull = !!expectedParam.mayBeNull;
130 e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
131 if (e) {
132 e.popStackFrame();
133 return e;
134 }
135 var expectedElementType = expectedParam.elementType,
136 elementMayBeNull = !!expectedParam.elementMayBeNull;
137 if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
138 (expectedElementType || !elementMayBeNull)) {
139 var expectedElementInteger = !!expectedParam.elementInteger,
140 expectedElementDomElement = !!expectedParam.elementDomElement;
141 for (var i=0; i < param.length; i++) {
142 var elem = param[i];
143 e = Function._validateParameterType(elem, expectedElementType,
144 expectedElementInteger, expectedElementDomElement, elementMayBeNull,
145 paramName + "[" + i + "]");
146 if (e) {
147 e.popStackFrame();
148 return e;
149 }
150 }
151 }
152 return null;
153 }
154 Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
155 var e, i;
156 if (typeof(param) === "undefined") {
157 if (mayBeNull) {
158 return null;
159 }
160 else {
161 e = Error.argumentUndefined(paramName);
162 e.popStackFrame();
163 return e;
164 }
165 }
166 if (param === null) {
167 if (mayBeNull) {
168 return null;
169 }
170 else {
171 e = Error.argumentNull(paramName);
172 e.popStackFrame();
173 return e;
174 }
175 }
176 if (expectedType && expectedType.__enum) {
177 if (typeof(param) !== 'number') {
178 e = Error.argumentType(paramName, Object.getType(param), expectedType);
179 e.popStackFrame();
180 return e;
181 }
182 if ((param % 1) === 0) {
183 var values = expectedType.prototype;
184 if (!expectedType.__flags || (param === 0)) {
185 for (i in values) {
186 if (values[i] === param) return null;
187 }
188 }
189 else {
190 var v = param;
191 for (i in values) {
192 var vali = values[i];
193 if (vali === 0) continue;
194 if ((vali & param) === vali) {
195 v -= vali;
196 }
197 if (v === 0) return null;
198 }
199 }
200 }
201 e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
202 e.popStackFrame();
203 return e;
204 }
205 if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) {
206 e = Error.argument(paramName, Sys.Res.argumentDomElement);
207 e.popStackFrame();
208 return e;
209 }
210 if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {
211 e = Error.argumentType(paramName, Object.getType(param), expectedType);
212 e.popStackFrame();
213 return e;
214 }
215 if (expectedType === Number && expectedInteger) {
216 if ((param % 1) !== 0) {
217 e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
218 e.popStackFrame();
219 return e;
220 }
221 }
222 return null;
223 }
224
225 Error.__typeName = 'Error';
226 Error.__class = true;
227 Error.create = function Error$create(message, errorInfo) {
228 /// <summary locid="M:J#Error.create" />
229 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
230 /// <param name="errorInfo" optional="true" mayBeNull="true"></param>
231 /// <returns type="Error"></returns>
232 var e = Function._validateParams(arguments, [
233 {name: "message", type: String, mayBeNull: true, optional: true},
234 {name: "errorInfo", mayBeNull: true, optional: true}
235 ]);
236 if (e) throw e;
237 var err = new Error(message);
238 err.message = message;
239 if (errorInfo) {
240 for (var v in errorInfo) {
241 err[v] = errorInfo[v];
242 }
243 }
244 err.popStackFrame();
245 return err;
246 }
247 Error.argument = function Error$argument(paramName, message) {
248 /// <summary locid="M:J#Error.argument" />
249 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
250 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
251 /// <returns></returns>
252 var e = Function._validateParams(arguments, [
253 {name: "paramName", type: String, mayBeNull: true, optional: true},
254 {name: "message", type: String, mayBeNull: true, optional: true}
255 ]);
256 if (e) throw e;
257 var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument);
258 if (paramName) {
259 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
260 }
261 var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
262 err.popStackFrame();
263 return err;
264 }
265 Error.argumentNull = function Error$argumentNull(paramName, message) {
266 /// <summary locid="M:J#Error.argumentNull" />
267 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
268 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
269 /// <returns></returns>
270 var e = Function._validateParams(arguments, [
271 {name: "paramName", type: String, mayBeNull: true, optional: true},
272 {name: "message", type: String, mayBeNull: true, optional: true}
273 ]);
274 if (e) throw e;
275 var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull);
276 if (paramName) {
277 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
278 }
279 var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
280 err.popStackFrame();
281 return err;
282 }
283 Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
284 /// <summary locid="M:J#Error.argumentOutOfRange" />
285 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
286 /// <param name="actualValue" optional="true" mayBeNull="true"></param>
287 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
288 /// <returns></returns>
289 var e = Function._validateParams(arguments, [
290 {name: "paramName", type: String, mayBeNull: true, optional: true},
291 {name: "actualValue", mayBeNull: true, optional: true},
292 {name: "message", type: String, mayBeNull: true, optional: true}
293 ]);
294 if (e) throw e;
295 var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange);
296 if (paramName) {
297 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
298 }
299 if (typeof(actualValue) !== "undefined" && actualValue !== null) {
300 displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
301 }
302 var err = Error.create(displayMessage, {
303 name: "Sys.ArgumentOutOfRangeException",
304 paramName: paramName,
305 actualValue: actualValue
306 });
307 err.popStackFrame();
308 return err;
309 }
310 Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
311 /// <summary locid="M:J#Error.argumentType" />
312 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
313 /// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
314 /// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
315 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
316 /// <returns></returns>
317 var e = Function._validateParams(arguments, [
318 {name: "paramName", type: String, mayBeNull: true, optional: true},
319 {name: "actualType", type: Type, mayBeNull: true, optional: true},
320 {name: "expectedType", type: Type, mayBeNull: true, optional: true},
321 {name: "message", type: String, mayBeNull: true, optional: true}
322 ]);
323 if (e) throw e;
324 var displayMessage = "Sys.ArgumentTypeException: ";
325 if (message) {
326 displayMessage += message;
327 }
328 else if (actualType && expectedType) {
329 displayMessage +=
330 String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
331 }
332 else {
333 displayMessage += Sys.Res.argumentType;
334 }
335 if (paramName) {
336 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
337 }
338 var err = Error.create(displayMessage, {
339 name: "Sys.ArgumentTypeException",
340 paramName: paramName,
341 actualType: actualType,
342 expectedType: expectedType
343 });
344 err.popStackFrame();
345 return err;
346 }
347 Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
348 /// <summary locid="M:J#Error.argumentUndefined" />
349 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
350 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
351 /// <returns></returns>
352 var e = Function._validateParams(arguments, [
353 {name: "paramName", type: String, mayBeNull: true, optional: true},
354 {name: "message", type: String, mayBeNull: true, optional: true}
355 ]);
356 if (e) throw e;
357 var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined);
358 if (paramName) {
359 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
360 }
361 var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
362 err.popStackFrame();
363 return err;
364 }
365 Error.format = function Error$format(message) {
366 /// <summary locid="M:J#Error.format" />
367 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
368 /// <returns></returns>
369 var e = Function._validateParams(arguments, [
370 {name: "message", type: String, mayBeNull: true, optional: true}
371 ]);
372 if (e) throw e;
373 var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format);
374 var err = Error.create(displayMessage, {name: 'Sys.FormatException'});
375 err.popStackFrame();
376 return err;
377 }
378 Error.invalidOperation = function Error$invalidOperation(message) {
379 /// <summary locid="M:J#Error.invalidOperation" />
380 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
381 /// <returns></returns>
382 var e = Function._validateParams(arguments, [
383 {name: "message", type: String, mayBeNull: true, optional: true}
384 ]);
385 if (e) throw e;
386 var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation);
387 var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
388 err.popStackFrame();
389 return err;
390 }
391 Error.notImplemented = function Error$notImplemented(message) {
392 /// <summary locid="M:J#Error.notImplemented" />
393 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
394 /// <returns></returns>
395 var e = Function._validateParams(arguments, [
396 {name: "message", type: String, mayBeNull: true, optional: true}
397 ]);
398 if (e) throw e;
399 var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented);
400 var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
401 err.popStackFrame();
402 return err;
403 }
404 Error.parameterCount = function Error$parameterCount(message) {
405 /// <summary locid="M:J#Error.parameterCount" />
406 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
407 /// <returns></returns>
408 var e = Function._validateParams(arguments, [
409 {name: "message", type: String, mayBeNull: true, optional: true}
410 ]);
411 if (e) throw e;
412 var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount);
413 var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
414 err.popStackFrame();
415 return err;
416 }
417 Error.prototype.popStackFrame = function Error$popStackFrame() {
418 /// <summary locid="M:J#checkParam" />
419 if (arguments.length !== 0) throw Error.parameterCount();
420 if (typeof(this.stack) === "undefined" || this.stack === null ||
421 typeof(this.fileName) === "undefined" || this.fileName === null ||
422 typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
423 return;
424 }
425 var stackFrames = this.stack.split("\n");
426 var currentFrame = stackFrames[0];
427 var pattern = this.fileName + ":" + this.lineNumber;
428 while(typeof(currentFrame) !== "undefined" &&
429 currentFrame !== null &&
430 currentFrame.indexOf(pattern) === -1) {
431 stackFrames.shift();
432 currentFrame = stackFrames[0];
433 }
434 var nextFrame = stackFrames[1];
435 if (typeof(nextFrame) === "undefined" || nextFrame === null) {
436 return;
437 }
438 var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
439 if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
440 return;
441 }
442 this.fileName = nextFrameParts[1];
443 this.lineNumber = parseInt(nextFrameParts[2]);
444 stackFrames.shift();
445 this.stack = stackFrames.join("\n");
446 }
447
448 Object.__typeName = 'Object';
449 Object.__class = true;
450 Object.getType = function Object$getType(instance) {
451 /// <summary locid="M:J#Object.getType" />
452 /// <param name="instance"></param>
453 /// <returns type="Type"></returns>
454 var e = Function._validateParams(arguments, [
455 {name: "instance"}
456 ]);
457 if (e) throw e;
458 var ctor = instance.constructor;
459 if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) {
460 return Object;
461 }
462 return ctor;
463 }
464 Object.getTypeName = function Object$getTypeName(instance) {
465 /// <summary locid="M:J#Object.getTypeName" />
466 /// <param name="instance"></param>
467 /// <returns type="String"></returns>
468 var e = Function._validateParams(arguments, [
469 {name: "instance"}
470 ]);
471 if (e) throw e;
472 return Object.getType(instance).getName();
473 }
474
475 String.__typeName = 'String';
476 String.__class = true;
477 String.prototype.endsWith = function String$endsWith(suffix) {
478 /// <summary locid="M:J#String.endsWith" />
479 /// <param name="suffix" type="String"></param>
480 /// <returns type="Boolean"></returns>
481 var e = Function._validateParams(arguments, [
482 {name: "suffix", type: String}
483 ]);
484 if (e) throw e;
485 return (this.substr(this.length - suffix.length) === suffix);
486 }
487 String.prototype.startsWith = function String$startsWith(prefix) {
488 /// <summary locid="M:J#String.startsWith" />
489 /// <param name="prefix" type="String"></param>
490 /// <returns type="Boolean"></returns>
491 var e = Function._validateParams(arguments, [
492 {name: "prefix", type: String}
493 ]);
494 if (e) throw e;
495 return (this.substr(0, prefix.length) === prefix);
496 }
497 String.prototype.trim = function String$trim() {
498 /// <summary locid="M:J#String.trim" />
499 /// <returns type="String"></returns>
500 if (arguments.length !== 0) throw Error.parameterCount();
501 return this.replace(/^\s+|\s+$/g, '');
502 }
503 String.prototype.trimEnd = function String$trimEnd() {
504 /// <summary locid="M:J#String.trimEnd" />
505 /// <returns type="String"></returns>
506 if (arguments.length !== 0) throw Error.parameterCount();
507 return this.replace(/\s+$/, '');
508 }
509 String.prototype.trimStart = function String$trimStart() {
510 /// <summary locid="M:J#String.trimStart" />
511 /// <returns type="String"></returns>
512 if (arguments.length !== 0) throw Error.parameterCount();
513 return this.replace(/^\s+/, '');
514 }
515 String.format = function String$format(format, args) {
516 /// <summary locid="M:J#String.format" />
517 /// <param name="format" type="String"></param>
518 /// <param name="args" parameterArray="true" mayBeNull="true"></param>
519 /// <returns type="String"></returns>
520 var e = Function._validateParams(arguments, [
521 {name: "format", type: String},
522 {name: "args", mayBeNull: true, parameterArray: true}
523 ]);
524 if (e) throw e;
525 return String._toFormattedString(false, arguments);
526 }
527 String._toFormattedString = function String$_toFormattedString(useLocale, args) {
528 var result = '';
529 var format = args[0];
530 for (var i=0;;) {
531 var open = format.indexOf('{', i);
532 var close = format.indexOf('}', i);
533 if ((open < 0) && (close < 0)) {
534 result += format.slice(i);
535 break;
536 }
537 if ((close > 0) && ((close < open) || (open < 0))) {
538 if (format.charAt(close + 1) !== '}') {
539 throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
540 }
541 result += format.slice(i, close + 1);
542 i = close + 2;
543 continue;
544 }
545 result += format.slice(i, open);
546 i = open + 1;
547 if (format.charAt(i) === '{') {
548 result += '{';
549 i++;
550 continue;
551 }
552 if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
553 var brace = format.substring(i, close);
554 var colonIndex = brace.indexOf(':');
555 var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1;
556 if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid);
557 var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);
558 var arg = args[argNumber];
559 if (typeof(arg) === "undefined" || arg === null) {
560 arg = '';
561 }
562 if (arg.toFormattedString) {
563 result += arg.toFormattedString(argFormat);
564 }
565 else if (useLocale && arg.localeFormat) {
566 result += arg.localeFormat(argFormat);
567 }
568 else if (arg.format) {
569 result += arg.format(argFormat);
570 }
571 else
572 result += arg.toString();
573 i = close + 1;
574 }
575 return result;
576 }
577
578 Boolean.__typeName = 'Boolean';
579 Boolean.__class = true;
580 Boolean.parse = function Boolean$parse(value) {
581 /// <summary locid="M:J#Boolean.parse" />
582 /// <param name="value" type="String"></param>
583 /// <returns type="Boolean"></returns>
584 var e = Function._validateParams(arguments, [
585 {name: "value", type: String}
586 ], false);
587 if (e) throw e;
588 var v = value.trim().toLowerCase();
589 if (v === 'false') return false;
590 if (v === 'true') return true;
591 throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
592 }
593
594 Date.__typeName = 'Date';
595 Date.__class = true;
596
597 Number.__typeName = 'Number';
598 Number.__class = true;
599
600 RegExp.__typeName = 'RegExp';
601 RegExp.__class = true;
602
603 if (!window) this.window = this;
604 window.Type = Function;
605 Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
606 Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");
607 Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
608 /// <summary locid="M:J#Type.callBaseMethod" />
609 /// <param name="instance"></param>
610 /// <param name="name" type="String"></param>
611 /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
612 /// <returns></returns>
613 var e = Function._validateParams(arguments, [
614 {name: "instance"},
615 {name: "name", type: String},
616 {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
617 ]);
618 if (e) throw e;
619 var baseMethod = Sys._getBaseMethod(this, instance, name);
620 if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
621 if (!baseArguments) {
622 return baseMethod.apply(instance);
623 }
624 else {
625 return baseMethod.apply(instance, baseArguments);
626 }
627 }
628 Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
629 /// <summary locid="M:J#Type.getBaseMethod" />
630 /// <param name="instance"></param>
631 /// <param name="name" type="String"></param>
632 /// <returns type="Function" mayBeNull="true"></returns>
633 var e = Function._validateParams(arguments, [
634 {name: "instance"},
635 {name: "name", type: String}
636 ]);
637 if (e) throw e;
638 return Sys._getBaseMethod(this, instance, name);
639 }
640 Type.prototype.getBaseType = function Type$getBaseType() {
641 /// <summary locid="M:J#Type.getBaseType" />
642 /// <returns type="Type" mayBeNull="true"></returns>
643 if (arguments.length !== 0) throw Error.parameterCount();
644 return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
645 }
646 Type.prototype.getInterfaces = function Type$getInterfaces() {
647 /// <summary locid="M:J#Type.getInterfaces" />
648 /// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></returns>
649 if (arguments.length !== 0) throw Error.parameterCount();
650 var result = [];
651 var type = this;
652 while(type) {
653 var interfaces = type.__interfaces;
654 if (interfaces) {
655 for (var i = 0, l = interfaces.length; i < l; i++) {
656 var interfaceType = interfaces[i];
657 if (!Array.contains(result, interfaceType)) {
658 result[result.length] = interfaceType;
659 }
660 }
661 }
662 type = type.__baseType;
663 }
664 return result;
665 }
666 Type.prototype.getName = function Type$getName() {
667 /// <summary locid="M:J#Type.getName" />
668 /// <returns type="String"></returns>
669 if (arguments.length !== 0) throw Error.parameterCount();
670 return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
671 }
672 Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
673 /// <summary locid="M:J#Type.implementsInterface" />
674 /// <param name="interfaceType" type="Type"></param>
675 /// <returns type="Boolean"></returns>
676 var e = Function._validateParams(arguments, [
677 {name: "interfaceType", type: Type}
678 ]);
679 if (e) throw e;
680 this.resolveInheritance();
681 var interfaceName = interfaceType.getName();
682 var cache = this.__interfaceCache;
683 if (cache) {
684 var cacheEntry = cache[interfaceName];
685 if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
686 }
687 else {
688 cache = this.__interfaceCache = {};
689 }
690 var baseType = this;
691 while (baseType) {
692 var interfaces = baseType.__interfaces;
693 if (interfaces) {
694 if (Array.indexOf(interfaces, interfaceType) !== -1) {
695 return cache[interfaceName] = true;
696 }
697 }
698 baseType = baseType.__baseType;
699 }
700 return cache[interfaceName] = false;
701 }
702 Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
703 /// <summary locid="M:J#Type.inheritsFrom" />
704 /// <param name="parentType" type="Type"></param>
705 /// <returns type="Boolean"></returns>
706 var e = Function._validateParams(arguments, [
707 {name: "parentType", type: Type}
708 ]);
709 if (e) throw e;
710 this.resolveInheritance();
711 var baseType = this.__baseType;
712 while (baseType) {
713 if (baseType === parentType) {
714 return true;
715 }
716 baseType = baseType.__baseType;
717 }
718 return false;
719 }
720 Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
721 /// <summary locid="M:J#Type.initializeBase" />
722 /// <param name="instance"></param>
723 /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
724 /// <returns></returns>
725 var e = Function._validateParams(arguments, [
726 {name: "instance"},
727 {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
728 ]);
729 if (e) throw e;
730 if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this);
731 this.resolveInheritance();
732 if (this.__baseType) {
733 if (!baseArguments) {
734 this.__baseType.apply(instance);
735 }
736 else {
737 this.__baseType.apply(instance, baseArguments);
738 }
739 }
740 return instance;
741 }
742 Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
743 /// <summary locid="M:J#Type.isImplementedBy" />
744 /// <param name="instance" mayBeNull="true"></param>
745 /// <returns type="Boolean"></returns>
746 var e = Function._validateParams(arguments, [
747 {name: "instance", mayBeNull: true}
748 ]);
749 if (e) throw e;
750 if (typeof(instance) === "undefined" || instance === null) return false;
751 var instanceType = Object.getType(instance);
752 return !!(instanceType.implementsInterface && instanceType.implementsInterface(this));
753 }
754 Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
755 /// <summary locid="M:J#Type.isInstanceOfType" />
756 /// <param name="instance" mayBeNull="true"></param>
757 /// <returns type="Boolean"></returns>
758 var e = Function._validateParams(arguments, [
759 {name: "instance", mayBeNull: true}
760 ]);
761 if (e) throw e;
762 return Sys._isInstanceOfType(this, instance);
763 }
764 Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
765 /// <summary locid="M:J#Type.registerClass" />
766 /// <param name="typeName" type="String"></param>
767 /// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
768 /// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
769 /// <returns type="Type"></returns>
770 var e = Function._validateParams(arguments, [
771 {name: "typeName", type: String},
772 {name: "baseType", type: Type, mayBeNull: true, optional: true},
773 {name: "interfaceTypes", type: Type, parameterArray: true}
774 ]);
775 if (e) throw e;
776 if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
777 var parsedName;
778 try {
779 parsedName = eval(typeName);
780 }
781 catch(e) {
782 throw Error.argument('typeName', Sys.Res.argumentTypeName);
783 }
784 if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
785 if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
786 if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
787 if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass);
788 this.prototype.constructor = this;
789 this.__typeName = typeName;
790 this.__class = true;
791 if (baseType) {
792 this.__baseType = baseType;
793 this.__basePrototypePending = true;
794 }
795 Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
796 if (interfaceTypes) {
797 this.__interfaces = [];
798 this.resolveInheritance();
799 for (var i = 2, l = arguments.length; i < l; i++) {
800 var interfaceType = arguments[i];
801 if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface);
802 for (var methodName in interfaceType.prototype) {
803 var method = interfaceType.prototype[methodName];
804 if (!this.prototype[methodName]) {
805 this.prototype[methodName] = method;
806 }
807 }
808 this.__interfaces.push(interfaceType);
809 }
810 }
811 Sys.__registeredTypes[typeName] = true;
812 return this;
813 }
814 Type.prototype.registerInterface = function Type$registerInterface(typeName) {
815 /// <summary locid="M:J#Type.registerInterface" />
816 /// <param name="typeName" type="String"></param>
817 /// <returns type="Type"></returns>
818 var e = Function._validateParams(arguments, [
819 {name: "typeName", type: String}
820 ]);
821 if (e) throw e;
822 if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
823 var parsedName;
824 try {
825 parsedName = eval(typeName);
826 }
827 catch(e) {
828 throw Error.argument('typeName', Sys.Res.argumentTypeName);
829 }
830 if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
831 if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
832 Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
833 this.prototype.constructor = this;
834 this.__typeName = typeName;
835 this.__interface = true;
836 Sys.__registeredTypes[typeName] = true;
837 return this;
838 }
839 Type.prototype.resolveInheritance = function Type$resolveInheritance() {
840 /// <summary locid="M:J#Type.resolveInheritance" />
841 if (arguments.length !== 0) throw Error.parameterCount();
842 if (this.__basePrototypePending) {
843 var baseType = this.__baseType;
844 baseType.resolveInheritance();
845 for (var memberName in baseType.prototype) {
846 var memberValue = baseType.prototype[memberName];
847 if (!this.prototype[memberName]) {
848 this.prototype[memberName] = memberValue;
849 }
850 }
851 delete this.__basePrototypePending;
852 }
853 }
854 Type.getRootNamespaces = function Type$getRootNamespaces() {
855 /// <summary locid="M:J#Type.getRootNamespaces" />
856 /// <returns type="Array"></returns>
857 if (arguments.length !== 0) throw Error.parameterCount();
858 return Array.clone(Sys.__rootNamespaces);
859 }
860 Type.isClass = function Type$isClass(type) {
861 /// <summary locid="M:J#Type.isClass" />
862 /// <param name="type" mayBeNull="true"></param>
863 /// <returns type="Boolean"></returns>
864 var e = Function._validateParams(arguments, [
865 {name: "type", mayBeNull: true}
866 ]);
867 if (e) throw e;
868 if ((typeof(type) === 'undefined') || (type === null)) return false;
869 return !!type.__class;
870 }
871 Type.isInterface = function Type$isInterface(type) {
872 /// <summary locid="M:J#Type.isInterface" />
873 /// <param name="type" mayBeNull="true"></param>
874 /// <returns type="Boolean"></returns>
875 var e = Function._validateParams(arguments, [
876 {name: "type", mayBeNull: true}
877 ]);
878 if (e) throw e;
879 if ((typeof(type) === 'undefined') || (type === null)) return false;
880 return !!type.__interface;
881 }
882 Type.isNamespace = function Type$isNamespace(object) {
883 /// <summary locid="M:J#Type.isNamespace" />
884 /// <param name="object" mayBeNull="true"></param>
885 /// <returns type="Boolean"></returns>
886 var e = Function._validateParams(arguments, [
887 {name: "object", mayBeNull: true}
888 ]);
889 if (e) throw e;
890 if ((typeof(object) === 'undefined') || (object === null)) return false;
891 return !!object.__namespace;
892 }
893 Type.parse = function Type$parse(typeName, ns) {
894 /// <summary locid="M:J#Type.parse" />
895 /// <param name="typeName" type="String" mayBeNull="true"></param>
896 /// <param name="ns" optional="true" mayBeNull="true"></param>
897 /// <returns type="Type" mayBeNull="true"></returns>
898 var e = Function._validateParams(arguments, [
899 {name: "typeName", type: String, mayBeNull: true},
900 {name: "ns", mayBeNull: true, optional: true}
901 ]);
902 if (e) throw e;
903 var fn;
904 if (ns) {
905 fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
906 return fn || null;
907 }
908 if (!typeName) return null;
909 if (!Type.__htClasses) {
910 Type.__htClasses = {};
911 }
912 fn = Type.__htClasses[typeName];
913 if (!fn) {
914 fn = eval(typeName);
915 if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName);
916 Type.__htClasses[typeName] = fn;
917 }
918 return fn;
919 }
920 Type.registerNamespace = function Type$registerNamespace(namespacePath) {
921 /// <summary locid="M:J#Type.registerNamespace" />
922 /// <param name="namespacePath" type="String"></param>
923 var e = Function._validateParams(arguments, [
924 {name: "namespacePath", type: String}
925 ]);
926 if (e) throw e;
927 Type._registerNamespace(namespacePath);
928 }
929 Type._registerNamespace = function Type$_registerNamespace(namespacePath) {
930 if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
931 var rootObject = window;
932 var namespaceParts = namespacePath.split('.');
933 for (var i = 0; i < namespaceParts.length; i++) {
934 var currentPart = namespaceParts[i];
935 var ns = rootObject[currentPart];
936 var nsType = typeof(ns);
937 if ((nsType !== "undefined") && (ns !== null)) {
938 if (nsType === "function") {
939 throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.')));
940 }
941 if ((typeof(ns) !== "object") || (ns instanceof Array)) {
942 throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.')));
943 }
944 }
945 if (!ns) {
946 ns = rootObject[currentPart] = {};
947 }
948 if (!ns.__namespace) {
949 if ((i === 0) && (namespacePath !== "Sys")) {
950 Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns;
951 }
952 ns.__namespace = true;
953 ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
954 var parsedName;
955 try {
956 parsedName = eval(ns.__typeName);
957 }
958 catch(e) {
959 parsedName = null;
960 }
961 if (parsedName !== ns) {
962 delete rootObject[currentPart];
963 throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
964 }
965 ns.getName = function ns$getName() {return this.__typeName;}
966 }
967 rootObject = ns;
968 }
969 }
970 Type._checkDependency = function Type$_checkDependency(dependency, featureName) {
971 var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false);
972 if ((typeof(featureName) !== 'undefined') && !isDependent) {
973 throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
974 featureName, dependency));
975 }
976 return isDependent;
977 }
978 Type._registerScript = function Type$_registerScript(scriptName, dependencies) {
979 var scripts = Type._registerScript._scripts;
980 if (!scripts) {
981 Type._registerScript._scripts = scripts = {};
982 }
983 if (scripts[scriptName]) {
984 throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName));
985 }
986 scripts[scriptName] = true;
987 if (dependencies) {
988 for (var i = 0, l = dependencies.length; i < l; i++) {
989 var dependency = dependencies[i];
990 if (!Type._checkDependency(dependency)) {
991 throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency));
992 }
993 }
994 }
995 }
996 Type._registerNamespace("Sys");
997 Sys.__upperCaseTypes = {};
998 Sys.__rootNamespaces = [Sys];
999 Sys.__registeredTypes = {};
1000 Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) {
1001 if (typeof(instance) === "undefined" || instance === null) return false;
1002 if (instance instanceof type) return true;
1003 var instanceType = Object.getType(instance);
1004 return !!(instanceType === type) ||
1005 (instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
1006 (instanceType.implementsInterface && instanceType.implementsInterface(type));
1007 }
1008 Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
1009 if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
1010 var baseType = type.getBaseType();
1011 if (baseType) {
1012 var baseMethod = baseType.prototype[name];
1013 return (baseMethod instanceof Function) ? baseMethod : null;
1014 }
1015 return null;
1016 }
1017 Sys._isDomElement = function Sys$_isDomElement(obj) {
1018 var val = false;
1019 if (typeof (obj.nodeType) !== 'number') {
1020 var doc = obj.ownerDocument || obj.document || obj;
1021 if (doc != obj) {
1022 var w = doc.defaultView || doc.parentWindow;
1023 val = (w != obj);
1024 }
1025 else {
1026 val = (typeof (doc.body) === 'undefined');
1027 }
1028 }
1029 return !val;
1030 }
1031
1032 Array.__typeName = 'Array';
1033 Array.__class = true;
1034 Array.add = Array.enqueue = function Array$enqueue(array, item) {
1035 /// <summary locid="M:J#Array.enqueue" />
1036 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1037 /// <param name="item" mayBeNull="true"></param>
1038 var e = Function._validateParams(arguments, [
1039 {name: "array", type: Array, elementMayBeNull: true},
1040 {name: "item", mayBeNull: true}
1041 ]);
1042 if (e) throw e;
1043 array[array.length] = item;
1044 }
1045 Array.addRange = function Array$addRange(array, items) {
1046 /// <summary locid="M:J#Array.addRange" />
1047 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1048 /// <param name="items" type="Array" elementMayBeNull="true"></param>
1049 var e = Function._validateParams(arguments, [
1050 {name: "array", type: Array, elementMayBeNull: true},
1051 {name: "items", type: Array, elementMayBeNull: true}
1052 ]);
1053 if (e) throw e;
1054 array.push.apply(array, items);
1055 }
1056 Array.clear = function Array$clear(array) {
1057 /// <summary locid="M:J#Array.clear" />
1058 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1059 var e = Function._validateParams(arguments, [
1060 {name: "array", type: Array, elementMayBeNull: true}
1061 ]);
1062 if (e) throw e;
1063 array.length = 0;
1064 }
1065 Array.clone = function Array$clone(array) {
1066 /// <summary locid="M:J#Array.clone" />
1067 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1068 /// <returns type="Array" elementMayBeNull="true"></returns>
1069 var e = Function._validateParams(arguments, [
1070 {name: "array", type: Array, elementMayBeNull: true}
1071 ]);
1072 if (e) throw e;
1073 if (array.length === 1) {
1074 return [array[0]];
1075 }
1076 else {
1077 return Array.apply(null, array);
1078 }
1079 }
1080 Array.contains = function Array$contains(array, item) {
1081 /// <summary locid="M:J#Array.contains" />
1082 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1083 /// <param name="item" mayBeNull="true"></param>
1084 /// <returns type="Boolean"></returns>
1085 var e = Function._validateParams(arguments, [
1086 {name: "array", type: Array, elementMayBeNull: true},
1087 {name: "item", mayBeNull: true}
1088 ]);
1089 if (e) throw e;
1090 return (Sys._indexOf(array, item) >= 0);
1091 }
1092 Array.dequeue = function Array$dequeue(array) {
1093 /// <summary locid="M:J#Array.dequeue" />
1094 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1095 /// <returns mayBeNull="true"></returns>
1096 var e = Function._validateParams(arguments, [
1097 {name: "array", type: Array, elementMayBeNull: true}
1098 ]);
1099 if (e) throw e;
1100 return array.shift();
1101 }
1102 Array.forEach = function Array$forEach(array, method, instance) {
1103 /// <summary locid="M:J#Array.forEach" />
1104 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1105 /// <param name="method" type="Function"></param>
1106 /// <param name="instance" optional="true" mayBeNull="true"></param>
1107 var e = Function._validateParams(arguments, [
1108 {name: "array", type: Array, elementMayBeNull: true},
1109 {name: "method", type: Function},
1110 {name: "instance", mayBeNull: true, optional: true}
1111 ]);
1112 if (e) throw e;
1113 for (var i = 0, l = array.length; i < l; i++) {
1114 var elt = array[i];
1115 if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
1116 }
1117 }
1118 Array.indexOf = function Array$indexOf(array, item, start) {
1119 /// <summary locid="M:J#Array.indexOf" />
1120 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1121 /// <param name="item" optional="true" mayBeNull="true"></param>
1122 /// <param name="start" optional="true" mayBeNull="true"></param>
1123 /// <returns type="Number"></returns>
1124 var e = Function._validateParams(arguments, [
1125 {name: "array", type: Array, elementMayBeNull: true},
1126 {name: "item", mayBeNull: true, optional: true},
1127 {name: "start", mayBeNull: true, optional: true}
1128 ]);
1129 if (e) throw e;
1130 return Sys._indexOf(array, item, start);
1131 }
1132 Array.insert = function Array$insert(array, index, item) {
1133 /// <summary locid="M:J#Array.insert" />
1134 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1135 /// <param name="index" mayBeNull="true"></param>
1136 /// <param name="item" mayBeNull="true"></param>
1137 var e = Function._validateParams(arguments, [
1138 {name: "array", type: Array, elementMayBeNull: true},
1139 {name: "index", mayBeNull: true},
1140 {name: "item", mayBeNull: true}
1141 ]);
1142 if (e) throw e;
1143 array.splice(index, 0, item);
1144 }
1145 Array.parse = function Array$parse(value) {
1146 /// <summary locid="M:J#Array.parse" />
1147 /// <param name="value" type="String" mayBeNull="true"></param>
1148 /// <returns type="Array" elementMayBeNull="true"></returns>
1149 var e = Function._validateParams(arguments, [
1150 {name: "value", type: String, mayBeNull: true}
1151 ]);
1152 if (e) throw e;
1153 if (!value) return [];
1154 var v = eval(value);
1155 if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat);
1156 return v;
1157 }
1158 Array.remove = function Array$remove(array, item) {
1159 /// <summary locid="M:J#Array.remove" />
1160 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1161 /// <param name="item" mayBeNull="true"></param>
1162 /// <returns type="Boolean"></returns>
1163 var e = Function._validateParams(arguments, [
1164 {name: "array", type: Array, elementMayBeNull: true},
1165 {name: "item", mayBeNull: true}
1166 ]);
1167 if (e) throw e;
1168 var index = Sys._indexOf(array, item);
1169 if (index >= 0) {
1170 array.splice(index, 1);
1171 }
1172 return (index >= 0);
1173 }
1174 Array.removeAt = function Array$removeAt(array, index) {
1175 /// <summary locid="M:J#Array.removeAt" />
1176 /// <param name="array" type="Array" elementMayBeNull="true"></param>
1177 /// <param name="index" mayBeNull="true"></param>
1178 var e = Function._validateParams(arguments, [
1179 {name: "array", type: Array, elementMayBeNull: true},
1180 {name: "index", mayBeNull: true}
1181 ]);
1182 if (e) throw e;
1183 array.splice(index, 1);
1184 }
1185 Sys._indexOf = function Sys$_indexOf(array, item, start) {
1186 if (typeof(item) === "undefined") return -1;
1187 var length = array.length;
1188 if (length !== 0) {
1189 start = start - 0;
1190 if (isNaN(start)) {
1191 start = 0;
1192 }
1193 else {
1194 if (isFinite(start)) {
1195 start = start - (start % 1);
1196 }
1197 if (start < 0) {
1198 start = Math.max(0, length + start);
1199 }
1200 }
1201 for (var i = start; i < length; i++) {
1202 if ((typeof(array[i]) !== "undefined") && (array[i] === item)) {
1203 return i;
1204 }
1205 }
1206 }
1207 return -1;
1208 }
1209 Type._registerScript._scripts = {
1210 "MicrosoftAjaxCore.js": true,
1211 "MicrosoftAjaxGlobalization.js": true,
1212 "MicrosoftAjaxSerialization.js": true,
1213 "MicrosoftAjaxComponentModel.js": true,
1214 "MicrosoftAjaxHistory.js": true,
1215 "MicrosoftAjaxNetwork.js" : true,
1216 "MicrosoftAjaxWebServices.js": true };
1217
1218 Sys.IDisposable = function Sys$IDisposable() {
1219 throw Error.notImplemented();
1220 }
1221 function Sys$IDisposable$dispose() {
1222 throw Error.notImplemented();
1223 }
1224 Sys.IDisposable.prototype = {
1225 dispose: Sys$IDisposable$dispose
1226 }
1227 Sys.IDisposable.registerInterface('Sys.IDisposable');
1228
1229 Sys.StringBuilder = function Sys$StringBuilder(initialText) {
1230 /// <summary locid="M:J#Sys.StringBuilder.#ctor" />
1231 /// <param name="initialText" optional="true" mayBeNull="true"></param>
1232 var e = Function._validateParams(arguments, [
1233 {name: "initialText", mayBeNull: true, optional: true}
1234 ]);
1235 if (e) throw e;
1236 this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ?
1237 [initialText.toString()] : [];
1238 this._value = {};
1239 this._len = 0;
1240 }
1241 function Sys$StringBuilder$append(text) {
1242 /// <summary locid="M:J#Sys.StringBuilder.append" />
1243 /// <param name="text" mayBeNull="true"></param>
1244 var e = Function._validateParams(arguments, [
1245 {name: "text", mayBeNull: true}
1246 ]);
1247 if (e) throw e;
1248 this._parts[this._parts.length] = text;
1249 }
1250 function Sys$StringBuilder$appendLine(text) {
1251 /// <summary locid="M:J#Sys.StringBuilder.appendLine" />
1252 /// <param name="text" optional="true" mayBeNull="true"></param>
1253 var e = Function._validateParams(arguments, [
1254 {name: "text", mayBeNull: true, optional: true}
1255 ]);
1256 if (e) throw e;
1257 this._parts[this._parts.length] =
1258 ((typeof(text) === 'undefined') || (text === null) || (text === '')) ?
1259 '\r\n' : text + '\r\n';
1260 }
1261 function Sys$StringBuilder$clear() {
1262 /// <summary locid="M:J#Sys.StringBuilder.clear" />
1263 if (arguments.length !== 0) throw Error.parameterCount();
1264 this._parts = [];
1265 this._value = {};
1266 this._len = 0;
1267 }
1268 function Sys$StringBuilder$isEmpty() {
1269 /// <summary locid="M:J#Sys.StringBuilder.isEmpty" />
1270 /// <returns type="Boolean"></returns>
1271 if (arguments.length !== 0) throw Error.parameterCount();
1272 if (this._parts.length === 0) return true;
1273 return this.toString() === '';
1274 }
1275 function Sys$StringBuilder$toString(separator) {
1276 /// <summary locid="M:J#Sys.StringBuilder.toString" />
1277 /// <param name="separator" type="String" optional="true" mayBeNull="true"></param>
1278 /// <returns type="String"></returns>
1279 var e = Function._validateParams(arguments, [
1280 {name: "separator", type: String, mayBeNull: true, optional: true}
1281 ]);
1282 if (e) throw e;
1283 separator = separator || '';
1284 var parts = this._parts;
1285 if (this._len !== parts.length) {
1286 this._value = {};
1287 this._len = parts.length;
1288 }
1289 var val = this._value;
1290 if (typeof(val[separator]) === 'undefined') {
1291 if (separator !== '') {
1292 for (var i = 0; i < parts.length;) {
1293 if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) {
1294 parts.splice(i, 1);
1295 }
1296 else {
1297 i++;
1298 }
1299 }
1300 }
1301 val[separator] = this._parts.join(separator);
1302 }
1303 return val[separator];
1304 }
1305 Sys.StringBuilder.prototype = {
1306 append: Sys$StringBuilder$append,
1307 appendLine: Sys$StringBuilder$appendLine,
1308 clear: Sys$StringBuilder$clear,
1309 isEmpty: Sys$StringBuilder$isEmpty,
1310 toString: Sys$StringBuilder$toString
1311 }
1312 Sys.StringBuilder.registerClass('Sys.StringBuilder');
1313
1314 Sys.Browser = {};
1315 Sys.Browser.InternetExplorer = {};
1316 Sys.Browser.Firefox = {};
1317 Sys.Browser.Safari = {};
1318 Sys.Browser.Opera = {};
1319 Sys.Browser.agent = null;
1320 Sys.Browser.hasDebuggerStatement = false;
1321 Sys.Browser.name = navigator.appName;
1322 Sys.Browser.version = parseFloat(navigator.appVersion);
1323 Sys.Browser.documentMode = 0;
1324 if (navigator.userAgent.indexOf(' MSIE ') > -1) {
1325 Sys.Browser.agent = Sys.Browser.InternetExplorer;
1326 Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
1327 if (Sys.Browser.version >= 8) {
1328 if (document.documentMode >= 7) {
1329 Sys.Browser.documentMode = document.documentMode;
1330 }
1331 }
1332 Sys.Browser.hasDebuggerStatement = true;
1333 }
1334 else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
1335 Sys.Browser.agent = Sys.Browser.Firefox;
1336 Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
1337 Sys.Browser.name = 'Firefox';
1338 Sys.Browser.hasDebuggerStatement = true;
1339 }
1340 else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) {
1341 Sys.Browser.agent = Sys.Browser.Safari;
1342 Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]);
1343 Sys.Browser.name = 'Safari';
1344 }
1345 else if (navigator.userAgent.indexOf('Opera/') > -1) {
1346 Sys.Browser.agent = Sys.Browser.Opera;
1347 }
1348
1349 Sys.EventArgs = function Sys$EventArgs() {
1350 /// <summary locid="M:J#Sys.EventArgs.#ctor" />
1351 if (arguments.length !== 0) throw Error.parameterCount();
1352 }
1353 Sys.EventArgs.registerClass('Sys.EventArgs');
1354 Sys.EventArgs.Empty = new Sys.EventArgs();
1355
1356 Sys.CancelEventArgs = function Sys$CancelEventArgs() {
1357 /// <summary locid="M:J#Sys.CancelEventArgs.#ctor" />
1358 if (arguments.length !== 0) throw Error.parameterCount();
1359 Sys.CancelEventArgs.initializeBase(this);
1360 this._cancel = false;
1361 }
1362 function Sys$CancelEventArgs$get_cancel() {
1363 /// <value type="Boolean" locid="P:J#Sys.CancelEventArgs.cancel"></value>
1364 if (arguments.length !== 0) throw Error.parameterCount();
1365 return this._cancel;
1366 }
1367 function Sys$CancelEventArgs$set_cancel(value) {
1368 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
1369 if (e) throw e;
1370 this._cancel = value;
1371 }
1372 Sys.CancelEventArgs.prototype = {
1373 get_cancel: Sys$CancelEventArgs$get_cancel,
1374 set_cancel: Sys$CancelEventArgs$set_cancel
1375 }
1376 Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs);
1377 Type.registerNamespace('Sys.UI');
1378
1379 Sys._Debug = function Sys$_Debug() {
1380 /// <summary locid="M:J#Sys.Debug.#ctor" />
1381 /// <field name="isDebug" type="Boolean" locid="F:J#Sys.Debug.isDebug"></field>
1382 if (arguments.length !== 0) throw Error.parameterCount();
1383 }
1384 function Sys$_Debug$_appendConsole(text) {
1385 if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
1386 Debug.writeln(text);
1387 }
1388 if (window.console && window.console.log) {
1389 window.console.log(text);
1390 }
1391 if (window.opera) {
1392 window.opera.postError(text);
1393 }
1394 if (window.debugService) {
1395 window.debugService.trace(text);
1396 }
1397 }
1398 function Sys$_Debug$_appendTrace(text) {
1399 var traceElement = document.getElementById('TraceConsole');
1400 if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
1401 traceElement.value += text + '\n';
1402 }
1403 }
1404 function Sys$_Debug$assert(condition, message, displayCaller) {
1405 /// <summary locid="M:J#Sys.Debug.assert" />
1406 /// <param name="condition" type="Boolean"></param>
1407 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
1408 /// <param name="displayCaller" type="Boolean" optional="true"></param>
1409 var e = Function._validateParams(arguments, [
1410 {name: "condition", type: Boolean},
1411 {name: "message", type: String, mayBeNull: true, optional: true},
1412 {name: "displayCaller", type: Boolean, optional: true}
1413 ]);
1414 if (e) throw e;
1415 if (!condition) {
1416 message = (displayCaller && this.assert.caller) ?
1417 String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) :
1418 String.format(Sys.Res.assertFailed, message);
1419 if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) {
1420 this.fail(message);
1421 }
1422 }
1423 }
1424 function Sys$_Debug$clearTrace() {
1425 /// <summary locid="M:J#Sys.Debug.clearTrace" />
1426 if (arguments.length !== 0) throw Error.parameterCount();
1427 var traceElement = document.getElementById('TraceConsole');
1428 if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
1429 traceElement.value = '';
1430 }
1431 }
1432 function Sys$_Debug$fail(message) {
1433 /// <summary locid="M:J#Sys.Debug.fail" />
1434 /// <param name="message" type="String" mayBeNull="true"></param>
1435 var e = Function._validateParams(arguments, [
1436 {name: "message", type: String, mayBeNull: true}
1437 ]);
1438 if (e) throw e;
1439 this._appendConsole(message);
1440 if (Sys.Browser.hasDebuggerStatement) {
1441 eval('debugger');
1442 }
1443 }
1444 function Sys$_Debug$trace(text) {
1445 /// <summary locid="M:J#Sys.Debug.trace" />
1446 /// <param name="text"></param>
1447 var e = Function._validateParams(arguments, [
1448 {name: "text"}
1449 ]);
1450 if (e) throw e;
1451 this._appendConsole(text);
1452 this._appendTrace(text);
1453 }
1454 function Sys$_Debug$traceDump(object, name) {
1455 /// <summary locid="M:J#Sys.Debug.traceDump" />
1456 /// <param name="object" mayBeNull="true"></param>
1457 /// <param name="name" type="String" mayBeNull="true" optional="true"></param>
1458 var e = Function._validateParams(arguments, [
1459 {name: "object", mayBeNull: true},
1460 {name: "name", type: String, mayBeNull: true, optional: true}
1461 ]);
1462 if (e) throw e;
1463 var text = this._traceDump(object, name, true);
1464 }
1465 function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) {
1466 name = name? name : 'traceDump';
1467 indentationPadding = indentationPadding? indentationPadding : '';
1468 if (object === null) {
1469 this.trace(indentationPadding + name + ': null');
1470 return;
1471 }
1472 switch(typeof(object)) {
1473 case 'undefined':
1474 this.trace(indentationPadding + name + ': Undefined');
1475 break;
1476 case 'number': case 'string': case 'boolean':
1477 this.trace(indentationPadding + name + ': ' + object);
1478 break;
1479 default:
1480 if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) {
1481 this.trace(indentationPadding + name + ': ' + object.toString());
1482 break;
1483 }
1484 if (!loopArray) {
1485 loopArray = [];
1486 }
1487 else if (Array.contains(loopArray, object)) {
1488 this.trace(indentationPadding + name + ': ...');
1489 return;
1490 }
1491 Array.add(loopArray, object);
1492 if ((object == window) || (object === document) ||
1493 (window.HTMLElement && (object instanceof HTMLElement)) ||
1494 (typeof(object.nodeName) === 'string')) {
1495 var tag = object.tagName? object.tagName : 'DomElement';
1496 if (object.id) {
1497 tag += ' - ' + object.id;
1498 }
1499 this.trace(indentationPadding + name + ' {' + tag + '}');
1500 }
1501 else {
1502 var typeName = Object.getTypeName(object);
1503 this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : ''));
1504 if ((indentationPadding === '') || recursive) {
1505 indentationPadding += " ";
1506 var i, length, properties, p, v;
1507 if (Array.isInstanceOfType(object)) {
1508 length = object.length;
1509 for (i = 0; i < length; i++) {
1510 this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray);
1511 }
1512 }
1513 else {
1514 for (p in object) {
1515 v = object[p];
1516 if (!Function.isInstanceOfType(v)) {
1517 this._traceDump(v, p, recursive, indentationPadding, loopArray);
1518 }
1519 }
1520 }
1521 }
1522 }
1523 Array.remove(loopArray, object);
1524 }
1525 }
1526 Sys._Debug.prototype = {
1527 _appendConsole: Sys$_Debug$_appendConsole,
1528 _appendTrace: Sys$_Debug$_appendTrace,
1529 assert: Sys$_Debug$assert,
1530 clearTrace: Sys$_Debug$clearTrace,
1531 fail: Sys$_Debug$fail,
1532 trace: Sys$_Debug$trace,
1533 traceDump: Sys$_Debug$traceDump,
1534 _traceDump: Sys$_Debug$_traceDump
1535 }
1536 Sys._Debug.registerClass('Sys._Debug');
1537 Sys.Debug = new Sys._Debug();
1538 Sys.Debug.isDebug = true;
1539
1540 function Sys$Enum$parse(value, ignoreCase) {
1541 /// <summary locid="M:J#Sys.Enum.parse" />
1542 /// <param name="value" type="String"></param>
1543 /// <param name="ignoreCase" type="Boolean" optional="true"></param>
1544 /// <returns></returns>
1545 var e = Function._validateParams(arguments, [
1546 {name: "value", type: String},
1547 {name: "ignoreCase", type: Boolean, optional: true}
1548 ]);
1549 if (e) throw e;
1550 var values, parsed, val;
1551 if (ignoreCase) {
1552 values = this.__lowerCaseValues;
1553 if (!values) {
1554 this.__lowerCaseValues = values = {};
1555 var prototype = this.prototype;
1556 for (var name in prototype) {
1557 values[name.toLowerCase()] = prototype[name];
1558 }
1559 }
1560 }
1561 else {
1562 values = this.prototype;
1563 }
1564 if (!this.__flags) {
1565 val = (ignoreCase ? value.toLowerCase() : value);
1566 parsed = values[val.trim()];
1567 if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
1568 return parsed;
1569 }
1570 else {
1571 var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
1572 var v = 0;
1573 for (var i = parts.length - 1; i >= 0; i--) {
1574 var part = parts[i].trim();
1575 parsed = values[part];
1576 if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName));
1577 v |= parsed;
1578 }
1579 return v;
1580 }
1581 }
1582 function Sys$Enum$toString(value) {
1583 /// <summary locid="M:J#Sys.Enum.toString" />
1584 /// <param name="value" optional="true" mayBeNull="true"></param>
1585 /// <returns type="String"></returns>
1586 var e = Function._validateParams(arguments, [
1587 {name: "value", mayBeNull: true, optional: true}
1588 ]);
1589 if (e) throw e;
1590 if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
1591 if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this);
1592 var values = this.prototype;
1593 var i;
1594 if (!this.__flags || (value === 0)) {
1595 for (i in values) {
1596 if (values[i] === value) {
1597 return i;
1598 }
1599 }
1600 }
1601 else {
1602 var sorted = this.__sortedValues;
1603 if (!sorted) {
1604 sorted = [];
1605 for (i in values) {
1606 sorted[sorted.length] = {key: i, value: values[i]};
1607 }
1608 sorted.sort(function(a, b) {
1609 return a.value - b.value;
1610 });
1611 this.__sortedValues = sorted;
1612 }
1613 var parts = [];
1614 var v = value;
1615 for (i = sorted.length - 1; i >= 0; i--) {
1616 var kvp = sorted[i];
1617 var vali = kvp.value;
1618 if (vali === 0) continue;
1619 if ((vali & value) === vali) {
1620 parts[parts.length] = kvp.key;
1621 v -= vali;
1622 if (v === 0) break;
1623 }
1624 }
1625 if (parts.length && v === 0) return parts.reverse().join(', ');
1626 }
1627 throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
1628 }
1629 Type.prototype.registerEnum = function Type$registerEnum(name, flags) {
1630 /// <summary locid="M:J#Sys.UI.LineType.#ctor" />
1631 /// <param name="name" type="String"></param>
1632 /// <param name="flags" type="Boolean" optional="true"></param>
1633 var e = Function._validateParams(arguments, [
1634 {name: "name", type: String},
1635 {name: "flags", type: Boolean, optional: true}
1636 ]);
1637 if (e) throw e;
1638 if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName);
1639 var parsedName;
1640 try {
1641 parsedName = eval(name);
1642 }
1643 catch(e) {
1644 throw Error.argument('name', Sys.Res.argumentTypeName);
1645 }
1646 if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName);
1647 if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name));
1648 for (var j in this.prototype) {
1649 var val = this.prototype[j];
1650 if (!Type.__identifierRegExp.test(j)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j));
1651 if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger);
1652 if (typeof(this[j]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, j));
1653 }
1654 Sys.__upperCaseTypes[name.toUpperCase()] = this;
1655 for (var i in this.prototype) {
1656 this[i] = this.prototype[i];
1657 }
1658 this.__typeName = name;
1659 this.parse = Sys$Enum$parse;
1660 this.__string = this.toString();
1661 this.toString = Sys$Enum$toString;
1662 this.__flags = flags;
1663 this.__enum = true;
1664 Sys.__registeredTypes[name] = true;
1665 }
1666 Type.isEnum = function Type$isEnum(type) {
1667 /// <summary locid="M:J#Type.isEnum" />
1668 /// <param name="type" mayBeNull="true"></param>
1669 /// <returns type="Boolean"></returns>
1670 var e = Function._validateParams(arguments, [
1671 {name: "type", mayBeNull: true}
1672 ]);
1673 if (e) throw e;
1674 if ((typeof(type) === 'undefined') || (type === null)) return false;
1675 return !!type.__enum;
1676 }
1677 Type.isFlags = function Type$isFlags(type) {
1678 /// <summary locid="M:J#Type.isFlags" />
1679 /// <param name="type" mayBeNull="true"></param>
1680 /// <returns type="Boolean"></returns>
1681 var e = Function._validateParams(arguments, [
1682 {name: "type", mayBeNull: true}
1683 ]);
1684 if (e) throw e;
1685 if ((typeof(type) === 'undefined') || (type === null)) return false;
1686 return !!type.__flags;
1687 }
1688 Sys.CollectionChange = function Sys$CollectionChange(action, newItems, newStartingIndex, oldItems, oldStartingIndex) {
1689 /// <summary locid="M:J#Sys.CollectionChange.#ctor" />
1690 /// <param name="action" type="Sys.NotifyCollectionChangedAction"></param>
1691 /// <param name="newItems" optional="true" mayBeNull="true"></param>
1692 /// <param name="newStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
1693 /// <param name="oldItems" optional="true" mayBeNull="true"></param>
1694 /// <param name="oldStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
1695 /// <field name="action" type="Sys.NotifyCollectionChangedAction" locid="F:J#Sys.CollectionChange.action"></field>
1696 /// <field name="newItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.newItems"></field>
1697 /// <field name="newStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.newStartingIndex"></field>
1698 /// <field name="oldItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.oldItems"></field>
1699 /// <field name="oldStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.oldStartingIndex"></field>
1700 var e = Function._validateParams(arguments, [
1701 {name: "action", type: Sys.NotifyCollectionChangedAction},
1702 {name: "newItems", mayBeNull: true, optional: true},
1703 {name: "newStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true},
1704 {name: "oldItems", mayBeNull: true, optional: true},
1705 {name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true}
1706 ]);
1707 if (e) throw e;
1708 this.action = action;
1709 if (newItems) {
1710 if (!(newItems instanceof Array)) {
1711 newItems = [newItems];
1712 }
1713 }
1714 this.newItems = newItems || null;
1715 if (typeof newStartingIndex !== "number") {
1716 newStartingIndex = -1;
1717 }
1718 this.newStartingIndex = newStartingIndex;
1719 if (oldItems) {
1720 if (!(oldItems instanceof Array)) {
1721 oldItems = [oldItems];
1722 }
1723 }
1724 this.oldItems = oldItems || null;
1725 if (typeof oldStartingIndex !== "number") {
1726 oldStartingIndex = -1;
1727 }
1728 this.oldStartingIndex = oldStartingIndex;
1729 }
1730 Sys.CollectionChange.registerClass("Sys.CollectionChange");
1731 Sys.NotifyCollectionChangedAction = function Sys$NotifyCollectionChangedAction() {
1732 /// <summary locid="M:J#Sys.NotifyCollectionChangedAction.#ctor" />
1733 /// <field name="add" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.add"></field>
1734 /// <field name="remove" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.remove"></field>
1735 /// <field name="reset" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.reset"></field>
1736 if (arguments.length !== 0) throw Error.parameterCount();
1737 throw Error.notImplemented();
1738 }
1739 Sys.NotifyCollectionChangedAction.prototype = {
1740 add: 0,
1741 remove: 1,
1742 reset: 2
1743 }
1744 Sys.NotifyCollectionChangedAction.registerEnum('Sys.NotifyCollectionChangedAction');
1745 Sys.NotifyCollectionChangedEventArgs = function Sys$NotifyCollectionChangedEventArgs(changes) {
1746 /// <summary locid="M:J#Sys.NotifyCollectionChangedEventArgs.#ctor" />
1747 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
1748 var e = Function._validateParams(arguments, [
1749 {name: "changes", type: Array, elementType: Sys.CollectionChange}
1750 ]);
1751 if (e) throw e;
1752 this._changes = changes;
1753 Sys.NotifyCollectionChangedEventArgs.initializeBase(this);
1754 }
1755 function Sys$NotifyCollectionChangedEventArgs$get_changes() {
1756 /// <value type="Array" elementType="Sys.CollectionChange" locid="P:J#Sys.NotifyCollectionChangedEventArgs.changes"></value>
1757 if (arguments.length !== 0) throw Error.parameterCount();
1758 return this._changes || [];
1759 }
1760 Sys.NotifyCollectionChangedEventArgs.prototype = {
1761 get_changes: Sys$NotifyCollectionChangedEventArgs$get_changes
1762 }
1763 Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs);
1764 Sys.Observer = function Sys$Observer() {
1765 throw Error.invalidOperation();
1766 }
1767 Sys.Observer.registerClass("Sys.Observer");
1768 Sys.Observer.makeObservable = function Sys$Observer$makeObservable(target) {
1769 /// <summary locid="M:J#Sys.Observer.makeObservable" />
1770 /// <param name="target" mayBeNull="false"></param>
1771 /// <returns></returns>
1772 var e = Function._validateParams(arguments, [
1773 {name: "target"}
1774 ]);
1775 if (e) throw e;
1776 var isArray = target instanceof Array,
1777 o = Sys.Observer;
1778 Sys.Observer._ensureObservable(target);
1779 if (target.setValue === o._observeMethods.setValue) return target;
1780 o._addMethods(target, o._observeMethods);
1781 if (isArray) {
1782 o._addMethods(target, o._arrayMethods);
1783 }
1784 return target;
1785 }
1786 Sys.Observer._ensureObservable = function Sys$Observer$_ensureObservable(target) {
1787 var type = typeof target;
1788 if ((type === "string") || (type === "number") || (type === "boolean") || (type === "date")) {
1789 throw Error.invalidOperation(String.format(Sys.Res.notObservable, type));
1790 }
1791 }
1792 Sys.Observer._addMethods = function Sys$Observer$_addMethods(target, methods) {
1793 for (var m in methods) {
1794 if (target[m] && (target[m] !== methods[m])) {
1795 throw Error.invalidOperation(String.format(Sys.Res.observableConflict, m));
1796 }
1797 target[m] = methods[m];
1798 }
1799 }
1800 Sys.Observer._addEventHandler = function Sys$Observer$_addEventHandler(target, eventName, handler) {
1801 Sys.Observer._getContext(target, true).events._addHandler(eventName, handler);
1802 }
1803 Sys.Observer.addEventHandler = function Sys$Observer$addEventHandler(target, eventName, handler) {
1804 /// <summary locid="M:J#Sys.Observer.addEventHandler" />
1805 /// <param name="target"></param>
1806 /// <param name="eventName" type="String"></param>
1807 /// <param name="handler" type="Function"></param>
1808 var e = Function._validateParams(arguments, [
1809 {name: "target"},
1810 {name: "eventName", type: String},
1811 {name: "handler", type: Function}
1812 ]);
1813 if (e) throw e;
1814 Sys.Observer._ensureObservable(target);
1815 Sys.Observer._addEventHandler(target, eventName, handler);
1816 }
1817 Sys.Observer._removeEventHandler = function Sys$Observer$_removeEventHandler(target, eventName, handler) {
1818 Sys.Observer._getContext(target, true).events._removeHandler(eventName, handler);
1819 }
1820 Sys.Observer.removeEventHandler = function Sys$Observer$removeEventHandler(target, eventName, handler) {
1821 /// <summary locid="M:J#Sys.Observer.removeEventHandler" />
1822 /// <param name="target"></param>
1823 /// <param name="eventName" type="String"></param>
1824 /// <param name="handler" type="Function"></param>
1825 var e = Function._validateParams(arguments, [
1826 {name: "target"},
1827 {name: "eventName", type: String},
1828 {name: "handler", type: Function}
1829 ]);
1830 if (e) throw e;
1831 Sys.Observer._ensureObservable(target);
1832 Sys.Observer._removeEventHandler(target, eventName, handler);
1833 }
1834 Sys.Observer.raiseEvent = function Sys$Observer$raiseEvent(target, eventName, eventArgs) {
1835 /// <summary locid="M:J#Sys.Observer.raiseEvent" />
1836 /// <param name="target"></param>
1837 /// <param name="eventName" type="String"></param>
1838 /// <param name="eventArgs" type="Sys.EventArgs"></param>
1839 var e = Function._validateParams(arguments, [
1840 {name: "target"},
1841 {name: "eventName", type: String},
1842 {name: "eventArgs", type: Sys.EventArgs}
1843 ]);
1844 if (e) throw e;
1845 Sys.Observer._ensureObservable(target);
1846 var ctx = Sys.Observer._getContext(target);
1847 if (!ctx) return;
1848 var handler = ctx.events.getHandler(eventName);
1849 if (handler) {
1850 handler(target, eventArgs);
1851 }
1852 }
1853 Sys.Observer.addPropertyChanged = function Sys$Observer$addPropertyChanged(target, handler) {
1854 /// <summary locid="M:J#Sys.Observer.addPropertyChanged" />
1855 /// <param name="target" mayBeNull="false"></param>
1856 /// <param name="handler" type="Function"></param>
1857 var e = Function._validateParams(arguments, [
1858 {name: "target"},
1859 {name: "handler", type: Function}
1860 ]);
1861 if (e) throw e;
1862 Sys.Observer._ensureObservable(target);
1863 Sys.Observer._addEventHandler(target, "propertyChanged", handler);
1864 }
1865 Sys.Observer.removePropertyChanged = function Sys$Observer$removePropertyChanged(target, handler) {
1866 /// <summary locid="M:J#Sys.Observer.removePropertyChanged" />
1867 /// <param name="target" mayBeNull="false"></param>
1868 /// <param name="handler" type="Function"></param>
1869 var e = Function._validateParams(arguments, [
1870 {name: "target"},
1871 {name: "handler", type: Function}
1872 ]);
1873 if (e) throw e;
1874 Sys.Observer._ensureObservable(target);
1875 Sys.Observer._removeEventHandler(target, "propertyChanged", handler);
1876 }
1877 Sys.Observer.beginUpdate = function Sys$Observer$beginUpdate(target) {
1878 /// <summary locid="M:J#Sys.Observer.beginUpdate" />
1879 /// <param name="target" mayBeNull="false"></param>
1880 var e = Function._validateParams(arguments, [
1881 {name: "target"}
1882 ]);
1883 if (e) throw e;
1884 Sys.Observer._ensureObservable(target);
1885 Sys.Observer._getContext(target, true).updating = true;
1886 }
1887 Sys.Observer.endUpdate = function Sys$Observer$endUpdate(target) {
1888 /// <summary locid="M:J#Sys.Observer.endUpdate" />
1889 /// <param name="target" mayBeNull="false"></param>
1890 var e = Function._validateParams(arguments, [
1891 {name: "target"}
1892 ]);
1893 if (e) throw e;
1894 Sys.Observer._ensureObservable(target);
1895 var ctx = Sys.Observer._getContext(target);
1896 if (!ctx || !ctx.updating) return;
1897 ctx.updating = false;
1898 var dirty = ctx.dirty;
1899 ctx.dirty = false;
1900 if (dirty) {
1901 if (target instanceof Array) {
1902 var changes = ctx.changes;
1903 ctx.changes = null;
1904 Sys.Observer.raiseCollectionChanged(target, changes);
1905 }
1906 Sys.Observer.raisePropertyChanged(target, "");
1907 }
1908 }
1909 Sys.Observer.isUpdating = function Sys$Observer$isUpdating(target) {
1910 /// <summary locid="M:J#Sys.Observer.isUpdating" />
1911 /// <param name="target" mayBeNull="false"></param>
1912 /// <returns type="Boolean"></returns>
1913 var e = Function._validateParams(arguments, [
1914 {name: "target"}
1915 ]);
1916 if (e) throw e;
1917 Sys.Observer._ensureObservable(target);
1918 var ctx = Sys.Observer._getContext(target);
1919 return ctx ? ctx.updating : false;
1920 }
1921 Sys.Observer._setValue = function Sys$Observer$_setValue(target, propertyName, value) {
1922 var getter, setter, mainTarget = target, path = propertyName.split('.');
1923 for (var i = 0, l = (path.length - 1); i < l ; i++) {
1924 var name = path[i];
1925 getter = target["get_" + name];
1926 if (typeof (getter) === "function") {
1927 target = getter.call(target);
1928 }
1929 else {
1930 target = target[name];
1931 }
1932 var type = typeof (target);
1933 if ((target === null) || (type === "undefined")) {
1934 throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, propertyName));
1935 }
1936 }
1937 var currentValue, lastPath = path[l];
1938 getter = target["get_" + lastPath];
1939 setter = target["set_" + lastPath];
1940 if (typeof(getter) === 'function') {
1941 currentValue = getter.call(target);
1942 }
1943 else {
1944 currentValue = target[lastPath];
1945 }
1946 if (typeof(setter) === 'function') {
1947 setter.call(target, value);
1948 }
1949 else {
1950 target[lastPath] = value;
1951 }
1952 if (currentValue !== value) {
1953 var ctx = Sys.Observer._getContext(mainTarget);
1954 if (ctx && ctx.updating) {
1955 ctx.dirty = true;
1956 return;
1957 };
1958 Sys.Observer.raisePropertyChanged(mainTarget, path[0]);
1959 }
1960 }
1961 Sys.Observer.setValue = function Sys$Observer$setValue(target, propertyName, value) {
1962 /// <summary locid="M:J#Sys.Observer.setValue" />
1963 /// <param name="target" mayBeNull="false"></param>
1964 /// <param name="propertyName" type="String"></param>
1965 /// <param name="value" mayBeNull="true"></param>
1966 var e = Function._validateParams(arguments, [
1967 {name: "target"},
1968 {name: "propertyName", type: String},
1969 {name: "value", mayBeNull: true}
1970 ]);
1971 if (e) throw e;
1972 Sys.Observer._ensureObservable(target);
1973 Sys.Observer._setValue(target, propertyName, value);
1974 }
1975 Sys.Observer.raisePropertyChanged = function Sys$Observer$raisePropertyChanged(target, propertyName) {
1976 /// <summary locid="M:J#Sys.Observer.raisePropertyChanged" />
1977 /// <param name="target" mayBeNull="false"></param>
1978 /// <param name="propertyName" type="String"></param>
1979 Sys.Observer.raiseEvent(target, "propertyChanged", new Sys.PropertyChangedEventArgs(propertyName));
1980 }
1981 Sys.Observer.addCollectionChanged = function Sys$Observer$addCollectionChanged(target, handler) {
1982 /// <summary locid="M:J#Sys.Observer.addCollectionChanged" />
1983 /// <param name="target" type="Array" elementMayBeNull="true"></param>
1984 /// <param name="handler" type="Function"></param>
1985 var e = Function._validateParams(arguments, [
1986 {name: "target", type: Array, elementMayBeNull: true},
1987 {name: "handler", type: Function}
1988 ]);
1989 if (e) throw e;
1990 Sys.Observer._addEventHandler(target, "collectionChanged", handler);
1991 }
1992 Sys.Observer.removeCollectionChanged = function Sys$Observer$removeCollectionChanged(target, handler) {
1993 /// <summary locid="M:J#Sys.Observer.removeCollectionChanged" />
1994 /// <param name="target" type="Array" elementMayBeNull="true"></param>
1995 /// <param name="handler" type="Function"></param>
1996 var e = Function._validateParams(arguments, [
1997 {name: "target", type: Array, elementMayBeNull: true},
1998 {name: "handler", type: Function}
1999 ]);
2000 if (e) throw e;
2001 Sys.Observer._removeEventHandler(target, "collectionChanged", handler);
2002 }
2003 Sys.Observer._collectionChange = function Sys$Observer$_collectionChange(target, change) {
2004 var ctx = Sys.Observer._getContext(target);
2005 if (ctx && ctx.updating) {
2006 ctx.dirty = true;
2007 var changes = ctx.changes;
2008 if (!changes) {
2009 ctx.changes = changes = [change];
2010 }
2011 else {
2012 changes.push(change);
2013 }
2014 }
2015 else {
2016 Sys.Observer.raiseCollectionChanged(target, [change]);
2017 Sys.Observer.raisePropertyChanged(target, 'length');
2018 }
2019 }
2020 Sys.Observer.add = function Sys$Observer$add(target, item) {
2021 /// <summary locid="M:J#Sys.Observer.add" />
2022 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2023 /// <param name="item" mayBeNull="true"></param>
2024 var e = Function._validateParams(arguments, [
2025 {name: "target", type: Array, elementMayBeNull: true},
2026 {name: "item", mayBeNull: true}
2027 ]);
2028 if (e) throw e;
2029 var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], target.length);
2030 Array.add(target, item);
2031 Sys.Observer._collectionChange(target, change);
2032 }
2033 Sys.Observer.addRange = function Sys$Observer$addRange(target, items) {
2034 /// <summary locid="M:J#Sys.Observer.addRange" />
2035 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2036 /// <param name="items" type="Array" elementMayBeNull="true"></param>
2037 var e = Function._validateParams(arguments, [
2038 {name: "target", type: Array, elementMayBeNull: true},
2039 {name: "items", type: Array, elementMayBeNull: true}
2040 ]);
2041 if (e) throw e;
2042 var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, items, target.length);
2043 Array.addRange(target, items);
2044 Sys.Observer._collectionChange(target, change);
2045 }
2046 Sys.Observer.clear = function Sys$Observer$clear(target) {
2047 /// <summary locid="M:J#Sys.Observer.clear" />
2048 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2049 var e = Function._validateParams(arguments, [
2050 {name: "target", type: Array, elementMayBeNull: true}
2051 ]);
2052 if (e) throw e;
2053 var oldItems = Array.clone(target);
2054 Array.clear(target);
2055 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems, 0));
2056 }
2057 Sys.Observer.insert = function Sys$Observer$insert(target, index, item) {
2058 /// <summary locid="M:J#Sys.Observer.insert" />
2059 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2060 /// <param name="index" type="Number" integer="true"></param>
2061 /// <param name="item" mayBeNull="true"></param>
2062 var e = Function._validateParams(arguments, [
2063 {name: "target", type: Array, elementMayBeNull: true},
2064 {name: "index", type: Number, integer: true},
2065 {name: "item", mayBeNull: true}
2066 ]);
2067 if (e) throw e;
2068 Array.insert(target, index, item);
2069 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index));
2070 }
2071 Sys.Observer.remove = function Sys$Observer$remove(target, item) {
2072 /// <summary locid="M:J#Sys.Observer.remove" />
2073 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2074 /// <param name="item" mayBeNull="true"></param>
2075 /// <returns type="Boolean"></returns>
2076 var e = Function._validateParams(arguments, [
2077 {name: "target", type: Array, elementMayBeNull: true},
2078 {name: "item", mayBeNull: true}
2079 ]);
2080 if (e) throw e;
2081 var index = Array.indexOf(target, item);
2082 if (index !== -1) {
2083 Array.remove(target, item);
2084 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
2085 return true;
2086 }
2087 return false;
2088 }
2089 Sys.Observer.removeAt = function Sys$Observer$removeAt(target, index) {
2090 /// <summary locid="M:J#Sys.Observer.removeAt" />
2091 /// <param name="target" type="Array" elementMayBeNull="true"></param>
2092 /// <param name="index" type="Number" integer="true"></param>
2093 var e = Function._validateParams(arguments, [
2094 {name: "target", type: Array, elementMayBeNull: true},
2095 {name: "index", type: Number, integer: true}
2096 ]);
2097 if (e) throw e;
2098 if ((index > -1) && (index < target.length)) {
2099 var item = target[index];
2100 Array.removeAt(target, index);
2101 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
2102 }
2103 }
2104 Sys.Observer.raiseCollectionChanged = function Sys$Observer$raiseCollectionChanged(target, changes) {
2105 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2106 /// <param name="target"></param>
2107 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
2108 Sys.Observer.raiseEvent(target, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
2109 }
2110 Sys.Observer._observeMethods = {
2111 add_propertyChanged: function(handler) {
2112 Sys.Observer._addEventHandler(this, "propertyChanged", handler);
2113 },
2114 remove_propertyChanged: function(handler) {
2115 Sys.Observer._removeEventHandler(this, "propertyChanged", handler);
2116 },
2117 addEventHandler: function(eventName, handler) {
2118 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2119 /// <param name="eventName" type="String"></param>
2120 /// <param name="handler" type="Function"></param>
2121 var e = Function._validateParams(arguments, [
2122 {name: "eventName", type: String},
2123 {name: "handler", type: Function}
2124 ]);
2125 if (e) throw e;
2126 Sys.Observer._addEventHandler(this, eventName, handler);
2127 },
2128 removeEventHandler: function(eventName, handler) {
2129 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2130 /// <param name="eventName" type="String"></param>
2131 /// <param name="handler" type="Function"></param>
2132 var e = Function._validateParams(arguments, [
2133 {name: "eventName", type: String},
2134 {name: "handler", type: Function}
2135 ]);
2136 if (e) throw e;
2137 Sys.Observer._removeEventHandler(this, eventName, handler);
2138 },
2139 get_isUpdating: function() {
2140 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2141 /// <returns type="Boolean"></returns>
2142 return Sys.Observer.isUpdating(this);
2143 },
2144 beginUpdate: function() {
2145 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2146 Sys.Observer.beginUpdate(this);
2147 },
2148 endUpdate: function() {
2149 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2150 Sys.Observer.endUpdate(this);
2151 },
2152 setValue: function(name, value) {
2153 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2154 /// <param name="name" type="String"></param>
2155 /// <param name="value" mayBeNull="true"></param>
2156 var e = Function._validateParams(arguments, [
2157 {name: "name", type: String},
2158 {name: "value", mayBeNull: true}
2159 ]);
2160 if (e) throw e;
2161 Sys.Observer._setValue(this, name, value);
2162 },
2163 raiseEvent: function(eventName, eventArgs) {
2164 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2165 /// <param name="eventName" type="String"></param>
2166 /// <param name="eventArgs" type="Sys.EventArgs"></param>
2167 Sys.Observer.raiseEvent(this, eventName, eventArgs);
2168 },
2169 raisePropertyChanged: function(name) {
2170 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2171 /// <param name="name" type="String"></param>
2172 Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(name));
2173 }
2174 }
2175 Sys.Observer._arrayMethods = {
2176 add_collectionChanged: function(handler) {
2177 Sys.Observer._addEventHandler(this, "collectionChanged", handler);
2178 },
2179 remove_collectionChanged: function(handler) {
2180 Sys.Observer._removeEventHandler(this, "collectionChanged", handler);
2181 },
2182 add: function(item) {
2183 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2184 /// <param name="item" mayBeNull="true"></param>
2185 Sys.Observer.add(this, item);
2186 },
2187 addRange: function(items) {
2188 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2189 /// <param name="items" type="Array" elementMayBeNull="true"></param>
2190 Sys.Observer.addRange(this, items);
2191 },
2192 clear: function() {
2193 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2194 Sys.Observer.clear(this);
2195 },
2196 insert: function(index, item) {
2197 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2198 /// <param name="index" type="Number" integer="true"></param>
2199 /// <param name="item" mayBeNull="true"></param>
2200 Sys.Observer.insert(this, index, item);
2201 },
2202 remove: function(item) {
2203 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2204 /// <param name="item" mayBeNull="true"></param>
2205 /// <returns type="Boolean"></returns>
2206 return Sys.Observer.remove(this, item);
2207 },
2208 removeAt: function(index) {
2209 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2210 /// <param name="index" type="Number" integer="true"></param>
2211 Sys.Observer.removeAt(this, index);
2212 },
2213 raiseCollectionChanged: function(changes) {
2214 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
2215 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
2216 Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
2217 }
2218 }
2219 Sys.Observer._getContext = function Sys$Observer$_getContext(obj, create) {
2220 var ctx = obj._observerContext;
2221 if (ctx) return ctx();
2222 if (create) {
2223 return (obj._observerContext = Sys.Observer._createContext())();
2224 }
2225 return null;
2226 }
2227 Sys.Observer._createContext = function Sys$Observer$_createContext() {
2228 var ctx = {
2229 events: new Sys.EventHandlerList()
2230 };
2231 return function() {
2232 return ctx;
2233 }
2234 }
2235 Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) {
2236 var quoteCount = 0;
2237 var escaped = false;
2238 for (var i = 0, il = preMatch.length; i < il; i++) {
2239 var c = preMatch.charAt(i);
2240 switch (c) {
2241 case '\'':
2242 if (escaped) strBuilder.append("'");
2243 else quoteCount++;
2244 escaped = false;
2245 break;
2246 case '\\':
2247 if (escaped) strBuilder.append("\\");
2248 escaped = !escaped;
2249 break;
2250 default:
2251 strBuilder.append(c);
2252 escaped = false;
2253 break;
2254 }
2255 }
2256 return quoteCount;
2257 }
2258 Date._expandFormat = function Date$_expandFormat(dtf, format) {
2259 if (!format) {
2260 format = "F";
2261 }
2262 var len = format.length;
2263 if (len === 1) {
2264 switch (format) {
2265 case "d":
2266 return dtf.ShortDatePattern;
2267 case "D":
2268 return dtf.LongDatePattern;
2269 case "t":
2270 return dtf.ShortTimePattern;
2271 case "T":
2272 return dtf.LongTimePattern;
2273 case "f":
2274 return dtf.LongDatePattern + " " + dtf.ShortTimePattern;
2275 case "F":
2276 return dtf.FullDateTimePattern;
2277 case "M": case "m":
2278 return dtf.MonthDayPattern;
2279 case "s":
2280 return dtf.SortableDateTimePattern;
2281 case "Y": case "y":
2282 return dtf.YearMonthPattern;
2283 default:
2284 throw Error.format(Sys.Res.formatInvalidString);
2285 }
2286 }
2287 else if ((len === 2) && (format.charAt(0) === "%")) {
2288 format = format.charAt(1);
2289 }
2290 return format;
2291 }
2292 Date._expandYear = function Date$_expandYear(dtf, year) {
2293 var now = new Date(),
2294 era = Date._getEra(now);
2295 if (year < 100) {
2296 var curr = Date._getEraYear(now, dtf, era);
2297 year += curr - (curr % 100);
2298 if (year > dtf.Calendar.TwoDigitYearMax) {
2299 year -= 100;
2300 }
2301 }
2302 return year;
2303 }
2304 Date._getEra = function Date$_getEra(date, eras) {
2305 if (!eras) return 0;
2306 var start, ticks = date.getTime();
2307 for (var i = 0, l = eras.length; i < l; i += 4) {
2308 start = eras[i+2];
2309 if ((start === null) || (ticks >= start)) {
2310 return i;
2311 }
2312 }
2313 return 0;
2314 }
2315 Date._getEraYear = function Date$_getEraYear(date, dtf, era, sortable) {
2316 var year = date.getFullYear();
2317 if (!sortable && dtf.eras) {
2318 year -= dtf.eras[era + 3];
2319 }
2320 return year;
2321 }
2322 Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) {
2323 if (!dtf._parseRegExp) {
2324 dtf._parseRegExp = {};
2325 }
2326 else if (dtf._parseRegExp[format]) {
2327 return dtf._parseRegExp[format];
2328 }
2329 var expFormat = Date._expandFormat(dtf, format);
2330 expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");
2331 var regexp = new Sys.StringBuilder("^");
2332 var groups = [];
2333 var index = 0;
2334 var quoteCount = 0;
2335 var tokenRegExp = Date._getTokenRegExp();
2336 var match;
2337 while ((match = tokenRegExp.exec(expFormat)) !== null) {
2338 var preMatch = expFormat.slice(index, match.index);
2339 index = tokenRegExp.lastIndex;
2340 quoteCount += Date._appendPreOrPostMatch(preMatch, regexp);
2341 if ((quoteCount%2) === 1) {
2342 regexp.append(match[0]);
2343 continue;
2344 }
2345 switch (match[0]) {
2346 case 'dddd': case 'ddd':
2347 case 'MMMM': case 'MMM':
2348 case 'gg': case 'g':
2349 regexp.append("(\\D+)");
2350 break;
2351 case 'tt': case 't':
2352 regexp.append("(\\D*)");
2353 break;
2354 case 'yyyy':
2355 regexp.append("(\\d{4})");
2356 break;
2357 case 'fff':
2358 regexp.append("(\\d{3})");
2359 break;
2360 case 'ff':
2361 regexp.append("(\\d{2})");
2362 break;
2363 case 'f':
2364 regexp.append("(\\d)");
2365 break;
2366 case 'dd': case 'd':
2367 case 'MM': case 'M':
2368 case 'yy': case 'y':
2369 case 'HH': case 'H':
2370 case 'hh': case 'h':
2371 case 'mm': case 'm':
2372 case 'ss': case 's':
2373 regexp.append("(\\d\\d?)");
2374 break;
2375 case 'zzz':
2376 regexp.append("([+-]?\\d\\d?:\\d{2})");
2377 break;
2378 case 'zz': case 'z':
2379 regexp.append("([+-]?\\d\\d?)");
2380 break;
2381 case '/':
2382 regexp.append("(\\" + dtf.DateSeparator + ")");
2383 break;
2384 default:
2385 Sys.Debug.fail("Invalid date format pattern");
2386 }
2387 Array.add(groups, match[0]);
2388 }
2389 Date._appendPreOrPostMatch(expFormat.slice(index), regexp);
2390 regexp.append("$");
2391 var regexpStr = regexp.toString().replace(/\s+/g, "\\s+");
2392 var parseRegExp = {'regExp': regexpStr, 'groups': groups};
2393 dtf._parseRegExp[format] = parseRegExp;
2394 return parseRegExp;
2395 }
2396 Date._getTokenRegExp = function Date$_getTokenRegExp() {
2397 return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g;
2398 }
2399 Date.parseLocale = function Date$parseLocale(value, formats) {
2400 /// <summary locid="M:J#Date.parseLocale" />
2401 /// <param name="value" type="String"></param>
2402 /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
2403 /// <returns type="Date"></returns>
2404 var e = Function._validateParams(arguments, [
2405 {name: "value", type: String},
2406 {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
2407 ]);
2408 if (e) throw e;
2409 return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments);
2410 }
2411 Date.parseInvariant = function Date$parseInvariant(value, formats) {
2412 /// <summary locid="M:J#Date.parseInvariant" />
2413 /// <param name="value" type="String"></param>
2414 /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
2415 /// <returns type="Date"></returns>
2416 var e = Function._validateParams(arguments, [
2417 {name: "value", type: String},
2418 {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
2419 ]);
2420 if (e) throw e;
2421 return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments);
2422 }
2423 Date._parse = function Date$_parse(value, cultureInfo, args) {
2424 var i, l, date, format, formats, custom = false;
2425 for (i = 1, l = args.length; i < l; i++) {
2426 format = args[i];
2427 if (format) {
2428 custom = true;
2429 date = Date._parseExact(value, format, cultureInfo);
2430 if (date) return date;
2431 }
2432 }
2433 if (! custom) {
2434 formats = cultureInfo._getDateTimeFormats();
2435 for (i = 0, l = formats.length; i < l; i++) {
2436 date = Date._parseExact(value, formats[i], cultureInfo);
2437 if (date) return date;
2438 }
2439 }
2440 return null;
2441 }
2442 Date._parseExact = function Date$_parseExact(value, format, cultureInfo) {
2443 value = value.trim();
2444 var dtf = cultureInfo.dateTimeFormat,
2445 parseInfo = Date._getParseRegExp(dtf, format),
2446 match = new RegExp(parseInfo.regExp).exec(value);
2447 if (match === null) return null;
2448
2449 var groups = parseInfo.groups,
2450 era = null, year = null, month = null, date = null, weekDay = null,
2451 hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
2452 pmHour = false;
2453 for (var j = 0, jl = groups.length; j < jl; j++) {
2454 var matchGroup = match[j+1];
2455 if (matchGroup) {
2456 switch (groups[j]) {
2457 case 'dd': case 'd':
2458 date = parseInt(matchGroup, 10);
2459 if ((date < 1) || (date > 31)) return null;
2460 break;
2461 case 'MMMM':
2462 month = cultureInfo._getMonthIndex(matchGroup);
2463 if ((month < 0) || (month > 11)) return null;
2464 break;
2465 case 'MMM':
2466 month = cultureInfo._getAbbrMonthIndex(matchGroup);
2467 if ((month < 0) || (month > 11)) return null;
2468 break;
2469 case 'M': case 'MM':
2470 month = parseInt(matchGroup, 10) - 1;
2471 if ((month < 0) || (month > 11)) return null;
2472 break;
2473 case 'y': case 'yy':
2474 year = Date._expandYear(dtf,parseInt(matchGroup, 10));
2475 if ((year < 0) || (year > 9999)) return null;
2476 break;
2477 case 'yyyy':
2478 year = parseInt(matchGroup, 10);
2479 if ((year < 0) || (year > 9999)) return null;
2480 break;
2481 case 'h': case 'hh':
2482 hour = parseInt(matchGroup, 10);
2483 if (hour === 12) hour = 0;
2484 if ((hour < 0) || (hour > 11)) return null;
2485 break;
2486 case 'H': case 'HH':
2487 hour = parseInt(matchGroup, 10);
2488 if ((hour < 0) || (hour > 23)) return null;
2489 break;
2490 case 'm': case 'mm':
2491 min = parseInt(matchGroup, 10);
2492 if ((min < 0) || (min > 59)) return null;
2493 break;
2494 case 's': case 'ss':
2495 sec = parseInt(matchGroup, 10);
2496 if ((sec < 0) || (sec > 59)) return null;
2497 break;
2498 case 'tt': case 't':
2499 var upperToken = matchGroup.toUpperCase();
2500 pmHour = (upperToken === dtf.PMDesignator.toUpperCase());
2501 if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null;
2502 break;
2503 case 'f':
2504 msec = parseInt(matchGroup, 10) * 100;
2505 if ((msec < 0) || (msec > 999)) return null;
2506 break;
2507 case 'ff':
2508 msec = parseInt(matchGroup, 10) * 10;
2509 if ((msec < 0) || (msec > 999)) return null;
2510 break;
2511 case 'fff':
2512 msec = parseInt(matchGroup, 10);
2513 if ((msec < 0) || (msec > 999)) return null;
2514 break;
2515 case 'dddd':
2516 weekDay = cultureInfo._getDayIndex(matchGroup);
2517 if ((weekDay < 0) || (weekDay > 6)) return null;
2518 break;
2519 case 'ddd':
2520 weekDay = cultureInfo._getAbbrDayIndex(matchGroup);
2521 if ((weekDay < 0) || (weekDay > 6)) return null;
2522 break;
2523 case 'zzz':
2524 var offsets = matchGroup.split(/:/);
2525 if (offsets.length !== 2) return null;
2526 hourOffset = parseInt(offsets[0], 10);
2527 if ((hourOffset < -12) || (hourOffset > 13)) return null;
2528 var minOffset = parseInt(offsets[1], 10);
2529 if ((minOffset < 0) || (minOffset > 59)) return null;
2530 tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset);
2531 break;
2532 case 'z': case 'zz':
2533 hourOffset = parseInt(matchGroup, 10);
2534 if ((hourOffset < -12) || (hourOffset > 13)) return null;
2535 tzMinOffset = hourOffset * 60;
2536 break;
2537 case 'g': case 'gg':
2538 var eraName = matchGroup;
2539 if (!eraName || !dtf.eras) return null;
2540 eraName = eraName.toLowerCase().trim();
2541 for (var i = 0, l = dtf.eras.length; i < l; i += 4) {
2542 if (eraName === dtf.eras[i + 1].toLowerCase()) {
2543 era = i;
2544 break;
2545 }
2546 }
2547 if (era === null) return null;
2548 break;
2549 }
2550 }
2551 }
2552 var result = new Date(), defaults, convert = dtf.Calendar.convert;
2553 if (convert) {
2554 defaults = convert.fromGregorian(result);
2555 }
2556 if (!convert) {
2557 defaults = [result.getFullYear(), result.getMonth(), result.getDate()];
2558 }
2559 if (year === null) {
2560 year = defaults[0];
2561 }
2562 else if (dtf.eras) {
2563 year += dtf.eras[(era || 0) + 3];
2564 }
2565 if (month === null) {
2566 month = defaults[1];
2567 }
2568 if (date === null) {
2569 date = defaults[2];
2570 }
2571 if (convert) {
2572 result = convert.toGregorian(year, month, date);
2573 if (result === null) return null;
2574 }
2575 else {
2576 result.setFullYear(year, month, date);
2577 if (result.getDate() !== date) return null;
2578 if ((weekDay !== null) && (result.getDay() !== weekDay)) {
2579 return null;
2580 }
2581 }
2582 if (pmHour && (hour < 12)) {
2583 hour += 12;
2584 }
2585 result.setHours(hour, min, sec, msec);
2586 if (tzMinOffset !== null) {
2587 var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset());
2588 result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60);
2589 }
2590 return result;
2591 }
2592 Date.prototype.format = function Date$format(format) {
2593 /// <summary locid="M:J#Date.format" />
2594 /// <param name="format" type="String"></param>
2595 /// <returns type="String"></returns>
2596 var e = Function._validateParams(arguments, [
2597 {name: "format", type: String}
2598 ]);
2599 if (e) throw e;
2600 return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
2601 }
2602 Date.prototype.localeFormat = function Date$localeFormat(format) {
2603 /// <summary locid="M:J#Date.localeFormat" />
2604 /// <param name="format" type="String"></param>
2605 /// <returns type="String"></returns>
2606 var e = Function._validateParams(arguments, [
2607 {name: "format", type: String}
2608 ]);
2609 if (e) throw e;
2610 return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
2611 }
2612 Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) {
2613 var dtf = cultureInfo.dateTimeFormat,
2614 convert = dtf.Calendar.convert;
2615 if (!format || !format.length || (format === 'i')) {
2616 if (cultureInfo && cultureInfo.name.length) {
2617 if (convert) {
2618 return this._toFormattedString(dtf.FullDateTimePattern, cultureInfo);
2619 }
2620 else {
2621 var eraDate = new Date(this.getTime());
2622 var era = Date._getEra(this, dtf.eras);
2623 eraDate.setFullYear(Date._getEraYear(this, dtf, era));
2624 return eraDate.toLocaleString();
2625 }
2626 }
2627 else {
2628 return this.toString();
2629 }
2630 }
2631 var eras = dtf.eras,
2632 sortable = (format === "s");
2633 format = Date._expandFormat(dtf, format);
2634 var ret = new Sys.StringBuilder();
2635 var hour;
2636 function addLeadingZero(num) {
2637 if (num < 10) {
2638 return '0' + num;
2639 }
2640 return num.toString();
2641 }
2642 function addLeadingZeros(num) {
2643 if (num < 10) {
2644 return '00' + num;
2645 }
2646 if (num < 100) {
2647 return '0' + num;
2648 }
2649 return num.toString();
2650 }
2651 function padYear(year) {
2652 if (year < 10) {
2653 return '000' + year;
2654 }
2655 else if (year < 100) {
2656 return '00' + year;
2657 }
2658 else if (year < 1000) {
2659 return '0' + year;
2660 }
2661 return year.toString();
2662 }
2663
2664 var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g;
2665 function hasDay() {
2666 if (foundDay || checkedDay) {
2667 return foundDay;
2668 }
2669 foundDay = dayPartRegExp.test(format);
2670 checkedDay = true;
2671 return foundDay;
2672 }
2673
2674 var quoteCount = 0,
2675 tokenRegExp = Date._getTokenRegExp(),
2676 converted;
2677 if (!sortable && convert) {
2678 converted = convert.fromGregorian(this);
2679 }
2680 for (;;) {
2681 var index = tokenRegExp.lastIndex;
2682 var ar = tokenRegExp.exec(format);
2683 var preMatch = format.slice(index, ar ? ar.index : format.length);
2684 quoteCount += Date._appendPreOrPostMatch(preMatch, ret);
2685 if (!ar) break;
2686 if ((quoteCount%2) === 1) {
2687 ret.append(ar[0]);
2688 continue;
2689 }
2690
2691 function getPart(date, part) {
2692 if (converted) {
2693 return converted[part];
2694 }
2695 switch (part) {
2696 case 0: return date.getFullYear();
2697 case 1: return date.getMonth();
2698 case 2: return date.getDate();
2699 }
2700 }
2701 switch (ar[0]) {
2702 case "dddd":
2703 ret.append(dtf.DayNames[this.getDay()]);
2704 break;
2705 case "ddd":
2706 ret.append(dtf.AbbreviatedDayNames[this.getDay()]);
2707 break;
2708 case "dd":
2709 foundDay = true;
2710 ret.append(addLeadingZero(getPart(this, 2)));
2711 break;
2712 case "d":
2713 foundDay = true;
2714 ret.append(getPart(this, 2));
2715 break;
2716 case "MMMM":
2717 ret.append((dtf.MonthGenitiveNames && hasDay())
2718 ? dtf.MonthGenitiveNames[getPart(this, 1)]
2719 : dtf.MonthNames[getPart(this, 1)]);
2720 break;
2721 case "MMM":
2722 ret.append((dtf.AbbreviatedMonthGenitiveNames && hasDay())
2723 ? dtf.AbbreviatedMonthGenitiveNames[getPart(this, 1)]
2724 : dtf.AbbreviatedMonthNames[getPart(this, 1)]);
2725 break;
2726 case "MM":
2727 ret.append(addLeadingZero(getPart(this, 1) + 1));
2728 break;
2729 case "M":
2730 ret.append(getPart(this, 1) + 1);
2731 break;
2732 case "yyyy":
2733 ret.append(padYear(converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)));
2734 break;
2735 case "yy":
2736 ret.append(addLeadingZero((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100));
2737 break;
2738 case "y":
2739 ret.append((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100);
2740 break;
2741 case "hh":
2742 hour = this.getHours() % 12;
2743 if (hour === 0) hour = 12;
2744 ret.append(addLeadingZero(hour));
2745 break;
2746 case "h":
2747 hour = this.getHours() % 12;
2748 if (hour === 0) hour = 12;
2749 ret.append(hour);
2750 break;
2751 case "HH":
2752 ret.append(addLeadingZero(this.getHours()));
2753 break;
2754 case "H":
2755 ret.append(this.getHours());
2756 break;
2757 case "mm":
2758 ret.append(addLeadingZero(this.getMinutes()));
2759 break;
2760 case "m":
2761 ret.append(this.getMinutes());
2762 break;
2763 case "ss":
2764 ret.append(addLeadingZero(this.getSeconds()));
2765 break;
2766 case "s":
2767 ret.append(this.getSeconds());
2768 break;
2769 case "tt":
2770 ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator);
2771 break;
2772 case "t":
2773 ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0));
2774 break;
2775 case "f":
2776 ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0));
2777 break;
2778 case "ff":
2779 ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2));
2780 break;
2781 case "fff":
2782 ret.append(addLeadingZeros(this.getMilliseconds()));
2783 break;
2784 case "z":
2785 hour = this.getTimezoneOffset() / 60;
2786 ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour)));
2787 break;
2788 case "zz":
2789 hour = this.getTimezoneOffset() / 60;
2790 ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))));
2791 break;
2792 case "zzz":
2793 hour = this.getTimezoneOffset() / 60;
2794 ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) +
2795 ":" + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60)));
2796 break;
2797 case "g":
2798 case "gg":
2799 if (dtf.eras) {
2800 ret.append(dtf.eras[Date._getEra(this, eras) + 1]);
2801 }
2802 break;
2803 case "/":
2804 ret.append(dtf.DateSeparator);
2805 break;
2806 default:
2807 Sys.Debug.fail("Invalid date format pattern");
2808 }
2809 }
2810 return ret.toString();
2811 }
2812 String.localeFormat = function String$localeFormat(format, args) {
2813 /// <summary locid="M:J#String.localeFormat" />
2814 /// <param name="format" type="String"></param>
2815 /// <param name="args" parameterArray="true" mayBeNull="true"></param>
2816 /// <returns type="String"></returns>
2817 var e = Function._validateParams(arguments, [
2818 {name: "format", type: String},
2819 {name: "args", mayBeNull: true, parameterArray: true}
2820 ]);
2821 if (e) throw e;
2822 return String._toFormattedString(true, arguments);
2823 }
2824 Number.parseLocale = function Number$parseLocale(value) {
2825 /// <summary locid="M:J#Number.parseLocale" />
2826 /// <param name="value" type="String"></param>
2827 /// <returns type="Number"></returns>
2828 var e = Function._validateParams(arguments, [
2829 {name: "value", type: String}
2830 ], false);
2831 if (e) throw e;
2832 return Number._parse(value, Sys.CultureInfo.CurrentCulture);
2833 }
2834 Number.parseInvariant = function Number$parseInvariant(value) {
2835 /// <summary locid="M:J#Number.parseInvariant" />
2836 /// <param name="value" type="String"></param>
2837 /// <returns type="Number"></returns>
2838 var e = Function._validateParams(arguments, [
2839 {name: "value", type: String}
2840 ], false);
2841 if (e) throw e;
2842 return Number._parse(value, Sys.CultureInfo.InvariantCulture);
2843 }
2844 Number._parse = function Number$_parse(value, cultureInfo) {
2845 value = value.trim();
2846
2847 if (value.match(/^[+-]?infinity$/i)) {
2848 return parseFloat(value);
2849 }
2850 if (value.match(/^0x[a-f0-9]+$/i)) {
2851 return parseInt(value);
2852 }
2853 var numFormat = cultureInfo.numberFormat;
2854 var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern);
2855 var sign = signInfo[0];
2856 var num = signInfo[1];
2857
2858 if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) {
2859 signInfo = Number._parseNumberNegativePattern(value, numFormat, 1);
2860 sign = signInfo[0];
2861 num = signInfo[1];
2862 }
2863 if (sign === '') sign = '+';
2864
2865 var exponent;
2866 var intAndFraction;
2867 var exponentPos = num.indexOf('e');
2868 if (exponentPos < 0) exponentPos = num.indexOf('E');
2869 if (exponentPos < 0) {
2870 intAndFraction = num;
2871 exponent = null;
2872 }
2873 else {
2874 intAndFraction = num.substr(0, exponentPos);
2875 exponent = num.substr(exponentPos + 1);
2876 }
2877
2878 var integer;
2879 var fraction;
2880 var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator);
2881 if (decimalPos < 0) {
2882 integer = intAndFraction;
2883 fraction = null;
2884 }
2885 else {
2886 integer = intAndFraction.substr(0, decimalPos);
2887 fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length);
2888 }
2889
2890 integer = integer.split(numFormat.NumberGroupSeparator).join('');
2891 var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " ");
2892 if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) {
2893 integer = integer.split(altNumGroupSeparator).join('');
2894 }
2895
2896 var p = sign + integer;
2897 if (fraction !== null) {
2898 p += '.' + fraction;
2899 }
2900 if (exponent !== null) {
2901 var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1);
2902 if (expSignInfo[0] === '') {
2903 expSignInfo[0] = '+';
2904 }
2905 p += 'e' + expSignInfo[0] + expSignInfo[1];
2906 }
2907 if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) {
2908 return parseFloat(p);
2909 }
2910 return Number.NaN;
2911 }
2912 Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) {
2913 var neg = numFormat.NegativeSign;
2914 var pos = numFormat.PositiveSign;
2915 switch (numberNegativePattern) {
2916 case 4:
2917 neg = ' ' + neg;
2918 pos = ' ' + pos;
2919 case 3:
2920 if (value.endsWith(neg)) {
2921 return ['-', value.substr(0, value.length - neg.length)];
2922 }
2923 else if (value.endsWith(pos)) {
2924 return ['+', value.substr(0, value.length - pos.length)];
2925 }
2926 break;
2927 case 2:
2928 neg += ' ';
2929 pos += ' ';
2930 case 1:
2931 if (value.startsWith(neg)) {
2932 return ['-', value.substr(neg.length)];
2933 }
2934 else if (value.startsWith(pos)) {
2935 return ['+', value.substr(pos.length)];
2936 }
2937 break;
2938 case 0:
2939 if (value.startsWith('(') && value.endsWith(')')) {
2940 return ['-', value.substr(1, value.length - 2)];
2941 }
2942 break;
2943 default:
2944 Sys.Debug.fail("");
2945 }
2946 return ['', value];
2947 }
2948 Number.prototype.format = function Number$format(format) {
2949 /// <summary locid="M:J#Number.format" />
2950 /// <param name="format" type="String"></param>
2951 /// <returns type="String"></returns>
2952 var e = Function._validateParams(arguments, [
2953 {name: "format", type: String}
2954 ]);
2955 if (e) throw e;
2956 return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
2957 }
2958 Number.prototype.localeFormat = function Number$localeFormat(format) {
2959 /// <summary locid="M:J#Number.localeFormat" />
2960 /// <param name="format" type="String"></param>
2961 /// <returns type="String"></returns>
2962 var e = Function._validateParams(arguments, [
2963 {name: "format", type: String}
2964 ]);
2965 if (e) throw e;
2966 return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
2967 }
2968 Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) {
2969 if (!format || (format.length === 0) || (format === 'i')) {
2970 if (cultureInfo && (cultureInfo.name.length > 0)) {
2971 return this.toLocaleString();
2972 }
2973 else {
2974 return this.toString();
2975 }
2976 }
2977
2978 var _percentPositivePattern = ["n %", "n%", "%n" ];
2979 var _percentNegativePattern = ["-n %", "-n%", "-%n"];
2980 var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
2981 var _currencyPositivePattern = ["$n","n$","$ n","n $"];
2982 var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
2983 function zeroPad(str, count, left) {
2984 for (var l=str.length; l < count; l++) {
2985 str = (left ? ('0' + str) : (str + '0'));
2986 }
2987 return str;
2988 }
2989
2990 function expandNumber(number, precision, groupSizes, sep, decimalChar) {
2991 Sys.Debug.assert(groupSizes.length > 0, "groupSizes must be an array of at least 1");
2992 var curSize = groupSizes[0];
2993 var curGroupIndex = 1;
2994 var factor = Math.pow(10, precision);
2995 var rounded = (Math.round(number * factor) / factor);
2996 if (!isFinite(rounded)) {
2997 rounded = number;
2998 }
2999 number = rounded;
3000
3001 var numberString = number.toString();
3002 var right = "";
3003 var exponent;
3004
3005
3006 var split = numberString.split(/e/i);
3007 numberString = split[0];
3008 exponent = (split.length > 1 ? parseInt(split[1]) : 0);
3009 split = numberString.split('.');
3010 numberString = split[0];
3011 right = split.length > 1 ? split[1] : "";
3012
3013 var l;
3014 if (exponent > 0) {
3015 right = zeroPad(right, exponent, false);
3016 numberString += right.slice(0, exponent);
3017 right = right.substr(exponent);
3018 }
3019 else if (exponent < 0) {
3020 exponent = -exponent;
3021 numberString = zeroPad(numberString, exponent+1, true);
3022 right = numberString.slice(-exponent, numberString.length) + right;
3023 numberString = numberString.slice(0, -exponent);
3024 }
3025 if (precision > 0) {
3026 if (right.length > precision) {
3027 right = right.slice(0, precision);
3028 }
3029 else {
3030 right = zeroPad(right, precision, false);
3031 }
3032 right = decimalChar + right;
3033 }
3034 else {
3035 right = "";
3036 }
3037 var stringIndex = numberString.length-1;
3038 var ret = "";
3039 while (stringIndex >= 0) {
3040 if (curSize === 0 || curSize > stringIndex) {
3041 if (ret.length > 0)
3042 return numberString.slice(0, stringIndex + 1) + sep + ret + right;
3043 else
3044 return numberString.slice(0, stringIndex + 1) + right;
3045 }
3046 if (ret.length > 0)
3047 ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret;
3048 else
3049 ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1);
3050 stringIndex -= curSize;
3051 if (curGroupIndex < groupSizes.length) {
3052 curSize = groupSizes[curGroupIndex];
3053 curGroupIndex++;
3054 }
3055 }
3056 return numberString.slice(0, stringIndex + 1) + sep + ret + right;
3057 }
3058 var nf = cultureInfo.numberFormat;
3059 var number = Math.abs(this);
3060 if (!format)
3061 format = "D";
3062 var precision = -1;
3063 if (format.length > 1) precision = parseInt(format.slice(1), 10);
3064 var pattern;
3065 switch (format.charAt(0)) {
3066 case "d":
3067 case "D":
3068 pattern = 'n';
3069 if (precision !== -1) {
3070 number = zeroPad(""+number, precision, true);
3071 }
3072 if (this < 0) number = -number;
3073 break;
3074 case "c":
3075 case "C":
3076 if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern];
3077 else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern];
3078 if (precision === -1) precision = nf.CurrencyDecimalDigits;
3079 number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator);
3080 break;
3081 case "n":
3082 case "N":
3083 if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern];
3084 else pattern = 'n';
3085 if (precision === -1) precision = nf.NumberDecimalDigits;
3086 number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator);
3087 break;
3088 case "p":
3089 case "P":
3090 if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern];
3091 else pattern = _percentPositivePattern[nf.PercentPositivePattern];
3092 if (precision === -1) precision = nf.PercentDecimalDigits;
3093 number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator);
3094 break;
3095 default:
3096 throw Error.format(Sys.Res.formatBadFormatSpecifier);
3097 }
3098 var regex = /n|\$|-|%/g;
3099 var ret = "";
3100 for (;;) {
3101 var index = regex.lastIndex;
3102 var ar = regex.exec(pattern);
3103 ret += pattern.slice(index, ar ? ar.index : pattern.length);
3104 if (!ar)
3105 break;
3106 switch (ar[0]) {
3107 case "n":
3108 ret += number;
3109 break;
3110 case "$":
3111 ret += nf.CurrencySymbol;
3112 break;
3113 case "-":
3114 if (/[1-9]/.test(number)) {
3115 ret += nf.NegativeSign;
3116 }
3117 break;
3118 case "%":
3119 ret += nf.PercentSymbol;
3120 break;
3121 default:
3122 Sys.Debug.fail("Invalid number format pattern");
3123 }
3124 }
3125 return ret;
3126 }
3127
3128 Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) {
3129 /// <summary locid="M:J#Sys.CultureInfo.#ctor" />
3130 /// <param name="name" type="String"></param>
3131 /// <param name="numberFormat" type="Object"></param>
3132 /// <param name="dateTimeFormat" type="Object"></param>
3133 var e = Function._validateParams(arguments, [
3134 {name: "name", type: String},
3135 {name: "numberFormat", type: Object},
3136 {name: "dateTimeFormat", type: Object}
3137 ]);
3138 if (e) throw e;
3139 this.name = name;
3140 this.numberFormat = numberFormat;
3141 this.dateTimeFormat = dateTimeFormat;
3142 }
3143 function Sys$CultureInfo$_getDateTimeFormats() {
3144 if (! this._dateTimeFormats) {
3145 var dtf = this.dateTimeFormat;
3146 this._dateTimeFormats =
3147 [ dtf.MonthDayPattern,
3148 dtf.YearMonthPattern,
3149 dtf.ShortDatePattern,
3150 dtf.ShortTimePattern,
3151 dtf.LongDatePattern,
3152 dtf.LongTimePattern,
3153 dtf.FullDateTimePattern,
3154 dtf.RFC1123Pattern,
3155 dtf.SortableDateTimePattern,
3156 dtf.UniversalSortableDateTimePattern ];
3157 }
3158 return this._dateTimeFormats;
3159 }
3160 function Sys$CultureInfo$_getIndex(value, a1, a2) {
3161 var upper = this._toUpper(value),
3162 i = Array.indexOf(a1, upper);
3163 if (i === -1) {
3164 i = Array.indexOf(a2, upper);
3165 }
3166 return i;
3167 }
3168 function Sys$CultureInfo$_getMonthIndex(value) {
3169 if (!this._upperMonths) {
3170 this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames);
3171 this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames);
3172 }
3173 return this._getIndex(value, this._upperMonths, this._upperMonthsGenitive);
3174 }
3175 function Sys$CultureInfo$_getAbbrMonthIndex(value) {
3176 if (!this._upperAbbrMonths) {
3177 this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
3178 this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames);
3179 }
3180 return this._getIndex(value, this._upperAbbrMonths, this._upperAbbrMonthsGenitive);
3181 }
3182 function Sys$CultureInfo$_getDayIndex(value) {
3183 if (!this._upperDays) {
3184 this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames);
3185 }
3186 return Array.indexOf(this._upperDays, this._toUpper(value));
3187 }
3188 function Sys$CultureInfo$_getAbbrDayIndex(value) {
3189 if (!this._upperAbbrDays) {
3190 this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);
3191 }
3192 return Array.indexOf(this._upperAbbrDays, this._toUpper(value));
3193 }
3194 function Sys$CultureInfo$_toUpperArray(arr) {
3195 var result = [];
3196 for (var i = 0, il = arr.length; i < il; i++) {
3197 result[i] = this._toUpper(arr[i]);
3198 }
3199 return result;
3200 }
3201 function Sys$CultureInfo$_toUpper(value) {
3202 return value.split("\u00A0").join(' ').toUpperCase();
3203 }
3204 Sys.CultureInfo.prototype = {
3205 _getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats,
3206 _getIndex: Sys$CultureInfo$_getIndex,
3207 _getMonthIndex: Sys$CultureInfo$_getMonthIndex,
3208 _getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex,
3209 _getDayIndex: Sys$CultureInfo$_getDayIndex,
3210 _getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex,
3211 _toUpperArray: Sys$CultureInfo$_toUpperArray,
3212 _toUpper: Sys$CultureInfo$_toUpper
3213 }
3214 Sys.CultureInfo.registerClass('Sys.CultureInfo');
3215 Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) {
3216 var dtf = value.dateTimeFormat;
3217 if (dtf && !dtf.eras) {
3218 dtf.eras = value.eras;
3219 }
3220 return new Sys.CultureInfo(value.name, value.numberFormat, dtf);
3221 }
3222 Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
3223 if (typeof(__cultureInfo) === "object") {
3224 Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo);
3225 delete __cultureInfo;
3226 }
3227 else {
3228 Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
3229 }
3230 Type.registerNamespace('Sys.Serialization');
3231 Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() {
3232 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.#ctor" />
3233 if (arguments.length !== 0) throw Error.parameterCount();
3234 }
3235 Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer');
3236 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = [];
3237 Sys.Serialization.JavaScriptSerializer._charsToEscape = [];
3238 Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g');
3239 Sys.Serialization.JavaScriptSerializer._escapeChars = {};
3240 Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i');
3241 Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g');
3242 Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g');
3243 Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g');
3244 Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type';
3245 Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() {
3246 var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007',
3247 '\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011',
3248 '\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019',
3249 '\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f'];
3250 Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\';
3251 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g');
3252 Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\';
3253 Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"';
3254 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g');
3255 Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"';
3256 for (var i = 0; i < 32; i++) {
3257 var c = String.fromCharCode(i);
3258 Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c;
3259 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g');
3260 Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i];
3261 }
3262 }
3263 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) {
3264 stringBuilder.append(object.toString());
3265 }
3266 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) {
3267 if (isFinite(object)) {
3268 stringBuilder.append(String(object));
3269 }
3270 else {
3271 throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
3272 }
3273 }
3274 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) {
3275 stringBuilder.append('"');
3276 if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) {
3277 if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) {
3278 Sys.Serialization.JavaScriptSerializer._init();
3279 }
3280 if (string.length < 128) {
3281 string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,
3282 function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; });
3283 }
3284 else {
3285 for (var i = 0; i < 34; i++) {
3286 var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i];
3287 if (string.indexOf(c) !== -1) {
3288 if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) {
3289 string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
3290 }
3291 else {
3292 string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c],
3293 Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
3294 }
3295 }
3296 }
3297 }
3298 }
3299 stringBuilder.append(string);
3300 stringBuilder.append('"');
3301 }
3302 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) {
3303 var i;
3304 switch (typeof object) {
3305 case 'object':
3306 if (object) {
3307 if (prevObjects){
3308 for( var j = 0; j < prevObjects.length; j++) {
3309 if (prevObjects[j] === object) {
3310 throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle);
3311 }
3312 }
3313 }
3314 else {
3315 prevObjects = new Array();
3316 }
3317 try {
3318 Array.add(prevObjects, object);
3319
3320 if (Number.isInstanceOfType(object)){
3321 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
3322 }
3323 else if (Boolean.isInstanceOfType(object)){
3324 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
3325 }
3326 else if (String.isInstanceOfType(object)){
3327 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
3328 }
3329
3330 else if (Array.isInstanceOfType(object)) {
3331 stringBuilder.append('[');
3332
3333 for (i = 0; i < object.length; ++i) {
3334 if (i > 0) {
3335 stringBuilder.append(',');
3336 }
3337 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects);
3338 }
3339 stringBuilder.append(']');
3340 }
3341 else {
3342 if (Date.isInstanceOfType(object)) {
3343 stringBuilder.append('"\\/Date(');
3344 stringBuilder.append(object.getTime());
3345 stringBuilder.append(')\\/"');
3346 break;
3347 }
3348 var properties = [];
3349 var propertyCount = 0;
3350 for (var name in object) {
3351 if (name.startsWith('$')) {
3352 continue;
3353 }
3354 if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){
3355 properties[propertyCount++] = properties[0];
3356 properties[0] = name;
3357 }
3358 else{
3359 properties[propertyCount++] = name;
3360 }
3361 }
3362 if (sort) properties.sort();
3363 stringBuilder.append('{');
3364 var needComma = false;
3365
3366 for (i=0; i<propertyCount; i++) {
3367 var value = object[properties[i]];
3368 if (typeof value !== 'undefined' && typeof value !== 'function') {
3369 if (needComma) {
3370 stringBuilder.append(',');
3371 }
3372 else {
3373 needComma = true;
3374 }
3375
3376 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(properties[i], stringBuilder, sort, prevObjects);
3377 stringBuilder.append(':');
3378 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(value, stringBuilder, sort, prevObjects);
3379
3380 }
3381 }
3382 stringBuilder.append('}');
3383 }
3384 }
3385 finally {
3386 Array.removeAt(prevObjects, prevObjects.length - 1);
3387 }
3388 }
3389 else {
3390 stringBuilder.append('null');
3391 }
3392 break;
3393 case 'number':
3394 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
3395 break;
3396 case 'string':
3397 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
3398 break;
3399 case 'boolean':
3400 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
3401 break;
3402 default:
3403 stringBuilder.append('null');
3404 break;
3405 }
3406 }
3407 Sys.Serialization.JavaScriptSerializer.serialize = function Sys$Serialization$JavaScriptSerializer$serialize(object) {
3408 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.serialize" />
3409 /// <param name="object" mayBeNull="true"></param>
3410 /// <returns type="String"></returns>
3411 var e = Function._validateParams(arguments, [
3412 {name: "object", mayBeNull: true}
3413 ]);
3414 if (e) throw e;
3415 var stringBuilder = new Sys.StringBuilder();
3416 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false);
3417 return stringBuilder.toString();
3418 }
3419 Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) {
3420 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.deserialize" />
3421 /// <param name="data" type="String"></param>
3422 /// <param name="secure" type="Boolean" optional="true"></param>
3423 /// <returns></returns>
3424 var e = Function._validateParams(arguments, [
3425 {name: "data", type: String},
3426 {name: "secure", type: Boolean, optional: true}
3427 ]);
3428 if (e) throw e;
3429
3430 if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString);
3431 try {
3432 var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)");
3433
3434 if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(
3435 exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null;
3436 return eval('(' + exp + ')');
3437 }
3438 catch (e) {
3439 throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
3440 }
3441 }
3442 Type.registerNamespace('Sys.UI');
3443
3444 Sys.EventHandlerList = function Sys$EventHandlerList() {
3445 /// <summary locid="M:J#Sys.EventHandlerList.#ctor" />
3446 if (arguments.length !== 0) throw Error.parameterCount();
3447 this._list = {};
3448 }
3449 function Sys$EventHandlerList$_addHandler(id, handler) {
3450 Array.add(this._getEvent(id, true), handler);
3451 }
3452 function Sys$EventHandlerList$addHandler(id, handler) {
3453 /// <summary locid="M:J#Sys.EventHandlerList.addHandler" />
3454 /// <param name="id" type="String"></param>
3455 /// <param name="handler" type="Function"></param>
3456 var e = Function._validateParams(arguments, [
3457 {name: "id", type: String},
3458 {name: "handler", type: Function}
3459 ]);
3460 if (e) throw e;
3461 this._addHandler(id, handler);
3462 }
3463 function Sys$EventHandlerList$_removeHandler(id, handler) {
3464 var evt = this._getEvent(id);
3465 if (!evt) return;
3466 Array.remove(evt, handler);
3467 }
3468 function Sys$EventHandlerList$removeHandler(id, handler) {
3469 /// <summary locid="M:J#Sys.EventHandlerList.removeHandler" />
3470 /// <param name="id" type="String"></param>
3471 /// <param name="handler" type="Function"></param>
3472 var e = Function._validateParams(arguments, [
3473 {name: "id", type: String},
3474 {name: "handler", type: Function}
3475 ]);
3476 if (e) throw e;
3477 this._removeHandler(id, handler);
3478 }
3479 function Sys$EventHandlerList$getHandler(id) {
3480 /// <summary locid="M:J#Sys.EventHandlerList.getHandler" />
3481 /// <param name="id" type="String"></param>
3482 /// <returns type="Function"></returns>
3483 var e = Function._validateParams(arguments, [
3484 {name: "id", type: String}
3485 ]);
3486 if (e) throw e;
3487 var evt = this._getEvent(id);
3488 if (!evt || (evt.length === 0)) return null;
3489 evt = Array.clone(evt);
3490 return function(source, args) {
3491 for (var i = 0, l = evt.length; i < l; i++) {
3492 evt[i](source, args);
3493 }
3494 };
3495 }
3496 function Sys$EventHandlerList$_getEvent(id, create) {
3497 if (!this._list[id]) {
3498 if (!create) return null;
3499 this._list[id] = [];
3500 }
3501 return this._list[id];
3502 }
3503 Sys.EventHandlerList.prototype = {
3504 _addHandler: Sys$EventHandlerList$_addHandler,
3505 addHandler: Sys$EventHandlerList$addHandler,
3506 _removeHandler: Sys$EventHandlerList$_removeHandler,
3507 removeHandler: Sys$EventHandlerList$removeHandler,
3508 getHandler: Sys$EventHandlerList$getHandler,
3509 _getEvent: Sys$EventHandlerList$_getEvent
3510 }
3511 Sys.EventHandlerList.registerClass('Sys.EventHandlerList');
3512 Sys.CommandEventArgs = function Sys$CommandEventArgs(commandName, commandArgument, commandSource) {
3513 /// <summary locid="M:J#Sys.CommandEventArgs.#ctor" />
3514 /// <param name="commandName" type="String"></param>
3515 /// <param name="commandArgument" mayBeNull="true"></param>
3516 /// <param name="commandSource" mayBeNull="true"></param>
3517 var e = Function._validateParams(arguments, [
3518 {name: "commandName", type: String},
3519 {name: "commandArgument", mayBeNull: true},
3520 {name: "commandSource", mayBeNull: true}
3521 ]);
3522 if (e) throw e;
3523 Sys.CommandEventArgs.initializeBase(this);
3524 this._commandName = commandName;
3525 this._commandArgument = commandArgument;
3526 this._commandSource = commandSource;
3527 }
3528 function Sys$CommandEventArgs$get_commandName() {
3529 /// <value type="String" locid="P:J#Sys.CommandEventArgs.commandName"></value>
3530 if (arguments.length !== 0) throw Error.parameterCount();
3531 return this._commandName;
3532 }
3533 function Sys$CommandEventArgs$get_commandArgument() {
3534 /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandArgument"></value>
3535 if (arguments.length !== 0) throw Error.parameterCount();
3536 return this._commandArgument;
3537 }
3538 function Sys$CommandEventArgs$get_commandSource() {
3539 /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandSource"></value>
3540 if (arguments.length !== 0) throw Error.parameterCount();
3541 return this._commandSource;
3542 }
3543 Sys.CommandEventArgs.prototype = {
3544 _commandName: null,
3545 _commandArgument: null,
3546 _commandSource: null,
3547 get_commandName: Sys$CommandEventArgs$get_commandName,
3548 get_commandArgument: Sys$CommandEventArgs$get_commandArgument,
3549 get_commandSource: Sys$CommandEventArgs$get_commandSource
3550 }
3551 Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs);
3552
3553 Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() {
3554 /// <summary locid="M:J#Sys.INotifyPropertyChange.#ctor" />
3555 if (arguments.length !== 0) throw Error.parameterCount();
3556 throw Error.notImplemented();
3557 }
3558 function Sys$INotifyPropertyChange$add_propertyChanged(handler) {
3559 /// <summary locid="E:J#Sys.INotifyPropertyChange.propertyChanged" />
3560 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3561 if (e) throw e;
3562 throw Error.notImplemented();
3563 }
3564 function Sys$INotifyPropertyChange$remove_propertyChanged(handler) {
3565 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3566 if (e) throw e;
3567 throw Error.notImplemented();
3568 }
3569 Sys.INotifyPropertyChange.prototype = {
3570 add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged,
3571 remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged
3572 }
3573 Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange');
3574
3575 Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) {
3576 /// <summary locid="M:J#Sys.PropertyChangedEventArgs.#ctor" />
3577 /// <param name="propertyName" type="String"></param>
3578 var e = Function._validateParams(arguments, [
3579 {name: "propertyName", type: String}
3580 ]);
3581 if (e) throw e;
3582 Sys.PropertyChangedEventArgs.initializeBase(this);
3583 this._propertyName = propertyName;
3584 }
3585
3586 function Sys$PropertyChangedEventArgs$get_propertyName() {
3587 /// <value type="String" locid="P:J#Sys.PropertyChangedEventArgs.propertyName"></value>
3588 if (arguments.length !== 0) throw Error.parameterCount();
3589 return this._propertyName;
3590 }
3591 Sys.PropertyChangedEventArgs.prototype = {
3592 get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName
3593 }
3594 Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
3595
3596 Sys.INotifyDisposing = function Sys$INotifyDisposing() {
3597 /// <summary locid="M:J#Sys.INotifyDisposing.#ctor" />
3598 if (arguments.length !== 0) throw Error.parameterCount();
3599 throw Error.notImplemented();
3600 }
3601 function Sys$INotifyDisposing$add_disposing(handler) {
3602 /// <summary locid="E:J#Sys.INotifyDisposing.disposing" />
3603 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3604 if (e) throw e;
3605 throw Error.notImplemented();
3606 }
3607 function Sys$INotifyDisposing$remove_disposing(handler) {
3608 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3609 if (e) throw e;
3610 throw Error.notImplemented();
3611 }
3612 Sys.INotifyDisposing.prototype = {
3613 add_disposing: Sys$INotifyDisposing$add_disposing,
3614 remove_disposing: Sys$INotifyDisposing$remove_disposing
3615 }
3616 Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");
3617
3618 Sys.Component = function Sys$Component() {
3619 /// <summary locid="M:J#Sys.Component.#ctor" />
3620 if (arguments.length !== 0) throw Error.parameterCount();
3621 if (Sys.Application) Sys.Application.registerDisposableObject(this);
3622 }
3623 function Sys$Component$get_events() {
3624 /// <value type="Sys.EventHandlerList" locid="P:J#Sys.Component.events"></value>
3625 if (arguments.length !== 0) throw Error.parameterCount();
3626 if (!this._events) {
3627 this._events = new Sys.EventHandlerList();
3628 }
3629 return this._events;
3630 }
3631 function Sys$Component$get_id() {
3632 /// <value type="String" locid="P:J#Sys.Component.id"></value>
3633 if (arguments.length !== 0) throw Error.parameterCount();
3634 return this._id;
3635 }
3636 function Sys$Component$set_id(value) {
3637 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
3638 if (e) throw e;
3639 if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice);
3640 this._idSet = true;
3641 var oldId = this.get_id();
3642 if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp);
3643 this._id = value;
3644 }
3645 function Sys$Component$get_isInitialized() {
3646 /// <value type="Boolean" locid="P:J#Sys.Component.isInitialized"></value>
3647 if (arguments.length !== 0) throw Error.parameterCount();
3648 return this._initialized;
3649 }
3650 function Sys$Component$get_isUpdating() {
3651 /// <value type="Boolean" locid="P:J#Sys.Component.isUpdating"></value>
3652 if (arguments.length !== 0) throw Error.parameterCount();
3653 return this._updating;
3654 }
3655 function Sys$Component$add_disposing(handler) {
3656 /// <summary locid="E:J#Sys.Component.disposing" />
3657 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3658 if (e) throw e;
3659 this.get_events().addHandler("disposing", handler);
3660 }
3661 function Sys$Component$remove_disposing(handler) {
3662 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3663 if (e) throw e;
3664 this.get_events().removeHandler("disposing", handler);
3665 }
3666 function Sys$Component$add_propertyChanged(handler) {
3667 /// <summary locid="E:J#Sys.Component.propertyChanged" />
3668 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3669 if (e) throw e;
3670 this.get_events().addHandler("propertyChanged", handler);
3671 }
3672 function Sys$Component$remove_propertyChanged(handler) {
3673 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
3674 if (e) throw e;
3675 this.get_events().removeHandler("propertyChanged", handler);
3676 }
3677 function Sys$Component$beginUpdate() {
3678 this._updating = true;
3679 }
3680 function Sys$Component$dispose() {
3681 if (this._events) {
3682 var handler = this._events.getHandler("disposing");
3683 if (handler) {
3684 handler(this, Sys.EventArgs.Empty);
3685 }
3686 }
3687 delete this._events;
3688 Sys.Application.unregisterDisposableObject(this);
3689 Sys.Application.removeComponent(this);
3690 }
3691 function Sys$Component$endUpdate() {
3692 this._updating = false;
3693 if (!this._initialized) this.initialize();
3694 this.updated();
3695 }
3696 function Sys$Component$initialize() {
3697 this._initialized = true;
3698 }
3699 function Sys$Component$raisePropertyChanged(propertyName) {
3700 /// <summary locid="M:J#Sys.Component.raisePropertyChanged" />
3701 /// <param name="propertyName" type="String"></param>
3702 var e = Function._validateParams(arguments, [
3703 {name: "propertyName", type: String}
3704 ]);
3705 if (e) throw e;
3706 if (!this._events) return;
3707 var handler = this._events.getHandler("propertyChanged");
3708 if (handler) {
3709 handler(this, new Sys.PropertyChangedEventArgs(propertyName));
3710 }
3711 }
3712 function Sys$Component$updated() {
3713 }
3714 Sys.Component.prototype = {
3715 _id: null,
3716 _idSet: false,
3717 _initialized: false,
3718 _updating: false,
3719 get_events: Sys$Component$get_events,
3720 get_id: Sys$Component$get_id,
3721 set_id: Sys$Component$set_id,
3722 get_isInitialized: Sys$Component$get_isInitialized,
3723 get_isUpdating: Sys$Component$get_isUpdating,
3724 add_disposing: Sys$Component$add_disposing,
3725 remove_disposing: Sys$Component$remove_disposing,
3726 add_propertyChanged: Sys$Component$add_propertyChanged,
3727 remove_propertyChanged: Sys$Component$remove_propertyChanged,
3728 beginUpdate: Sys$Component$beginUpdate,
3729 dispose: Sys$Component$dispose,
3730 endUpdate: Sys$Component$endUpdate,
3731 initialize: Sys$Component$initialize,
3732 raisePropertyChanged: Sys$Component$raisePropertyChanged,
3733 updated: Sys$Component$updated
3734 }
3735 Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing);
3736 function Sys$Component$_setProperties(target, properties) {
3737 /// <summary locid="M:J#Sys.Component._setProperties" />
3738 /// <param name="target"></param>
3739 /// <param name="properties"></param>
3740 var e = Function._validateParams(arguments, [
3741 {name: "target"},
3742 {name: "properties"}
3743 ]);
3744 if (e) throw e;
3745 var current;
3746 var targetType = Object.getType(target);
3747 var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
3748 var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating();
3749 if (isComponent) target.beginUpdate();
3750 for (var name in properties) {
3751 var val = properties[name];
3752 var getter = isObject ? null : target["get_" + name];
3753 if (isObject || typeof(getter) !== 'function') {
3754 var targetVal = target[name];
3755 if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
3756 if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
3757 target[name] = val;
3758 }
3759 else {
3760 Sys$Component$_setProperties(targetVal, val);
3761 }
3762 }
3763 else {
3764 var setter = target["set_" + name];
3765 if (typeof(setter) === 'function') {
3766 setter.apply(target, [val]);
3767 }
3768 else if (val instanceof Array) {
3769 current = getter.apply(target);
3770 if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
3771 for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) {
3772 current[j] = val[i];
3773 }
3774 }
3775 else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) {
3776 current = getter.apply(target);
3777 if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
3778 Sys$Component$_setProperties(current, val);
3779 }
3780 else {
3781 throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
3782 }
3783 }
3784 }
3785 if (isComponent) target.endUpdate();
3786 }
3787 function Sys$Component$_setReferences(component, references) {
3788 for (var name in references) {
3789 var setter = component["set_" + name];
3790 var reference = $find(references[name]);
3791 if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
3792 if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name]));
3793 setter.apply(component, [reference]);
3794 }
3795 }
3796 var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
3797 /// <summary locid="M:J#Sys.Component.create" />
3798 /// <param name="type" type="Type"></param>
3799 /// <param name="properties" optional="true" mayBeNull="true"></param>
3800 /// <param name="events" optional="true" mayBeNull="true"></param>
3801 /// <param name="references" optional="true" mayBeNull="true"></param>
3802 /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
3803 /// <returns type="Sys.UI.Component"></returns>
3804 var e = Function._validateParams(arguments, [
3805 {name: "type", type: Type},
3806 {name: "properties", mayBeNull: true, optional: true},
3807 {name: "events", mayBeNull: true, optional: true},
3808 {name: "references", mayBeNull: true, optional: true},
3809 {name: "element", mayBeNull: true, domElement: true, optional: true}
3810 ]);
3811 if (e) throw e;
3812 if (!type.inheritsFrom(Sys.Component)) {
3813 throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
3814 }
3815 if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
3816 if (!element) throw Error.argument('element', Sys.Res.createNoDom);
3817 }
3818 else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom);
3819 var component = (element ? new type(element): new type());
3820 var app = Sys.Application;
3821 var creatingComponents = app.get_isCreatingComponents();
3822 component.beginUpdate();
3823 if (properties) {
3824 Sys$Component$_setProperties(component, properties);
3825 }
3826 if (events) {
3827 for (var name in events) {
3828 if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
3829 if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
3830 component["add_" + name](events[name]);
3831 }
3832 }
3833 if (component.get_id()) {
3834 app.addComponent(component);
3835 }
3836 if (creatingComponents) {
3837 app._createdComponents[app._createdComponents.length] = component;
3838 if (references) {
3839 app._addComponentToSecondPass(component, references);
3840 }
3841 else {
3842 component.endUpdate();
3843 }
3844 }
3845 else {
3846 if (references) {
3847 Sys$Component$_setReferences(component, references);
3848 }
3849 component.endUpdate();
3850 }
3851 return component;
3852 }
3853
3854 Sys.UI.MouseButton = function Sys$UI$MouseButton() {
3855 /// <summary locid="M:J#Sys.UI.MouseButton.#ctor" />
3856 /// <field name="leftButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.leftButton"></field>
3857 /// <field name="middleButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.middleButton"></field>
3858 /// <field name="rightButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.rightButton"></field>
3859 if (arguments.length !== 0) throw Error.parameterCount();
3860 throw Error.notImplemented();
3861 }
3862 Sys.UI.MouseButton.prototype = {
3863 leftButton: 0,
3864 middleButton: 1,
3865 rightButton: 2
3866 }
3867 Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");
3868
3869 Sys.UI.Key = function Sys$UI$Key() {
3870 /// <summary locid="M:J#Sys.UI.Key.#ctor" />
3871 /// <field name="backspace" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.backspace"></field>
3872 /// <field name="tab" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.tab"></field>
3873 /// <field name="enter" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.enter"></field>
3874 /// <field name="esc" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.esc"></field>
3875 /// <field name="space" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.space"></field>
3876 /// <field name="pageUp" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageUp"></field>
3877 /// <field name="pageDown" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageDown"></field>
3878 /// <field name="end" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.end"></field>
3879 /// <field name="home" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.home"></field>
3880 /// <field name="left" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.left"></field>
3881 /// <field name="up" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.up"></field>
3882 /// <field name="right" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.right"></field>
3883 /// <field name="down" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.down"></field>
3884 /// <field name="del" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.del"></field>
3885 if (arguments.length !== 0) throw Error.parameterCount();
3886 throw Error.notImplemented();
3887 }
3888 Sys.UI.Key.prototype = {
3889 backspace: 8,
3890 tab: 9,
3891 enter: 13,
3892 esc: 27,
3893 space: 32,
3894 pageUp: 33,
3895 pageDown: 34,
3896 end: 35,
3897 home: 36,
3898 left: 37,
3899 up: 38,
3900 right: 39,
3901 down: 40,
3902 del: 127
3903 }
3904 Sys.UI.Key.registerEnum("Sys.UI.Key");
3905
3906 Sys.UI.Point = function Sys$UI$Point(x, y) {
3907 /// <summary locid="M:J#Sys.UI.Point.#ctor" />
3908 /// <param name="x" type="Number" integer="true"></param>
3909 /// <param name="y" type="Number" integer="true"></param>
3910 /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
3911 /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
3912 var e = Function._validateParams(arguments, [
3913 {name: "x", type: Number, integer: true},
3914 {name: "y", type: Number, integer: true}
3915 ]);
3916 if (e) throw e;
3917 this.x = x;
3918 this.y = y;
3919 }
3920 Sys.UI.Point.registerClass('Sys.UI.Point');
3921
3922 Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) {
3923 /// <summary locid="M:J#Sys.UI.Bounds.#ctor" />
3924 /// <param name="x" type="Number" integer="true"></param>
3925 /// <param name="y" type="Number" integer="true"></param>
3926 /// <param name="width" type="Number" integer="true"></param>
3927 /// <param name="height" type="Number" integer="true"></param>
3928 /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.x"></field>
3929 /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.y"></field>
3930 /// <field name="width" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.width"></field>
3931 /// <field name="height" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.height"></field>
3932 var e = Function._validateParams(arguments, [
3933 {name: "x", type: Number, integer: true},
3934 {name: "y", type: Number, integer: true},
3935 {name: "width", type: Number, integer: true},
3936 {name: "height", type: Number, integer: true}
3937 ]);
3938 if (e) throw e;
3939 this.x = x;
3940 this.y = y;
3941 this.height = height;
3942 this.width = width;
3943 }
3944 Sys.UI.Bounds.registerClass('Sys.UI.Bounds');
3945
3946 Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) {
3947 /// <summary locid="M:J#Sys.UI.DomEvent.#ctor" />
3948 /// <param name="eventObject"></param>
3949 /// <field name="altKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.altKey"></field>
3950 /// <field name="button" type="Sys.UI.MouseButton" locid="F:J#Sys.UI.DomEvent.button"></field>
3951 /// <field name="charCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.charCode"></field>
3952 /// <field name="clientX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientX"></field>
3953 /// <field name="clientY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientY"></field>
3954 /// <field name="ctrlKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.ctrlKey"></field>
3955 /// <field name="keyCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.keyCode"></field>
3956 /// <field name="offsetX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetX"></field>
3957 /// <field name="offsetY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetY"></field>
3958 /// <field name="screenX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenX"></field>
3959 /// <field name="screenY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenY"></field>
3960 /// <field name="shiftKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.shiftKey"></field>
3961 /// <field name="target" locid="F:J#Sys.UI.DomEvent.target"></field>
3962 /// <field name="type" type="String" locid="F:J#Sys.UI.DomEvent.type"></field>
3963 var e = Function._validateParams(arguments, [
3964 {name: "eventObject"}
3965 ]);
3966 if (e) throw e;
3967 var ev = eventObject;
3968 var etype = this.type = ev.type.toLowerCase();
3969 this.rawEvent = ev;
3970 this.altKey = ev.altKey;
3971 if (typeof(ev.button) !== 'undefined') {
3972 this.button = (typeof(ev.which) !== 'undefined') ? ev.button :
3973 (ev.button === 4) ? Sys.UI.MouseButton.middleButton :
3974 (ev.button === 2) ? Sys.UI.MouseButton.rightButton :
3975 Sys.UI.MouseButton.leftButton;
3976 }
3977 if (etype === 'keypress') {
3978 this.charCode = ev.charCode || ev.keyCode;
3979 }
3980 else if (ev.keyCode && (ev.keyCode === 46)) {
3981 this.keyCode = 127;
3982 }
3983 else {
3984 this.keyCode = ev.keyCode;
3985 }
3986 this.clientX = ev.clientX;
3987 this.clientY = ev.clientY;
3988 this.ctrlKey = ev.ctrlKey;
3989 this.target = ev.target ? ev.target : ev.srcElement;
3990 if (!etype.startsWith('key')) {
3991 if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !== 'undefined')) {
3992 this.offsetX = ev.offsetX;
3993 this.offsetY = ev.offsetY;
3994 }
3995 else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX) === 'number')) {
3996 var loc = Sys.UI.DomElement.getLocation(this.target);
3997 var w = Sys.UI.DomElement._getWindow(this.target);
3998 this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x;
3999 this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y;
4000 }
4001 }
4002 this.screenX = ev.screenX;
4003 this.screenY = ev.screenY;
4004 this.shiftKey = ev.shiftKey;
4005 }
4006 function Sys$UI$DomEvent$preventDefault() {
4007 /// <summary locid="M:J#Sys.UI.DomEvent.preventDefault" />
4008 if (arguments.length !== 0) throw Error.parameterCount();
4009 if (this.rawEvent.preventDefault) {
4010 this.rawEvent.preventDefault();
4011 }
4012 else if (window.event) {
4013 this.rawEvent.returnValue = false;
4014 }
4015 }
4016 function Sys$UI$DomEvent$stopPropagation() {
4017 /// <summary locid="M:J#Sys.UI.DomEvent.stopPropagation" />
4018 if (arguments.length !== 0) throw Error.parameterCount();
4019 if (this.rawEvent.stopPropagation) {
4020 this.rawEvent.stopPropagation();
4021 }
4022 else if (window.event) {
4023 this.rawEvent.cancelBubble = true;
4024 }
4025 }
4026 Sys.UI.DomEvent.prototype = {
4027 preventDefault: Sys$UI$DomEvent$preventDefault,
4028 stopPropagation: Sys$UI$DomEvent$stopPropagation
4029 }
4030 Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent');
4031 var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler, autoRemove) {
4032 /// <summary locid="M:J#Sys.UI.DomEvent.addHandler" />
4033 /// <param name="element"></param>
4034 /// <param name="eventName" type="String"></param>
4035 /// <param name="handler" type="Function"></param>
4036 /// <param name="autoRemove" type="Boolean" optional="true"></param>
4037 var e = Function._validateParams(arguments, [
4038 {name: "element"},
4039 {name: "eventName", type: String},
4040 {name: "handler", type: Function},
4041 {name: "autoRemove", type: Boolean, optional: true}
4042 ]);
4043 if (e) throw e;
4044 Sys.UI.DomEvent._ensureDomNode(element);
4045 if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError);
4046 if (!element._events) {
4047 element._events = {};
4048 }
4049 var eventCache = element._events[eventName];
4050 if (!eventCache) {
4051 element._events[eventName] = eventCache = [];
4052 }
4053 var browserHandler;
4054 if (element.addEventListener) {
4055 browserHandler = function(e) {
4056 return handler.call(element, new Sys.UI.DomEvent(e));
4057 }
4058 element.addEventListener(eventName, browserHandler, false);
4059 }
4060 else if (element.attachEvent) {
4061 browserHandler = function() {
4062 var e = {};
4063 try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {}
4064 return handler.call(element, new Sys.UI.DomEvent(e));
4065 }
4066 element.attachEvent('on' + eventName, browserHandler);
4067 }
4068 eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler, autoRemove: autoRemove };
4069 if (autoRemove) {
4070 var d = element.dispose;
4071 if (d !== Sys.UI.DomEvent._disposeHandlers) {
4072 element.dispose = Sys.UI.DomEvent._disposeHandlers;
4073 if (typeof(d) !== "undefined") {
4074 element._chainDispose = d;
4075 }
4076 }
4077 }
4078 }
4079 var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner, autoRemove) {
4080 /// <summary locid="M:J#Sys.UI.DomEvent.addHandlers" />
4081 /// <param name="element"></param>
4082 /// <param name="events" type="Object"></param>
4083 /// <param name="handlerOwner" optional="true"></param>
4084 /// <param name="autoRemove" type="Boolean" optional="true"></param>
4085 var e = Function._validateParams(arguments, [
4086 {name: "element"},
4087 {name: "events", type: Object},
4088 {name: "handlerOwner", optional: true},
4089 {name: "autoRemove", type: Boolean, optional: true}
4090 ]);
4091 if (e) throw e;
4092 Sys.UI.DomEvent._ensureDomNode(element);
4093 for (var name in events) {
4094 var handler = events[name];
4095 if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);
4096 if (handlerOwner) {
4097 handler = Function.createDelegate(handlerOwner, handler);
4098 }
4099 $addHandler(element, name, handler, autoRemove || false);
4100 }
4101 }
4102 var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) {
4103 /// <summary locid="M:J#Sys.UI.DomEvent.clearHandlers" />
4104 /// <param name="element"></param>
4105 var e = Function._validateParams(arguments, [
4106 {name: "element"}
4107 ]);
4108 if (e) throw e;
4109 Sys.UI.DomEvent._ensureDomNode(element);
4110 Sys.UI.DomEvent._clearHandlers(element, false);
4111 }
4112 Sys.UI.DomEvent._clearHandlers = function Sys$UI$DomEvent$_clearHandlers(element, autoRemoving) {
4113 if (element._events) {
4114 var cache = element._events;
4115 for (var name in cache) {
4116 var handlers = cache[name];
4117 for (var i = handlers.length - 1; i >= 0; i--) {
4118 var entry = handlers[i];
4119 if (!autoRemoving || entry.autoRemove) {
4120 $removeHandler(element, name, entry.handler);
4121 }
4122 }
4123 }
4124 element._events = null;
4125 }
4126 }
4127 Sys.UI.DomEvent._disposeHandlers = function Sys$UI$DomEvent$_disposeHandlers() {
4128 Sys.UI.DomEvent._clearHandlers(this, true);
4129 var d = this._chainDispose, type = typeof(d);
4130 if (type !== "undefined") {
4131 this.dispose = d;
4132 this._chainDispose = null;
4133 if (type === "function") {
4134 this.dispose();
4135 }
4136 }
4137 }
4138 var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {
4139 /// <summary locid="M:J#Sys.UI.DomEvent.removeHandler" />
4140 /// <param name="element"></param>
4141 /// <param name="eventName" type="String"></param>
4142 /// <param name="handler" type="Function"></param>
4143 var e = Function._validateParams(arguments, [
4144 {name: "element"},
4145 {name: "eventName", type: String},
4146 {name: "handler", type: Function}
4147 ]);
4148 if (e) throw e;
4149 Sys.UI.DomEvent._removeHandler(element, eventName, handler);
4150 }
4151 Sys.UI.DomEvent._removeHandler = function Sys$UI$DomEvent$_removeHandler(element, eventName, handler) {
4152 Sys.UI.DomEvent._ensureDomNode(element);
4153 var browserHandler = null;
4154 if ((typeof(element._events) !== 'object') || !element._events) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
4155 var cache = element._events[eventName];
4156 if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
4157 for (var i = 0, l = cache.length; i < l; i++) {
4158 if (cache[i].handler === handler) {
4159 browserHandler = cache[i].browserHandler;
4160 break;
4161 }
4162 }
4163 if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
4164 if (element.removeEventListener) {
4165 element.removeEventListener(eventName, browserHandler, false);
4166 }
4167 else if (element.detachEvent) {
4168 element.detachEvent('on' + eventName, browserHandler);
4169 }
4170 cache.splice(i, 1);
4171 }
4172 Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) {
4173 if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;
4174
4175 var doc = element.ownerDocument || element.document || element;
4176 if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) {
4177 throw Error.argument("element", Sys.Res.argumentDomNode);
4178 }
4179 }
4180
4181 Sys.UI.DomElement = function Sys$UI$DomElement() {
4182 /// <summary locid="M:J#Sys.UI.DomElement.#ctor" />
4183 if (arguments.length !== 0) throw Error.parameterCount();
4184 throw Error.notImplemented();
4185 }
4186 Sys.UI.DomElement.registerClass('Sys.UI.DomElement');
4187 Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) {
4188 /// <summary locid="M:J#Sys.UI.DomElement.addCssClass" />
4189 /// <param name="element" domElement="true"></param>
4190 /// <param name="className" type="String"></param>
4191 var e = Function._validateParams(arguments, [
4192 {name: "element", domElement: true},
4193 {name: "className", type: String}
4194 ]);
4195 if (e) throw e;
4196 if (!Sys.UI.DomElement.containsCssClass(element, className)) {
4197 if (element.className === '') {
4198 element.className = className;
4199 }
4200 else {
4201 element.className += ' ' + className;
4202 }
4203 }
4204 }
4205 Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) {
4206 /// <summary locid="M:J#Sys.UI.DomElement.containsCssClass" />
4207 /// <param name="element" domElement="true"></param>
4208 /// <param name="className" type="String"></param>
4209 /// <returns type="Boolean"></returns>
4210 var e = Function._validateParams(arguments, [
4211 {name: "element", domElement: true},
4212 {name: "className", type: String}
4213 ]);
4214 if (e) throw e;
4215 return Array.contains(element.className.split(' '), className);
4216 }
4217 Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) {
4218 /// <summary locid="M:J#Sys.UI.DomElement.getBounds" />
4219 /// <param name="element" domElement="true"></param>
4220 /// <returns type="Sys.UI.Bounds"></returns>
4221 var e = Function._validateParams(arguments, [
4222 {name: "element", domElement: true}
4223 ]);
4224 if (e) throw e;
4225 var offset = Sys.UI.DomElement.getLocation(element);
4226 return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);
4227 }
4228 var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
4229 /// <summary locid="M:J#Sys.UI.DomElement.getElementById" />
4230 /// <param name="id" type="String"></param>
4231 /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
4232 /// <returns domElement="true" mayBeNull="true"></returns>
4233 var e = Function._validateParams(arguments, [
4234 {name: "id", type: String},
4235 {name: "element", mayBeNull: true, domElement: true, optional: true}
4236 ]);
4237 if (e) throw e;
4238 if (!element) return document.getElementById(id);
4239 if (element.getElementById) return element.getElementById(id);
4240 var nodeQueue = [];
4241 var childNodes = element.childNodes;
4242 for (var i = 0; i < childNodes.length; i++) {
4243 var node = childNodes[i];
4244 if (node.nodeType == 1) {
4245 nodeQueue[nodeQueue.length] = node;
4246 }
4247 }
4248 while (nodeQueue.length) {
4249 node = nodeQueue.shift();
4250 if (node.id == id) {
4251 return node;
4252 }
4253 childNodes = node.childNodes;
4254 for (i = 0; i < childNodes.length; i++) {
4255 node = childNodes[i];
4256 if (node.nodeType == 1) {
4257 nodeQueue[nodeQueue.length] = node;
4258 }
4259 }
4260 }
4261 return null;
4262 }
4263 if (document.documentElement.getBoundingClientRect) {
4264 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
4265 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
4266 /// <param name="element" domElement="true"></param>
4267 /// <returns type="Sys.UI.Point"></returns>
4268 var e = Function._validateParams(arguments, [
4269 {name: "element", domElement: true}
4270 ]);
4271 if (e) throw e;
4272 if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
4273 var clientRect = element.getBoundingClientRect();
4274 if (!clientRect) {
4275 return new Sys.UI.Point(0,0);
4276 }
4277 var documentElement = element.ownerDocument.documentElement,
4278 offsetX = Math.floor(clientRect.left + 0.5) + documentElement.scrollLeft,
4279 offsetY = Math.floor(clientRect.top + 0.5) + documentElement.scrollTop;
4280 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
4281 try {
4282 var f = element.ownerDocument.parentWindow.frameElement || null;
4283 if (f) {
4284 var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0;
4285 offsetX += offset;
4286 offsetY += offset;
4287 }
4288 }
4289 catch(ex) {
4290 }
4291 if (Sys.Browser.version <= 7) {
4292
4293 var multiplier, before, rect, d = document.createElement("div");
4294 d.style.cssText = "position:absolute !important;left:0px !important;right:0px !important;height:0px !important;width:1px !important;display:hidden !important";
4295 try {
4296 before = document.body.childNodes[0];
4297 document.body.insertBefore(d, before);
4298 rect = d.getBoundingClientRect();
4299 document.body.removeChild(d);
4300 multiplier = (rect.right - rect.left);
4301 }
4302 catch (e) {
4303 }
4304 if (multiplier && (multiplier !== 1)) {
4305 offsetX = Math.floor(offsetX / multiplier);
4306 offsetY = Math.floor(offsetY / multiplier);
4307 }
4308 }
4309 if ((document.documentMode || 0) < 8) {
4310 offsetX -= 2;
4311 offsetY -= 2;
4312 }
4313 }
4314 return new Sys.UI.Point(offsetX, offsetY);
4315 }
4316 }
4317 else if (Sys.Browser.agent === Sys.Browser.Safari) {
4318 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
4319 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
4320 /// <param name="element" domElement="true"></param>
4321 /// <returns type="Sys.UI.Point"></returns>
4322 var e = Function._validateParams(arguments, [
4323 {name: "element", domElement: true}
4324 ]);
4325 if (e) throw e;
4326 if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
4327 var offsetX = 0, offsetY = 0,
4328 parent,
4329 previous = null,
4330 previousStyle = null,
4331 currentStyle;
4332 for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
4333 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
4334 var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
4335 if ((parent.offsetLeft || parent.offsetTop) &&
4336 ((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) {
4337 offsetX += parent.offsetLeft;
4338 offsetY += parent.offsetTop;
4339 }
4340 if (previous && Sys.Browser.version >= 3) {
4341 offsetX += parseInt(currentStyle.borderLeftWidth);
4342 offsetY += parseInt(currentStyle.borderTopWidth);
4343 }
4344 }
4345 currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
4346 var elementPosition = currentStyle ? currentStyle.position : null;
4347 if (!elementPosition || (elementPosition !== "absolute")) {
4348 for (parent = element.parentNode; parent; parent = parent.parentNode) {
4349 tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
4350 if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
4351 offsetX -= (parent.scrollLeft || 0);
4352 offsetY -= (parent.scrollTop || 0);
4353 }
4354 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
4355 var parentPosition = currentStyle ? currentStyle.position : null;
4356 if (parentPosition && (parentPosition === "absolute")) break;
4357 }
4358 }
4359 return new Sys.UI.Point(offsetX, offsetY);
4360 }
4361 }
4362 else {
4363 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
4364 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
4365 /// <param name="element" domElement="true"></param>
4366 /// <returns type="Sys.UI.Point"></returns>
4367 var e = Function._validateParams(arguments, [
4368 {name: "element", domElement: true}
4369 ]);
4370 if (e) throw e;
4371 if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
4372 var offsetX = 0, offsetY = 0,
4373 parent,
4374 previous = null,
4375 previousStyle = null,
4376 currentStyle = null;
4377 for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
4378 var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
4379 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
4380 if ((parent.offsetLeft || parent.offsetTop) &&
4381 !((tagName === "BODY") &&
4382 (!previousStyle || previousStyle.position !== "absolute"))) {
4383 offsetX += parent.offsetLeft;
4384 offsetY += parent.offsetTop;
4385 }
4386 if (previous !== null && currentStyle) {
4387 if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) {
4388 offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
4389 offsetY += parseInt(currentStyle.borderTopWidth) || 0;
4390 }
4391 if (tagName === "TABLE" &&
4392 (currentStyle.position === "relative" || currentStyle.position === "absolute")) {
4393 offsetX += parseInt(currentStyle.marginLeft) || 0;
4394 offsetY += parseInt(currentStyle.marginTop) || 0;
4395 }
4396 }
4397 }
4398 currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
4399 var elementPosition = currentStyle ? currentStyle.position : null;
4400 if (!elementPosition || (elementPosition !== "absolute")) {
4401 for (parent = element.parentNode; parent; parent = parent.parentNode) {
4402 tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
4403 if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
4404 offsetX -= (parent.scrollLeft || 0);
4405 offsetY -= (parent.scrollTop || 0);
4406 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
4407 if (currentStyle) {
4408 offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
4409 offsetY += parseInt(currentStyle.borderTopWidth) || 0;
4410 }
4411 }
4412 }
4413 }
4414 return new Sys.UI.Point(offsetX, offsetY);
4415 }
4416 }
4417 Sys.UI.DomElement.isDomElement = function Sys$UI$DomElement$isDomElement(obj) {
4418 /// <summary locid="M:J#Sys.UI.DomElement.isDomElement" />
4419 /// <param name="obj"></param>
4420 /// <returns type="Boolean"></returns>
4421 var e = Function._validateParams(arguments, [
4422 {name: "obj"}
4423 ]);
4424 if (e) throw e;
4425 return Sys._isDomElement(obj);
4426 }
4427 Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) {
4428 /// <summary locid="M:J#Sys.UI.DomElement.removeCssClass" />
4429 /// <param name="element" domElement="true"></param>
4430 /// <param name="className" type="String"></param>
4431 var e = Function._validateParams(arguments, [
4432 {name: "element", domElement: true},
4433 {name: "className", type: String}
4434 ]);
4435 if (e) throw e;
4436 var currentClassName = ' ' + element.className + ' ';
4437 var index = currentClassName.indexOf(' ' + className + ' ');
4438 if (index >= 0) {
4439 element.className = (currentClassName.substr(0, index) + ' ' +
4440 currentClassName.substring(index + className.length + 1, currentClassName.length)).trim();
4441 }
4442 }
4443 Sys.UI.DomElement.resolveElement = function Sys$UI$DomElement$resolveElement(elementOrElementId, containerElement) {
4444 /// <summary locid="M:J#Sys.UI.DomElement.resolveElement" />
4445 /// <param name="elementOrElementId" mayBeNull="true"></param>
4446 /// <param name="containerElement" domElement="true" optional="true" mayBeNull="true"></param>
4447 /// <returns domElement="true"></returns>
4448 var e = Function._validateParams(arguments, [
4449 {name: "elementOrElementId", mayBeNull: true},
4450 {name: "containerElement", mayBeNull: true, domElement: true, optional: true}
4451 ]);
4452 if (e) throw e;
4453 var el = elementOrElementId;
4454 if (!el) return null;
4455 if (typeof(el) === "string") {
4456 el = Sys.UI.DomElement.getElementById(el, containerElement);
4457 if (!el) {
4458 throw Error.argument("elementOrElementId", String.format(Sys.Res.elementNotFound, elementOrElementId));
4459 }
4460 }
4461 else if(!Sys.UI.DomElement.isDomElement(el)) {
4462 throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId);
4463 }
4464 return el;
4465 }
4466 Sys.UI.DomElement.raiseBubbleEvent = function Sys$UI$DomElement$raiseBubbleEvent(source, args) {
4467 /// <summary locid="M:J#Sys.UI.DomElement.raiseBubbleEvent" />
4468 /// <param name="source" domElement="true"></param>
4469 /// <param name="args" type="Sys.EventArgs"></param>
4470 var e = Function._validateParams(arguments, [
4471 {name: "source", domElement: true},
4472 {name: "args", type: Sys.EventArgs}
4473 ]);
4474 if (e) throw e;
4475 var target = source;
4476 while (target) {
4477 var control = target.control;
4478 if (control && control.onBubbleEvent && control.raiseBubbleEvent) {
4479 Sys.UI.DomElement._raiseBubbleEventFromControl(control, source, args);
4480 return;
4481 }
4482 target = target.parentNode;
4483 }
4484 }
4485 Sys.UI.DomElement._raiseBubbleEventFromControl = function Sys$UI$DomElement$_raiseBubbleEventFromControl(control, source, args) {
4486 if (!control.onBubbleEvent(source, args)) {
4487 control._raiseBubbleEvent(source, args);
4488 }
4489 }
4490 Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) {
4491 /// <summary locid="M:J#Sys.UI.DomElement.setLocation" />
4492 /// <param name="element" domElement="true"></param>
4493 /// <param name="x" type="Number" integer="true"></param>
4494 /// <param name="y" type="Number" integer="true"></param>
4495 var e = Function._validateParams(arguments, [
4496 {name: "element", domElement: true},
4497 {name: "x", type: Number, integer: true},
4498 {name: "y", type: Number, integer: true}
4499 ]);
4500 if (e) throw e;
4501 var style = element.style;
4502 style.position = 'absolute';
4503 style.left = x + "px";
4504 style.top = y + "px";
4505 }
4506 Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) {
4507 /// <summary locid="M:J#Sys.UI.DomElement.toggleCssClass" />
4508 /// <param name="element" domElement="true"></param>
4509 /// <param name="className" type="String"></param>
4510 var e = Function._validateParams(arguments, [
4511 {name: "element", domElement: true},
4512 {name: "className", type: String}
4513 ]);
4514 if (e) throw e;
4515 if (Sys.UI.DomElement.containsCssClass(element, className)) {
4516 Sys.UI.DomElement.removeCssClass(element, className);
4517 }
4518 else {
4519 Sys.UI.DomElement.addCssClass(element, className);
4520 }
4521 }
4522 Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) {
4523 /// <summary locid="M:J#Sys.UI.DomElement.getVisibilityMode" />
4524 /// <param name="element" domElement="true"></param>
4525 /// <returns type="Sys.UI.VisibilityMode"></returns>
4526 var e = Function._validateParams(arguments, [
4527 {name: "element", domElement: true}
4528 ]);
4529 if (e) throw e;
4530 return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ?
4531 Sys.UI.VisibilityMode.hide :
4532 Sys.UI.VisibilityMode.collapse;
4533 }
4534 Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) {
4535 /// <summary locid="M:J#Sys.UI.DomElement.setVisibilityMode" />
4536 /// <param name="element" domElement="true"></param>
4537 /// <param name="value" type="Sys.UI.VisibilityMode"></param>
4538 var e = Function._validateParams(arguments, [
4539 {name: "element", domElement: true},
4540 {name: "value", type: Sys.UI.VisibilityMode}
4541 ]);
4542 if (e) throw e;
4543 Sys.UI.DomElement._ensureOldDisplayMode(element);
4544 if (element._visibilityMode !== value) {
4545 element._visibilityMode = value;
4546 if (Sys.UI.DomElement.getVisible(element) === false) {
4547 if (element._visibilityMode === Sys.UI.VisibilityMode.hide) {
4548 element.style.display = element._oldDisplayMode;
4549 }
4550 else {
4551 element.style.display = 'none';
4552 }
4553 }
4554 element._visibilityMode = value;
4555 }
4556 }
4557 Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {
4558 /// <summary locid="M:J#Sys.UI.DomElement.getVisible" />
4559 /// <param name="element" domElement="true"></param>
4560 /// <returns type="Boolean"></returns>
4561 var e = Function._validateParams(arguments, [
4562 {name: "element", domElement: true}
4563 ]);
4564 if (e) throw e;
4565 var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
4566 if (!style) return true;
4567 return (style.visibility !== 'hidden') && (style.display !== 'none');
4568 }
4569 Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) {
4570 /// <summary locid="M:J#Sys.UI.DomElement.setVisible" />
4571 /// <param name="element" domElement="true"></param>
4572 /// <param name="value" type="Boolean"></param>
4573 var e = Function._validateParams(arguments, [
4574 {name: "element", domElement: true},
4575 {name: "value", type: Boolean}
4576 ]);
4577 if (e) throw e;
4578 if (value !== Sys.UI.DomElement.getVisible(element)) {
4579 Sys.UI.DomElement._ensureOldDisplayMode(element);
4580 element.style.visibility = value ? 'visible' : 'hidden';
4581 if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) {
4582 element.style.display = element._oldDisplayMode;
4583 }
4584 else {
4585 element.style.display = 'none';
4586 }
4587 }
4588 }
4589 Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) {
4590 if (!element._oldDisplayMode) {
4591 var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
4592 element._oldDisplayMode = style ? style.display : null;
4593 if (!element._oldDisplayMode || element._oldDisplayMode === 'none') {
4594 switch(element.tagName.toUpperCase()) {
4595 case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL':
4596 case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM':
4597 case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR':
4598 case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD':
4599 case 'TH': case 'TR': case 'UL':
4600 element._oldDisplayMode = 'block';
4601 break;
4602 case 'LI':
4603 element._oldDisplayMode = 'list-item';
4604 break;
4605 default:
4606 element._oldDisplayMode = 'inline';
4607 }
4608 }
4609 }
4610 }
4611 Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) {
4612 var doc = element.ownerDocument || element.document || element;
4613 return doc.defaultView || doc.parentWindow;
4614 }
4615 Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) {
4616 if (element.nodeType === 3) return null;
4617 var w = Sys.UI.DomElement._getWindow(element);
4618 if (element.documentElement) element = element.documentElement;
4619 var computedStyle = (w && (element !== w) && w.getComputedStyle) ?
4620 w.getComputedStyle(element, null) :
4621 element.currentStyle || element.style;
4622 if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) {
4623 var oldDisplay = element.style.display;
4624 var oldPosition = element.style.position;
4625 element.style.position = 'absolute';
4626 element.style.display = 'block';
4627 var style = w.getComputedStyle(element, null);
4628 element.style.display = oldDisplay;
4629 element.style.position = oldPosition;
4630 computedStyle = {};
4631 for (var n in style) {
4632 computedStyle[n] = style[n];
4633 }
4634 computedStyle.display = 'none';
4635 }
4636 return computedStyle;
4637 }
4638
4639 Sys.IContainer = function Sys$IContainer() {
4640 throw Error.notImplemented();
4641 }
4642 function Sys$IContainer$addComponent(component) {
4643 /// <summary locid="M:J#Sys.IContainer.addComponent" />
4644 /// <param name="component" type="Sys.Component"></param>
4645 var e = Function._validateParams(arguments, [
4646 {name: "component", type: Sys.Component}
4647 ]);
4648 if (e) throw e;
4649 throw Error.notImplemented();
4650 }
4651 function Sys$IContainer$removeComponent(component) {
4652 /// <summary locid="M:J#Sys.IContainer.removeComponent" />
4653 /// <param name="component" type="Sys.Component"></param>
4654 var e = Function._validateParams(arguments, [
4655 {name: "component", type: Sys.Component}
4656 ]);
4657 if (e) throw e;
4658 throw Error.notImplemented();
4659 }
4660 function Sys$IContainer$findComponent(id) {
4661 /// <summary locid="M:J#Sys.IContainer.findComponent" />
4662 /// <param name="id" type="String"></param>
4663 /// <returns type="Sys.Component"></returns>
4664 var e = Function._validateParams(arguments, [
4665 {name: "id", type: String}
4666 ]);
4667 if (e) throw e;
4668 throw Error.notImplemented();
4669 }
4670 function Sys$IContainer$getComponents() {
4671 /// <summary locid="M:J#Sys.IContainer.getComponents" />
4672 /// <returns type="Array" elementType="Sys.Component"></returns>
4673 if (arguments.length !== 0) throw Error.parameterCount();
4674 throw Error.notImplemented();
4675 }
4676 Sys.IContainer.prototype = {
4677 addComponent: Sys$IContainer$addComponent,
4678 removeComponent: Sys$IContainer$removeComponent,
4679 findComponent: Sys$IContainer$findComponent,
4680 getComponents: Sys$IContainer$getComponents
4681 }
4682 Sys.IContainer.registerInterface("Sys.IContainer");
4683
4684 Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) {
4685 /// <summary locid="M:J#Sys.ApplicationLoadEventArgs.#ctor" />
4686 /// <param name="components" type="Array" elementType="Sys.Component"></param>
4687 /// <param name="isPartialLoad" type="Boolean"></param>
4688 var e = Function._validateParams(arguments, [
4689 {name: "components", type: Array, elementType: Sys.Component},
4690 {name: "isPartialLoad", type: Boolean}
4691 ]);
4692 if (e) throw e;
4693 Sys.ApplicationLoadEventArgs.initializeBase(this);
4694 this._components = components;
4695 this._isPartialLoad = isPartialLoad;
4696 }
4697
4698 function Sys$ApplicationLoadEventArgs$get_components() {
4699 /// <value type="Array" elementType="Sys.Component" locid="P:J#Sys.ApplicationLoadEventArgs.components"></value>
4700 if (arguments.length !== 0) throw Error.parameterCount();
4701 return this._components;
4702 }
4703 function Sys$ApplicationLoadEventArgs$get_isPartialLoad() {
4704 /// <value type="Boolean" locid="P:J#Sys.ApplicationLoadEventArgs.isPartialLoad"></value>
4705 if (arguments.length !== 0) throw Error.parameterCount();
4706 return this._isPartialLoad;
4707 }
4708 Sys.ApplicationLoadEventArgs.prototype = {
4709 get_components: Sys$ApplicationLoadEventArgs$get_components,
4710 get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad
4711 }
4712 Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
4713
4714 Sys._Application = function Sys$_Application() {
4715 /// <summary locid="M:J#Sys.Application.#ctor" />
4716 if (arguments.length !== 0) throw Error.parameterCount();
4717 Sys._Application.initializeBase(this);
4718 this._disposableObjects = [];
4719 this._components = {};
4720 this._createdComponents = [];
4721 this._secondPassComponents = [];
4722 this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler);
4723 Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
4724 this._domReady();
4725 }
4726 function Sys$_Application$get_isCreatingComponents() {
4727 /// <value type="Boolean" locid="P:J#Sys.Application.isCreatingComponents"></value>
4728 if (arguments.length !== 0) throw Error.parameterCount();
4729 return this._creatingComponents;
4730 }
4731 function Sys$_Application$get_isDisposing() {
4732 /// <value type="Boolean" locid="P:J#Sys.Application.isDisposing"></value>
4733 if (arguments.length !== 0) throw Error.parameterCount();
4734 return this._disposing;
4735 }
4736 function Sys$_Application$add_init(handler) {
4737 /// <summary locid="E:J#Sys.Application.init" />
4738 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4739 if (e) throw e;
4740 if (this._initialized) {
4741 handler(this, Sys.EventArgs.Empty);
4742 }
4743 else {
4744 this.get_events().addHandler("init", handler);
4745 }
4746 }
4747 function Sys$_Application$remove_init(handler) {
4748 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4749 if (e) throw e;
4750 this.get_events().removeHandler("init", handler);
4751 }
4752 function Sys$_Application$add_load(handler) {
4753 /// <summary locid="E:J#Sys.Application.load" />
4754 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4755 if (e) throw e;
4756 this.get_events().addHandler("load", handler);
4757 }
4758 function Sys$_Application$remove_load(handler) {
4759 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4760 if (e) throw e;
4761 this.get_events().removeHandler("load", handler);
4762 }
4763 function Sys$_Application$add_unload(handler) {
4764 /// <summary locid="E:J#Sys.Application.unload" />
4765 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4766 if (e) throw e;
4767 this.get_events().addHandler("unload", handler);
4768 }
4769 function Sys$_Application$remove_unload(handler) {
4770 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
4771 if (e) throw e;
4772 this.get_events().removeHandler("unload", handler);
4773 }
4774 function Sys$_Application$addComponent(component) {
4775 /// <summary locid="M:J#Sys.Application.addComponent" />
4776 /// <param name="component" type="Sys.Component"></param>
4777 var e = Function._validateParams(arguments, [
4778 {name: "component", type: Sys.Component}
4779 ]);
4780 if (e) throw e;
4781 var id = component.get_id();
4782 if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId);
4783 if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id));
4784 this._components[id] = component;
4785 }
4786 function Sys$_Application$beginCreateComponents() {
4787 /// <summary locid="M:J#Sys.Application.beginCreateComponents" />
4788 if (arguments.length !== 0) throw Error.parameterCount();
4789 this._creatingComponents = true;
4790 }
4791 function Sys$_Application$dispose() {
4792 /// <summary locid="M:J#Sys.Application.dispose" />
4793 if (arguments.length !== 0) throw Error.parameterCount();
4794 if (!this._disposing) {
4795 this._disposing = true;
4796 if (this._timerCookie) {
4797 window.clearTimeout(this._timerCookie);
4798 delete this._timerCookie;
4799 }
4800 if (this._endRequestHandler) {
4801 Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
4802 delete this._endRequestHandler;
4803 }
4804 if (this._beginRequestHandler) {
4805 Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);
4806 delete this._beginRequestHandler;
4807 }
4808 if (window.pageUnload) {
4809 window.pageUnload(this, Sys.EventArgs.Empty);
4810 }
4811 var unloadHandler = this.get_events().getHandler("unload");
4812 if (unloadHandler) {
4813 unloadHandler(this, Sys.EventArgs.Empty);
4814 }
4815 var disposableObjects = Array.clone(this._disposableObjects);
4816 for (var i = 0, l = disposableObjects.length; i < l; i++) {
4817 var object = disposableObjects[i];
4818 if (typeof(object) !== "undefined") {
4819 object.dispose();
4820 }
4821 }
4822 Array.clear(this._disposableObjects);
4823 Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate);
4824 if (Sys._ScriptLoader) {
4825 var sl = Sys._ScriptLoader.getInstance();
4826 if(sl) {
4827 sl.dispose();
4828 }
4829 }
4830 Sys._Application.callBaseMethod(this, 'dispose');
4831 }
4832 }
4833 function Sys$_Application$disposeElement(element, childNodesOnly) {
4834 /// <summary locid="M:J#Sys._Application.disposeElement" />
4835 /// <param name="element"></param>
4836 /// <param name="childNodesOnly" type="Boolean"></param>
4837 var e = Function._validateParams(arguments, [
4838 {name: "element"},
4839 {name: "childNodesOnly", type: Boolean}
4840 ]);
4841 if (e) throw e;
4842 if (element.nodeType === 1) {
4843 var children = element.getElementsByTagName("*");
4844 for (var i = children.length - 1; i >= 0; i--) {
4845 this._disposeElementInternal(children[i]);
4846 }
4847 if (!childNodesOnly) {
4848 this._disposeElementInternal(element);
4849 }
4850 }
4851 }
4852 function Sys$_Application$endCreateComponents() {
4853 /// <summary locid="M:J#Sys.Application.endCreateComponents" />
4854 if (arguments.length !== 0) throw Error.parameterCount();
4855 var components = this._secondPassComponents;
4856 for (var i = 0, l = components.length; i < l; i++) {
4857 var component = components[i].component;
4858 Sys$Component$_setReferences(component, components[i].references);
4859 component.endUpdate();
4860 }
4861 this._secondPassComponents = [];
4862 this._creatingComponents = false;
4863 }
4864 function Sys$_Application$findComponent(id, parent) {
4865 /// <summary locid="M:J#Sys.Application.findComponent" />
4866 /// <param name="id" type="String"></param>
4867 /// <param name="parent" optional="true" mayBeNull="true"></param>
4868 /// <returns type="Sys.Component" mayBeNull="true"></returns>
4869 var e = Function._validateParams(arguments, [
4870 {name: "id", type: String},
4871 {name: "parent", mayBeNull: true, optional: true}
4872 ]);
4873 if (e) throw e;
4874 return (parent ?
4875 ((Sys.IContainer.isInstanceOfType(parent)) ?
4876 parent.findComponent(id) :
4877 parent[id] || null) :
4878 Sys.Application._components[id] || null);
4879 }
4880 function Sys$_Application$getComponents() {
4881 /// <summary locid="M:J#Sys.Application.getComponents" />
4882 /// <returns type="Array" elementType="Sys.Component"></returns>
4883 if (arguments.length !== 0) throw Error.parameterCount();
4884 var res = [];
4885 var components = this._components;
4886 for (var name in components) {
4887 res[res.length] = components[name];
4888 }
4889 return res;
4890 }
4891 function Sys$_Application$initialize() {
4892 /// <summary locid="M:J#Sys.Application.initialize" />
4893 if (arguments.length !== 0) throw Error.parameterCount();
4894 if(!this.get_isInitialized() && !this._disposing) {
4895 Sys._Application.callBaseMethod(this, 'initialize');
4896 this._raiseInit();
4897 if (this.get_stateString) {
4898 if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
4899 this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest);
4900 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);
4901 this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest);
4902 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
4903 }
4904 var loadedEntry = this.get_stateString();
4905 if (loadedEntry !== this._currentEntry) {
4906 this._navigate(loadedEntry);
4907 }
4908 else {
4909 this._ensureHistory();
4910 }
4911 }
4912 this.raiseLoad();
4913 }
4914 }
4915 function Sys$_Application$notifyScriptLoaded() {
4916 /// <summary locid="M:J#Sys.Application.notifyScriptLoaded" />
4917 if (arguments.length !== 0) throw Error.parameterCount();
4918 }
4919 function Sys$_Application$registerDisposableObject(object) {
4920 /// <summary locid="M:J#Sys.Application.registerDisposableObject" />
4921 /// <param name="object" type="Sys.IDisposable"></param>
4922 var e = Function._validateParams(arguments, [
4923 {name: "object", type: Sys.IDisposable}
4924 ]);
4925 if (e) throw e;
4926 if (!this._disposing) {
4927 var objects = this._disposableObjects,
4928 i = objects.length;
4929 objects[i] = object;
4930 object.__msdisposeindex = i;
4931 }
4932 }
4933 function Sys$_Application$raiseLoad() {
4934 /// <summary locid="M:J#Sys.Application.raiseLoad" />
4935 if (arguments.length !== 0) throw Error.parameterCount();
4936 var h = this.get_events().getHandler("load");
4937 var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded);
4938 this._loaded = true;
4939 if (h) {
4940 h(this, args);
4941 }
4942 if (window.pageLoad) {
4943 window.pageLoad(this, args);
4944 }
4945 this._createdComponents = [];
4946 }
4947 function Sys$_Application$removeComponent(component) {
4948 /// <summary locid="M:J#Sys.Application.removeComponent" />
4949 /// <param name="component" type="Sys.Component"></param>
4950 var e = Function._validateParams(arguments, [
4951 {name: "component", type: Sys.Component}
4952 ]);
4953 if (e) throw e;
4954 var id = component.get_id();
4955 if (id) delete this._components[id];
4956 }
4957 function Sys$_Application$unregisterDisposableObject(object) {
4958 /// <summary locid="M:J#Sys.Application.unregisterDisposableObject" />
4959 /// <param name="object" type="Sys.IDisposable"></param>
4960 var e = Function._validateParams(arguments, [
4961 {name: "object", type: Sys.IDisposable}
4962 ]);
4963 if (e) throw e;
4964 if (!this._disposing) {
4965 var i = object.__msdisposeindex;
4966 if (typeof(i) === "number") {
4967 var disposableObjects = this._disposableObjects;
4968 delete disposableObjects[i];
4969 delete object.__msdisposeindex;
4970 if (++this._deleteCount > 1000) {
4971 var newArray = [];
4972 for (var j = 0, l = disposableObjects.length; j < l; j++) {
4973 object = disposableObjects[j];
4974 if (typeof(object) !== "undefined") {
4975 object.__msdisposeindex = newArray.length;
4976 newArray.push(object);
4977 }
4978 }
4979 this._disposableObjects = newArray;
4980 this._deleteCount = 0;
4981 }
4982 }
4983 }
4984 }
4985 function Sys$_Application$_addComponentToSecondPass(component, references) {
4986 this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references};
4987 }
4988 function Sys$_Application$_disposeComponents(list) {
4989 if (list) {
4990 for (var i = list.length - 1; i >= 0; i--) {
4991 var item = list[i];
4992 if (typeof(item.dispose) === "function") {
4993 item.dispose();
4994 }
4995 }
4996 }
4997 }
4998 function Sys$_Application$_disposeElementInternal(element) {
4999 var d = element.dispose;
5000 if (d && typeof(d) === "function") {
5001 element.dispose();
5002 }
5003 else {
5004 var c = element.control;
5005 if (c && typeof(c.dispose) === "function") {
5006 c.dispose();
5007 }
5008 }
5009 var list = element._behaviors;
5010 if (list) {
5011 this._disposeComponents(list);
5012 }
5013 list = element._components;
5014 if (list) {
5015 this._disposeComponents(list);
5016 element._components = null;
5017 }
5018 }
5019 function Sys$_Application$_domReady() {
5020 var check, er, app = this;
5021 function init() { app.initialize(); }
5022 var onload = function() {
5023 Sys.UI.DomEvent.removeHandler(window, "load", onload);
5024 init();
5025 }
5026 Sys.UI.DomEvent.addHandler(window, "load", onload);
5027
5028 if (document.addEventListener) {
5029 try {
5030 document.addEventListener("DOMContentLoaded", check = function() {
5031 document.removeEventListener("DOMContentLoaded", check, false);
5032 init();
5033 }, false);
5034 }
5035 catch (er) { }
5036 }
5037 else if (document.attachEvent) {
5038 if ((window == window.top) && document.documentElement.doScroll) {
5039 var timeout, el = document.createElement("div");
5040 check = function() {
5041 try {
5042 el.doScroll("left");
5043 }
5044 catch (er) {
5045 timeout = window.setTimeout(check, 0);
5046 return;
5047 }
5048 el = null;
5049 init();
5050 }
5051 check();
5052 }
5053 else {
5054 document.attachEvent("onreadystatechange", check = function() {
5055 if (document.readyState === "complete") {
5056 document.detachEvent("onreadystatechange", check);
5057 init();
5058 }
5059 });
5060 }
5061 }
5062 }
5063 function Sys$_Application$_raiseInit() {
5064 var handler = this.get_events().getHandler("init");
5065 if (handler) {
5066 this.beginCreateComponents();
5067 handler(this, Sys.EventArgs.Empty);
5068 this.endCreateComponents();
5069 }
5070 }
5071 function Sys$_Application$_unloadHandler(event) {
5072 this.dispose();
5073 }
5074 Sys._Application.prototype = {
5075 _creatingComponents: false,
5076 _disposing: false,
5077 _deleteCount: 0,
5078 get_isCreatingComponents: Sys$_Application$get_isCreatingComponents,
5079 get_isDisposing: Sys$_Application$get_isDisposing,
5080 add_init: Sys$_Application$add_init,
5081 remove_init: Sys$_Application$remove_init,
5082 add_load: Sys$_Application$add_load,
5083 remove_load: Sys$_Application$remove_load,
5084 add_unload: Sys$_Application$add_unload,
5085 remove_unload: Sys$_Application$remove_unload,
5086 addComponent: Sys$_Application$addComponent,
5087 beginCreateComponents: Sys$_Application$beginCreateComponents,
5088 dispose: Sys$_Application$dispose,
5089 disposeElement: Sys$_Application$disposeElement,
5090 endCreateComponents: Sys$_Application$endCreateComponents,
5091 findComponent: Sys$_Application$findComponent,
5092 getComponents: Sys$_Application$getComponents,
5093 initialize: Sys$_Application$initialize,
5094 notifyScriptLoaded: Sys$_Application$notifyScriptLoaded,
5095 registerDisposableObject: Sys$_Application$registerDisposableObject,
5096 raiseLoad: Sys$_Application$raiseLoad,
5097 removeComponent: Sys$_Application$removeComponent,
5098 unregisterDisposableObject: Sys$_Application$unregisterDisposableObject,
5099 _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass,
5100 _disposeComponents: Sys$_Application$_disposeComponents,
5101 _disposeElementInternal: Sys$_Application$_disposeElementInternal,
5102 _domReady: Sys$_Application$_domReady,
5103 _raiseInit: Sys$_Application$_raiseInit,
5104 _unloadHandler: Sys$_Application$_unloadHandler
5105 }
5106 Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer);
5107 Sys.Application = new Sys._Application();
5108 var $find = Sys.Application.findComponent;
5109
5110 Sys.UI.Behavior = function Sys$UI$Behavior(element) {
5111 /// <summary locid="M:J#Sys.UI.Behavior.#ctor" />
5112 /// <param name="element" domElement="true"></param>
5113 var e = Function._validateParams(arguments, [
5114 {name: "element", domElement: true}
5115 ]);
5116 if (e) throw e;
5117 Sys.UI.Behavior.initializeBase(this);
5118 this._element = element;
5119 var behaviors = element._behaviors;
5120 if (!behaviors) {
5121 element._behaviors = [this];
5122 }
5123 else {
5124 behaviors[behaviors.length] = this;
5125 }
5126 }
5127 function Sys$UI$Behavior$get_element() {
5128 /// <value domElement="true" locid="P:J#Sys.UI.Behavior.element"></value>
5129 if (arguments.length !== 0) throw Error.parameterCount();
5130 return this._element;
5131 }
5132 function Sys$UI$Behavior$get_id() {
5133 /// <value type="String" locid="P:J#Sys.UI.Behavior.id"></value>
5134 if (arguments.length !== 0) throw Error.parameterCount();
5135 var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
5136 if (baseId) return baseId;
5137 if (!this._element || !this._element.id) return '';
5138 return this._element.id + '$' + this.get_name();
5139 }
5140 function Sys$UI$Behavior$get_name() {
5141 /// <value type="String" locid="P:J#Sys.UI.Behavior.name"></value>
5142 if (arguments.length !== 0) throw Error.parameterCount();
5143 if (this._name) return this._name;
5144 var name = Object.getTypeName(this);
5145 var i = name.lastIndexOf('.');
5146 if (i !== -1) name = name.substr(i + 1);
5147 if (!this.get_isInitialized()) this._name = name;
5148 return name;
5149 }
5150 function Sys$UI$Behavior$set_name(value) {
5151 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
5152 if (e) throw e;
5153 if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' '))
5154 throw Error.argument('value', Sys.Res.invalidId);
5155 if (typeof(this._element[value]) !== 'undefined')
5156 throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value));
5157 if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit);
5158 this._name = value;
5159 }
5160 function Sys$UI$Behavior$initialize() {
5161 Sys.UI.Behavior.callBaseMethod(this, 'initialize');
5162 var name = this.get_name();
5163 if (name) this._element[name] = this;
5164 }
5165 function Sys$UI$Behavior$dispose() {
5166 Sys.UI.Behavior.callBaseMethod(this, 'dispose');
5167 var e = this._element;
5168 if (e) {
5169 var name = this.get_name();
5170 if (name) {
5171 e[name] = null;
5172 }
5173 var behaviors = e._behaviors;
5174 Array.remove(behaviors, this);
5175 if (behaviors.length === 0) {
5176 e._behaviors = null;
5177 }
5178 delete this._element;
5179 }
5180 }
5181 Sys.UI.Behavior.prototype = {
5182 _name: null,
5183 get_element: Sys$UI$Behavior$get_element,
5184 get_id: Sys$UI$Behavior$get_id,
5185 get_name: Sys$UI$Behavior$get_name,
5186 set_name: Sys$UI$Behavior$set_name,
5187 initialize: Sys$UI$Behavior$initialize,
5188 dispose: Sys$UI$Behavior$dispose
5189 }
5190 Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component);
5191 Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) {
5192 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorByName" />
5193 /// <param name="element" domElement="true"></param>
5194 /// <param name="name" type="String"></param>
5195 /// <returns type="Sys.UI.Behavior" mayBeNull="true"></returns>
5196 var e = Function._validateParams(arguments, [
5197 {name: "element", domElement: true},
5198 {name: "name", type: String}
5199 ]);
5200 if (e) throw e;
5201 var b = element[name];
5202 return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
5203 }
5204 Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) {
5205 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviors" />
5206 /// <param name="element" domElement="true"></param>
5207 /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
5208 var e = Function._validateParams(arguments, [
5209 {name: "element", domElement: true}
5210 ]);
5211 if (e) throw e;
5212 if (!element._behaviors) return [];
5213 return Array.clone(element._behaviors);
5214 }
5215 Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) {
5216 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorsByType" />
5217 /// <param name="element" domElement="true"></param>
5218 /// <param name="type" type="Type"></param>
5219 /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
5220 var e = Function._validateParams(arguments, [
5221 {name: "element", domElement: true},
5222 {name: "type", type: Type}
5223 ]);
5224 if (e) throw e;
5225 var behaviors = element._behaviors;
5226 var results = [];
5227 if (behaviors) {
5228 for (var i = 0, l = behaviors.length; i < l; i++) {
5229 if (type.isInstanceOfType(behaviors[i])) {
5230 results[results.length] = behaviors[i];
5231 }
5232 }
5233 }
5234 return results;
5235 }
5236
5237 Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() {
5238 /// <summary locid="M:J#Sys.UI.VisibilityMode.#ctor" />
5239 /// <field name="hide" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.hide"></field>
5240 /// <field name="collapse" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.collapse"></field>
5241 if (arguments.length !== 0) throw Error.parameterCount();
5242 throw Error.notImplemented();
5243 }
5244 Sys.UI.VisibilityMode.prototype = {
5245 hide: 0,
5246 collapse: 1
5247 }
5248 Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");
5249
5250 Sys.UI.Control = function Sys$UI$Control(element) {
5251 /// <summary locid="M:J#Sys.UI.Control.#ctor" />
5252 /// <param name="element" domElement="true"></param>
5253 var e = Function._validateParams(arguments, [
5254 {name: "element", domElement: true}
5255 ]);
5256 if (e) throw e;
5257 if (typeof(element.control) !== 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
5258 Sys.UI.Control.initializeBase(this);
5259 this._element = element;
5260 element.control = this;
5261 var role = this.get_role();
5262 if (role) {
5263 element.setAttribute("role", role);
5264 }
5265 }
5266 function Sys$UI$Control$get_element() {
5267 /// <value domElement="true" locid="P:J#Sys.UI.Control.element"></value>
5268 if (arguments.length !== 0) throw Error.parameterCount();
5269 return this._element;
5270 }
5271 function Sys$UI$Control$get_id() {
5272 /// <value type="String" locid="P:J#Sys.UI.Control.id"></value>
5273 if (arguments.length !== 0) throw Error.parameterCount();
5274 if (!this._element) return '';
5275 return this._element.id;
5276 }
5277 function Sys$UI$Control$set_id(value) {
5278 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
5279 if (e) throw e;
5280 throw Error.invalidOperation(Sys.Res.cantSetId);
5281 }
5282 function Sys$UI$Control$get_parent() {
5283 /// <value type="Sys.UI.Control" locid="P:J#Sys.UI.Control.parent"></value>
5284 if (arguments.length !== 0) throw Error.parameterCount();
5285 if (this._parent) return this._parent;
5286 if (!this._element) return null;
5287
5288 var parentElement = this._element.parentNode;
5289 while (parentElement) {
5290 if (parentElement.control) {
5291 return parentElement.control;
5292 }
5293 parentElement = parentElement.parentNode;
5294 }
5295 return null;
5296 }
5297 function Sys$UI$Control$set_parent(value) {
5298 var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]);
5299 if (e) throw e;
5300 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5301 var parents = [this];
5302 var current = value;
5303 while (current) {
5304 if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain);
5305 parents[parents.length] = current;
5306 current = current.get_parent();
5307 }
5308 this._parent = value;
5309 }
5310 function Sys$UI$Control$get_role() {
5311 /// <value type="String" locid="P:J#Sys.UI.Control.role"></value>
5312 if (arguments.length !== 0) throw Error.parameterCount();
5313 return null;
5314 }
5315 function Sys$UI$Control$get_visibilityMode() {
5316 /// <value type="Sys.UI.VisibilityMode" locid="P:J#Sys.UI.Control.visibilityMode"></value>
5317 if (arguments.length !== 0) throw Error.parameterCount();
5318 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5319 return Sys.UI.DomElement.getVisibilityMode(this._element);
5320 }
5321 function Sys$UI$Control$set_visibilityMode(value) {
5322 var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]);
5323 if (e) throw e;
5324 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5325 Sys.UI.DomElement.setVisibilityMode(this._element, value);
5326 }
5327 function Sys$UI$Control$get_visible() {
5328 /// <value type="Boolean" locid="P:J#Sys.UI.Control.visible"></value>
5329 if (arguments.length !== 0) throw Error.parameterCount();
5330 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5331 return Sys.UI.DomElement.getVisible(this._element);
5332 }
5333 function Sys$UI$Control$set_visible(value) {
5334 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
5335 if (e) throw e;
5336 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5337 Sys.UI.DomElement.setVisible(this._element, value)
5338 }
5339 function Sys$UI$Control$addCssClass(className) {
5340 /// <summary locid="M:J#Sys.UI.Control.addCssClass" />
5341 /// <param name="className" type="String"></param>
5342 var e = Function._validateParams(arguments, [
5343 {name: "className", type: String}
5344 ]);
5345 if (e) throw e;
5346 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5347 Sys.UI.DomElement.addCssClass(this._element, className);
5348 }
5349 function Sys$UI$Control$dispose() {
5350 Sys.UI.Control.callBaseMethod(this, 'dispose');
5351 if (this._element) {
5352 this._element.control = null;
5353 delete this._element;
5354 }
5355 if (this._parent) delete this._parent;
5356 }
5357 function Sys$UI$Control$onBubbleEvent(source, args) {
5358 /// <summary locid="M:J#Sys.UI.Control.onBubbleEvent" />
5359 /// <param name="source"></param>
5360 /// <param name="args" type="Sys.EventArgs"></param>
5361 /// <returns type="Boolean"></returns>
5362 var e = Function._validateParams(arguments, [
5363 {name: "source"},
5364 {name: "args", type: Sys.EventArgs}
5365 ]);
5366 if (e) throw e;
5367 return false;
5368 }
5369 function Sys$UI$Control$raiseBubbleEvent(source, args) {
5370 /// <summary locid="M:J#Sys.UI.Control.raiseBubbleEvent" />
5371 /// <param name="source"></param>
5372 /// <param name="args" type="Sys.EventArgs"></param>
5373 var e = Function._validateParams(arguments, [
5374 {name: "source"},
5375 {name: "args", type: Sys.EventArgs}
5376 ]);
5377 if (e) throw e;
5378 this._raiseBubbleEvent(source, args);
5379 }
5380 function Sys$UI$Control$_raiseBubbleEvent(source, args) {
5381 var currentTarget = this.get_parent();
5382 while (currentTarget) {
5383 if (currentTarget.onBubbleEvent(source, args)) {
5384 return;
5385 }
5386 currentTarget = currentTarget.get_parent();
5387 }
5388 }
5389 function Sys$UI$Control$removeCssClass(className) {
5390 /// <summary locid="M:J#Sys.UI.Control.removeCssClass" />
5391 /// <param name="className" type="String"></param>
5392 var e = Function._validateParams(arguments, [
5393 {name: "className", type: String}
5394 ]);
5395 if (e) throw e;
5396 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5397 Sys.UI.DomElement.removeCssClass(this._element, className);
5398 }
5399 function Sys$UI$Control$toggleCssClass(className) {
5400 /// <summary locid="M:J#Sys.UI.Control.toggleCssClass" />
5401 /// <param name="className" type="String"></param>
5402 var e = Function._validateParams(arguments, [
5403 {name: "className", type: String}
5404 ]);
5405 if (e) throw e;
5406 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
5407 Sys.UI.DomElement.toggleCssClass(this._element, className);
5408 }
5409 Sys.UI.Control.prototype = {
5410 _parent: null,
5411 _visibilityMode: Sys.UI.VisibilityMode.hide,
5412 get_element: Sys$UI$Control$get_element,
5413 get_id: Sys$UI$Control$get_id,
5414 set_id: Sys$UI$Control$set_id,
5415 get_parent: Sys$UI$Control$get_parent,
5416 set_parent: Sys$UI$Control$set_parent,
5417 get_role: Sys$UI$Control$get_role,
5418 get_visibilityMode: Sys$UI$Control$get_visibilityMode,
5419 set_visibilityMode: Sys$UI$Control$set_visibilityMode,
5420 get_visible: Sys$UI$Control$get_visible,
5421 set_visible: Sys$UI$Control$set_visible,
5422 addCssClass: Sys$UI$Control$addCssClass,
5423 dispose: Sys$UI$Control$dispose,
5424 onBubbleEvent: Sys$UI$Control$onBubbleEvent,
5425 raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent,
5426 _raiseBubbleEvent: Sys$UI$Control$_raiseBubbleEvent,
5427 removeCssClass: Sys$UI$Control$removeCssClass,
5428 toggleCssClass: Sys$UI$Control$toggleCssClass
5429 }
5430 Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component);
5431 Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) {
5432 /// <summary locid="M:J#Sys.HistoryEventArgs.#ctor" />
5433 /// <param name="state" type="Object"></param>
5434 var e = Function._validateParams(arguments, [
5435 {name: "state", type: Object}
5436 ]);
5437 if (e) throw e;
5438 Sys.HistoryEventArgs.initializeBase(this);
5439 this._state = state;
5440 }
5441 function Sys$HistoryEventArgs$get_state() {
5442 /// <value type="Object" locid="P:J#Sys.HistoryEventArgs.state"></value>
5443 if (arguments.length !== 0) throw Error.parameterCount();
5444 return this._state;
5445 }
5446 Sys.HistoryEventArgs.prototype = {
5447 get_state: Sys$HistoryEventArgs$get_state
5448 }
5449 Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs);
5450 Sys.Application._appLoadHandler = null;
5451 Sys.Application._beginRequestHandler = null;
5452 Sys.Application._clientId = null;
5453 Sys.Application._currentEntry = '';
5454 Sys.Application._endRequestHandler = null;
5455 Sys.Application._history = null;
5456 Sys.Application._enableHistory = false;
5457 Sys.Application._historyEnabledInScriptManager = false;
5458 Sys.Application._historyFrame = null;
5459 Sys.Application._historyInitialized = false;
5460 Sys.Application._historyPointIsNew = false;
5461 Sys.Application._ignoreTimer = false;
5462 Sys.Application._initialState = null;
5463 Sys.Application._state = {};
5464 Sys.Application._timerCookie = 0;
5465 Sys.Application._timerHandler = null;
5466 Sys.Application._uniqueId = null;
5467 Sys._Application.prototype.get_stateString = function Sys$_Application$get_stateString() {
5468 /// <summary locid="M:J#Sys._Application.get_stateString" />
5469 if (arguments.length !== 0) throw Error.parameterCount();
5470 var hash = null;
5471
5472 if (Sys.Browser.agent === Sys.Browser.Firefox) {
5473 var href = window.location.href;
5474 var hashIndex = href.indexOf('#');
5475 if (hashIndex !== -1) {
5476 hash = href.substring(hashIndex + 1);
5477 }
5478 else {
5479 hash = "";
5480 }
5481 return hash;
5482 }
5483 else {
5484 hash = window.location.hash;
5485 }
5486
5487 if ((hash.length > 0) && (hash.charAt(0) === '#')) {
5488 hash = hash.substring(1);
5489 }
5490 return hash;
5491 };
5492 Sys._Application.prototype.get_enableHistory = function Sys$_Application$get_enableHistory() {
5493 /// <summary locid="M:J#Sys._Application.get_enableHistory" />
5494 if (arguments.length !== 0) throw Error.parameterCount();
5495 return this._enableHistory;
5496 };
5497 Sys._Application.prototype.set_enableHistory = function Sys$_Application$set_enableHistory(value) {
5498 if (this._initialized && !this._initializing) {
5499 throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory);
5500 }
5501 else if (this._historyEnabledInScriptManager && !value) {
5502 throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination);
5503 }
5504 this._enableHistory = value;
5505 };
5506 Sys._Application.prototype.add_navigate = function Sys$_Application$add_navigate(handler) {
5507 /// <summary locid="E:J#Sys.Application.navigate" />
5508 /// <param name="handler" type="Function"></param>
5509 var e = Function._validateParams(arguments, [
5510 {name: "handler", type: Function}
5511 ]);
5512 if (e) throw e;
5513 this.get_events().addHandler("navigate", handler);
5514 };
5515 Sys._Application.prototype.remove_navigate = function Sys$_Application$remove_navigate(handler) {
5516 /// <summary locid="M:J#Sys._Application.remove_navigate" />
5517 /// <param name="handler" type="Function"></param>
5518 var e = Function._validateParams(arguments, [
5519 {name: "handler", type: Function}
5520 ]);
5521 if (e) throw e;
5522 this.get_events().removeHandler("navigate", handler);
5523 };
5524 Sys._Application.prototype.addHistoryPoint = function Sys$_Application$addHistoryPoint(state, title) {
5525 /// <summary locid="M:J#Sys.Application.addHistoryPoint" />
5526 /// <param name="state" type="Object"></param>
5527 /// <param name="title" type="String" optional="true" mayBeNull="true"></param>
5528 var e = Function._validateParams(arguments, [
5529 {name: "state", type: Object},
5530 {name: "title", type: String, mayBeNull: true, optional: true}
5531 ]);
5532 if (e) throw e;
5533 if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled);
5534 for (var n in state) {
5535 var v = state[n];
5536 var t = typeof(v);
5537 if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) {
5538 throw Error.argument('state', Sys.Res.stateMustBeStringDictionary);
5539 }
5540 }
5541 this._ensureHistory();
5542 var initialState = this._state;
5543 for (var key in state) {
5544 var value = state[key];
5545 if (value === null) {
5546 if (typeof(initialState[key]) !== 'undefined') {
5547 delete initialState[key];
5548 }
5549 }
5550 else {
5551 initialState[key] = value;
5552 }
5553 }
5554 var entry = this._serializeState(initialState);
5555 this._historyPointIsNew = true;
5556 this._setState(entry, title);
5557 this._raiseNavigate();
5558 };
5559 Sys._Application.prototype.setServerId = function Sys$_Application$setServerId(clientId, uniqueId) {
5560 /// <summary locid="M:J#Sys.Application.setServerId" />
5561 /// <param name="clientId" type="String"></param>
5562 /// <param name="uniqueId" type="String"></param>
5563 var e = Function._validateParams(arguments, [
5564 {name: "clientId", type: String},
5565 {name: "uniqueId", type: String}
5566 ]);
5567 if (e) throw e;
5568 this._clientId = clientId;
5569 this._uniqueId = uniqueId;
5570 };
5571 Sys._Application.prototype.setServerState = function Sys$_Application$setServerState(value) {
5572 /// <summary locid="M:J#Sys.Application.setServerState" />
5573 /// <param name="value" type="String"></param>
5574 var e = Function._validateParams(arguments, [
5575 {name: "value", type: String}
5576 ]);
5577 if (e) throw e;
5578 this._ensureHistory();
5579 this._state.__s = value;
5580 this._updateHiddenField(value);
5581 };
5582 Sys._Application.prototype._deserializeState = function Sys$_Application$_deserializeState(entry) {
5583 var result = {};
5584 entry = entry || '';
5585 var serverSeparator = entry.indexOf('&&');
5586 if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) {
5587 result.__s = entry.substr(serverSeparator + 2);
5588 entry = entry.substr(0, serverSeparator);
5589 }
5590 var tokens = entry.split('&');
5591 for (var i = 0, l = tokens.length; i < l; i++) {
5592 var token = tokens[i];
5593 var equal = token.indexOf('=');
5594 if ((equal !== -1) && (equal + 1 < token.length)) {
5595 var name = token.substr(0, equal);
5596 var value = token.substr(equal + 1);
5597 result[name] = decodeURIComponent(value);
5598 }
5599 }
5600 return result;
5601 };
5602 Sys._Application.prototype._enableHistoryInScriptManager = function Sys$_Application$_enableHistoryInScriptManager() {
5603 this._enableHistory = true;
5604 this._historyEnabledInScriptManager = true;
5605 };
5606 Sys._Application.prototype._ensureHistory = function Sys$_Application$_ensureHistory() {
5607 if (!this._historyInitialized && this._enableHistory) {
5608 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) {
5609 this._historyFrame = document.getElementById('__historyFrame');
5610 if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame);
5611 this._ignoreIFrame = true;
5612 }
5613 this._timerHandler = Function.createDelegate(this, this._onIdle);
5614 this._timerCookie = window.setTimeout(this._timerHandler, 100);
5615
5616 try {
5617 this._initialState = this._deserializeState(this.get_stateString());
5618 } catch(e) {}
5619
5620 this._historyInitialized = true;
5621 }
5622 };
5623 Sys._Application.prototype._navigate = function Sys$_Application$_navigate(entry) {
5624 this._ensureHistory();
5625 var state = this._deserializeState(entry);
5626
5627 if (this._uniqueId) {
5628 var oldServerEntry = this._state.__s || '';
5629 var newServerEntry = state.__s || '';
5630 if (newServerEntry !== oldServerEntry) {
5631 this._updateHiddenField(newServerEntry);
5632 __doPostBack(this._uniqueId, newServerEntry);
5633 this._state = state;
5634 return;
5635 }
5636 }
5637 this._setState(entry);
5638 this._state = state;
5639 this._raiseNavigate();
5640 };
5641 Sys._Application.prototype._onIdle = function Sys$_Application$_onIdle() {
5642 delete this._timerCookie;
5643
5644 var entry = this.get_stateString();
5645 if (entry !== this._currentEntry) {
5646 if (!this._ignoreTimer) {
5647 this._historyPointIsNew = false;
5648 this._navigate(entry);
5649 }
5650 }
5651 else {
5652 this._ignoreTimer = false;
5653 }
5654 this._timerCookie = window.setTimeout(this._timerHandler, 100);
5655 };
5656 Sys._Application.prototype._onIFrameLoad = function Sys$_Application$_onIFrameLoad(entry) {
5657 this._ensureHistory();
5658 if (!this._ignoreIFrame) {
5659 this._historyPointIsNew = false;
5660 this._navigate(entry);
5661 }
5662 this._ignoreIFrame = false;
5663 };
5664 Sys._Application.prototype._onPageRequestManagerBeginRequest = function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) {
5665 this._ignoreTimer = true;
5666 };
5667 Sys._Application.prototype._onPageRequestManagerEndRequest = function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) {
5668 var dataItem = args.get_dataItems()[this._clientId];
5669 var eventTarget = document.getElementById("__EVENTTARGET");
5670 if (eventTarget && eventTarget.value === this._uniqueId) {
5671 eventTarget.value = '';
5672 }
5673 if (typeof(dataItem) !== 'undefined') {
5674 this.setServerState(dataItem);
5675 this._historyPointIsNew = true;
5676 }
5677 else {
5678 this._ignoreTimer = false;
5679 }
5680 var entry = this._serializeState(this._state);
5681 if (entry !== this._currentEntry) {
5682 this._ignoreTimer = true;
5683 this._setState(entry);
5684 this._raiseNavigate();
5685 }
5686 };
5687 Sys._Application.prototype._raiseNavigate = function Sys$_Application$_raiseNavigate() {
5688 var h = this.get_events().getHandler("navigate");
5689 var stateClone = {};
5690 for (var key in this._state) {
5691 if (key !== '__s') {
5692 stateClone[key] = this._state[key];
5693 }
5694 }
5695 var args = new Sys.HistoryEventArgs(stateClone);
5696 if (h) {
5697 h(this, args);
5698 }
5699 var err;
5700 try {
5701 if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash &&
5702 (!window.frameElement || window.top.location.hash)) {
5703 window.history.go(0);
5704 }
5705 }
5706 catch(err) {
5707 }
5708 };
5709 Sys._Application.prototype._serializeState = function Sys$_Application$_serializeState(state) {
5710 var serialized = [];
5711 for (var key in state) {
5712 var value = state[key];
5713 if (key === '__s') {
5714 var serverState = value;
5715 }
5716 else {
5717 if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid);
5718 serialized[serialized.length] = key + '=' + encodeURIComponent(value);
5719 }
5720 }
5721 return serialized.join('&') + (serverState ? '&&' + serverState : '');
5722 };
5723 Sys._Application.prototype._setState = function Sys$_Application$_setState(entry, title) {
5724 if (this._enableHistory) {
5725 entry = entry || '';
5726 if (entry !== this._currentEntry) {
5727 if (window.theForm) {
5728 var action = window.theForm.action;
5729 var hashIndex = action.indexOf('#');
5730 window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry;
5731 }
5732
5733 if (this._historyFrame && this._historyPointIsNew) {
5734 this._ignoreIFrame = true;
5735 var frameDoc = this._historyFrame.contentWindow.document;
5736 frameDoc.open("javascript:'<html></html>'");
5737 frameDoc.write("<html><head><title>" + (title || document.title) +
5738 "</title><scri" + "pt type=\"text/javascript\">parent.Sys.Application._onIFrameLoad(" +
5739 Sys.Serialization.JavaScriptSerializer.serialize(entry) +
5740 ");</scri" + "pt></head><body></body></html>");
5741 frameDoc.close();
5742 }
5743 this._ignoreTimer = false;
5744 this._currentEntry = entry;
5745 if (this._historyFrame || this._historyPointIsNew) {
5746 var currentHash = this.get_stateString();
5747 if (entry !== currentHash) {
5748 var loc = document.location;
5749 if (loc.href.length - loc.hash.length + entry.length > 1024) {
5750 throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars);
5751 }
5752 window.location.hash = entry;
5753 this._currentEntry = this.get_stateString();
5754 if ((typeof(title) !== 'undefined') && (title !== null)) {
5755 document.title = title;
5756 }
5757 }
5758 }
5759 this._historyPointIsNew = false;
5760 }
5761 }
5762 };
5763 Sys._Application.prototype._updateHiddenField = function Sys$_Application$_updateHiddenField(value) {
5764 if (this._clientId) {
5765 var serverStateField = document.getElementById(this._clientId);
5766 if (serverStateField) {
5767 serverStateField.value = value;
5768 }
5769 }
5770 };
5771
5772 if (!window.XMLHttpRequest) {
5773 window.XMLHttpRequest = function window$XMLHttpRequest() {
5774 var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
5775 for (var i = 0, l = progIDs.length; i < l; i++) {
5776 try {
5777 return new ActiveXObject(progIDs[i]);
5778 }
5779 catch (ex) {
5780 }
5781 }
5782 return null;
5783 }
5784 }
5785 Type.registerNamespace('Sys.Net');
5786
5787 Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() {
5788 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.#ctor" />
5789 if (arguments.length !== 0) throw Error.parameterCount();
5790 this._webRequest = null;
5791 this._resultObject = null;
5792 }
5793 function Sys$Net$WebRequestExecutor$get_webRequest() {
5794 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.WebRequestExecutor.webRequest"></value>
5795 if (arguments.length !== 0) throw Error.parameterCount();
5796 return this._webRequest;
5797 }
5798 function Sys$Net$WebRequestExecutor$_set_webRequest(value) {
5799 if (this.get_started()) {
5800 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
5801 }
5802 this._webRequest = value;
5803 }
5804 function Sys$Net$WebRequestExecutor$get_started() {
5805 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.started"></value>
5806 if (arguments.length !== 0) throw Error.parameterCount();
5807 throw Error.notImplemented();
5808 }
5809 function Sys$Net$WebRequestExecutor$get_responseAvailable() {
5810 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.responseAvailable"></value>
5811 if (arguments.length !== 0) throw Error.parameterCount();
5812 throw Error.notImplemented();
5813 }
5814 function Sys$Net$WebRequestExecutor$get_timedOut() {
5815 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.timedOut"></value>
5816 if (arguments.length !== 0) throw Error.parameterCount();
5817 throw Error.notImplemented();
5818 }
5819 function Sys$Net$WebRequestExecutor$get_aborted() {
5820 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.aborted"></value>
5821 if (arguments.length !== 0) throw Error.parameterCount();
5822 throw Error.notImplemented();
5823 }
5824 function Sys$Net$WebRequestExecutor$get_responseData() {
5825 /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.responseData"></value>
5826 if (arguments.length !== 0) throw Error.parameterCount();
5827 throw Error.notImplemented();
5828 }
5829 function Sys$Net$WebRequestExecutor$get_statusCode() {
5830 /// <value type="Number" locid="P:J#Sys.Net.WebRequestExecutor.statusCode"></value>
5831 if (arguments.length !== 0) throw Error.parameterCount();
5832 throw Error.notImplemented();
5833 }
5834 function Sys$Net$WebRequestExecutor$get_statusText() {
5835 /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.statusText"></value>
5836 if (arguments.length !== 0) throw Error.parameterCount();
5837 throw Error.notImplemented();
5838 }
5839 function Sys$Net$WebRequestExecutor$get_xml() {
5840 /// <value locid="P:J#Sys.Net.WebRequestExecutor.xml"></value>
5841 if (arguments.length !== 0) throw Error.parameterCount();
5842 throw Error.notImplemented();
5843 }
5844 function Sys$Net$WebRequestExecutor$get_object() {
5845 /// <value locid="P:J#Sys.Net.WebRequestExecutor.object"></value>
5846 if (arguments.length !== 0) throw Error.parameterCount();
5847 if (!this._resultObject) {
5848 this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
5849 }
5850 return this._resultObject;
5851 }
5852 function Sys$Net$WebRequestExecutor$executeRequest() {
5853 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.executeRequest" />
5854 if (arguments.length !== 0) throw Error.parameterCount();
5855 throw Error.notImplemented();
5856 }
5857 function Sys$Net$WebRequestExecutor$abort() {
5858 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.abort" />
5859 if (arguments.length !== 0) throw Error.parameterCount();
5860 throw Error.notImplemented();
5861 }
5862 function Sys$Net$WebRequestExecutor$getResponseHeader(header) {
5863 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getResponseHeader" />
5864 /// <param name="header" type="String"></param>
5865 var e = Function._validateParams(arguments, [
5866 {name: "header", type: String}
5867 ]);
5868 if (e) throw e;
5869 throw Error.notImplemented();
5870 }
5871 function Sys$Net$WebRequestExecutor$getAllResponseHeaders() {
5872 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getAllResponseHeaders" />
5873 if (arguments.length !== 0) throw Error.parameterCount();
5874 throw Error.notImplemented();
5875 }
5876 Sys.Net.WebRequestExecutor.prototype = {
5877 get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest,
5878 _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest,
5879 get_started: Sys$Net$WebRequestExecutor$get_started,
5880 get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable,
5881 get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut,
5882 get_aborted: Sys$Net$WebRequestExecutor$get_aborted,
5883 get_responseData: Sys$Net$WebRequestExecutor$get_responseData,
5884 get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode,
5885 get_statusText: Sys$Net$WebRequestExecutor$get_statusText,
5886 get_xml: Sys$Net$WebRequestExecutor$get_xml,
5887 get_object: Sys$Net$WebRequestExecutor$get_object,
5888 executeRequest: Sys$Net$WebRequestExecutor$executeRequest,
5889 abort: Sys$Net$WebRequestExecutor$abort,
5890 getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader,
5891 getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders
5892 }
5893 Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor');
5894
5895 Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) {
5896 /// <summary locid="M:J#Sys.Net.XMLDOM.#ctor" />
5897 /// <param name="markup" type="String"></param>
5898 var e = Function._validateParams(arguments, [
5899 {name: "markup", type: String}
5900 ]);
5901 if (e) throw e;
5902 if (!window.DOMParser) {
5903 var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
5904 for (var i = 0, l = progIDs.length; i < l; i++) {
5905 try {
5906 var xmlDOM = new ActiveXObject(progIDs[i]);
5907 xmlDOM.async = false;
5908 xmlDOM.loadXML(markup);
5909 xmlDOM.setProperty('SelectionLanguage', 'XPath');
5910 return xmlDOM;
5911 }
5912 catch (ex) {
5913 }
5914 }
5915 }
5916 else {
5917 try {
5918 var domParser = new window.DOMParser();
5919 return domParser.parseFromString(markup, 'text/xml');
5920 }
5921 catch (ex) {
5922 }
5923 }
5924 return null;
5925 }
5926 Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
5927 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />
5928 if (arguments.length !== 0) throw Error.parameterCount();
5929 Sys.Net.XMLHttpExecutor.initializeBase(this);
5930 var _this = this;
5931 this._xmlHttpRequest = null;
5932 this._webRequest = null;
5933 this._responseAvailable = false;
5934 this._timedOut = false;
5935 this._timer = null;
5936 this._aborted = false;
5937 this._started = false;
5938 this._onReadyStateChange = (function () {
5939
5940 if (_this._xmlHttpRequest.readyState === 4 ) {
5941 try {
5942 if (typeof(_this._xmlHttpRequest.status) === "undefined") {
5943 return;
5944 }
5945 }
5946 catch(ex) {
5947 return;
5948 }
5949
5950 _this._clearTimer();
5951 _this._responseAvailable = true;
5952 _this._webRequest.completed(Sys.EventArgs.Empty);
5953 if (_this._xmlHttpRequest != null) {
5954 _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
5955 _this._xmlHttpRequest = null;
5956 }
5957 }
5958 });
5959 this._clearTimer = (function() {
5960 if (_this._timer != null) {
5961 window.clearTimeout(_this._timer);
5962 _this._timer = null;
5963 }
5964 });
5965 this._onTimeout = (function() {
5966 if (!_this._responseAvailable) {
5967 _this._clearTimer();
5968 _this._timedOut = true;
5969 _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
5970 _this._xmlHttpRequest.abort();
5971 _this._webRequest.completed(Sys.EventArgs.Empty);
5972 _this._xmlHttpRequest = null;
5973 }
5974 });
5975 }
5976 function Sys$Net$XMLHttpExecutor$get_timedOut() {
5977 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.timedOut"></value>
5978 if (arguments.length !== 0) throw Error.parameterCount();
5979 return this._timedOut;
5980 }
5981 function Sys$Net$XMLHttpExecutor$get_started() {
5982 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.started"></value>
5983 if (arguments.length !== 0) throw Error.parameterCount();
5984 return this._started;
5985 }
5986 function Sys$Net$XMLHttpExecutor$get_responseAvailable() {
5987 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.responseAvailable"></value>
5988 if (arguments.length !== 0) throw Error.parameterCount();
5989 return this._responseAvailable;
5990 }
5991 function Sys$Net$XMLHttpExecutor$get_aborted() {
5992 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.aborted"></value>
5993 if (arguments.length !== 0) throw Error.parameterCount();
5994 return this._aborted;
5995 }
5996 function Sys$Net$XMLHttpExecutor$executeRequest() {
5997 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.executeRequest" />
5998 if (arguments.length !== 0) throw Error.parameterCount();
5999 this._webRequest = this.get_webRequest();
6000 if (this._started) {
6001 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
6002 }
6003 if (this._webRequest === null) {
6004 throw Error.invalidOperation(Sys.Res.nullWebRequest);
6005 }
6006 var body = this._webRequest.get_body();
6007 var headers = this._webRequest.get_headers();
6008 this._xmlHttpRequest = new XMLHttpRequest();
6009 this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange;
6010 var verb = this._webRequest.get_httpVerb();
6011 this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true );
6012 this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
6013 if (headers) {
6014 for (var header in headers) {
6015 var val = headers[header];
6016 if (typeof(val) !== "function")
6017 this._xmlHttpRequest.setRequestHeader(header, val);
6018 }
6019 }
6020 if (verb.toLowerCase() === "post") {
6021 if ((headers === null) || !headers['Content-Type']) {
6022 this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
6023 }
6024 if (!body) {
6025 body = "";
6026 }
6027 }
6028 var timeout = this._webRequest.get_timeout();
6029 if (timeout > 0) {
6030 this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
6031 }
6032 this._xmlHttpRequest.send(body);
6033 this._started = true;
6034 }
6035 function Sys$Net$XMLHttpExecutor$getResponseHeader(header) {
6036 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getResponseHeader" />
6037 /// <param name="header" type="String"></param>
6038 /// <returns type="String"></returns>
6039 var e = Function._validateParams(arguments, [
6040 {name: "header", type: String}
6041 ]);
6042 if (e) throw e;
6043 if (!this._responseAvailable) {
6044 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader'));
6045 }
6046 if (!this._xmlHttpRequest) {
6047 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader'));
6048 }
6049 var result;
6050 try {
6051 result = this._xmlHttpRequest.getResponseHeader(header);
6052 } catch (e) {
6053 }
6054 if (!result) result = "";
6055 return result;
6056 }
6057 function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() {
6058 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getAllResponseHeaders" />
6059 /// <returns type="String"></returns>
6060 if (arguments.length !== 0) throw Error.parameterCount();
6061 if (!this._responseAvailable) {
6062 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders'));
6063 }
6064 if (!this._xmlHttpRequest) {
6065 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders'));
6066 }
6067 return this._xmlHttpRequest.getAllResponseHeaders();
6068 }
6069 function Sys$Net$XMLHttpExecutor$get_responseData() {
6070 /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.responseData"></value>
6071 if (arguments.length !== 0) throw Error.parameterCount();
6072 if (!this._responseAvailable) {
6073 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
6074 }
6075 if (!this._xmlHttpRequest) {
6076 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
6077 }
6078 return this._xmlHttpRequest.responseText;
6079 }
6080 function Sys$Net$XMLHttpExecutor$get_statusCode() {
6081 /// <value type="Number" locid="P:J#Sys.Net.XMLHttpExecutor.statusCode"></value>
6082 if (arguments.length !== 0) throw Error.parameterCount();
6083 if (!this._responseAvailable) {
6084 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode'));
6085 }
6086 if (!this._xmlHttpRequest) {
6087 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode'));
6088 }
6089 var result = 0;
6090 try {
6091 result = this._xmlHttpRequest.status;
6092 }
6093 catch(ex) {
6094 }
6095 return result;
6096 }
6097 function Sys$Net$XMLHttpExecutor$get_statusText() {
6098 /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.statusText"></value>
6099 if (arguments.length !== 0) throw Error.parameterCount();
6100 if (!this._responseAvailable) {
6101 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText'));
6102 }
6103 if (!this._xmlHttpRequest) {
6104 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText'));
6105 }
6106 return this._xmlHttpRequest.statusText;
6107 }
6108 function Sys$Net$XMLHttpExecutor$get_xml() {
6109 /// <value locid="P:J#Sys.Net.XMLHttpExecutor.xml"></value>
6110 if (arguments.length !== 0) throw Error.parameterCount();
6111 if (!this._responseAvailable) {
6112 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
6113 }
6114 if (!this._xmlHttpRequest) {
6115 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
6116 }
6117 var xml = this._xmlHttpRequest.responseXML;
6118 if (!xml || !xml.documentElement) {
6119 xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);
6120 if (!xml || !xml.documentElement)
6121 return null;
6122 }
6123 else if (navigator.userAgent.indexOf('MSIE') !== -1) {
6124 xml.setProperty('SelectionLanguage', 'XPath');
6125 }
6126 if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
6127 xml.documentElement.tagName === "parsererror") {
6128 return null;
6129 }
6130
6131 if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") {
6132 return null;
6133 }
6134
6135 return xml;
6136 }
6137 function Sys$Net$XMLHttpExecutor$abort() {
6138 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.abort" />
6139 if (arguments.length !== 0) throw Error.parameterCount();
6140 if (!this._started) {
6141 throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
6142 }
6143 if (this._aborted || this._responseAvailable || this._timedOut)
6144 return;
6145 this._aborted = true;
6146 this._clearTimer();
6147 if (this._xmlHttpRequest && !this._responseAvailable) {
6148 this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
6149 this._xmlHttpRequest.abort();
6150
6151 this._xmlHttpRequest = null;
6152 this._webRequest.completed(Sys.EventArgs.Empty);
6153 }
6154 }
6155 Sys.Net.XMLHttpExecutor.prototype = {
6156 get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut,
6157 get_started: Sys$Net$XMLHttpExecutor$get_started,
6158 get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable,
6159 get_aborted: Sys$Net$XMLHttpExecutor$get_aborted,
6160 executeRequest: Sys$Net$XMLHttpExecutor$executeRequest,
6161 getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader,
6162 getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders,
6163 get_responseData: Sys$Net$XMLHttpExecutor$get_responseData,
6164 get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode,
6165 get_statusText: Sys$Net$XMLHttpExecutor$get_statusText,
6166 get_xml: Sys$Net$XMLHttpExecutor$get_xml,
6167 abort: Sys$Net$XMLHttpExecutor$abort
6168 }
6169 Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
6170
6171 Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() {
6172 /// <summary locid="P:J#Sys.Net.WebRequestManager.#ctor" />
6173 if (arguments.length !== 0) throw Error.parameterCount();
6174 this._defaultTimeout = 0;
6175 this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
6176 }
6177 function Sys$Net$_WebRequestManager$add_invokingRequest(handler) {
6178 /// <summary locid="E:J#Sys.Net.WebRequestManager.invokingRequest" />
6179 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6180 if (e) throw e;
6181 this._get_eventHandlerList().addHandler("invokingRequest", handler);
6182 }
6183 function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) {
6184 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6185 if (e) throw e;
6186 this._get_eventHandlerList().removeHandler("invokingRequest", handler);
6187 }
6188 function Sys$Net$_WebRequestManager$add_completedRequest(handler) {
6189 /// <summary locid="E:J#Sys.Net.WebRequestManager.completedRequest" />
6190 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6191 if (e) throw e;
6192 this._get_eventHandlerList().addHandler("completedRequest", handler);
6193 }
6194 function Sys$Net$_WebRequestManager$remove_completedRequest(handler) {
6195 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6196 if (e) throw e;
6197 this._get_eventHandlerList().removeHandler("completedRequest", handler);
6198 }
6199 function Sys$Net$_WebRequestManager$_get_eventHandlerList() {
6200 if (!this._events) {
6201 this._events = new Sys.EventHandlerList();
6202 }
6203 return this._events;
6204 }
6205 function Sys$Net$_WebRequestManager$get_defaultTimeout() {
6206 /// <value type="Number" locid="P:J#Sys.Net.WebRequestManager.defaultTimeout"></value>
6207 if (arguments.length !== 0) throw Error.parameterCount();
6208 return this._defaultTimeout;
6209 }
6210 function Sys$Net$_WebRequestManager$set_defaultTimeout(value) {
6211 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
6212 if (e) throw e;
6213 if (value < 0) {
6214 throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
6215 }
6216 this._defaultTimeout = value;
6217 }
6218 function Sys$Net$_WebRequestManager$get_defaultExecutorType() {
6219 /// <value type="String" locid="P:J#Sys.Net.WebRequestManager.defaultExecutorType"></value>
6220 if (arguments.length !== 0) throw Error.parameterCount();
6221 return this._defaultExecutorType;
6222 }
6223 function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) {
6224 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
6225 if (e) throw e;
6226 this._defaultExecutorType = value;
6227 }
6228 function Sys$Net$_WebRequestManager$executeRequest(webRequest) {
6229 /// <summary locid="M:J#Sys.Net.WebRequestManager.executeRequest" />
6230 /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
6231 var e = Function._validateParams(arguments, [
6232 {name: "webRequest", type: Sys.Net.WebRequest}
6233 ]);
6234 if (e) throw e;
6235 var executor = webRequest.get_executor();
6236 if (!executor) {
6237 var failed = false;
6238 try {
6239 var executorType = eval(this._defaultExecutorType);
6240 executor = new executorType();
6241 } catch (e) {
6242 failed = true;
6243 }
6244 if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) {
6245 throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
6246 }
6247 webRequest.set_executor(executor);
6248 }
6249 if (executor.get_aborted()) {
6250 return;
6251 }
6252 var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
6253 var handler = this._get_eventHandlerList().getHandler("invokingRequest");
6254 if (handler) {
6255 handler(this, evArgs);
6256 }
6257 if (!evArgs.get_cancel()) {
6258 executor.executeRequest();
6259 }
6260 }
6261 Sys.Net._WebRequestManager.prototype = {
6262 add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest,
6263 remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest,
6264 add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest,
6265 remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest,
6266 _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList,
6267 get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout,
6268 set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout,
6269 get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType,
6270 set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType,
6271 executeRequest: Sys$Net$_WebRequestManager$executeRequest
6272 }
6273 Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager');
6274 Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
6275
6276 Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) {
6277 /// <summary locid="M:J#Sys.Net.NetworkRequestEventArgs.#ctor" />
6278 /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
6279 var e = Function._validateParams(arguments, [
6280 {name: "webRequest", type: Sys.Net.WebRequest}
6281 ]);
6282 if (e) throw e;
6283 Sys.Net.NetworkRequestEventArgs.initializeBase(this);
6284 this._webRequest = webRequest;
6285 }
6286 function Sys$Net$NetworkRequestEventArgs$get_webRequest() {
6287 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.NetworkRequestEventArgs.webRequest"></value>
6288 if (arguments.length !== 0) throw Error.parameterCount();
6289 return this._webRequest;
6290 }
6291 Sys.Net.NetworkRequestEventArgs.prototype = {
6292 get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest
6293 }
6294 Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
6295
6296 Sys.Net.WebRequest = function Sys$Net$WebRequest() {
6297 /// <summary locid="M:J#Sys.Net.WebRequest.#ctor" />
6298 if (arguments.length !== 0) throw Error.parameterCount();
6299 this._url = "";
6300 this._headers = { };
6301 this._body = null;
6302 this._userContext = null;
6303 this._httpVerb = null;
6304 this._executor = null;
6305 this._invokeCalled = false;
6306 this._timeout = 0;
6307 }
6308 function Sys$Net$WebRequest$add_completed(handler) {
6309 /// <summary locid="E:J#Sys.Net.WebRequest.completed" />
6310 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6311 if (e) throw e;
6312 this._get_eventHandlerList().addHandler("completed", handler);
6313 }
6314 function Sys$Net$WebRequest$remove_completed(handler) {
6315 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
6316 if (e) throw e;
6317 this._get_eventHandlerList().removeHandler("completed", handler);
6318 }
6319 function Sys$Net$WebRequest$completed(eventArgs) {
6320 /// <summary locid="M:J#Sys.Net.WebRequest.completed" />
6321 /// <param name="eventArgs" type="Sys.EventArgs"></param>
6322 var e = Function._validateParams(arguments, [
6323 {name: "eventArgs", type: Sys.EventArgs}
6324 ]);
6325 if (e) throw e;
6326 var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");
6327 if (handler) {
6328 handler(this._executor, eventArgs);
6329 }
6330 handler = this._get_eventHandlerList().getHandler("completed");
6331 if (handler) {
6332 handler(this._executor, eventArgs);
6333 }
6334 }
6335 function Sys$Net$WebRequest$_get_eventHandlerList() {
6336 if (!this._events) {
6337 this._events = new Sys.EventHandlerList();
6338 }
6339 return this._events;
6340 }
6341 function Sys$Net$WebRequest$get_url() {
6342 /// <value type="String" locid="P:J#Sys.Net.WebRequest.url"></value>
6343 if (arguments.length !== 0) throw Error.parameterCount();
6344 return this._url;
6345 }
6346 function Sys$Net$WebRequest$set_url(value) {
6347 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
6348 if (e) throw e;
6349 this._url = value;
6350 }
6351 function Sys$Net$WebRequest$get_headers() {
6352 /// <value locid="P:J#Sys.Net.WebRequest.headers"></value>
6353 if (arguments.length !== 0) throw Error.parameterCount();
6354 return this._headers;
6355 }
6356 function Sys$Net$WebRequest$get_httpVerb() {
6357 /// <value type="String" locid="P:J#Sys.Net.WebRequest.httpVerb"></value>
6358 if (arguments.length !== 0) throw Error.parameterCount();
6359 if (this._httpVerb === null) {
6360 if (this._body === null) {
6361 return "GET";
6362 }
6363 return "POST";
6364 }
6365 return this._httpVerb;
6366 }
6367 function Sys$Net$WebRequest$set_httpVerb(value) {
6368 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
6369 if (e) throw e;
6370 if (value.length === 0) {
6371 throw Error.argument('value', Sys.Res.invalidHttpVerb);
6372 }
6373 this._httpVerb = value;
6374 }
6375 function Sys$Net$WebRequest$get_body() {
6376 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.body"></value>
6377 if (arguments.length !== 0) throw Error.parameterCount();
6378 return this._body;
6379 }
6380 function Sys$Net$WebRequest$set_body(value) {
6381 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
6382 if (e) throw e;
6383 this._body = value;
6384 }
6385 function Sys$Net$WebRequest$get_userContext() {
6386 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.userContext"></value>
6387 if (arguments.length !== 0) throw Error.parameterCount();
6388 return this._userContext;
6389 }
6390 function Sys$Net$WebRequest$set_userContext(value) {
6391 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
6392 if (e) throw e;
6393 this._userContext = value;
6394 }
6395 function Sys$Net$WebRequest$get_executor() {
6396 /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.Net.WebRequest.executor"></value>
6397 if (arguments.length !== 0) throw Error.parameterCount();
6398 return this._executor;
6399 }
6400 function Sys$Net$WebRequest$set_executor(value) {
6401 var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
6402 if (e) throw e;
6403 if (this._executor !== null && this._executor.get_started()) {
6404 throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
6405 }
6406 this._executor = value;
6407 this._executor._set_webRequest(this);
6408 }
6409 function Sys$Net$WebRequest$get_timeout() {
6410 /// <value type="Number" locid="P:J#Sys.Net.WebRequest.timeout"></value>
6411 if (arguments.length !== 0) throw Error.parameterCount();
6412 if (this._timeout === 0) {
6413 return Sys.Net.WebRequestManager.get_defaultTimeout();
6414 }
6415 return this._timeout;
6416 }
6417 function Sys$Net$WebRequest$set_timeout(value) {
6418 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
6419 if (e) throw e;
6420 if (value < 0) {
6421 throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
6422 }
6423 this._timeout = value;
6424 }
6425 function Sys$Net$WebRequest$getResolvedUrl() {
6426 /// <summary locid="M:J#Sys.Net.WebRequest.getResolvedUrl" />
6427 /// <returns type="String"></returns>
6428 if (arguments.length !== 0) throw Error.parameterCount();
6429 return Sys.Net.WebRequest._resolveUrl(this._url);
6430 }
6431 function Sys$Net$WebRequest$invoke() {
6432 /// <summary locid="M:J#Sys.Net.WebRequest.invoke" />
6433 if (arguments.length !== 0) throw Error.parameterCount();
6434 if (this._invokeCalled) {
6435 throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
6436 }
6437 Sys.Net.WebRequestManager.executeRequest(this);
6438 this._invokeCalled = true;
6439 }
6440 Sys.Net.WebRequest.prototype = {
6441 add_completed: Sys$Net$WebRequest$add_completed,
6442 remove_completed: Sys$Net$WebRequest$remove_completed,
6443 completed: Sys$Net$WebRequest$completed,
6444 _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList,
6445 get_url: Sys$Net$WebRequest$get_url,
6446 set_url: Sys$Net$WebRequest$set_url,
6447 get_headers: Sys$Net$WebRequest$get_headers,
6448 get_httpVerb: Sys$Net$WebRequest$get_httpVerb,
6449 set_httpVerb: Sys$Net$WebRequest$set_httpVerb,
6450 get_body: Sys$Net$WebRequest$get_body,
6451 set_body: Sys$Net$WebRequest$set_body,
6452 get_userContext: Sys$Net$WebRequest$get_userContext,
6453 set_userContext: Sys$Net$WebRequest$set_userContext,
6454 get_executor: Sys$Net$WebRequest$get_executor,
6455 set_executor: Sys$Net$WebRequest$set_executor,
6456 get_timeout: Sys$Net$WebRequest$get_timeout,
6457 set_timeout: Sys$Net$WebRequest$set_timeout,
6458 getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl,
6459 invoke: Sys$Net$WebRequest$invoke
6460 }
6461 Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) {
6462 if (url && url.indexOf('://') !== -1) {
6463 return url;
6464 }
6465 if (!baseUrl || baseUrl.length === 0) {
6466 var baseElement = document.getElementsByTagName('base')[0];
6467 if (baseElement && baseElement.href && baseElement.href.length > 0) {
6468 baseUrl = baseElement.href;
6469 }
6470 else {
6471 baseUrl = document.URL;
6472 }
6473 }
6474 var qsStart = baseUrl.indexOf('?');
6475 if (qsStart !== -1) {
6476 baseUrl = baseUrl.substr(0, qsStart);
6477 }
6478 qsStart = baseUrl.indexOf('#');
6479 if (qsStart !== -1) {
6480 baseUrl = baseUrl.substr(0, qsStart);
6481 }
6482 baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);
6483 if (!url || url.length === 0) {
6484 return baseUrl;
6485 }
6486 if (url.charAt(0) === '/') {
6487 var slashslash = baseUrl.indexOf('://');
6488 if (slashslash === -1) {
6489 throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
6490 }
6491 var nextSlash = baseUrl.indexOf('/', slashslash + 3);
6492 if (nextSlash === -1) {
6493 throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
6494 }
6495 return baseUrl.substr(0, nextSlash) + url;
6496 }
6497 else {
6498 var lastSlash = baseUrl.lastIndexOf('/');
6499 if (lastSlash === -1) {
6500 throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
6501 }
6502 return baseUrl.substr(0, lastSlash+1) + url;
6503 }
6504 }
6505 Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod, addParams) {
6506 encodeMethod = encodeMethod || encodeURIComponent;
6507 var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
6508 if (queryString) {
6509 for (arg in queryString) {
6510 obj = queryString[arg];
6511 if (typeof(obj) === "function") continue;
6512 val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
6513 if (i++) {
6514 sb.append('&');
6515 }
6516 sb.append(arg);
6517 sb.append('=');
6518 sb.append(encodeMethod(val));
6519 }
6520 }
6521 if (addParams) {
6522 if (i) {
6523 sb.append('&');
6524 }
6525 sb.append(addParams);
6526 }
6527 return sb.toString();
6528 }
6529 Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString, addParams) {
6530 if (!queryString && !addParams) {
6531 return url;
6532 }
6533 var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
6534 return qs.length
6535 ? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
6536 : url;
6537 }
6538 Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest');
6539
6540 Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) {
6541 /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor" />
6542 /// <param name="scriptElement" domElement="true"></param>
6543 /// <param name="completedCallback" type="Function"></param>
6544 var e = Function._validateParams(arguments, [
6545 {name: "scriptElement", domElement: true},
6546 {name: "completedCallback", type: Function}
6547 ]);
6548 if (e) throw e;
6549 this._scriptElement = scriptElement;
6550 this._completedCallback = completedCallback;
6551 }
6552 function Sys$_ScriptLoaderTask$get_scriptElement() {
6553 /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement"></value>
6554 if (arguments.length !== 0) throw Error.parameterCount();
6555 return this._scriptElement;
6556 }
6557 function Sys$_ScriptLoaderTask$dispose() {
6558 if(this._disposed) {
6559 return;
6560 }
6561 this._disposed = true;
6562 this._removeScriptElementHandlers();
6563 Sys._ScriptLoaderTask._clearScript(this._scriptElement);
6564 this._scriptElement = null;
6565 }
6566 function Sys$_ScriptLoaderTask$execute() {
6567 /// <summary locid="M:J#Sys._ScriptLoaderTask.execute" />
6568 if (arguments.length !== 0) throw Error.parameterCount();
6569 this._addScriptElementHandlers();
6570 var headElements = document.getElementsByTagName('head');
6571 if (headElements.length === 0) {
6572 throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
6573 }
6574 else {
6575 headElements[0].appendChild(this._scriptElement);
6576 }
6577 }
6578 function Sys$_ScriptLoaderTask$_addScriptElementHandlers() {
6579 this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
6580
6581 if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
6582 this._scriptElement.readyState = 'loaded';
6583 $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate);
6584 }
6585 else {
6586 $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate);
6587 }
6588 if (this._scriptElement.addEventListener) {
6589 this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler);
6590 this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false);
6591 }
6592 }
6593 function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() {
6594 if(this._scriptLoadDelegate) {
6595 var scriptElement = this.get_scriptElement();
6596 if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
6597 $removeHandler(scriptElement, 'load', this._scriptLoadDelegate);
6598 }
6599 else {
6600 $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate);
6601 }
6602 if (this._scriptErrorDelegate) {
6603 this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false);
6604 this._scriptErrorDelegate = null;
6605 }
6606 this._scriptLoadDelegate = null;
6607 }
6608 }
6609 function Sys$_ScriptLoaderTask$_scriptErrorHandler() {
6610 if(this._disposed) {
6611 return;
6612 }
6613
6614 this._completedCallback(this.get_scriptElement(), false);
6615 }
6616 function Sys$_ScriptLoaderTask$_scriptLoadHandler() {
6617 if(this._disposed) {
6618 return;
6619 }
6620 var scriptElement = this.get_scriptElement();
6621 if ((scriptElement.readyState !== 'loaded') &&
6622 (scriptElement.readyState !== 'complete')) {
6623 return;
6624 }
6625
6626 this._completedCallback(scriptElement, true);
6627 }
6628 Sys._ScriptLoaderTask.prototype = {
6629 get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement,
6630 dispose: Sys$_ScriptLoaderTask$dispose,
6631 execute: Sys$_ScriptLoaderTask$execute,
6632 _addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers,
6633 _removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers,
6634 _scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler,
6635 _scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler
6636 }
6637 Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
6638 Sys._ScriptLoaderTask._clearScript = function Sys$_ScriptLoaderTask$_clearScript(scriptElement) {
6639 if (!Sys.Debug.isDebug) {
6640 scriptElement.parentNode.removeChild(scriptElement);
6641 }
6642 }
6643 Type.registerNamespace('Sys.Net');
6644
6645 Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() {
6646 }
6647 function Sys$Net$WebServiceProxy$get_timeout() {
6648 /// <value type="Number" locid="P:J#Sys.Net.WebServiceProxy.timeout"></value>
6649 if (arguments.length !== 0) throw Error.parameterCount();
6650 return this._timeout || 0;
6651 }
6652 function Sys$Net$WebServiceProxy$set_timeout(value) {
6653 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
6654 if (e) throw e;
6655 if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
6656 this._timeout = value;
6657 }
6658 function Sys$Net$WebServiceProxy$get_defaultUserContext() {
6659 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultUserContext"></value>
6660 if (arguments.length !== 0) throw Error.parameterCount();
6661 return (typeof(this._userContext) === "undefined") ? null : this._userContext;
6662 }
6663 function Sys$Net$WebServiceProxy$set_defaultUserContext(value) {
6664 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
6665 if (e) throw e;
6666 this._userContext = value;
6667 }
6668 function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() {
6669 /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultSucceededCallback"></value>
6670 if (arguments.length !== 0) throw Error.parameterCount();
6671 return this._succeeded || null;
6672 }
6673 function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) {
6674 var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
6675 if (e) throw e;
6676 this._succeeded = value;
6677 }
6678 function Sys$Net$WebServiceProxy$get_defaultFailedCallback() {
6679 /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultFailedCallback"></value>
6680 if (arguments.length !== 0) throw Error.parameterCount();
6681 return this._failed || null;
6682 }
6683 function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) {
6684 var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
6685 if (e) throw e;
6686 this._failed = value;
6687 }
6688 function Sys$Net$WebServiceProxy$get_enableJsonp() {
6689 /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceProxy.enableJsonp"></value>
6690 if (arguments.length !== 0) throw Error.parameterCount();
6691 return !!this._jsonp;
6692 }
6693 function Sys$Net$WebServiceProxy$set_enableJsonp(value) {
6694 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
6695 if (e) throw e;
6696 this._jsonp = value;
6697 }
6698 function Sys$Net$WebServiceProxy$get_path() {
6699 /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.path"></value>
6700 if (arguments.length !== 0) throw Error.parameterCount();
6701 return this._path || null;
6702 }
6703 function Sys$Net$WebServiceProxy$set_path(value) {
6704 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
6705 if (e) throw e;
6706 this._path = value;
6707 }
6708 function Sys$Net$WebServiceProxy$get_jsonpCallbackParameter() {
6709 /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.jsonpCallbackParameter"></value>
6710 if (arguments.length !== 0) throw Error.parameterCount();
6711 return this._callbackParameter || "callback";
6712 }
6713 function Sys$Net$WebServiceProxy$set_jsonpCallbackParameter(value) {
6714 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
6715 if (e) throw e;
6716 this._callbackParameter = value;
6717 }
6718 function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) {
6719 /// <summary locid="M:J#Sys.Net.WebServiceProxy._invoke" />
6720 /// <param name="servicePath" type="String"></param>
6721 /// <param name="methodName" type="String"></param>
6722 /// <param name="useGet" type="Boolean"></param>
6723 /// <param name="params"></param>
6724 /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
6725 /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
6726 /// <param name="userContext" mayBeNull="true" optional="true"></param>
6727 /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
6728 var e = Function._validateParams(arguments, [
6729 {name: "servicePath", type: String},
6730 {name: "methodName", type: String},
6731 {name: "useGet", type: Boolean},
6732 {name: "params"},
6733 {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
6734 {name: "onFailure", type: Function, mayBeNull: true, optional: true},
6735 {name: "userContext", mayBeNull: true, optional: true}
6736 ]);
6737 if (e) throw e;
6738 onSuccess = onSuccess || this.get_defaultSucceededCallback();
6739 onFailure = onFailure || this.get_defaultFailedCallback();
6740 if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext();
6741 return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter());
6742 }
6743 Sys.Net.WebServiceProxy.prototype = {
6744 get_timeout: Sys$Net$WebServiceProxy$get_timeout,
6745 set_timeout: Sys$Net$WebServiceProxy$set_timeout,
6746 get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext,
6747 set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext,
6748 get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback,
6749 set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback,
6750 get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback,
6751 set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback,
6752 get_enableJsonp: Sys$Net$WebServiceProxy$get_enableJsonp,
6753 set_enableJsonp: Sys$Net$WebServiceProxy$set_enableJsonp,
6754 get_path: Sys$Net$WebServiceProxy$get_path,
6755 set_path: Sys$Net$WebServiceProxy$set_path,
6756 get_jsonpCallbackParameter: Sys$Net$WebServiceProxy$get_jsonpCallbackParameter,
6757 set_jsonpCallbackParameter: Sys$Net$WebServiceProxy$set_jsonpCallbackParameter,
6758 _invoke: Sys$Net$WebServiceProxy$_invoke
6759 }
6760 Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy');
6761 Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) {
6762 /// <summary locid="M:J#Sys.Net.WebServiceProxy.invoke" />
6763 /// <param name="servicePath" type="String"></param>
6764 /// <param name="methodName" type="String" mayBeNull="true" optional="true"></param>
6765 /// <param name="useGet" type="Boolean" optional="true"></param>
6766 /// <param name="params" mayBeNull="true" optional="true"></param>
6767 /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
6768 /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
6769 /// <param name="userContext" mayBeNull="true" optional="true"></param>
6770 /// <param name="timeout" type="Number" optional="true"></param>
6771 /// <param name="enableJsonp" type="Boolean" optional="true" mayBeNull="true"></param>
6772 /// <param name="jsonpCallbackParameter" type="String" optional="true" mayBeNull="true"></param>
6773 /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
6774 var e = Function._validateParams(arguments, [
6775 {name: "servicePath", type: String},
6776 {name: "methodName", type: String, mayBeNull: true, optional: true},
6777 {name: "useGet", type: Boolean, optional: true},
6778 {name: "params", mayBeNull: true, optional: true},
6779 {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
6780 {name: "onFailure", type: Function, mayBeNull: true, optional: true},
6781 {name: "userContext", mayBeNull: true, optional: true},
6782 {name: "timeout", type: Number, optional: true},
6783 {name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
6784 {name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true}
6785 ]);
6786 if (e) throw e;
6787 var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
6788 tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
6789 ((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host));
6790 useGet = jsonp || useGet;
6791 if (jsonp) {
6792 jsonpCallbackParameter = jsonpCallbackParameter || "callback";
6793 tempCallback = "_jsonp" + Sys._jsonp++;
6794 }
6795 if (!params) params = {};
6796 var urlParams = params;
6797 if (!useGet || !urlParams) urlParams = {};
6798 var script, error, timeoutcookie = null, loader, body = null,
6799 url = Sys.Net.WebRequest._createUrl(methodName
6800 ? (servicePath+"/"+encodeURIComponent(methodName))
6801 : servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null);
6802 if (jsonp) {
6803 script = document.createElement("script");
6804 script.src = url;
6805 loader = new Sys._ScriptLoaderTask(script, function(script, loaded) {
6806 if (!loaded || tempCallback) {
6807 jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
6808 }
6809 });
6810 function jsonpComplete(data, statusCode) {
6811 if (timeoutcookie !== null) {
6812 window.clearTimeout(timeoutcookie);
6813 timeoutcookie = null;
6814 }
6815 loader.dispose();
6816 delete Sys[tempCallback];
6817 tempCallback = null;
6818 if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
6819 if (onFailure) {
6820 error = new Sys.Net.WebServiceError(false,
6821 data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName),
6822 data.StackTrace || null,
6823 data.ExceptionType || null,
6824 data);
6825 error._statusCode = statusCode;
6826 onFailure(error, userContext, methodName);
6827 }
6828 else {
6829 if (data.StackTrace && data.Message) {
6830 error = data.StackTrace + "-- " + data.Message;
6831 }
6832 else {
6833 error = data.StackTrace || data.Message;
6834 }
6835 error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error);
6836 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
6837 }
6838 }
6839 else if (onSuccess) {
6840 onSuccess(data, userContext, methodName);
6841 }
6842 }
6843 Sys[tempCallback] = jsonpComplete;
6844 loader.execute();
6845 return null;
6846 }
6847 var request = new Sys.Net.WebRequest();
6848 request.set_url(url);
6849 request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
6850 if (!useGet) {
6851 body = Sys.Serialization.JavaScriptSerializer.serialize(params);
6852 if (body === "{}") body = "";
6853 }
6854 request.set_body(body);
6855 request.add_completed(onComplete);
6856 if (timeout && timeout > 0) request.set_timeout(timeout);
6857 request.invoke();
6858
6859 function onComplete(response, eventArgs) {
6860 if (response.get_responseAvailable()) {
6861 var statusCode = response.get_statusCode();
6862 var result = null;
6863
6864 try {
6865 var contentType = response.getResponseHeader("Content-Type");
6866 if (contentType.startsWith("application/json")) {
6867 result = response.get_object();
6868 }
6869 else if (contentType.startsWith("text/xml")) {
6870 result = response.get_xml();
6871 }
6872 else {
6873 result = response.get_responseData();
6874 }
6875 } catch (ex) {
6876 }
6877 var error = response.getResponseHeader("jsonerror");
6878 var errorObj = (error === "true");
6879 if (errorObj) {
6880 if (result) {
6881 result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result);
6882 }
6883 }
6884 else if (contentType.startsWith("application/json")) {
6885 result = (!result || (typeof(result.d) === "undefined")) ? result : result.d;
6886 }
6887 if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
6888 if (onFailure) {
6889 if (!result || !errorObj) {
6890 result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName));
6891 }
6892 result._statusCode = statusCode;
6893 onFailure(result, userContext, methodName);
6894 }
6895 else {
6896 if (result && errorObj) {
6897 error = result.get_exceptionType() + "-- " + result.get_message();
6898 }
6899 else {
6900 error = response.get_responseData();
6901 }
6902 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
6903 }
6904 }
6905 else if (onSuccess) {
6906 onSuccess(result, userContext, methodName);
6907 }
6908 }
6909 else {
6910 var msg;
6911 if (response.get_timedOut()) {
6912 msg = String.format(Sys.Res.webServiceTimedOut, methodName);
6913 }
6914 else {
6915 msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName)
6916 }
6917 if (onFailure) {
6918 onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName);
6919 }
6920 else {
6921 throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
6922 }
6923 }
6924 }
6925 return request;
6926 }
6927 Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) {
6928 var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
6929 var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName });
6930 e.popStackFrame();
6931 return e;
6932 }
6933 Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) {
6934 var error = err.get_exceptionType() + "-- " + err.get_message();
6935 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
6936 }
6937 Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) {
6938 return function(properties) {
6939 if (properties) {
6940 for (var name in properties) {
6941 this[name] = properties[name];
6942 }
6943 }
6944 this.__type = type;
6945 }
6946 }
6947 Sys._jsonp = 0;
6948 Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;
6949
6950 Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) {
6951 /// <summary locid="M:J#Sys.Net.WebServiceError.#ctor" />
6952 /// <param name="timedOut" type="Boolean"></param>
6953 /// <param name="message" type="String" mayBeNull="true"></param>
6954 /// <param name="stackTrace" type="String" mayBeNull="true" optional="true"></param>
6955 /// <param name="exceptionType" type="String" mayBeNull="true" optional="true"></param>
6956 /// <param name="errorObject" type="Object" mayBeNull="true" optional="true"></param>
6957 var e = Function._validateParams(arguments, [
6958 {name: "timedOut", type: Boolean},
6959 {name: "message", type: String, mayBeNull: true},
6960 {name: "stackTrace", type: String, mayBeNull: true, optional: true},
6961 {name: "exceptionType", type: String, mayBeNull: true, optional: true},
6962 {name: "errorObject", type: Object, mayBeNull: true, optional: true}
6963 ]);
6964 if (e) throw e;
6965 this._timedOut = timedOut;
6966 this._message = message;
6967 this._stackTrace = stackTrace;
6968 this._exceptionType = exceptionType;
6969 this._errorObject = errorObject;
6970 this._statusCode = -1;
6971 }
6972 function Sys$Net$WebServiceError$get_timedOut() {
6973 /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceError.timedOut"></value>
6974 if (arguments.length !== 0) throw Error.parameterCount();
6975 return this._timedOut;
6976 }
6977 function Sys$Net$WebServiceError$get_statusCode() {
6978 /// <value type="Number" locid="P:J#Sys.Net.WebServiceError.statusCode"></value>
6979 if (arguments.length !== 0) throw Error.parameterCount();
6980 return this._statusCode;
6981 }
6982 function Sys$Net$WebServiceError$get_message() {
6983 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.message"></value>
6984 if (arguments.length !== 0) throw Error.parameterCount();
6985 return this._message;
6986 }
6987 function Sys$Net$WebServiceError$get_stackTrace() {
6988 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.stackTrace"></value>
6989 if (arguments.length !== 0) throw Error.parameterCount();
6990 return this._stackTrace || "";
6991 }
6992 function Sys$Net$WebServiceError$get_exceptionType() {
6993 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.exceptionType"></value>
6994 if (arguments.length !== 0) throw Error.parameterCount();
6995 return this._exceptionType || "";
6996 }
6997 function Sys$Net$WebServiceError$get_errorObject() {
6998 /// <value type="Object" locid="P:J#Sys.Net.WebServiceError.errorObject"></value>
6999 if (arguments.length !== 0) throw Error.parameterCount();
7000 return this._errorObject || null;
7001 }
7002 Sys.Net.WebServiceError.prototype = {
7003 get_timedOut: Sys$Net$WebServiceError$get_timedOut,
7004 get_statusCode: Sys$Net$WebServiceError$get_statusCode,
7005 get_message: Sys$Net$WebServiceError$get_message,
7006 get_stackTrace: Sys$Net$WebServiceError$get_stackTrace,
7007 get_exceptionType: Sys$Net$WebServiceError$get_exceptionType,
7008 get_errorObject: Sys$Net$WebServiceError$get_errorObject
7009 }
7010 Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError');
7011
7012
7013 Type.registerNamespace('Sys');
7014
7015 Sys.Res={
7016 'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.',
7017 'argumentTypeName':'Value is not the name of an existing type.',
7018 'cantBeCalledAfterDispose':'Can\'t be called after dispose.',
7019 'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.',
7020 'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.',
7021 'notATypeName':'Value is not a valid type name.',
7022 'elementNotFound':'An element with id \'{0}\' could not be found.',
7023 'stateMustBeStringDictionary':'The state object can only have null and string fields.',
7024 'boolTrueOrFalse':'Value must be \'true\' or \'false\'.',
7025 'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a <head> element.',
7026 'stringFormatInvalid':'The format string is invalid.',
7027 'referenceNotFound':'Component \'{0}\' was not found.',
7028 'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.',
7029 'circularParentChain':'The chain of control parents can\'t have circular references.',
7030 'namespaceContainsNonObject':'Object {0} already exists and is not an object.',
7031 'undefinedEvent':'\'{0}\' is not an event.',
7032 'propertyUndefined':'\'{0}\' is not a property or an existing field.',
7033 'observableConflict':'Object already contains a member with the name \'{0}\'.',
7034 'historyCannotEnableHistory':'Cannot set enableHistory after initialization.',
7035 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
7036 'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.',
7037 'propertyNotWritable':'\'{0}\' is not a writable property.',
7038 'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.',
7039 'controlAlreadyDefined':'A control is already associated with the element.',
7040 'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.',
7041 'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.',
7042 'invalidNameSpace':'Value is not a valid namespace identifier.',
7043 'notAnInterface':'Value is not a valid interface.',
7044 'eventHandlerNotFunction':'Handler must be a function.',
7045 'propertyNotAnArray':'\'{0}\' is not an Array property.',
7046 'namespaceContainsClass':'Object {0} already exists as a class, enum, or interface.',
7047 'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.',
7048 'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.',
7049 'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.',
7050 'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.',
7051 'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.',
7052 'baseNotAClass':'Value is not a class.',
7053 'expectedElementOrId':'Value must be a DOM element or DOM element Id.',
7054 'methodNotFound':'No method found with name \'{0}\'.',
7055 'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.',
7056 'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.',
7057 'cantSetId':'The id property can\'t be set on this object.',
7058 'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.',
7059 'enumValueNotInteger':'An enumeration definition can only contain integer values.',
7060 'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.',
7061 'argumentDomNode':'Value must be a DOM element or a text node.',
7062 'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.',
7063 'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.',
7064 'createNotComponent':'{0} does not derive from Sys.Component.',
7065 'createNoDom':'Value must not be null for Controls and Behaviors.',
7066 'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.',
7067 'notObservable':'Instances of type \'{0}\' cannot be observed.',
7068 'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.',
7069 'argumentInteger':'Value must be an integer.',
7070 'invokeCalledTwice':'Cannot call invoke more than once.',
7071 'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}',
7072 'argumentType':'Object cannot be converted to the required type.',
7073 'argumentNull':'Value cannot be null.',
7074 'scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.',
7075 'scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.',
7076 'formatBadFormatSpecifier':'Format specifier was invalid.',
7077 'requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.',
7078 'webServiceFailedNoMsg':'The server method \'{0}\' failed.',
7079 'argumentDomElement':'Value must be a DOM element.',
7080 'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.',
7081 'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.',
7082 'actualValue':'Actual value was {0}.',
7083 'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.',
7084 'scriptLoadFailed':'The script \'{0}\' could not be loaded.',
7085 'parameterCount':'Parameter count mismatch.',
7086 'cannotDeserializeEmptyString':'Cannot deserialize empty string.',
7087 'formatInvalidString':'Input string was not in a correct format.',
7088 'invalidTimeout':'Value must be greater than or equal to zero.',
7089 'cannotAbortBeforeStart':'Cannot abort when executor has not started.',
7090 'argument':'Value does not fall within the expected range.',
7091 'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.',
7092 'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.',
7093 'nullWebRequest':'Cannot call executeRequest with a null webRequest.',
7094 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
7095 'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.',
7096 'argumentUndefined':'Value cannot be undefined.',
7097 'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}',
7098 'servicePathNotSet':'The path to the web service has not been set.',
7099 'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.',
7100 'cannotCallOnceStarted':'Cannot call {0} once started.',
7101 'badBaseUrl1':'Base URL does not contain ://.',
7102 'badBaseUrl2':'Base URL does not contain another /.',
7103 'badBaseUrl3':'Cannot find last / in base URL.',
7104 'setExecutorAfterActive':'Cannot set executor after it has become active.',
7105 'paramName':'Parameter name: {0}',
7106 'nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.',
7107 'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.',
7108 'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.',
7109 'format':'One of the identified items was in an invalid format.',
7110 'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}',
7111 'argumentOutOfRange':'Specified argument was out of the range of valid values.',
7112 'webServiceTimedOut':'The server method \'{0}\' timed out.',
7113 'notImplemented':'The method or operation is not implemented.',
7114 'assertFailed':'Assertion Failed: {0}',
7115 'invalidOperation':'Operation is not valid due to the current state of the object.',
7116 'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'
7117 };