0% found this document useful (0 votes)
4 views

Name MicrosoftAjax.debug.js

Uploaded by

XOXOXO
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Name MicrosoftAjax.debug.js

Uploaded by

XOXOXO
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 155

// Name: MicrosoftAjax.debug.

js
// Assembly: AjaxControlToolkit
// Version: 4.1.51116.0
// FileVersion: 4.1.51116
// (c) 2010 CodePlex Foundation

(function(window, Sys) {

var merge = function _merge(target) {


target = target || {};
foreach(arguments, function(o) {
if (o) {
forIn(o, function(v, n) {
target[n] = v;
});
}
}, 1);
return target;
}
var forIn = function _forIn(obj, callback) {
for (var x in obj) {
callback(obj[x], x);
}
}
var foreach = function _foreach(arr, callback, start) {
var cancelled;
if (arr) {
arr = arr !== window && typeof(arr.nodeType) === "undefined" &&
(arr instanceof Array ||
(typeof(arr.length) === 'number' && (typeof(arr.callee) === "function"
|| (arr.item && typeof(arr.nodeType) === "undefined") && !arr.addEventListener && !
arr.attachEvent)))
? arr : [arr];
for (var i = start||0, l = arr.length; i < l; i++) {
if (callback(arr[i], i)) {
cancelled = true;
break;
}
}
}
return !cancelled;
}
var callIf = function _callIf(obj, name, args) {
var fn = obj[name],
exists = typeof(fn) === "function";
if (exists) fn.call(obj, args);
return exists;
}
if (!Sys || !Sys.loader) {
function append(target) {
target = target || {};
foreach(arguments, function(o) {
if (o) {
forIn(o, function(v, n) {
if (typeof(target[n]) === "undefined") target[n] = v;
});
}
}, 1);
return target;
}

var attachEvent = !!document.attachEvent;

function getAndDelete(obj, field) {


var r = obj[field];
delete obj[field];
return r;
}
function foreachCall(obj, field, args) {
foreach(getAndDelete(obj, field), function(callback) {
callback.apply(null, args||[]);
});
}
function lazyget(obj, name, value) {
return obj ? (obj[name] = obj[name] || value) : value;
}
function lazypush(obj, name, value) {
lazyget(obj, name, []).push(value);
}
function lazyset(obj, name, key, value) {
lazyget(obj, name, {})[key] = value;
}
function all(tag, element) {
return (element||document).getElementsByTagName(tag);
}
function createElement(tag) {
return document.createElement(tag);
}
function listenOnce(target, name, ieName, callback, isReadyState, isScript) {
function onEvent() {
if (!attachEvent || !isReadyState || /loaded|
complete/.test(target.readyState)) {
if (attachEvent) {
target.detachEvent(ieName || ("on" + name), onEvent);
}
else {
target.removeEventListener(name, onEvent, false);
if (isScript) {
target.removeEventListener("error", onEvent, false);
}
}
callback.apply(target);
target = null;
}
}
if (attachEvent) {
target.attachEvent(ieName || ("on" + name), onEvent);
}
else {
if (target.addEventListener) {
target.addEventListener(name, onEvent, false);
}
if (isScript) {
target.addEventListener("error", onEvent, false);
}
}
}
function raiseDomReady() {
if (Sys._domReady) {
Sys._2Pass(getAndDelete(Sys, "_domReadyQueue"));
}
}
function raiseOnReady() {
var ready = Sys._ready;
if (!ready && Sys._domReady && !(Sys.loader && Sys.loader._loading)) {
Sys._ready = ready = true;
}
if (ready) {
Sys._2Pass(getAndDelete(Sys, "_readyQueue"));
}
}
window.Sys = Sys = append(Sys, {
version: [3, 0, 31106, 0],
__namespace: true,
debug: true,
scripts: {},
activateDom: true,
composites: {},
components: {},
plugins: {},
create: {},
converters: {},
_domLoaded: function _domLoaded() {
if (Sys._domChecked) return;
Sys._domChecked = true;
function domReady() {
if (!Sys._domReady) {
Sys._domReady = true;
var autoRequire = Sys._autoRequire;
if (autoRequire) {
Sys.require(autoRequire, function() {
Sys._autoRequire = null;
foreachCall(Sys, "_autoQueue");
}, autoToken);
}
raiseDomReady();
raiseOnReady();
}
}
listenOnce(window, "load", null, domReady);

var check;
if (attachEvent) {
if ((window == window.top) && document.documentElement.doScroll) {
var timeout, er, el = createElement("div");
check = function() {
try {
el.doScroll("left");
}
catch (er) {
timeout = window.setTimeout(check, 0);
return;
}
el = null;
domReady();
}
check();
}
else {
listenOnce(document, null, "onreadystatechange", domReady,
true);
}
}
else if (document.addEventListener) {
listenOnce(document, "DOMContentLoaded", null, domReady);
}
},
_getById: function _getById(found, id, single, includeSelf, element,
filter) {
if (element) {
if (includeSelf && (element.id === id)) {
found.push(element);
}
else if (!filter) {
foreach(all("*", element), function(element) {
if (element.id === id) {
found.push(element);
return true;
}
});
}
}
else {
var e = document.getElementById(id);
if (e) found.push(e);
}
return found.length;
},
_getByClass: function _getByClass(found, targetClass, single, includeSelf,
element, filter) {
function pushIfMatch(element) {
var ret, className = element.className;
if (className && ((className === targetClass) ||
(className.indexOf(' ' + targetClass) >= 0) || (className.indexOf(targetClass + '
') >= 0))) {
found.push(element);
ret = true;
}
return ret;
}
var i, l, nodes;
if (includeSelf && pushIfMatch(element) && single) {
return true;
}
if (!filter) {
element = element || document;
var finder = element.querySelectorAll ||
element.getElementsByClassName;
if (finder) {
if (element.querySelectorAll) targetClass = "." + targetClass;
nodes = finder.call(element, targetClass);
for (i = 0, l = nodes.length; i < l; i++) {
found.push(nodes[i]);
if (single) return true;
}
}
else {
nodes = all("*", element);
for (i = 0, l = nodes.length; i < l; i++) {
if (pushIfMatch(nodes[i]) && single) {
return true;
}
}
}
}
},
query: function query(selector, context) {
/// <summary>Queries the DOM for a set of DOM elements.</summary>
/// <validationOptions enabled="false" />
/// <param name="selector">Selector for a set of DOM elements based on
id (#&lt;id>), class (.&lt;name>), or tag name (&lt;tagname>). Also supports an
array of DOM elements or selectors. More complex selectors may be used if jQuery is
loaded.</param>
/// <param name="context" optional="true" mayBeNull="true">A DOM
element (exclusive), array of DOM elements (inclusive), or other Sys.ElementSet or
Sys.UI.TemplateContext (exclusive) to restrict the search within.</param>
/// <returns type="Sys.ElementSet">An object representing the set of
matching elements.</returns>
return new Sys.ElementSet(selector, context);
},
get: function get(selector, context) {
/// <summary>Queries the DOM for a single DOM element.</summary>
/// <validationOptions enabled="false" />
/// <param name="selector">
/// Selector for a DOM element based on id (#&lt;id>), class
(.&lt;name>), or tag name (&lt;tagname>). More complex selectors may be used if
jQuery is loaded.
/// If multiple elements match the selector, the first one is returned.
/// </param>
/// <param name="context" optional="true" mayBeNull="true">An element,
array of elements, or Sys.UI.TemplateContext to restrict the query within.</param>
/// <returns>The matching element, or null if none match.</returns>
return (context && typeof(context.get) === "function") ?
context.get(selector) :
this._find(selector, context, true);
},
_find: function _find(selector, context, single, filter) {
var found = [],
selectors;
if (typeof(selector) === "string") {
selectors = [selector];
}
else {
selectors = selector;
}
var includeSelf = context instanceof Array,
simpleNonTag = /^([\$#\.])((\w|[$:\.\-])+)$/,
tag = /^((\w+)|\*)$/;
if ((typeof(context) === "string") || (context instanceof Array)) {
context = Sys._find(context);
}
if (context instanceof Sys.ElementSet) {
context = context.get();
}
foreach(selectors, function(selector) {
if (typeof(selector) !== "string") {
if (filter) {
if (contains(context, selector)) {
found.push(selector);
}
}
else {
found.push(selector);
}
}
else {
var match = simpleNonTag.exec(selector);
if (match && match.length === 4) {
selector = match[2];
var type = match[1];
if (type === "$") {
Sys._getComponent(found, selector, context);
}
else {
var finder = type === "#" ? Sys._getById :
Sys._getByClass;
if (context) {
foreach(context, function(node) {
if (node.nodeType === 1) {
return finder(found, selector, single,
includeSelf, node, filter);
}
});
}
else {
finder(found, selector, single);
}
}
}
else if (tag.test(selector)) {
if (context instanceof Array) {
foreach(context, function(node) {
if (node.nodeType === 1) {
if (includeSelf && (selector === "*" ||
(node.tagName.toLowerCase() === selector))) {
found.push(node);
if (single) return true;
}
if (!filter) {
if(!foreach(all(selector, node),
function(node) {
found.push(node);
if (single) return true;
})) {
return true;
}
}
}
});
}
else {
var nodes = all(selector, context);
if (single) {
if (nodes[0]) {
found.push(nodes[0]);
}
return true;
}
foreach(nodes, function(node) {
found.push(node);
});
}
}
else if (window.jQuery) {
if (!filter) {
found.push.apply(found, jQuery(selector,
context).get());
}
if (includeSelf) {
found.push.apply(found,
jQuery(context).filter(selector).get());
}
}
}
});
return found.length ? (single ? (found[0] || null) : found) : null;
},
onDomReady: function onDomReady(callback) {
/// <summary>Registers a function to be called when the DOM is
ready.</summary>
/// <validationOptions enabled="false" />
/// <param name="callback" type="Function"></param>
lazypush(this, "_domReadyQueue", callback);
raiseDomReady();
},
onReady: function onReady(callback) {
/// <summary>Registers a function to be called when the DOM is ready
and when all required resources have been loaded.</summary>
/// <validationOptions enabled="false" />
/// <param name="callback" type="Function"></param>
lazypush(this, "_readyQueue", callback);
raiseOnReady();
},
_set: function(instance, properties) {
forIn(properties, function(value, field) {
callIf(instance, "add_" + field, value) ||
callIf(instance, "set_" + field, value) ||
(instance[field] = value);
});
}
});

Sys._getComponent = Sys._getComponent || function() { }

Sys._2Pass = Sys._2Pass || function _2Pass(callback) {


foreach(callback, function(c) { c(); });
}

var obj;
if (!Sys.ElementSet) {
obj = Sys.ElementSet = function(selector, context) {
/// <summary>Represents a set of DOM elements.</summary>
/// <param name="selector">The DOM selector, array of DOM selectors, or array
of DOM elements to query the document for.</param>
/// <param name="context">A DOM selector (exclusive), A DOM element
(exclusive), array of DOM elements (inclusive), or other Sys.ElementSet (exclusive)
to restrict the search within.</param>
this._elements = ((typeof(context) === "object") && typeof(context.query) ===
"function") ?
context.query(selector).get() :
Sys._find(selector, context) || [];
}
obj.prototype = {
__class: true,
components: function(type, index) {
/// <summary>Gets the set of controls and behaviors associated with the
current DOM elements.</summary>
/// <param name="type" type="Function" mayBeNull="true"
optional="true">Type to limit the search to.</param>
/// <param name="index" type="Number" mayBeNull="true"
optional="true">Index of the component to limit to.</param>
/// <returns type="Sys.ComponentSet" />
var elementSet = new Sys.ElementSet(this.get());
return new Sys.ComponentSet(elementSet, type, index);
},
component: function(type, index) {
/// <summary>Get the first control or behavior associated with the current
set of DOM elements.</summary>
/// <param name="type" type="Function" mayBeNull="true"
optional="true">Type to limit the search to.</param>
/// <param name="index" type="Number" mayBeNull="true"
optional="true">Index of the component to return.</param>
/// <returns type="Object" mayBeNull="true" />
return this.components(type, index).get(0);
},
each: function(callback) {
/// <summary>Enumerates all the matched elements, calling the given
callback for each with the current element as the context.
/// The callback may return false to cancel enumeration.</summary>
/// <returns type="Sys.ElementSet"/>
var elements = this._elements;
for (var i = 0, l = elements.length; i < l; i++) {
if (callback.call(elements[i], i) === false) break;
}
return this;
},
get: function(index) {
/// <summary>Retrieves the element at the specified index.</summary>
/// <param name="index" type="Number">The index of the element to retrieve.
Omit to return all elements as an array.</param>
/// <returns isDomElement="true">The element at the given index, or an
array of all the matched elements.</returns>
var elements = this._elements;
return (typeof(index) === "undefined") ? (Array.apply(null, elements)) :
(elements[index] || null);
},
find: function(selector) {
/// <summary>Searches the current set of DOM elements with the given
selector, including descendents.</summary>
/// <param name="selector">DOM selector or array of DOM selectors to search
with.</param>
/// <returns type="Sys.ElementSet">A new element set with the matched
elements.</returns>
return new Sys.ElementSet(selector, this);
},
filter: function(selector) {
/// <summary>Filters the current set of DOM elements by the given selector,
excluding descendents.</summary>
/// <param name="selector">DOM selector or array of elements to filter
by.</param>
/// <returns type="Sys.ElementSet">A new element set with the matched
elements.</returns>
return new Sys.ElementSet(Sys._find(selector, this._elements, false,
true));
}
}
}
if (!Sys.ComponentSet) {
obj = Sys.ComponentSet = function ComponentSet(elementSet, query, index) {
/// <summary></summary>
/// <param name="elementSet" type="Sys.ElementSet" mayBeNull="true"
optional="true"></param>
/// <param name="query" mayBeNull="true" optional="true">The type of component
to filter by, or an array of components to include.</param>
/// <param name="index" type="Number" mayBeNull="true" optional="true">The
index of the component to retrieve from the filtered list.</param>
this._elementSet = elementSet || (elementSet = new Sys.ElementSet());
this._components = this._execute(elementSet, query, index);
}
obj.prototype = {
__class: true,
setProperties: function ComponentSet$setProperties(properties) {
/// <summary>Sets properties on the matched components.</summary>
/// <param name="properties" type="Object" mayBeNull="false">Object with
the names and values of the properties to set.</param>
/// <returns type="Sys.ComponentSet" />
return this.each(function() {
Sys._set(this, properties);
});
},
get: function ComponentSet$get(index) {
/// <summary>Returns the component at the specified index, or an array of
all matches if not specified.</summary>
/// <param name="index" type="Number" mayBeNull="true"
optional="true"></param>
/// <returns type="Object" mayBeNull="true"/>
var components = this._components;
return (typeof(index) === "undefined") ? (Array.apply(null, components)) :
(components[index || 0] || null);
},
each: function ComponentSet$each(callback) {
/// <summary>Enumerate all the found components. The index of the component
are passed as parameters to a callback. You may return 'false' to cancel the
enumeration.</summary>
/// <param name="callback" type="Function" mayBeNull="false">Function
called for each component.</param>
/// <returns type="Sys.ComponentSet" />
foreach(this._components, function(c, i) {
if (callback.call(c, i) === false) {
return true;
}
});
return this;
},
elements: function ComponentSet$elements() {
/// <summary>Returns the underlying set of elements this component
collection came from.</summary>
/// <returns type="Sys.ElementSet" />
return this._elementSet;
},
_execute: function ComponentSet$_execute(elementSet, query, index) {
var components = [];
function match(c) {
var ctor;
return (c instanceof query) ||
((ctor = c.constructor) && (
(ctor === query) ||
(ctor.inheritsFrom && ctor.inheritsFrom(query)) ||
(ctor.implementsInterface &&
ctor.implementsInterface(query))));
}
if (query instanceof Array) {
components.push.apply(components, query);
}
else {
elementSet.each(function() {
var c = this.control;
if (c && (!query || match(c))) {
components.push(c);
}
foreach(this._behaviors, function(b) {
if (!query || match(b)) {
components.push(b);
}
});
});
}
if ((typeof(index) !== "undefined")) {
if (components[index]) {
components = [components[index]];
}
else {
components = [];
}
}
return components;
}
}
}

obj = null;
}
var getCreate = function _getCreate(options, isPlugin) {
var body = [],
arglist = [],
type = options.type,
typeName = options.typeName || (type ? type.getName() : ""),
isBehavior = options._isBehavior,
description = (options && options.description) ||
(type && ("Creates an instance of the type '" + typeName
+ "' and sets the given properties.")) ||
"";
body.push("/// <summary>", description, "</summary>\n");
foreach(options && options.parameters, function(parameter) {
var name = parameter, type = '', desc = '';
if (typeof(parameter) !== "string") {
name = parameter.name;
type = parameter.type||'';
desc = parameter.description||'';
}
arglist.push(name);
body.push('/// <param name="', name, '"');
if (type) {
body.push(' type="', type, '"');
}
body.push('>', desc, '</param>\n');
});
var returnType;
if (!isPlugin) {
arglist.push("properties");
body.push('/// <param name="properties" type="Object" mayBeNull="true"
optional="true">Additional properties to set on the component.</param>\n');
returnType = isBehavior ? 'Sys.ComponentSet' : typeName;
}
else {
returnType = options.returnType;
}
if (returnType) {
body.push('/// <returns type="', returnType, '" />\n');
}
if (isPlugin) {
body.push('return Sys.plugins["', options.name, '"].plugin.apply(this,
arguments);');
}
else {
body.push('return Sys._createComp.call(this,
arguments.callee._component, arguments.callee._component.defaults, arguments);');
}
arglist.push(body.join(''));

var fn = Function.apply(null, arglist);


if (!isPlugin) {
fn._component = options;
}
return fn;

}
Sys._getCreate = getCreate;

function execute() {

var $type, $prototype;


Sys._foreach = foreach;
Sys._forIn = forIn;
Sys._merge = merge;
Sys._callIf = callIf;

$type = Function;
$type.__typeName = 'Function';
$type.__class = true;

$type.createCallback = function Function$createCallback(method, context) {


/// <summary locid="M:J#Function.createCallback">Creates a callback function
that retains the parameter initially used during its creation. The callback is
used without parameter but this will call the actual method with the parameter.
This is especially useful when setting up a handler for a DOM event that must
retain a parameter despite the DOM event handler needing to be a function with
the event object as the only parameter. In this case, the function will be called
with the event as the first parameter and the context as the second. If the
callback is called with an arbitrary list of parameters, the context is
appended.</summary>
/// <param name="method" type="Function">The function for which the callback is
created.</param>
/// <param name="context" mayBeNull="true">The parameter for the
function.</param>
/// <returns type="Function">The callback function.</returns>
var e = Function._validateParams(arguments, [
{name: "method", type: Function},
{name: "context", mayBeNull: true}
]);
if (e) throw e;

return function() {
var l = arguments.length;
if (l > 0) {
var args = [];
for (var i = 0; i < l; i++) {
args[i] = arguments[i];
}
args[l] = context;
return method.apply(this, args);
}
return method.call(this, context);
}
}

$type.createDelegate = function Function$createDelegate(instance, method) {


/// <summary locid="M:J#Function.createDelegate">Creates a delegate function
that retains the context from its creation (i.e. what 'this' means from within
its scope). This is especially useful when setting up an event handler to point
to an object method that needs to use the 'this' pointer from within its
scope.</summary>
/// <param name="instance" mayBeNull="true">The object instance that will be
the context for the function (i.e. what 'this' means from within its
scope).</param>
/// <param name="method" type="Function">The function from which the delegate
is created.</param>
/// <returns type="Function">The delegate function.</returns>
var e = Function._validateParams(arguments, [
{name: "instance", mayBeNull: true},
{name: "method", type: Function}
]);
if (e) throw e;

return function() {
return method.apply(instance, arguments);
}
}

$type.emptyFunction = $type.emptyMethod = function Function$emptyMethod() {


/// <summary locid="M:J#Function.emptyMethod">A function that does
nothing.</summary>
}

$type.validateParameters = function Function$validateParameters(parameters,


expectedParameters, validateParameterCount) {
/// <summary locid="M:J#Function.validateParameters">Validates the parameters
to a method are as expected.</summary>
/// <param name="parameters"></param>
/// <param name="expectedParameters"></param>
/// <param name="validateParameterCount" type="Boolean" optional="true"
mayBeNull="true">True if extra parameters are prohibited, false if they should be
ignored. The default is true.</param>
/// <returns type="Error" mayBeNull="true"></returns>
var e = Function._validateParams(arguments, [
{name: "parameters"},
{name: "expectedParameters"},
{name: "validateParameterCount", type: Boolean, mayBeNull: true, optional:
true}
]);
if (e) throw e;
return Function._validateParams(parameters, expectedParameters,
validateParameterCount);
}

$type._validateParams = function Function$_validateParams(params, expectedParams,


validateParameterCount) {
var e, expectedLength = expectedParams.length;
validateParameterCount = validateParameterCount !== false;
e = Function._validateParameterCount(params, expectedParams,
validateParameterCount);
if (e) {
e.popStackFrame();
return e;
}
for (var i = 0, l = params.length; i < l; i++) {
var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
paramName = expectedParam.name;
if (expectedParam.parameterArray) {
paramName += "[" + (i - expectedLength + 1) + "]";
}
else if (!validateParameterCount && (i >= expectedLength)) {
break;
}
e = Function._validateParameter(params[i], expectedParam, paramName);
if (e) {
e.popStackFrame();
return e;
}
}
return null;
}

$type._validateParameterCount = function Function$_validateParameterCount(params,


expectedParams, validateParameterCount) {
var i, error,
expectedLen = expectedParams.length,
actualLen = params.length;
if (actualLen < expectedLen) {
var minParams = expectedLen;
for (i = 0; i < expectedLen; i++) {
var param = expectedParams[i];
if (param.optional || param.parameterArray) {
minParams--;
}
}
if (actualLen < minParams) {
error = true;
}
}
else if (validateParameterCount && (actualLen > expectedLen)) {
error = true;
for (i = 0; i < expectedLen; i++) {
if (expectedParams[i].parameterArray) {
error = false;
break;
}
}
}

if (error) {
var e = Error.parameterCount();
e.popStackFrame();
return e;
}

return null;
}

$type._validateParameter = function Function$_validateParameter(param,


expectedParam, paramName) {
var e,
expectedType = expectedParam.type,
expectedInteger = !!expectedParam.integer,
expectedDomElement = !!expectedParam.domElement,
mayBeNull = !!expectedParam.mayBeNull;

e = Function._validateParameterType(param, expectedType, expectedInteger,


expectedDomElement, mayBeNull, paramName);
if (e) {
e.popStackFrame();
return e;
}

var expectedElementType = expectedParam.elementType,


elementMayBeNull = !!expectedParam.elementMayBeNull;
if (expectedType === Array && typeof(param) !== "undefined" && param !== null
&&
(expectedElementType || !elementMayBeNull)) {
var expectedElementInteger = !!expectedParam.elementInteger,
expectedElementDomElement = !!expectedParam.elementDomElement;
for (var i=0; i < param.length; i++) {
var elem = param[i];
e = Function._validateParameterType(elem, expectedElementType,
expectedElementInteger, expectedElementDomElement,
elementMayBeNull,
paramName + "[" + i + "]");
if (e) {
e.popStackFrame();
return e;
}
}
}

return null;
}

$type._validateParameterType = function Function$_validateParameterType(param,


expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
var e, i;

if (typeof(param) === "undefined" || param === null) {


if (mayBeNull) {
return null;
}
e = param === null ? Error.argumentNull(paramName) :
Error.argumentUndefined(paramName);
e.popStackFrame();
return e;
}

if (expectedType && expectedType.__enum) {


if (typeof(param) !== 'number') {
e = Error.argumentType(paramName, Object.getType(param), expectedType);
e.popStackFrame();
return e;
}
if ((param % 1) === 0) {
var values = expectedType.prototype;
if (!expectedType.__flags || (param === 0)) {
for (i in values) {
if (values[i] === param) return null;
}
}
else {
var v = param;
for (i in values) {
var vali = values[i];
if (vali === 0) continue;
if ((vali & param) === vali) {
v -= vali;
}
if (v === 0) return null;
}
}
}
e = Error.argumentOutOfRange(paramName, param,
String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
e.popStackFrame();
return e;
}

if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType ===


3))) {
e = Error.argument(paramName, Sys.Res.argumentDomElement);
e.popStackFrame();
return e;
}

if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {


e = Error.argumentType(paramName, Object.getType(param), expectedType);
e.popStackFrame();
return e;
}

if (expectedType === Number && expectedInteger) {


if ((param % 1) !== 0) {
e = Error.argumentOutOfRange(paramName, param,
Sys.Res.argumentInteger);
e.popStackFrame();
return e;
}
}

return null;
}
$type = Error;
$type.__typeName = 'Error';
$type.__class = true;

Sys._errorArgument = function(kind, paramName, message) {


var name = "Sys.Argument" + kind + "Exception";
var displayMessage = name + ": " + (message || Sys.Res["argument"+kind]);
if (paramName) {
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
}

var err = Error.create(displayMessage, { name: name, paramName: paramName });


err.popStackFrame();
err.popStackFrame();
return err;
}

Sys._error = function(kind, message, defaultMessage) {


var name = "Sys." + kind + "Exception";
var displayMessage = name + ": " + (message || Sys.Res[defaultMessage]);
var err = Error.create(displayMessage, {name: name});
err.popStackFrame();
err.popStackFrame();
return err;
}

$type.create = function Error$create(message, errorInfo) {


/// <summary locid="M:J#Error.create">Use this method to create a new
error.</summary>
/// <param name="message" type="String" optional="true" mayBeNull="true">The
error message.</param>
/// <param name="errorInfo" optional="true" mayBeNull="true">A plain JavaScript
object that contains extended information about the error. The object should have
a 'name' field that contains a string that identifies the error and any
additional fields that are necessary to fully describe the error.</param>
/// <returns type="Error">An Error object.</returns>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true, optional: true},
{name: "errorInfo", mayBeNull: true, optional: true}
]);
if (e) throw e;

var err = new Error(message);


err.message = message;

if (errorInfo) {
for (var v in errorInfo) {
err[v] = errorInfo[v];
}
}

err.popStackFrame();
return err;
}

$type.argument = function Error$argument(paramName, message) {


/// <summary locid="M:J#Error.argument">Creates an ArgumentException with a
specified error message and the name of the parameter that caused this
exception.</summary>
/// <param name="paramName" type="String" optional="true" mayBeNull="true">The
name of the parameter that caused the exception.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents an ArgumentException.</returns>
var e = Function._validateParams(arguments, [
{name: "paramName", type: String, mayBeNull: true, optional: true},
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._errorArgument("", paramName, message);
}

$type.argumentNull = function Error$argumentNull(paramName, message) {


/// <summary locid="M:J#Error.argumentNull">Creates an ArgumentNullException
with a specified error message and the name of the parameter that caused this
exception.</summary>
/// <param name="paramName" type="String" optional="true" mayBeNull="true">The
name of the parameter that caused the exception.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents an
ArgumentNullException.</returns>
var e = Function._validateParams(arguments, [
{name: "paramName", type: String, mayBeNull: true, optional: true},
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._errorArgument("Null", paramName, message);
}

$type.argumentOutOfRange = function Error$argumentOutOfRange(paramName,


actualValue, message) {
/// <summary locid="M:J#Error.argumentOutOfRange">Creates an
ArgumentOutOfRangeException with a specified error message and the name and
actual value of the parameter that caused this exception.</summary>
/// <param name="paramName" type="String" optional="true" mayBeNull="true">The
name of the parameter that caused the exception.</param>
/// <param name="actualValue" optional="true" mayBeNull="true">The actual value
of the parameter.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents an
ArgumentOutOfRangeException.</returns>
var e = Function._validateParams(arguments, [
{name: "paramName", type: String, mayBeNull: true, optional: true},
{name: "actualValue", mayBeNull: true, optional: true},
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;

var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ||


Sys.Res.argumentOutOfRange);
if (paramName) {
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
}

if (typeof(actualValue) !== "undefined" && actualValue !== null) {


displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
}

var err = Error.create(displayMessage, {


name: "Sys.ArgumentOutOfRangeException",
paramName: paramName,
actualValue: actualValue
});
err.popStackFrame();
return err;
}

$type.argumentType = function Error$argumentType(paramName, actualType,


expectedType, message) {
/// <summary locid="M:J#Error.argumentType">Creates an ArgumentTypeException
with a specified error message and the name, actual type, and expected type of
the parameter that caused this exception.</summary>
/// <param name="paramName" type="String" optional="true" mayBeNull="true">The
name of the parameter that caused the exception.</param>
/// <param name="actualType" type="Type" optional="true" mayBeNull="true">The
actual type of the parameter value.</param>
/// <param name="expectedType" type="Type" optional="true" mayBeNull="true">The
expected type of the parameter value.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents an
ArgumentTypeException.</returns>
var e = Function._validateParams(arguments, [
{name: "paramName", type: String, mayBeNull: true, optional: true},
{name: "actualType", type: Type, mayBeNull: true, optional: true},
{name: "expectedType", type: Type, mayBeNull: true, optional: true},
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;

var displayMessage = "Sys.ArgumentTypeException: ";


if (message) {
displayMessage += message;
}
else if (actualType && expectedType) {
displayMessage +=
String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(),
expectedType.getName());
}
else {
displayMessage += Sys.Res.argumentType;
}

if (paramName) {
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
}

var err = Error.create(displayMessage, {


name: "Sys.ArgumentTypeException",
paramName: paramName,
actualType: actualType,
expectedType: expectedType
});
err.popStackFrame();
return err;
}

$type.argumentUndefined = function Error$argumentUndefined(paramName, message) {


/// <summary locid="M:J#Error.argumentUndefined">Creates an
ArgumentUndefinedException with a specified error message and the name of the
parameter that caused this exception.</summary>
/// <param name="paramName" type="String" optional="true" mayBeNull="true">The
name of the parameter that caused the exception.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents an
ArgumentUndefinedException.</returns>
var e = Function._validateParams(arguments, [
{name: "paramName", type: String, mayBeNull: true, optional: true},
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._errorArgument("Undefined", paramName, message);
}

$type.format = function Error$format(message) {


/// <summary locid="M:J#Error.format">Creates a format error.</summary>
/// <param name="message" type="String" optional="true" mayBeNull="true">The
error message.</param>
/// <returns>An Error object that represents a FormatException.</returns>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._error("Format", message, "format");
}

$type.invalidOperation = function Error$invalidOperation(message) {


/// <summary locid="M:J#Error.invalidOperation">Creates an invalid operation
error.</summary>
/// <param name="message" type="String" optional="true" mayBeNull="true">The
error message.</param>
/// <returns>An Error instance that represents an
InvalidOperationException.</returns>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._error("InvalidOperation", message, "invalidOperation");
}

$type.notImplemented = function Error$notImplemented(message) {


/// <summary locid="M:J#Error.notImplemented">Creates a not implemented
error.</summary>
/// <param name="message" type="String" optional="true" mayBeNull="true">The
error message.</param>
/// <returns>An Error instance that represents a
NotImplementedException.</returns>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._error("NotImplemented", message, "notImplemented");
}

$type.parameterCount = function Error$parameterCount(message) {


/// <summary locid="M:J#Error.parameterCount">Creates a ParameterCountException
with a specified error message.</summary>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message that describes the error.</param>
/// <returns>An Error instance that represents a
ParameterCountException.</returns>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
return Sys._error("ParameterCount", message, "parameterCount");
}

$type.prototype.popStackFrame = function Error$popStackFrame() {


/// <summary locid="M:J#checkParam">Updates the fileName and lineNumber fields
based on the next frame in the stack trace. Call this method whenever an instance
of Error is returned from a function. This makes the fileName and lineNumber
reported in the FireFox console point to the location where the exception was
thrown, not the location where the instance of Error was created.</summary>
if (arguments.length !== 0) throw Error.parameterCount();

if (typeof(this.stack) === "undefined" || this.stack === null ||


typeof(this.fileName) === "undefined" || this.fileName === null ||
typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
return;
}

var stackFrames = this.stack.split("\n");

var currentFrame = stackFrames[0];


var pattern = this.fileName + ":" + this.lineNumber;
while(typeof(currentFrame) !== "undefined" &&
currentFrame !== null &&
currentFrame.indexOf(pattern) < 0) {
stackFrames.shift();
currentFrame = stackFrames[0];
}

var nextFrame = stackFrames[1];

if (typeof(nextFrame) === "undefined" || nextFrame === null) {


return;
}

var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);


if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
return;
}

this.fileName = nextFrameParts[1];

this.lineNumber = parseInt(nextFrameParts[2]);

stackFrames.shift();
this.stack = stackFrames.join("\n");
}
$type = Object;
$type.__typeName = 'Object';
$type.__class = true;

$type.getType = function Object$getType(instance) {


/// <summary locid="M:J#Object.getType"></summary>
/// <param name="instance">The object for which the type must be
returned.</param>
/// <returns type="Type">The type of the object.</returns>
var e = Function._validateParams(arguments, [
{name: "instance"}
]);
if (e) throw e;
var ctor = instance.constructor;
if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName ||
(ctor.__typeName === 'Object')) {
return Object;
}
return ctor;
}

$type.getTypeName = function Object$getTypeName(instance) {


/// <summary locid="M:J#Object.getTypeName"></summary>
/// <param name="instance">The object for which the type name must be
returned.</param>
/// <returns type="String">The name of the type of the object.</returns>
var e = Function._validateParams(arguments, [
{name: "instance"}
]);
if (e) throw e;
return Object.getType(instance).getName();
}
$type = String;
$type.__typeName = 'String';
$type.__class = true;
$prototype = $type.prototype;
$prototype.endsWith = function String$endsWith(suffix) {
/// <summary locid="M:J#String.endsWith">Determines whether the end of this
instance matches the specified string.</summary>
/// <param name="suffix" type="String">A string to compare to.</param>
/// <returns type="Boolean">true if suffix matches the end of this instance;
otherwise, false.</returns>
var e = Function._validateParams(arguments, [
{name: "suffix", type: String}
]);
if (e) throw e;
return (this.substr(this.length - suffix.length) === suffix);
}

$prototype.startsWith = function String$startsWith(prefix) {


/// <summary locid="M:J#String.startsWith">Determines whether the beginning of
this instance matches the specified string.</summary>
/// <param name="prefix" type="String">The String to compare.</param>
/// <returns type="Boolean">true if prefix matches the beginning of this
string; otherwise, false.</returns>
var e = Function._validateParams(arguments, [
{name: "prefix", type: String}
]);
if (e) throw e;
return (this.substr(0, prefix.length) === prefix);
}

$prototype.trim = function String$trim() {


/// <summary locid="M:J#String.trim">Removes all leading and trailing white-
space characters from the current String object.</summary>
/// <returns type="String">The string that remains after all white-space
characters are removed from the start and end of the current String
object.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return this.replace(/^\s+|\s+$/g, '');
}

$prototype.trimEnd = function String$trimEnd() {


/// <summary locid="M:J#String.trimEnd">Removes all trailing white spaces from
the current String object.</summary>
/// <returns type="String">The string that remains after all white-space
characters are removed from the end of the current String object.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return this.replace(/\s+$/, '');
}

$prototype.trimStart = function String$trimStart() {


/// <summary locid="M:J#String.trimStart">Removes all leading white spaces from
the current String object.</summary>
/// <returns type="String">The string that remains after all white-space
characters are removed from the start of the current String object.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return this.replace(/^\s+/, '');
}

$type.format = function String$format(format, args) {


/// <summary locid="M:J#String.format">Replaces the format items in a specified
String with the text equivalents of the values of corresponding object instances.
The invariant culture will be used to format dates and numbers.</summary>
/// <param name="format" type="String">A format string.</param>
/// <param name="args" parameterArray="true" mayBeNull="true">The objects to
format.</param>
/// <returns type="String">A copy of format in which the format items have been
replaced by the string equivalent of the corresponding instances of object
arguments.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String},
{name: "args", mayBeNull: true, parameterArray: true}
]);
if (e) throw e;
return String._toFormattedString(false, arguments);
}

$type._toFormattedString = function String$_toFormattedString(useLocale, args) {


var result = '';
var format = args[0];

for (var i=0;;) {


var open = format.indexOf('{', i);
var close = format.indexOf('}', i);
if ((open < 0) && (close < 0)) {
result += format.slice(i);
break;
}
if ((close > 0) && ((close < open) || (open < 0))) {
if (format.charAt(close + 1) !== '}') {
throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
}
result += format.slice(i, close + 1);
i = close + 2;
continue;
}

result += format.slice(i, open);


i = open + 1;

if (format.charAt(i) === '{') {


result += '{';
i++;
continue;
}

if (close < 0) throw Error.argument('format',


Sys.Res.stringFormatBraceMismatch);

var brace = format.substring(i, close);


var colonIndex = brace.indexOf(':');
var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0,
colonIndex), 10) + 1;
if (isNaN(argNumber)) throw Error.argument('format',
Sys.Res.stringFormatInvalid);
var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);

var arg = args[argNumber];


if (typeof(arg) === "undefined" || arg === null) {
arg = '';
}
if (arg.toFormattedString) {
result += arg.toFormattedString(argFormat);
}
else if (useLocale && arg.localeFormat) {
result += arg.localeFormat(argFormat);
}
else if (arg.format) {
result += arg.format(argFormat);
}
else
result += arg.toString();

i = close + 1;
}

return result;
}
$type = Boolean;
$type.__typeName = 'Boolean';
$type.__class = true;

$type.parse = function Boolean$parse(value) {


/// <summary locid="M:J#Boolean.parse">Creates a bool from its string
representation.</summary>
/// <param name="value" type="String">"true" or "false".</param>
/// <returns type="Boolean"></returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String}
], false);
if (e) throw e;
var v = value.trim().toLowerCase(),
r;
if (v === 'false') {
r = false;
}
else if (v === 'true') {
r = true;
}
else {
throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
}
return r;
}
$type = Date;
$type.__typeName = 'Date';
$type.__class = true;
$type = Number;
$type.__typeName = 'Number';
$type.__class = true;
$type = RegExp;
$type.__typeName = 'RegExp';
$type.__class = true;
if (!window) this.window = this;

window.Type = $type = Function;

$type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]


{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\
s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
$type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\
r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");

$prototype = $type.prototype;
$prototype.callBaseMethod = function Type$callBaseMethod(instance, name,
baseArguments) {
/// <summary locid="M:J#Type.callBaseMethod"></summary>
/// <param name="instance">The instance for the base method. Usually
'this'.</param>
/// <param name="name" type="String">The name of the base method.</param>
/// <param name="baseArguments" type="Array" optional="true" mayBeNull="true"
elementMayBeNull="true">The arguments to pass to the base method.</param>
/// <returns>The return value of the base method.</returns>
var e = Function._validateParams(arguments, [
{name: "instance"},
{name: "name", type: String},
{name: "baseArguments", type: Array, mayBeNull: true, optional: true,
elementMayBeNull: true}
]);
if (e) throw e;
var baseMethod = Sys._getBaseMethod(this, instance, name);
if (!baseMethod) throw
Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
return baseArguments ? baseMethod.apply(instance, baseArguments) :
baseMethod.apply(instance);
}

$prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {


/// <summary locid="M:J#Type.getBaseMethod">Use this method to get the base
implementation of a method from the base class.</summary>
/// <param name="instance">The instance for which the base method is needed.
Usually 'this'.</param>
/// <param name="name" type="String">The name of the method to get.</param>
/// <returns type="Function" mayBeNull="true">The base method.</returns>
var e = Function._validateParams(arguments, [
{name: "instance"},
{name: "name", type: String}
]);
if (e) throw e;
return Sys._getBaseMethod(this, instance, name);
}

$prototype.getBaseType = function Type$getBaseType() {


/// <summary locid="M:J#Type.getBaseType"></summary>
/// <returns type="Type" mayBeNull="true">The base type.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
}

$prototype.getInterfaces = function Type$getInterfaces() {


/// <summary locid="M:J#Type.getInterfaces"></summary>
/// <returns type="Array" elementType="Type" mayBeNull="false"
elementMayBeNull="false">A copy of the list of interfaces that the type
implements.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
var result = [];
var type = this;
while(type) {
var interfaces = type.__interfaces;
if (interfaces) {
for (var i = 0, l = interfaces.length; i < l; i++) {
var interfaceType = interfaces[i];
if (!Array.contains(result, interfaceType)) {
result.push(interfaceType);
}
}
}
type = type.__baseType;
}
return result;
}

$prototype.getName = function Type$getName() {


/// <summary locid="M:J#Type.getName"></summary>
/// <returns type="String">The name of the type.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
}

$prototype.implementsInterface = function Type$implementsInterface(interfaceType) {


/// <summary locid="M:J#Type.implementsInterface"></summary>
/// <param name="interfaceType" type="Type">The interface to test.</param>
/// <returns type="Boolean">True if the type implements the
interface.</returns>
var e = Function._validateParams(arguments, [
{name: "interfaceType", type: Type}
]);
if (e) throw e;
this.resolveInheritance();

var interfaceName = interfaceType.getName();


var cache = this.__interfaceCache;
if (cache) {
var cacheEntry = cache[interfaceName];
if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
}
else {
cache = this.__interfaceCache = {};
}

var baseType = this;


while (baseType) {
var interfaces = baseType.__interfaces;
if (interfaces && Array.indexOf(interfaces, interfaceType) !== -1) {
return cache[interfaceName] = true;
}

baseType = baseType.__baseType;
}

return cache[interfaceName] = false;


}

$prototype.inheritsFrom = function Type$inheritsFrom(parentType) {


/// <summary locid="M:J#Type.inheritsFrom"></summary>
/// <param name="parentType" type="Type">The type to test.</param>
/// <returns type="Boolean">True if the type inherits from
parentType.</returns>
var e = Function._validateParams(arguments, [
{name: "parentType", type: Type}
]);
if (e) throw e;
this.resolveInheritance();
return Sys._inheritsFrom(this, parentType);
}

Sys._inheritsFrom = function _inheritsFrom(type, parentType) {


var ret;
if (parentType) {
var baseType = type.__baseType;
while (baseType) {
if (baseType === parentType) {
ret = true;
break;
}
baseType = baseType.__baseType;
}
}
return !!ret;
}

$prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {


/// <summary locid="M:J#Type.initializeBase">This method initializes the base
type in the context of a given instance object (to keep track of the base type,
and to effectively inherit the object model of the base class, and initializing
members of the base class). This should be called from the derived class
constructor.</summary>
/// <param name="instance">The object to initialize base types for. Usually
'this'.</param>
/// <param name="baseArguments" type="Array" optional="true" mayBeNull="true"
elementMayBeNull="true">The arguments for the base constructor.</param>
/// <returns>The instance.</returns>
var e = Function._validateParams(arguments, [
{name: "instance"},
{name: "baseArguments", type: Array, mayBeNull: true, optional: true,
elementMayBeNull: true}
]);
if (e) throw e;
if (!Sys._isInstanceOfType(this, instance)) throw
Error.argumentType('instance', Object.getType(instance), this);

this.resolveInheritance();
var baseType = this.__baseType;
if (baseType) {
baseArguments ? baseType.apply(instance, baseArguments) :
baseType.apply(instance);
}

return instance;
}

$prototype.isImplementedBy = function Type$isImplementedBy(instance) {


/// <summary locid="M:J#Type.isImplementedBy"></summary>
/// <param name="instance" mayBeNull="true">The object on which the interface
must be tested.</param>
/// <returns type="Boolean">True if the instance implements the
interface.</returns>
var e = Function._validateParams(arguments, [
{name: "instance", mayBeNull: true}
]);
if (e) throw e;
if (typeof(instance) === "undefined" || instance === null) return false;

var instanceType = Object.getType(instance);


return !!(instanceType.implementsInterface &&
instanceType.implementsInterface(this));
}

$prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {


/// <summary locid="M:J#Type.isInstanceOfType"></summary>
/// <param name="instance" mayBeNull="true">The object on which the type must
be tested.</param>
/// <returns type="Boolean">True if the object is an instance of the type or
one of its derived types.</returns>
var e = Function._validateParams(arguments, [
{name: "instance", mayBeNull: true}
]);
if (e) throw e;
return Sys._isInstanceOfType(this, instance);
}

$prototype.registerClass = function Type$registerClass(typeName, baseType,


interfaceTypes) {
/// <summary locid="M:J#Type.registerClass">Registers a class (represented by
its ctor function), and optional base type, followed by any number of
interfaces.</summary>
/// <param name="typeName" type="String">The fully-qualified name of the
type.</param>
/// <param name="baseType" type="Type" optional="true" mayBeNull="true">The
base type.</param>
/// <param name="interfaceTypes" parameterArray="true" type="Type">One or
several interfaces that the type implements.</param>
/// <returns type="Type">The registered type.</returns>
var e = Function._validateParams(arguments, [
{name: "typeName", type: String},
{name: "baseType", type: Type, mayBeNull: true, optional: true},
{name: "interfaceTypes", type: Type, parameterArray: true}
]);
if (e) throw e;
if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw
Error.argument('typeName', Sys.Res.notATypeName);
var parsedName;
try {
parsedName = eval(typeName);
}
catch(e) {
throw Error.argument('typeName', Sys.Res.argumentTypeName);
}
if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
if (Sys.__registeredTypes[typeName]) throw
Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));

if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw


Error.argumentUndefined('baseType');
var prototype = this.prototype;
prototype.constructor = this;
this.__typeName = typeName;
this.__class = true;
if (baseType) {
this.__baseType = baseType;
this.__basePrototypePending = true;
}
Sys.__upperCaseTypes[typeName.toUpperCase()] = this;

if (interfaceTypes) {
var interfaces = this.__interfaces = [];
this.resolveInheritance();
for (var i = 2, l = arguments.length; i < l; i++) {
var interfaceType = arguments[i];
if (!interfaceType.__interface) throw Error.argument('interfaceTypes['
+ (i - 2) + ']', Sys.Res.notAnInterface);
for (var methodName in interfaceType.prototype) {
var method = interfaceType.prototype[methodName];
if (!prototype[methodName]) {
prototype[methodName] = method;
}
}
interfaces.push(interfaceType);
}
}
Sys.__registeredTypes[typeName] = true;
return this;
}

