//-----------------------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------
// MicrosoftAjax.js
// Microsoft AJAX Framework.


Function.__typeName = 'Function';

Function.createCallback = function Function$createCallback(method, context) {
    /// <param name="method" type="Function"></param>
    /// <param name="context" mayBeNull="true"></param>
    /// <returns type="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);
    }
}

Function.createDelegate = function Function$createDelegate(instance, method) {
    /// <param name="instance" mayBeNull="true"></param>
    /// <param name="method" type="Function"></param>
    /// <returns type="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);
    }
}

Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
    if (arguments.length !== 0) throw Error.parameterCount();
}

Function._validateParams = function Function$_validateParams(params, expectedParams) {
                                                                                                                            
    var e;

    e = Function._validateParameterCount(params, expectedParams);
    if (e) {
        e.popStackFrame();
        return e;
    }

    for (var i=0; i < params.length; i++) {
                                var expectedParam = expectedParams[Math.min(i, expectedParams.length - 1)];

        var paramName = expectedParam.name;
        if (expectedParam.parameterArray) {
                        paramName += "[" + (i - expectedParams.length + 1) + "]";
        }

        e = Function._validateParameter(params[i], expectedParam, paramName);
        if (e) {
            e.popStackFrame();
            return e;
        }
    }


    return null;
}

Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams) {
    var maxParams = expectedParams.length;
    var minParams = 0;
    for (var i=0; i < expectedParams.length; i++) {
        if (expectedParams[i].parameterArray) {
            maxParams = Number.MAX_VALUE;
        }
        else if (!expectedParams[i].optional) {
            minParams++;
        }
    }

    if (params.length < minParams || params.length > maxParams) {
        var e = Error.parameterCount();
        e.popStackFrame();
        return e;
    }

    return null;
}

Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
    var e;

    var expectedType = expectedParam.type;
    var expectedInteger = !!expectedParam.integer;
    var mayBeNull = !!expectedParam.mayBeNull;

    e = Function._validateParameterType(param, expectedType, expectedInteger, mayBeNull, paramName);
    if (e) {
        e.popStackFrame();
        return e;
    }

        var expectedElementType = expectedParam.elementType;
    var elementMayBeNull = !!expectedParam.elementMayBeNull;
    if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
        (expectedElementType || !elementMayBeNull)) {
        var expectedElementInteger = !!expectedParam.elementInteger;
        for (var i=0; i < param.length; i++) {
            var elem = param[i];
            e = Function._validateParameterType(elem, expectedElementType, expectedElementInteger, elementMayBeNull,
                                                paramName + "[" + i + "]");
            if (e) {
                e.popStackFrame();
                return e;
            }
        }
    }

    return null;
}

Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, mayBeNull, paramName) {
    var e;

    if (typeof(param) === "undefined") {
        if (mayBeNull) {
            return null;
        }
        else {
            e = Error.argumentUndefined(paramName);
            e.popStackFrame();
            return e;
        }
    }

    if (param === null) {
        if (mayBeNull) {
            return null;
        }
        else {
            e = Error.argumentNull(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 (var i in values) {
                    if (values[i] === param) return null;
                }
            }
            else {
                var v = param;
                for (var 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 (expectedType && !expectedType.isInstanceOfType(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.RuntimeRes.argumentInteger);
            e.popStackFrame();
            return e;
        }
    }

    return null;
}
Error.__typeName = 'Error';

Error.create = function Error$create(message, errorInfo) {
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="errorInfo" optional="true" mayBeNull="true"></param>
    /// <returns type="Error"></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 e = new Error(message);
    e.message = message;

    if (errorInfo) {
        for (var v in errorInfo) {
            e[v] = errorInfo[v];
        }
    }

    e.popStackFrame();
    return e;
}

Error.argument = function Error$argument(paramName, message) {
    /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></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;


    var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.RuntimeRes.argument);
    if (paramName) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.paramName, paramName);
    }

    var e = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
    e.popStackFrame();
    return e;
}

Error.argumentNull = function Error$argumentNull(paramName, message) {
    /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></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;


    var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.RuntimeRes.argumentNull);
    if (paramName) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.paramName, paramName);
    }

    var e = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
    e.popStackFrame();
    return e;
}

Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
    /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="actualValue" optional="true" mayBeNull="true"></param>
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></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 ? message : Sys.RuntimeRes.argumentOutOfRange);
    if (paramName) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.paramName, paramName);
    }

                if (typeof(actualValue) !== "undefined" && actualValue !== null) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.actualValue, actualValue);
    }

    var e = Error.create(displayMessage, {
        name: "Sys.ArgumentOutOfRangeException",
        paramName: paramName,
        actualValue: actualValue
    });
    e.popStackFrame();
    return e;
}

Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
    /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
    /// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></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.RuntimeRes.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
    }
    else {
        displayMessage += Sys.RuntimeRes.argumentType;
    }

    if (paramName) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.paramName, paramName);
    }

    var e = Error.create(displayMessage, {
        name: "Sys.ArgumentTypeException",
        paramName: paramName,
        actualType: actualType,
        expectedType: expectedType
    });
    e.popStackFrame();
    return e;
}

Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
    /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></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;


    var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.RuntimeRes.argumentUndefined);
    if (paramName) {
        displayMessage += "\n" + String.format(Sys.RuntimeRes.paramName, paramName);
    }

    var e = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
    e.popStackFrame();
    return e;
}

Error.invalidOperation = function Error$invalidOperation(message) {
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "message", type: String, mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.RuntimeRes.invalidOperation);

    var e = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
    e.popStackFrame();
    return e;
}

Error.notImplemented = function Error$notImplemented(message) {
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "message", type: String, mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.RuntimeRes.notImplemented);

    var e = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
    e.popStackFrame();
    return e;
}

Error.parameterCount = function Error$parameterCount(message) {
    /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "message", type: String, mayBeNull: true, optional: true}
    ]);
    if (e) throw e;


    var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.RuntimeRes.parameterCount);
    var e = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
    e.popStackFrame();
    return e;
}

Error.prototype.popStackFrame = function Error$popStackFrame() {
    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) === -1) {
        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");
}
if (!window) this.window = this;

window.Type = Function;

window.__rootNamespaces = [];

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");

Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
    /// <param name="instance"></param>
    /// <param name="name" type="String"></param>
    /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
    /// <returns></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 = this.getBaseMethod(instance, name);
    if (!baseMethod) throw Error.invalidOperation(String.format(Sys.RuntimeRes.methodNotFound, name));
    if (!baseArguments) {
        return baseMethod.apply(instance);
    }
    else {
        return baseMethod.apply(instance, baseArguments);
    }
}

Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
    /// <param name="instance"></param>
    /// <param name="name" type="String"></param>
    /// <returns type="Function" mayBeNull="true"></returns>
    var e = Function._validateParams(arguments, [
        {name: "instance"},
        {name: "name", type: String}
    ]);
    if (e) throw e;

    if (!this.isInstanceOfType(instance)) throw Error.argumentType('instance', Object.getType(instance), this);
    var baseType = this.getBaseType();
    if (baseType) {
        var baseMethod = baseType.prototype[name];
        return (baseMethod instanceof Function) ? baseMethod : null;
    }

    return null;
}

Type.prototype.getBaseType = function Type$getBaseType() {
    /// <returns type="Type" mayBeNull="true"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
}

Type.prototype.getInterfaces = function Type$getInterfaces() {
    /// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></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 (!result.contains(interfaceType)) {
                    result[result.length] = interfaceType;
                }
            }
        }
        type = type.__baseType;
    }
    return result;
}

Type.prototype.getName = function Type$getName() {
    /// <returns type="String"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
}

Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
    /// <param name="interfaceType" type="Type"></param>
    /// <returns type="Boolean"></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) {
            if (interfaces.contains(interfaceType)) {
                return cache[interfaceName] = true;
            }
        }

        baseType = baseType.__baseType;
    }

    return cache[interfaceName] = false;
}

Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
    /// <param name="parentType" type="Type"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "parentType", type: Type}
    ]);
    if (e) throw e;

    this.resolveInheritance();
    var baseType = this.__baseType;
    while (baseType) {
        if (baseType === parentType) {
            return true;
        }
        baseType = baseType.__baseType;
    }

    return false;
}

Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
    /// <param name="instance"></param>
    /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "instance"},
        {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
    ]);
    if (e) throw e;

    if (!this.isInstanceOfType(instance)) throw Error.argumentType('instance', Object.getType(instance), this);

    this.resolveInheritance();
    if (this.__baseType) {
        if (!baseArguments) {
            this.__baseType.apply(instance);
        }
        else {
            this.__baseType.apply(instance, baseArguments);
        }
    }

    return instance;
}

Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
    /// <param name="instance" mayBeNull="true"></param>
    /// <returns type="Boolean"></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));
}

Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
    /// <param name="instance" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "instance", mayBeNull: true}
    ]);
    if (e) throw e;

    if (typeof(instance) === "undefined" || instance === null) return false;

    if (instance instanceof this) return true;

    var instanceType = Object.getType(instance);
    return !!(instanceType === this) ||
           (instanceType.inheritsFrom && instanceType.inheritsFrom(this)) ||
           (instanceType.implementsInterface && instanceType.implementsInterface(this));
}

Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
    /// <param name="typeName" type="String"></param>
    /// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
    /// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
    /// <returns type="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.RuntimeRes.notATypeName);
        var parsedName;
    try {
        parsedName = eval(typeName);
    }
    catch(e) {
        throw Error.argument('typeName', Sys.RuntimeRes.argumentTypeName);
    }
    if (parsedName !== this) throw Error.argument('typeName', Sys.RuntimeRes.badTypeName);
        if (this.__registered) throw Error.invalidOperation(String.format(Sys.RuntimeRes.typeRegisteredTwice, typeName));

            if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
    if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.RuntimeRes.baseNotAClass);

    this.prototype.constructor = this;
    this.__typeName = typeName;
    this.__class = true;
    if (baseType) {
        this.__baseType = baseType;
        this.__basePrototypePending = true;
    }
        if (!window.__classes) window.__classes = {};
    window.__classes[typeName.toUpperCase()] = this;

                if (interfaceTypes) {
        this.__interfaces = [];
        for (var i = 2; i < arguments.length; i++) {
            var interfaceType = arguments[i];
            if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.RuntimeRes.notAnInterface);
            this.resolveInheritance();
            for (var methodName in interfaceType.prototype) {
                var method = interfaceType.prototype[methodName];
                if (!this.prototype[methodName]) {
                    this.prototype[methodName] = method;
                }
            }
            this.__interfaces.push(interfaceType);
        }
    }
    this.__registered = true;

    return this;
}

Type.prototype.registerInterface = function Type$registerInterface(typeName) {
    /// <param name="typeName" type="String"></param>
    /// <returns type="Type"></returns>
    var e = Function._validateParams(arguments, [
        {name: "typeName", type: String}
    ]);
    if (e) throw e;

    if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.RuntimeRes.notATypeName);
        var parsedName;
    try {
        parsedName = eval(typeName);
    }
    catch(e) {
        throw Error.argument('typeName', Sys.RuntimeRes.argumentTypeName);
    }
    if (parsedName !== this) throw Error.argument('typeName', Sys.RuntimeRes.badTypeName);
        if (this.__registered) throw Error.invalidOperation(String.format(Sys.RuntimeRes.typeRegisteredTwice, typeName));
    this.prototype.constructor = this;
    this.__typeName = typeName;
    this.__interface = true;
    this.__registered = true;

    return this;
}

Type.prototype.resolveInheritance = function Type$resolveInheritance() {
    if (arguments.length !== 0) throw Error.parameterCount();

    if (this.__basePrototypePending) {
        var baseType = this.__baseType;

        baseType.resolveInheritance();

        for (var memberName in baseType.prototype) {
            var memberValue = baseType.prototype[memberName];
            if (!this.prototype[memberName]) {
                this.prototype[memberName] = memberValue;
            }
        }
        delete this.__basePrototypePending;
    }
}

Type.createInstance = function Type$createInstance(type) {
    /// <param name="type"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "type"}
    ]);
    if (e) throw e;

    if (typeof(type) !== 'function') {
        if (typeof(type) !== 'string') throw Error.argument('type', Sys.RuntimeRes.typeShouldBeTypeOrString);
        type = Type.parse(type);
        if (typeof(type) !== 'function') throw Error.argument('type', Sys.RuntimeRes.typeShouldBeTypeOrString);
    }
    return new type();
}

Type.getRootNamespaces = function Type$getRootNamespaces() {
    /// <returns type="Array"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return window.__rootNamespaces.clone();
}

Type.isClass = function Type$isClass(type) {
    /// <param name="type" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "type", mayBeNull: true}
    ]);
    if (e) throw e;

    if ((typeof(type) === 'undefined') || (type === null)) return false;
    return !!type.__class;
}

Type.isInterface = function Type$isInterface(type) {
    /// <param name="type" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "type", mayBeNull: true}
    ]);
    if (e) throw e;

    if ((typeof(type) === 'undefined') || (type === null)) return false;
    return !!type.__interface;
}

Type.isNamespace = function Type$isNamespace(object) {
    /// <param name="object" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "object", mayBeNull: true}
    ]);
    if (e) throw e;

    if ((typeof(object) === 'undefined') || (object === null)) return false;
    return !!object.__namespace;
}

Type.parse = function Type$parse(typeName, ns) {
    /// <param name="typeName" type="String" mayBeNull="true"></param>
    /// <param name="ns" optional="true" mayBeNull="true"></param>
    /// <returns type="Type" mayBeNull="true"></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) {
        if (!window.__classes) return null;
        fn = window.__classes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
        return fn || null;
    }
    if (!typeName) return null;
    if (!Type.__htClasses) {
        Type.__htClasses = {};
    }
    fn = Type.__htClasses[typeName];
    if (!fn) {
        fn = eval(typeName);
        if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.RuntimeRes.notATypeName);
        Type.__htClasses[typeName] = fn;
    }
    return fn;
}

var registerNamespace = Type.registerNamespace = function Type$registerNamespace(namespacePath) {
    /// <param name="namespacePath" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "namespacePath", type: String}
    ]);
    if (e) throw e;

    if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.RuntimeRes.invalidNameSpace);
    var rootObject = window;
    var namespaceParts = namespacePath.split('.');

    for (var i = 0; i < namespaceParts.length; i++) {
        var currentPart = namespaceParts[i];
        var ns = rootObject[currentPart];
        if (ns && !ns.__namespace) {
            throw Error.invalidOperation(String.format(Sys.RuntimeRes.namespaceContainsObject, namespaceParts.splice(0, i + 1).join('.')));
        }
        if (!ns) {
            ns = rootObject[currentPart] = {};
            if (i === 0) {
                window.__rootNamespaces[window.__rootNamespaces.length] = ns;
            }
            ns.__namespace = true;
            ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
            ns.getName = function ns$getName() {return this.__typeName;}
        }
        rootObject = ns;
    }
}
Object.__typeName = 'Object';

Object.getType = function Object$getType(instance) {
    /// <param name="instance"></param>
    /// <returns type="Type"></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')) {
                if (Sys && Sys.UI && Sys.UI.DomElement && Sys.UI.DomElement.isInstanceOfType(instance)) {
            return Sys.UI.DomElement;
        }
        return Object;
    }
    return ctor;
}

Object.getTypeName = function Object$getTypeName(instance) {
    /// <param name="instance"></param>
    /// <returns type="String"></returns>
    var e = Function._validateParams(arguments, [
        {name: "instance"}
    ]);
    if (e) throw e;

    return Object.getType(instance).getName();
}
Boolean.__typeName = 'Boolean';

Boolean.parse = function Boolean$parse(value) {
    /// <param name="value" type="String"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "value", type: String}
    ]);
    if (e) throw e;

    var v = value.trim().toLowerCase();
    if (v === 'false') return false;
    if (v === 'true') return true;
    throw Error.argumentOutOfRange('value', value, Sys.RuntimeRes.boolTrueOrFalse);
}
Date.__typeName = 'Date';

Number.__typeName = 'Number';

Number.parse = function Number$parse(value) {
    /// <param name="value" type="String" mayBeNull="true"></param>
    /// <returns type="Number"></returns>
    var e = Function._validateParams(arguments, [
        {name: "value", type: String, mayBeNull: true}
    ]);
    if (e) throw e;

    return parseFloat(value);
}
RegExp.__typeName = 'RegExp';

Array.__typeName = 'Array';

Array.prototype.add = Array.prototype.queue = function Array$queue(item) {
    /// <param name="item" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "item", mayBeNull: true}
    ]);
    if (e) throw e;


        this[this.length] = item;
}

Array.prototype.addRange = function Array$addRange(items) {
    /// <param name="items" type="Array" elementMayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "items", type: Array, elementMayBeNull: true}
    ]);
    if (e) throw e;


        this.push.apply(this, items);
}

Array.prototype.clear = function Array$clear() {
    if (arguments.length !== 0) throw Error.parameterCount();
    this.length = 0;
}

Array.prototype.clone = function Array$clone() {
    /// <returns type="Array" elementMayBeNull="true"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    if (this.length === 1) {
        return [this[0]];
    }
    else {
                        return Array.apply(null, this);
    }
}

Array.prototype.contains = Array.prototype.exists = function Array$exists(item) {
    /// <param name="item" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "item", mayBeNull: true}
    ]);
    if (e) throw e;

    return (this.indexOf(item) >= 0);
}

Array.prototype.dequeue = Array.prototype.shift;

if (!Array.prototype.forEach) {
    Array.prototype.forEach = function Array$forEach(method, instance) {
        /// <param name="method" type="Function"></param>
        /// <param name="instance" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "method", type: Function},
            {name: "instance", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        var length = this.length;
        for (var i = 0; i < length; i++) {
            var elt = this[i];
            if (typeof(elt) !== 'undefined') method.call(instance, elt, i, this);
        }
    }
}

if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function Array$indexOf(item, start) {
        /// <param name="item" optional="true" mayBeNull="true"></param>
        /// <param name="start" optional="true" mayBeNull="true"></param>
        /// <returns type="Number"></returns>
        var e = Function._validateParams(arguments, [
            {name: "item", mayBeNull: true, optional: true},
            {name: "start", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        if (typeof(item) === "undefined") return -1;
        var length = this.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 (this[i] === item) {
                    return i;
                }
            }
        }
        return -1;
    }
}

Array.prototype.insert = function Array$insert(index, item) {
    /// <param name="index" mayBeNull="true"></param>
    /// <param name="item" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "index", mayBeNull: true},
        {name: "item", mayBeNull: true}
    ]);
    if (e) throw e;

    this.splice(index, 0, item);
}

Array.parse = function Array$parse(value) {
    /// <param name="value" type="String" mayBeNull="true"></param>
    /// <returns type="Array" elementMayBeNull="true"></returns>
    var e = Function._validateParams(arguments, [
        {name: "value", type: String, mayBeNull: true}
    ]);
    if (e) throw e;

    if (!value) return [];
    var v = eval(value);
    if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.RuntimeRes.arrayParseBadFormat);
    return v;
}

Array.prototype.remove = function Array$remove(item) {
    /// <param name="item" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "item", mayBeNull: true}
    ]);
    if (e) throw e;

    var index = this.indexOf(item);
    if (index >= 0) {
        this.splice(index, 1);
    }
    return (index >= 0);
}

Array.prototype.removeAt = function Array$removeAt(index) {
    /// <param name="index" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "index", mayBeNull: true}
    ]);
    if (e) throw e;

    this.splice(index, 1);
}
String.__typeName = 'String';

String.prototype.endsWith = function String$endsWith(suffix) {
    /// <param name="suffix" type="String"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "suffix", type: String}
    ]);
    if (e) throw e;

    return (this.substr(this.length - suffix.length) === suffix);
}

String.format = function String$format(format, args) {
    /// <param name="format" type="String"></param>
    /// <param name="args" parameterArray="true" mayBeNull="true"></param>
    /// <returns type="String"></returns>
    var e = Function._validateParams(arguments, [
        {name: "format", type: String},
        {name: "args", mayBeNull: true, parameterArray: true}
    ]);
    if (e) throw e;

    var result = '';

    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.RuntimeRes.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.RuntimeRes.stringFormatBraceMismatch);

        
                var brace = format.slice(i, close).split(':');

        var argNumber = parseInt(brace[0]) + 1;
        if ((brace.length > 2) || isNaN(argNumber)) throw Error.argument('format', Sys.RuntimeRes.stringFormatInvalid);
        var arg = arguments[argNumber];
        if (typeof(arg) === "undefined" || arg === null) {
            arg = '';
        }

                if (arg.toFormattedString)
            result += arg.toFormattedString(brace[1] ? brace[1] : '');
        else
            result += arg.toString();

        i = close + 1;
    }

    return result;
}

String.prototype.startsWith = function String$startsWith(prefix) {
    /// <param name="prefix" type="String"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "prefix", type: String}
    ]);
    if (e) throw e;

    return (this.substr(0, prefix.length) === prefix);
}

String.prototype.trim = function String$trim() {
    /// <returns type="String"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return this.replace(/^\s+|\s+$/g, '');
}

String.prototype.trimEnd = String.prototype.rTrim = function String$rTrim() {
    /// <returns type="String"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return this.replace(/\s+$/, '');
}

String.prototype.trimStart = String.prototype.lTrim = function String$lTrim() {
    /// <returns type="String"></returns>
    if (arguments.length !== 0) throw Error.parameterCount();
    return this.replace(/^\s+/, '');
}

Type.registerNamespace('Sys');
Sys.RuntimeRes = {
    argumentInteger: 'Value must be an integer.',
    argumentTypeName: 'Value is not the name of an existing type.',
    arrayParseBadFormat: 'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.',
    badTypeName: 'Value is not the name of the type being registered or the name is a reserved word.',
    baseNotAClass: 'Value is not a class.',
    boolTrueOrFalse: 'Value must be \'true\' or \'false\'.',
    invalidNameSpace: 'Value is not a valid namespace identifier.',
    methodNotFound: "No method found with name '{0}'.",
    methodRegisteredTwice: 'Method {0} has already been registered.',
    namespaceContainsObject: 'Object {0} already exists and is not a namespace.',
    notAMethod: '{0} is not a method.',
    notAnInterface: 'Value is not a valid interface.',
    notATypeName: 'Value is not a valid type name.',
    stringFormatBraceMismatch: 'The format string contains an unmatched opening or closing brace.',
    stringFormatInvalid: 'The format string is invalid.',
    typeRegisteredTwice: 'Type {0} has already been registered.',
    typeShouldBeTypeOrString: 'Value is not a valid type or a valid type name.',
    actualValue: 'Actual value was {0}.',
    argument: 'Value does not fall within the expected range.',
    argumentNull: 'Value cannot be null.',
    argumentOutOfRange: 'Specified argument was out of the range of valid values.',
    argumentType: "Object cannot be converted to the required type.",
    argumentTypeWithTypes: "Object of type '{0}' cannot be converted to type '{1}'.",
    argumentUndefined: 'Value cannot be undefined.',
            invalidOperation: 'Operation is not valid due to the current state of the object.',
    notImplemented: 'The method or operation is not implemented.',
    parameterCount: 'Parameter count mismatch.',
    paramName: 'Parameter name: {0}'
}
Sys.IDisposable = function Sys$IDisposable() {
    throw Error.notImplemented();
}

    function Sys$IDisposable$dispose() {
        throw Error.notImplemented();
    }
Sys.IDisposable.prototype = {
    dispose: Sys$IDisposable$dispose
}
Sys.IDisposable.registerInterface('Sys.IDisposable');
Sys.StringBuilder = function Sys$StringBuilder(initialText) {
    /// <param name="initialText" optional="true" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "initialText", mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    this._parts = [];

    this.append(initialText)
}


    function Sys$StringBuilder$append(text) {
        /// <param name="text" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "text", mayBeNull: true}
        ]);
        if (e) throw e;

        if (typeof(text) !== "undefined" && text !== null) {
            this._parts.push(text);
        }
    }

    function Sys$StringBuilder$appendLine(text) {
        /// <param name="text" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "text", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        this.append(text);
        this.append('\r\n');
    }

    function Sys$StringBuilder$clear() {
        if (arguments.length !== 0) throw Error.parameterCount();
        this._parts = [];
    }

    function Sys$StringBuilder$isEmpty() {
        /// <returns type="Boolean"></returns>
        if (arguments.length !== 0) throw Error.parameterCount();
        return (this._parts.length === 0);
    }



    function Sys$StringBuilder$toString(separator) {
        /// <param name="separator" type="String" optional="true" mayBeNull="true"></param>
        /// <returns type="String"></returns>
        var e = Function._validateParams(arguments, [
            {name: "separator", type: String, mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        return this._parts.join(separator || '');
    }
Sys.StringBuilder.prototype = {
    append: Sys$StringBuilder$append,

    appendLine: Sys$StringBuilder$appendLine,

    clear: Sys$StringBuilder$clear,

    isEmpty: Sys$StringBuilder$isEmpty,

            toString: Sys$StringBuilder$toString
}
Sys.StringBuilder.registerClass('Sys.StringBuilder');
if (!window.XMLHttpRequest) {
    window.XMLHttpRequest = function window$XMLHttpRequest() {
        var progIDs = [ 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP' ];
	    
        for (var i = 0; i < progIDs.length; i++) {
            try {
                var xmlHttp = new ActiveXObject(progIDs[i]);
                return xmlHttp;
            }
            catch (ex) {
            }
        }
	    
        return null;
    }
}

Sys.Browser = {};

Sys.Browser.InternetExplorer = {};
Sys.Browser.Firefox = {};
Sys.Browser.Safari = {};
Sys.Browser.Opera = {};

Sys.Browser.agent = null;
Sys.Browser.hasDebuggerStatement = false;
Sys.Browser.name = navigator.appName;
Sys.Browser.version = parseFloat(navigator.appVersion);

if (navigator.userAgent.indexOf(' MSIE ') > -1) {
    Sys.Browser.agent = Sys.Browser.InternetExplorer;
    Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
    Sys.Browser.hasDebuggerStatement = true;
}
else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
    Sys.Browser.agent = Sys.Browser.Firefox;
    Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
    Sys.Browser.name = 'Firefox';
    Sys.Browser.hasDebuggerStatement = true;
}
else if (navigator.userAgent.indexOf(' Safari/') > -1) {
    Sys.Browser.agent = Sys.Browser.Safari;
    Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Safari\/(\d+\.\d+)/)[1]);
    Sys.Browser.name = 'Safari';
}
else if (navigator.userAgent.indexOf('Opera/') > -1) {
    Sys.Browser.agent = Sys.Browser.Opera;
}


Type.registerNamespace('Sys.UI');

Sys.Res = {
    appComponentMustBeInitialized: "Components must be initialized before they are added to the Application object.",
    appDuplicateComponent: "Two components with the same id '{0}' can't be added to the application.",
    behaviorDuplicateName: "A behavior with name '{0}' already exists or it is the name of an existing property on the target element.",
    cantAddWithoutId: "Can't add a component that doesn't have an id.",
    cantSetId: "The id property can't be set on this object.",
    cantSetIdAfterInit: "The id property can't be set on this object after initialization.",
    circularParentChain: "The chain of control parents can't have circular references.",
    componentCantSetIdTwice: "The id property of a component can't be set more than once.",
    controlAlreadyDefined: "Can't create a control if the associated element already has a 'control' field.",
    createComponentOnDom: "Value must be null for Components that are not Controls or Behaviors.",
    createNoDom: "Value must not be null for Controls and Behaviors.",
    createNotComponent: '{0} does not derive from Sys.Component.',
    enumInvalidValueName: "'{0}' is not a valid name for an enum value.",
    enumReservedName: "'{0}' is a reserved name that can't be used as an enum value name.",
    enumValueNotInteger: 'An enumeration definition can only contain integer values.',
    eventHandlerInvalid: 'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
    eventHandlerNotFound: 'Handler not found.',
    eventHandlerNotFunction: 'Handler must be a function.',
    invalidId: "Value can't be an empty string or start or end with spaces.",
    propertyNotAnArray: "'{0}' is not an Array property.",
    propertyNotWritable: "'{0}' is not a writable property.",
    propertyNullOrUndefined: "Cannot set the properties of '{0}' because it returned a null value.",
    propertyUndefined: "'{0}' is not a property or an existing field.",
    referenceNotFound: "Component '{0}' was not found.",
    undefinedEvent: "'{0}' is not an event.",
        assertFailed: 'Assertion Failed: {0}',
    assertFailedCaller: 'Assertion Failed: {0}\r\nat {1}',
    breakIntoDebugger: '{0}\r\n\r\nBreak into debugger?',
    enumInvalidValue: "'{0}' is not a valid value for enum {1}.",

    eventHandlerInvalid: 'Handler was not added through the Sys.UI.DomEvent.addHandler method.',

        badBaseUrl1: 'Base URL does not contain ://.',
    badBaseUrl2: 'Base URL does not contain another /.',
    badBaseUrl3: 'Cannot find last / in base URL.',
    cannotAbortBeforeStart: 'Cannot abort when executor has not started.',
    cannotCallBeforeResponse: 'Cannot call {0} when responseAvailable is false.',
    cannotCallOnceStarted: 'Cannot call {0} once started.',
    cannotCallOutsideHandler: 'Cannot call {0} outside of a completed event handler.',
    cannotDeserializeEmptyString: 'Cannot deserialize empty string.',
    cannotSerializeNonFiniteNumbers: 'Cannot serialize non finite numbers.',
    controlCantSetId: "The id property can't be set on a control.",
    invalidExecutorType: 'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.',
    invalidHttpVerb: 'httpVerb cannot be set to an empty or null string.',
    invalidTimeout: 'Value must be greater than or equal to zero.',
    invokeCalledTwice: 'Cannot call invoke more than once.',
    nullWebRequest: 'Cannot call executeRequest with a null webRequest.',
    setExecutorAfterActive: 'Cannot set executor after it has become active.',
    webServiceFailed: "The server method '{0}' failed with the following error: {1}",
    webServiceFailedNoMsg: "The server method '{0}' failed.",
    webServiceTimedOut: "The server method '{0}' timed out.",

        invalidServiceUrl: 'Cannot be set to an empty or null string.'
}
Sys._Debug = function Sys$_Debug() {
    if (arguments.length !== 0) throw Error.parameterCount();
}

    function Sys$_Debug$assert(condition, message, displayCaller) {
        /// <param name="condition" type="Boolean"></param>
        /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
        /// <param name="displayCaller" type="Boolean" optional="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "condition", type: Boolean},
            {name: "message", type: String, mayBeNull: true, optional: true},
            {name: "displayCaller", type: Boolean, 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);
            }
        }
    }

    function Sys$_Debug$fail(message) {
        /// <param name="message" type="String" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "message", type: String, mayBeNull: true}
        ]);
        if (e) throw e;

        if (Debug && Debug.writeln) Debug.writeln(message);

                if (Sys.Browser.hasDebuggerStatement) {
            eval('debugger');
        }
    }