Sys.registerComponent = function registerComponent(type, options) {


/// <summary locid="M:J#Sys.registerComponent">Generates a create() function
for the given type using the optional description and parameters for
intellisense.</summary>
/// <param name="type" type="Function">The type to be created.</param>
/// <param name="options" type="Object" optional="true"
mayBeNull="true"></param>
var e = Function._validateParams(arguments, [
{name: "type", type: Function},
{name: "options", type: Object, mayBeNull: true, optional: true}
]);
if (e) throw e;
var typeName = type.getName();
var isControlOrBehavior = Sys.UI && (Sys._inheritsFrom(type, Sys.UI.Control) ||
Sys._inheritsFrom(type, Sys.UI.Behavior));
var name = (options && options.name);
if (!name) {
name = typeName;
var i = name.lastIndexOf('.');
if (i >= 0) {
name = name.substr(i+1);
if (name && name.charAt(0) === "_") return;
}
name = name.substr(0, 1).toLowerCase() + name.substr(1);
}
if (!options) {
options = {};
}
options.name = name;
options.type = type;
options.typeName = typeName;
options._isBehavior = isControlOrBehavior;

options = Sys.components[name] = merge(Sys.components[name], options);

var fn = Sys._getCreate(options),
target = isControlOrBehavior ? Sys.ElementSet.prototype : Sys.create;
target[name] = fn;
}

Sys.registerPlugin = function registerPlugin(pluginInfo) {


/// <summary locid="M:J#Sys.registerPlugin"></summary>
/// <param name="pluginInfo" type="Object">An object describing the plugin
(name, plugin, dom, global, components)</param>
var e = Function._validateParams(arguments, [
{name: "pluginInfo", type: Object}
]);
if (e) throw e;
var name = pluginInfo.name,
fnName = pluginInfo.functionName || name;
Sys.plugins[name] = merge(Sys.plugins[name], pluginInfo);
var plugin = pluginInfo.plugin,
sysTarget;
if (pluginInfo.global) {
sysTarget = Sys;
}
else if (pluginInfo.dom) {
sysTarget = Sys.ElementSet.prototype;
}
else if (pluginInfo.components) {
sysTarget = Sys.ComponentSet.prototype;
}
if (sysTarget) {
sysTarget[fnName] = Sys._getCreate(pluginInfo, true);
}
}

Sys._createComp = function _createComp(component, defaults, args) {


var type = component.type,
parameters = component.parameters || [],
isBehavior = component._isBehavior,
target = isBehavior ? args[0] : null;
var props = args[parameters.length] || {};
props = merge({}, defaults, props);
foreach(parameters, function(parameter, i) {
var name = typeof(parameter) === "string" ? parameter : parameter.name,
value = args[i];
if (typeof(value) !== "undefined" && typeof(props[name]) === "undefined") {
props[name] = value;
}
});
if (this instanceof Sys.ElementSet) {
var components = [];
this.each(function() {
components.push(Sys._create(type, props, this));
});
return new Sys.ComponentSet(this, components);
}
else {
return Sys._create(type, props);
}
}

Sys._create = function _create(type, properties, target) {


var targetType = typeof(target);
if (targetType === "string") {
target = Sys.get(target);
}
var instance;
Sys._2Pass(function() {
instance = targetType === "undefined" ? new type() : new type(target);
callIf(instance, "beginUpdate");
Sys._set(instance, properties);
var componentType = Sys.Component;
if (!componentType || !componentType._register(instance)) {
callIf(instance, "endUpdate") || callIf(instance, "initialize");
}
});
return instance;
}

$prototype.registerInterface = function Type$registerInterface(typeName) {


/// <summary locid="M:J#Type.registerInterface">Registers an interface
(represented by its ctor function).</summary>
/// <param name="typeName" type="String">The fully-qualified name of the
interface.</param>
/// <returns type="Type">The registered interface.</returns>
var e = Function._validateParams(arguments, [
{name: "typeName", type: String}
]);
if (e) throw e;
if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw
Error.argument('typeName', Sys.Res.notATypeName);
var parsedName;
try {
parsedName = eval(typeName);
}
catch(e) {
throw Error.argument('typeName', Sys.Res.argumentTypeName);
}
if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
if (Sys.__registeredTypes[typeName]) throw
Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
Sys.__upperCaseTypes[typeName.toUpperCase()] = this;

this.prototype.constructor = this;
this.__typeName = typeName;
this.__interface = true;
Sys.__registeredTypes[typeName] = true;

return this;
}

$prototype.resolveInheritance = function Type$resolveInheritance() {


/// <summary locid="M:J#Type.resolveInheritance">This method is called on the
ctor function instance. It does three things: 1. It stores __baseType as a property
of the constructor function 2. It copies members from the baseType's prototype into
the prototype associated with the type represented by this ctor, if this type
itself doesn't have the same member in its prototype, i.e., it doesn't override
the method. 3. It recurses up the inheritance chain to do the same for the base
type. Note that this logic runs only once per type, because it is based on true
value for __basePrototypePending property off the ctor function.</summary>
if (arguments.length !== 0) throw Error.parameterCount();

if (this.__basePrototypePending) {
var baseType = this.__baseType;

baseType.resolveInheritance();
var basePrototype = baseType.prototype,
thisPrototype = this.prototype;
for (var memberName in basePrototype) {
thisPrototype[memberName] = thisPrototype[memberName] ||
basePrototype[memberName];
}
delete this.__basePrototypePending;
}
}

$type.getRootNamespaces = function Type$getRootNamespaces() {


/// <summary locid="M:J#Type.getRootNamespaces"></summary>
/// <returns type="Array">Returns an array containing references to all the
root namespaces</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return Array.clone(Sys.__rootNamespaces);
}

$type.isClass = function Type$isClass(type) {


/// <summary locid="M:J#Type.isClass"></summary>
/// <param name="type" mayBeNull="true">The type to test.</param>
/// <returns type="Boolean">True if the type is a class.</returns>
var e = Function._validateParams(arguments, [
{name: "type", mayBeNull: true}
]);
if (e) throw e;
return !!(type && type.__class);
}

$type.isInterface = function Type$isInterface(type) {


/// <summary locid="M:J#Type.isInterface"></summary>
/// <param name="type" mayBeNull="true">The type to test.</param>
/// <returns type="Boolean">True if the type is an interface.</returns>
var e = Function._validateParams(arguments, [
{name: "type", mayBeNull: true}
]);
if (e) throw e;
return !!(type && type.__interface);
}

$type.isNamespace = function Type$isNamespace(object) {


/// <summary locid="M:J#Type.isNamespace"></summary>
/// <param name="object" mayBeNull="true">The type to test.</param>
/// <returns type="Boolean">True if the object is a namespace.</returns>
var e = Function._validateParams(arguments, [
{name: "object", mayBeNull: true}
]);
if (e) throw e;
return !!(object && object.__namespace);
}

$type.parse = function Type$parse(typeName, ns) {


/// <summary locid="M:J#Type.parse">If a namespace is specified, the type name
is searched for on this namespace in a case-insensitive way. If no namespace is
specified, the fully-qualified, case-sensitive type name must be
specified.</summary>
/// <param name="typeName" type="String" mayBeNull="true">The name of the
type.</param>
/// <param name="ns" optional="true" mayBeNull="true">The namespace where to
look for the type.</param>
/// <returns type="Type" mayBeNull="true">The type or null.</returns>
var e = Function._validateParams(arguments, [
{name: "typeName", type: String, mayBeNull: true},
{name: "ns", mayBeNull: true, optional: true}
]);
if (e) throw e;
var fn;
if (ns) {
fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' +
typeName.toUpperCase()];
return fn || null;
}
if (!typeName) return null;
var htClasses = Type.__htClasses;
if (!htClasses) {
Type.__htClasses = htClasses = {};
}
fn = htClasses[typeName];
if (!fn) {
fn = window.eval(typeName);
if (typeof(fn) !== 'function') throw Error.argument('typeName',
Sys.Res.notATypeName);
htClasses[typeName] = fn;
}
return fn;
}

$type.registerNamespace = function Type$registerNamespace(namespacePath) {


/// <summary locid="M:J#Type.registerNamespace">Creates a namespace.</summary>
/// <param name="namespacePath" type="String">The full path of the
namespace.</param>
var e = Function._validateParams(arguments, [
{name: "namespacePath", type: String}
]);
if (e) throw e;
Type._registerNamespace(namespacePath);
}
$type._registerNamespace = function Type$_registerNamespace(namespacePath) {
if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw
Error.argument('namespacePath', Sys.Res.invalidNameSpace);
var rootObject = window;
var namespaceParts = namespacePath.split('.');

for (var i = 0, l = namespaceParts.length; i < l; i++) {


var currentPart = namespaceParts[i];
var ns = rootObject[currentPart];
var nsType = typeof(ns);
if ((nsType !== "undefined") && (ns !== null)) {
if (nsType === "function") {
throw
Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass,
namespaceParts.splice(0, i + 1).join('.')));
}
if ((typeof(ns) !== "object") || (ns instanceof Array)) {
throw
Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject,
namespaceParts.splice(0, i + 1).join('.')));
}
}
if (!ns) {
ns = rootObject[currentPart] = {};
}
if (!ns.__namespace) {
if (!i && (namespacePath !== "Sys")) {
Sys.__rootNamespaces.push(ns);
}
ns.__namespace = true;
ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
var parsedName;
try {
parsedName = eval(ns.__typeName);
}
catch(e) {
parsedName = null;
}
if (parsedName !== ns) {
delete rootObject[currentPart];
throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
}
ns.getName = function ns$getName() {return this.__typeName;}
}
rootObject = ns;
}
}

$type._checkDependency = function Type$_checkDependency(dependency, featureName) {


var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!
scripts[dependency]) : false);
if ((typeof(featureName) !== 'undefined') && !isDependent) {
throw
Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
featureName, dependency));
}
return isDependent;
}

$type._registerScript = function Type$_registerScript(scriptName, dependencies) {


var scripts = Type._registerScript._scripts;
if (!scripts) {
Type._registerScript._scripts = scripts = {};
}
if (scripts[scriptName]) {
throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded,
scriptName));
}
scripts[scriptName] = true;
if (dependencies) {
for (var i = 0, l = dependencies.length; i < l; i++) {
var dependency = dependencies[i];
if (!Type._checkDependency(dependency)) {
throw
Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName,
dependency));
}
}
}
}

$type._registerNamespace("Sys");
Sys.__upperCaseTypes = {};
Sys.__rootNamespaces = [Sys];
Sys.__registeredTypes = {};

Sys._isInstanceOfType = function _isInstanceOfType(type, instance) {


if (typeof(instance) === "undefined" || instance === null) return false;
if (instance instanceof type) return true;
var instanceType = Object.getType(instance);
return !!(instanceType === type) ||
(instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
(instanceType.implementsInterface &&
instanceType.implementsInterface(type));
}

Sys._getBaseMethod = function _getBaseMethod(type, instance, name) {


if (!Sys._isInstanceOfType(type, instance)) throw
Error.argumentType('instance', Object.getType(instance), type);
var baseType = type.getBaseType();
if (baseType) {
var baseMethod = baseType.prototype[name];
return (baseMethod instanceof Function) ? baseMethod : null;
}
return null;
}

Sys._isDomElement = function _isDomElement(obj) {


var val = false;
if (typeof (obj.nodeType) !== 'number') {
var doc = obj.ownerDocument || obj.document || obj;
if (doc != obj) {
var w = doc.defaultView || doc.parentWindow;
val = (w != obj);
}
else {
val = !doc.body || !Sys._isDomElement(doc.body);
}
}
return !val;
}

var isBrowser = Sys._isBrowser = function _isBrowser(name) {


return Sys.Browser.agent === Sys.Browser[name];
}

foreach(Sys._ns, $type._registerNamespace);
delete Sys._ns;
$type = Array;
$type.__typeName = 'Array';
$type.__class = true;

var indexOf = Sys._indexOf = function _indexOf(array, item, start) {


if (typeof(item) === "undefined") return -1;
var length = array.length;
if (length !== 0) {
start = start - 0;
if (isNaN(start)) {
start = 0;
}
else {
if (isFinite(start)) {
start = start - (start % 1);
}
if (start < 0) {
start = Math.max(0, length + start);
}
}

for (var i = start; i < length; i++) {


if (array[i] === item) {
return i;
}
}
}
return -1;
}

$type.add = $type.enqueue = function Array$enqueue(array, item) {


/// <summary locid="M:J#Array.enqueue">Adds an element at the end of the
array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to add
to.</param>
/// <param name="item" mayBeNull="true">The object to add.</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
array[array.length] = item;
}

$type.addRange = function Array$addRange(array, items) {


/// <summary locid="M:J#Array.addRange">Adds a range of items at the end of the
array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to add
to.</param>
/// <param name="items" type="Array" elementMayBeNull="true">The array of items
to append.</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "items", type: Array, elementMayBeNull: true}
]);
if (e) throw e;

array.push.apply(array, items);
}
$type.clear = function Array$clear(array) {
/// <summary locid="M:J#Array.clear">Clears the array of its
elements.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
clear.</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true}
]);
if (e) throw e;
array.length = 0;
}

$type.clone = function Array$clone(array) {


/// <summary locid="M:J#Array.clone">Makes a clone of the array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
clone.</param>
/// <returns type="Array" elementMayBeNull="true">A clone of the
array.</returns>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true}
]);
if (e) throw e;
return array.length === 1 ? [array[0]] : Array.apply(null, array);
}

$type.contains = function Array$contains(array, item) {


/// <summary locid="M:J#Array.contains">Use this method to determine if an
array contains the specified element.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to look
into.</param>
/// <param name="item" mayBeNull="true">The object to find in the
array.</param>
/// <returns type="Boolean">True if the object was found.</returns>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
return (indexOf(array, item) >= 0);
}

$type.dequeue = function Array$dequeue(array) {


/// <summary locid="M:J#Array.dequeue"></summary>
/// <param name="array" type="Array" elementMayBeNull="true">Removes and
returns the object at the beginning of the array.</param>
/// <returns mayBeNull="true">The object that is removed from the beginning of
the array.</returns>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true}
]);
if (e) throw e;
return array.shift();
}

$type.forEach = function Array$forEach(array, method, instance) {


/// <summary locid="M:J#Array.forEach">Calls the specified function on each
element of the array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
enumerate.</param>
/// <param name="method" type="Function">The method to call. The method
should take the array element, the index of the element and the array itself as
its parameters.</param>
/// <param name="instance" optional="true" mayBeNull="true">The context under
which the function must run (i.e. what 'this' means inside the function).</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "method", type: Function},
{name: "instance", mayBeNull: true, optional: true}
]);
if (e) throw e;
for (var i = 0, l = array.length; i < l; i++) {
var elt = array[i];
if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
}
}

$type.indexOf = function Array$indexOf(array, item, start) {


/// <summary locid="M:J#Array.indexOf">Finds the index in the array of the
provided item.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to look
into.</param>
/// <param name="item" optional="true" mayBeNull="true">The object to
find.</param>
/// <param name="start" optional="true" mayBeNull="true">The index where the
search begins.</param>
/// <returns type="Number">The index of the item or -1 if it wasn't
found.</returns>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true, optional: true},
{name: "start", mayBeNull: true, optional: true}
]);
if (e) throw e;
return indexOf(array, item, start);
}

$type.insert = function Array$insert(array, index, item) {


/// <summary locid="M:J#Array.insert">Inserts an item at the specified
index.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
insert into.</param>
/// <param name="index" mayBeNull="true">The index where the item will be
inserted.</param>
/// <param name="item" mayBeNull="true">The item to insert.</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "index", mayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
array.splice(index, 0, item);
}

$type.parse = function Array$parse(value) {


/// <summary locid="M:J#Array.parse">Creates an array from a string
representation of the form "[elt1, elt2, elt3]".</summary>
/// <param name="value" type="String" mayBeNull="true">The string
representation of the array.</param>
/// <returns type="Array" elementMayBeNull="true">An array built from the
string representation.</returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String, mayBeNull: true}
]);
if (e) throw e;
var v = value ? window.eval("(" + value + ")") : [];
if (!Array.isInstanceOfType(v)) throw Error.argument('value',
Sys.Res.arrayParseBadFormat);
return v;
}

$type.remove = function Array$remove(array, item) {


/// <summary locid="M:J#Array.remove">Removes the first occurence of an item
from the array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
remove from.</param>
/// <param name="item" mayBeNull="true">The item to remove.</param>
/// <returns type="Boolean">True if the item was found.</returns>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
var index = indexOf(array, item);
if (index >= 0) {
array.splice(index, 1);
}
return (index >= 0);
}

$type.removeAt = function Array$removeAt(array, index) {


/// <summary locid="M:J#Array.removeAt">Removes the item at the specified index
from the array.</summary>
/// <param name="array" type="Array" elementMayBeNull="true">The array to
remove from.</param>
/// <param name="index" mayBeNull="true">The index of the item to
remove.</param>
var e = Function._validateParams(arguments, [
{name: "array", type: Array, elementMayBeNull: true},
{name: "index", mayBeNull: true}
]);
if (e) throw e;
array.splice(index, 1);
}

Type._registerScript._scripts = {
"MicrosoftAjaxCore.js": true,
"MicrosoftAjaxGlobalization.js": true,
"MicrosoftAjaxSerialization.js": true,
"MicrosoftAjaxComponentModel.js": true,
"MicrosoftAjaxHistory.js": true,
"MicrosoftAjaxNetwork.js" : true,
"MicrosoftAjaxWebServices.js": true };

$type = Sys.IDisposable = function IDisposable() {


throw Error.notImplemented();
}
$type.prototype = {
dispose: function IDisposable$dispose() {
throw Error.notImplemented();
}
}
$type.registerInterface('Sys.IDisposable');
$type = Sys.StringBuilder = function StringBuilder(initialText) {
/// <summary locid="M:J#Sys.StringBuilder.#ctor">Provides an optimized
mechanism to concatenate a sequence of strings.</summary>
/// <param name="initialText" optional="true" mayBeNull="true">The initial text
for the StringBuilder.</param>
var e = Function._validateParams(arguments, [
{name: "initialText", mayBeNull: true, optional: true}
]);
if (e) throw e;
this._parts = (typeof(initialText) !== 'undefined' && initialText !== null &&
initialText !== '') ?
[initialText.toString()] : [];
this._value = {};
this._len = 0;
}

$type.prototype = {
append: function StringBuilder$append(text) {
/// <summary locid="M:J#Sys.StringBuilder.append">Appends a new string at
the end of the StringBuilder.</summary>
/// <param name="text" mayBeNull="true">The string to append.</param>
/// <returns type="Sys.StringBuilder"></returns>
var e = Function._validateParams(arguments, [
{name: "text", mayBeNull: true}
]);
if (e) throw e;
this._parts.push(text);
return this;
},

appendLine: function StringBuilder$appendLine(text) {


/// <summary locid="M:J#Sys.StringBuilder.appendLine">Appends a new string
as a line of text at the end of the StringBuilder.</summary>
/// <param name="text" optional="true" mayBeNull="true">The string to
append.</param>
/// <returns type="Sys.StringBuilder"></returns>
var e = Function._validateParams(arguments, [
{name: "text", mayBeNull: true, optional: true}
]);
if (e) throw e;
this._parts.push(
((typeof(text) === 'undefined') || (text === null) || (text === '')) ?
'\r\n' : (text + '\r\n'));
return this;
},

clear: function StringBuilder$clear() {


/// <summary locid="M:J#Sys.StringBuilder.clear">Clears the StringBuilder
of its current contents.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._parts = [];
this._value = {};
this._len = 0;
},

isEmpty: function StringBuilder$isEmpty() {


/// <summary locid="M:J#Sys.StringBuilder.isEmpty">Use this method to
determine if the StringBuilder has contents.</summary>
/// <returns type="Boolean">True if the StringBuilder has any
contents.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return (!this._parts.length || !this.toString());
},

toString: function StringBuilder$toString(separator) {


/// <summary locid="M:J#Sys.StringBuilder.toString">Creates a string from
the contents of the StringBuilder.</summary>
/// <param name="separator" type="String" optional="true"
mayBeNull="true">The separator to insert between the elements of the
StringBuilder.</param>
/// <returns type="String">The string built from the
StringBuilder.</returns>
var e = Function._validateParams(arguments, [
{name: "separator", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
separator = separator || '';
var parts = this._parts;
if (this._len !== parts.length) {
this._value = {};
this._len = parts.length;
}
var val = this._value;
var ret = val[separator];
if (typeof(ret) === 'undefined') {
if (separator !== '') {
for (var i = 0; i < parts.length;) {
var part = parts[i];
if ((typeof(part) === 'undefined') || (part === '') || (part
=== null)) {
parts.splice(i, 1);
}
else {
i++;
}
}
}
val[separator] = ret = parts.join(separator);
}
return ret;
}
}
$type.registerClass('Sys.StringBuilder');

var agent = navigator.userAgent,


browser = Sys.Browser = {
InternetExplorer: {},
Firefox: {},
Safari: {},
Opera: {},
agent: null,
hasDebuggerStatement: false,
name: navigator.appName,
version: parseFloat(navigator.appVersion),
documentMode: 0 };

if (agent.indexOf(' MSIE ') > -1) {


browser.agent = browser.InternetExplorer;
browser.version = parseFloat(agent.match(/MSIE (\d+\.\d+)/)[1]);
if ((browser.version > 7) && (document.documentMode > 6)) {
browser.documentMode = document.documentMode;
}
browser.hasDebuggerStatement = true;
}
else if (agent.indexOf(' Firefox/') > -1) {
browser.agent = browser.Firefox;
browser.version = parseFloat(agent.match(/ Firefox\/(\d+\.\d+)/)[1]);
browser.name = 'Firefox';
browser.hasDebuggerStatement = true;
}
else if (agent.indexOf(' AppleWebKit/') > -1) {
browser.agent = browser.Safari;
browser.version = parseFloat(agent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]);
browser.name = 'Safari';
}
else if (agent.indexOf('Opera/') > -1) {
browser.agent = browser.Opera;
}

$type = Sys.EventArgs = function EventArgs() {


/// <summary locid="M:J#Sys.EventArgs.#ctor">EventArgs is the base class for
classes containing event data.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
}
$type.registerClass('Sys.EventArgs');

Sys.EventArgs.Empty = new Sys.EventArgs();


$type = Sys.CancelEventArgs = function CancelEventArgs() {
/// <summary locid="M:J#Sys.CancelEventArgs.#ctor">CancelEventArgs is the base
class for classes containing event data, which can be used to cancel the
event.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
Sys.CancelEventArgs.initializeBase(this);

this._cancel = false;
}
$type.prototype = {
get_cancel: function CancelEventArgs$get_cancel() {
/// <value type="Boolean" locid="P:J#Sys.CancelEventArgs.cancel"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._cancel;
},
set_cancel: function CancelEventArgs$set_cancel(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Boolean}]);
if (e) throw e;
this._cancel = value;
}
}
$type.registerClass('Sys.CancelEventArgs', Sys.EventArgs);

Type.registerNamespace('Sys.UI');

$type = Sys._Debug = function _Debug() {


/// <summary locid="M:J#Sys.Debug.#ctor">Provides a set of methods that help
debug your code.</summary>
/// <field name="isDebug" type="Boolean" locid="F:J#Sys.Debug.isDebug"></field>
if (arguments.length !== 0) throw Error.parameterCount();
}
$type.prototype = {
_appendConsole: function _Debug$_appendConsole(text) {
if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
Debug.writeln(text);
}
if (window.console && window.console.log) {
window.console.log(text);
}
if (window.opera) {
window.opera.postError(text);
}
if (window.debugService) {
window.debugService.trace(text);
}
},

_getTrace: function() {
var traceElement = Sys.get('#TraceConsole');
return (traceElement && (traceElement.tagName.toUpperCase() ===
'TEXTAREA')) ? traceElement : null;
},

_appendTrace: function _Debug$_appendTrace(text) {


var traceElement = this._getTrace();
if (traceElement) {
traceElement.value += text + '\n';
}
},

assert: function _Debug$assert(condition, message, displayCaller) {


/// <summary locid="M:J#Sys.Debug.assert">Checks for a condition, displays
a message and prompts the user to break into the debugger if the condition is
false.</summary>
/// <param name="condition" type="Boolean">true to prevent a message being
displayed; otherwise, false.</param>
/// <param name="message" type="String" optional="true" mayBeNull="true">A
message to display.</param>
/// <param name="displayCaller" type="Boolean" optional="true"
mayBeNull="true">True if the function calling assert should be displayed in the
message.</param>
var e = Function._validateParams(arguments, [
{name: "condition", type: Boolean},
{name: "message", type: String, mayBeNull: true, optional: true},
{name: "displayCaller", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
if (!condition) {
message = (displayCaller && this.assert.caller) ?
String.format(Sys.Res.assertFailedCaller, message,
this.assert.caller) :
String.format(Sys.Res.assertFailed, message);

if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) {
this.fail(message);
}
}
},

clearTrace: function _Debug$clearTrace() {


/// <summary locid="M:J#Sys.Debug.clearTrace"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
var traceElement = this._getTrace();
if (traceElement) {
traceElement.value = '';
}
},

fail: function _Debug$fail(message) {


/// <summary locid="M:J#Sys.Debug.fail">Displays a message in the
debugger's output window and breaks into the debugger.</summary>
/// <param name="message" type="String" mayBeNull="true">A message to
display.</param>
var e = Function._validateParams(arguments, [
{name: "message", type: String, mayBeNull: true}
]);
if (e) throw e;
this._appendConsole(message);

if (Sys.Browser.hasDebuggerStatement) {
window.eval('debugger');
}
},

trace: function _Debug$trace(text) {


/// <summary locid="M:J#Sys.Debug.trace">Appends a text line to the
debugger console and the TraceConsole textarea element if available.</summary>
/// <param name="text">Text for trace.</param>
var e = Function._validateParams(arguments, [
{name: "text"}
]);
if (e) throw e;
this._appendConsole(text);
this._appendTrace(text);
},

traceDump: function _Debug$traceDump(object, name) {


/// <summary locid="M:J#Sys.Debug.traceDump">Dumps an object to the
debugger console and the TraceConsole textarea element if available.</summary>
/// <param name="object" mayBeNull="true">Object for trace dump.</param>
/// <param name="name" type="String" mayBeNull="true"
optional="true">Object name.</param>
var e = Function._validateParams(arguments, [
{name: "object", mayBeNull: true},
{name: "name", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
this._traceDump(object, name, true);
},

_traceDump: function _Debug$_traceDump(object, name, recursive,


indentationPadding, loopArray) {
name = name || 'traceDump';
indentationPadding = indentationPadding || '';
var prefix = indentationPadding + name + ": ";
if (object === null) {
this.trace(prefix + 'null');
return;
}
switch(typeof(object)) {
case 'undefined':
this.trace(prefix + 'Undefined');
break;
case 'number': case 'string': case 'boolean':
this.trace(prefix + object);
break;
default:
if (Date.isInstanceOfType(object) ||
RegExp.isInstanceOfType(object)) {
this.trace(prefix + object.toString());
break;
}
if (!loopArray) {
loopArray = [];
}
else if (Array.contains(loopArray, object)) {
this.trace(prefix + '...');
return;
}
loopArray.push(object);

if ((object == window) || (object === document) ||


(window.HTMLElement && (object instanceof HTMLElement)) ||
(typeof(object.nodeName) === 'string')) {
var tag = object.tagName || 'DomElement';
if (object.id) {
tag += ' - ' + object.id;
}
this.trace(indentationPadding + name + ' {' + tag + '}');
}
else {
var typeName = Object.getTypeName(object);
this.trace(indentationPadding + name + (typeof(typeName) ===
'string' ? ' {' + typeName + '}' : ''));
if ((indentationPadding === '') || recursive) {
indentationPadding += " ";
var i, length, properties, p, v;
if (object instanceof Array) {
length = object.length;
for (i = 0; i < length; i++) {
this._traceDump(object[i], '[' + i + ']',
recursive, indentationPadding, loopArray);
}
}
else {
for (p in object) {
v = object[p];
if (typeof(v) !== "function") {
this._traceDump(v, p, recursive,
indentationPadding, loopArray);
}
}
}
}
}
Array.remove(loopArray, object);
}
}
}
$type.registerClass('Sys._Debug');

$type = Sys.Debug = new Sys._Debug();


$type.isDebug = true;
function Sys$Enum$parse(value, ignoreCase) {
/// <summary locid="M:J#Sys.Enum.parse">Converts the string representation of
the name or numeric value of one or more enumerated constants to an equivalent
enumerated object.</summary>
/// <param name="value" type="String">A string containing the name or value to
convert.</param>
/// <param name="ignoreCase" type="Boolean" optional="true" mayBeNull="true">If
true, the parsing will be done case-insensitively. If omitted, the parsing is done
case-sensitively.</param>
/// <returns>An object of type enumType whose value is represented by
value.</returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String},
{name: "ignoreCase", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
var values, parsed, val;
if (ignoreCase) {
values = this.__lowerCaseValues;
if (!values) {
this.__lowerCaseValues = values = {};
var prototype = this.prototype;
for (var name in prototype) {
values[name.toLowerCase()] = prototype[name];
}
}
}
else {
values = this.prototype;
}
function throwError(v) {
if (typeof(parsed) !== 'number') throw Error.argument('value',
String.format(Sys.Res.enumInvalidValue, v, this.__typeName));
}
if (!this.__flags) {
val = (ignoreCase ? value.toLowerCase() : value);
parsed = values[val.trim()];
if (typeof(parsed) !== 'number') throwError.call(this, value);
return parsed;
}
else {
var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
var v = 0;

for (var i = parts.length - 1; i >= 0; i--) {


var part = parts[i].trim();
parsed = values[part];
if (typeof(parsed) !== 'number') throwError.call(this, value.split(',')
[i].trim());
v |= parsed;
}
return v;
}
}

function Sys$Enum$toString(value) {
/// <summary locid="M:J#Sys.Enum.toString">Converts the value of an enum
instance to its equivalent string representation.</summary>
/// <param name="value" optional="true" mayBeNull="true">The value of the enum
instance for which the string representation must be constructed.</param>
/// <returns type="String">The string representation of "value".</returns>
var e = Function._validateParams(arguments, [
{name: "value", mayBeNull: true, optional: true}
]);
if (e) throw e;
if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw
Error.argumentType('value', Object.getType(value), this);
var values = this.prototype;
var i;
if (!this.__flags || (value === 0)) {
for (i in values) {
if (values[i] === value) {
return i;
}
}
}
else {
var sorted = this.__sortedValues;
if (!sorted) {
sorted = [];
for (i in values) {
sorted.push({key: i, value: values[i]});
}
sorted.sort(function(a, b) {
return a.value - b.value;
});
this.__sortedValues = sorted;
}
var parts = [];
var v = value;
for (i = sorted.length - 1; i >= 0; i--) {
var kvp = sorted[i];
var vali = kvp.value;
if (vali === 0) continue;
if ((vali & value) === vali) {
parts.push(kvp.key);
v -= vali;
if (v === 0) break;
}
}
if (parts.length && v === 0) return parts.reverse().join(', ');
}
throw Error.argumentOutOfRange('value', value,
String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
}

$type = Type;

$type.prototype.registerEnum = function Type$registerEnum(name, flags) {


/// <summary locid="M:J#Sys.UI.LineType.#ctor">Registers an enum
type.</summary>
/// <param name="name" type="String">The fully-qualified name of the
enum.</param>
/// <param name="flags" type="Boolean" optional="true" mayBeNull="true">True if
the enum is a flags collection.</param>
var e = Function._validateParams(arguments, [
{name: "name", type: String},
{name: "flags", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw
Error.argument('name', Sys.Res.notATypeName);
var parsedName;
try {
parsedName = eval(name);
}
catch(e) {
throw Error.argument('name', Sys.Res.argumentTypeName);
}
if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName);
if (Sys.__registeredTypes[name]) throw
Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name));
for (var j in this.prototype) {
var val = this.prototype[j];
if (!Type.__identifierRegExp.test(j)) throw
Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j));
if (typeof(val) !== 'number' || (val % 1) !== 0) throw
Error.invalidOperation(Sys.Res.enumValueNotInteger);
if (typeof(this[j]) !== 'undefined') throw
Error.invalidOperation(String.format(Sys.Res.enumReservedName, j));
}
Sys.__upperCaseTypes[name.toUpperCase()] = this;

for (var i in this.prototype) {


this[i] = this.prototype[i];
}
this.__typeName = name;
this.parse = Sys$Enum$parse;
this.__string = this.toString();
this.toString = Sys$Enum$toString;
this.__flags = flags;
this.__enum = true;
Sys.__registeredTypes[name] = true;
}

$type.isEnum = function Type$isEnum(type) {


/// <summary locid="M:J#Type.isEnum"></summary>
/// <param name="type" mayBeNull="true">The type to test.</param>
/// <returns type="Boolean">True if the type is an enum.</returns>
var e = Function._validateParams(arguments, [
{name: "type", mayBeNull: true}
]);
if (e) throw e;
return !!(type && type.__enum);
}

$type.isFlags = function Type$isFlags(type) {


/// <summary locid="M:J#Type.isFlags"></summary>
/// <param name="type" mayBeNull="true">The type to test.</param>
/// <returns type="Boolean">True if the type is a set of flags.</returns>
var e = Function._validateParams(arguments, [
{name: "type", mayBeNull: true}
]);
if (e) throw e;
return !!(type && type.__flags);
}

$type = Sys.CollectionChange = function CollectionChange(action, newItems,


newStartingIndex, oldItems, oldStartingIndex) {
/// <summary locid="M:J#Sys.CollectionChange.#ctor">Describes a change in a
collection.</summary>
/// <param name="action" type="Sys.NotifyCollectionChangedAction"></param>
/// <param name="newItems" optional="true" mayBeNull="true">The items that were
added when action is add or replace.</param>
/// <param name="newStartingIndex" type="Number" integer="true" optional="true"
mayBeNull="true">The index where new items have been inserted.</param>
/// <param name="oldItems" optional="true" mayBeNull="true">The items that were
removed when action is remove or replace.</param>
/// <param name="oldStartingIndex" type="Number" integer="true" optional="true"
mayBeNull="true">The index where old items have been removed.</param>
/// <field name="action" type="Sys.NotifyCollectionChangedAction"
locid="F:J#Sys.CollectionChange.action"></field>
/// <field name="newItems" type="Array" mayBeNull="true"
elementMayBeNull="true" locid="F:J#Sys.CollectionChange.newItems">The items that
were added when action is add.</field>
/// <field name="newStartingIndex" type="Number" integer="true"
locid="F:J#Sys.CollectionChange.newStartingIndex">The index where new items have
been inserted.</field>
/// <field name="oldItems" type="Array" mayBeNull="true"
elementMayBeNull="true" locid="F:J#Sys.CollectionChange.oldItems">The items that
were removed when action is remove.</field>
/// <field name="oldStartingIndex" type="Number" integer="true"
locid="F:J#Sys.CollectionChange.oldStartingIndex">The index where old items have
been removed.</field>
var e = Function._validateParams(arguments, [
{name: "action", type: Sys.NotifyCollectionChangedAction},
{name: "newItems", mayBeNull: true, optional: true},
{name: "newStartingIndex", type: Number, mayBeNull: true, integer: true,
optional: true},
{name: "oldItems", mayBeNull: true, optional: true},
{name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true,
optional: true}
]);
if (e) throw e;
this.action = action;
if (newItems) {
if (!(newItems instanceof Array)) {
newItems = [newItems];
}
}
this.newItems = newItems || null;
if (typeof newStartingIndex !== "number") {
newStartingIndex = -1;
}
this.newStartingIndex = newStartingIndex;
if (oldItems) {
if (!(oldItems instanceof Array)) {
oldItems = [oldItems];
}
}
this.oldItems = oldItems || null;
if (typeof oldStartingIndex !== "number") {
oldStartingIndex = -1;
}
this.oldStartingIndex = oldStartingIndex;
}
$type.registerClass("Sys.CollectionChange");
$type = Sys.NotifyCollectionChangedAction = function
NotifyCollectionChangedAction() {
/// <summary locid="M:J#Sys.NotifyCollectionChangedAction.#ctor">Describes how
a collection has changed.</summary>
/// <field name="add" type="Number" integer="true" static="true"
locid="F:J#Sys.NotifyCollectionChangedAction.add"></field>
/// <field name="remove" type="Number" integer="true" static="true"
locid="F:J#Sys.NotifyCollectionChangedAction.remove"></field>
/// <field name="reset" type="Number" integer="true" static="true"
locid="F:J#Sys.NotifyCollectionChangedAction.reset"></field>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
add: 0,
remove: 1,
reset: 2
}
$type.registerEnum('Sys.NotifyCollectionChangedAction');
$type = Sys.NotifyCollectionChangedEventArgs = function
NotifyCollectionChangedEventArgs(changes) {
/// <summary locid="M:J#Sys.NotifyCollectionChangedEventArgs.#ctor">Describes
how the collection was changed.</summary>
/// <param name="changes" type="Array" elementType="Sys.CollectionChange">A
list of changes that were performed on the collection since the last event.</param>
var e = Function._validateParams(arguments, [
{name: "changes", type: Array, elementType: Sys.CollectionChange}
]);
if (e) throw e;
this._changes = changes;
Sys.NotifyCollectionChangedEventArgs.initializeBase(this);
}
$type.prototype = {
get_changes: function NotifyCollectionChangedEventArgs$get_changes() {
/// <value type="Array" elementType="Sys.CollectionChange"
locid="P:J#Sys.NotifyCollectionChangedEventArgs.changes"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._changes || [];
}
}
$type.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs);

$type = Sys.Observer = function Observer() {


throw Error.invalidOperation();
}
$type.registerClass("Sys.Observer");

$type.makeObservable = function Observer$makeObservable(target) {


/// <summary locid="M:J#Sys.Observer.makeObservable">Makes an object directly
observable by adding observable methods to it.</summary>
/// <param name="target" mayBeNull="false">The object, array, or DOM element to
make observable.</param>
/// <returns>The observable object.</returns>
var e = Function._validateParams(arguments, [
{name: "target"}
]);
if (e) throw e;
var isArray = target instanceof Array,
o = Sys.Observer;
Sys.Observer._ensureObservable(target);
if (target.setValue === o._observeMethods.setValue) return target;
o._addMethods(target, o._observeMethods);
if (isArray) {
o._addMethods(target, o._arrayMethods);
}
return target;
}

$type._ensureObservable = function Observer$_ensureObservable(target) {


var type = typeof target;
if ((type === "string") || (type === "number") || (type === "boolean") || (type
=== "date")) {
throw Error.invalidOperation(String.format(Sys.Res.notObservable, type));
}
}
$type._addMethods = function Observer$_addMethods(target, methods) {
for (var m in methods) {
if (target[m] && (target[m] !== methods[m])) {
throw Error.invalidOperation(String.format(Sys.Res.observableConflict,
m));
}
target[m] = methods[m];
}
}
$type._addEventHandler = function Observer$_addEventHandler(target, eventName,
handler) {
Sys.Observer._getContext(target, true).events._addHandler(eventName, handler);
}
$type.addEventHandler = function Observer$addEventHandler(target, eventName,
handler) {
/// <summary locid="M:J#Sys.Observer.addEventHandler">Adds an observable event
handler to the target.</summary>
/// <param name="target"></param>
/// <param name="eventName" type="String"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "eventName", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._addEventHandler(target, eventName, handler);
}
$type._removeEventHandler = function Observer$_removeEventHandler(target,
eventName, handler) {
Sys.Observer._getContext(target, true).events._removeHandler(eventName,
handler);
}
$type.removeEventHandler = function Observer$removeEventHandler(target, eventName,
handler) {
/// <summary locid="M:J#Sys.Observer.removeEventHandler">Removes an observable
event handler from the target.</summary>
/// <param name="target"></param>
/// <param name="eventName" type="String"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "eventName", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._removeEventHandler(target, eventName, handler);
}
$type.clearEventHandlers = function Observer$clearEventHandlers(target, eventName)
{
/// <summary locid="M:J#Sys.Observer.clearEventHandlers">Removes all observable
event handlers from the target.</summary>
/// <param name="target"></param>
/// <param name="eventName" type="String" mayBeNull="true" optional="true">If
not given, handlers for all events are removed.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "eventName", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._getContext(target, true).events._removeHandlers(eventName);
}
$type.raiseEvent = function Observer$raiseEvent(target, eventName, eventArgs) {
/// <summary locid="M:J#Sys.Observer.raiseEvent">Raises an observable event on
the target.</summary>
/// <param name="target"></param>
/// <param name="eventName" type="String"></param>
/// <param name="eventArgs" optional="true" mayBeNull="true"></param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "eventName", type: String},
{name: "eventArgs", mayBeNull: true, optional: true}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
var ctx = Sys.Observer._getContext(target);
if (!ctx) return;
var handler = ctx.events.getHandler(eventName);
if (handler) {
handler(target, eventArgs || Sys.EventArgs.Empty);
}
}
$type.addPropertyChanged = function Observer$addPropertyChanged(target, handler) {
/// <summary locid="M:J#Sys.Observer.addPropertyChanged">Adds a propertyChanged
event handler to the target.</summary>
/// <param name="target" mayBeNull="false">The object to observe.</param>
/// <param name="handler" type="Function">The event handler.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._addEventHandler(target, "propertyChanged", handler);
}
$type.removePropertyChanged = function Observer$removePropertyChanged(target,
handler) {
/// <summary locid="M:J#Sys.Observer.removePropertyChanged">Removes a
propertyChanged event handler from the target.</summary>
/// <param name="target" mayBeNull="false">The object to observe.</param>
/// <param name="handler" type="Function">The event handler.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._removeEventHandler(target, "propertyChanged", handler);
}
$type.beginUpdate = function Observer$beginUpdate(target) {
/// <summary locid="M:J#Sys.Observer.beginUpdate"></summary>
/// <param name="target" mayBeNull="false"></param>
var e = Function._validateParams(arguments, [
{name: "target"}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._getContext(target, true).updating = true;
}
$type.endUpdate = function Observer$endUpdate(target) {
/// <summary locid="M:J#Sys.Observer.endUpdate"></summary>
/// <param name="target" mayBeNull="false"></param>
var e = Function._validateParams(arguments, [
{name: "target"}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
var ctx = Sys.Observer._getContext(target);
if (!ctx || !ctx.updating) return;
ctx.updating = false;
var dirty = ctx.dirty;
ctx.dirty = false;
if (dirty) {
if (target instanceof Array) {
var changes = ctx.changes;
ctx.changes = null;
Sys.Observer.raiseCollectionChanged(target, changes);
}
Sys.Observer.raisePropertyChanged(target, "");
}
}
$type.isUpdating = function Observer$isUpdating(target) {
/// <summary locid="M:J#Sys.Observer.isUpdating"></summary>
/// <param name="target" mayBeNull="false"></param>
/// <returns type="Boolean"></returns>
var e = Function._validateParams(arguments, [
{name: "target"}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
var ctx = Sys.Observer._getContext(target);
return ctx ? ctx.updating : false;
}
$type._setValue = function Observer$_setValue(target, propertyName, value) {
var getter, setter, mainTarget = target, path = propertyName.split('.');
for (var i = 0, l = (path.length - 1); i < l ; i++) {
var name = path[i];
getter = target["get_" + name];
if (typeof (getter) === "function") {
target = getter.call(target);
}
else {
target = target[name];
}
var type = typeof (target);
if ((target === null) || (type === "undefined")) {
throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath,
propertyName));
}
}
var currentValue, lastPath = path[l];
getter = target["get_" + lastPath];
if (typeof(getter) === 'function') {
currentValue = getter.call(target);
}
else {
currentValue = target[lastPath];
}
callIf(target, "set_" + lastPath, value) || (target[lastPath] = value);
if (currentValue !== value) {
var ctx = Sys.Observer._getContext(mainTarget);
if (ctx && ctx.updating) {
ctx.dirty = true;
return;
};
Sys.Observer.raisePropertyChanged(mainTarget, path[0]);
}
}
$type.setValue = function Observer$setValue(target, propertyName, value) {
/// <summary locid="M:J#Sys.Observer.setValue">Sets a property or field on the
target in an observable manner.</summary>
/// <param name="target" mayBeNull="false">The object to set a property
on.</param>
/// <param name="propertyName" type="String">The name of the property to field
to set.</param>
/// <param name="value" mayBeNull="true">The value to set.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "propertyName", type: String},
{name: "value", mayBeNull: true}
]);
if (e) throw e;
Sys.Observer._ensureObservable(target);
Sys.Observer._setValue(target, propertyName, value);
}
$type.raisePropertyChanged = function Observer$raisePropertyChanged(target,
propertyName) {
/// <summary locid="M:J#Sys.Observer.raisePropertyChanged">Raises a change
notification event.</summary>
/// <param name="target" mayBeNull="false">The object to raise the event
on.</param>
/// <param name="propertyName" type="String">The name of the property that
changed.</param>
Sys.Observer.raiseEvent(target, "propertyChanged", new
Sys.PropertyChangedEventArgs(propertyName));
}

$type.addCollectionChanged = function Observer$addCollectionChanged(target,


handler) {
/// <summary locid="M:J#Sys.Observer.addCollectionChanged"></summary>
/// <param name="target" type="Array" elementMayBeNull="true"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._addEventHandler(target, "collectionChanged", handler);
}
$type.removeCollectionChanged = function Observer$removeCollectionChanged(target,
handler) {
/// <summary locid="M:J#Sys.Observer.removeCollectionChanged"></summary>
/// <param name="target" type="Array" elementMayBeNull="true"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._removeEventHandler(target, "collectionChanged", handler);
}
$type._collectionChange = function Observer$_collectionChange(target, change) {
var ctx = this._getContext(target);
if (ctx && ctx.updating) {
ctx.dirty = true;
var changes = ctx.changes;
if (!changes) {
ctx.changes = changes = [change];
}
else {
changes.push(change);
}
}
else {
this.raiseCollectionChanged(target, [change]);
this.raisePropertyChanged(target, 'length');
}
}
$type.add = function Observer$add(target, item) {
/// <summary locid="M:J#Sys.Observer.add">Adds an item to the collection in an
observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to add
to.</param>
/// <param name="item" mayBeNull="true">The item to add.</param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add,
[item], target.length);
Array.add(target, item);
Sys.Observer._collectionChange(target, change);
}
$type.addRange = function Observer$addRange(target, items) {
/// <summary locid="M:J#Sys.Observer.addRange">Adds items to the collection in
an observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to add
to.</param>
/// <param name="items" type="Array" elementMayBeNull="true">The array of items
to add.</param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "items", type: Array, elementMayBeNull: true}
]);
if (e) throw e;
var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add,
items, target.length);
Array.addRange(target, items);
Sys.Observer._collectionChange(target, change);
}
$type.clear = function Observer$clear(target) {
/// <summary locid="M:J#Sys.Observer.clear">Clears the array of its elements in
an observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to
clear.</param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true}
]);
if (e) throw e;
var oldItems = Array.clone(target);
Array.clear(target);
Sys.Observer._collectionChange(target, new
Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems,
0));
}
$type.insert = function Observer$insert(target, index, item) {
/// <summary locid="M:J#Sys.Observer.insert">Inserts an item at the specified
index in an observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to
insert into.</param>
/// <param name="index" type="Number" integer="true">The index where the item
will be inserted.</param>
/// <param name="item" mayBeNull="true">The item to insert.</param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "index", type: Number, integer: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
Array.insert(target, index, item);
Sys.Observer._collectionChange(target, new
Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index));
}
$type.remove = function Observer$remove(target, item) {
/// <summary locid="M:J#Sys.Observer.remove">Removes the first occurence of an
item from the array in an observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to
remove from.</param>
/// <param name="item" mayBeNull="true">The item to remove.</param>
/// <returns type="Boolean">True if the item was found.</returns>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "item", mayBeNull: true}
]);
if (e) throw e;
var index = Array.indexOf(target, item);
if (index !== -1) {
Array.remove(target, item);
Sys.Observer._collectionChange(target, new
Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item],
index));
return true;
}
return false;
}
$type.removeAt = function Observer$removeAt(target, index) {
/// <summary locid="M:J#Sys.Observer.removeAt">Removes the item at the
specified index from the array in an observable manner.</summary>
/// <param name="target" type="Array" elementMayBeNull="true">The array to
remove from.</param>
/// <param name="index" type="Number" integer="true">The index of the item to
remove.</param>
var e = Function._validateParams(arguments, [
{name: "target", type: Array, elementMayBeNull: true},
{name: "index", type: Number, integer: true}
]);
if (e) throw e;
if ((index > -1) && (index < target.length)) {
var item = target[index];
Array.removeAt(target, index);
Sys.Observer._collectionChange(target, new
Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item],
index));
}
}
$type.raiseCollectionChanged = function Observer$raiseCollectionChanged(target,
changes) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Raises the
collectionChanged event.</summary>
/// <param name="target">The collection to raise the event on.</param>
/// <param name="changes" type="Array" elementType="Sys.CollectionChange">A
list of changes that were performed on the collection since the last event.</param>
Sys.Observer.raiseEvent(target, "collectionChanged", new
Sys.NotifyCollectionChangedEventArgs(changes));
}

$type._observeMethods = {
add_propertyChanged: function(handler) {
Sys.Observer._addEventHandler(this, "propertyChanged", handler);
},
remove_propertyChanged: function(handler) {
Sys.Observer._removeEventHandler(this, "propertyChanged", handler);
},
addEventHandler: function(eventName, handler) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Adds an
observable event handler.</summary>
/// <param name="eventName" type="String"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "eventName", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._addEventHandler(this, eventName, handler);
},
removeEventHandler: function(eventName, handler) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Removes an
observable event handler.</summary>
/// <param name="eventName" type="String"></param>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "eventName", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.Observer._removeEventHandler(this, eventName, handler);
},
clearEventHandlers: function(eventName) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Removes all
observable event handlers from the target.</summary>
/// <param name="target"></param>
/// <param name="eventName" type="String" mayBeNull="true"
optional="true">If not given, handlers for all events are removed.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "eventName", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
Sys.Observer._getContext(this, true).events._removeHandlers(eventName);
},
get_isUpdating: function() {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged"></summary>
/// <returns type="Boolean"></returns>
return Sys.Observer.isUpdating(this);
},
beginUpdate: function() {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged"></summary>
Sys.Observer.beginUpdate(this);
},
endUpdate: function() {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged"></summary>
Sys.Observer.endUpdate(this);
},
setValue: function(name, value) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Sets a
property or field on the target in an observable manner.</summary>
/// <param name="name" type="String">The name of the property to field to
set.</param>
/// <param name="value" mayBeNull="true">The value to set.</param>
var e = Function._validateParams(arguments, [
{name: "name", type: String},
{name: "value", mayBeNull: true}
]);
if (e) throw e;
Sys.Observer._setValue(this, name, value);
},
raiseEvent: function(eventName, eventArgs) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Raises an
observable event.</summary>
/// <param name="eventName" type="String"></param>
/// <param name="eventArgs" optional="true" mayBeNull="true"></param>
Sys.Observer.raiseEvent(this, eventName, eventArgs||null);
},
raisePropertyChanged: function(name) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Raises a
change notification event.</summary>
/// <param name="name" type="String">The name of the property that
changed.</param>
Sys.Observer.raiseEvent(this, "propertyChanged", new
Sys.PropertyChangedEventArgs(name));
}
}
$type._arrayMethods = {
add_collectionChanged: function(handler) {
Sys.Observer._addEventHandler(this, "collectionChanged", handler);
},
remove_collectionChanged: function(handler) {
Sys.Observer._removeEventHandler(this, "collectionChanged", handler);
},
add: function(item) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Adds an item
to the collection in an observable manner.</summary>
/// <param name="item" mayBeNull="true">The item to add.</param>
Sys.Observer.add(this, item);
},
addRange: function(items) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Adds items to
the collection in an observable manner.</summary>
/// <param name="items" type="Array" elementMayBeNull="true">The array of
items to add.</param>
Sys.Observer.addRange(this, items);
},
clear: function() {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Clears the
array of its elements in an observable manner.</summary>
Sys.Observer.clear(this);
},
insert: function(index, item) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Inserts an
item at the specified index in an observable manner.</summary>
/// <param name="index" type="Number" integer="true">The index where the
item will be inserted.</param>
/// <param name="item" mayBeNull="true">The item to insert.</param>
Sys.Observer.insert(this, index, item);
},
remove: function(item) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Removes the
first occurence of an item from the array in an observable manner.</summary>
/// <param name="item" mayBeNull="true">The item to remove.</param>
/// <returns type="Boolean">True if the item was found.</returns>
return Sys.Observer.remove(this, item);
},
removeAt: function(index) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Removes the
item at the specified index from the array in an observable manner.</summary>
/// <param name="index" type="Number" integer="true">The index of the item
to remove.</param>
Sys.Observer.removeAt(this, index);
},
raiseCollectionChanged: function(changes) {
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged">Raises the
collectionChanged event.</summary>
/// <param name="changes" type="Array" elementType="Sys.CollectionChange">A
list of changes that were performed on the collection since the last event.</param>
Sys.Observer.raiseEvent(this, "collectionChanged", new
Sys.NotifyCollectionChangedEventArgs(changes));
}
}
$type._getContext = function Observer$_getContext(obj, create) {
var ctx = obj._observerContext;
if (ctx) return ctx();
if (create) {
return (obj._observerContext = this._createContext())();
}
return null;
}
$type._createContext = function Observer$_createContext() {
var ctx = {
events: new Sys.EventHandlerList()
};
return function() {
return ctx;
}
}