Sys._Debug.prototype = {
    assert: Sys$_Debug$assert,

    fail: Sys$_Debug$fail
}
Sys._Debug.registerClass('Sys._Debug');

window.debug = new Sys._Debug();
    window.debug.isDebug = true;
function Sys$Enum$parse(value) {
    /// <param name="value" type="String"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "value", type: String}
    ]);
    if (e) throw e;

    var values = this.prototype;
    if (!this.__flags) {
        var val = values[value.trim()];
        if (typeof(val) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
        return val;
    }
    else {
        var parts = value.split(',');
        var v = 0;

        for (var i = parts.length - 1; i >= 0; i--) {
            var part = parts[i].trim();
            var val = values[part];
            if (typeof(val) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, part, this.__typeName));
            v |= val;
        }
        return v;
    }
}

function Sys$Enum$toString(value) {
    /// <param name="value" optional="true" mayBeNull="true"></param>
    /// <returns type="String"></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[sorted.length] = {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.add(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.prototype.registerEnum = function Type$registerEnum(name, flags) {
    /// <param name="name" type="String"></param>
    /// <param name="flags" type="Boolean" optional="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "name", type: String},
        {name: "flags", type: Boolean, optional: true}
    ]);
    if (e) throw e;

    if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.RuntimeRes.notATypeName);
        var parsedName;
    try {
        parsedName = eval(name);
    }
    catch(e) {
        throw Error.argument('name', Sys.RuntimeRes.argumentTypeName);
    }
    if (parsedName !== this) throw Error.argument('name', Sys.RuntimeRes.badTypeName);
    if (this.__registered) throw Error.invalidOperation(String.format(Sys.RuntimeRes.typeRegisteredTwice, name));
    for (var i in this.prototype) {
        var val = this.prototype[i];
        if (!Type.__identifierRegExp.test(i)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, i));
        if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger);
        if (typeof(this[i]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, i));
    }
    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;
    this.__registered = true;
}

Type.isEnum = function Type$isEnum(type) {
    /// <param name="type" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "type", mayBeNull: true}
    ]);
    if (e) throw e;

    if ((typeof(type) === 'undefined') || (type === null)) return false;
    return !!type.__enum;
}

Type.isFlags = function Type$isFlags(type) {
    /// <param name="type" mayBeNull="true"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "type", mayBeNull: true}
    ]);
    if (e) throw e;

    if ((typeof(type) === 'undefined') || (type === null)) return false;
    return !!type.__flags;
}
Sys.EventHandlerList = function Sys$EventHandlerList() {
    if (arguments.length !== 0) throw Error.parameterCount();
    this._list = {};
}


    function Sys$EventHandlerList$addHandler(id, handler) {
        /// <param name="id" type="String"></param>
        /// <param name="handler" type="Function"></param>
        var e = Function._validateParams(arguments, [
            {name: "id", type: String},
            {name: "handler", type: Function}
        ]);
        if (e) throw e;

        this._getEvent(id, true).add(handler);
    }
    function Sys$EventHandlerList$removeHandler(id, handler) {
        /// <param name="id" type="String"></param>
        /// <param name="handler" type="Function"></param>
        var e = Function._validateParams(arguments, [
            {name: "id", type: String},
            {name: "handler", type: Function}
        ]);
        if (e) throw e;

        var evt = this._getEvent(id);
        if (!evt) return;
        evt.remove(handler);
    }
    function Sys$EventHandlerList$getHandler(id) {
        /// <param name="id" type="String"></param>
        /// <returns type="Function"></returns>
        var e = Function._validateParams(arguments, [
            {name: "id", type: String}
        ]);
        if (e) throw e;

        var evt = this._getEvent(id);
        if (!evt || (evt.length === 0)) return null;
        evt = evt.clone();
        if (!evt._handler) {
            evt._handler = function(source, args) {
                for (var i = 0, l = evt.length; i < l; i++) {
                    evt[i](source, args);
                }
            };
        }
        return evt._handler;
    }

    function Sys$EventHandlerList$_getEvent(id, create) {
        if (!this._list[id]) {
            if (!create) return null;
            this._list[id] = [];
        }
        return this._list[id];
    }
Sys.EventHandlerList.prototype = {
    addHandler: Sys$EventHandlerList$addHandler,
    removeHandler: Sys$EventHandlerList$removeHandler,
    getHandler: Sys$EventHandlerList$getHandler,

    _getEvent: Sys$EventHandlerList$_getEvent
}
Sys.EventHandlerList.registerClass('Sys.EventHandlerList');
Sys.EventArgs = function Sys$EventArgs() {
    if (arguments.length !== 0) throw Error.parameterCount();
}
Sys.EventArgs.registerClass('Sys.EventArgs');

Sys.EventArgs.Empty = new Sys.EventArgs();
Sys.CancelEventArgs = function Sys$CancelEventArgs() {
    if (arguments.length !== 0) throw Error.parameterCount();
    Sys.CancelEventArgs.initializeBase(this);

    this._cancel = false;
}


    function Sys$CancelEventArgs$get_cancel() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._cancel;
    }
    function Sys$CancelEventArgs$set_cancel(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
        if (e) throw e;

        this._cancel = value;
    }
Sys.CancelEventArgs.prototype = {
    get_cancel: Sys$CancelEventArgs$get_cancel,
    set_cancel: Sys$CancelEventArgs$set_cancel
}

Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs);
Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() {
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}

    function Sys$INotifyPropertyChange$add_propertyChanged(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        throw Error.notImplemented();
    }
    function Sys$INotifyPropertyChange$remove_propertyChanged(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        throw Error.notImplemented();
    }
Sys.INotifyPropertyChange.prototype = {
    add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged,
    remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged
}
Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange');
Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) {
    /// <param name="propertyName" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "propertyName", type: String}
    ]);
    if (e) throw e;

    Sys.PropertyChangedEventArgs.initializeBase(this);
    this._propertyName = propertyName;
}
 
    function Sys$PropertyChangedEventArgs$get_propertyName() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._propertyName;
    }
Sys.PropertyChangedEventArgs.prototype = {
    get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName
}
Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
Sys.INotifyDisposing = function Sys$INotifyDisposing() {
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}

    function Sys$INotifyDisposing$add_disposing(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        throw Error.notImplemented();
    }
    function Sys$INotifyDisposing$remove_disposing(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        throw Error.notImplemented();
    }
Sys.INotifyDisposing.prototype = {
    add_disposing: Sys$INotifyDisposing$add_disposing,
    remove_disposing: Sys$INotifyDisposing$remove_disposing
}
Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");
Sys.Component = function Sys$Component() {
    if (arguments.length !== 0) throw Error.parameterCount();
    if (Sys.Application) Sys.Application.registerDisposableObject(this);
}





    function Sys$Component$get_events() {
        /// <value type="Sys.EventHandlerList"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        if (!this._events) {
            this._events = new Sys.EventHandlerList();
        }
        return this._events;
    }
    function Sys$Component$get_id() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._id;
    }
    function Sys$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);
        if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' '))
            throw Error.argument('value', Sys.Res.invalidId);
        this._id = value;
        this._idSet = true;
    }
    function Sys$Component$get_isInitialized() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._initialized;
    }
    function Sys$Component$get_isUpdating() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._updating;
    }
    function Sys$Component$add_disposing(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().addHandler("disposing", handler);
    }
    function Sys$Component$remove_disposing(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().removeHandler("disposing", handler);
    }
    function Sys$Component$add_propertyChanged(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().addHandler("propertyChanged", handler);
    }
    function Sys$Component$remove_propertyChanged(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().removeHandler("propertyChanged", handler);
    }
    function Sys$Component$beginUpdate() {
        this._updating = true;
    }
    function Sys$Component$dispose() {
        if (this._events) {
            var handler = this._events.getHandler("disposing");
            if (handler) {
                handler(this, Sys.EventArgs.Empty);
            }
        }
        delete this._events;
        Sys.Application.unregisterDisposableObject(this);
        Sys.Application.removeComponent(this);
    }
    function Sys$Component$endUpdate() {
        this._updating = false;
        if (!this._initialized) this.initialize();
        this.updated();
    }
    function Sys$Component$initialize() {
        this._initialized = true;
    }
    function Sys$Component$raisePropertyChanged(propertyName) {
        /// <param name="propertyName" type="String"></param>
        var e = Function._validateParams(arguments, [
            {name: "propertyName", type: String}
        ]);
        if (e) throw e;

        if (!this._events) return;
        var handler = this._events.getHandler("propertyChanged");
        if (handler) {
            handler(this, new Sys.PropertyChangedEventArgs(propertyName));
        }
    }
    function Sys$Component$updated() {
    }
Sys.Component.prototype = {
    _id: null,
    _idSet: false,
    _initialized: false,
    _updating: false,
    get_events: Sys$Component$get_events,
    get_id: Sys$Component$get_id,
    set_id: Sys$Component$set_id,
    get_isInitialized: Sys$Component$get_isInitialized,
    get_isUpdating: Sys$Component$get_isUpdating,
    add_disposing: Sys$Component$add_disposing,
    remove_disposing: Sys$Component$remove_disposing,
    add_propertyChanged: Sys$Component$add_propertyChanged,
    remove_propertyChanged: Sys$Component$remove_propertyChanged,
    beginUpdate: Sys$Component$beginUpdate,
    dispose: Sys$Component$dispose,
    endUpdate: Sys$Component$endUpdate,
    initialize: Sys$Component$initialize,
    raisePropertyChanged: Sys$Component$raisePropertyChanged,
    updated: Sys$Component$updated
}
Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing);

function Sys$Component$_setProperties(target, properties) {
    /// <param name="target"></param>
    /// <param name="properties"></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 (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
            if ((typeof(val) !== 'object') || (isObject && (typeof(targetVal) === 'undefined'))) {
                target[name] = val;
            }
            else {
                Sys$Component$_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));
                Sys$Component$_setProperties(current, val);
            }
            else {
                                throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
            }
        }
    }
    if (isComponent) target.endUpdate();
}

function Sys$Component$_setReferences(component, references) {
    for (var name in references) {
        var setter = component["set_" + name];
        var reference = $find(references[name]);
        if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
        if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, name));
        setter.apply(component, [reference]);
    }
}

var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
    /// <param name="type" type="Type"></param>
    /// <param name="properties" optional="true" mayBeNull="true"></param>
    /// <param name="events" optional="true" mayBeNull="true"></param>
    /// <param name="references" optional="true" mayBeNull="true"></param>
    /// <param name="element" type="Sys.UI.DomElement" optional="true" mayBeNull="true"></param>
    /// <returns type="Sys.UI.Component"></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", type: Sys.UI.DomElement, mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    if (!type.inheritsFrom(Sys.Component)) {
        throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
    }
    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());
    var app = Sys.Application;
    var creatingComponents = app.get_isCreatingComponents();

    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]);
        }
    }

    app._createdComponents.add(component);
    if (component.get_id()) {
        app.addComponent(component);
    }
    if (creatingComponents) {
        if (references) {
            app._addComponentToSecondPass(component, references);
        }
        else {
            component.endUpdate();
        }
    }
    else {
        if (references) {
            Sys$Component$_setReferences(component, references);
        }
        component.endUpdate();
    }

    return component;
}
Sys.UI.MouseButton = function Sys$UI$MouseButton() {
    /// <field name="leftButton" type="Number" integer="true" static="true"></field>
    /// <field name="middleButton" type="Number" integer="true" static="true"></field>
    /// <field name="rightButton" type="Number" integer="true" static="true"></field>
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}




Sys.UI.MouseButton.prototype = {
    leftButton: 0,
    middleButton: 1,
    rightButton: 2
}
Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");
Sys.UI.Key = function Sys$UI$Key() {
    /// <field name="backspace" type="Number" integer="true" static="true"></field>
    /// <field name="tab" type="Number" integer="true" static="true"></field>
    /// <field name="return" type="Number" integer="true" static="true"></field>
    /// <field name="esc" type="Number" integer="true" static="true"></field>
    /// <field name="space" type="Number" integer="true" static="true"></field>
    /// <field name="pageUp" type="Number" integer="true" static="true"></field>
    /// <field name="pageDown" type="Number" integer="true" static="true"></field>
    /// <field name="end" type="Number" integer="true" static="true"></field>
    /// <field name="home" type="Number" integer="true" static="true"></field>
    /// <field name="left" type="Number" integer="true" static="true"></field>
    /// <field name="up" type="Number" integer="true" static="true"></field>
    /// <field name="right" type="Number" integer="true" static="true"></field>
    /// <field name="down" type="Number" integer="true" static="true"></field>
    /// <field name="windowsDelete" type="Number" integer="true" static="true"></field>
    /// <field name="delete" type="Number" integer="true" static="true"></field>
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}
