function outOfRange(value, low, high) {


return (value < low) || (value > high);
}

function expandYear(dtf, year) {


var now = new Date(),
era = getEra(now);
if (year < 100) {
var curr = getEraYear(now, dtf, era);
year += curr - (curr % 100);
if (year > dtf.Calendar.TwoDigitYearMax) {
year -= 100;
}
}
return year;
}

function getEra(date, eras) {


if (!eras) return 0;
var start, ticks = date.getTime();
for (var i = 0, l = eras.length; i < l; i += 4) {
start = eras[i+2];
if ((start === null) || (ticks >= start)) {
return i;
}
}
return 0;
}

function getEraYear(date, dtf, era, sortable) {


var year = date.getFullYear();
if (!sortable && dtf.eras) {
year -= dtf.eras[era + 3];
}
return year;
}

Sys._appendPreOrPostMatch = function _appendPreOrPostMatch(preMatch, strings) {


var quoteCount = 0;
var escaped = false;
for (var i = 0, il = preMatch.length; i < il; i++) {
var c = preMatch.charAt(i);
switch (c) {
case '\'':
if (escaped) strings.push("'");
else quoteCount++;
escaped = false;
break;
case '\\':
if (escaped) strings.push("\\");
escaped = !escaped;
break;
default:
strings.push(c);
escaped = false;
break;
}
}
return quoteCount;
}

$type = Date;
$type._expandFormat = function Date$_expandFormat(dtf, format) {
format = format || "F";
var len = format.length;
if (len === 1) {
switch (format) {
case "d":
return dtf["ShortDatePattern"];
case "D":
return dtf["LongDatePattern"];
case "t":
return dtf["ShortTimePattern"];
case "T":
return dtf["LongTimePattern"];
case "f":
return dtf["LongDatePattern"] + " " + dtf["ShortTimePattern"];
case "F":
return dtf["FullDateTimePattern"];
case "M": case "m":
return dtf["MonthDayPattern"];
case "s":
return dtf["SortableDateTimePattern"];
case "Y": case "y":
return dtf["YearMonthPattern"];
default:
throw Error.format(Sys.Res.formatInvalidString);
}
}
else if ((len === 2) && (format.charAt(0) === "%")) {
format = format.charAt(1);
}
return format;
}

$type._getParseRegExp = function Date$_getParseRegExp(dtf, format) {


var re = dtf._parseRegExp;
if (!re) {
dtf._parseRegExp = re = {};
}
else {
var reFormat = re[format];
if (reFormat) {
return reFormat;
}
}

var expFormat = Date._expandFormat(dtf, format);


expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");

var regexp = ["^"];


var groups = [];
var index = 0;
var quoteCount = 0;
var tokenRegExp = Date._getTokenRegExp();
var match;

while ((match = tokenRegExp.exec(expFormat)) !== null) {


var preMatch = expFormat.slice(index, match.index);
index = tokenRegExp.lastIndex;

quoteCount += Sys._appendPreOrPostMatch(preMatch, regexp);


if (quoteCount % 2) {
regexp.push(match[0]);
continue;
}

var m = match[0],
len = m.length,
add;
switch (m) {
case 'dddd': case 'ddd':
case 'MMMM': case 'MMM':
case 'gg': case 'g':
add = "(\\D+)";
break;
case 'tt': case 't':
add = "(\\D*)";
break;
case 'yyyy':
case 'fff':
case 'ff':
case 'f':
add = "(\\d{" + len + "})";
break;
case 'dd': case 'd':
case 'MM': case 'M':
case 'yy': case 'y':
case 'HH': case 'H':
case 'hh': case 'h':
case 'mm': case 'm':
case 'ss': case 's':
add = "(\\d\\d?)";
break;
case 'zzz':
add = "([+-]?\\d\\d?:\\d{2})";
break;
case 'zz': case 'z':
add = "([+-]?\\d\\d?)";
break;
case '/':
add = "(\\" + dtf.DateSeparator + ")";
break;
}
if (add) {
regexp.push(add);
}
groups.push(match[0]);
}
Sys._appendPreOrPostMatch(expFormat.slice(index), regexp);
regexp.push("$");
var regexpStr = regexp.join('').replace(/\s+/g, "\\s+");
var parseRegExp = {'regExp': regexpStr, 'groups': groups};
re[format] = parseRegExp;
return parseRegExp;
}

$type._getTokenRegExp = function Date$_getTokenRegExp() {


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;
}

$type.parseLocale = function Date$parseLocale(value, formats) {


/// <summary locid="M:J#Date.parseLocale">Creates a date from a locale-specific
string representation.</summary>
/// <param name="value" type="String">A locale-specific string that can parse
to a date.</param>
/// <param name="formats" parameterArray="true" optional="true"
mayBeNull="true">Custom formats to match.</param>
/// <returns type="Date"></returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String},
{name: "formats", mayBeNull: true, optional: true, parameterArray: true}
]);
if (e) throw e;
return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments);
}

$type.parseInvariant = function Date$parseInvariant(value, formats) {


/// <summary locid="M:J#Date.parseInvariant">Creates a date from its string
representation.</summary>
/// <param name="value" type="String">A string that can parse to a
date.</param>
/// <param name="formats" parameterArray="true" optional="true"
mayBeNull="true">Custom formats to match.</param>
/// <returns type="Date"></returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String},
{name: "formats", mayBeNull: true, optional: true, parameterArray: true}
]);
if (e) throw e;
return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments);
}

$type._parse = function Date$_parse(value, cultureInfo, args) {


var i, l, date, format, formats, custom = false;
for (i = 1, l = args.length; i < l; i++) {
format = args[i];
if (format) {
custom = true;
date = Date._parseExact(value, format, cultureInfo);
if (date) return date;
}
}
if (! custom) {
formats = cultureInfo._getDateTimeFormats();
for (i = 0, l = formats.length; i < l; i++) {
date = Date._parseExact(value, formats[i], cultureInfo);
if (date) return date;
}
}
return null;
}

$type._parseExact = function Date$_parseExact(value, format, cultureInfo) {


value = value.trim();
var dtf = cultureInfo.dateTimeFormat,
parseInfo = this._getParseRegExp(dtf, format),
match = new RegExp(parseInfo.regExp).exec(value);
if (match === null) return null;

var groups = parseInfo.groups,


era = null, year = null, month = null, date = null, weekDay = null,
hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
pmHour = false;

for (var j = 0, jl = groups.length; j < jl; j++) {


var matchGroup = match[j+1];
if (matchGroup) {
var current = groups[j],
clength = current.length,
matchInt = parseInt(matchGroup, 10);
switch (current) {
case 'dd': case 'd':
date = matchInt;
if (outOfRange(date, 1, 31)) return null;
break;
case 'MMM':
case 'MMMM':
month = cultureInfo._getMonthIndex(matchGroup, clength === 3);
if (outOfRange(month, 0, 11)) return null;
break;
case 'M': case 'MM':
month = matchInt - 1;
if (outOfRange(month, 0, 11)) return null;
break;
case 'y': case 'yy':
case 'yyyy':
year = clength < 4 ? expandYear(dtf,matchInt) : matchInt;
if (outOfRange(year, 0, 9999)) return null;
break;
case 'h': case 'hh':
hour = matchInt;
if (hour === 12) hour = 0;
if (outOfRange(hour, 0, 11)) return null;
break;
case 'H': case 'HH':
hour = matchInt;
if (outOfRange(hour, 0, 23)) return null;
break;
case 'm': case 'mm':
min = matchInt;
if (outOfRange(min, 0, 59)) return null;
break;
case 's': case 'ss':
sec = matchInt;
if (outOfRange(sec, 0, 59)) return null;
break;
case 'tt': case 't':
var upperToken = matchGroup.toUpperCase();
pmHour = (upperToken === dtf.PMDesignator.toUpperCase());
if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase()))
return null;
break;
case 'f':
case 'ff':
case 'fff':
msec = matchInt * Math.pow(10, 3-clength);
if (outOfRange(msec, 0, 999)) return null;
break;
case 'ddd':
case 'dddd':
weekDay = cultureInfo._getDayIndex(matchGroup, clength === 3);
if (outOfRange(weekDay, 0, 6)) return null;
break;
case 'zzz':
var offsets = matchGroup.split(/:/);
if (offsets.length !== 2) return null;
hourOffset = parseInt(offsets[0], 10);
if (outOfRange(hourOffset, -12, 13)) return null;
var minOffset = parseInt(offsets[1], 10);
if (outOfRange(minOffset, 0, 59)) return null;
tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')?
-minOffset : minOffset);
break;
case 'z': case 'zz':
hourOffset = matchInt;
if (outOfRange(hourOffset, -12, 13)) return null;
tzMinOffset = hourOffset * 60;
break;
case 'g': case 'gg':
var eraName = matchGroup;
if (!eraName || !dtf.eras) return null;
eraName = eraName.toLowerCase().trim();
for (var i = 0, l = dtf.eras.length; i < l; i += 4) {
if (eraName === dtf.eras[i + 1].toLowerCase()) {
era = i;
break;
}
}
if (era === null) return null;
break;
}
}
}
var result = new Date(), defaultYear, convert = dtf.Calendar.convert;
defaultYear = convert ? convert.fromGregorian(result)[0] :
result.getFullYear();
if (year === null) {
year = defaultYear;
}
else if (dtf.eras) {
year += dtf.eras[(era || 0) + 3];
}
if (month === null) {
month = 0;
}
if (date === null) {
date = 1;
}
if (convert) {
result = convert.toGregorian(year, month, date);
if (result === null) return null;
}
else {
result.setFullYear(year, month, date);
if (result.getDate() !== date) return null;
if ((weekDay !== null) && (result.getDay() !== weekDay)) {
return null;
}
}
if (pmHour && (hour < 12)) {
hour += 12;
}
result.setHours(hour, min, sec, msec);
if (tzMinOffset !== null) {
var adjustedMin = result.getMinutes() - (tzMinOffset +
result.getTimezoneOffset());
result.setHours(result.getHours() + parseInt(adjustedMin/60, 10),
adjustedMin%60);
}
return result;
}

$prototype = $type.prototype;
$prototype.format = function Date$format(format) {
/// <summary locid="M:J#Date.format">Format a date using the invariant
culture.</summary>
/// <param name="format" type="String">Format string.</param>
/// <returns type="String">Formatted date.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String}
]);
if (e) throw e;
return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
}

$prototype.localeFormat = function Date$localeFormat(format) {


/// <summary locid="M:J#Date.localeFormat">Format a date using the current
culture.</summary>
/// <param name="format" type="String">Format string.</param>
/// <returns type="String">Formatted date.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String}
]);
if (e) throw e;
return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
}

$prototype._toFormattedString = function Date$_toFormattedString(format,


cultureInfo) {
var dtf = cultureInfo.dateTimeFormat,
convert = dtf.Calendar.convert;
if (!format || !format.length || (format === 'i')) {
var ret;
if (cultureInfo && cultureInfo.name.length) {
if (convert) {
ret = this._toFormattedString(dtf.FullDateTimePattern,
cultureInfo);
}
else {
var eraDate = new Date(this.getTime());
var era = getEra(this, dtf.eras);
eraDate.setFullYear(getEraYear(this, dtf, era));
ret = eraDate.toLocaleString();
}
}
else {
ret = this.toString();
}
return ret;
}

var eras = dtf.eras,


sortable = (format === "s");
format = Date._expandFormat(dtf, format);

ret = [];
var hour;

var zeros = ['0','00','000'];


function padZeros(num, c) {
var s = num+'';
return ((c > 1) && (s.length < c)) ? (zeros[c-2]+s).substr(-c) : s;
}

var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g;


function hasDay() {
if (foundDay || checkedDay) {
return foundDay;
}
foundDay = dayPartRegExp.test(format);
checkedDay = true;
return foundDay;
}

var quoteCount = 0,
tokenRegExp = Date._getTokenRegExp(),
converted;
if (!sortable && convert) {
converted = convert.fromGregorian(this);
}
for (;;) {

var index = tokenRegExp.lastIndex;

var ar = tokenRegExp.exec(format);

var preMatch = format.slice(index, ar ? ar.index : format.length);


quoteCount += Sys._appendPreOrPostMatch(preMatch, ret);

if (!ar) break;

if (quoteCount % 2) {
ret.push(ar[0]);
continue;
}

function getPart(date, part) {


if (converted) {
return converted[part];
}
switch (part) {
case 0: return date.getFullYear();
case 1: return date.getMonth();
case 2: return date.getDate();
}
}

var current = ar[0],


clength = current.length;

switch (current) {
case "ddd":
case "dddd":
names = (clength === 3) ? dtf.AbbreviatedDayNames : dtf.DayNames;
ret.push(names[this.getDay()]);
break;
case "d":
case "dd":
foundDay = true;
ret.push(padZeros(getPart(this, 2), clength));
break;
case "MMM":
case "MMMM":
var namePrefix = (clength === 3 ? "Abbreviated" : ""),
genitiveNames = dtf[namePrefix + "MonthGenitiveNames"],
names = dtf[namePrefix + "MonthNames"],
part = getPart(this, 1);
ret.push((genitiveNames && hasDay())
? genitiveNames[part]
: names[part]);
break;
case "M":
case "MM":
ret.push(padZeros(getPart(this, 1) + 1, clength));
break;
case "y":
case "yy":
case "yyyy":
part = converted ? converted[0] : getEraYear(this, dtf, getEra(this,
eras), sortable);
if (clength < 4) {
part = part % 100;
}
ret.push(padZeros(part, clength));
break;
case "h":
case "hh":
hour = this.getHours() % 12;
if (hour === 0) hour = 12;
ret.push(padZeros(hour, clength));
break;
case "H":
case "HH":
ret.push(padZeros(this.getHours(), clength));
break;
case "m":
case "mm":
ret.push(padZeros(this.getMinutes(), clength));
break;
case "s":
case "ss":
ret.push(padZeros(this.getSeconds(), clength));
break;
case "t":
case "tt":
part = (this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator;
ret.push(clength === 1 ? part.charAt(0) : part);
break;
case "f":
case "ff":
case "fff":
ret.push(padZeros(this.getMilliseconds(), 3).substr(0, clength));
break;
case "z":
case "zz":
hour = this.getTimezoneOffset() / 60;
ret.push(((hour <= 0) ? '+' : '-') +
padZeros(Math.floor(Math.abs(hour)), clength));
break;
case "zzz":
hour = this.getTimezoneOffset() / 60;
ret.push(((hour <= 0) ? '+' : '-') +
padZeros(Math.floor(Math.abs(hour)), 2) +
":" + padZeros(Math.abs(this.getTimezoneOffset() % 60), 2));
break;
case "g":
case "gg":
if (dtf.eras) {
ret.push(dtf.eras[getEra(this, eras) + 1]);
}
break;
case "/":
ret.push(dtf.DateSeparator);
break;
}
}
return ret.join('');
}
String.localeFormat = function String$localeFormat(format, args) {
/// <summary locid="M:J#String.localeFormat">Replaces the format items in a
specified String with the text equivalents of the values of corresponding object
instances. The current culture will be used to format dates and numbers.</summary>
/// <param name="format" type="String">A format string.</param>
/// <param name="args" parameterArray="true" mayBeNull="true">The objects to
format.</param>
/// <returns type="String">A copy of format in which the format items have been
replaced by the string equivalent of the corresponding instances of object
arguments.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String},
{name: "args", mayBeNull: true, parameterArray: true}
]);
if (e) throw e;
return String._toFormattedString(true, arguments);
}
var formattingPatterns = {
P: ["Percent", ["-n %", "-n%", "-%n"], ["n %", "n%", "%n" ], 100],
N: ["Number",["(n)","-n","- n","n-","n -"], null, 1],
C: ["Currency",["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$
n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"],["$n","n$","$ n","n $"], 1]
};

Sys._toFormattedString = function _toFormattedString(format, cultureInfo) {


if (!format || !format.length || (format === 'i')) {
return (cultureInfo && cultureInfo.name.length) ?
this.toLocaleString() :
this.toString();
}

function zeroPad(str, count, left) {


for (var l=str.length; l < count; l++) {
str = (left ? ('0' + str) : (str + '0'));
}
return str;
}

function expandNumber(number, precision, groupSizes, sep, decimalChar) {


var curSize = groupSizes[0];
var curGroupIndex = 1;

var factor = Math.pow(10, precision);


var rounded = (Math.round(number * factor) / factor);
if (!isFinite(rounded)) {
rounded = number;
}
number = rounded;

var numberString = number+'';


var right = "";
var exponent;

var split = numberString.split(/e/i);


numberString = split[0];
exponent = (split.length > 1 ? parseInt(split[1]) : 0);
split = numberString.split('.');
numberString = split[0];
right = split.length > 1 ? split[1] : "";

var l;
if (exponent > 0) {
right = zeroPad(right, exponent, false);
numberString += right.slice(0, exponent);
right = right.substr(exponent);
}
else if (exponent < 0) {
exponent = -exponent;
numberString = zeroPad(numberString, exponent+1, true);
right = numberString.slice(-exponent, numberString.length) + right;
numberString = numberString.slice(0, -exponent);
}

if (precision > 0) {
right = decimalChar +
((right.length > precision) ? right.slice(0, precision) :
zeroPad(right, precision, false));
}
else {
right = "";
}

var stringIndex = numberString.length-1;


var ret = "";
while (stringIndex >= 0) {
if (curSize === 0 || curSize > stringIndex) {
return numberString.slice(0, stringIndex + 1) +
(ret.length ? (sep + ret + right) : right);
}

ret = numberString.slice(stringIndex - curSize + 1, stringIndex + 1) +


(ret.length ? (sep+ret) : "");

stringIndex -= curSize;

if (curGroupIndex < groupSizes.length) {


curSize = groupSizes[curGroupIndex];
curGroupIndex++;
}
}
return numberString.slice(0, stringIndex + 1) + sep + ret + right;
}
var nf = cultureInfo.numberFormat;

var number = Math.abs(this);

format = format || "D";

var precision = -1;


if (format.length > 1) precision = parseInt(format.slice(1), 10);

var pattern,
current = format.charAt(0).toUpperCase();
switch (current) {
case "D":
pattern = 'n';

if (precision !== -1) {


number = zeroPad(""+number, precision, true);
}

if (this < 0) number = -number;


break;
case "C":
case "N":
case "P":
current = formattingPatterns[current];
var name = current[0];
pattern = (this < 0) ? current[1][nf[name+"NegativePattern"]] : (current[2]
? current[2][nf[name+"PositivePattern"]] : "n");
if (precision === -1) precision = nf[name+"DecimalDigits"];
number = expandNumber(Math.abs(this)*current[3], precision,
nf[name+"GroupSizes"], nf[name+"GroupSeparator"], nf[name+"DecimalSeparator"]);
break;
default:
throw Error.format(Sys.Res.formatBadFormatSpecifier);
}

var regex = /n|\$|-|%/g;

var ret = "";

for (;;) {

var index = regex.lastIndex;

var ar = regex.exec(pattern);

ret += pattern.slice(index, ar ? ar.index : pattern.length);


if (!ar)
break;

switch (ar[0]) {
case "n":
ret += number;
break;
case "$":
ret += nf.CurrencySymbol;
break;
case "-":
if (/[1-9]/.test(number)) {
ret += nf.NegativeSign;
}
break;
case "%":
ret += nf.PercentSymbol;
break;
}
}

return ret;
}

$type = Number;
$type.parseLocale = function Number$parseLocale(value) {
/// <summary locid="M:J#Number.parseLocale">Creates a number from its locale
string representation.</summary>
/// <param name="value" type="String">A string that can parse to a
number.</param>
/// <returns type="Number"></returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String}
], false);
if (e) throw e;
return Number._parse(value, Sys.CultureInfo.CurrentCulture);
}
$type.parseInvariant = function Number$parseInvariant(value) {
/// <summary locid="M:J#Number.parseInvariant">Creates a number from its string
representation.</summary>
/// <param name="value" type="String">A string that can parse to a
number.</param>
/// <returns type="Number"></returns>
var e = Function._validateParams(arguments, [
{name: "value", type: String}
], false);
if (e) throw e;
return Number._parse(value, Sys.CultureInfo.InvariantCulture);
}
$type._parse = function Number$_parse(value, cultureInfo) {
value = value.trim();

if (value.match(/^[+-]?infinity$/i)) {
return parseFloat(value);
}
if (value.match(/^0x[a-f0-9]+$/i)) {
return parseInt(value);
}
var numFormat = cultureInfo.numberFormat;
var signInfo = Number._parseNumberNegativePattern(value, numFormat,
numFormat.NumberNegativePattern);
var sign = signInfo[0];
var num = signInfo[1];

if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) {


signInfo = Number._parseNumberNegativePattern(value, numFormat, 1);
sign = signInfo[0];
num = signInfo[1];
}
if (sign === '') sign = '+';

var exponent;
var intAndFraction;
var exponentPos = num.indexOf('e');
if (exponentPos < 0) exponentPos = num.indexOf('E');
if (exponentPos < 0) {
intAndFraction = num;
exponent = null;
}
else {
intAndFraction = num.substr(0, exponentPos);
exponent = num.substr(exponentPos + 1);
}

var integer;
var fraction;
var decSep = numFormat.NumberDecimalSeparator
var decimalPos = intAndFraction.indexOf(decSep);
if (decimalPos < 0) {
integer = intAndFraction;
fraction = null;
}
else {
integer = intAndFraction.substr(0, decimalPos);
fraction = intAndFraction.substr(decimalPos + decSep.length);
}

var numGroupSep = numFormat.NumberGroupSeparator


integer = integer.split(numGroupSep).join('');
var altNumGroupSeparator = numGroupSep.replace(/\u00A0/g, " ");
if (numGroupSep !== altNumGroupSeparator) {
integer = integer.split(altNumGroupSeparator).join('');
}

var p = sign + integer;


if (fraction !== null) {
p += '.' + fraction;
}
if (exponent !== null) {
var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat,
1);
if (expSignInfo[0] === '') {
expSignInfo[0] = '+';
}
p += 'e' + expSignInfo[0] + expSignInfo[1];
}
if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) {
return parseFloat(p);
}
return Number.NaN;
}
$type._parseNumberNegativePattern = function
Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) {
var neg = numFormat.NegativeSign;
var pos = numFormat.PositiveSign;
switch (numberNegativePattern) {
case 4:
neg = ' ' + neg;
pos = ' ' + pos;
case 3:
if (value.endsWith(neg)) {
return ['-', value.substr(0, value.length - neg.length)];
}
else if (value.endsWith(pos)) {
return ['+', value.substr(0, value.length - pos.length)];
}
break;
case 2:
neg += ' ';
pos += ' ';
case 1:
if (value.startsWith(neg)) {
return ['-', value.substr(neg.length)];
}
else if (value.startsWith(pos)) {
return ['+', value.substr(pos.length)];
}
break;
case 0:
if (value.startsWith('(') && value.endsWith(')')) {
return ['-', value.substr(1, value.length - 2)];
}
break;
}
return ['', value];
}

$prototype = $type.prototype;
$prototype.format = function Number$format(format) {
/// <summary locid="M:J#Number.format">Format a number using the invariant
culture.</summary>
/// <param name="format" type="String">Format string.</param>
/// <returns type="String">Formatted number.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String}
]);
if (e) throw e;
return Sys._toFormattedString.call(this, format,
Sys.CultureInfo.InvariantCulture);
}
$prototype.localeFormat = function Number$localeFormat(format) {
/// <summary locid="M:J#Number.localeFormat">Format a number using the current
culture.</summary>
/// <param name="format" type="String">Format string.</param>
/// <returns type="String">Formatted number.</returns>
var e = Function._validateParams(arguments, [
{name: "format", type: String}
]);
if (e) throw e;
return Sys._toFormattedString.call(this, format,
Sys.CultureInfo.CurrentCulture);
}
function toUpper(value) {
return value.split("\u00A0").join(' ').toUpperCase();
}
function toUpperArray(arr) {
var result = [];
foreach(arr, function(value, i) {
result[i] = toUpper(value);
});
return result;
}

function clone(obj) {
var objNew = {};
forIn(obj, function(value, field) {
objNew[field] = (value instanceof Array) ? (value.length === 1 ? [value] :
Array.apply(null, value)) :
((typeof(value) === "object") ? clone(value) : value);
});
return objNew;
}

$type = Sys.CultureInfo = function CultureInfo(name, numberFormat, dateTimeFormat)


{
/// <summary locid="M:J#Sys.CultureInfo.#ctor"></summary>
/// <param name="name" type="String">CultureInfo name.</param>
/// <param name="numberFormat" type="Object">CultureInfo number format
information.</param>
/// <param name="dateTimeFormat" type="Object">CultureInfo date time format
information.</param>
var e = Function._validateParams(arguments, [
{name: "name", type: String},
{name: "numberFormat", type: Object},
{name: "dateTimeFormat", type: Object}
]);
if (e) throw e;
this.name = name;
this.numberFormat = numberFormat;
this.dateTimeFormat = dateTimeFormat;
}
$type.prototype = {
_getDateTimeFormats: function CultureInfo$_getDateTimeFormats() {
var formats = this._dateTimeFormats;
if (!formats) {
var dtf = this.dateTimeFormat;
this._dateTimeFormats = formats =
[ dtf["MonthDayPattern"],
dtf["YearMonthPattern"],
dtf["ShortDatePattern"],
dtf["ShortTimePattern"],
dtf["LongDatePattern"],
dtf["LongTimePattern"],
dtf["FullDateTimePattern"],
dtf["RFC1123Pattern"],
dtf["SortableDateTimePattern"],
dtf["UniversalSortableDateTimePattern"] ];
}
return formats;
},
_getMonthIndex: function CultureInfo$_getMonthIndex(value, abbr) {
var name = abbr ? "_upperAbbrMonths" : "_upperMonths",
genitiveName = name + "Genitive",
upperMonths = this[name];
if (!upperMonths) {
var prefix = (abbr ? "Abbreviated" : "");
this[name] = toUpperArray(this.dateTimeFormat[prefix+"MonthNames"]);
this[genitiveName] =
toUpperArray(this.dateTimeFormat[prefix+"MonthGenitiveNames"]);
}
value = toUpper(value);
var i = indexOf(this[name], value);
if (i < 0) {
i = indexOf(this[genitiveName], value);
}
return i;
},
_getDayIndex: function CultureInfo$_getDayIndex(value, abbr) {
var name = abbr ? "_upperAbbrDays" : "_upperDays",
upperDays = this[name];
if (!upperDays) {
this[name] = toUpperArray(this.dateTimeFormat[(abbr ? "Abbreviated" :
"")+"DayNames"]);
}
return indexOf(this[name], toUpper(value));
}
}
$type.registerClass('Sys.CultureInfo');

$type._parse = function(value) {
var dtf = value.dateTimeFormat;
if (dtf && !dtf.eras) {
dtf.eras = value.eras;
}
return new Sys.CultureInfo(value.name, value.numberFormat, dtf);
}
$type._setup = function() {
var cultureInfo = window.__cultureInfo,
monthNames =
["January","February","March","April","May","June","July","August","September","Oct
ober","November","December",""],
shortMonthNames =
["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],
invariant = {"name":"","numberFormat":
{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","CurrencyGroupSizes":
[3],"NumberGroupSizes":[3],"PercentGroupSizes":
[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\
u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"Per
centPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-
Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","
NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Inf
inity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","P
ercentGroupSeparator":",","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,"Cale
ndarType":1,"Eras":
[1],"TwoDigitYearMax":2029},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRul
e":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","SortableDateTi
mePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","Universal
SortableDateTimePattern":"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"],"Abbreviat
edMonthNames":shortMonthNames,"MonthNames":monthNames,"NativeCalendarName":"Gregori
an
Calendar","AbbreviatedMonthGenitiveNames":Array.clone(shortMonthNames),"MonthGeniti
veNames":Array.clone(monthNames)},"eras":[1,"A.D.",null,0]};
this.InvariantCulture = this._parse(invariant);
switch(typeof(cultureInfo)) {
case "string":
cultureInfo = window.eval("(" + cultureInfo + ")");
case "object":
this.CurrentCulture = this._parse(cultureInfo);
delete __cultureInfo;
break;
default:
cultureInfo = clone(invariant);
cultureInfo.name = "en-US";
cultureInfo.numberFormat.CurrencySymbol = "$";
var dtf = cultureInfo.dateTimeFormat;
dtf.FullDatePattern = "dddd, MMMM dd, yyyy h:mm:ss tt";
dtf.LongDatePattern = "dddd, MMMM dd, yyyy";
dtf.LongTimePattern = "h:mm:ss tt";
dtf.ShortDatePattern = "M/d/yyyy";
dtf.ShortTimePattern = "h:mm tt";
dtf.YearMonthPattern = "MMMM, yyyy";
this.CurrentCulture = this._parse(cultureInfo);
break;
}
}

$type._setup();

Type.registerNamespace('Sys.Serialization');

$type = Sys.Serialization.JavaScriptSerializer = function


Serialization$JavaScriptSerializer() {
/// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.#ctor">Provides
serialization from JavaScript object to JavaScript object notation.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
}
$type.registerClass('Sys.Serialization.JavaScriptSerializer');

$type._esc = {
charsRegExs: { '"': /\"/g, '\\': /\\/g }, /*"*/
chars: ['\\', '"'],
dateRegEx: /(^|[^\\])\"\\\/Date\((-?[0-9]+)(?:[a-zA-Z]|(?:\+|-)[0-9]
{4})?\)\\\/\"/g, /* " */
escapeChars: {'\\':'\\\\', '"':'\\"', "\b":"\\b", "\t":"\\t", "\n":"\\n", "\
f":"\\f", "\r":"\\r"},
escapeRegExG: /[\"\\\x00-\x1F]/g,
escapeRegEx: /[\"\\\x00-\x1F]/i,
jsonRegEx: /[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/g,
jsonStringRegEx: /\"(\\.|[^\"\\])*\"/g /*"*/
};
$type._init = function() {
var esc = this._esc,
toEsc = esc.chars,
toEscRE = esc.charsRegExs,
escChars = esc.escapeChars;
for (var i = 0; i < 32; i++) {
var c = String.fromCharCode(i);
toEsc[i+2] = c;
toEscRE[c] = new RegExp(c, 'g');
escChars[c] = escChars[c] || ("\\u" + ("000" + i.toString(16)).slice(-4));
}
this._load = true;
}
$type._serializeNumberWithBuilder = function(object, stringBuilder) {
if (!isFinite(object)) {
throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
}
stringBuilder.append(String(object));
}
$type._serializeStringWithBuilder = function(string, stringBuilder) {
stringBuilder.append('"');
var esc = this._esc;
if (esc.escapeRegEx.test(string)) {
if (!this._load) {
this._init();
}
if (string.length < 128) {
string = string.replace(esc.escapeRegExG,
function(x) { return esc.escapeChars[x]; });
}
else {
for (var i = 0; i < 34; i++) {
var c = esc.chars[i];
if (string.indexOf(c) !== -1) {
var escChar = esc.escapeChars[c];
string = (isBrowser("Opera") || isBrowser("Firefox")) ?
string.split(c).join(escChar) :
string.replace(esc.charsRegExs[c], escChar);
}
}
}
}
stringBuilder.append(string).append('"');
}
$type._serializeWithBuilder = function(object, stringBuilder, sort, prevObjects) {
var i;
switch (typeof object) {
case 'object':
if (object) {
if (prevObjects){
if (Sys._indexOf(prevObjects, object) !== -1) {
throw
Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle);
}
}
else {
prevObjects = [];
}
try {
prevObjects.push(object);

if (Number.isInstanceOfType(object)) {
this._serializeNumberWithBuilder(object, stringBuilder);
}
else if (Boolean.isInstanceOfType(object)) {
stringBuilder.append(object);
}
else if (String.isInstanceOfType(object)) {
this._serializeStringWithBuilder(object, stringBuilder);
}

else if (object instanceof Array) {


stringBuilder.append('[');

for (i = 0; i < object.length; ++i) {


if (i) {
stringBuilder.append(',');
}
this._serializeWithBuilder(object[i], stringBuilder, false,
prevObjects);
}
stringBuilder.append(']');
}
else {
if (Date.isInstanceOfType(object)) {
stringBuilder.append('"\\/Date(').
append(object.getTime()).
append(')\\/"');
break;
}

var properties = [],


propertyCount = 0;
for (var name in object) {
if (name.charAt(0) !== '$') {
if (name === '__type' && propertyCount) {
properties[propertyCount++] = properties[0];
properties[0] = name;
}
else {
properties[propertyCount++] = name;
}
}
}
if (sort) properties.sort();

stringBuilder.append('{');

var needComma;
for (i=0; i < propertyCount; i++) {
var prop = properties[i], value = object[prop],
type = typeof(value);
if (type !== 'undefined' && type !== 'function') {
if (needComma) {
stringBuilder.append(',');
}
this._serializeWithBuilder(prop, stringBuilder, sort,
prevObjects);
stringBuilder.append(':');
this._serializeWithBuilder(value, stringBuilder, sort,
prevObjects);
needComma = true;
}
}
stringBuilder.append('}');
}
}
finally {
Array.removeAt(prevObjects, prevObjects.length - 1);
}
}
else {
stringBuilder.append('null');
}
break;

case 'number':
this._serializeNumberWithBuilder(object, stringBuilder);
break;

case 'string':
this._serializeStringWithBuilder(object, stringBuilder);
break;

case 'boolean':
stringBuilder.append(object);
break;

default:
stringBuilder.append('null');
break;
}
}

$type.serialize = function JavaScriptSerializer$serialize(object) {


/// <summary
locid="M:J#Sys.Serialization.JavaScriptSerializer.serialize">Generates a JSON
string from an object.</summary>
/// <param name="object" mayBeNull="true">The object to serialize.</param>
/// <returns type="String">The JSON string representation of the
object.</returns>
var e = Function._validateParams(arguments, [
{name: "object", mayBeNull: true}
]);
if (e) throw e;
var stringBuilder = new Sys.StringBuilder();
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object,
stringBuilder, false);
return stringBuilder.toString();
}

$type.deserialize = function JavaScriptSerializer$deserialize(data, secure) {


/// <summary
locid="M:J#Sys.Serialization.JavaScriptSerializer.deserialize">Deserializes a JSON
string.</summary>
/// <param name="data" type="String">The JSON string to eval.</param>
/// <param name="secure" type="Boolean" optional="true" mayBeNull="true">True
if the method should perform JSON conformance checks before evaluating. False by
default.</param>
/// <returns>The results of eval applied to data.</returns>
var e = Function._validateParams(arguments, [
{name: "data", type: String},
{name: "secure", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
if (!data.length) throw Error.argument('data',
Sys.Res.cannotDeserializeEmptyString);
var er, esc = Sys.Serialization.JavaScriptSerializer._esc;
try {
var exp = data.replace(esc.dateRegEx, "$1new Date($2)");

if (secure && esc.jsonRegEx.test(exp.replace(esc.jsonStringRegEx, '')))


throw null;

return window.eval('(' + exp + ')');


}
catch (er) {
throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
}
}

Type.registerNamespace('Sys.UI');

$type = Sys.EventHandlerList = function EventHandlerList() {


/// <summary locid="M:J#Sys.EventHandlerList.#ctor">The EventHandlerList class
contains a dictionary of multicast events.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._list = {};
}

$type.prototype = {
_addHandler: function EventHandlerList$_addHandler(id, handler) {
Array.add(this._getEvent(id, true), handler);
},
addHandler: function EventHandlerList$addHandler(id, handler) {
/// <summary locid="M:J#Sys.EventHandlerList.addHandler">The addHandler
method adds a handler to the event identified by id.</summary>
/// <param name="id" type="String">The identifier for the event.</param>
/// <param name="handler" type="Function">The handler to add to the
event.</param>
var e = Function._validateParams(arguments, [
{name: "id", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
this._addHandler(id, handler);
},
_removeHandler: function EventHandlerList$_removeHandler(id, handler) {
var evt = this._getEvent(id);
if (!evt) return;
Array.remove(evt, handler);
},
_removeHandlers: function EventHandlerList$_removeHandlers(id) {
if (!id) {
this._list = {};
}
else {
var evt = this._getEvent(id);
if (!evt) return;
evt.length = 0;
}
},
removeHandler: function EventHandlerList$removeHandler(id, handler) {
/// <summary locid="M:J#Sys.EventHandlerList.removeHandler">The
removeHandler method removes a handler to the event identified by id.</summary>
/// <param name="id" type="String">The identifier for the event.</param>
/// <param name="handler" type="Function">The handler to remove from the
event.</param>
var e = Function._validateParams(arguments, [
{name: "id", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
this._removeHandler(id, handler);
},
getHandler: function EventHandlerList$getHandler(id) {
/// <summary locid="M:J#Sys.EventHandlerList.getHandler">The getHandler
method returns a single function that will call all handlers sequentially for the
specified event.</summary>
/// <param name="id" type="String">The identifier for the event.</param>
/// <returns type="Function">A function that will call each handler
sequentially.</returns>
var e = Function._validateParams(arguments, [
{name: "id", type: String}
]);
if (e) throw e;
var evt = this._getEvent(id);
if (!evt || !evt.length) return null;
evt = Array.clone(evt);
return function(source, args) {
for (var i = 0, l = evt.length; i < l; i++) {
evt[i](source, args);
}
};
},
_getEvent: function EventHandlerList$_getEvent(id, create) {
var e = this._list[id];
if (!e) {
if (!create) return null;
this._list[id] = e = [];
}
return e;
}
}
$type.registerClass('Sys.EventHandlerList');
$type = Sys.CommandEventArgs = function CommandEventArgs(commandName,
commandArgument, commandSource, commandEvent) {
/// <summary locid="M:J#Sys.CommandEventArgs.#ctor"></summary>
/// <param name="commandName" type="String">The command name.</param>
/// <param name="commandArgument" mayBeNull="true">The command
arguments.</param>
/// <param name="commandSource" mayBeNull="true">The command source.</param>
/// <param name="commandEvent" type="Sys.UI.DomEvent" mayBeNull="true"
optional="true">The DOM event that caused the command, if any.</param>
var e = Function._validateParams(arguments, [
{name: "commandName", type: String},
{name: "commandArgument", mayBeNull: true},
{name: "commandSource", mayBeNull: true},
{name: "commandEvent", type: Sys.UI.DomEvent, mayBeNull: true, optional:
true }
]);
if (e) throw e;
Sys.CommandEventArgs.initializeBase(this);
this._commandName = commandName;
this._commandArgument = commandArgument;
this._commandSource = commandSource;
this._commandEvent = commandEvent;
}
$type.prototype = {
get_commandName: function CommandEventArgs$get_commandName() {
/// <value type="String" locid="P:J#Sys.CommandEventArgs.commandName">The
command name.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._commandName || null;
},
get_commandArgument: function CommandEventArgs$get_commandArgument() {
/// <value mayBeNull="true"
locid="P:J#Sys.CommandEventArgs.commandArgument">The command arguments.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._commandArgument;
},
get_commandSource: function CommandEventArgs$get_commandSource() {
/// <value mayBeNull="true"
locid="P:J#Sys.CommandEventArgs.commandSource">The command source.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._commandSource || null;
},
get_commandEvent: function CommandEventArgs$get_commandEvent() {
/// <value mayBeNull="true" type="Sys.UI.DomEvent"
locid="P:J#Sys.CommandEventArgs.commandEvent">The DOM event that caused the
command, if any.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._commandEvent || null;
}
}
$type.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs);
$type = Sys.INotifyPropertyChange = function INotifyPropertyChange() {
/// <summary locid="M:J#Sys.INotifyPropertyChange.#ctor">Implement this
interface to become a provider of property change notifications.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
add_propertyChanged: function
INotifyPropertyChange$add_propertyChanged(handler) {
/// <summary locid="E:J#Sys.INotifyPropertyChange.propertyChanged"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
throw Error.notImplemented();
},
remove_propertyChanged: function
INotifyPropertyChange$remove_propertyChanged(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
throw Error.notImplemented();
}
}
$type.registerInterface('Sys.INotifyPropertyChange');
$type = Sys.PropertyChangedEventArgs = function
PropertyChangedEventArgs(propertyName) {
/// <summary locid="M:J#Sys.PropertyChangedEventArgs.#ctor">Describes property
changes.</summary>
/// <param name="propertyName" type="String">The name of the property that
changed.</param>
var e = Function._validateParams(arguments, [
{name: "propertyName", type: String}
]);
if (e) throw e;
Sys.PropertyChangedEventArgs.initializeBase(this);
this._propertyName = propertyName;
}
$type.prototype = {
get_propertyName: function PropertyChangedEventArgs$get_propertyName() {
/// <value type="String"
locid="P:J#Sys.PropertyChangedEventArgs.propertyName">The name of the property that
changed.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._propertyName;
}
}
$type.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
$type = Sys.INotifyDisposing = function INotifyDisposing() {
/// <summary locid="M:J#Sys.INotifyDisposing.#ctor">Implement this interface if
the class exposes an event to notify when it's disposing.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
add_disposing: function INotifyDisposing$add_disposing(handler) {
/// <summary locid="E:J#Sys.INotifyDisposing.disposing"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
throw Error.notImplemented();
},
remove_disposing: function INotifyDisposing$remove_disposing(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
throw Error.notImplemented();
}
}
$type.registerInterface("Sys.INotifyDisposing");
$type = Sys.Component = function Component() {
/// <summary locid="M:J#Sys.Component.#ctor">Base class for Control, Behavior
and any object that wants its lifetime to be managed.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
if (Sys.Application) Sys.Application.registerDisposableObject(this);
}
$type.prototype = {
_idSet: false,
get_events: function Component$get_events() {
/// <value type="Sys.EventHandlerList" locid="P:J#Sys.Component.events">The
collection of event handlers for this behavior. This property should only be used
by derived behaviors and should not be publicly called by other code.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return Sys.Observer._getContext(this, true).events;
},
get_id: function Component$get_id() {
/// <value type="String" locid="P:J#Sys.Component.id"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._id || null;
},
set_id: function Component$set_id(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
if (this._idSet) throw
Error.invalidOperation(Sys.Res.componentCantSetIdTwice);
this._idSet = true;
var oldId = this.get_id();
if (oldId && Sys.Application.findComponent(oldId)) throw
Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp);
this._id = value;
},
get_isInitialized: function Component$get_isInitialized() {
/// <value type="Boolean" locid="P:J#Sys.Component.isInitialized"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._initialized;
},
get_isUpdating: function Component$get_isUpdating() {
/// <value type="Boolean" locid="P:J#Sys.Component.isUpdating"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._updating;
},
add_disposing: function Component$add_disposing(handler) {
/// <summary locid="E:J#Sys.Component.disposing"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._addHandler("disposing", handler);
},
remove_disposing: function Component$remove_disposing(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._removeHandler("disposing", handler);
},
add_propertyChanged: function Component$add_propertyChanged(handler) {
/// <summary locid="E:J#Sys.Component.propertyChanged"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._addHandler("propertyChanged", handler);
},
remove_propertyChanged: function Component$remove_propertyChanged(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._removeHandler("propertyChanged", handler);
},
_addHandler: function Component$_addHandler(eventName, handler) {
Sys.Observer.addEventHandler(this, eventName, handler);
},
_removeHandler: function Component$_removeHandler(eventName, handler) {
Sys.Observer.removeEventHandler(this, eventName, handler);
},
beginUpdate: function Component$beginUpdate() {
this._updating = true;
},
dispose: function Component$dispose() {
Sys.Observer.raiseEvent(this, "disposing")
Sys.Observer.clearEventHandlers(this);
Sys.Application.unregisterDisposableObject(this);
Sys.Application.removeComponent(this);
},
endUpdate: function Component$endUpdate() {
this._updating = false;
if (!this._initialized) this.initialize();
this.updated();
},
initialize: function Component$initialize() {
this._initialized = true;
},
raisePropertyChanged: function Component$raisePropertyChanged(propertyName) {
/// <summary locid="M:J#Sys.Component.raisePropertyChanged">Raises a change
notification event.</summary>
/// <param name="propertyName" type="String">The name of the property that
changed.</param>
var e = Function._validateParams(arguments, [
{name: "propertyName", type: String}
]);
if (e) throw e;
Sys.Observer.raisePropertyChanged(this, propertyName);
},
updated: function Component$updated() {
}
}
$type.registerClass('Sys.Component', null, Sys.IDisposable,
Sys.INotifyPropertyChange, Sys.INotifyDisposing);

$type._setProperties = function Component$_setProperties(target, properties) {


/// <summary locid="M:J#Sys.Component._setProperties">Recursively sets
properties on an object.</summary>
/// <param name="target">The object on which to set the property
values.</param>
/// <param name="properties">A JSON object containing the property
values.</param>
var e = Function._validateParams(arguments, [
{name: "target"},
{name: "properties"}
]);
if (e) throw e;
var current;
var targetType = Object.getType(target);
var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
var isComponent = Sys.Component.isInstanceOfType(target) && !
target.get_isUpdating();
if (isComponent) target.beginUpdate();
for (var name in properties) {
var val = properties[name];
var getter = isObject ? null : target["get_" + name];
if (isObject || typeof(getter) !== 'function') {
var targetVal = target[name];
if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
target[name] = val;
}
else {
this._setProperties(targetVal, val);
}
}
else {
var setter = target["set_" + name];
if (typeof(setter) === 'function') {
setter.apply(target, [val]);
}
else if (val instanceof Array) {
current = getter.apply(target);
if (!(current instanceof Array)) throw new
Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
for (var i = 0, j = current.length, l= val.length; i < l; i++, j++)
{
current[j] = val[i];
}
}
else if ((typeof(val) === 'object') && (Object.getType(val) ===
Object)) {
current = getter.apply(target);
if ((typeof(current) === 'undefined') || (current === null)) throw
new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
this._setProperties(current, val);
}
else {
throw new
Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
}
}
}
if (isComponent) target.endUpdate();
}

$type._setReferences = function Component$_setReferences(component, references) {


var reference, refs = {};
forIn(references, function(id, name) {
refs[name] = reference = $find(id);
if (!reference) throw
Error.invalidOperation(String.format(Sys.Res.referenceNotFound, id));
});
Sys._set(component, refs);
}

$create = $type.create = function Component$create(type, properties, events,


references, element) {
/// <summary locid="M:J#Sys.Component.create">Instantiates a component of the
specified type, attaches it to the specified element if it's a Control or
Behavior, sets the properties as described by the specified JSON object, then
calls initialize.</summary>
/// <param name="type" type="Type">The type of the component to create.</param>
/// <param name="properties" optional="true" mayBeNull="true">A JSON object
that describes the properties and their values.</param>
/// <param name="events" optional="true" mayBeNull="true">A JSON object that
describes the events and their handlers.</param>
/// <param name="references" optional="true" mayBeNull="true">A JSON object
that describes the properties that are references to other components. The
contents of this object consists of name/id pairs. If in a two-pass creation, the
setting of these properties will be delayed until the second pass.</param>
/// <param name="element" domElement="true" optional="true"
mayBeNull="true">The DOM element the component must be attached to.</param>
/// <returns type="Object">The component instance.</returns>
var e = Function._validateParams(arguments, [
{name: "type", type: Type},
{name: "properties", mayBeNull: true, optional: true},
{name: "events", mayBeNull: true, optional: true},
{name: "references", mayBeNull: true, optional: true},
{name: "element", mayBeNull: true, domElement: true, optional: true}
]);
if (e) throw e;
if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
if (!element) throw Error.argument('element', Sys.Res.createNoDom);
}
else if (element) throw Error.argument('element',
Sys.Res.createComponentOnDom);
var component = (element ? new type(element): new type());
callIf(component, "beginUpdate");
if (properties) {
Sys.Component._setProperties(component, properties);
}
if (events) {
for (var name in events) {
if (!(component["add_" + name] instanceof Function)) throw new
Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
if (!(events[name] instanceof Function)) throw new
Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
component["add_" + name](events[name]);
}
}
Sys.Component._register(component, references);
return component;
}
$type._register = function Component$_register(component, references, dontUpdate) {
var ret;
if (Sys.Component.isInstanceOfType(component)) {
ret = true;
var app = Sys.Application;
if (component.get_id()) {
app.addComponent(component);
}
if (app.get_isCreatingComponents()) {
app._createdComponents.push(component);
if (references) {
app._addComponentToSecondPass(component, references);
}
else if (!dontUpdate) {
component.endUpdate();
}
}
else {
if (references) {
Sys.Component._setReferences(component, references);
}
if (!dontUpdate) {
component.endUpdate();
}
}
}
return ret;
}

Sys._getComponent = function _getComponent(found, selector, context) {


var component = Sys.Application.findComponent(selector);
if (component) {
found.push(component);
}
}

Sys._2Pass = function _2Pass(callback) {


var app = Sys.Application,
useTwoPass = !app.get_isCreatingComponents();
if (useTwoPass) app.beginCreateComponents();
foreach(callback, function(c) { c() });
if (useTwoPass) app.endCreateComponents();
}
$type = Sys.UI.MouseButton = function MouseButton() {
/// <summary locid="M:J#Sys.UI.MouseButton.#ctor">Describes mouse buttons. The
values are those from the DOM standard, which are different from the IE
values.</summary>
/// <field name="leftButton" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.MouseButton.leftButton"></field>
/// <field name="middleButton" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.MouseButton.middleButton"></field>
/// <field name="rightButton" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.MouseButton.rightButton"></field>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
leftButton: 0,
middleButton: 1,
rightButton: 2
}
$type.registerEnum("Sys.UI.MouseButton");
$type = Sys.UI.Key = function Key() {
/// <summary locid="M:J#Sys.UI.Key.#ctor">Describes key codes.</summary>
/// <field name="backspace" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.backspace"></field>
/// <field name="tab" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.tab"></field>
/// <field name="enter" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.enter"></field>
/// <field name="esc" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.esc"></field>
/// <field name="space" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.space"></field>
/// <field name="pageUp" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.pageUp"></field>
/// <field name="pageDown" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.pageDown"></field>
/// <field name="end" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.end"></field>
/// <field name="home" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.home"></field>
/// <field name="left" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.left"></field>
/// <field name="up" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.up"></field>
/// <field name="right" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.right"></field>
/// <field name="down" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.down"></field>
/// <field name="del" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.Key.del"></field>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
backspace: 8,
tab: 9,
enter: 13,
esc: 27,
space: 32,
pageUp: 33,
pageDown: 34,
end: 35,
home: 36,
left: 37,
up: 38,
right: 39,
down: 40,
del: 127
}
$type.registerEnum("Sys.UI.Key");
$type = Sys.UI.Point = function Point(x, y) {
/// <summary locid="M:J#Sys.UI.Point.#ctor"></summary>
/// <param name="x" type="Number" integer="true"></param>
/// <param name="y" type="Number" integer="true"></param>
/// <field name="x" type="Number" integer="true"
locid="F:J#Sys.UI.Point.x"></field>
/// <field name="y" type="Number" integer="true"
locid="F:J#Sys.UI.Point.y"></field>
var e = Function._validateParams(arguments, [
{name: "x", type: Number, integer: true},
{name: "y", type: Number, integer: true}
]);
if (e) throw e;
this.x = x;
this.y = y;
}
$type.registerClass('Sys.UI.Point');
$type = Sys.UI.Bounds = function Bounds(x, y, width, height) {
/// <summary locid="M:J#Sys.UI.Bounds.#ctor"></summary>
/// <param name="x" type="Number" integer="true"></param>
/// <param name="y" type="Number" integer="true"></param>
/// <param name="width" type="Number" integer="true"></param>
/// <param name="height" type="Number" integer="true"></param>
/// <field name="x" type="Number" integer="true"
locid="F:J#Sys.UI.Bounds.x"></field>
/// <field name="y" type="Number" integer="true"
locid="F:J#Sys.UI.Bounds.y"></field>
/// <field name="width" type="Number" integer="true"
locid="F:J#Sys.UI.Bounds.width"></field>
/// <field name="height" type="Number" integer="true"
locid="F:J#Sys.UI.Bounds.height"></field>
var e = Function._validateParams(arguments, [
{name: "x", type: Number, integer: true},
{name: "y", type: Number, integer: true},
{name: "width", type: Number, integer: true},
{name: "height", type: Number, integer: true}
]);
if (e) throw e;
this.x = x;
this.y = y;
this.height = height;
this.width = width;
}
$type.registerClass('Sys.UI.Bounds');
$type = Sys.UI.DomEvent = function DomEvent(eventObject) {
/// <summary locid="M:J#Sys.UI.DomEvent.#ctor">A cross-browser object that
represents event properties.</summary>
/// <param name="eventObject">The browser-specific event object (window.event
for IE).</param>
/// <field name="altKey" type="Boolean"
locid="F:J#Sys.UI.DomEvent.altKey"></field>
/// <field name="button" type="Sys.UI.MouseButton"
locid="F:J#Sys.UI.DomEvent.button"></field>
/// <field name="charCode" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.charCode">The character code for the pressed
key.</field>
/// <field name="clientX" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.clientX"></field>
/// <field name="clientY" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.clientY"></field>
/// <field name="ctrlKey" type="Boolean"
locid="F:J#Sys.UI.DomEvent.ctrlKey"></field>
/// <field name="keyCode" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.keyCode">The key code for the pressed key.</field>
/// <field name="offsetX" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.offsetX"></field>
/// <field name="offsetY" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.offsetY"></field>
/// <field name="screenX" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.screenX"></field>
/// <field name="screenY" type="Number" integer="true"
locid="F:J#Sys.UI.DomEvent.screenY"></field>
/// <field name="shiftKey" type="Boolean"
locid="F:J#Sys.UI.DomEvent.shiftKey"></field>
/// <field name="target" locid="F:J#Sys.UI.DomEvent.target"></field>
/// <field name="type" type="String" locid="F:J#Sys.UI.DomEvent.type"></field>
var e = Function._validateParams(arguments, [
{name: "eventObject"}
]);
if (e) throw e;
var ev = eventObject;
var etype = this.type = ev.type.toLowerCase();
this.rawEvent = ev;
this.altKey = ev.altKey;
if (typeof(ev.button) !== 'undefined') {
this.button = (typeof(ev.which) !== 'undefined') ? ev.button :
(ev.button === 4) ? Sys.UI.MouseButton.middleButton :
(ev.button === 2) ? Sys.UI.MouseButton.rightButton :
Sys.UI.MouseButton.leftButton;
}
if (etype === 'keypress') {
this.charCode = ev.charCode || ev.keyCode;
}
else if (ev.keyCode && (ev.keyCode === 46)) {
this.keyCode = 127;
}
else {
this.keyCode = ev.keyCode;
}
this.clientX = ev.clientX;
this.clientY = ev.clientY;
this.ctrlKey = ev.ctrlKey;
this.target = ev.target || ev.srcElement;
if (!etype.startsWith('key')) {
if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !==
'undefined')) {
this.offsetX = ev.offsetX;
this.offsetY = ev.offsetY;
}
else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX)
=== 'number')) {
var loc = Sys.UI.DomElement.getLocation(this.target);
var w = Sys.UI.DomElement._getWindow(this.target);
this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x;
this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y;
}
}
this.screenX = ev.screenX;
this.screenY = ev.screenY;
this.shiftKey = ev.shiftKey;
}
$type.prototype = {
preventDefault: function DomEvent$preventDefault() {
/// <summary locid="M:J#Sys.UI.DomEvent.preventDefault">Prevents the
default event action from happening. For example, a textbox keydown event, if
suppressed, will prevent the character from being appended to the
textbox.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
var raw = this.rawEvent;
if (raw.preventDefault) {
raw.preventDefault();
}
else if (window.event) {
raw.returnValue = false;
}
},
stopPropagation: function DomEvent$stopPropagation() {
/// <summary locid="M:J#Sys.UI.DomEvent.stopPropagation">Prevents the event
from being propagated to parent elements.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
var raw = this.rawEvent;
if (raw.stopPropagation) {
raw.stopPropagation();
}
else if (window.event) {
raw.cancelBubble = true;
}
}
}
$type.registerClass('Sys.UI.DomEvent');

$addHandler = $type.addHandler = function DomEvent$addHandler(elements, eventName,


handler, autoRemove) {
/// <summary locid="M:J#Sys.UI.DomEvent.addHandler">A cross-browser way to add
a DOM event handler to an element.</summary>
/// <param name="elements">The element or text node, or array of elements or
text nodes, that exposes the event. You may also pass a DOM selector or array of
DOM selectors.</param>
/// <param name="eventName" type="String">The name of the event. Do not include
the 'on' prefix, for example, 'click' instead of 'onclick'.</param>
/// <param name="handler" type="Function">The event handler to add.</param>
/// <param name="autoRemove" type="Boolean" optional="true"
mayBeNull="true">Whether the handler should be removed automatically when the
element is disposed of, such as when an UpdatePanel refreshes, or
Sys.Application.disposeElement is called.</param>
var e = Function._validateParams(arguments, [
{name: "elements"},
{name: "eventName", type: String},
{name: "handler", type: Function},
{name: "autoRemove", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
if (eventName === "error") throw
Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError);
Sys.query(elements).each(function() {
var nodeType = this.nodeType;
if (nodeType === 3 || nodeType === 2 || nodeType === 8) return;
Sys.UI.DomEvent._ensureDomNode(this);
if (!this._events) {
this._events = {};
}
var eventCache = this._events[eventName];
if (!eventCache) {
this._events[eventName] = eventCache = [];
}
var element = this,
browserHandler;
if (this.addEventListener) {
browserHandler = function(e) {
return handler.call(element, new Sys.UI.DomEvent(e));
}
this.addEventListener(eventName, browserHandler, false);
}
else if (this.attachEvent) {
browserHandler = function() {
var ex, ev = {};
try {ev = Sys.UI.DomElement._getWindow(element).event} catch(ex) {}
return handler.call(element, new Sys.UI.DomEvent(ev));
}
this.attachEvent('on' + eventName, browserHandler);
}
eventCache.push({handler: handler, browserHandler: browserHandler,
autoRemove: autoRemove });
if (autoRemove) {
Sys.UI.DomElement._onDispose(this, Sys.UI.DomEvent._disposeHandlers);
}
});
}

Sys.registerPlugin({
name: "addHandler",
dom: true,
returnType: "Sys.ElementSet",
description: "A cross-browser way to add a DOM event handler to an element.",
parameters: [
{name: "eventName", type: "String", description: "The name of the event. Do
not include the 'on' prefix, for example, 'click' instead of 'onclick'."},
{name: "handler", type: "Function", description: "The event handler to
add."},
{name: "autoRemove", type: "Boolean", description: "Whether the handler
should be removed automatically when the element is disposed of, such as when an
UpdatePanel refreshes, or Sys.Application.disposeElement is called."}
],
plugin: function (eventName, handler, autoRemove) {
Sys.UI.DomEvent.addHandler(this.get(), eventName, handler, autoRemove);
return this;
}
});

$addHandlers = $type.addHandlers = function DomEvent$addHandlers(elements, events,


handlerOwner, autoRemove) {
/// <summary locid="M:J#Sys.UI.DomEvent.addHandlers">Adds a list of event
handlers to an element. If a handlerOwner is specified, delegates are created with
each of the handlers.</summary>
/// <param name="elements">The element or text node, or array of element or
text nodes, that exposes the event. You may also pass a DOM selector or array of
DOM selectors.</param>
/// <param name="events" type="Object">A dictionary of event handlers.</param>
/// <param name="handlerOwner" optional="true" mayBeNull="true">The owner of
the event handlers that will be the this pointer for the delegates that will be
created from the handlers.</param>
/// <param name="autoRemove" type="Boolean" optional="true"
mayBeNull="true">Whether the handler should be removed automatically when the
element is disposed of, such as when an UpdatePanel refreshes, or when
Sys.Application.disposeElement is called.</param>
var e = Function._validateParams(arguments, [
{name: "elements"},
{name: "events", type: Object},
{name: "handlerOwner", mayBeNull: true, optional: true},
{name: "autoRemove", type: Boolean, mayBeNull: true, optional: true}
]);
if (e) throw e;
Sys.query(elements).each(function() {
var nodeType = this.nodeType;
if (nodeType === 3 || nodeType === 2 || nodeType === 8) return;
Sys.UI.DomEvent._ensureDomNode(this);
for (var name in events) {
var handler = events[name];
if (typeof(handler) !== 'function') throw
Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);
if (handlerOwner) {
handler = Function.createDelegate(handlerOwner, handler);
}
$addHandler(this, name, handler, autoRemove || false);
}
});
}

Sys.registerPlugin({
name: "addHandlers",
dom: true,
returnType: "Sys.ElementSet",
description: "Adds a list of event handlers to an element. If a handlerOwner is
specified, delegates are created with each of the handlers.",
parameters: [
{name: "events", type: "Object", description: "A dictionary of event
handlers."},
{name: "handlerOwner", description: "The owner of the event handlers that
will be the this pointer for the delegates that will be created from the
handlers."},
{name: "autoRemove", type: "Boolean", description: "Whether the handler
should be removed automatically when the element is disposed of, such as when an
UpdatePanel refreshes, or Sys.Application.disposeElement is called."}
],
plugin: function (events, handlerOwner, autoRemove) {
Sys.UI.DomEvent.addHandlers(this.get(), events, handlerOwner, autoRemove);
return this;
}
});

$clearHandlers = $type.clearHandlers = function DomEvent$clearHandlers(elements) {


/// <summary locid="M:J#Sys.UI.DomEvent.clearHandlers">Clears all the event
handlers that were added to the element or array of elements.</summary>
/// <param name="elements">The element or text node, or an array of elements or
text nodes. You may also pass a DOM selector or array of DOM selectors.</param>
var e = Function._validateParams(arguments, [
{name: "elements"}
]);
if (e) throw e;
Sys.query(elements).each(function() {
var nodeType = this.nodeType;
if (nodeType === 3 || nodeType === 2 || nodeType === 8) return;
Sys.UI.DomEvent._ensureDomNode(this);
Sys.UI.DomEvent._clearHandlers(this, false);
});
}

Sys.registerPlugin({
name: "clearHandlers",
dom: true,
returnType: "Sys.ElementSet",
description: "Clears all the event handlers that were added to the element or
array of elements.",
plugin: function() {
Sys.UI.DomEvent.clearHandlers(this.get());
return this;
}
});

$type._clearHandlers = function DomEvent$_clearHandlers(elements, autoRemoving) {


Sys.query(elements).each(function() {
var nodeType = this.nodeType;
if (nodeType === 3 || nodeType === 2 || nodeType === 8) return;
Sys.UI.DomEvent._ensureDomNode(this);
var cache = this._events;
if (cache) {
for (var name in cache) {
var handlers = cache[name];
for (var i = handlers.length - 1; i >= 0; i--) {
var entry = handlers[i];
if (!autoRemoving || entry.autoRemove) {
$removeHandler(this, name, entry.handler);
}
}
}
}
});
}

$type._disposeHandlers = function DomEvent$_disposeHandlers() {


Sys.UI.DomEvent._clearHandlers(this, true);
}

$removeHandler = $type.removeHandler = function DomEvent$removeHandler(elements,


eventName, handler) {
/// <summary locid="M:J#Sys.UI.DomEvent.removeHandler">A cross-browser way to
remove a DOM event handler from an element.</summary>
/// <param name="elements">The element or text node, or array of elements or
text nodes, that exposes the event. You may also pass a DOM selector or array of
DOM selectors.</param>
/// <param name="eventName" type="String">The name of the event. Do not include
the 'on' prefix, for example, 'click' instead of 'onclick'.</param>
/// <param name="handler" type="Function">The event handler to remove.</param>
var e = Function._validateParams(arguments, [
{name: "elements"},
{name: "eventName", type: String},
{name: "handler", type: Function}
]);
if (e) throw e;
Sys.UI.DomEvent._removeHandler(elements, eventName, handler);
}
$type._removeHandler = function DomEvent$_removeHandler(elements, eventName,
handler) {
Sys.query(elements).each(function() {
var nodeType = this.nodeType;
if (nodeType === 3 || nodeType === 2 || nodeType === 8) return;
Sys.UI.DomEvent._ensureDomNode(this);
var browserHandler = null;
if ((typeof(this._events) !== 'object') || !this._events) throw
Error.invalidOperation(Sys.Res.eventHandlerInvalid);
var cache = this._events[eventName];
if (!(cache instanceof Array)) throw
Error.invalidOperation(Sys.Res.eventHandlerInvalid);
for (var i = 0, l = cache.length; i < l; i++) {
if (cache[i].handler === handler) {
browserHandler = cache[i].browserHandler;
break;
}
}
if (typeof(browserHandler) !== 'function') throw
Error.invalidOperation(Sys.Res.eventHandlerInvalid);
if (this.removeEventListener) {
this.removeEventListener(eventName, browserHandler, false);
}
else if (this.detachEvent) {
this.detachEvent('on' + eventName, browserHandler);
}
cache.splice(i, 1);
});
}

Sys.registerPlugin({
name: "removeHandler",
dom: true,
returnType: "Sys.ElementSet",
description: "A cross-browser way to remove a DOM event handler from an
element.",
parameters: [
{name: "eventName", type: "String", description: "The name of the event. Do
not include the 'on' prefix, for example, 'click' instead of 'onclick'."},
{name: "handler", type: "Function", description: "The event handler to
remove."}
],
plugin: function (eventName, handler) {
Sys.UI.DomEvent.removeHandler(this.get(), eventName, handler);
return this;
}
});

$type._ensureDomNode = function DomEvent$_ensureDomNode(element) {


if (element && element.tagName && (element.tagName.toUpperCase() === "SCRIPT"))
return;

var doc = element ? (element.ownerDocument || element.document || element) :


null;
if (!element ||
((typeof(element.document) !== 'object') && (element != doc) &&
(typeof(element.nodeType) !== 'number'))) {
throw Error.argument("element", Sys.Res.argumentDomNode);
}
}
$type = Sys.UI.DomElement = function DomElement() {
/// <summary locid="M:J#Sys.UI.DomElement.#ctor">This static class provides
helpers to work with DOM elements.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.registerClass('Sys.UI.DomElement');

$type.addCssClass = function DomElement$addCssClass(element, className) {


/// <summary locid="M:J#Sys.UI.DomElement.addCssClass">Adds a CSS class to an
element if it doesn't already have it.</summary>
/// <param name="element" domElement="true"></param>
/// <param name="className" type="String">The name of the CSS class to
add.</param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "className", type: String}
]);
if (e) throw e;
if (!Sys.UI.DomElement.containsCssClass(element, className)) {
if (element.className === '') {
element.className = className;
}
else {
element.className += ' ' + className;
}
}
}

$type.containsCssClass = function DomElement$containsCssClass(element, className) {


/// <summary locid="M:J#Sys.UI.DomElement.containsCssClass">Determines if an
element has the specified CSS class.</summary>
/// <param name="element" domElement="true"></param>
/// <param name="className" type="String">The name of the CSS class to
test.</param>
/// <returns type="Boolean">True if the CSS class was found on the
element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "className", type: String}
]);
if (e) throw e;
return Array.contains(element.className.split(' '), className);
}

$type.getBounds = function DomElement$getBounds(element) {


/// <summary locid="M:J#Sys.UI.DomElement.getBounds">Gets the coordinates,
width and height of an element.</summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.Bounds">A Bounds object with four fields, x, y, width
and height, which contain the pixel coordinates, width and height of the
element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
var offset = Sys.UI.DomElement.getLocation(element);

return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0,


element.offsetHeight || 0);
}

$get = $type.getElementById = function DomElement$getElementById(id, element) {


/// <summary locid="M:J#Sys.UI.DomElement.getElementById">Finds an element by
id.</summary>
/// <param name="id" type="String">The id of the element to find.</param>
/// <param name="element" domElement="true" optional="true"
mayBeNull="true"></param>
/// <returns domElement="true" mayBeNull="true">The element, or null if it was
not found.</returns>
var e = Function._validateParams(arguments, [
{name: "id", type: String},
{name: "element", mayBeNull: true, domElement: true, optional: true}
]);
if (e) throw e;
return Sys.get("#" + id, element || null);
}

if (document.documentElement.getBoundingClientRect) {
$type.getLocation = function DomElement$getLocation(element) {
/// <summary locid="M:J#Sys.UI.DomElement.getLocation">Gets the coordinates
of a DOM element.</summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.Point">A Point object with two fields, x and y,
which contain the pixel coordinates of the element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;

if (element.self || element.nodeType === 9 ||


(element === document.documentElement) ||
(element.parentNode === element.ownerDocument.documentElement)) {
return new Sys.UI.Point(0, 0);
}

var clientRect = element.getBoundingClientRect();


if (!clientRect) {
return new Sys.UI.Point(0,0);
}
var ex, ownerDoc = element.ownerDocument, documentElement =
ownerDoc.documentElement,
offsetX = Math.round(clientRect.left) + (documentElement.scrollLeft ||
(ownerDoc.body ? ownerDoc.body.scrollLeft : 0)),
offsetY = Math.round(clientRect.top) + (documentElement.scrollTop ||
(ownerDoc.body ? ownerDoc.body.scrollTop : 0));
if (isBrowser("InternetExplorer")) {
try {
var f = element.ownerDocument.parentWindow.frameElement || null;
if (f) {
f = f.frameBorder;
var offset = (f === "0" || f === "no") ? 2 : 0;
offsetX += offset;
offsetY += offset;
}
}
catch(ex) {
}
if (Sys.Browser.version === 7 && !document.documentMode) {
var body = document.body,
rect = body.getBoundingClientRect(),
zoom = (rect.right-rect.left) / body.clientWidth;
zoom = Math.round(zoom * 100);
zoom = (zoom - zoom % 5) / 100;
if (!isNaN(zoom) && (zoom !== 1)) {
offsetX = Math.round(offsetX / zoom);
offsetY = Math.round(offsetY / zoom);
}
}
if ((document.documentMode || 0) < 8) {
offsetX -= documentElement.clientLeft;
offsetY -= documentElement.clientTop;
}
}
return new Sys.UI.Point(offsetX, offsetY);
}
}
else if (isBrowser("Safari")) {
$type.getLocation = function DomElement$getLocation_Safari(element) {
/// <summary locid="M:J#Sys.UI.DomElement.getLocation">Gets the coordinates
of a DOM element.</summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.Point">A Point object with two fields, x and y,
which contain the pixel coordinates of the element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
if ((element.window && (element.window === element)) || element.nodeType
=== 9) return new Sys.UI.Point(0,0);

var offsetX = 0, offsetY = 0,


parent,
previous = null,
previousStyle = null,
currentStyle;
for (parent = element; parent; previous = parent, previousStyle =
currentStyle, parent = parent.offsetParent) {
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;

if ((parent.offsetLeft || parent.offsetTop) &&


((tagName !== "BODY") || (!previousStyle ||
previousStyle.position !== "absolute"))) {
offsetX += parent.offsetLeft;
offsetY += parent.offsetTop;
}

if (previous && Sys.Browser.version >= 3) {


offsetX += parseInt(currentStyle.borderLeftWidth);
offsetY += parseInt(currentStyle.borderTopWidth);
}
}

currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
var elementPosition = currentStyle ? currentStyle.position : null;
if (elementPosition !== "absolute") {
for (parent = element.parentNode; parent; parent = parent.parentNode) {
tagName = parent.tagName ? parent.tagName.toUpperCase() : null;

if ((tagName !== "BODY") && (tagName !== "HTML") &&


(parent.scrollLeft || parent.scrollTop)) {
offsetX -= (parent.scrollLeft || 0);
offsetY -= (parent.scrollTop || 0);
}
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
var parentPosition = currentStyle ? currentStyle.position : null;

if (parentPosition && (parentPosition === "absolute")) break;


}
}
return new Sys.UI.Point(offsetX, offsetY);
}
}
else {
$type.getLocation = function DomElement$getLocation_Generic(element) {
/// <summary locid="M:J#Sys.UI.DomElement.getLocation">Gets the coordinates
of a DOM element.</summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.Point">A Point object with two fields, x and y,
which contain the pixel coordinates of the element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
if ((element.window && (element.window === element)) || element.nodeType
=== 9) return new Sys.UI.Point(0,0);

var offsetX = 0, offsetY = 0,


parent,
previous = null,
previousStyle = null,
currentStyle = null;
for (parent = element; parent; previous = parent, previousStyle =
currentStyle, parent = parent.offsetParent) {
var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);

if ((parent.offsetLeft || parent.offsetTop) &&


!((tagName === "BODY") &&
(!previousStyle || previousStyle.position !== "absolute"))) {

offsetX += parent.offsetLeft;
offsetY += parent.offsetTop;
}

if (previous !== null && currentStyle) {


if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !==
"HTML")) {
offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
offsetY += parseInt(currentStyle.borderTopWidth) || 0;
}
if (tagName === "TABLE" &&
(currentStyle.position === "relative" || currentStyle.position
=== "absolute")) {
offsetX += parseInt(currentStyle.marginLeft) || 0;
offsetY += parseInt(currentStyle.marginTop) || 0;
}
}
}

currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
var elementPosition = currentStyle ? currentStyle.position : null;
if (elementPosition !== "absolute") {
for (parent = element.parentNode; parent; parent = parent.parentNode) {
tagName = parent.tagName ? parent.tagName.toUpperCase() : null;

if ((tagName !== "BODY") && (tagName !== "HTML") &&


(parent.scrollLeft || parent.scrollTop)) {

offsetX -= (parent.scrollLeft || 0);


offsetY -= (parent.scrollTop || 0);

currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
if (currentStyle) {
offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
offsetY += parseInt(currentStyle.borderTopWidth) || 0;
}
}
}
}
return new Sys.UI.Point(offsetX, offsetY);
}
}

$type.isDomElement = function DomElement$isDomElement(obj) {


/// <summary locid="M:J#Sys.UI.DomElement.isDomElement">Determines if the given
argument is a DOM element.</summary>
/// <param name="obj"></param>
/// <returns type="Boolean">True if the object is a DOM element, otherwise
false.</returns>
var e = Function._validateParams(arguments, [
{name: "obj"}
]);
if (e) throw e;
return Sys._isDomElement(obj);
}

$type.removeCssClass = function DomElement$removeCssClass(element, className) {


/// <summary locid="M:J#Sys.UI.DomElement.removeCssClass">Removes a CSS class
from an element.</summary>
/// <param name="element" domElement="true"></param>
/// <param name="className" type="String">The name of the CSS class to
remove.</param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "className", type: String}
]);
if (e) throw e;
var currentClassName = ' ' + element.className + ' ';
var index = currentClassName.indexOf(' ' + className + ' ');
if (index >= 0) {
element.className = (currentClassName.substr(0, index) + ' ' +
currentClassName.substring(index + className.length + 1,
currentClassName.length)).trim();
}
}