Sys.UI.Key.prototype = {
    backspace: 8,
    tab: 9,
    "return": 13,
    esc: 27,
    space: 32,
    pageUp: 33,
    pageDown: 34,
    end: 35,
    home: 36,
    left: 37,
    up: 38,
    right: 39,
    down: 40,
    windowsDelete: 46,
    "delete": 127
}
Sys.UI.Key.registerEnum("Sys.UI.Key");
Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) {
    /// <param name="eventObject"></param>
    /// <field name="altKey" type="Boolean"></field>
    /// <field name="button" type="Sys.UI.MouseButton"></field>
    /// <field name="charCode" type="Number" integer="true"></field>
    /// <field name="clientX" type="Number" integer="true"></field>
    /// <field name="clientY" type="Number" integer="true"></field>
    /// <field name="ctrlKey" type="Boolean"></field>
    /// <field name="offsetX" type="Number" integer="true"></field>
    /// <field name="offsetY" type="Number" integer="true"></field>
    /// <field name="screenX" type="Number" integer="true"></field>
    /// <field name="screenY" type="Number" integer="true"></field>
    /// <field name="shiftKey" type="Boolean"></field>
    /// <field name="target" type="Sys.UI.DomElement"></field>
    /// <field name="type" type="String"></field>
    var e = Function._validateParams(arguments, [
        {name: "eventObject"}
    ]);
    if (e) throw e;

    var e = eventObject;
    this.rawEvent = e;
    this.altKey = e.altKey;
    this.button = (typeof(e.which) === 'undefined') ? e.button :
        (e.button === 4) ? Sys.UI.MouseButton.middleButton :
        (e.button === 2) ? Sys.UI.MouseButton.rightButton :
        Sys.UI.MouseButton.leftButton;
    this.charCode = e.charCode ? e.charCode : e.keyCode;
    this.clientX = e.clientX;
    this.clientY = e.clientY;
    this.ctrlKey = e.ctrlKey;
    this.target = e.target ? e.target : e.srcElement;
    if (this.target) {
        var loc = Sys.UI.DomElement.getLocation(this.target);
        this.offsetX = e.offsetX ? e.offsetX : window.pageXOffset + e.clientX - loc.x;
        this.offsetY = e.offsetY ? e.offsetY : window.pageYOffset + e.clientY - loc.y;
    }
    this.screenX = e.screenX;
    this.screenY = e.screenY;
    this.shiftKey = e.shiftKey;
    this.type = e.type;
}

    function Sys$UI$DomEvent$preventDefault() {
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this.rawEvent.preventDefault) {
            this.rawEvent.preventDefault();
        }
        else if (window.event) {
            window.event.returnValue = false;
        }
    }
    function Sys$UI$DomEvent$stopPropagation() {
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this.rawEvent.stopPropagation) {
            this.rawEvent.stopPropagation();
        }
        else if (window.event) {
            window.event.cancelBubble = true;
        }
    }
Sys.UI.DomEvent.prototype = {
    preventDefault: Sys$UI$DomEvent$preventDefault,
    stopPropagation: Sys$UI$DomEvent$stopPropagation
}
Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent');

var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="eventName" type="String"></param>
    /// <param name="handler" type="Function"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "eventName", type: String},
        {name: "handler", type: Function}
    ]);
    if (e) throw e;

    if (element.addEventListener) {
        if (!handler._browserHandler) {
            handler._browserHandler = function handler$_browserHandler(e) {
                handler.call(element, new Sys.UI.DomEvent(e));
            }
        }
        element.addEventListener(eventName, handler._browserHandler, false);
    }
    else if (element.attachEvent) {
        if (!handler._browserHandler) {
            handler._browserHandler = function handler$_browserHandler() {
                handler.call(element, new Sys.UI.DomEvent(window.event));
            }
        }
        element.attachEvent('on' + eventName, handler._browserHandler);
    }
}

var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="eventName" type="String"></param>
    /// <param name="handler" type="Function"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "eventName", type: String},
        {name: "handler", type: Function}
    ]);
    if (e) throw e;

    if (typeof(handler._browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
    var browserHandler = handler._browserHandler;
    if (element.removeEventListener) {
        element.removeEventListener(eventName, browserHandler, false);
    }
    else if (element.detachEvent) {
        element.detachEvent('on' + eventName, browserHandler);
    }
}
Sys.IContainer = function Sys$IContainer() {
    throw Error.notImplemented();
}

    function Sys$IContainer$addComponent(component) {
        /// <param name="component" type="Sys.Component"></param>
        var e = Function._validateParams(arguments, [
            {name: "component", type: Sys.Component}
        ]);
        if (e) throw e;

        throw Error.notImplemented();
    }
    function Sys$IContainer$removeComponent(component) {
        /// <param name="component" type="Sys.Component"></param>
        var e = Function._validateParams(arguments, [
            {name: "component", type: Sys.Component}
        ]);
        if (e) throw e;

        throw Error.notImplemented();
    }
    function Sys$IContainer$findComponent(id) {
        /// <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();
    }
    function Sys$IContainer$getComponents() {
        /// <returns type="Array" elementType="Sys.Component"></returns>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
Sys.IContainer.prototype = {
    addComponent: Sys$IContainer$addComponent,
    removeComponent: Sys$IContainer$removeComponent,
    findComponent: Sys$IContainer$findComponent,
    getComponents: Sys$IContainer$getComponents
}
Sys.IContainer.registerInterface("Sys.IContainer");

Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components) {
    /// <param name="components" type="Array" elementType="Sys.Component"></param>
    var e = Function._validateParams(arguments, [
        {name: "components", type: Array, elementType: Sys.Component}
    ]);
    if (e) throw e;

    Sys.ApplicationLoadEventArgs.initializeBase(this);
    this._components = components;
}
 
    function Sys$ApplicationLoadEventArgs$get_components() {
        /// <value type="Array" elementType="Sys.Component"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._components;
    }
Sys.ApplicationLoadEventArgs.prototype = {
    get_components: Sys$ApplicationLoadEventArgs$get_components
}
Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
Sys._Application = function Sys$_Application() {
    Sys._Application.initializeBase(this);

    this._disposableObjects = [];
    this._components = {};
    this._createdComponents = [];
    this._secondPassComponents = [];

    this._loadHandlerDelegate = Function.createDelegate(this, this._loadHandler);
    this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler);

    Sys.UI.DomEvent.addHandler(window, "load", this._loadHandlerDelegate);
    Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
}




    function Sys$_Application$get_isCreatingComponents() {
        /// <value type="Array" elementType="Sys.Component"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._creatingComponents;
    }
    function Sys$_Application$add_load(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().addHandler("load", handler);
    }
    function Sys$_Application$remove_load(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().removeHandler("load", handler);
    }
    function Sys$_Application$add_init(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        if (this._initialized) {
            handler(this, Sys.EventArgs.Empty);
        }
        else {
            this.get_events().addHandler("init", handler);
        }
    }
    function Sys$_Application$remove_init(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().removeHandler("init", handler);
    }
    function Sys$_Application$add_unload(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().addHandler("unload", handler);
    }
    function Sys$_Application$remove_unload(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this.get_events().removeHandler("unload", handler);
    }
    function Sys$_Application$addComponent(component) {
        /// <param name="component" type="Sys.Component"></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;
    }
    function Sys$_Application$beginCreateComponents() {
        this._creatingComponents = true;
    }
    function Sys$_Application$dispose() {
        if (!this._disposing) {
            this._disposing = true;
            if (window.pageUnload) {
                window.pageUnload(this, Sys.EventArgs.Empty);
            }
            var unloadHandler = this.get_events().getHandler("unload");
            if (unloadHandler) {
                unloadHandler(this, Sys.EventArgs.Empty);
            }
            var disposableObjects = this._disposableObjects.clone();
            for (var i = 0, l = disposableObjects.length; i < l; i++) {
                disposableObjects[i].dispose();
            }
            this._disposableObjects.clear();

            Sys.UI.DomEvent.removeHandler(window, "load", this._loadHandlerDelegate);
            Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate);
            Sys._Application.callBaseMethod(this, 'dispose');
        }
    }
    function Sys$_Application$endCreateComponents() {
        var components = this._secondPassComponents;
        for (var i = 0, l = components.length; i < l; i++) {
            var component = components[i].component;
            Sys$Component$_setReferences(component, components[i].references);
            component.endUpdate();
        }
        this._secondPassComponents = [];
        this._creatingComponents = false;
    }
    function Sys$_Application$findComponent(id, parent) {
        /// <param name="id" type="String"></param>
        /// <param name="parent" optional="true" mayBeNull="true"></param>
        /// <returns type="Sys.Component" mayBeNull="true"></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);
    }
    function Sys$_Application$getComponents() {
        /// <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) {
            res[res.length] = components[name];
        }
        return res;
    }
    function Sys$_Application$initialize() {
        if (!this._initialized) {
            Sys._Application.callBaseMethod(this, 'initialize');
            var handler = this.get_events().getHandler("init");
            if (handler) {
                this.beginCreateComponents();
                handler(this, Sys.EventArgs.Empty);
                this.endCreateComponents();
            }
        }
        this.raiseLoad();
    }
    function Sys$_Application$registerDisposableObject(object) {
        /// <param name="object" type="Sys.IDisposable"></param>
        var e = Function._validateParams(arguments, [
            {name: "object", type: Sys.IDisposable}
        ]);
        if (e) throw e;

        if (!this._disposing) {
            this._disposableObjects[this._disposableObjects.length] = object;
        }
    }
    function Sys$_Application$raiseLoad() {
        var h = this.get_events().getHandler("load");
        var args = new Sys.ApplicationLoadEventArgs(this._createdComponents.clone());
        if (h) {
            h(this, args);
        }
        if (window.pageLoad) {
            window.pageLoad(this, args);
        }
        this._createdComponents = [];
    }
    function Sys$_Application$removeComponent(component) {
        /// <param name="component" type="Sys.Component"></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];
    }
    function Sys$_Application$unregisterDisposableObject(object) {
        /// <param name="object" type="Sys.IDisposable"></param>
        var e = Function._validateParams(arguments, [
            {name: "object", type: Sys.IDisposable}
        ]);
        if (e) throw e;

        if (!this._disposing) {
            this._disposableObjects.remove(object);
        }
    }
    function Sys$_Application$_addComponentToSecondPass(component, references) {
        this._secondPassComponents.add({component: component, references: references});
    }
    function Sys$_Application$_loadHandler(event) {
        this.initialize();
    }
    function Sys$_Application$_unloadHandler(event) {
        this.dispose();
    }
Sys._Application.prototype = {
    _creatingComponents: false,
    _disposing: false,

    get_isCreatingComponents: Sys$_Application$get_isCreatingComponents,
    add_load: Sys$_Application$add_load,
    remove_load: Sys$_Application$remove_load,
    add_init: Sys$_Application$add_init,
    remove_init: Sys$_Application$remove_init,
    add_unload: Sys$_Application$add_unload,
    remove_unload: Sys$_Application$remove_unload,
    addComponent: Sys$_Application$addComponent,
    beginCreateComponents: Sys$_Application$beginCreateComponents,
    dispose: Sys$_Application$dispose,
    endCreateComponents: Sys$_Application$endCreateComponents,
    findComponent: Sys$_Application$findComponent,
    getComponents: Sys$_Application$getComponents,
    initialize: Sys$_Application$initialize,
    registerDisposableObject: Sys$_Application$registerDisposableObject,
    raiseLoad: Sys$_Application$raiseLoad,
    removeComponent: Sys$_Application$removeComponent,
    unregisterDisposableObject: Sys$_Application$unregisterDisposableObject,
    _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass,
    _loadHandler: Sys$_Application$_loadHandler,
    _unloadHandler: Sys$_Application$_unloadHandler
}
Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer);

Sys.Application = new Sys._Application();

var $find = Sys.Application.findComponent;

Type.registerNamespace('Sys.Net');

Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() {
    if (arguments.length !== 0) throw Error.parameterCount();
    this._webRequest = null;
    this._resultObject = null;
}


    function Sys$Net$WebRequestExecutor$get_webRequest() {
        /// <value type="Sys.Net.WebRequest"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._webRequest;
    }

    function Sys$Net$WebRequestExecutor$_set_webRequest(value) {
        if (this.get_started()) {
            throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
        }

        this._webRequest = value;
    }


    function Sys$Net$WebRequestExecutor$get_started() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }

    function Sys$Net$WebRequestExecutor$get_responseAvailable() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }

    function Sys$Net$WebRequestExecutor$get_timedOut() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_aborted() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_responseData() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_statusCode() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_statusText() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_xml() {
        /// <value></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$get_object() {
        /// <value></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        if (!this._resultObject) {
            this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
        }
        return this._resultObject;
    }


    function Sys$Net$WebRequestExecutor$executeRequest() {
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$abort() {
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$getResponseHeader(header) {
        /// <param name="header" type="String"></param>
        var e = Function._validateParams(arguments, [
            {name: "header", type: String}
        ]);
        if (e) throw e;

        throw Error.notImplemented();
    }
    function Sys$Net$WebRequestExecutor$getAllResponseHeaders() {
        if (arguments.length !== 0) throw Error.parameterCount();
        throw Error.notImplemented();
    }
Sys.Net.WebRequestExecutor.prototype = {
    get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest,

    _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest,

        get_started: Sys$Net$WebRequestExecutor$get_started,

    get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable,

    get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut,
    get_aborted: Sys$Net$WebRequestExecutor$get_aborted,
    get_responseData: Sys$Net$WebRequestExecutor$get_responseData,
    get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode,
    get_statusText: Sys$Net$WebRequestExecutor$get_statusText,
    get_xml: Sys$Net$WebRequestExecutor$get_xml,
    get_object: Sys$Net$WebRequestExecutor$get_object,

        executeRequest: Sys$Net$WebRequestExecutor$executeRequest,
    abort: Sys$Net$WebRequestExecutor$abort,
    getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader,
    getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders
}
Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor');
window.XMLDOM = function window$XMLDOM(markup) {
    if (!window.DOMParser) {
        var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];

        for (var i = 0; i < progIDs.length; i++) {
            try {
                var xmlDOM = new ActiveXObject(progIDs[i]);
                xmlDOM.async = false;
                xmlDOM.loadXML(markup);
                xmlDOM.setProperty('SelectionLanguage', 'XPath');

                return xmlDOM;
            }
            catch (ex) {
            }
        }

        return null;
    }
        else {
        var domParser = new window.DOMParser();
        return domParser.parseFromString(markup, 'text/xml');
    }
    }

Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
    if (arguments.length !== 0) throw Error.parameterCount();

    Sys.Net.XMLHttpExecutor.initializeBase(this);

    var _this = this;
    this._xmlHttpRequest = null;
    this._webRequest = null;
    this._responseAvailable = false;
    this._timedOut = false;
    this._timer = null;
    this._aborted = false;
    this._started = false;

    this._onReadyStateChange = function () {
        
        if (_this._xmlHttpRequest.readyState === 4 ) {

            _this._clearTimer();
            _this._responseAvailable = true;
            _this._webRequest.completed(Sys.EventArgs.Empty);
            if (_this._xmlHttpRequest != null) {
                _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
                _this._xmlHttpRequest = null;
            }
        }
    }

    this._clearTimer = function this$_clearTimer() {
        if (_this._timer != null) {
            window.clearTimeout(_this._timer);
            _this._timer = null;
        }
    }

    this._onTimeout = function this$_onTimeout() {
        if (!_this._responseAvailable) {
            _this._clearTimer();
            _this._timedOut = true;
            _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
            _this._xmlHttpRequest.abort();
            _this._webRequest.completed(Sys.EventArgs.Empty);
            _this._xmlHttpRequest = null;
        }
    }

}



    function Sys$Net$XMLHttpExecutor$get_timedOut() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._timedOut;
    }

    function Sys$Net$XMLHttpExecutor$get_started() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._started;
    }

    function Sys$Net$XMLHttpExecutor$get_responseAvailable() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
    return this._responseAvailable;
    }

    function Sys$Net$XMLHttpExecutor$get_aborted() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._aborted;
    }

    function Sys$Net$XMLHttpExecutor$executeRequest() {
        if (arguments.length !== 0) throw Error.parameterCount();
        this._webRequest = this.get_webRequest();

        if (this._started) {
            throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
        }
        if (this._webRequest === null) {
            throw Error.invalidOperation(Sys.Res.nullWebRequest);
        }

        var body = this._webRequest.get_body();
        var headers = this._webRequest.get_headers();
        this._xmlHttpRequest = new XMLHttpRequest();
        this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange;
        var verb = this._webRequest.get_httpVerb();
        this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true );
        if (headers) {
            for (var header in headers) {
                var val = headers[header];
                if (typeof(val) !== "function")
                    this._xmlHttpRequest.setRequestHeader(header, val);
            }
        }

        if (verb.toLowerCase() === "post") {
                        if ((headers === null) || !headers['Content-Type']) {
                this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            }

                        if (!body) {
                body = "";
            }
        }

        var timeout = this._webRequest.get_timeout();
        if (timeout > 0) {
            this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
        }
        this._xmlHttpRequest.send(body);
        this._started = true;
    }

    function Sys$Net$XMLHttpExecutor$getResponseHeader(header) {
        /// <param name="header" type="String"></param>
        /// <returns type="String"></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 result;
        try {
            result = this._xmlHttpRequest.getResponseHeader(header);
        } catch (e) {
        }
        if (!result) result = "";
        return result;
    }

    function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() {
        /// <returns type="String"></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();
    }

    function Sys$Net$XMLHttpExecutor$get_responseData() {
        /// <value type="String"></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;
    }

    function Sys$Net$XMLHttpExecutor$get_statusCode() {
        /// <value type="Number"></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'));
        }

        return this._xmlHttpRequest.status;
    }

    function Sys$Net$XMLHttpExecutor$get_statusText() {
        /// <value type="String"></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;
    }

    function Sys$Net$XMLHttpExecutor$get_xml() {
        /// <value></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 xml = this._xmlHttpRequest.responseXML;
        if (xml === null || !xml.documentElement) {

                        xml = new XMLDOM(this._xmlHttpRequest.responseText);

                        if (xml === null || !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.tagName === "root" && xml.documentElement.firstChild && 
            xml.documentElement.firstChild.tagName === "parsererror") {
            return null;
        }
        
        return xml;
    }

    function Sys$Net$XMLHttpExecutor$abort() {
        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();

        if (this._xmlHttpRequest && !this._responseAvailable) {

                        this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
            this._xmlHttpRequest.abort();

            this._xmlHttpRequest = null;
            var handler = this._webRequest._get_eventHandlerList().getHandler("completed");
            if (handler) {
                handler(this, Sys.EventArgs.Empty);
            }
        }
    }
Sys.Net.XMLHttpExecutor.prototype = {

    get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut,

    get_started: Sys$Net$XMLHttpExecutor$get_started,

    get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable,

    get_aborted: Sys$Net$XMLHttpExecutor$get_aborted,

    executeRequest: Sys$Net$XMLHttpExecutor$executeRequest,

    getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader,

    getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders,

    get_responseData: Sys$Net$XMLHttpExecutor$get_responseData,

    get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode,

    get_statusText: Sys$Net$XMLHttpExecutor$get_statusText,

    get_xml: Sys$Net$XMLHttpExecutor$get_xml,

    abort: Sys$Net$XMLHttpExecutor$abort
}
Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() {
    this._this = this;
    this._defaultTimeout = 0;
    this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
}


    function Sys$Net$_WebRequestManager$add_invokingRequest(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this._get_eventHandlerList().addHandler("invokingRequest", handler);
    }
    function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this._get_eventHandlerList().removeHandler("invokingRequest", handler);
    }

    function Sys$Net$_WebRequestManager$add_completedRequest(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this._get_eventHandlerList().addHandler("completedRequest", handler);
    }
    function Sys$Net$_WebRequestManager$remove_completedRequest(handler) {
        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
        if (e) throw e;

        this._get_eventHandlerList().removeHandler("completedRequest", handler);
    }

    function Sys$Net$_WebRequestManager$_get_eventHandlerList() {
        if (!this._events) {
            this._events = new Sys.EventHandlerList();
        }
        return this._events;
    }

    function Sys$Net$_WebRequestManager$get_defaultTimeout() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultTimeout;
    }
    function Sys$Net$_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;
    }

    function Sys$Net$_WebRequestManager$get_defaultExecutorType() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultExecutorType;
    }
    function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String}]);
        if (e) throw e;

        this._defaultExecutorType = value;
    }

    function Sys$Net$_WebRequestManager$executeRequest(webRequest) {
        /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
        var e = Function._validateParams(arguments, [
            {name: "webRequest", type: Sys.Net.WebRequest}
        ]);
        if (e) throw e;

        var executor = webRequest.get_executor();
                if (!executor) {
            
            var failed = false;
            try {
                var executorType = eval(this._defaultExecutorType);
                executor = new executorType();
            } catch (e) {
                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()) {
            return;
        }

        var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
        var handler = this._get_eventHandlerList().getHandler("invokingRequest");
        if (handler) {
            handler(this, evArgs);
        }

        if (!evArgs.get_cancel()) {
            executor.executeRequest();
        }
    }
Sys.Net._WebRequestManager.prototype = {
    add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest,
    remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest,

    add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest,
    remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest,

    _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList,

    get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout,
    set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout,

    get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType,
    set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType,

    executeRequest: Sys$Net$_WebRequestManager$executeRequest
}

Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager');

Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) {
    /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
    var e = Function._validateParams(arguments, [
        {name: "webRequest", type: Sys.Net.WebRequest}
    ]);
    if (e) throw e;

    Sys.Net.NetworkRequestEventArgs.initializeBase(this);
    this._webRequest = webRequest;
}


    function Sys$Net$NetworkRequestEventArgs$get_webRequest() {
        /// <value type="Sys.Net.WebRequest"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._webRequest;
    }
Sys.Net.NetworkRequestEventArgs.prototype = {
    get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest
}

Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
Sys.Net.WebRequest = function Sys$Net$WebRequest() {
    if (arguments.length !== 0) throw Error.parameterCount();
    this._url = "";
    this._headers = { };
    this._body = null;
    this._userContext = null;
    this._httpVerb = null;
    this._executor = null;
    this._invokeCalled = false;
    this._timeout = 0;
}


    function Sys$Net$WebRequest$add_completed(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        this._get_eventHandlerList().addHandler("completed", handler);
    }
    function Sys$Net$WebRequest$remove_completed(handler) {
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e;

        this._get_eventHandlerList().removeHandler("completed", handler);
    }

    function Sys$Net$WebRequest$completed(eventArgs) {
        /// <param name="eventArgs" type="Sys.EventArgs"></param>
        var e = Function._validateParams(arguments, [
            {name: "eventArgs", type: Sys.EventArgs}
        ]);
        if (e) throw e;

        var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");
        if (handler) {
            handler(this._executor, eventArgs);
        }

        handler = this._get_eventHandlerList().getHandler("completed");
        if (handler) {
            handler(this._executor, eventArgs);
        }
    }

    function Sys$Net$WebRequest$_get_eventHandlerList() {
        if (!this._events) {
            this._events = new Sys.EventHandlerList();
        }
        return this._events;
    }

    function Sys$Net$WebRequest$get_url() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._url;
    }
    function Sys$Net$WebRequest$set_url(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String}]);
        if (e) throw e;

        this._url = value;
    }

    function Sys$Net$WebRequest$get_headers() {
        /// <value></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._headers;
    }

    function Sys$Net$WebRequest$get_httpVerb() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
                if (this._httpVerb === null) {
            if (this._body === null) {
                return "GET";
            }
            return "POST";
        }
        return this._httpVerb;
    }
    function Sys$Net$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;
    }

    function Sys$Net$WebRequest$get_body() {
        /// <value mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._body;
    }
    function Sys$Net$WebRequest$set_body(value) {
        var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
        if (e) throw e;

        this._body = value;
    }

    function Sys$Net$WebRequest$get_userContext() {
        /// <value mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._userContext;
    }
    function Sys$Net$WebRequest$set_userContext(value) {
        var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
        if (e) throw e;

        this._userContext = value;
    }

    function Sys$Net$WebRequest$get_executor() {
        /// <value type="Sys.Net.WebRequestExecutor"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._executor;
    }
    function Sys$Net$WebRequest$set_executor(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
        if (e) throw e;

        if (this._executor !== null && this._executor.get_started()) {
            throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
        }

        this._executor = value;
        this._executor._set_webRequest(this);
    }

    function Sys$Net$WebRequest$get_timeout() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this._timeout === 0) {
            return Sys.Net.WebRequestManager.get_defaultTimeout();
        }
        return this._timeout;
    }
    function Sys$Net$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;
    }

    function Sys$Net$WebRequest$getResolvedUrl() {
        /// <returns type="String"></returns>
        if (arguments.length !== 0) throw Error.parameterCount();
        return Sys.Net.WebRequest._resolveUrl(this._url);
    }

    function Sys$Net$WebRequest$invoke() {
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this._invokeCalled) {
            throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
        }

        Sys.Net.WebRequestManager.executeRequest(this);
        this._invokeCalled = true;
    }