$type.resolveElement = function DomElement$resolveElement(elementOrElementId,


containerElement) {
/// <summary locid="M:J#Sys.UI.DomElement.resolveElement">Returns the element
with the specified Id in the specified container, or the element if it is already
an element.</summary>
/// <param name="elementOrElementId" mayBeNull="true"></param>
/// <param name="containerElement" domElement="true" optional="true"
mayBeNull="true"></param>
/// <returns domElement="true"></returns>
var e = Function._validateParams(arguments, [
{name: "elementOrElementId", mayBeNull: true},
{name: "containerElement", mayBeNull: true, domElement: true, optional:
true}
]);
if (e) throw e;
var el = elementOrElementId;
if (!el) return null;
if (typeof(el) === "string") {
el = Sys.get("#" + el, containerElement);
if (!el) {
throw Error.argument("elementOrElementId",
String.format(Sys.Res.elementNotFound, elementOrElementId));
}
}
else if(!Sys.UI.DomElement.isDomElement(el)) {
throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId);
}
return el;
}

$type.raiseBubbleEvent = function DomElement$raiseBubbleEvent(source, args) {


/// <summary locid="M:J#Sys.UI.DomElement.raiseBubbleEvent">Raises a bubble
event.</summary>
/// <param name="source" domElement="true">The DOM element that triggers the
event.</param>
/// <param name="args" type="Sys.EventArgs">The event arguments.</param>
var e = Function._validateParams(arguments, [
{name: "source", domElement: true},
{name: "args", type: Sys.EventArgs}
]);
if (e) throw e;
var target = source;
while (target) {
var control = target.control;
if (control && control.onBubbleEvent && control.raiseBubbleEvent) {
if (!control.onBubbleEvent(source, args)) {
control._raiseBubbleEvent(source, args);
}
return;
}
target = target.parentNode;
}
}

$type._ensureGet = function DomElement$_ensureGet(selector, context, arg) {


var ret = Sys.get(selector, context);
if (!ret && typeof(selector) === "string") {
throw Error.invalidOperation(String.format(Sys.Res.selectorNotFound,
selector));
}
else if (ret && !this.isDomElement(ret)) {
throw
Error.invalidOperation(String.format(Sys.Res.expectedDomElementOrSelector, arg));
}
return ret;
}

$type.setLocation = function DomElement$setLocation(element, x, y) {


/// <summary locid="M:J#Sys.UI.DomElement.setLocation">Sets the position of an
element.</summary>
/// <param name="element" domElement="true"></param>
/// <param name="x" type="Number" integer="true"></param>
/// <param name="y" type="Number" integer="true"></param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "x", type: Number, integer: true},
{name: "y", type: Number, integer: true}
]);
if (e) throw e;
var style = element.style;
style.position = 'absolute';
style.left = x + "px";
style.top = y + "px";
}

$type.toggleCssClass = function DomElement$toggleCssClass(element, className) {


/// <summary locid="M:J#Sys.UI.DomElement.toggleCssClass">Toggles a CSS class
on and off o an element.</summary>
/// <param name="element" domElement="true"></param>
/// <param name="className" type="String">The name of the CSS class to
toggle.</param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "className", type: String}
]);
if (e) throw e;
if (Sys.UI.DomElement.containsCssClass(element, className)) {
Sys.UI.DomElement.removeCssClass(element, className);
}
else {
Sys.UI.DomElement.addCssClass(element, className);
}
}

$type.getVisibilityMode = function DomElement$getVisibilityMode(element) {


/// <summary locid="M:J#Sys.UI.DomElement.getVisibilityMode"></summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.VisibilityMode"></returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ?
Sys.UI.VisibilityMode.hide :
Sys.UI.VisibilityMode.collapse;
}
$type.setVisibilityMode = function DomElement$setVisibilityMode(element, value) {
/// <summary locid="M:J#Sys.UI.DomElement.setVisibilityMode"></summary>
/// <param name="element" domElement="true"></param>
/// <param name="value" type="Sys.UI.VisibilityMode"></param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "value", type: Sys.UI.VisibilityMode}
]);
if (e) throw e;
Sys.UI.DomElement._ensureOldDisplayMode(element);
if (element._visibilityMode !== value) {
element._visibilityMode = value;
if (Sys.UI.DomElement.getVisible(element) === false) {
element.style.display = (value === Sys.UI.VisibilityMode.hide) ?
element._oldDisplayMode : 'none';
}
}
}

$type.getVisible = function DomElement$getVisible(element) {


/// <summary locid="M:J#Sys.UI.DomElement.getVisible"></summary>
/// <param name="element" domElement="true"></param>
/// <returns type="Boolean"></returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
var style = element.currentStyle ||
Sys.UI.DomElement._getCurrentStyle(element);
return style ? (style.visibility !== 'hidden') && (style.display !== 'none') :
true;
}
$type.setVisible = function DomElement$setVisible(element, value) {
/// <summary locid="M:J#Sys.UI.DomElement.setVisible"></summary>
/// <param name="element" domElement="true"></param>
/// <param name="value" type="Boolean"></param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "value", type: Boolean}
]);
if (e) throw e;
if (value !== Sys.UI.DomElement.getVisible(element)) {
Sys.UI.DomElement._ensureOldDisplayMode(element);
var style = element.style;
style.visibility = value ? 'visible' : 'hidden';
style.display = (value || (element._visibilityMode ===
Sys.UI.VisibilityMode.hide)) ? element._oldDisplayMode : 'none';
}
}

$type.setCommand = function DomElement$setCommand(commandSource, commandName,


commandArgument, commandTarget) {
/// <summary locid="M:J#Sys.UI.DomElement.setCommand">Causes a DOM element to
raise a bubble event when clicked.</summary>
/// <param name="commandSource">The DOM element, array of DOM elements, or DOM
element selectors that causes the event when clicked.</param>
/// <param name="commandName" type="String" mayBeNull="true">The name of the
command to raise.</param>
/// <param name="commandArgument" mayBeNull="true" optional="true">Optional
command argument.</param>
/// <param name="commandTarget" optional="true" mayBeNull="true">DOM element
from which the command should start bubbling up.</param>
var e = Function._validateParams(arguments, [
{name: "commandSource"},
{name: "commandName", type: String, mayBeNull: true},
{name: "commandArgument", mayBeNull: true, optional: true},
{name: "commandTarget", mayBeNull: true, optional: true}
]);
if (e) throw e;
Sys.UI.DomEvent.addHandler(commandSource, 'click', function(ev) {
var source = commandTarget || this;
Sys.UI.DomElement.raiseBubbleEvent(source, new
Sys.CommandEventArgs(commandName, commandArgument, this, ev));
}, true /*autoRemove*/);
}

Sys.registerPlugin({
name: "setCommand",
dom: true,
returnType: "Sys.ElementSet",
description: "Causes a DOM element to raise a bubble event when clicked.",
parameters: [
{name: "commandName", type:"String", description: "The name of the command
to raise."},
{name: "commandArgument", description: "Optional command argument."},
{name: "commandTarget", description: "DOM element from which the command
should start bubbling up."}
],
plugin: function(commandName, commandArgument, commandTarget) {
var e = Function._validateParams(arguments, [
{name: "commandName", type: String, mayBeNull: true},
{name: "commandArgument", mayBeNull: true, optional: true},
{name: "commandTarget", mayBeNull: true, optional: true}
]);
if (e) throw e;
return this.addHandler('click', function(ev) {
var source = commandTarget || this;
Sys.UI.DomElement.raiseBubbleEvent(source, new
Sys.CommandEventArgs(commandName, commandArgument, this, ev));
}, true /*autoRemove*/);
}
});

$type._ensureOldDisplayMode = function DomElement$_ensureOldDisplayMode(element) {


if (!element._oldDisplayMode) {
var style = element.currentStyle || this._getCurrentStyle(element);
element._oldDisplayMode = style ? style.display : null;
if (!element._oldDisplayMode || element._oldDisplayMode === 'none') {
var tagName = element.tagName,
mode = 'inline';
if (/^(DIV|P|ADDRESS|BLOCKQUOTE|BODY|COL|COLGROUP|DD|DL|DT|FIELDSET|
FORM|H1|H2|H3|H4|H5|H6|HR|IFRAME|LEGEND|OL|PRE|TABLE|TD|TH|TR|UL)$/i.test(tagName))
{
mode = 'block';
}
else if (tagName.toUpperCase() === "LI") {
mode = 'list-item';
}
element._oldDisplayMode = mode;
}
}
}

$type._getWindow = function DomElement$_getWindow(element) {


var doc = element.ownerDocument || element.document || element;
return doc.defaultView || doc.parentWindow;
}

$type._getCurrentStyle = function DomElement$_getCurrentStyle(element) {


if (element.nodeType === 3) return null;
var w = this._getWindow(element);
if (element.documentElement) element = element.documentElement;
var computedStyle = (w && (element !== w) && w.getComputedStyle) ?
w.getComputedStyle(element, null) :
element.currentStyle || element.style;
return computedStyle;
}

$type._onDispose = function DomElement$_onDispose(element, fn) {


var queue, d = element.dispose;
if (d !== Sys.UI.DomElement._dispose) {
element.dispose = Sys.UI.DomElement._dispose;
element.__msajaxdispose = queue = [];
if (typeof(d) === "function") {
queue.push(d);
}
}
else {
queue = element.__msajaxdispose;
}
queue.push(fn);
}

$type._dispose = function DomElement$_dispose() {


var queue = this.__msajaxdispose;
if (queue) {
for (var i = 0, l = queue.length; i < l; i++) {
queue[i].apply(this);
}
}
if (this.control && typeof(this.control.dispose) === "function") {
this.control.dispose();
}
this.__msajaxdispose = null;
this.dispose = null;
}
$type = Sys.IContainer = function IContainer() {
throw Error.notImplemented();
}
$type.prototype = {
addComponent: function IContainer$addComponent(component) {
/// <summary locid="M:J#Sys.IContainer.addComponent"></summary>
/// <param name="component" type="Sys.Component"></param>
var e = Function._validateParams(arguments, [
{name: "component", type: Sys.Component}
]);
if (e) throw e;
throw Error.notImplemented();
},
removeComponent: function IContainer$removeComponent(component) {
/// <summary locid="M:J#Sys.IContainer.removeComponent"></summary>
/// <param name="component" type="Sys.Component"></param>
var e = Function._validateParams(arguments, [
{name: "component", type: Sys.Component}
]);
if (e) throw e;
throw Error.notImplemented();
},
findComponent: function IContainer$findComponent(id) {
/// <summary locid="M:J#Sys.IContainer.findComponent"></summary>
/// <param name="id" type="String"></param>
/// <returns type="Sys.Component"></returns>
var e = Function._validateParams(arguments, [
{name: "id", type: String}
]);
if (e) throw e;
throw Error.notImplemented();
},
getComponents: function IContainer$getComponents() {
/// <summary locid="M:J#Sys.IContainer.getComponents"></summary>
/// <returns type="Array" elementType="Sys.Component"></returns>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
}
$type.registerInterface("Sys.IContainer");

$type = Sys.ApplicationLoadEventArgs = function


ApplicationLoadEventArgs(components, isPartialLoad) {
/// <summary locid="M:J#Sys.ApplicationLoadEventArgs.#ctor"></summary>
/// <param name="components" type="Array" elementType="Sys.Component">The list
of components that were created since the last time the load event was
raised.</param>
/// <param name="isPartialLoad" type="Boolean">True if the page is partially
loading.</param>
var e = Function._validateParams(arguments, [
{name: "components", type: Array, elementType: Sys.Component},
{name: "isPartialLoad", type: Boolean}
]);
if (e) throw e;
Sys.ApplicationLoadEventArgs.initializeBase(this);
this._components = components;
this._isPartialLoad = isPartialLoad;
}
$type.prototype = {
get_components: function ApplicationLoadEventArgs$get_components() {
/// <value type="Array" elementType="Sys.Component"
locid="P:J#Sys.ApplicationLoadEventArgs.components">The list of components that
were created since the last time the load event was raised.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._components;
},
get_isPartialLoad: function ApplicationLoadEventArgs$get_isPartialLoad() {
/// <value type="Boolean"
locid="P:J#Sys.ApplicationLoadEventArgs.isPartialLoad">True if the page is
partially loading.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._isPartialLoad;
}
}
$type.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
$type = Sys._Application = function _Application() {
/// <summary locid="M:J#Sys.Application.#ctor"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
Sys._Application.initializeBase(this);

this._disposableObjects = [];
this._components = {};
this._createdComponents = [];
this._secondPassComponents = [];

this._unloadHandlerDelegate = Function.createDelegate(this,
this._unloadHandler);
Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
}
$type.prototype = {
_deleteCount: 0,

get_isCreatingComponents: function _Application$get_isCreatingComponents() {


/// <value type="Boolean"
locid="P:J#Sys.Application.isCreatingComponents"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._creatingComponents;
},
get_isDisposing: function _Application$get_isDisposing() {
/// <value type="Boolean" locid="P:J#Sys.Application.isDisposing"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._disposing;
},
add_init: function _Application$add_init(handler) {
/// <summary locid="E:J#Sys.Application.init"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
if (this._initialized) {
handler(this, Sys.EventArgs.Empty);
}
else {
this._addHandler("init", handler);
}
},
remove_init: function _Application$remove_init(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._removeHandler("init", handler);
},
add_load: function _Application$add_load(handler) {
/// <summary locid="E:J#Sys.Application.load"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._addHandler("load", handler);
},
remove_load: function _Application$remove_load(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._removeHandler("load", handler);
},
add_unload: function _Application$add_unload(handler) {
/// <summary locid="E:J#Sys.Application.unload"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._addHandler("unload", handler);
},
remove_unload: function _Application$remove_unload(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
this._removeHandler("unload", handler);
},
addComponent: function _Application$addComponent(component) {
/// <summary locid="M:J#Sys.Application.addComponent">Adds a top-level
component to the application.</summary>
/// <param name="component" type="Sys.Component">The component to
add.</param>
var e = Function._validateParams(arguments, [
{name: "component", type: Sys.Component}
]);
if (e) throw e;
var id = component.get_id();
if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId);
if (typeof(this._components[id]) !== 'undefined') throw
Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id));
this._components[id] = component;
},
beginCreateComponents: function _Application$beginCreateComponents() {
/// <summary locid="M:J#Sys.Application.beginCreateComponents"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._creatingComponents = true;
},
dispose: function _Application$dispose() {
/// <summary locid="M:J#Sys.Application.dispose"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._disposing) {
this._disposing = true;
if (this._timerCookie) {
window.clearTimeout(this._timerCookie);
delete this._timerCookie;
}
var endHandler = this._endRequestHandler;
var beginHandler = this._beginRequestHandler;
if (endHandler || beginHandler) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (endHandler) prm.remove_endRequest(endHandler);
if (beginHandler) prm.remove_beginRequest(beginHandler);
delete this._endRequestHandler;
delete this._beginRequestHandler;
}
if (window.pageUnload) {
window.pageUnload(this, Sys.EventArgs.Empty);
}
Sys.Observer.raiseEvent(this, "unload");
var disposableObjects = Array.clone(this._disposableObjects);
for (var i = 0, l = disposableObjects.length; i < l; i++) {
var object = disposableObjects[i];
if (typeof(object) !== "undefined") {
object.dispose();
}
}
this._disposableObjects.length = 0;

Sys.UI.DomEvent.removeHandler(window, "unload",
this._unloadHandlerDelegate);

if (Sys._ScriptLoader) {
var sl = Sys._ScriptLoader.getInstance();
if (sl) {
sl.dispose();
}
}

Sys._Application.callBaseMethod(this, 'dispose');
}
},
disposeElement: function _Application$disposeElement(element, childNodesOnly) {
/// <summary locid="M:J#Sys._Application.disposeElement">Disposes of
control and behavior resources associated with an element and its child
nodes.</summary>
/// <param name="element">The element to dispose.</param>
/// <param name="childNodesOnly" type="Boolean">Whether to dispose of the
element and its child nodes or only its child nodes.</param>
var e = Function._validateParams(arguments, [
{name: "element"},
{name: "childNodesOnly", type: Boolean}
]);
if (e) throw e;
if (element.nodeType === 1) {
var d, c, i, list,
allElements = element.getElementsByTagName("*"),
length = allElements.length,
children = new Array(length);
for (i = 0; i < length; i++) {
children[i] = allElements[i];
}
for (i = length - 1; i >= 0; i--) {
var child = children[i];
d = child.dispose;
if (d && typeof(d) === "function") {
child.dispose();
}
else {
c = child.control;
if (c && typeof(c.dispose) === "function") {
c.dispose();
}
}
list = child._behaviors;
if (list) {
this._disposeComponents(list);
}
list = child._components;
if (list) {
this._disposeComponents(list);
child._components = null;
}
}
if (!childNodesOnly) {
d = element.dispose;
if (d && typeof(d) === "function") {
element.dispose();
}
else {
c = element.control;
if (c && typeof(c.dispose) === "function") {
c.dispose();
}
}
list = element._behaviors;
if (list) {
this._disposeComponents(list);
}
list = element._components;
if (list) {
this._disposeComponents(list);
element._components = null;
}
}
}
},
endCreateComponents: function _Application$endCreateComponents() {
/// <summary locid="M:J#Sys.Application.endCreateComponents"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
var components = this._secondPassComponents;
for (var i = 0, l = components.length; i < l; i++) {
var entry = components[i],
component = entry.component;
Sys.Component._setReferences(component, entry.references);
component.endUpdate();
}
this._secondPassComponents = [];
this._creatingComponents = false;
},
findComponent: function _Application$findComponent(id, parent) {
/// <summary locid="M:J#Sys.Application.findComponent">Finds top-level
components that were added through addComponent if no parent is specified or
children of the specified parent. If parent is a component</summary>
/// <param name="id" type="String">The id of the component to find.</param>
/// <param name="parent" optional="true" mayBeNull="true">The component or
element that contains the component to find. If not specified or null, the search
is made on Application.</param>
/// <returns type="Sys.Component" mayBeNull="true">The component, or null
if it wasn't found.</returns>
var e = Function._validateParams(arguments, [
{name: "id", type: String},
{name: "parent", mayBeNull: true, optional: true}
]);
if (e) throw e;
return (parent ?
((Sys.IContainer.isInstanceOfType(parent)) ?
parent.findComponent(id) :
parent[id] || null) :
Sys.Application._components[id] || null);
},
getComponents: function _Application$getComponents() {
/// <summary locid="M:J#Sys.Application.getComponents"></summary>
/// <returns type="Array" elementType="Sys.Component"></returns>
if (arguments.length !== 0) throw Error.parameterCount();
var res = [];
var components = this._components;
for (var name in components) {
if (components.hasOwnProperty(name)) {
res.push(components[name]);
}
}
return res;
},
initialize: function _Application$initialize() {
/// <summary locid="M:J#Sys.Application.initialize"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
window.setTimeout(Function.createDelegate(this, this._doInitialize), 0);
},
_doInitialize: function _Application$_doInitialize() {
if(!this.get_isInitialized() && !this._disposing) {
Sys._Application.callBaseMethod(this, 'initialize');
this._raiseInit();
if (this.get_stateString) {
if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
this._beginRequestHandler = Function.createDelegate(this,
this._onPageRequestManagerBeginRequest);
prm.add_beginRequest(this._beginRequestHandler);
this._endRequestHandler = Function.createDelegate(this,
this._onPageRequestManagerEndRequest);
prm.add_endRequest(this._endRequestHandler);
}
var loadedEntry = this.get_stateString();
if (loadedEntry !== this._currentEntry) {
this._navigate(loadedEntry);
}
else {
this._ensureHistory();
}
}
this.raiseLoad();
}
},
notifyScriptLoaded: function _Application$notifyScriptLoaded() {
/// <summary locid="M:J#Sys.Application.notifyScriptLoaded">Called by
referenced scripts to indicate that they have completed loading.
[Obsolete]</summary>
if (arguments.length !== 0) throw Error.parameterCount();
},
registerDisposableObject: function
_Application$registerDisposableObject(object) {
/// <summary locid="M:J#Sys.Application.registerDisposableObject">Registers
a disposable object with the application.</summary>
/// <param name="object" type="Sys.IDisposable">The object to
register.</param>
var e = Function._validateParams(arguments, [
{name: "object", type: Sys.IDisposable}
]);
if (e) throw e;
if (!this._disposing) {
var objects = this._disposableObjects,
i = objects.length;
objects[i] = object;
object.__msdisposeindex = i;
}
},
raiseLoad: function _Application$raiseLoad() {
/// <summary locid="M:J#Sys.Application.raiseLoad"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
var args = new
Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded);
this._loaded = true;
Sys.Observer.raiseEvent(this, "load", args);
if (window.pageLoad) {
window.pageLoad(this, args);
}
this._createdComponents = [];
},
removeComponent: function _Application$removeComponent(component) {
/// <summary locid="M:J#Sys.Application.removeComponent">Removes a top-
level component from the application.</summary>
/// <param name="component" type="Sys.Component">The component to
remove.</param>
var e = Function._validateParams(arguments, [
{name: "component", type: Sys.Component}
]);
if (e) throw e;
var id = component.get_id();
if (id) delete this._components[id];
},
unregisterDisposableObject: function
_Application$unregisterDisposableObject(object) {
/// <summary
locid="M:J#Sys.Application.unregisterDisposableObject">Unregisters a disposable
object from the application.</summary>
/// <param name="object" type="Sys.IDisposable">The object to
unregister.</param>
var e = Function._validateParams(arguments, [
{name: "object", type: Sys.IDisposable}
]);
if (e) throw e;
if (!this._disposing) {
var i = object.__msdisposeindex;
if (typeof(i) === "number") {
var disposableObjects = this._disposableObjects;
delete disposableObjects[i];
delete object.__msdisposeindex;
if (++this._deleteCount > 1000) {
var newArray = [];
for (var j = 0, l = disposableObjects.length; j < l; j++) {
object = disposableObjects[j];
if (typeof(object) !== "undefined") {
object.__msdisposeindex = newArray.length;
newArray.push(object);
}
}
this._disposableObjects = newArray;
this._deleteCount = 0;
}
}
}
},
_addComponentToSecondPass: function
_Application$_addComponentToSecondPass(component, references) {
this._secondPassComponents.push({component: component, references:
references});
},
_disposeComponents: function _Application$_disposeComponents(list) {
if (list) {
for (var i = list.length - 1; i >= 0; i--) {
var item = list[i];
if (typeof(item.dispose) === "function") {
item.dispose();
}
}
}
},
_raiseInit: function _Application$_raiseInit() {
this.beginCreateComponents();
Sys.Observer.raiseEvent(this, "init");
this.endCreateComponents();
},
_unloadHandler: function _Application$_unloadHandler(event) {
this.dispose();
}
}
$type.registerClass('Sys._Application', Sys.Component, Sys.IContainer);