Sys.Net.WebRequest.prototype = {
    add_completed: Sys$Net$WebRequest$add_completed,
    remove_completed: Sys$Net$WebRequest$remove_completed,

    completed: Sys$Net$WebRequest$completed,

    _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList,

    get_url: Sys$Net$WebRequest$get_url,
    set_url: Sys$Net$WebRequest$set_url,

    get_headers: Sys$Net$WebRequest$get_headers,

    get_httpVerb: Sys$Net$WebRequest$get_httpVerb,
    set_httpVerb: Sys$Net$WebRequest$set_httpVerb,

    get_body: Sys$Net$WebRequest$get_body,
    set_body: Sys$Net$WebRequest$set_body,

    get_userContext: Sys$Net$WebRequest$get_userContext,
    set_userContext: Sys$Net$WebRequest$set_userContext,

    get_executor: Sys$Net$WebRequest$get_executor,
    set_executor: Sys$Net$WebRequest$set_executor,

    get_timeout: Sys$Net$WebRequest$get_timeout,
    set_timeout: Sys$Net$WebRequest$set_timeout,

    getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl,

    invoke: Sys$Net$WebRequest$invoke
}

Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) {
        if (url && url.indexOf('://') !== -1) {
        return url;
    }

        if (!baseUrl || baseUrl.length === 0) {
        var baseElement = document.getElementsByTagName('base')[0];
        if (baseElement && baseElement.href && baseElement.href.length > 0) {
            baseUrl = baseElement.href;
        }
        else {
            baseUrl = document.URL;
        }
    }

        var qsStart = baseUrl.indexOf('?');
    if (qsStart !== -1) {
        baseUrl = baseUrl.substr(0, qsStart);
    }
    baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);

        if (!url || url.length === 0) {
        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;
    }
}

Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod) {
        if (!encodeMethod)
        encodeMethod = encodeURIComponent;

    var sb = new Sys.StringBuilder();

    var i = 0;
    for (var arg in queryString) {
        var obj = queryString[arg];
        if (typeof(obj) === "function") continue;
        var val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
        if (i !== 0) {
            sb.append('&');
        }

        sb.append(arg);
        sb.append('=');
        sb.append(encodeMethod(val));

        i++;
    }

    return sb.toString();
}

Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString) {
    if (!queryString) {
        return url;
    }

    var qs = Sys.Net.WebRequest._createQueryString(queryString);
    if (qs.length > 0) {
        var sep = '?';
        if (url && url.indexOf('?') !== -1)
            sep = '&';
        return url + sep + qs;
    } else {
        return url;
    }
}

Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest');
Sys.Net._WebMethod = function Sys$Net$_WebMethod(proxy, methodName, fullName, useGet) {
    /// <param name="proxy"></param>
    /// <param name="methodName" type="String"></param>
    /// <param name="fullName" type="String"></param>
    /// <param name="useGet" type="Boolean"></param>
    var e = Function._validateParams(arguments, [
        {name: "proxy"},
        {name: "methodName", type: String},
        {name: "fullName", type: String},
        {name: "useGet", type: Boolean}
    ]);
    if (e) throw e;

    
    this._proxy = proxy;
    this._fullMethodName = fullName;
    this._methodName = methodName
    this._useGet = useGet;
}


    function Sys$Net$_WebMethod$addHeaders(headers) {
        /// <param name="headers"></param>
        var e = Function._validateParams(arguments, [
            {name: "headers"}
        ]);
        if (e) throw e;

                headers['Content-Type'] = 'application/json';
    }

    function Sys$Net$_WebMethod$getUrl(params) {
        /// <param name="params"></param>
        /// <returns type="String"></returns>
        var e = Function._validateParams(arguments, [
            {name: "params"}
        ]);
        if (e) throw e;

                if (!this._useGet || !params)
            params = {};

                return Sys.Net.WebRequest._createUrl(this._proxy._get_path() + "/js/"+this._methodName, params );
    }

    function Sys$Net$_WebMethod$getBody(params) {
        /// <param name="params"></param>
        /// <returns type="String"></returns>
        var e = Function._validateParams(arguments, [
            {name: "params"}
        ]);
        if (e) throw e;


                if (this._useGet) return null;
        
        var body = Sys.Serialization.JavaScriptSerializer.serialize(params);

                if (body === "{}")
            return "";

        return body;
    }


    function Sys$Net$_WebMethod$_execute(params) {
        return this._invokeInternal.apply(this, arguments);
    }

    function Sys$Net$_WebMethod$_invokeInternal(params, onSuccess, onFailure, userContext) {
        /// <param name="params"></param>
        /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
        /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
        /// <param name="userContext" mayBeNull="true" optional="true"></param>
        var e = Function._validateParams(arguments, [
            {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;

        var methodName = this._fullMethodName;

                if (onSuccess === null || typeof onSuccess === 'undefined') onSuccess = this._proxy.get_defaultSucceededCallback();
        if (onFailure === null || typeof onFailure === 'undefined') onFailure = this._proxy.get_defaultFailedCallback();
        if (userContext === null || typeof userContext === 'undefined') userContext = this._proxy.get_defaultUserContext();

                var request = new Sys.Net.WebRequest();

                this.addHeaders(request.get_headers());
        request.set_url(this.getUrl(params));
        if (!params) params = {};

                request.set_body(this.getBody(params));
        request.add_completed(onComplete);
        var timeout = this._proxy.get_timeout();
        if (timeout > 0) request.set_timeout(timeout);
        request.invoke();

        function onComplete(response, eventArgs) {
            if (response.get_responseAvailable()) {
                var statusCode = response.get_statusCode();
                var result = null;

                try {
                    var contentType = response.getResponseHeader("Content-Type");
                    if (contentType.startsWith("application/json")) {
                        result = response.get_object();
                    }
                    else if (contentType.startsWith("text/xml")) {
                        result = response.get_xml();
                    }
                                        else {
                        result = response.get_responseData();
                    }
                } catch (ex) {
                }

                if (((statusCode < 200) || (statusCode >= 300)) || Sys.Net.WebServiceError.isInstanceOfType(result)) {
                    if (onFailure) {
                        if (!result || !Sys.Net.WebServiceError.isInstanceOfType(result)) {
                            result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName), "", "");
                        }
                        result._statusCode = statusCode;
                        onFailure(result, userContext, methodName);
                    }
                    else {
                                                var error;
                        if (result) {
                                                        error = result.get_exceptionType() + "-- " + result.get_message();
                        }
                        else {
                                                                                    error = response.get_responseData();
                        }
                        alert(String.format(Sys.Res.webServiceFailed, methodName, error));
                    }
                }
                else if (onSuccess) {
                    onSuccess(result, userContext, methodName);
                }
            }
            else {
                var msg;
                if (response.get_timedOut()) {
                    msg = String.format(Sys.Res.webServiceTimedOut, methodName);
                }
                else {
                    msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName)
                }
                if (onFailure) {
                    onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName);
                }
                else {
                                        alert(msg);
                }
            }
        }

        return request;
    }
Sys.Net._WebMethod.prototype = {
    addHeaders: Sys$Net$_WebMethod$addHeaders,

    getUrl: Sys$Net$_WebMethod$getUrl,

    getBody: Sys$Net$_WebMethod$getBody,

        _execute: Sys$Net$_WebMethod$_execute,

    _invokeInternal: Sys$Net$_WebMethod$_invokeInternal
}
Sys.Net._WebMethod.registerClass('Sys.Net._WebMethod');

Sys.Net._WebMethod._generateTypedConstructor = function Sys$Net$_WebMethod$_generateTypedConstructor(type) {
    return function(properties) {
        this.__type = type;

                if (properties) {
            for (var name in properties) {
                this[name] = properties[name];
            }
        }
    }
}

Sys.Net._WebMethod._invoke = function Sys$Net$_WebMethod$_invoke(proxy, methodName, fullName, useGet) {
    
    var method = new Sys.Net._WebMethod(proxy, methodName, fullName, useGet);

        var callMethodArgs = new Array();
    for (var i=4; i<arguments.length; i++)
        callMethodArgs[i-4] = arguments[i];

        return method._execute.apply(method, callMethodArgs);
}

Sys.Net._WebMethod._createProxyMethod = function Sys$Net$_WebMethod$_createProxyMethod(proxy, methodName, fullName, useGet) {

        var numOfParams = arguments.length-4;

        var createWebMethodArguments = arguments;

        return function() {

                                var args = {};
        for (var i=0; i<numOfParams; i++) {
            args[createWebMethodArguments[i+4]] = arguments[i];
        }

                        var callMethodArgs = [ this , methodName, fullName, useGet, args ];
        
                for (var i=0; i+numOfParams<arguments.length; i++)
            callMethodArgs[i+5] = arguments[numOfParams+i];
        
                return Sys.Net._WebMethod._invoke.apply(null, callMethodArgs);
    }

}
Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType) {
    /// <param name="timedOut" type="Boolean"></param>
    /// <param name="message" type="String"></param>
    /// <param name="stackTrace" type="String"></param>
    /// <param name="exceptionType" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "timedOut", type: Boolean},
        {name: "message", type: String},
        {name: "stackTrace", type: String},
        {name: "exceptionType", type: String}
    ]);
    if (e) throw e;

    this._timedOut = timedOut;
    this._message = message;
    this._stackTrace = stackTrace;
    this._exceptionType = exceptionType;
    this._statusCode = -1;
}


    function Sys$Net$WebServiceError$get_timedOut() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._timedOut;
    }

    function Sys$Net$WebServiceError$get_statusCode() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._statusCode;
    }

    function Sys$Net$WebServiceError$get_message() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._message;
    }

    function Sys$Net$WebServiceError$get_stackTrace() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._stackTrace;
    }

    function Sys$Net$WebServiceError$get_exceptionType() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._exceptionType;
    }
Sys.Net.WebServiceError.prototype = {
    get_timedOut: Sys$Net$WebServiceError$get_timedOut,

    get_statusCode: Sys$Net$WebServiceError$get_statusCode,

    get_message: Sys$Net$WebServiceError$get_message,

    get_stackTrace: Sys$Net$WebServiceError$get_stackTrace,

    get_exceptionType: Sys$Net$WebServiceError$get_exceptionType
}
Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError');

Type.registerNamespace('Sys.Services');


Sys.Services._ProfileService = function Sys$Services$_ProfileService() {
    Sys.Services._ProfileService.initializeBase(this);
    this.properties = {};
}
Sys.Services._ProfileService.WebServicePath = 'ScriptServices/Microsoft/Web/Profile/ProfileService.asmx';








    function Sys$Services$_ProfileService$get_defaultFailedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultFailedCallback;
    }
    function Sys$Services$_ProfileService$set_defaultFailedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultFailedCallback = value;
    }

    function Sys$Services$_ProfileService$get_defaultLoadCompletedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultLoadCompletedCallback;
    }
    function Sys$Services$_ProfileService$set_defaultLoadCompletedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultLoadCompletedCallback = value;
    }

    function Sys$Services$_ProfileService$get_defaultSaveCompletedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultSaveCompletedCallback;
    }
    function Sys$Services$_ProfileService$set_defaultSaveCompletedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultSaveCompletedCallback = value;
    }


    function Sys$Services$_ProfileService$get_path() {
        /// <value type="String" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._path;
    }
    function Sys$Services$_ProfileService$set_path(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String, mayBeNull: true}]);
        if (e) throw e;

        if((!value) || (!value.length)) {
            value = '';
        }
        this._path = value;
    }

    function Sys$Services$_ProfileService$get_timeout() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._timeout;
    }
    function Sys$Services$_ProfileService$set_timeout(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
        if (e) throw e;

        this._timeout = value;
    }

    function Sys$Services$_ProfileService$_get_path() {
        var path = this.get_path();
        return path.length > 0 ? path : Sys.Services._ProfileService.WebServicePath;
    }

    function Sys$Services$_ProfileService$load(propertyNames, loadCompletedCallback, failedCallback, userContext) {
        /// <param name="propertyNames" type="Array" elementType="String" optional="true" elementMayBeNull="false" mayBeNull="true"></param>
        /// <param name="loadCompletedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="userContext" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "propertyNames", type: Array, mayBeNull: true, optional: true, elementType: String},
            {name: "loadCompletedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "failedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "userContext", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        var parameters = {};
        var methodName;
        var fullMethodName;
        if(!propertyNames) {
            methodName = "GetAllPropertiesForCurrentUser";
            fullMethodName = "Microsoft.Web.Profile.ProfileService.GetAllPropertiesForCurrentUser";
        }
        else {
            methodName = "GetPropertiesForCurrentUser";
            fullMethodName = "Microsoft.Web.Profile.ProfileService.GetPropertiesForCurrentUser";
            parameters = { properties: this._clonePropertyNames(propertyNames) };
        }
                Sys.Net._WebMethod._invoke(this,
                                        methodName,
                                        fullMethodName, false,
                                        parameters,
                                        Function.createDelegate(this, this._onLoadComplete),
                                        Function.createDelegate(this, this._onLoadFailed),                                         [loadCompletedCallback, failedCallback, userContext]);
    }

    function Sys$Services$_ProfileService$save(propertyNames, saveCompletedCallback, failedCallback, userContext) {
        /// <param name="propertyNames" type="Array" elementType="String" optional="true" elementMayBeNull="false" mayBeNull="true"></param>
        /// <param name="saveCompletedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="userContext" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "propertyNames", type: Array, mayBeNull: true, optional: true, elementType: String},
            {name: "saveCompletedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "failedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "userContext", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

        var flattenedProperties = this._flattenProperties(propertyNames, this.properties);
                Sys.Net._WebMethod._invoke(this,
                                        "SetPropertiesForCurrentUser",
                                        "Microsoft.Web.Profile.ProfileService.SetPropertiesForCurrentUser", false,
                                        { values: flattenedProperties },
                                        Function.createDelegate(this, this._onSaveComplete),
                                        Function.createDelegate(this, this._onSaveFailed),
                                        [saveCompletedCallback, failedCallback, userContext]);
    }


    function Sys$Services$_ProfileService$_clonePropertyNames(arr) {
        var nodups = [];
        var seen = {};
        for(var i=0; i < arr.length; i++) {
            var prop = arr[i];
            if(!seen[prop]) { nodups.add(prop); seen[prop]=true; };
        }
        return nodups;
    }





    function Sys$Services$_ProfileService$_flattenProperties(propertyNames, properties, groupName) {
        var flattenedProperties = {};
        var val;
        var key;
        if(propertyNames && propertyNames.length == 0) {
            return flattenedProperties;
        }
        
        for (var property in properties) {
            val = properties[property];
            key = groupName ? groupName + "." + property : property;
                        if(Sys.Services.ProfileGroup.isInstanceOfType(val)) {
                var groupProperties = this._flattenProperties(propertyNames, val, key);
                                                                                                                for(var subKey in groupProperties) {
                    var subVal = groupProperties[subKey];
                    flattenedProperties[subKey] = subVal;
                }
            }
            else {
                                if(!propertyNames || propertyNames.indexOf(key) != -1) {
                    flattenedProperties[key] = val;
                }
            }
        }
        return flattenedProperties;
    }

    function Sys$Services$_ProfileService$_onLoadComplete(result, context, methodName) {
        var unflattened = this._unflattenProperties(result);
        for(var name in unflattened) {
            this.properties[name] = unflattened[name];
        }
        
        var userCallback = context[0];
        var callback = userCallback ? userCallback : this._defaultLoadCompletedCallback;
        if(callback) {
            callback(result.length, context[2], "Sys.Services.ProfileService.load");
        }
    }

    function Sys$Services$_ProfileService$_onLoadFailed(err, context, methodName) {
        var userCallback = context[1];
        var callback = userCallback ? userCallback : this._defaultFailedCallback;
        if(callback) {
            callback(err, context[2], "Sys.Services.ProfileService.load");
        }
    }

    function Sys$Services$_ProfileService$_onSaveComplete(result, context, methodName) {
        var userCallback = context[0];
        var userContext = context[2];
        var callback = userCallback ? userCallback : this._defaultSaveCompletedCallback;
        if(callback) {
            callback(result, userContext, "Sys.Services.ProfileService.save");
        }
    }

    function Sys$Services$_ProfileService$_onSaveFailed(err, context, methodName) {
        var userCallback = context[1];
        var userContext = context[2];
        var callback = userCallback ? userCallback : this._defaultFailedCallback;
        if(callback) {
            callback(err, userContext, "Sys.Services.ProfileService.save");
        }
    }

    function Sys$Services$_ProfileService$_unflattenProperties(properties) {
        var unflattenedProperties = {};
        var dotIndex;
        var val;
        var count = 0;
        for(var key in properties) {
            count++;
            val = properties[key];
            
            dotIndex = key.indexOf('.');
            if(dotIndex !== -1) {
                var groupName = key.substr(0, dotIndex);
                key = key.substr(dotIndex+1);
                var group = unflattenedProperties[groupName];
                if((!group) || (!Sys.Services.ProfileGroup.isInstanceOfType(group))) {
                    group = new Sys.Services.ProfileGroup();
                    unflattenedProperties[groupName] = group;
                }
                group[key] = val;
            }
            else {
                unflattenedProperties[key] = val;
            }
        }
        properties.length = count;
        return unflattenedProperties;
    }
Sys.Services._ProfileService.prototype = {
    _defaultFailedCallback: null,
    _defaultLoadCompletedCallback: null,
    _defaultSaveCompletedCallback: null,
    _path: '',
    _timeout: 0,

    get_defaultFailedCallback: Sys$Services$_ProfileService$get_defaultFailedCallback,
    set_defaultFailedCallback: Sys$Services$_ProfileService$set_defaultFailedCallback,

    get_defaultLoadCompletedCallback: Sys$Services$_ProfileService$get_defaultLoadCompletedCallback,
    set_defaultLoadCompletedCallback: Sys$Services$_ProfileService$set_defaultLoadCompletedCallback,

    get_defaultSaveCompletedCallback: Sys$Services$_ProfileService$get_defaultSaveCompletedCallback,
    set_defaultSaveCompletedCallback: Sys$Services$_ProfileService$set_defaultSaveCompletedCallback,
    
    
    get_path: Sys$Services$_ProfileService$get_path,
    set_path: Sys$Services$_ProfileService$set_path,
        
    get_timeout: Sys$Services$_ProfileService$get_timeout,
    set_timeout: Sys$Services$_ProfileService$set_timeout,
    
    _get_path: Sys$Services$_ProfileService$_get_path,
    
    load: Sys$Services$_ProfileService$load,
    
    save: Sys$Services$_ProfileService$save,
    
        _clonePropertyNames: Sys$Services$_ProfileService$_clonePropertyNames,    

                    _flattenProperties: Sys$Services$_ProfileService$_flattenProperties,

    _onLoadComplete: Sys$Services$_ProfileService$_onLoadComplete,
    
    _onLoadFailed: Sys$Services$_ProfileService$_onLoadFailed,
    
    _onSaveComplete: Sys$Services$_ProfileService$_onSaveComplete,
    
    _onSaveFailed: Sys$Services$_ProfileService$_onSaveFailed,
    
    _unflattenProperties: Sys$Services$_ProfileService$_unflattenProperties
}
Sys.Services._ProfileService.registerClass('Sys.Services._ProfileService');
Sys.Services.ProfileService = new Sys.Services._ProfileService();

Sys.Services.ProfileGroup = function Sys$Services$ProfileGroup(properties) {
    /// <param name="properties" optional="true" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "properties", mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    if(properties) {
        for(var property in properties) {
            this[property] = properties[property];
        }
    }
}
Sys.Services.ProfileGroup.registerClass('Sys.Services.ProfileGroup');
Sys.Services._AuthenticationService = function Sys$Services$_AuthenticationService() {
    if (arguments.length !== 0) throw Error.parameterCount();
    Sys.Services._AuthenticationService.initializeBase(this);
}
Sys.Services._AuthenticationService.WebServicePath = 'ScriptServices/Microsoft/Web/Security/AuthenticationService.asmx';








    function Sys$Services$_AuthenticationService$get_defaultFailedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultFailedCallback;
    }
    function Sys$Services$_AuthenticationService$set_defaultFailedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultFailedCallback = value;
    }

    function Sys$Services$_AuthenticationService$get_defaultLoginCompletedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultLoginCompletedCallback;
    }
    function Sys$Services$_AuthenticationService$set_defaultLoginCompletedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultLoginCompletedCallback = value;
    }

    function Sys$Services$_AuthenticationService$get_defaultLogoutCompletedCallback() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._defaultLogoutCompletedCallback;
    }
    function Sys$Services$_AuthenticationService$set_defaultLogoutCompletedCallback(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
        if (e) throw e;

        this._defaultLogoutCompletedCallback = value;
    }

    function Sys$Services$_AuthenticationService$get_isLoggedIn() {
        /// <value type="Function" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._authenticated;
    }

    function Sys$Services$_AuthenticationService$get_path() {
        /// <value type="String" mayBeNull="true"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._path;
    }
    function Sys$Services$_AuthenticationService$set_path(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String, mayBeNull: true}]);
        if (e) throw e;

        if((!value) || (!value.length)) {
            value = '';
        }
        this._path = value;
    }

    function Sys$Services$_AuthenticationService$get_timeout() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._timeout;
    }
    function Sys$Services$_AuthenticationService$set_timeout(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
        if (e) throw e;

        this._timeout = value;
    }

    function Sys$Services$_AuthenticationService$_set_authenticated(authenticated) {
        this._authenticated = authenticated;
    }

    function Sys$Services$_AuthenticationService$_get_path() {
        var path = this.get_path();
        return path.length > 0 ? path : Sys.Services._AuthenticationService.WebServicePath;
    }

    function Sys$Services$_AuthenticationService$login(username, password, isPersistent, customInfo, redirectUrl, loginCompletedCallback, failedCallback, userContext) {
        /// <param name="username" type="String" mayBeNull="false"></param>
        /// <param name="password" type="String" mayBeNull="true"></param>
        /// <param name="isPersistent" type="Boolean" optional="true" mayBeNull="true"></param>
        /// <param name="customInfo" type="String" optional="true" mayBeNull="true"></param>
        /// <param name="redirectUrl" type="String" optional="true" mayBeNull="true"></param>
        /// <param name="loginCompletedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="userContext" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "username", type: String},
            {name: "password", type: String, mayBeNull: true},
            {name: "isPersistent", type: Boolean, mayBeNull: true, optional: true},
            {name: "customInfo", type: String, mayBeNull: true, optional: true},
            {name: "redirectUrl", type: String, mayBeNull: true, optional: true},
            {name: "loginCompletedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "failedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "userContext", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

                Sys.Net._WebMethod._invoke(this, "Login", "Microsoft.Web.Security.AuthenticationService.Login", false,
                                        { userName: username, password: password, createPersistentCookie: isPersistent },
                                        Function.createDelegate(this, this._onLoginComplete),
                                        Function.createDelegate(this, this._onLoginFailed),
                                        [username, password, isPersistent, redirectUrl, loginCompletedCallback, failedCallback, userContext]);
    }

    function Sys$Services$_AuthenticationService$logout(redirectUrl, logoutCompletedCallback, failedCallback, userContext) {
        /// <param name="redirectUrl" type="String" optional="true" mayBeNull="true"></param>
        /// <param name="loginCompletedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
        /// <param name="userContext" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "redirectUrl", type: String, mayBeNull: true, optional: true},
            {name: "loginCompletedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "failedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "userContext", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;

                Sys.Net._WebMethod._invoke(this, "Logout", "Microsoft.Web.Security.AuthenticationService.Logout", false, {}, 
                                        Function.createDelegate(this, this._onLogoutComplete),
                                        Function.createDelegate(this, this._onLogoutFailed),
                                        [redirectUrl, logoutCompletedCallback, failedCallback, userContext]);
    }

    function Sys$Services$_AuthenticationService$_onLoginComplete(result, context, methodName) {
        var redirectUrl = context[3];
        var userCallback = context[4];
        var userContext = context[6];
        var callback = userCallback ? userCallback : this._defaultLoginCompletedCallback;
        
        if(result) {
            this._authenticated = true;
                                                
            if(redirectUrl && redirectUrl.length > 0) {
                window.location = redirectUrl;
            }
            else if(callback) {
                callback(true, userContext, "Sys.Services.AuthenticationService.login");
            }
        }
        else if (callback) {
            callback(false, userContext, "Sys.Services.AuthenticationService.login");
        }
    }

    function Sys$Services$_AuthenticationService$_onLoginFailed(err, context, methodName) {
        var userCallback = context[5];
        var callback = userCallback ? userCallback : this._defaultFailedCallback;
        if(callback) {
            callback(err, context[6], "Sys.Services.AuthenticationService.login");
        }
    }

    function Sys$Services$_AuthenticationService$_onLogoutComplete(result, context, methodName) {
        var redirectUrl = context[0];
        var userCallback = context[1];
        var userContext = context[3];
        var callback = userCallback ? userCallback : this._defaultLogoutCompletedCallback;

        this._authenticated = false;
        
        if(redirectUrl && redirectUrl.length > 0) {
            window.location = redirectUrl;
        }
        else if (callback) {
            callback(null, userContext, "Sys.Services.AuthenticationService.logout");
        }
    }

    function Sys$Services$_AuthenticationService$_onLogoutFailed(err, context, methodName) {
        var userCallback = context[2];
        var callback = userCallback ? userCallback : this._defaultFailedCallback;
        if(callback) {
            callback(err, context[3], "Sys.Services.AuthenticationService.logout");
        }
    }
Sys.Services._AuthenticationService.prototype = {
    _defaultFailedCallback: null,
    _defaultLoginCompletedCallback: null,
    _defaultLogoutCompletedCallback: null,
    _path: '',
    _timeout: 0,
    _authenticated: false,
    
    get_defaultFailedCallback: Sys$Services$_AuthenticationService$get_defaultFailedCallback,
    set_defaultFailedCallback: Sys$Services$_AuthenticationService$set_defaultFailedCallback,

    get_defaultLoginCompletedCallback: Sys$Services$_AuthenticationService$get_defaultLoginCompletedCallback,
    set_defaultLoginCompletedCallback: Sys$Services$_AuthenticationService$set_defaultLoginCompletedCallback,

    get_defaultLogoutCompletedCallback: Sys$Services$_AuthenticationService$get_defaultLogoutCompletedCallback,
    set_defaultLogoutCompletedCallback: Sys$Services$_AuthenticationService$set_defaultLogoutCompletedCallback,

    get_isLoggedIn: Sys$Services$_AuthenticationService$get_isLoggedIn,

    get_path: Sys$Services$_AuthenticationService$get_path,
    set_path: Sys$Services$_AuthenticationService$set_path,
    
    get_timeout: Sys$Services$_AuthenticationService$get_timeout,
    set_timeout: Sys$Services$_AuthenticationService$set_timeout,    
    
    _set_authenticated: Sys$Services$_AuthenticationService$_set_authenticated,

    _get_path: Sys$Services$_AuthenticationService$_get_path,
    
    login: Sys$Services$_AuthenticationService$login,
    
    logout: Sys$Services$_AuthenticationService$logout,
    
    _onLoginComplete: Sys$Services$_AuthenticationService$_onLoginComplete,
    
    _onLoginFailed: Sys$Services$_AuthenticationService$_onLoginFailed,
    
    _onLogoutComplete: Sys$Services$_AuthenticationService$_onLogoutComplete,
    
    _onLogoutFailed: Sys$Services$_AuthenticationService$_onLogoutFailed
}

Sys.Services._AuthenticationService.registerClass('Sys.Services._AuthenticationService');
Sys.Services.AuthenticationService = new Sys.Services._AuthenticationService();

Type.registerNamespace('Sys.Serialization');


Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() {
    if (arguments.length !== 0) throw Error.parameterCount();
}
Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer');

Sys.Serialization.JavaScriptSerializer._stringRegEx = new RegExp('["\b\f\n\r\t\\\\\x00-\x1F]', 'i');

Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort) {
    var i;
    switch (typeof object) {
    case 'object':
        if (object) {
                        if (Array.isInstanceOfType(object)) {
                stringBuilder.append('[');
                for (i = 0; i < object.length; ++i) {
                    if (i > 0) {
                        stringBuilder.append(',');
                    }
                    stringBuilder.append(Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder));
                }
                stringBuilder.append(']');
            }
            else {
                                if (Date.isInstanceOfType(object)) {
                    stringBuilder.append('"@');
                    stringBuilder.append(''+object.getTime());
                    stringBuilder.append('@"');
                    break;
                }

                var properties = [];
                var propertyCount = 0;
                for (var name in object) {
                                        if (name.startsWith('$')) {
                        continue;
                    }
                    properties[propertyCount++] = name;
                }
                if (sort) properties.sort();

                stringBuilder.append('{');
                var needComma = false;
                for (i=0; i<propertyCount; i++) {
                    var value = object[properties[i]];
                    if (typeof value !== 'undefined' && typeof value !== 'function') {
                        if (needComma) {
                            stringBuilder.append(',');
                        }
                        else {
                            needComma = true;
                        }

                                                stringBuilder.append(Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(properties[i], stringBuilder, sort));
                        stringBuilder.append(':');
                        stringBuilder.append(Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(value, stringBuilder, sort));
                    }
                }
                stringBuilder.append('}');
            }
        }
        else {
            stringBuilder.append('null');
        }
        break;

    case 'number':
        if (isFinite(object)) {
            stringBuilder.append(String(object));
        }
        else {
            throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
        }
        break;

    case 'string':
        stringBuilder.append('"');

        if (Sys.Serialization.JavaScriptSerializer._stringRegEx.test(object)) {
            var length = object.length;
            for (i = 0; i < length; ++i) {
                var curChar = object.charAt(i);
                                if (curChar >= ' ') {
                                        if (curChar === '\\' || curChar === '"') {
                        stringBuilder.append('\\');
                    }
                    stringBuilder.append(curChar);
                }
                else {
                    switch (curChar) {
                        case '\b':
                            stringBuilder.append('\\b');
                            break;
                        case '\f':
                            stringBuilder.append('\\f');
                            break;
                        case '\n':
                            stringBuilder.append('\\n');
                            break;
                        case '\r':
                            stringBuilder.append('\\r');
                            break;
                        case '\t':
                            stringBuilder.append('\\t');
                            break;
                        default:
                                                        stringBuilder.append('\\u00');
                            if (curChar.charCodeAt() < 16) stringBuilder.append('0');
                            stringBuilder.append(curChar.charCodeAt().toString(16));
                    }
                }
            }
        } else {
            stringBuilder.append(object);
        }
        stringBuilder.append('"');
        break;

    case 'boolean':
        stringBuilder.append(object.toString());
        break;

    default:
        stringBuilder.append('null');
        break;
    }
}

Sys.Serialization.JavaScriptSerializer.serialize = function Sys$Serialization$JavaScriptSerializer$serialize(object) {
    /// <param name="object" mayBeNull="true"></param>
    /// <returns type="String"></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();
}

Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data) {
    /// <param name="data" type="String"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "data", type: String}
    ]);
    if (e) throw e;

    if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString);
    var exp = data.replace(new RegExp('\\"@(-?[0-9]+)@\\"', 'g'), "new Date($1)");
    exp = exp.replace(new RegExp('\\"@_Error(.*)Error_@\\"', 'g'), "new Sys.Net.WebServiceError$1");
    return eval('(' + exp + ')');
}

Sys.UI.DomElement = function Sys$UI$DomElement() {
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}
Sys.UI.DomElement.registerClass('Sys.UI.DomElement');

Sys.UI.DomElement.isInstanceOfType = function Sys$UI$DomElement$isInstanceOfType(instance) {
                    return  !!((instance === window) ||
        (instance === document) ||
        (window.HTMLElement && (instance instanceof HTMLElement)) ||
        (typeof(instance.nodeName) === 'string'));
}

Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="className" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "className", type: String}
    ]);
    if (e) throw e;

    if (!Sys.UI.DomElement.containsCssClass(element, className)) {
        element.className += ' ' + className;
    }
}

Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="className" type="String"></param>
    /// <returns type="Boolean"></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "className", type: String}
    ]);
    if (e) throw e;

    return element.className.split(' ').contains(className);
}

Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement}
    ]);
    if (e) throw e;

    var offset = Sys.UI.DomElement.getLocation(element);

    return { x: offset.x, y: offset.y, width: element.offsetWidth, height: element.offsetHeight };
}