Sys.Application = new Sys._Application();


window.$find = Sys.Application.findComponent;

Sys.onReady(function() {
Sys.Application._doInitialize();
});

$type = Sys.UI.Behavior = function Behavior(element) {


/// <summary locid="M:J#Sys.UI.Behavior.#ctor"></summary>
/// <param name="element" domElement="true">The DOM element the behavior is
associated with.</param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
Sys.UI.Behavior.initializeBase(this);
this._element = element;
var behaviors = (element._behaviors = element._behaviors || []);
behaviors.push(this);
}
$type.prototype = {
get_element: function Behavior$get_element() {
/// <value domElement="true" locid="P:J#Sys.UI.Behavior.element">The DOM
element this behavior is associated with</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._element;
},
get_id: function Behavior$get_id() {
/// <value type="String" locid="P:J#Sys.UI.Behavior.id"></value>
if (arguments.length !== 0) throw Error.parameterCount();
var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
if (baseId) return baseId;
var element = this._element;
if (!element || !element.id) return '';
return element.id + '$' + this.get_name();
},
get_name: function Behavior$get_name() {
/// <value type="String" locid="P:J#Sys.UI.Behavior.name"></value>
if (arguments.length !== 0) throw Error.parameterCount();
if (this._name) return this._name;
var name = Object.getTypeName(this);
var i = name.lastIndexOf('.');
if (i >= 0) name = name.substr(i + 1);
if (!this._initialized) this._name = name;
return name;
},
set_name: function Behavior$set_name(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
if ((value === '') || (value.charAt(0) === ' ') ||
(value.charAt(value.length - 1) === ' '))
throw Error.argument('value', Sys.Res.invalidId);
if (typeof(this._element[value]) !== 'undefined')
throw
Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value));
if (this.get_isInitialized()) throw
Error.invalidOperation(Sys.Res.cantSetNameAfterInit);
this._name = value;
},
initialize: function Behavior$initialize() {
Sys.UI.Behavior.callBaseMethod(this, 'initialize');
var name = this.get_name();
if (name) this._element[name] = this;
},
dispose: function Behavior$dispose() {
Sys.UI.Behavior.callBaseMethod(this, 'dispose');
var e = this._element;
if (e) {
var name = this.get_name();
if (name) {
e[name] = null;
}
var behaviors = e._behaviors;
Array.remove(behaviors, this);
if (!behaviors.length) {
e._behaviors = null;
}
delete this._element;
}
}
}
$type.registerClass('Sys.UI.Behavior', Sys.Component);

$type.getBehaviorByName = function Behavior$getBehaviorByName(element, name) {


/// <summary locid="M:J#Sys.UI.Behavior.getBehaviorByName">Gets a behavior with
the specified name from the dom element.</summary>
/// <param name="element" domElement="true">The DOM element to inspect.</param>
/// <param name="name" type="String">The name of the behavior to look
for.</param>
/// <returns type="Sys.UI.Behavior" mayBeNull="true">The behaviors or null if
it was not found.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "name", type: String}
]);
if (e) throw e;
var b = element[name];
return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
}

$type.getBehaviors = function Behavior$getBehaviors(element) {


/// <summary locid="M:J#Sys.UI.Behavior.getBehaviors">Gets a collection
containing the behaviors associated with an element.</summary>
/// <param name="element" domElement="true">The DOM element.</param>
/// <returns type="Array" elementType="Sys.UI.Behavior">An array containing the
behaviors associated with the DOM element.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
var behaviors = element._behaviors;
return behaviors ? Array.clone(behaviors) : [];
}

Sys.UI.Behavior.getBehaviorsByType = function Behavior$getBehaviorsByType(element,


type) {
/// <summary locid="M:J#Sys.UI.Behavior.getBehaviorsByType">Gets an array of
behaviors with the specified type from the dom element.</summary>
/// <param name="element" domElement="true">The DOM element to inspect.</param>
/// <param name="type" type="Type">The type of behavior to look for.</param>
/// <returns type="Array" elementType="Sys.UI.Behavior">An array containing the
behaviors of the specified type found on the element. The array is empty if no
behavior of this type was found.</returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true},
{name: "type", type: Type}
]);
if (e) throw e;
var behaviors = element._behaviors;
var results = [];
if (behaviors) {
for (var i = 0, l = behaviors.length; i < l; i++) {
var behavior = behaviors[i];
if (type.isInstanceOfType(behavior)) {
results.push(behavior);
}
}
}
return results;
}
$type = Sys.UI.VisibilityMode = function VisibilityMode() {
/// <summary locid="M:J#Sys.UI.VisibilityMode.#ctor">Describes how a DOM
element should disappear when its visible property is set to false.</summary>
/// <field name="hide" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.VisibilityMode.hide">The element disappears but its space
remains</field>
/// <field name="collapse" type="Number" integer="true" static="true"
locid="F:J#Sys.UI.VisibilityMode.collapse">The element disappears and the space it
occupied is collapsed.</field>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
}
$type.prototype = {
hide: 0,
collapse: 1
}
$type.registerEnum("Sys.UI.VisibilityMode");

$type = Sys.UI.Control = function Control(element) {


/// <summary locid="M:J#Sys.UI.Control.#ctor"></summary>
/// <param name="element" domElement="true">The DOM element the behavior is
associated with.</param>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
if (element.control) throw
Error.invalidOperation(Sys.Res.controlAlreadyDefined);
Sys.UI.Control.initializeBase(this);

this._element = element;
element.control = this;
var role = this.get_role();
if (role) {
element.setAttribute("role", role);
}
}
$type.prototype = {
_parent: null,
_visibilityMode: Sys.UI.VisibilityMode.hide,

get_element: function Control$get_element() {


/// <value domElement="true" locid="P:J#Sys.UI.Control.element">The DOM
element this behavior is associated with</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._element;
},
get_id: function Control$get_id() {
/// <value type="String" locid="P:J#Sys.UI.Control.id"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._id || (this._element ? this._element.id : "");
},
get_parent: function Control$get_parent() {
/// <value type="Sys.UI.Control" locid="P:J#Sys.UI.Control.parent"></value>
if (arguments.length !== 0) throw Error.parameterCount();
if (this._parent) return this._parent;
if (!this._element) return null;

var parentElement = this._element.parentNode;


while (parentElement) {
if (parentElement.control) {
return parentElement.control;
}
parentElement = parentElement.parentNode;
}
return null;
},
set_parent: function Control$set_parent(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Sys.UI.Control}]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
var parents = [this];
var current = value;
while (current) {
if (Array.contains(parents, current)) throw
Error.invalidOperation(Sys.Res.circularParentChain);
parents.push(current);
current = current.get_parent();
}
this._parent = value;
},
get_role: function Control$get_role() {
/// <value type="String" locid="P:J#Sys.UI.Control.role"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return null;
},
get_visibilityMode: function Control$get_visibilityMode() {
/// <value type="Sys.UI.VisibilityMode"
locid="P:J#Sys.UI.Control.visibilityMode"></value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
return Sys.UI.DomElement.getVisibilityMode(this._element);
},
set_visibilityMode: function Control$set_visibilityMode(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Sys.UI.VisibilityMode}]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
Sys.UI.DomElement.setVisibilityMode(this._element, value);
},
get_visible: function Control$get_visible() {
/// <value type="Boolean" locid="P:J#Sys.UI.Control.visible"></value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
return Sys.UI.DomElement.getVisible(this._element);
},
set_visible: function Control$set_visible(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Boolean}]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
Sys.UI.DomElement.setVisible(this._element, value)
},
addCssClass: function Control$addCssClass(className) {
/// <summary locid="M:J#Sys.UI.Control.addCssClass">Adds a CSS class to the
control if it doesn't already have it.</summary>
/// <param name="className" type="String">The name of the CSS class to
add.</param>
var e = Function._validateParams(arguments, [
{name: "className", type: String}
]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
Sys.UI.DomElement.addCssClass(this._element, className);
},
dispose: function Control$dispose() {
Sys.UI.Control.callBaseMethod(this, 'dispose');
if (this._element) {
this._element.control = null;
delete this._element;
}
if (this._parent) delete this._parent;
},
onBubbleEvent: function Control$onBubbleEvent(source, args) {
/// <summary locid="M:J#Sys.UI.Control.onBubbleEvent"></summary>
/// <param name="source">The object that triggered the event.</param>
/// <param name="args" type="Sys.EventArgs">The event arguments.</param>
/// <returns type="Boolean">False, because the event was not handled and
should bubble up further. Derived classes should override that and return true
whenever they handle the event to prevent it from bubbling up.</returns>
var e = Function._validateParams(arguments, [
{name: "source"},
{name: "args", type: Sys.EventArgs}
]);
if (e) throw e;
return false;
},
raiseBubbleEvent: function Control$raiseBubbleEvent(source, args) {
/// <summary locid="M:J#Sys.UI.Control.raiseBubbleEvent"></summary>
/// <param name="source">The object that triggered the event.</param>
/// <param name="args" type="Sys.EventArgs">The event arguments.</param>
var e = Function._validateParams(arguments, [
{name: "source"},
{name: "args", type: Sys.EventArgs}
]);
if (e) throw e;
this._raiseBubbleEvent(source, args);
},
_raiseBubbleEvent: function Control$_raiseBubbleEvent(source, args) {
var currentTarget = this.get_parent();
while (currentTarget) {
if (currentTarget.onBubbleEvent(source, args)) {
return;
}
currentTarget = currentTarget.get_parent();
}
},
removeCssClass: function Control$removeCssClass(className) {
/// <summary locid="M:J#Sys.UI.Control.removeCssClass">Removes a CSS class
from the control.</summary>
/// <param name="className" type="String">The name of the CSS class to
remove.</param>
var e = Function._validateParams(arguments, [
{name: "className", type: String}
]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
Sys.UI.DomElement.removeCssClass(this._element, className);
},
toggleCssClass: function Control$toggleCssClass(className) {
/// <summary locid="M:J#Sys.UI.Control.toggleCssClass">Toggles a CSS class
on and off on the control.</summary>
/// <param name="className" type="String">The name of the CSS class to
toggle.</param>
var e = Function._validateParams(arguments, [
{name: "className", type: String}
]);
if (e) throw e;
if (!this._element) throw
Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
Sys.UI.DomElement.toggleCssClass(this._element, className);
}
}
$type.registerClass('Sys.UI.Control', Sys.Component);

$type = Sys.HistoryEventArgs = function HistoryEventArgs(state) {


/// <summary locid="M:J#Sys.HistoryEventArgs.#ctor"></summary>
/// <param name="state" type="Object"></param>
var e = Function._validateParams(arguments, [
{name: "state", type: Object}
]);
if (e) throw e;
Sys.HistoryEventArgs.initializeBase(this);
this._state = state;
}
$type.prototype = {
get_state: function HistoryEventArgs$get_state() {
/// <value type="Object" locid="P:J#Sys.HistoryEventArgs.state"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._state;
}
}
$type.registerClass('Sys.HistoryEventArgs', Sys.EventArgs);
$type = Sys.Application;
$type._currentEntry = '';
$type._initialState = null;
$type._state = {};

$prototype = Sys._Application.prototype;
$prototype.get_stateString = function _Application$get_stateString() {
/// <summary locid="M:J#Sys._Application.get_stateString"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
var hash = null;

if (isBrowser("Firefox")) {
var href = window.location.href;
var hashIndex = href.indexOf('#');
if (hashIndex !== -1) {
hash = href.substring(hashIndex + 1);
}
else {
hash = "";
}
return hash;
}
else {
hash = window.location.hash;
}

if (hash.length && (hash.charAt(0) === '#')) {


hash = hash.substring(1);
}

return hash;
};

$prototype.get_enableHistory = function _Application$get_enableHistory() {


/// <summary locid="M:J#Sys._Application.get_enableHistory"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._enableHistory;
};

$prototype.set_enableHistory = function _Application$set_enableHistory(value) {


if (this._initialized && !this._initializing) {
throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory);
}
else if (this._historyEnabledInScriptManager && !value) {
throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination);
}
this._enableHistory = value;
};

$prototype.add_navigate = function _Application$add_navigate(handler) {


/// <summary locid="E:J#Sys.Application.navigate"></summary>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "handler", type: Function}
]);
if (e) throw e;
this._addHandler("navigate", handler);
};

$prototype.remove_navigate = function _Application$remove_navigate(handler) {


/// <summary locid="M:J#Sys._Application.remove_navigate"></summary>
/// <param name="handler" type="Function"></param>
var e = Function._validateParams(arguments, [
{name: "handler", type: Function}
]);
if (e) throw e;
this._removeHandler("navigate", handler);
};

$prototype.addHistoryPoint = function _Application$addHistoryPoint(state, title) {


/// <summary locid="M:J#Sys.Application.addHistoryPoint"></summary>
/// <param name="state" type="Object">A dictionary of state bits that will be
added to the main state to form the global state of the new history point. The
state must be a string dictionary. The application is responsible for converting
the state bits from and into the relevant types.</param>
/// <param name="title" type="String" optional="true" mayBeNull="true">The
title for the new history point.</param>
var e = Function._validateParams(arguments, [
{name: "state", type: Object},
{name: "title", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
if (!this._enableHistory) throw
Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled);
for (var n in state) {
var v = state[n];
var t = typeof(v);
if ((v !== null) && ((t === 'object') || (t === 'function') || (t ===
'undefined'))) {
throw Error.argument('state', Sys.Res.stateMustBeStringDictionary);
}
}
this._ensureHistory();
var initialState = this._state;
for (var key in state) {
var value = state[key];
if (value === null) {
if (typeof(initialState[key]) !== 'undefined') {
delete initialState[key];
}
}
else {
initialState[key] = value;
}
}
var entry = this._serializeState(initialState);
this._historyPointIsNew = true;
this._setState(entry, title);
this._raiseNavigate();
};

$prototype.setServerId = function _Application$setServerId(clientId, uniqueId) {


/// <summary locid="M:J#Sys.Application.setServerId"></summary>
/// <param name="clientId" type="String"></param>
/// <param name="uniqueId" type="String"></param>
var e = Function._validateParams(arguments, [
{name: "clientId", type: String},
{name: "uniqueId", type: String}
]);
if (e) throw e;
this._clientId = clientId;
this._uniqueId = uniqueId;
};

$prototype.setServerState = function _Application$setServerState(value) {


/// <summary locid="M:J#Sys.Application.setServerState"></summary>
/// <param name="value" type="String"></param>
var e = Function._validateParams(arguments, [
{name: "value", type: String}
]);
if (e) throw e;
this._ensureHistory();
this._state.__s = value;
this._updateHiddenField(value);
};

$prototype._deserializeState = function _Application$_deserializeState(entry) {


var result = {};
entry = entry || '';
var serverSeparator = entry.indexOf('&&');
if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) {
result.__s = entry.substr(serverSeparator + 2);
entry = entry.substr(0, serverSeparator);
}
var tokens = entry.split('&');
for (var i = 0, l = tokens.length; i < l; i++) {
var token = tokens[i];
var equal = token.indexOf('=');
if ((equal !== -1) && (equal + 1 < token.length)) {
var name = token.substr(0, equal);
var value = token.substr(equal + 1);
result[name] = decodeURIComponent(value);
}
}
return result;
};

$prototype._enableHistoryInScriptManager = function
_Application$_enableHistoryInScriptManager() {
this._enableHistory = true;
this._historyEnabledInScriptManager = true;
};

$prototype._ensureHistory = function _Application$_ensureHistory() {


if (!this._historyInitialized && this._enableHistory) {
if (isBrowser("InternetExplorer") && (Sys.Browser.documentMode < 8)) {
this._historyFrame = Sys.get('#__historyFrame');
if (!this._historyFrame) throw
Error.invalidOperation(Sys.Res.historyMissingFrame);
this._ignoreIFrame = true;
}
this._timerHandler = Function.createDelegate(this, this._onIdle);
this._timerCookie = window.setTimeout(this._timerHandler, 100);

var e;
try {
this._initialState = this._deserializeState(this.get_stateString());
}
catch(e) {}

this._historyInitialized = true;
}
};

$prototype._navigate = function _Application$_navigate(entry) {


this._ensureHistory();

var state = this._deserializeState(entry);

if (this._uniqueId) {
var oldServerEntry = this._state.__s || '';
var newServerEntry = state.__s || '';
if (newServerEntry !== oldServerEntry) {
this._updateHiddenField(newServerEntry);
__doPostBack(this._uniqueId, newServerEntry);
this._state = state;
return;
}
}
this._setState(entry);
this._state = state;
this._raiseNavigate();
};

$prototype._onIdle = function _Application$_onIdle() {


delete this._timerCookie;

var entry = this.get_stateString();


if (entry !== this._currentEntry) {
if (!this._ignoreTimer) {
this._historyPointIsNew = false;
this._navigate(entry);
}
}
else {
this._ignoreTimer = false;
}
this._timerCookie = window.setTimeout(this._timerHandler, 100);
};

$prototype._onIFrameLoad = function _Application$_onIFrameLoad(entry) {


this._ensureHistory();
if (!this._ignoreIFrame) {
this._historyPointIsNew = false;
this._navigate(entry);
}
this._ignoreIFrame = false;
};

$prototype._onPageRequestManagerBeginRequest = function
_Application$_onPageRequestManagerBeginRequest(sender, args) {
this._ignoreTimer = true;
this._originalTitle = document.title;
};

$prototype._onPageRequestManagerEndRequest = function
_Application$_onPageRequestManagerEndRequest(sender, args) {
var dataItem = args.get_dataItems()[this._clientId];
var originalTitle = this._originalTitle;
this._originalTitle = null;

var eventTarget = Sys.get("#__EVENTTARGET");


if (eventTarget && eventTarget.value === this._uniqueId) {
eventTarget.value = '';
}
if (typeof(dataItem) !== 'undefined') {
this.setServerState(dataItem);
this._historyPointIsNew = true;
}
else {
this._ignoreTimer = false;
}
var entry = this._serializeState(this._state);
if (entry !== this._currentEntry) {
this._ignoreTimer = true;
if (typeof(originalTitle) === "string") {
if (!isBrowser("InternetExplorer") || Sys.Browser.version > 7) {
var newTitle = document.title;
document.title = originalTitle;
this._setState(entry);
document.title = newTitle;
}
else {
this._setState(entry);
}
this._raiseNavigate();
}
else {
this._setState(entry);
this._raiseNavigate();
}
}
};

$prototype._raiseNavigate = function _Application$_raiseNavigate() {


var isNew = this._historyPointIsNew;
var stateClone = {};
for (var key in this._state) {
if (key !== '__s') {
stateClone[key] = this._state[key];
}
}
var args = new Sys.HistoryEventArgs(stateClone);
Sys.Observer.raiseEvent(this, "navigate", args);
if (!isNew) {
var err;
try {
if (isBrowser("Firefox") && window.location.hash &&
(!window.frameElement || window.top.location.hash)) {
(Sys.Browser.version < 3.5) ?
window.history.go(0) :
location.hash = this.get_stateString();
}
}
catch(err) {
}
}
};

$prototype._serializeState = function _Application$_serializeState(state) {


var serialized = [];
for (var key in state) {
var value = state[key];
if (key === '__s') {
var serverState = value;
}
else {
if (key.indexOf('=') !== -1) throw Error.argument('state',
Sys.Res.stateFieldNameInvalid);
serialized.push(key + '=' + encodeURIComponent(value));
}
}
return serialized.join('&') + (serverState ? '&&' + serverState : '');
};

$prototype._setState = function _Application$_setState(entry, title) {


if (this._enableHistory) {
entry = entry || '';
if (entry !== this._currentEntry) {
if (window.theForm) {
var action = window.theForm.action;
var hashIndex = action.indexOf('#');
window.theForm.action = ((hashIndex !== -1) ? action.substring(0,
hashIndex) : action) + '#' + entry;
}

if (this._historyFrame && this._historyPointIsNew) {


this._ignoreIFrame = true;
var frameDoc = this._historyFrame.contentWindow.document;
frameDoc.open("javascript:'<html></html>'");
frameDoc.write("<html><head><title>" + (title || document.title) +
"</title><scri" + "pt
type=\"text/javascript\">parent.Sys.Application._onIFrameLoad(" +
Sys.Serialization.JavaScriptSerializer.serialize(entry) +
");</scri" + "pt></head><body></body></html>");
frameDoc.close();
}
this._ignoreTimer = false;
this._currentEntry = entry;
if (this._historyFrame || this._historyPointIsNew) {
var currentHash = this.get_stateString();
if (entry !== currentHash) {
var loc = document.location;
if (loc.href.length - loc.hash.length + entry.length > 2048) {
throw
Error.invalidOperation(String.format(Sys.Res.urlTooLong, 2048));
}
window.location.hash = entry;
this._currentEntry = this.get_stateString();
if ((typeof(title) !== 'undefined') && (title !== null)) {
document.title = title;
}
}
}
this._historyPointIsNew = false;
}
}
};

$prototype._updateHiddenField = function _Application$_updateHiddenField(value) {


if (this._clientId) {
var serverStateField = document.getElementById(this._clientId);
if (serverStateField) {
serverStateField.value = value;
}
}
};
if (!window.XMLHttpRequest) {
window.XMLHttpRequest = function window$XMLHttpRequest() {
var ex, progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
for (var i = 0, l = progIDs.length; i < l; i++) {
try {
return new ActiveXObject(progIDs[i]);
}
catch (ex) {
}
}
return null;
}
}

Type.registerNamespace('Sys.Net');

$type = Sys.Net.WebRequestExecutor = function WebRequestExecutor() {


/// <summary locid="M:J#Sys.Net.WebRequestExecutor.#ctor">Base class for
WebRequestExecutors which handle the actual execution of a WebRequest</summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._webRequest = null;
this._resultObject = null;
}

$type.prototype = {
get_started: function WebRequestExecutor$get_started() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebRequestExecutor.started"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_responseAvailable: function WebRequestExecutor$get_responseAvailable() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebRequestExecutor.responseAvailable"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_timedOut: function WebRequestExecutor$get_timedOut() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebRequestExecutor.timedOut"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_aborted: function WebRequestExecutor$get_aborted() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebRequestExecutor.aborted"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_responseData: function WebRequestExecutor$get_responseData() {
/// <value type="String"
locid="P:J#Sys.Net.WebRequestExecutor.responseData"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_statusCode: function WebRequestExecutor$get_statusCode() {
/// <value type="Number"
locid="P:J#Sys.Net.WebRequestExecutor.statusCode"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_statusText: function WebRequestExecutor$get_statusText() {
/// <value type="String"
locid="P:J#Sys.Net.WebRequestExecutor.statusText"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_xml: function WebRequestExecutor$get_xml() {
/// <value locid="P:J#Sys.Net.WebRequestExecutor.xml"></value>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
executeRequest: function WebRequestExecutor$executeRequest() {
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.executeRequest">Begins
execution of the request.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
abort: function WebRequestExecutor$abort() {
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.abort">Aborts the
request.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
getAllResponseHeaders: function WebRequestExecutor$getAllResponseHeaders() {
/// <summary
locid="M:J#Sys.Net.WebRequestExecutor.getAllResponseHeaders">Returns all the
responses header.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
getResponseHeader: function WebRequestExecutor$getResponseHeader(header) {
/// <summary
locid="M:J#Sys.Net.WebRequestExecutor.getResponseHeader">Returns a response
header.</summary>
/// <param name="header" type="String">The requested header.</param>
var e = Function._validateParams(arguments, [
{name: "header", type: String}
]);
if (e) throw e;
throw Error.notImplemented();
},
get_webRequest: function WebRequestExecutor$get_webRequest() {
/// <value type="Sys.Net.WebRequest"
locid="P:J#Sys.Net.WebRequestExecutor.webRequest"></value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._webRequest;
},
_set_webRequest: function WebRequestExecutor$_set_webRequest(value) {
if (this.get_started()) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted,
'set_webRequest'));
}
this._webRequest = value;
},
get_object: function WebRequestExecutor$get_object() {
/// <value locid="P:J#Sys.Net.WebRequestExecutor.object">The JSON eval'd
response.</value>
if (arguments.length !== 0) throw Error.parameterCount();
var result = this._resultObject;
if (!result) {
this._resultObject = result =
Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
}
return result;
}
}
$type.registerClass('Sys.Net.WebRequestExecutor');
Sys.Net.XMLDOM = function XMLDOM(markup) {
/// <summary locid="M:J#Sys.Net.XMLDOM.#ctor">Creates an XML document from an
XML string.</summary>
/// <param name="markup" type="String">The XML string to parse.</param>
var e = Function._validateParams(arguments, [
{name: "markup", type: String}
]);
if (e) throw e;
if (!window.DOMParser) {
var ex, progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
for (var i = 0, l = progIDs.length; i < l; i++) {
try {
var xmlDOM = new ActiveXObject(progIDs[i]);
xmlDOM.async = false;
xmlDOM.loadXML(markup);
xmlDOM.setProperty('SelectionLanguage', 'XPath');
return xmlDOM;
}
catch (ex) {
}
}
}
else {
try {
var domParser = new window.DOMParser();
return domParser.parseFromString(markup, 'text/xml');
}
catch (ex) {
}
}
return null;
}

$type = Sys.Net.XMLHttpExecutor = function XMLHttpExecutor() {


/// <summary
locid="M:J#Sys.Net.XMLHttpExecutor.#ctor">XMLHttpExecutor</summary>
if (arguments.length !== 0) throw Error.parameterCount();

Sys.Net.XMLHttpExecutor.initializeBase(this);

var _this = this;

this._onReadyStateChange = (function () {
/*
readyState values:
0 = uninitialized
1 = loading
2 = loaded
3 = interactive
4 = complete
*/
if (_this._xmlHttpRequest.readyState === 4 /*complete*/) {
try {
if (typeof(_this._xmlHttpRequest.status) === "undefined") {
return;
}
}
catch(ex) {
return;
}

_this._clearTimer();
_this._responseAvailable = true;
_this._webRequest.completed(Sys.EventArgs.Empty);
if (_this._xmlHttpRequest) {
_this._xmlHttpRequest.onreadystatechange =
Function.emptyMethod;
_this._xmlHttpRequest = null;
}
}
});

this._clearTimer = (function() {
if (_this._timer) {
window.clearTimeout(_this._timer);
_this._timer = null;
}
});

this._onTimeout = (function() {
if (!_this._responseAvailable) {
_this._clearTimer();
_this._timedOut = true;
var xhr = _this._xmlHttpRequest;
xhr.onreadystatechange = Function.emptyMethod;
xhr.abort();
_this._webRequest.completed(Sys.EventArgs.Empty);
_this._xmlHttpRequest = null;
}
});

$type.prototype = {

get_timedOut: function XMLHttpExecutor$get_timedOut() {


/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.timedOut">True
if the executor has timed out.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._timedOut;
},

get_started: function XMLHttpExecutor$get_started() {


/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.started">True
if the executor has started.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._started;
},

get_responseAvailable: function XMLHttpExecutor$get_responseAvailable() {


/// <value type="Boolean"
locid="P:J#Sys.Net.XMLHttpExecutor.responseAvailable">True if a response is
available.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._responseAvailable;
},

get_aborted: function XMLHttpExecutor$get_aborted() {


/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.aborted">True
if the executor has been aborted.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._aborted;
},

executeRequest: function XMLHttpExecutor$executeRequest() {


/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.executeRequest">Invokes the
request.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
var request = this.get_webRequest();
this._webRequest = request;

if (this._started) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted,
'executeRequest'));
}
if (!this._webRequest) {
throw Error.invalidOperation(Sys.Res.nullWebRequest);
}

var body = request.get_body();


var headers = request.get_headers();
var xhr = new XMLHttpRequest();
this._xmlHttpRequest = xhr;
xhr.onreadystatechange = this._onReadyStateChange;
var verb = request.get_httpVerb();
xhr.open(verb, request.getResolvedUrl(), true /*async*/);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
if (headers) {
for (var header in headers) {
var val = headers[header];
if (typeof(val) !== "function")
xhr.setRequestHeader(header, val);
}
}

if (verb.toLowerCase() === "post") {


if ((headers === null) || !headers['Content-Type']) {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-
urlencoded; charset=utf-8');
}
if (!body) {
body = "";
}
}

var timeout = request.get_timeout();


if (timeout > 0) {
this._timer = window.setTimeout(Function.createDelegate(this,
this._onTimeout), timeout);
}
xhr.send(body);
this._started = true;
},

getResponseHeader: function XMLHttpExecutor$getResponseHeader(header) {


/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getResponseHeader">Returns
a response header.</summary>
/// <param name="header" type="String">The requested header.</param>
/// <returns type="String">The value of the header.</returns>
var e = Function._validateParams(arguments, [
{name: "header", type: String}
]);
if (e) throw e;
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse,
'getResponseHeader'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler,
'getResponseHeader'));
}

var er, result;


try {
result = this._xmlHttpRequest.getResponseHeader(header);
} catch (er) {
}
if (!result) result = "";
return result;
},

getAllResponseHeaders: function XMLHttpExecutor$getAllResponseHeaders() {


/// <summary
locid="M:J#Sys.Net.XMLHttpExecutor.getAllResponseHeaders">Returns all the responses
header.</summary>
/// <returns type="String">The text of all the headers.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse,
'getAllResponseHeaders'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler,
'getAllResponseHeaders'));
}
return this._xmlHttpRequest.getAllResponseHeaders();
},

get_responseData: function XMLHttpExecutor$get_responseData() {


/// <value type="String"
locid="P:J#Sys.Net.XMLHttpExecutor.responseData">The text of the response.</value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse,
'get_responseData'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler,
'get_responseData'));
}

return this._xmlHttpRequest.responseText;
},

get_statusCode: function XMLHttpExecutor$get_statusCode() {


/// <value type="Number" locid="P:J#Sys.Net.XMLHttpExecutor.statusCode">The
status code of the response.</value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse,
'get_statusCode'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler,
'get_statusCode'));
}
var ex, result = 0;
try {
result = this._xmlHttpRequest.status;
}
catch(ex) {
}
return result;
},

get_statusText: function XMLHttpExecutor$get_statusText() {


/// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.statusText">The
status text of the repsonse.</value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse,
'get_statusText'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler,
'get_statusText'));
}
return this._xmlHttpRequest.statusText;
},

get_xml: function XMLHttpExecutor$get_xml() {


/// <value locid="P:J#Sys.Net.XMLHttpExecutor.xml">The response in xml
format.</value>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
}
if (!this._xmlHttpRequest) {
throw
Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
}
var xhr = this._xmlHttpRequest;
var xml = xhr.responseXML;
if (!xml || !xml.documentElement) {

xml = Sys.Net.XMLDOM(xhr.responseText);

if (!xml || !xml.documentElement)
return null;
}
else if (navigator.userAgent.indexOf('MSIE') !== -1) {
xml.setProperty('SelectionLanguage', 'XPath');
}

if (xml.documentElement.namespaceURI ===
"http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
xml.documentElement.tagName === "parsererror") {
return null;
}

if (xml.documentElement.firstChild &&
xml.documentElement.firstChild.tagName === "parsererror") {
return null;
}

return xml;
},

abort: function XMLHttpExecutor$abort() {


/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.abort">Aborts the
request.</summary>
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._started) {
throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
}

if (this._aborted || this._responseAvailable || this._timedOut)


return;

this._aborted = true;

this._clearTimer();
var xhr = this._xmlHttpRequest;
if (xhr && !this._responseAvailable) {
xhr.onreadystatechange = Function.emptyMethod;
xhr.abort();

this._xmlHttpRequest = null;

this._webRequest.completed(Sys.EventArgs.Empty);
}
}
}
$type.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
$type = Sys.Net._WebRequestManager = function _WebRequestManager() {
/// <summary locid="P:J#Sys.Net.WebRequestManager.#ctor"></summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
}