var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
    /// <param name="id" type="String"></param>
    /// <param name="element" type="Sys.UI.DomElement" optional="true" mayBeNull="true"></param>
    /// <returns type="Sys.UI.DomElement" mayBeNull="true"></returns>
    var e = Function._validateParams(arguments, [
        {name: "id", type: String},
        {name: "element", type: Sys.UI.DomElement, mayBeNull: true, optional: true}
    ]);
    if (e) throw e;

    if (!element) return document.getElementById(id);
    if (element.getElementById) return element.getElementById(id);

        var nodeQueue = [];
    var childNodes = element.childNodes;
    for (var i = 0; i < childNodes.length; i++) {
        var node = childNodes[i];
        if (node.nodeType == 1) {
            nodeQueue[nodeQueue.length] = node;
        }
    }

    while (nodeQueue.length) {
        node = nodeQueue.shift();
        if (node.id == id) {
            return node;
        }
        childNodes = node.childNodes;
        for (i = 0; i < childNodes.length; i++) {
            node = childNodes[i];
            if (node.nodeType == 1) {
                nodeQueue[nodeQueue.length] = node;
            }
        }
    }

    return null;
}

Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <returns></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement}
    ]);
    if (e) throw e;

    var offsetX = 0;
    var offsetY = 0;
    var parent;

    for (parent = element; parent; parent = parent.offsetParent) {
        if (parent.offsetLeft) {
            offsetX += parent.offsetLeft;
        }
        if (parent.offsetTop) {
            offsetY += parent.offsetTop;
        }
    }

    return { x: offsetX, y: offsetY };
}

Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="className" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {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();
    }
}

Sys.UI.DomElement.setAccessibilityAttribute = function Sys$UI$DomElement$setAccessibilityAttribute(element, name, value) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="name" type="String"></param>
    /// <param name="value" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "name", type: String},
        {name: "value", type: String}
    ]);
    if (e) throw e;

    if (element.setAttributeNS) {
        element.setAttributeNS("http://www.w3.org/2005/07/aaa", name, value);
    }
}

Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="x" type="Number" integer="true"></param>
    /// <param name="y" type="Number" integer="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {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";
}

Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="className" type="String"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {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);
    }
}
Sys.UI.Behavior = function Sys$UI$Behavior(element) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement}
    ]);
    if (e) throw e;

    Sys.UI.Behavior.initializeBase(this);

    this._element = element;

    var behaviors = element._behaviors;
    if (!behaviors) {
        element._behaviors = [this];
    }
    else {
        behaviors[behaviors.length] = this;
    }
}


    function Sys$UI$Behavior$get_element() {
        /// <value type="Sys.UI.DomElement"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._element;
    }
    function Sys$UI$Behavior$get_id() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
        if (baseId) return baseId;
        if (!this._element || !this._element.id) return '';
        return this._element.id + '$' + this.get_name();
    }
    function Sys$UI$Behavior$get_name() {
        /// <value type="String"></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 != -1) name = name.substr(i + 1);
        if (!this.get_isInitialized()) this._name = name;
        return name;
    }
    function Sys$UI$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.cantSetIdAfterInit);
        this._name = value;
    }
    function Sys$UI$Behavior$initialize() {
        Sys.UI.Behavior.callBaseMethod(this, 'initialize');
        var name = this.get_name();
        if (name) this._element[name] = this;
    }
    function Sys$UI$Behavior$dispose() {
        Sys.UI.Behavior.callBaseMethod(this, 'dispose');
        if (this._element) {
            var name = this.get_name();
            if (name) {
                this._element[name] = null;
            }
            this._element._behaviors.remove(this);
            delete this._element;
        }
    }
Sys.UI.Behavior.prototype = {
    _name: null,
    get_element: Sys$UI$Behavior$get_element,
    get_id: Sys$UI$Behavior$get_id,
    get_name: Sys$UI$Behavior$get_name,
    set_name: Sys$UI$Behavior$set_name,
    initialize: Sys$UI$Behavior$initialize,
    dispose: Sys$UI$Behavior$dispose
}
Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component);

Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="name" type="String"></param>
    /// <returns type="Sys.UI.Behavior" mayBeNull="true"></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {name: "name", type: String}
    ]);
    if (e) throw e;

    var b = element[name];
    return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
}

Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement}
    ]);
    if (e) throw e;

    if (!element._behaviors) return [];
    return element._behaviors.clone();
}

Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    /// <param name="type" type="Type"></param>
    /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement},
        {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++) {
            if (type.isInstanceOfType(behaviors[i])) {
                results[results.length] = behaviors[i];
            }
        }
    }
    return results;
}
Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() {
    /// <field name="hide" type="Number" integer="true" static="true"></field>
    /// <field name="collapse" type="Number" integer="true" static="true"></field>
    if (arguments.length !== 0) throw Error.parameterCount();
    throw Error.notImplemented();
}



Sys.UI.VisibilityMode.prototype = {
    hide: 0,
    collapse: 1
}
Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");

Sys.UI.Control = function Sys$UI$Control(element) {
    /// <param name="element" type="Sys.UI.DomElement"></param>
    var e = Function._validateParams(arguments, [
        {name: "element", type: Sys.UI.DomElement}
    ]);
    if (e) throw e;

    if (typeof(element.control) != 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
    Sys.UI.Control.initializeBase(this);

    this._element = element;
    element.control = this;

    this._oldDisplayMode = this._element.style.display;
    if (!this._oldDisplayMode || (this._oldDisplayMode == 'none')) {
        this._oldDisplayMode = '';
    }
}




    function Sys$UI$Control$get_element() {
        /// <value type="Sys.UI.DomElement"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._element;
    }
    function Sys$UI$Control$get_id() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        if (!this._element) return '';
        return this._element.id;
    }
    function Sys$UI$Control$set_id(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String}]);
        if (e) throw e;

        throw Error.invalidOperation(Sys.Res.cantSetId);
    }
    function Sys$UI$Control$get_parent() {
        /// <value type="Sys.UI.Control"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this._parent) {
            return this._parent;
        }
        else {
            var parentElement = this._element.parentNode;
            while (parentElement) {
                if (parentElement.control) {
                    return parentElement.control;
                }
                parentElement = parentElement.parentNode;
            }
            return null;
        }
    }
    function Sys$UI$Control$set_parent(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]);
        if (e) throw e;

        var parents = [this];
        var current = value;
        while (current) {
            if (parents.contains(current)) throw Error.invalidOperation(Sys.Res.circularParentChain);
            parents[parents.length] = current;
            current = current.get_parent();
        }
        this._parent = value;
    }
    function Sys$UI$Control$get_role() {
        /// <value type="String"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return "";
    }
    function Sys$UI$Control$get_visibilityMode() {
        /// <value type="Sys.UI.VisibilityMode"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._visibilityMode;
    }
    function Sys$UI$Control$set_visibilityMode(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]);
        if (e) throw e;

        if (this._visibilityMode !== value) {
            this._visibilityMode = value;
            if (this.get_visible() === false) {
                if (this._visibilityMode === Sys.UI.VisibilityMode.hide) {
                    this._element.style.display = this._oldDisplayMode;
                }
                else {
                    this._element.style.display = 'none';
                }
            }
        }
        this._visibilityMode = value;
    }
    function Sys$UI$Control$get_visible() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return (this._element.style.visibility != 'hidden');
    }
    function Sys$UI$Control$set_visible(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
        if (e) throw e;

        if (value != this.get_visible()) {
            this._element.style.visibility = value ? 'visible' : 'hidden';
            if (value || (this._visibilityMode === Sys.UI.VisibilityMode.hide)) {
                this._element.style.display = this._oldDisplayMode;
            }
            else {
                this._element.style.display = 'none';
            }
        }
    }
    function Sys$UI$Control$dispose() {
        Sys.UI.Control.callBaseMethod(this, 'dispose');
        if (this._element) {
            this._element.control = null;
            delete this._element;
        }
    }
    function Sys$UI$Control$initialize() {
        Sys.UI.Control.callBaseMethod(this, 'initialize');
        var elt = this._element;
        if (elt.setAttributeNS) {
            elt.setAttributeNS("http://www.w3.org/TR/xhtml2", "role", this.get_role());
        }
    }
    function Sys$UI$Control$onBubbleEvent(source, args) {
        /// <param name="source"></param>
        /// <param name="args" type="Sys.EventArgs"></param>
        /// <returns type="Boolean"></returns>
        var e = Function._validateParams(arguments, [
            {name: "source"},
            {name: "args", type: Sys.EventArgs}
        ]);
        if (e) throw e;

        return false;
    }
    function Sys$UI$Control$raiseBubbleEvent(source, args) {
        /// <param name="source"></param>
        /// <param name="args" type="Sys.EventArgs"></param>
        var e = Function._validateParams(arguments, [
            {name: "source"},
            {name: "args", type: Sys.EventArgs}
        ]);
        if (e) throw e;

        var currentTarget = this.get_parent();
        while (currentTarget) {
            if (currentTarget.onBubbleEvent(source, args)) {
                return;
            }
            currentTarget = currentTarget.get_parent();
        }
    }
Sys.UI.Control.prototype = {
    _parent: null,
    _visibilityMode: Sys.UI.VisibilityMode.hide,

    get_element: Sys$UI$Control$get_element,
    get_id: Sys$UI$Control$get_id,
    set_id: Sys$UI$Control$set_id,
    get_parent: Sys$UI$Control$get_parent,
    set_parent: Sys$UI$Control$set_parent,
    get_role: Sys$UI$Control$get_role,
    get_visibilityMode: Sys$UI$Control$get_visibilityMode,
    set_visibilityMode: Sys$UI$Control$set_visibilityMode,
    get_visible: Sys$UI$Control$get_visible,
    set_visible: Sys$UI$Control$set_visible,
    dispose: Sys$UI$Control$dispose,
    initialize: Sys$UI$Control$initialize,
    onBubbleEvent: Sys$UI$Control$onBubbleEvent,
    raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent
}
Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component);

///////////////////////////////////////////////////////////////////////////////

Sys.UI._Timer = function Sys$UI$_Timer(element) {
    Sys.UI._Timer.initializeBase(this,[element]);
    this._interval = 60000;
    this._enabled = true;
    this._postbackPending = false;
    this._raiseTickDelegate = null;
    this._endRequestHandlerDelegate = null;
    this._timer = null;
    this._pageRequestManager = null;
}

    function Sys$UI$_Timer$get_enabled() {
        /// <value type="Boolean"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._enabled;
    }
    function Sys$UI$_Timer$set_enabled(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
        if (e) throw e;

        this._enabled = value;
    }
    function Sys$UI$_Timer$get_interval() {
        /// <value type="Number"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._interval;
    }
    function Sys$UI$_Timer$set_interval(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
        if (e) throw e;

        this._interval = value;
    }
    function Sys$UI$_Timer$dispose(){
       this._stopTimer();
       if(this._pageRequestManager !== null){
           this._pageRequestManager.remove_endRequest(this._endRequestHandlerDelegate);
       }
       Sys.UI._Timer.callBaseMethod(this,"dispose");
    }
    function Sys$UI$_Timer$_doPostback(){
        __doPostBack(this.get_id(),'');
    }
    function Sys$UI$_Timer$_handleEndRequest(sender, arg){
        var dataItem = arg.get_dataItems()[this.get_id()];
	    if (dataItem){
            this._update(dataItem[0],dataItem[1]);
	  	}
	  
         	    if ((this._postbackPending === true) && (this._pageRequestManager !== null)&&(!pageRequestManager.get_isInAsyncPostBack())){
    	   	this._postbackPending = false;
            this._doPostback();
        }
	   
    }
    function Sys$UI$_Timer$initialize(){
        Sys.UI._Timer.callBaseMethod(this, 'initialize');
    	this._raiseTickDelegate = Function.createDelegate(this,this._raiseTick);
    	this._endRequestHandlerDelegate = Function.createDelegate(this,this._handleEndRequest);
    	if (Sys.WebForms && Sys.WebForms.PageRequestManager){
           this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();  
    	}
    	if (this._pageRequestManager !== null ){
    	    this._pageRequestManager.add_endRequest(this._endRequestHandlerDelegate);
    	}
        if(this.get_enabled()) {
            this._startTimer();
        }
    }
    function Sys$UI$_Timer$_raiseTick() {
	    if ((this._pageRequestManager === null) || (!this._pageRequestManager.get_isInAsyncPostBack())){
            this._doPostback();
        } 
        else {
            this._postBackPending = true;
        }
    }
    function Sys$UI$_Timer$_startTimer(){
        this._timer = window.setInterval(Function.createDelegate(this,this._raiseTick),this.get_interval());
    }
    function Sys$UI$_Timer$_stopTimer(){
	    if (this._timer !== null){
	 	    window.clearInterval(this._timer);
		    this._timer = null;
       } 	
    }
    function Sys$UI$_Timer$_update(enabled,interval) {
        var stopped = !this.get_enabled();
        var intervalChanged= (this.get_interval() !== interval);
	    if ((!stopped) && ((!enabled)||(intervalChanged))){
    	  	this._stopTimer();
    		stopped = true;
       	} 
    	this.set_enabled(enabled);
    	this.set_interval(interval);
    	if ((this.get_enabled()) && (stopped)){
    	    this._startTimer();
    	}
    }
Sys.UI._Timer.prototype = {
    get_enabled: Sys$UI$_Timer$get_enabled,
    set_enabled: Sys$UI$_Timer$set_enabled,
    get_interval: Sys$UI$_Timer$get_interval,
    set_interval: Sys$UI$_Timer$set_interval,
    dispose: Sys$UI$_Timer$dispose,
    _doPostback: Sys$UI$_Timer$_doPostback,
    _handleEndRequest: Sys$UI$_Timer$_handleEndRequest,
    initialize: Sys$UI$_Timer$initialize,
    _raiseTick: Sys$UI$_Timer$_raiseTick,
    _startTimer: Sys$UI$_Timer$_startTimer,
    _stopTimer: Sys$UI$_Timer$_stopTimer,
    _update: Sys$UI$_Timer$_update
}
Sys.UI._Timer.registerClass('Sys.UI._Timer', Sys.UI.Control);