$type.prototype = {
add_invokingRequest: function _WebRequestManager$add_invokingRequest(handler) {
/// <summary
locid="E:J#Sys.Net.WebRequestManager.invokingRequest"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "invokingRequest", handler);
},
remove_invokingRequest: function
_WebRequestManager$remove_invokingRequest(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "invokingRequest", handler);
},

add_completedRequest: function _WebRequestManager$add_completedRequest(handler)


{
/// <summary
locid="E:J#Sys.Net.WebRequestManager.completedRequest"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "completedRequest", handler);
},
remove_completedRequest: function
_WebRequestManager$remove_completedRequest(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "completedRequest", handler);
},
get_defaultTimeout: function _WebRequestManager$get_defaultTimeout() {
/// <value type="Number"
locid="P:J#Sys.Net.WebRequestManager.defaultTimeout">The default timeout for
requests in milliseconds.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._defaultTimeout || 0;
},
set_defaultTimeout: function _WebRequestManager$set_defaultTimeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
}

this._defaultTimeout = value;
},

get_defaultExecutorType: function _WebRequestManager$get_defaultExecutorType()


{
/// <value type="String"
locid="P:J#Sys.Net.WebRequestManager.defaultExecutorType">The default executor type
name.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._defaultExecutorType;
},
set_defaultExecutorType: function
_WebRequestManager$set_defaultExecutorType(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
this._defaultExecutorType = value;
},

executeRequest: function _WebRequestManager$executeRequest(webRequest) {


/// <summary locid="M:J#Sys.Net.WebRequestManager.executeRequest">Executes
a request.</summary>
/// <param name="webRequest" type="Sys.Net.WebRequest">The webRequest to
execute.</param>
var e = Function._validateParams(arguments, [
{name: "webRequest", type: Sys.Net.WebRequest}
]);
if (e) throw e;
var executor = webRequest.get_executor();
if (!executor) {
var er, failed;
try {
var executorType = window.eval(this._defaultExecutorType);
executor = new executorType();
}
catch (er) {
failed = true;
}

if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor)
|| !executor) {
throw Error.argument("defaultExecutorType",
String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
}

webRequest.set_executor(executor);
}

if (!executor.get_aborted()) {
var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
Sys.Observer.raiseEvent(this, "invokingRequest", evArgs);
if (!evArgs.get_cancel()) {
executor.executeRequest();
}
}
}
}

$type.registerClass('Sys.Net._WebRequestManager');

Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();


$type = Sys.Net.NetworkRequestEventArgs = function
NetworkRequestEventArgs(webRequest) {
/// <summary locid="M:J#Sys.Net.NetworkRequestEventArgs.#ctor">This class is
raised by the WebRequestManager when a WebRequest is about to be
executed.</summary>
/// <param name="webRequest" type="Sys.Net.WebRequest">The identifier for the
event.</param>
var e = Function._validateParams(arguments, [
{name: "webRequest", type: Sys.Net.WebRequest}
]);
if (e) throw e;
Sys.Net.NetworkRequestEventArgs.initializeBase(this);
this._webRequest = webRequest;
}

$type.prototype = {
get_webRequest: function NetworkRequestEventArgs$get_webRequest() {
/// <value type="Sys.Net.WebRequest"
locid="P:J#Sys.Net.NetworkRequestEventArgs.webRequest">The request about to be
executed.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._webRequest;
}
}

$type.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
$type = Sys.Net.WebRequest = function WebRequest() {
/// <summary locid="M:J#Sys.Net.WebRequest.#ctor">WebRequest class</summary>
if (arguments.length !== 0) throw Error.parameterCount();
this._url = "";
this._headers = { };
this._body = null;
this._userContext = null;
this._httpVerb = null;
}

$type.prototype = {
add_completed: function WebRequest$add_completed(handler) {
/// <summary locid="E:J#Sys.Net.WebRequest.completed"></summary>
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "completed", handler);
},
remove_completed: function WebRequest$remove_completed(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type:
Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "completed", handler);
},
completed: function WebRequest$completed(eventArgs) {
/// <summary locid="M:J#Sys.Net.WebRequest.completed">The completed method
should be called when the request is completed.</summary>
/// <param name="eventArgs" type="Sys.EventArgs">The event args to raise
the event with.</param>
var e = Function._validateParams(arguments, [
{name: "eventArgs", type: Sys.EventArgs}
]);
if (e) throw e;
function raise(source, sender, eventName) {
var handler = Sys.Observer._getContext(source,
true).events.getHandler(eventName);
if (handler) {
handler(sender, eventArgs);
}
}
raise(Sys.Net.WebRequestManager, this._executor, "completedRequest");
raise(this, this._executor, "completed");
Sys.Observer.clearEventHandlers(this, "completed");
},

get_url: function WebRequest$get_url() {


/// <value type="String" locid="P:J#Sys.Net.WebRequest.url">The
url.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._url;
},
set_url: function WebRequest$set_url(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
this._url = value;
},

get_headers: function WebRequest$get_headers() {


/// <value locid="P:J#Sys.Net.WebRequest.headers">The headers dictionary
for the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._headers;
},

get_httpVerb: function WebRequest$get_httpVerb() {


/// <value type="String" locid="P:J#Sys.Net.WebRequest.httpVerb">The
httpVerb for the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
if (this._httpVerb === null) {
if (this._body === null) {
return "GET";
}
return "POST";
}
return this._httpVerb;
},
set_httpVerb: function WebRequest$set_httpVerb(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
if (value.length === 0) {
throw Error.argument('value', Sys.Res.invalidHttpVerb);
}
this._httpVerb = value;
},

get_body: function WebRequest$get_body() {


/// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.body">The body of
the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._body;
},
set_body: function WebRequest$set_body(value) {
var e = Function._validateParams(arguments, [{name: "value", mayBeNull:
true}]);
if (e) throw e;
this._body = value;
},

get_userContext: function WebRequest$get_userContext() {


/// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.userContext">The
userContext of the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._userContext;
},
set_userContext: function WebRequest$set_userContext(value) {
var e = Function._validateParams(arguments, [{name: "value", mayBeNull:
true}]);
if (e) throw e;
this._userContext = value;
},

get_executor: function WebRequest$get_executor() {


/// <value type="Sys.Net.WebRequestExecutor"
locid="P:J#Sys.Net.WebRequest.executor">The executor for the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._executor || null;
},
set_executor: function WebRequest$set_executor(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Sys.Net.WebRequestExecutor}]);
if (e) throw e;
if (this._executor && this._executor.get_started()) {
throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
}
this._executor = value;
value._set_webRequest(this);
},

get_timeout: function WebRequest$get_timeout() {


/// <value type="Number" locid="P:J#Sys.Net.WebRequest.timeout">The timeout
in milliseconds for the request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._timeout || Sys.Net.WebRequestManager.get_defaultTimeout();
},
set_timeout: function WebRequest$set_timeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},

getResolvedUrl: function WebRequest$getResolvedUrl() {


/// <summary locid="M:J#raise">The getResolvedUrl method returns the url
resolved against the base url of the page if set.</summary>
/// <returns type="String">The resolved url for the request.</returns>
if (arguments.length !== 0) throw Error.parameterCount();
return Sys.Net.WebRequest._resolveUrl(this._url);
},

invoke: function WebRequest$invoke() {


/// <summary locid="M:J#raise">Invokes the request</summary>
if (arguments.length !== 0) throw Error.parameterCount();
if (this._invokeCalled) {
throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
}
Sys.Net.WebRequestManager.executeRequest(this);
this._invokeCalled = true;
}
}

$type._resolveUrl = function WebRequest$_resolveUrl(url, baseUrl) {


if (url && url.indexOf('://') > 0) {
return url;
}

if (!baseUrl || !baseUrl.length) {
var baseElement = Sys.get('base');
if (baseElement && baseElement.href && baseElement.href.length) {
baseUrl = baseElement.href;
}
else {
baseUrl = document.URL;
}
}

var qsStart = baseUrl.indexOf('?');


if (qsStart > 0) {
baseUrl = baseUrl.substr(0, qsStart);
}
qsStart = baseUrl.indexOf('#');
if (qsStart > 0) {
baseUrl = baseUrl.substr(0, qsStart);
}
baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);

if (!url || !url.length) {
return baseUrl;
}

if (url.charAt(0) === '/') {


var slashslash = baseUrl.indexOf('://');
if (slashslash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
}

var nextSlash = baseUrl.indexOf('/', slashslash + 3);


if (nextSlash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
}

return baseUrl.substr(0, nextSlash) + url;


}
else {
var lastSlash = baseUrl.lastIndexOf('/');
if (lastSlash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
}

return baseUrl.substr(0, lastSlash+1) + url;


}
}

$type._createQueryString = function WebRequest$_createQueryString(queryString,


encodeMethod, addParams) {
encodeMethod = encodeMethod || encodeURIComponent;
var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
if (queryString) {
for (arg in queryString) {
obj = queryString[arg];
if (typeof(obj) === "function") continue;
val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
if (i++) {
sb.append('&');
}
sb.append(arg);
sb.append('=');
sb.append(encodeMethod(val));
}
}
if (addParams) {
if (i) {
sb.append('&');
}
sb.append(addParams);
}
return sb.toString();
}

$type._createUrl = function WebRequest$_createUrl(url, queryString, addParams) {


if (!queryString && !addParams) {
return url;
}
var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
return qs.length
? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
: url;
}

$type.registerClass('Sys.Net.WebRequest');

Type.registerNamespace('Sys.Net');

$type = Sys.Net.WebServiceProxy = function WebServiceProxy() {


var type = Object.getType(this);

if (type._staticInstance && (typeof(type._staticInstance.get_enableJsonp) ===


"function")) {
this._jsonp = (type._staticInstance.get_enableJsonp());
}
}
$type.prototype = {
get_timeout: function WebServiceProxy$get_timeout() {
/// <value type="Number" locid="P:J#Sys.Net.WebServiceProxy.timeout">The
timeout in milliseconds for the service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._timeout || 0;
},
set_timeout: function WebServiceProxy$set_timeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},
get_defaultUserContext: function WebServiceProxy$get_defaultUserContext() {
/// <value mayBeNull="true"
locid="P:J#Sys.Net.WebServiceProxy.defaultUserContext">The default userContext for
this service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return (typeof(this._userContext) === "undefined") ? null :
this._userContext;
},
set_defaultUserContext: function WebServiceProxy$set_defaultUserContext(value)
{
var e = Function._validateParams(arguments, [{name: "value", mayBeNull:
true}]);
if (e) throw e;
this._userContext = value;
},
get_defaultSucceededCallback: function
WebServiceProxy$get_defaultSucceededCallback() {
/// <value type="Function" mayBeNull="true"
locid="P:J#Sys.Net.WebServiceProxy.defaultSucceededCallback">Returns the default
succeededCallback for this service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._succeeded || null;
},
set_defaultSucceededCallback: function
WebServiceProxy$set_defaultSucceededCallback(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Function, mayBeNull: true}]);
if (e) throw e;
this._succeeded = value;
},
get_defaultFailedCallback: function WebServiceProxy$get_defaultFailedCallback()
{
/// <value type="Function" mayBeNull="true"
locid="P:J#Sys.Net.WebServiceProxy.defaultFailedCallback">Returns the default
failedCallback for this service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._failed || null;
},
set_defaultFailedCallback: function
WebServiceProxy$set_defaultFailedCallback(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Function, mayBeNull: true}]);
if (e) throw e;
this._failed = value;
},
get_enableJsonp: function WebServiceProxy$get_enableJsonp() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebServiceProxy.enableJsonp">Specifies whether the service
supports JSONP for cross domain calling.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._jsonp;
},
set_enableJsonp: function WebServiceProxy$set_enableJsonp(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
Boolean}]);
if (e) throw e;
this._jsonp = value;
},
get_path: function WebServiceProxy$get_path() {
/// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.path">The path
to this service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._path || null;
},
set_path: function WebServiceProxy$set_path(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
this._path = value;
},
get_jsonpCallbackParameter: function
WebServiceProxy$get_jsonpCallbackParameter() {
/// <value type="String"
locid="P:J#Sys.Net.WebServiceProxy.jsonpCallbackParameter">Specifies the parameter
name that contains the callback function name for a JSONP request.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._callbackParameter || "callback";
},
set_jsonpCallbackParameter: function
WebServiceProxy$set_jsonpCallbackParameter(value) {
var e = Function._validateParams(arguments, [{name: "value", type:
String}]);
if (e) throw e;
this._callbackParameter = value;
},
_invoke: function WebServiceProxy$_invoke(servicePath, methodName, useGet,
params, onSuccess, onFailure, userContext) {
/// <summary locid="M:J#Sys.Net.WebServiceProxy._invoke"></summary>
/// <param name="servicePath" type="String">Path to the webservice</param>
/// <param name="methodName" type="String">Method to invoke</param>
/// <param name="useGet" type="Boolean">Controls whether requests use
HttpGet</param>
/// <param name="params">Method args.</param>
/// <param name="onSuccess" type="Function" mayBeNull="true"
optional="true">Success callback</param>
/// <param name="onFailure" type="Function" mayBeNull="true"
optional="true">Failure callback</param>
/// <param name="userContext" mayBeNull="true" optional="true">Success
callback</param>
/// <returns type="Sys.Net.WebRequest" mayBeNull="true">Returns the request
that was sent</returns>
var e = Function._validateParams(arguments, [
{name: "servicePath", type: String},
{name: "methodName", type: String},
{name: "useGet", type: Boolean},
{name: "params"},
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
{name: "userContext", mayBeNull: true, optional: true}
]);
if (e) throw e;

onSuccess = onSuccess || this.get_defaultSucceededCallback();


onFailure = onFailure || this.get_defaultFailedCallback();
if (userContext === null || typeof userContext === 'undefined') userContext
= this.get_defaultUserContext();
return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet,
params, onSuccess, onFailure, userContext, this.get_timeout(),
this.get_enableJsonp(), this.get_jsonpCallbackParameter());
}
}
$type.registerClass('Sys.Net.WebServiceProxy');

$type.invoke = function WebServiceProxy$invoke(servicePath, methodName, useGet,


params, onSuccess, onFailure, userContext, timeout, enableJsonp,
jsonpCallbackParameter) {
/// <summary locid="M:J#Sys.Net.WebServiceProxy.invoke"></summary>
/// <param name="servicePath" type="String">Path to the webservice</param>
/// <param name="methodName" type="String" mayBeNull="true"
optional="true">Method to invoke</param>
/// <param name="useGet" type="Boolean" optional="true"
mayBeNull="true">Controls whether requests use HttpGet</param>
/// <param name="params" mayBeNull="true" optional="true">Method args.</param>
/// <param name="onSuccess" type="Function" mayBeNull="true"
optional="true">Success callback</param>
/// <param name="onFailure" type="Function" mayBeNull="true"
optional="true">Failure callback</param>
/// <param name="userContext" mayBeNull="true" optional="true">Success
callback</param>
/// <param name="timeout" type="Number" optional="true"
mayBeNull="true">Timeout in milliseconds</param>
/// <param name="enableJsonp" type="Boolean" optional="true"
mayBeNull="true">Whether to use JSONP if the servicePath is for a different domain
(default is true).</param>
/// <param name="jsonpCallbackParameter" type="String" optional="true"
mayBeNull="true">The name of the callback parameter for JSONP request (default is
callback).</param>
/// <returns type="Sys.Net.WebRequest" mayBeNull="true">Returns the request
that was sent (null for JSONP requests).</returns>
var e = Function._validateParams(arguments, [
{name: "servicePath", type: String},
{name: "methodName", type: String, mayBeNull: true, optional: true},
{name: "useGet", type: Boolean, mayBeNull: true, optional: true},
{name: "params", mayBeNull: true, optional: true},
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
{name: "userContext", mayBeNull: true, optional: true},
{name: "timeout", type: Number, mayBeNull: true, optional: true},
{name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
{name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional:
true}
]);
if (e) throw e;
var schemeHost = (enableJsonp !== false) ?
Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
((schemeHost[1] !== location.protocol) || (schemeHost[2] !==
location.host));
useGet = jsonp || useGet;
if (jsonp) {
jsonpCallbackParameter = jsonpCallbackParameter || "callback";
tempCallback = "_jsonp" + Sys._jsonp++;
}
if (!params) params = {};
var urlParams = params;
if (!useGet || !urlParams) urlParams = {};
var error, timeoutcookie = null, body = null,
url = Sys.Net.WebRequest._createUrl(methodName
? (servicePath+"/"+encodeURIComponent(methodName))
: servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." +
tempCallback) : null);
if (jsonp) {
function jsonpComplete(data, statusCode) {
if (timeoutcookie !== null) {
window.clearTimeout(timeoutcookie);
timeoutcookie = null;
}
delete Sys[tempCallback];
tempCallback = null;
if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
if (onFailure) {
error = new Sys.Net.WebServiceError(false,
data.Message ||
String.format(Sys.Res.webServiceFailedNoMsg, methodName),
data.StackTrace || null,
data.ExceptionType || null,
data);
error._statusCode = statusCode;
onFailure(error, userContext, methodName);
}
else {
if (data.StackTrace && data.Message) {
error = data.StackTrace + "-- " + data.Message;
}
else {
error = data.StackTrace || data.Message;
}
error = String.format(error ? Sys.Res.webServiceFailed :
Sys.Res.webServiceFailedNoMsg, methodName, error);
throw Sys.Net.WebServiceProxy._createFailedError(methodName,
String.format(Sys.Res.webServiceFailed, methodName, error));
}
}
else if (onSuccess) {
onSuccess(data, userContext, methodName);
}
}
Sys[tempCallback] = jsonpComplete;
Sys._loadJsonp(url, function() {
if (tempCallback) {
jsonpComplete({ Message:
String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
}
});
return null;
}
var request = new Sys.Net.WebRequest();
request.set_url(url);
request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
if (!useGet) {
body = Sys.Serialization.JavaScriptSerializer.serialize(params);
if (body === "{}") body = "";
}
request.set_body(body);
request.add_completed(onComplete);
if (timeout > 0) request.set_timeout(timeout);
request.invoke();

function onComplete(response, eventArgs) {


if (response.get_responseAvailable()) {
var ex, statusCode = response.get_statusCode();
var result = null;
var isJson;

try {
var contentType = response.getResponseHeader("Content-Type");
isJson = contentType.startsWith("application/json");
result = isJson ? response.get_object() :
(contentType.startsWith("text/xml") ? response.get_xml() :
response.get_responseData());
}
catch (ex) {
}

var error = response.getResponseHeader("jsonerror");


var errorObj = (error === "true");
if (errorObj) {
if (result) {
result = new Sys.Net.WebServiceError(false, result.Message,
result.StackTrace, result.ExceptionType, result);
}
}
else if (isJson) {
result = (!result || (typeof(result.d) === "undefined")) ? result :
result.d;
}
if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
if (onFailure) {
if (!result || !errorObj) {
result = new Sys.Net.WebServiceError(false /*timedout*/,
String.format(Sys.Res.webServiceFailedNoMsg, methodName));
}
result._statusCode = statusCode;
onFailure(result, userContext, methodName);
}
else {
if (result && errorObj) {
error = result.get_exceptionType() + "-- " +
result.get_message();
}
else {
error = response.get_responseData();
}
throw Sys.Net.WebServiceProxy._createFailedError(methodName,
String.format(Sys.Res.webServiceFailed, methodName, error));
}
}
else if (onSuccess) {
onSuccess(result, userContext, methodName);
}
}
else {
var timedOut = response.get_timedOut(),
msg = String.format((timedOut ? Sys.Res.webServiceTimedOut :
Sys.Res.webServiceFailedNoMsg), methodName);
if (onFailure) {
onFailure(new Sys.Net.WebServiceError(timedOut, msg, "", ""),
userContext, methodName);
}
else {
throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
}
}
}

return request;
}

$type._createFailedError = function WebServiceProxy$_createFailedError(methodName,


errorMessage) {
var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
var e = Error.create(displayMessage, { 'name':
'Sys.Net.WebServiceFailedException', 'methodName': methodName });
e.popStackFrame();
return e;
}

$type._defaultFailedCallback = function WebServiceProxy$_defaultFailedCallback(err,


methodName) {
var error = err.get_exceptionType() + "-- " + err.get_message();
throw Sys.Net.WebServiceProxy._createFailedError(methodName,
String.format(Sys.Res.webServiceFailed, methodName, error));
}

$type._generateTypedConstructor = function
WebServiceProxy$_generateTypedConstructor(type) {
return function(properties) {
if (properties) {
for (var name in properties) {
this[name] = properties[name];
}
}
this.__type = type;
}
}

Sys._jsonp = 0;

$type._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;

Sys._loadJsonp = function _loadJsonp(src, callback) {


var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
var attachEvent = script.attachEvent;
function onEvent() {
if (!attachEvent || /loaded|complete/.test(script.readyState)) {
if (attachEvent) {
script.detachEvent("onreadystatechange", onEvent);
}
else {
script.removeEventListener("load", onEvent, false);
script.removeEventListener("error", onEvent, false);
}
callback.apply(script);
script = null;
}
}
if (attachEvent) {
script.attachEvent("onreadystatechange", onEvent);
}
else {
script.addEventListener("load", onEvent, false);
script.addEventListener("error", onEvent, false);
}
Sys.get("head").appendChild(script);
}
$type = Sys.Net.WebServiceError = function WebServiceError(timedOut, message,
stackTrace, exceptionType, errorObject) {
/// <summary locid="M:J#Sys.Net.WebServiceError.#ctor">Represents a webservice
error</summary>
/// <param name="timedOut" type="Boolean">Whether the service timed
out.</param>
/// <param name="message" type="String" mayBeNull="true">The error
message.</param>
/// <param name="stackTrace" type="String" mayBeNull="true" optional="true">The
stack trace of the error.</param>
/// <param name="exceptionType" type="String" mayBeNull="true"
optional="true">The server exception type.</param>
/// <param name="errorObject" type="Object" mayBeNull="true"
optional="true">The raw error information.</param>
var e = Function._validateParams(arguments, [
{name: "timedOut", type: Boolean},
{name: "message", type: String, mayBeNull: true},
{name: "stackTrace", type: String, mayBeNull: true, optional: true},
{name: "exceptionType", type: String, mayBeNull: true, optional: true},
{name: "errorObject", type: Object, mayBeNull: true, optional: true}
]);
if (e) throw e;
this._timedOut = timedOut;
this._message = message;
this._stackTrace = stackTrace;
this._exceptionType = exceptionType;
this._errorObject = errorObject;
this._statusCode = -1;
}

$type.prototype = {
get_timedOut: function WebServiceError$get_timedOut() {
/// <value type="Boolean"
locid="P:J#Sys.Net.WebServiceError.timedOut">Whether the service failed due to
timeout.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._timedOut;
},

get_statusCode: function WebServiceError$get_statusCode() {


/// <value type="Number" locid="P:J#Sys.Net.WebServiceError.statusCode">Int
representing the status of the response.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._statusCode;
},

get_message: function WebServiceError$get_message() {


/// <value type="String" locid="P:J#Sys.Net.WebServiceError.message">Error
message</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._message;
},

get_stackTrace: function WebServiceError$get_stackTrace() {


/// <value type="String"
locid="P:J#Sys.Net.WebServiceError.stackTrace">Stack trace of the error.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._stackTrace || "";
},

get_exceptionType: function WebServiceError$get_exceptionType() {


/// <value type="String"
locid="P:J#Sys.Net.WebServiceError.exceptionType">Exception type of the
error.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._exceptionType || "";
},

get_errorObject: function WebServiceError$get_errorObject() {


/// <value type="Object"
locid="P:J#Sys.Net.WebServiceError.errorObject">The raw error object returned by
the service.</value>
if (arguments.length !== 0) throw Error.parameterCount();
return this._errorObject || null;
}
}
$type.registerClass('Sys.Net.WebServiceError');

Type.registerNamespace("Sys.Services");
var ns = Sys.Services;
var service = "Service",
role = "Role",
auth = "Authentication",
profile = "Profile";
function setPath(path) {
this._path = path;
}
ns[auth+service] = {
set_path: setPath,
_setAuthenticated: function(auth) {
this._auth = auth;
}
};
ns["_" + auth + service] = {};

ns[profile + service] = { set_path: setPath };


ns["_" + profile + service] = {};
ns.ProfileGroup = function ns$ProfileGroup(properties) {
this._propertygroup = properties;
}

ns[role + service] = { set_path: setPath };


ns["_" + role + service] = {};

Sys._domLoaded();
}

if (Sys.loader) {
Sys.loader.registerScript("MicrosoftAjax", null, execute);
}
else {
execute();
}

})(window, window.Sys);
var $get, $create, $addHandler, $addHandlers, $clearHandlers;

Type.registerNamespace('Sys');
Sys.Res={
"argumentInteger":"Value must be an integer.",
"argumentType":"Object cannot be converted to the required type.",
"argumentNull":"Value cannot be null.",
"scriptAlreadyLoaded":"The script \u0027{0}\u0027 has been referenced multiple
times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode
property of the ScriptManager to Explicit.",
"scriptDependencyNotFound":"The script \u0027{0}\u0027 failed to load because it is
dependent on script \u0027{1}\u0027.",
"formatBadFormatSpecifier":"Format specifier was invalid.",
"requiredScriptReferenceNotIncluded":"\u0027{0}\u0027 requires that you have
included a script reference to \u0027{1}\u0027.",
"webServiceFailedNoMsg":"The server method \u0027{0}\u0027 failed.",
"argumentDomElement":"Value must be a DOM element.",
"actualValue":"Actual value was {0}.",
"enumInvalidValue":"\u0027{0}\u0027 is not a valid value for enum {1}.",
"scriptLoadFailed":"The script \u0027{0}\u0027 could not be loaded.",
"parameterCount":"Parameter count mismatch.",
"cannotDeserializeEmptyString":"Cannot deserialize empty string.",
"formatInvalidString":"Input string was not in a correct format.",
"argument":"Value does not fall within the expected range.",
"cannotDeserializeInvalidJson":"Cannot deserialize. The data does not correspond to
valid JSON.",
"cannotSerializeNonFiniteNumbers":"Cannot serialize non finite numbers.",
"argumentUndefined":"Value cannot be undefined.",
"webServiceInvalidReturnType":"The server method \u0027{0}\u0027 returned an
invalid type. Expected type: {1}",
"servicePathNotSet":"The path to the web service has not been set.",
"argumentTypeWithTypes":"Object of type \u0027{0}\u0027 cannot be converted to type
\u0027{1}\u0027.",
"paramName":"Parameter name: {0}",
"nullReferenceInPath":"Null reference while evaluating data path: \u0027{0}\
u0027.",
"format":"One of the identified items was in an invalid format.",
"assertFailedCaller":"Assertion Failed: {0}\r\nat {1}",
"argumentOutOfRange":"Specified argument was out of the range of valid values.",
"webServiceTimedOut":"The server method \u0027{0}\u0027 timed out.",
"notImplemented":"The method or operation is not implemented.",
"assertFailed":"Assertion Failed: {0}",
"invalidOperation":"Operation is not valid due to the current state of the
object.",
"breakIntoDebugger":"{0}\r\n\r\nBreak into debugger?",
"invokeCalledTwice":"Cannot call invoke more than once.",
"argumentTypeName":"Value is not the name of an existing type.",
"cantBeCalledAfterDispose":"Can\u0027t be called after dispose.",
"webServiceFailed":"The server method \u0027{0}\u0027 failed with the following
error: {1}",
"componentCantSetIdAfterAddedToApp":"The id property of a component can\u0027t be
set after it\u0027s been added to the Application object.",
"behaviorDuplicateName":"A behavior with name \u0027{0}\u0027 already exists or it
is the name of an existing property on the target element.",
"notATypeName":"Value is not a valid type name.",
"elementNotFound":"An element with id \u0027{0}\u0027 could not be found.",
"stateMustBeStringDictionary":"The state object can only have null and string
fields.",
"invalidExecutorType":"Could not create a valid Sys.Net.WebRequestExecutor from:
{0}.",
"boolTrueOrFalse":"Value must be \u0027true\u0027 or \u0027false\u0027.",
"cannotCallBeforeResponse":"Cannot call {0} when responseAvailable is false.",
"scriptLoadFailedNoHead":"ScriptLoader requires pages to contain a \u003chead\u003e
element.",
"stringFormatInvalid":"The format string is invalid.",
"referenceNotFound":"Component \u0027{0}\u0027 was not found.",
"enumReservedName":"\u0027{0}\u0027 is a reserved name that can\u0027t be used as
an enum value name.",
"circularParentChain":"The chain of control parents can\u0027t have circular
references.",
"namespaceContainsNonObject":"Object {0} already exists and is not an object.",
"undefinedEvent":"\u0027{0}\u0027 is not an event.",
"invalidTimeout":"Value must be greater than or equal to zero.",
"cannotAbortBeforeStart":"Cannot abort when executor has not started.",
"observableConflict":"Object already contains a member with the name \u0027{0}\
u0027.",
"invalidHttpVerb":"httpVerb cannot be set to an empty or null string.",
"nullWebRequest":"Cannot call executeRequest with a null webRequest.",
"historyCannotEnableHistory":"Cannot set enableHistory after initialization.",
"eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler
method.",
"scriptLoadFailedDebug":"The script \u0027{0}\u0027 failed to load. Check for:\r\n
Inaccessible path.\r\n Script errors. (IE) Enable \u0027Display a notification
about every script error\u0027 under advanced settings.",
"propertyNotWritable":"\u0027{0}\u0027 is not a writable property.",
"enumInvalidValueName":"\u0027{0}\u0027 is not a valid name for an enum value.",
"cannotCallOnceStarted":"Cannot call {0} once started.",
"controlAlreadyDefined":"A control is already associated with the element.",
"addHandlerCantBeUsedForError":"Can\u0027t add a handler for the error event using
this method. Please set the window.onerror property instead.",
"badBaseUrl1":"Base URL does not contain ://.",
"badBaseUrl2":"Base URL does not contain another /.",
"badBaseUrl3":"Cannot find last / in base URL.",
"setExecutorAfterActive":"Cannot set executor after it has become active.",
"cantAddNonFunctionhandler":"Can\u0027t add a handler that is not a function.",
"invalidNameSpace":"Value is not a valid namespace identifier.",
"notAnInterface":"Value is not a valid interface.",
"eventHandlerNotFunction":"Handler must be a function.",
"propertyNotAnArray":"\u0027{0}\u0027 is not an Array property.",
"namespaceContainsClass":"Object {0} already exists as a class, enum, or
interface.",
"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.",
"cantSetNameAfterInit":"The name property can\u0027t be set on this object after
initialization.",
"historyMissingFrame":"For the history feature to work in IE, the page must have an
iFrame element with id \u0027__historyFrame\u0027 pointed to a page that gets its
title from the \u0027title\u0027 query string parameter and calls
Sys.Application._onIFrameLoad() on the parent window. This can be done by setting
EnableHistory to true on ScriptManager.",
"appDuplicateComponent":"Two components with the same id \u0027{0}\u0027 can\u0027t
be added to the application.",
"historyCannotAddHistoryPointWithHistoryDisabled":"A history point can only be
added if enableHistory is set to true.",
"expectedElementOrId":"Value must be a DOM element or DOM element id.",
"selectorNotFound":"An element with selector \u0027{0}\u0027 could not be found.",
"cannotCallOutsideHandler":"Cannot call {0} outside of a completed event handler.",
"methodNotFound":"No method found with name \u0027{0}\u0027.",
"arrayParseBadFormat":"Value must be a valid string representation for an array. It
must start with a \u0027[\u0027 and end with a \u0027]\u0027.",
"cannotSerializeObjectWithCycle":"Cannot serialize object with cyclic reference
within child properties.",
"stateFieldNameInvalid":"State field names must not contain any \u0027=\u0027
characters.",
"stringFormatBraceMismatch":"The format string contains an unmatched opening or
closing brace.",
"enumValueNotInteger":"An enumeration definition can only contain integer values.",
"propertyNullOrUndefined":"Cannot set the properties of \u0027{0}\u0027 because it
returned a null value.",
"expectedDomElementOrSelector":"\u0027{0}\u0027 must be a DOM element or DOM
element selector.",
"argumentDomNode":"Value must be a DOM element or a text node.",
"componentCantSetIdTwice":"The id property of a component can\u0027t be set more
than once.",
"createComponentOnDom":"Value must be null for Components that are not Controls or
Behaviors.",
"createNoDom":"Value must not be null for Controls and Behaviors.",
"cantAddWithoutId":"Can\u0027t add a component that doesn\u0027t have an id.",
"urlTooLong":"The history state must be small enough to not make the url larger
than {0} characters.",
"notObservable":"Instances of type \u0027{0}\u0027 cannot be observed.",
"badTypeName":"Value is not the name of the type being registered or the name is a
reserved word."
};

You might also like