﻿function WebForm_FindFirstFocusableChild(control) {
    if (!control || !(control.tagName)) {
        return null;
    }
    var tagName = control.tagName.toLowerCase();
    if (tagName == "undefined") {
        return null;
    }
    var children = control.childNodes;
    if (children) {
        for (var i = 0; i < children.length; i++) {
            try {
                if (WebForm_CanFocus(children[i])) {
                    return children[i];
                }
                else {
                    var focused = WebForm_FindFirstFocusableChild(children[i]);
                    if (WebForm_CanFocus(focused)) {
                        return focused;
                    }
                }
            } catch (e) {
            }
        }
    }
    return null;
}
function WebForm_AutoFocus(focusId) {
    var targetControl;
    if (__nonMSDOMBrowser) {
        targetControl = document.getElementById(focusId);
    }
    else {
        targetControl = document.all[focusId];
    }
    var focused = targetControl;
    if (targetControl && (!WebForm_CanFocus(targetControl)) ) {
        focused = WebForm_FindFirstFocusableChild(targetControl);
    }
    if (focused) {
        try {
            focused.focus();
            if (__nonMSDOMBrowser) {
                focused.scrollIntoView(false);
            }
            if (window.__smartNav) {
                window.__smartNav.ae = focused.id;
            }
        }
        catch (e) {
        }
    }
}
function WebForm_CanFocus(element) {
    if (!element || !(element.tagName)) return false;
    var tagName = element.tagName.toLowerCase();
    return (!(element.disabled) &&
            (!(element.type) || element.type.toLowerCase() != "hidden") &&
            WebForm_IsFocusableTag(tagName) &&
            WebForm_IsInVisibleContainer(element)
            );
}
function WebForm_IsFocusableTag(tagName) {
    return (tagName == "input" ||
            tagName == "textarea" ||
            tagName == "select" ||
            tagName == "button" ||
            tagName == "a");
}
function WebForm_IsInVisibleContainer(ctrl) {
    var current = ctrl;
    while((typeof(current) != "undefined") && (current != null)) {
        if (current.disabled ||
            ( typeof(current.style) != "undefined" &&
            ( ( typeof(current.style.display) != "undefined" &&
                current.style.display == "none") ||
                ( typeof(current.style.visibility) != "undefined" &&
                current.style.visibility == "hidden") ) ) ) {
            return false;
        }
        if (typeof(current.parentNode) != "undefined" &&
                current.parentNode != null &&
                current.parentNode != current &&
                current.parentNode.tagName.toLowerCase() != "body") {
            current = current.parentNode;
        }
        else {
            return true;
        }
    }
    return true;
}

function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit) {
    this.eventTarget = eventTarget;
    this.eventArgument = eventArgument;
    this.validation = validation;
    this.validationGroup = validationGroup;
    this.actionUrl = actionUrl;
    this.trackFocus = trackFocus;
    this.clientSubmit = clientSubmit;
}
function WebForm_DoPostBackWithOptions(options) {
    var validationResult = true;
    if (options.validation) {
        if (typeof(Page_ClientValidate) == 'function') {
            validationResult = Page_ClientValidate(options.validationGroup);
        }
    }
    if (validationResult) {
        if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0)) {
            theForm.action = options.actionUrl;
        }
        if (options.trackFocus) {
            var lastFocus = theForm.elements["__LASTFOCUS"];
            if ((typeof(lastFocus) != "undefined") && (lastFocus != null)) {
                if (typeof(document.activeElement) == "undefined") {
                    lastFocus.value = options.eventTarget;
                }
                else {
                    var active = document.activeElement;
                    if ((typeof(active) != "undefined") && (active != null)) {
                        if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0)) {
                            lastFocus.value = active.id;
                        }
                        else if (typeof(active.name) != "undefined") {
                            lastFocus.value = active.name;
                        }
                    }
                }
            }
        }
    }
    if (options.clientSubmit) {
        __doPostBack(options.eventTarget, options.eventArgument);
    }
}
var __pendingCallbacks = new Array();
var __synchronousCallBackIndex = -1;
function WebForm_DoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
    var postData = __theFormPostData +
                "__CALLBACKID=" + WebForm_EncodeCallback(eventTarget) +
                "&__CALLBACKPARAM=" + WebForm_EncodeCallback(eventArgument);
    if (theForm["__EVENTVALIDATION"]) {
        postData += "&__EVENTVALIDATION=" + WebForm_EncodeCallback(theForm["__EVENTVALIDATION"].value);
    }
    var xmlRequest,e;
    try {
        xmlRequest = new XMLHttpRequest();
    }
    catch(e) {
        try {
            xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e) {
        }
    }
    var setRequestHeaderMethodExists = true;
    try {
        setRequestHeaderMethodExists = (xmlRequest && xmlRequest.setRequestHeader);
    }
    catch(e) {}
    var callback = new Object();
    callback.eventCallback = eventCallback;
    callback.context = context;
    callback.errorCallback = errorCallback;
    callback.async = useAsync;
    var callbackIndex = WebForm_FillFirstAvailableSlot(__pendingCallbacks, callback);
    if (!useAsync) {
        if (__synchronousCallBackIndex != -1) {
            __pendingCallbacks[__synchronousCallBackIndex] = null;
        }
        __synchronousCallBackIndex = callbackIndex;
    }
    if (setRequestHeaderMethodExists) {
        xmlRequest.onreadystatechange = WebForm_CallbackComplete;
        callback.xmlRequest = xmlRequest;
        xmlRequest.open("POST", theForm.action, true);
        xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
        xmlRequest.send(postData);
        return;
    }
    callback.xmlRequest = new Object();
    var callbackFrameID = "__CALLBACKFRAME" + callbackIndex;
    var xmlRequestFrame = document.frames[callbackFrameID];
    if (!xmlRequestFrame) {
        xmlRequestFrame = document.createElement("IFRAME");
        xmlRequestFrame.width = "1";
        xmlRequestFrame.height = "1";
        xmlRequestFrame.frameBorder = "0";
        xmlRequestFrame.id = callbackFrameID;
        xmlRequestFrame.name = callbackFrameID;
        xmlRequestFrame.style.position = "absolute";
        xmlRequestFrame.style.top = "-100px"
        xmlRequestFrame.style.left = "-100px";
        try {
            if (callBackFrameUrl) {
                xmlRequestFrame.src = callBackFrameUrl;
            }
        }
        catch(e) {}
        document.body.appendChild(xmlRequestFrame);
    }
    var interval = window.setInterval(function() {
        xmlRequestFrame = document.frames[callbackFrameID];
        if (xmlRequestFrame && xmlRequestFrame.document) {
            window.clearInterval(interval);
            xmlRequestFrame.document.write("");
            xmlRequestFrame.document.close();
            xmlRequestFrame.document.write('<html><body><form method="post"><input type="hidden" name="__CALLBACKLOADSCRIPT" value="t"></form></body></html>');
            xmlRequestFrame.document.close();
            xmlRequestFrame.document.forms[0].action = theForm.action;
            var count = __theFormPostCollection.length;
            var element;
            for (var i = 0; i < count; i++) {
                element = __theFormPostCollection[i];
                if (element) {
                    var fieldElement = xmlRequestFrame.document.createElement("INPUT");
                    fieldElement.type = "hidden";
                    fieldElement.name = element.name;
                    fieldElement.value = element.value;
                    xmlRequestFrame.document.forms[0].appendChild(fieldElement);
                }
            }
            var callbackIdFieldElement = xmlRequestFrame.document.createElement("INPUT");
            callbackIdFieldElement.type = "hidden";
            callbackIdFieldElement.name = "__CALLBACKID";
            callbackIdFieldElement.value = eventTarget;
            xmlRequestFrame.document.forms[0].appendChild(callbackIdFieldElement);
            var callbackParamFieldElement = xmlRequestFrame.document.createElement("INPUT");
            callbackParamFieldElement.type = "hidden";
            callbackParamFieldElement.name = "__CALLBACKPARAM";
            callbackParamFieldElement.value = eventArgument;
            xmlRequestFrame.document.forms[0].appendChild(callbackParamFieldElement);
            if (theForm["__EVENTVALIDATION"]) {
                var callbackValidationFieldElement = xmlRequestFrame.document.createElement("INPUT");
                callbackValidationFieldElement.type = "hidden";
                callbackValidationFieldElement.name = "__EVENTVALIDATION";
                callbackValidationFieldElement.value = theForm["__EVENTVALIDATION"].value;
                xmlRequestFrame.document.forms[0].appendChild(callbackValidationFieldElement);
            }
            var callbackIndexFieldElement = xmlRequestFrame.document.createElement("INPUT");
            callbackIndexFieldElement.type = "hidden";
            callbackIndexFieldElement.name = "__CALLBACKINDEX";
            callbackIndexFieldElement.value = callbackIndex;
            xmlRequestFrame.document.forms[0].appendChild(callbackIndexFieldElement);
            xmlRequestFrame.document.forms[0].submit();
        }
    }, 10);
}
function WebForm_CallbackComplete() {
    for (var i = 0; i < __pendingCallbacks.length; i++) {
        callbackObject = __pendingCallbacks[i];
        if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
            WebForm_ExecuteCallback(callbackObject);
            if (!__pendingCallbacks[i].async) {
                __synchronousCallBackIndex = -1;
            }
            __pendingCallbacks[i] = null;
            var callbackFrameID = "__CALLBACKFRAME" + i;
            var xmlRequestFrame = document.getElementById(callbackFrameID);
            if (xmlRequestFrame) {
                xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
            }
        }
    }
}
function WebForm_ExecuteCallback(callbackObject) {
    var response = callbackObject.xmlRequest.responseText;
    if (response.charAt(0) == "s") {
        if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
            callbackObject.eventCallback(response.substring(1), callbackObject.context);
        }
    }
    else if (response.charAt(0) == "e") {
        if ((typeof(callbackObject.errorCallback) != "undefined") && (callbackObject.errorCallback != null)) {
            callbackObject.errorCallback(response.substring(1), callbackObject.context);
        }
    }
    else {
        var separatorIndex = response.indexOf("|");
        if (separatorIndex != -1) {
            var validationFieldLength = parseInt(response.substring(0, separatorIndex));
            if (!isNaN(validationFieldLength)) {
                var validationField = response.substring(separatorIndex + 1, separatorIndex + validationFieldLength + 1);
                if (validationField != "") {
                    var validationFieldElement = theForm["__EVENTVALIDATION"];
                    if (!validationFieldElement) {
                        validationFieldElement = document.createElement("INPUT");
                        validationFieldElement.type = "hidden";
                        validationFieldElement.name = "__EVENTVALIDATION";
                        theForm.appendChild(validationFieldElement);
                    }
                    validationFieldElement.value = validationField;
                }
                if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
                    callbackObject.eventCallback(response.substring(separatorIndex + validationFieldLength + 1), callbackObject.context);
                }
            }
        }
    }
}
function WebForm_FillFirstAvailableSlot(array, element) {
    var i;
    for (i = 0; i < array.length; i++) {
        if (!array[i]) break;
    }
    array[i] = element;
    return i;
}
var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
var __theFormPostData = "";
var __theFormPostCollection = new Array();
function WebForm_InitCallback() {
    var count = theForm.elements.length;
    var element;
    for (var i = 0; i < count; i++) {
        element = theForm.elements[i];
        var tagName = element.tagName.toLowerCase();
        if (tagName == "input") {
            var type = element.type;
            if ((type == "text" || type == "hidden" || type == "password" ||
                ((type == "checkbox" || type == "radio") && element.checked)) &&
                (element.id != "__EVENTVALIDATION")) {
                WebForm_InitCallbackAddField(element.name, element.value);
            }
        }
        else if (tagName == "select") {
            var selectCount = element.options.length;
            for (var j = 0; j < selectCount; j++) {
                var selectChild = element.options[j];
                if (selectChild.selected == true) {
                    WebForm_InitCallbackAddField(element.name, element.value);
                }
            }
        }
        else if (tagName == "textarea") {
            WebForm_InitCallbackAddField(element.name, element.value);
        }
    }
}
function WebForm_InitCallbackAddField(name, value) {
    var nameValue = new Object();
    nameValue.name = name;
    nameValue.value = value;
    __theFormPostCollection[__theFormPostCollection.length] = nameValue;
    __theFormPostData += WebForm_EncodeCallback(name) + "=" + WebForm_EncodeCallback(value) + "&";
}
function WebForm_EncodeCallback(parameter) {
    if (encodeURIComponent) {
        return encodeURIComponent(parameter);
    }
    else {
        return escape(parameter);
    }
}
var __disabledControlArray = new Array();
function WebForm_ReEnableControls() {
    if (typeof(__enabledControlArray) == 'undefined') {
        return false;
    }
    var disabledIndex = 0;
    for (var i = 0; i < __enabledControlArray.length; i++) {
        var c;
        if (__nonMSDOMBrowser) {
            c = document.getElementById(__enabledControlArray[i]);
        }
        else {
            c = document.all[__enabledControlArray[i]];
        }
        if ((typeof(c) != "undefined") && (c != null) && (c.disabled == true)) {
            c.disabled = false;
            __disabledControlArray[disabledIndex++] = c;
        }
    }
    setTimeout("WebForm_ReDisableControls()", 0);
    return true;
}
function WebForm_ReDisableControls() {
    for (var i = 0; i < __disabledControlArray.length; i++) {
        __disabledControlArray[i].disabled = true;
    }
}
function WebForm_FireDefaultButton(event, target) {
    if (event.keyCode == 13) {
        var src = event.srcElement || event.target;
        if (!src || (src.tagName.toLowerCase() != "textarea")) {
            var defaultButton;
            if (__nonMSDOMBrowser) {
               defaultButton = document.getElementById(target);
            }
            else {
                defaultButton = document.all[target];
            }
            if (defaultButton && typeof(defaultButton.click) != "undefined") {
                defaultButton.click();
                event.cancelBubble = true;
                if (event.stopPropagation) event.stopPropagation();
                return false;
            }
        }
    }
    return true;
}
function WebForm_GetScrollX() {
    if (__nonMSDOMBrowser) {
        return window.pageXOffset;
    }
    else {
        if (document.documentElement && document.documentElement.scrollLeft) {
            return document.documentElement.scrollLeft;
        }
        else if (document.body) {
            return document.body.scrollLeft;
        }
    }
    return 0;
}
function WebForm_GetScrollY() {
    if (__nonMSDOMBrowser) {
        return window.pageYOffset;
    }
    else {
        if (document.documentElement && document.documentElement.scrollTop) {
            return document.documentElement.scrollTop;
        }
        else if (document.body) {
            return document.body.scrollTop;
        }
    }
    return 0;
}
function WebForm_SaveScrollPositionSubmit() {
    if (__nonMSDOMBrowser) {
        theForm.elements['__SCROLLPOSITIONY'].value = window.pageYOffset;
        theForm.elements['__SCROLLPOSITIONX'].value = window.pageXOffset;
    }
    else {
        theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
        theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
    }
    if ((typeof(this.oldSubmit) != "undefined") && (this.oldSubmit != null)) {
        return this.oldSubmit();
    }
    return true;
}
function WebForm_SaveScrollPositionOnSubmit() {
    theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
    theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
    if ((typeof(this.oldOnSubmit) != "undefined") && (this.oldOnSubmit != null)) {
        return this.oldOnSubmit();
    }
    return true;
}
function WebForm_RestoreScrollPosition() {
    if (__nonMSDOMBrowser) {
        window.scrollTo(theForm.elements['__SCROLLPOSITIONX'].value, theForm.elements['__SCROLLPOSITIONY'].value);
    }
    else {
        window.scrollTo(theForm.__SCROLLPOSITIONX.value, theForm.__SCROLLPOSITIONY.value);
    }
    if ((typeof(theForm.oldOnLoad) != "undefined") && (theForm.oldOnLoad != null)) {
        return theForm.oldOnLoad();
    }
    return true;
}
function WebForm_TextBoxKeyHandler(event) {
    if (event.keyCode == 13) {
        var target;
        if (__nonMSDOMBrowser) {
            target = event.target;
        }
        else {
            target = event.srcElement;
        }
        if ((typeof(target) != "undefined") && (target != null)) {
            if (typeof(target.onchange) != "undefined") {
                target.onchange();
                event.cancelBubble = true;
                if (event.stopPropagation) event.stopPropagation();
                return false;
            }
        }
    }
    return true;
}
function WebForm_TrimString(value) {
    return value.replace(/^\s+|\s+$/g, '')
}
function WebForm_AppendToClassName(element, className) {
    var currentClassName = ' ' + WebForm_TrimString(element.className) + ' ';
    className = WebForm_TrimString(className);
    var index = currentClassName.indexOf(' ' + className + ' ');
    if (index === -1) {
        element.className = (element.className === '') ? className : element.className + ' ' + className;
    }
}
function WebForm_RemoveClassName(element, className) {
    var currentClassName = ' ' + WebForm_TrimString(element.className) + ' ';
    className = WebForm_TrimString(className);
    var index = currentClassName.indexOf(' ' + className + ' ');
    if (index >= 0) {
        element.className = WebForm_TrimString(currentClassName.substring(0, index) + ' ' +
            currentClassName.substring(index + className.length + 1, currentClassName.length));
    }
}
function WebForm_GetElementById(elementId) {
    if (document.getElementById) {
        return document.getElementById(elementId);
    }
    else if (document.all) {
        return document.all[elementId];
    }
    else return null;
}
function WebForm_GetElementByTagName(element, tagName) {
    var elements = WebForm_GetElementsByTagName(element, tagName);
    if (elements && elements.length > 0) {
        return elements[0];
    }
    else return null;
}
function WebForm_GetElementsByTagName(element, tagName) {
    if (element && tagName) {
        if (element.getElementsByTagName) {
            return element.getElementsByTagName(tagName);
        }
        if (element.all && element.all.tags) {
            return element.all.tags(tagName);
        }
    }
    return null;
}
function WebForm_GetElementDir(element) {
    if (element) {
        if (element.dir) {
            return element.dir;
        }
        return WebForm_GetElementDir(element.parentNode);
    }
    return "ltr";
}
function WebForm_GetElementPosition(element) {
    var result = new Object();
    result.x = 0;
    result.y = 0;
    result.width = 0;
    result.height = 0;
    if (element.offsetParent) {
        result.x = element.offsetLeft;
        result.y = element.offsetTop;
        var parent = element.offsetParent;
        while (parent) {
            result.x += parent.offsetLeft;
            result.y += parent.offsetTop;
            var parentTagName = parent.tagName.toLowerCase();
            if (parentTagName != "table" &&
                parentTagName != "body" && 
                parentTagName != "html" && 
                parentTagName != "div" && 
                parent.clientTop && 
                parent.clientLeft) {
                result.x += parent.clientLeft;
                result.y += parent.clientTop;
            }
            parent = parent.offsetParent;
        }
    }
    else if (element.left && element.top) {
        result.x = element.left;
        result.y = element.top;
    }
    else {
        if (element.x) {
            result.x = element.x;
        }
        if (element.y) {
            result.y = element.y;
        }
    }
    if (element.offsetWidth && element.offsetHeight) {
        result.width = element.offsetWidth;
        result.height = element.offsetHeight;
    }
    else if (element.style && element.style.pixelWidth && element.style.pixelHeight) {
        result.width = element.style.pixelWidth;
        result.height = element.style.pixelHeight;
    }
    return result;
}
function WebForm_GetParentByTagName(element, tagName) {
    var parent = element.parentNode;
    var upperTagName = tagName.toUpperCase();
    while (parent && (parent.tagName.toUpperCase() != upperTagName)) {
        parent = parent.parentNode ? parent.parentNode : parent.parentElement;
    }
    return parent;
}
function WebForm_SetElementHeight(element, height) {
    if (element && element.style) {
        element.style.height = height + "px";
    }
}
function WebForm_SetElementWidth(element, width) {
    if (element && element.style) {
        element.style.width = width + "px";
    }
}
function WebForm_SetElementX(element, x) {
    if (element && element.style) {
        element.style.left = x + "px";
    }
}
function WebForm_SetElementY(element, y) {
    if (element && element.style) {
        element.style.top = y + "px";
    }
}

var Page_ValidationVer = "125";
var Page_IsValid = true;
var Page_BlockSubmit = false;
var Page_InvalidControlToBeFocused = null;
function ValidatorUpdateDisplay(val) {
    if (typeof(val.display) == "string") {
        if (val.display == "None") {
            return;
        }
        if (val.display == "Dynamic") {
            val.style.display = val.isvalid ? "none" : "inline";
            return;
        }
    }
    if ((navigator.userAgent.indexOf("Mac") > -1) &&
        (navigator.userAgent.indexOf("MSIE") > -1)) {
        val.style.display = "inline";
    }
    val.style.visibility = val.isvalid ? "hidden" : "visible";
}
function ValidatorUpdateIsValid() {
    Page_IsValid = AllValidatorsValid(Page_Validators);
}
function AllValidatorsValid(validators) {
    if ((typeof(validators) != "undefined") && (validators != null)) {
        var i;
        for (i = 0; i < validators.length; i++) {
            if (!validators[i].isvalid) {
                return false;
            }
        }
    }
    return true;
}
function ValidatorHookupControlID(controlID, val) {
    if (typeof(controlID) != "string") {
        return;
    }
    var ctrl = document.getElementById(controlID);
    if ((typeof(ctrl) != "undefined") && (ctrl != null)) {
        ValidatorHookupControl(ctrl, val);
    }
    else {
        val.isvalid = true;
        val.enabled = false;
    }
}
function ValidatorHookupControl(control, val) {
    if (typeof(control.tagName) != "string") {
        return;  
    }
    if (control.tagName != "INPUT" && control.tagName != "TEXTAREA" && control.tagName != "SELECT") {
        var i;
        for (i = 0; i < control.childNodes.length; i++) {
            ValidatorHookupControl(control.childNodes[i], val);
        }
        return;
    }
    else {
        if (typeof(control.Validators) == "undefined") {
            control.Validators = new Array;
            var eventType;
            if (control.type == "radio") {
                eventType = "onclick";
            } else {
                eventType = "onchange";
                if (typeof(val.focusOnError) == "string" && val.focusOnError == "t") {
                    ValidatorHookupEvent(control, "onblur", "ValidatedControlOnBlur(event); ");
                }
            }
            ValidatorHookupEvent(control, eventType, "ValidatorOnChange(event); ");
            if (control.type == "text" ||
                control.type == "password" ||
                control.type == "file") {
                ValidatorHookupEvent(control, "onkeypress", 
                    "if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } ");
            }
        }
        control.Validators[control.Validators.length] = val;
    }
}
function ValidatorHookupEvent(control, eventType, functionPrefix) {
    var ev;
    eval("ev = control." + eventType + ";");
    if (typeof(ev) == "function") {
        ev = ev.toString();
        ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}"));
    }
    else {
        ev = "";
    }
    var func;
    if (navigator.appName.toLowerCase().indexOf('explorer') > -1) {
        func = new Function(functionPrefix + " " + ev);
    }
    else {
        func = new Function("event", functionPrefix + " " + ev);
    }
    eval("control." + eventType + " = func;");
}
function ValidatorGetValue(id) {
    var control;
    control = document.getElementById(id);
    if (typeof(control.value) == "string") {
        return control.value;
    }
    return ValidatorGetValueRecursive(control);
}
function ValidatorGetValueRecursive(control)
{
    if (typeof(control.value) == "string" && (control.type != "radio" || control.checked == true)) {
        return control.value;
    }
    var i, val;
    for (i = 0; i<control.childNodes.length; i++) {
        val = ValidatorGetValueRecursive(control.childNodes[i]);
        if (val != "") return val;
    }
    return "";
}
function Page_ClientValidate(validationGroup) {
    Page_InvalidControlToBeFocused = null;
    if (typeof(Page_Validators) == "undefined") {
        return true;
    }
    var i;
    for (i = 0; i < Page_Validators.length; i++) {
        ValidatorValidate(Page_Validators[i], validationGroup, null);
    }
    ValidatorUpdateIsValid();
    ValidationSummaryOnSubmit(validationGroup);
    Page_BlockSubmit = !Page_IsValid;
    return Page_IsValid;
}
function ValidatorCommonOnSubmit() {
    Page_InvalidControlToBeFocused = null;
    var result = !Page_BlockSubmit;
    if ((typeof(window.event) != "undefined") && (window.event != null)) {
        window.event.returnValue = result;
    }
    Page_BlockSubmit = false;
    return result;
}
function ValidatorEnable(val, enable) {
    val.enabled = (enable != false);
    ValidatorValidate(val);
    ValidatorUpdateIsValid();
}
function ValidatorOnChange(event) {
    if (!event) {
        event = window.event;
    }
    Page_InvalidControlToBeFocused = null;
    var targetedControl;
    if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
        targetedControl = event.srcElement;
    }
    else {
        targetedControl = event.target;
    }
    var vals;
    if (typeof(targetedControl.Validators) != "undefined") {
        vals = targetedControl.Validators;
    }
    else {
        if (targetedControl.tagName.toLowerCase() == "label") {
            targetedControl = document.getElementById(targetedControl.htmlFor);
            vals = targetedControl.Validators;
        }
    }
    var i;
    for (i = 0; i < vals.length; i++) {
        ValidatorValidate(vals[i], null, event);
    }
    ValidatorUpdateIsValid();
}
function ValidatedTextBoxOnKeyPress(event) {
    if (event.keyCode == 13) {
        ValidatorOnChange(event);
        var vals;
        if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
            vals = event.srcElement.Validators;
        }
        else {
            vals = event.target.Validators;
        }
        return AllValidatorsValid(vals);
    }
    return true;
}
function ValidatedControlOnBlur(event) {
    var control;
    if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
        control = event.srcElement;
    }
    else {
        control = event.target;
    }
    if ((typeof(control) != "undefined") && (control != null) && (Page_InvalidControlToBeFocused == control)) {
        control.focus();
        Page_InvalidControlToBeFocused = null;
    }
}
function ValidatorValidate(val, validationGroup, event) {
    val.isvalid = true;
    if ((typeof(val.enabled) == "undefined" || val.enabled != false) && IsValidationGroupMatch(val, validationGroup)) {
        if (typeof(val.evaluationfunction) == "function") {
            val.isvalid = val.evaluationfunction(val);
            if (!val.isvalid && Page_InvalidControlToBeFocused == null &&
                typeof(val.focusOnError) == "string" && val.focusOnError == "t") {
                ValidatorSetFocus(val, event);
            }
        }
    }
    ValidatorUpdateDisplay(val);
}
function ValidatorSetFocus(val, event) {
    var ctrl;
    if (typeof(val.controlhookup) == "string") {
        var eventCtrl;
        if ((typeof(event) != "undefined") && (event != null)) {
            if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
                eventCtrl = event.srcElement;
            }
            else {
                eventCtrl = event.target;
            }
        }
        if ((typeof(eventCtrl) != "undefined") && (eventCtrl != null) &&
            (typeof(eventCtrl.id) == "string") &&
            (eventCtrl.id == val.controlhookup)) {
            ctrl = eventCtrl;
        }
    }
    if ((typeof(ctrl) == "undefined") || (ctrl == null)) {
        ctrl = document.getElementById(val.controltovalidate);
    }
    if ((typeof(ctrl) != "undefined") && (ctrl != null) &&
        (ctrl.tagName.toLowerCase() != "table" || (typeof(event) == "undefined") || (event == null)) && 
        ((ctrl.tagName.toLowerCase() != "input") || (ctrl.type.toLowerCase() != "hidden")) &&
        (typeof(ctrl.disabled) == "undefined" || ctrl.disabled == null || ctrl.disabled == false) &&
        (typeof(ctrl.visible) == "undefined" || ctrl.visible == null || ctrl.visible != false) &&
        (IsInVisibleContainer(ctrl))) {
        if ((ctrl.tagName.toLowerCase() == "table" && (typeof(__nonMSDOMBrowser) == "undefined" || __nonMSDOMBrowser)) ||
            (ctrl.tagName.toLowerCase() == "span")) {
            var inputElements = ctrl.getElementsByTagName("input");
            var lastInputElement  = inputElements[inputElements.length -1];
            if (lastInputElement != null) {
                ctrl = lastInputElement;
            }
        }
        if (typeof(ctrl.focus) != "undefined" && ctrl.focus != null) {
            ctrl.focus();
            Page_InvalidControlToBeFocused = ctrl;
        }
    }
}
function IsInVisibleContainer(ctrl) {
    if (typeof(ctrl.style) != "undefined" &&
        ( ( typeof(ctrl.style.display) != "undefined" &&
            ctrl.style.display == "none") ||
          ( typeof(ctrl.style.visibility) != "undefined" &&
            ctrl.style.visibility == "hidden") ) ) {
        return false;
    }
    else if (typeof(ctrl.parentNode) != "undefined" &&
             ctrl.parentNode != null &&
             ctrl.parentNode != ctrl) {
        return IsInVisibleContainer(ctrl.parentNode);
    }
    return true;
}
function IsValidationGroupMatch(control, validationGroup) {
    if ((typeof(validationGroup) == "undefined") || (validationGroup == null)) {
        return true;
    }
    var controlGroup = "";
    if (typeof(control.validationGroup) == "string") {
        controlGroup = control.validationGroup;
    }
    return (controlGroup == validationGroup);
}
function ValidatorOnLoad() {
    if (typeof(Page_Validators) == "undefined")
        return;
    var i, val;
    for (i = 0; i < Page_Validators.length; i++) {
        val = Page_Validators[i];
        if (typeof(val.evaluationfunction) == "string") {
            eval("val.evaluationfunction = " + val.evaluationfunction + ";");
        }
        if (typeof(val.isvalid) == "string") {
            if (val.isvalid == "False") {
                val.isvalid = false;
                Page_IsValid = false;
            }
            else {
                val.isvalid = true;
            }
        } else {
            val.isvalid = true;
        }
        if (typeof(val.enabled) == "string") {
            val.enabled = (val.enabled != "False");
        }
        if (typeof(val.controltovalidate) == "string") {
            ValidatorHookupControlID(val.controltovalidate, val);
        }
        if (typeof(val.controlhookup) == "string") {
            ValidatorHookupControlID(val.controlhookup, val);
        }
    }
    Page_ValidationActive = true;
}
function ValidatorConvert(op, dataType, val) {
    function GetFullYear(year) {
        var twoDigitCutoffYear = val.cutoffyear % 100;
        var cutoffYearCentury = val.cutoffyear - twoDigitCutoffYear;
        return ((year > twoDigitCutoffYear) ? (cutoffYearCentury - 100 + year) : (cutoffYearCentury + year));
    }
    var num, cleanInput, m, exp;
    if (dataType == "Integer") {
        exp = /^\s*[-\+]?\d+\s*$/;
        if (op.match(exp) == null)
            return null;
        num = parseInt(op, 10);
        return (isNaN(num) ? null : num);
    }
    else if(dataType == "Double") {
        exp = new RegExp("^\\s*([-\\+])?(\\d*)\\" + val.decimalchar + "?(\\d*)\\s*$");
        m = op.match(exp);
        if (m == null)
            return null;
        if (m[2].length == 0 && m[3].length == 0)
            return null;
        cleanInput = (m[1] != null ? m[1] : "") + (m[2].length>0 ? m[2] : "0") + (m[3].length>0 ? "." + m[3] : "");
        num = parseFloat(cleanInput);
        return (isNaN(num) ? null : num);
    }
    else if (dataType == "Currency") {
        var hasDigits = (val.digits > 0);
        var beginGroupSize, subsequentGroupSize;
        var groupSizeNum = parseInt(val.groupsize, 10);
        if (!isNaN(groupSizeNum) && groupSizeNum > 0) {
            beginGroupSize = "{1," + groupSizeNum + "}";
            subsequentGroupSize = "{" + groupSizeNum + "}";
        }
        else {
            beginGroupSize = subsequentGroupSize = "+";
        }
        exp = new RegExp("^\\s*([-\\+])?((\\d" + beginGroupSize + "(\\" + val.groupchar + "\\d" + subsequentGroupSize + ")+)|\\d*)"
                        + (hasDigits ? "\\" + val.decimalchar + "?(\\d{0," + val.digits + "})" : "")
                        + "\\s*$");
        m = op.match(exp);
        if (m == null)
            return null;
        if (m[2].length == 0 && hasDigits && m[5].length == 0)
            return null;
        cleanInput = (m[1] != null ? m[1] : "") + m[2].replace(new RegExp("(\\" + val.groupchar + ")", "g"), "") + ((hasDigits && m[5].length > 0) ? "." + m[5] : "");
        num = parseFloat(cleanInput);
        return (isNaN(num) ? null : num);
    }
    else if (dataType == "Date") {
        var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([-/]|\\. ?)(\\d{1,2})\\4(\\d{1,2})\\.?\\s*$");
        m = op.match(yearFirstExp);
        var day, month, year;
        if (m != null && (m[2].length == 4 || val.dateorder == "ymd")) {
            day = m[6];
            month = m[5];
            year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10))
        }
        else {
            if (val.dateorder == "ymd"){
                return null;
            }
            var yearLastExp = new RegExp("^\\s*(\\d{1,2})([-/]|\\. ?)(\\d{1,2})(?:\\s|\\2)((\\d{4})|(\\d{2}))(?:\\s\u0433\\.)?\\s*$");
            m = op.match(yearLastExp);
            if (m == null) {
                return null;
            }
            if (val.dateorder == "mdy") {
                day = m[3];
                month = m[1];
            }
            else {
                day = m[1];
                month = m[3];
            }
            year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10))
        }
        month -= 1;
        var date = new Date(year, month, day);
        if (year < 100) {
            date.setFullYear(year);
        }
        return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null;
    }
    else {
        return op.toString();
    }
}
function ValidatorCompare(operand1, operand2, operator, val) {
    var dataType = val.type;
    var op1, op2;
    if ((op1 = ValidatorConvert(operand1, dataType, val)) == null)
        return false;
    if (operator == "DataTypeCheck")
        return true;
    if ((op2 = ValidatorConvert(operand2, dataType, val)) == null)
        return true;
    switch (operator) {
        case "NotEqual":
            return (op1 != op2);
        case "GreaterThan":
            return (op1 > op2);
        case "GreaterThanEqual":
            return (op1 >= op2);
        case "LessThan":
            return (op1 < op2);
        case "LessThanEqual":
            return (op1 <= op2);
        default:
            return (op1 == op2);
    }
}
function CompareValidatorEvaluateIsValid(val) {
    var value = ValidatorGetValue(val.controltovalidate);
    if (ValidatorTrim(value).length == 0)
        return true;
    var compareTo = "";
    if ((typeof(val.controltocompare) != "string") ||
        (typeof(document.getElementById(val.controltocompare)) == "undefined") ||
        (null == document.getElementById(val.controltocompare))) {
        if (typeof(val.valuetocompare) == "string") {
            compareTo = val.valuetocompare;
        }
    }
    else {
        compareTo = ValidatorGetValue(val.controltocompare);
    }
    var operator = "Equal";
    if (typeof(val.operator) == "string") {
        operator = val.operator;
    }
    return ValidatorCompare(value, compareTo, operator, val);
}
function CustomValidatorEvaluateIsValid(val) {
    var value = "";
    if (typeof(val.controltovalidate) == "string") {
        value = ValidatorGetValue(val.controltovalidate);
        if ((ValidatorTrim(value).length == 0) &&
            ((typeof(val.validateemptytext) != "string") || (val.validateemptytext != "true"))) {
            return true;
        }
    }
    var args = { Value:value, IsValid:true };
    if (typeof(val.clientvalidationfunction) == "string") {
        eval(val.clientvalidationfunction + "(val, args) ;");
    }
    return args.IsValid;
}
function RegularExpressionValidatorEvaluateIsValid(val) {
    var value = ValidatorGetValue(val.controltovalidate);
    if (ValidatorTrim(value).length == 0)
        return true;
    var rx = new RegExp(val.validationexpression);
    var matches = rx.exec(value);
    return (matches != null && value == matches[0]);
}
function ValidatorTrim(s) {
    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (m == null) ? "" : m[1];
}
function RequiredFieldValidatorEvaluateIsValid(val) {
    return (ValidatorTrim(ValidatorGetValue(val.controltovalidate)) != ValidatorTrim(val.initialvalue))
}
function RangeValidatorEvaluateIsValid(val) {
    var value = ValidatorGetValue(val.controltovalidate);
    if (ValidatorTrim(value).length == 0)
        return true;
    return (ValidatorCompare(value, val.minimumvalue, "GreaterThanEqual", val) &&
            ValidatorCompare(value, val.maximumvalue, "LessThanEqual", val));
}
function ValidationSummaryOnSubmit(validationGroup) {
    if (typeof(Page_ValidationSummaries) == "undefined")
        return;
    var summary, sums, s;
    for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {
        summary = Page_ValidationSummaries[sums];
        summary.style.display = "none";
        if (!Page_IsValid && IsValidationGroupMatch(summary, validationGroup)) {
            var i;
            if (summary.showsummary != "False") {
                summary.style.display = "";
                if (typeof(summary.displaymode) != "string") {
                    summary.displaymode = "BulletList";
                }
                switch (summary.displaymode) {
                    case "List":
                        headerSep = "<br>";
                        first = "";
                        pre = "";
                        post = "<br>";
                        end = "";
                        break;
                    case "BulletList":
                    default:
                        headerSep = "";
                        first = "<ul>";
                        pre = "<li>";
                        post = "</li>";
                        end = "</ul>";
                        break;
                    case "SingleParagraph":
                        headerSep = " ";
                        first = "";
                        pre = "";
                        post = " ";
                        end = "<br>";
                        break;
                }
                s = "";
                if (typeof(summary.headertext) == "string") {
                    s += summary.headertext + headerSep;
                }
                s += first;
                for (i=0; i<Page_Validators.length; i++) {
                    if (!Page_Validators[i].isvalid && typeof(Page_Validators[i].errormessage) == "string") {
                        s += pre + Page_Validators[i].errormessage + post;
                    }
                }
                s += end;
                summary.innerHTML = s;
                window.scrollTo(0,0);
            }
            if (summary.showmessagebox == "True") {
                s = "";
                if (typeof(summary.headertext) == "string") {
                    s += summary.headertext + "\r\n";
                }
                var lastValIndex = Page_Validators.length - 1;
                for (i=0; i<=lastValIndex; i++) {
                    if (!Page_Validators[i].isvalid && typeof(Page_Validators[i].errormessage) == "string") {
                        switch (summary.displaymode) {
                            case "List":
                                s += Page_Validators[i].errormessage;
                                if (i < lastValIndex) {
                                    s += "\r\n";
                                }
                                break;
                            case "BulletList":
                            default:
                                s += "- " + Page_Validators[i].errormessage;
                                if (i < lastValIndex) {
                                    s += "\r\n";
                                }
                                break;
                            case "SingleParagraph":
                                s += Page_Validators[i].errormessage + " ";
                                break;
                        }
                    }
                }
                alert(s);
            }
        }
    }
}

Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadMaskPart=function(){this.value="";
this.index=-1;
this.type=-1;
this.PromptChar="_";
};
Telerik.Web.UI.RadMaskPart.prototype={HandleKey:function(a){return false;
},HandleWheel:function(a){return true;
},SetController:function(a){this.controller=a;
},GetValue:function(){return this.value.toString();
},GetVisValue:function(){return"";
},SetValue:function(a,b){return true;
},CanHandle:function(a,b){return true;
},IsCaseSensitive:function(){return false;
},GetLength:function(){return 1;
},IsAlpha:function(a){return a.match(/[^\u005D\u005B\t\n\r\f\s\v\\!-@|^_`{-\u00BF]{1}/)!=null;
}};
Telerik.Web.UI.RadMaskPart.registerClass("Telerik.Web.UI.RadMaskPart");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadDigitMaskPart=function(){Telerik.Web.UI.RadDigitMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadDigitMaskPart.prototype={GetValue:function(){return this.value.toString();
},IsCaseSensitive:function(){return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},CanHandle:function(a,b){if(isNaN(parseInt(a))){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},SetValue:function(a,b){if(a==""||a==this.PromptChar||a==" "){this.value="";
return true;
}if(this.CanHandle(a,b)){this.value=parseInt(a);
}return true;
}};
Telerik.Web.UI.RadDigitMaskPart.registerClass("Telerik.Web.UI.RadDigitMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadEnumerationMaskPart=function(a){Telerik.Web.UI.RadEnumerationMaskPart.initializeBase(this);
this.SetOptions(a);
this.lastOffsetPunched=-1;
this.selectedForCompletion=0;
this.FlipDirection=0;
this.RebuildKeyBuff();
};
Telerik.Web.UI.RadEnumerationMaskPart.prototype={SetOptions:function(a){this.length=0;
this.Options=a;
this.optionsIndex=[];
for(var b=0;
b<this.Options.length;
b++){this.length=Math.max(this.length,this.Options[b].length);
this.optionsIndex[this.Options[b]]=b;
}},CanHandle:function(){return true;
},SetController:function(a){this.controller=a;
this.InitializeSelection(a.get_allowEmptyEnumerations());
},InitializeSelection:function(a){if(a){this.value="";
this.selectedIndex=-1;
}else{this.value=this.Options[0];
this.selectedIndex=0;
}},RebuildKeyBuff:function(){this.keyBuff=[];
for(i=0;
i<this.length;
i++){this.keyBuff[i]="";
}this.keyBuffRebuilt=true;
},IsCaseSensitive:function(){return true;
},ResetCompletion:function(){this.selectedForCompetion=0;
},SelectNextCompletion:function(){this.selectedForCompletion++;
},Store:function(a,b){if(this.lastOffsetPunched==b){if(this.keyBuff[b]==a){this.SelectNextCompletion();
}else{this.RebuildKeyBuff();
}}else{this.ResetCompletion();
}this.lastOffsetPunched=b;
this.keyBuff[b]=a;
},SetNoCompletionValue:function(){if(this.controller.get_allowEmptyEnumerations()){this.SetOption(-1);
}},SetValue:function(a,d){d-=this.offset;
this.Store(a,d);
var b=new Telerik.Web.UI.CompletionList(this.Options,this.PromptChar);
var e=b.GetCompletions(this.keyBuff,d);
if(e.length>0){var c=this.optionsIndex[e[this.selectedForCompletion%e.length]];
this.SetOption(c);
}else{this.SetNoCompletionValue();
return false;
}return true;
},GetVisValue:function(){var a=this.value;
while(a.length<this.length){a+=this.PromptChar;
}return a;
},GetLength:function(){return this.length;
},GetSelectedIndex:function(){return this.selectedIndex;
},SetOption:function(c,a){var b=this.value;
if(this.controller.get_allowEmptyEnumerations()){if(c<-1){c=this.Options.length+c+1;
this.FlipDirection=-1;
}else{if(c>=this.Options.length){c=c-this.Options.length-1;
this.FlipDirection=1;
}}}else{if(c<0){c=this.Options.length+c;
this.FlipDirection=-1;
}else{if(c>=this.Options.length){c=c-this.Options.length;
this.FlipDirection=1;
}}}this.selectedIndex=c;
this.value=c==-1?"":this.Options[c];
if(typeof(a)!="undefined"){if(a){this.controller._OnMoveUp(this,b,this.value);
}else{this.controller._OnMoveDown(this,b,this.value);
}}this.controller._OnEnumChanged(this,b,this.value);
this.FlipDirection=0;
},HandleKey:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
if(a.IsDownArrow()){this.SetOption(this.selectedIndex+1,false);
this.controller._Visualise();
this.controller._FixSelection(a);
return true;
}else{if(a.IsUpArrow()){this.SetOption(this.selectedIndex-1,true);
this.controller._Visualise();
this.controller._FixSelection(a);
return true;
}}},HandleWheel:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
this.SetOption(this.selectedIndex-b.rawEvent.wheelDelta/120);
this.controller._Visualise();
this.controller._FixSelection(a);
return false;
}};
Telerik.Web.UI.RadEnumerationMaskPart.registerClass("Telerik.Web.UI.RadEnumerationMaskPart",Telerik.Web.UI.RadMaskPart);
Telerik.Web.UI.CompletionList=function(b,a){this.options=b;
this.blankChar=a;
};
Telerik.Web.UI.CompletionList.prototype={GetCompletions:function(c,d){var b=this.options;
for(var a=0;
a<=d;
a++){var e=c[a].toLowerCase();
b=this.FilterCompletions(b,a,e);
}return b;
},FilterCompletions:function(a,f,b){var c=[];
for(var d=0;
d<a.length;
d++){var g=a[d];
var e=g.charAt(f).toLowerCase();
if(this.CharacterMatchesCompletion(b,e)){c[c.length]=g;
}}return c;
},CharacterMatchesCompletion:function(b,a){return b==this.blankChar||b==" "||b==a;
}};
Telerik.Web.UI.CompletionList.registerClass("Telerik.Web.UI.CompletionList");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadFreeMaskPart=function(){Telerik.Web.UI.RadFreeMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadFreeMaskPart.prototype={IsCaseSensitive:function(){return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value;
},SetValue:function(a,b){this.value=a;
return true;
}};
Telerik.Web.UI.RadFreeMaskPart.registerClass("Telerik.Web.UI.RadFreeMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadLiteralMaskPart=function(a){Telerik.Web.UI.RadLiteralMaskPart.initializeBase(this);
this.ch=a;
};
Telerik.Web.UI.RadLiteralMaskPart.prototype={GetVisValue:function(){return this.ch;
},GetLength:function(){if(Sys.Browser.agent==Sys.Browser.Firefox){return this.ch.length-(this.ch.split("\r\n").length-1);
}return this.ch.length;
},GetValue:function(){return"";
},IsCaseSensitive:function(){if(this.NextChunk!=null){return this.NextChunk.IsCaseSensitive();
}},SetValue:function(a,b){b-=this.offset;
return a==this.ch.charAt(b)||!a;
},CanHandle:function(a,b){b-=this.offset;
if(a==this.ch.charAt(b)){return true;
}if(!a){return true;
}if(this.NextChunk!=null){return this.NextChunk.CanHandle(a,b+this.GetLength());
}}};
Telerik.Web.UI.RadLiteralMaskPart.registerClass("Telerik.Web.UI.RadLiteralMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadLowerMaskPart=function(){Telerik.Web.UI.RadLowerMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadLowerMaskPart.prototype={CanHandle:function(a,b){if(!this.IsAlpha(a)){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},SetValue:function(a,b){if(a==""){this.value="";
return true;
}if(this.IsAlpha(a)){this.value=a.toLowerCase();
}else{this.controller._OnChunkError(this,this.GetValue(),a);
}return true;
}};
Telerik.Web.UI.RadLowerMaskPart.registerClass("Telerik.Web.UI.RadLowerMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadNumericRangeMaskPart=function(a,c,d,b){Telerik.Web.UI.RadNumericRangeMaskPart.initializeBase(this);
this.upperLimit=c;
this.lowerLimit=a;
this.length=Math.max(this.lowerLimit.toString().length,this.upperLimit.toString().length);
this.leftAlign=d;
this.zeroFill=b;
this.minusIncluded=this.lowerLimit<0||this.upperLimit<0;
this.value=a;
this.FlipDirection=0;
};
Telerik.Web.UI.RadNumericRangeMaskPart.prototype={SetController:function(a){this.controller=a;
this.GetVisValue();
},IsCaseSensitive:function(){return true;
},CanHandle:function(a,b){if((a=="-"||a=="+")&&this.lowerLimit<0){return true;
}if(isNaN(parseInt(a))){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},InsertAt:function(a,b){return this.visValue.substr(0,b)+a.toString()+this.visValue.substr(b+1,this.visValue.length);
},ReplacePromptChar:function(b){var a=this.leftAlign?"":"0";
while(b.indexOf(this.PromptChar)>-1){b=b.replace(this.PromptChar,a);
}return b;
},SetValue:function(a,b){if(a==""){a=0;
}if(isNaN(parseInt(a))&&a!="+"&&a!="-"){return true;
}b-=this.offset;
var c=this.InsertAt(a,b);
c=this.ReplacePromptChar(c);
if(c.indexOf("-")!=-1&&c.indexOf("-")>0){c=c.replace("-","0");
}if(isNaN(parseInt(c))){c=0;
}if(this.controller.get_roundNumericRanges()){c=Math.min(this.upperLimit,c);
c=Math.max(this.lowerLimit,c);
this.setInternalValue(c);
}else{if(c<=this.upperLimit&&c>=this.lowerLimit){this.setInternalValue(c);
this.GetVisValue();
}else{return false;
}}this.GetVisValue();
return true;
},setInternalValue:function(b){var a=this.value;
this.value=b;
this.controller._OnEnumChanged(this,a,b);
if(a>b){this.controller._OnMoveDown(this,a,b);
}else{if(a<b){this.controller._OnMoveUp(this,a,b);
}}this.FlipDirection=0;
},GetVisValue:function(){var a="";
var b=Math.abs(this.value).toString();
if(this.leftAlign){if(this.value<0){a+=this.PromptChar;
}a+=b;
while(a.length<this.length){a+=this.controller.get_promptChar();
}}else{var c=this.zeroFill?"0":this.controller.get_promptChar();
if(this.value<0){b="-"+b;
}while(a.length<this.length-b.length){a+=c;
}a+=b;
}this.visValue=a;
return a;
},GetLength:function(){return this.length;
},HandleKey:function(b){this.controller._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this.controller._textBoxElement);
if(a.IsDownArrow()){this.MoveDown();
this.controller._FixSelection(a);
return true;
}else{if(a.IsUpArrow()){this.MoveUp();
this.controller._FixSelection(a);
return true;
}}},MoveUp:function(){var a=this.value;
a++;
if(a>this.upperLimit){a=this.lowerLimit;
this.FlipDirection=1;
}this.setInternalValue(a);
this.controller._Visualise();
},MoveDown:function(){var a=this.value;
a--;
if(a<this.lowerLimit){a=this.upperLimit;
this.FlipDirection=-1;
}this.setInternalValue(a);
this.controller._Visualise();
},HandleWheel:function(d){var a=this.value;
var c;
if(d.rawEvent.wheelDelta){c=d.rawEvent.wheelDelta/120;
if(window.opera){c=-c;
}}else{if(d.rawEvent.detail){c=-d.rawEvent.detail/3;
}}a=parseInt(a)+c;
var b=new Telerik.Web.UI.MaskedEventWrap(d,this.controller._textBoxElement);
if(a<this.lowerLimit){a=this.upperLimit-(this.lowerLimit-a-1);
this.FlipDirection=-1;
}if(a>this.upperLimit){a=this.lowerLimit+(a-this.upperLimit-1);
this.FlipDirection=1;
}this.setInternalValue(a);
this.controller._Visualise();
this.controller._FixSelection(b);
return false;
}};
Telerik.Web.UI.RadNumericRangeMaskPart.registerClass("Telerik.Web.UI.RadNumericRangeMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadUpperMaskPart=function(){Telerik.Web.UI.RadUpperMaskPart.initializeBase(this);
};
Telerik.Web.UI.RadUpperMaskPart.prototype={CanHandle:function(a,b){if(!this.IsAlpha(a)){this.controller._OnChunkError(this,this.GetValue(),a);
return false;
}return true;
},GetVisValue:function(){if(this.value.toString()==""){return this.PromptChar;
}return this.value.toString();
},SetValue:function(a,b){if(a==""){this.value="";
return true;
}if(this.IsAlpha(a)){this.value=a.toUpperCase();
}else{this.controller._OnChunkError(this,this.GetValue(),a);
}return true;
}};
Telerik.Web.UI.RadUpperMaskPart.registerClass("Telerik.Web.UI.RadUpperMaskPart",Telerik.Web.UI.RadMaskPart);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.MaskedEventWrap=function(b,a){if(b){this.event=b.rawEvent;
}this._selectionStart=a.selectionStart;
this._selectionEnd=a.selectionEnd;
this.fieldValue=a.value;
};
Telerik.Web.UI.MaskedEventWrap.prototype={IsUpArrow:function(){return this.event.keyCode==38;
},IsDownArrow:function(){return this.event.keyCode==40;
}};
Telerik.Web.UI.MaskedEventWrap.registerClass("Telerik.Web.UI.MaskedEventWrap");
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadMaskedTextBox=function(a){Telerik.Web.UI.RadMaskedTextBox.initializeBase(this,[a]);
this._parts=[];
this._partIndex=[];
this._displayPartIndex=[];
this._value="";
this._lastState=null;
this._length=0;
this._displayLength=0;
this._internalValueUpdate=false;
this._projectedValue="";
this._isTextarea=false;
this._initialMasks=[];
this._initialDisplayMasks=[];
this._promptChar="_";
this._displayPromptChar="_";
this._displayFormatPosition=Telerik.Web.UI.DisplayFormatPosition.Left;
this._hideOnBlur=false;
this._resetCaretOnFocus=false;
this._roundNumericRanges=true;
this._allowEmptyEnumerations=false;
this._readOnly=false;
this._focusOnStartup=false;
this._onTextBoxMouseUpDelegate=null;
this._onTextBoxMouseDownDelegate=null;
this._onTextBoxPasteDelegate=null;
this._onTextBoxPropertyChangeDelegate=null;
this._onTextBoxInputDelegate=null;
this._onFormResetDelegate=null;
this._isInitialized=false;
this._originalValue="";
this.preventPostBackAfterBlur=false;
};
Telerik.Web.UI.RadMaskedTextBox.prototype={initialize:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"initialize");
if(this._focused){this._focusOnStartup=true;
}this._fixAbsolutePositioning();
this._setMask(this.get__initialMasks());
if(this.get__initialDisplayMasks().length){this._setDisplayMask(this.get__initialDisplayMasks());
}this._SetValue(this._textBoxElement.value);
this._Visualise();
this._textBoxElement._oldValue=this._textBoxElement.value;
this._isTextarea=this._textBoxElement.tagName.toLowerCase()=="textarea";
this._RecordInitialState();
this._isInitialized=true;
if(this._focusOnStartup){this._calculateSelection();
this._lastState=new Telerik.Web.UI.MaskedEventWrap(null,this._textBoxElement);
}},dispose:function(){if(this._onTextBoxMouseUpDelegate){$removeHandler(this._textBoxElement,"mouseup",this._onTextBoxMouseUpDelegate);
this._onTextBoxMouseUpDelegate=null;
}if(this._onTextBoxMouseDownDelegate){$removeHandler(this._textBoxElement,"mousedown",this._onTextBoxMouseDownDelegate);
this._onTextBoxMouseDownDelegate=null;
}if(this._onFormResetDelegate){if(this._textBoxElement.form){$removeHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}this._onFormResetDelegate=null;
}if(Sys.Browser.agent==Sys.Browser.InternetExplorer){if(this._onTextBoxPasteDelegate){$removeHandler(this._textBoxElement,"paste",this._onTextBoxPasteDelegate);
this._onTextBoxPasteDelegate=null;
}if(this._onTextBoxPropertyChangeDelegate){$removeHandler(this._textBoxElement,"propertychange",this._onTextBoxPropertyChangeDelegate);
this._onTextBoxPropertyChangeDelegate=null;
}}else{if(this._onTextBoxInputDelegate){$removeHandler(this._textBoxElement,"input",this._onTextBoxInputDelegate);
this._onTextBoxInputDelegate=null;
}}Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"dispose");
},isEmpty:function(){return this._value=="";
},resetCursor:function(){this.set_cursorPosition(0);
},inSelection:function(a){this._calculateSelection();
if(this._textBoxElement.selectionStart!=this._textBoxElement.selectionEnd){this._OnActivity(a);
return true;
}if(a.ctrlKey||a.altKey||Sys.Browser.agent==Sys.Browser.Safari){this._OnActivity(a);
return true;
}return false;
},updateDisplayValue:function(){if(this._isInitialized){if(this._focused){if((this.get_hideOnBlur()&&this.isEmpty())||this._displayParts){this._Visualise();
this._textBoxElement.select();
}if(this.get_resetCaretOnFocus()){this.resetCursor();
}}else{this._Visualise();
}}},updateHiddenValue:function(){return this._setHiddenValue(this.get_valueWithPromptAndLiterals());
},get_valueWithLiterals:function(){var a=[];
for(var b=0;
b<this._parts.length;
b++){a[b]=this._parts[b].ch||this._parts[b].GetValue();
}return a.join("");
},get_valueWithPromptAndLiterals:function(){return this._GetVisibleValues(this._parts);
},get_prompt:function(){var b=new RegExp(".","g");
var a=[];
for(var c=0;
c<this._parts.length;
c++){a[c]=this._parts[c].ch||this._parts[c].GetVisValue().replace(b,this.get_promptChar());
}return a.join("");
},get_displayValue:function(){var a=this._value;
while(a.length<this._displayLength){if(this.get_displayFormatPosition()){a=this.get_promptChar()+a;
}else{a+=this.get_promptChar();
}}this._UpdateDisplayPartsInRange(a,0,this._displayLength);
if(this._displayParts){return this._GetVisibleValues(this._displayParts);
}else{return this._GetVisibleValues(this._parts);
}},set_cursorPosition:function(b){if(!this._focused){return;
}this._calculateSelection();
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){this._textBoxElement.select();
sel=document.selection.createRange();
var a=this._textBoxElement.value.substr(0,b).split("\r\n").length-1;
sel.move("character",b-a);
sel.select();
}else{this._textBoxElement.selectionStart=b;
this._textBoxElement.selectionEnd=b;
}},get_value:function(){var a=[];
for(var b=0;
b<this._parts.length;
b++){a[b]=this._parts[b].GetValue();
}return a.join("");
},set_value:function(a){this._SetValue(a);
if(this._ValueHasChanged()){this.raise_valueChanged();
if(this.get_autoPostBack()&&!this.preventPostBackAfterBlur){this.raisePostBackEvent();
}}},get_promptChar:function(){return this._promptChar;
},set_promptChar:function(a){if(this._promptChar!=a){this._promptChar=a;
this.raisePropertyChanged("PromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayPromptChar:function(){return this._displayPromptChar;
},set_displayPromptChar:function(a){if(this._displayPromptChar!=a){this._displayPromptChar=a;
this.raisePropertyChanged("DisplayPromptChar");
}},get_displayFormatPosition:function(){return this._displayFormatPosition;
},set_displayFormatPosition:function(a){if(this._displayFormatPosition!=a){this._displayFormatPosition=a;
this.raisePropertyChanged("DisplayFormatPosition");
}},get_hideOnBlur:function(){return this._hideOnBlur;
},set_hideOnBlur:function(a){if(this._hideOnBlur!=a){this._hideOnBlur=a;
this.raisePropertyChanged("HideOnBlur");
}},get_resetCaretOnFocus:function(){return this._resetCaretOnFocus;
},set_resetCaretOnFocus:function(a){if(this._resetCaretOnFocus!=a){this._resetCaretOnFocus=a;
this.raisePropertyChanged("ResetCaretOnFocus");
}},get_roundNumericRanges:function(){return this._roundNumericRanges;
},set_roundNumericRanges:function(a){if(this._roundNumericRanges!=a){this._roundNumericRanges=a;
this.raisePropertyChanged("RoundNumericRanges");
}},get_allowEmptyEnumerations:function(){return this._allowEmptyEnumerations;
},set_allowEmptyEnumerations:function(a){if(this._allowEmptyEnumerations!=a){this._allowEmptyEnumerations=a;
this.raisePropertyChanged("AllowEmptyEnumerations");
}},get_readOnly:function(){return this._readOnly;
},set_readOnly:function(a){if(this._readOnly!=a){this._readOnly=a;
this.raisePropertyChanged("ReadOnly");
}},saveClientState:function(){return Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"saveClientState");
},_attachMouseEventHandlers:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"_attachMouseEventHandlers");
this._onTextBoxMouseDownDelegate=Function.createDelegate(this,this._onTextBoxMouseDownHandler);
if(!$telerik.isSafari){this._onTextBoxMouseUpDelegate=Function.createDelegate(this,this._onTextBoxMouseUpHandler);
$addHandler(this._textBoxElement,"mouseup",this._onTextBoxMouseUpDelegate);
}$addHandler(this._textBoxElement,"mousedown",this._onTextBoxMouseDownDelegate);
},_attachEventHandlers:function(){Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this,"_attachEventHandlers");
if(this._textBoxElement&&this._textBoxElement.form){this._onFormResetDelegate=Function.createDelegate(this,this._onFormResetHandler);
$addHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}if(Sys.Browser.agent==Sys.Browser.InternetExplorer){this._onTextBoxPasteDelegate=Function.createDelegate(this,this._onTextBoxPasteHandler);
this._onTextBoxPropertyChangeDelegate=Function.createDelegate(this,this._onTextBoxPropertyChangeHandler);
$addHandler(this._textBoxElement,"paste",this._onTextBoxPasteDelegate);
$addHandler(this._textBoxElement,"propertychange",this._onTextBoxPropertyChangeDelegate);
}else{this._onTextBoxInputDelegate=Function.createDelegate(this,this._onTextBoxInputHandler);
$addHandler(this._textBoxElement,"input",this._onTextBoxInputDelegate);
}if(Sys.Browser.agent==Sys.Browser.Opera){var b=this;
var a=function(){return b._ValueHandler({});
};
setInterval(a,10);
}},_SetValue:function(a){this._internalValueUpdate=true;
this._UpdatePartsInRange(a,0,this._length);
this._internalValueUpdate=false;
this._Visualise();
},_initializeHiddenElement:function(a){this._hiddenElement=$get(a+"_Value");
},_initializeValidationField:function(a){this._validationField=$get(a);
},_setValidationField:function(a){if(this.isEmpty()){this._validationField.value="";
}else{this._validationField.value=this.get_valueWithLiterals();
}},_getValidationField:function(a){return this._validationField;
},_onFormResetHandler:function(a){if(this._originalValue==null){this._originalValue="";
}this._setHiddenValue(this._originalValue);
this._SetValue(this._originalValue);
},_onTextBoxInputHandler:function(a){this._ValueHandler(a);
},_onMouseWheel:function(a){return this._OnMouseWheel(event);
},_onTextBoxPropertyChangeHandler:function(a){this._OnPropertyChange();
},_onTextBoxPasteHandler:function(b){if(this.get_readOnly()){return false;
}var a=this;
setTimeout(function(){a._FakeOnPropertyChange();
},1);
},_onTextBoxBlurHandler:function(a){this._focused=false;
this._hovered=false;
if(this._ValueHasChanged()){this.raise_valueChanged();
if(this.get_autoPostBack()){this.raisePostBackEvent();
this.preventPostBackAfterBlur=true;
}}this.raise_blur(Sys.EventArgs.Empty);
this.updateDisplayValue();
this.updateCssClass();
},_onTextBoxMouseUpHandler:function(a){this._FakeOnPropertyChange();
this._ValueHandler(a);
this._ActivityHandler(a);
if(($telerik.isSafari||$telerik.isFirefox)&&this._allowApplySelection){this._allowApplySelection=false;
this._updateSelectionOnFocus();
a.preventDefault();
a.stopPropagation();
}},_onTextBoxMouseDownHandler:function(a){this._FakeOnPropertyChange();
this._ActivityHandler(a);
},_onTextBoxFocusHandler:function(b){this._allowApplySelection=true;
this._focused=true;
this.updateDisplayValue();
this.updateCssClass();
this._updateSelectionOnFocus();
this._FakeOnPropertyChange();
this._ActivityHandler(b);
this.raise_focus(Sys.EventArgs.Empty);
if(($telerik.isSafari||$telerik.isFirefox)&&this.get_selectionOnFocus()!=Telerik.Web.UI.SelectionOnFocus.None&&this.get_selectionOnFocus()!=Telerik.Web.UI.SelectionOnFocus.SelectAll){var a=this;
window.setTimeout(function(){a._triggerDomEvent("mouseup",a._textBoxElement);
},1);
}},_onTextBoxKeyUpHandler:function(a){this._FakeOnPropertyChange();
},_OnActivity:function(a){this._calculateSelection();
this._lastState=new Telerik.Web.UI.MaskedEventWrap(a,this._textBoxElement);
},_OnPropertyChange:function(){if(this._internalValueUpdate){return;
}if(event.propertyName=="value"){var b=event;
var a=this;
var c=function(){a._ValueHandler(b);
};
this._calculateSelection();
if(this._textBoxElement.selectionStart>0||this._textBoxElement.selectionEnd>0){c();
}else{setTimeout(c,1);
}}},_onTextBoxMouseWheelHandler:function(b){if(this.get_readOnly()){return false;
}this._calculateSelection();
var a=this._partIndex[this._textBoxElement.selectionStart];
if(a==null){return true;
}return a.HandleWheel(b);
},_updateSelectionOnFocus:function(){switch(this.get_selectionOnFocus()){case 0:break;
case 1:var b=0;
var a;
for(a=0;
a<this._partIndex.length;
a++){if(!this._partIndex[a].ch){b=a;
break;
}}this.set_caretPosition(b);
break;
case 2:if(this._textBoxElement.value.length>0){this.set_caretPosition(this._textBoxElement.value.length);
}break;
case 3:this.selectAllText();
break;
default:this.set_caretPosition(0);
break;
}},_onTextBoxKeyDownHandler:function(f){if(f.keyCode==27&&!$telerik.isIE){var b=this;
window.setTimeout(function(){b.set_textBoxValue(b.get_editValue());
},0);
}this._FakeOnPropertyChange();
if(this.inSelection(f)){return true;
}var c=this._partIndex[this._textBoxElement.selectionStart];
if(this.get_readOnly()&&(f.keyCode==46||f.keyCode==8||f.keyCode==38||f.keyCode==40)){f.preventDefault();
return false;
}else{if(f.keyCode==13){return true;
}else{if(c==null&&f.keyCode!=8){return true;
}else{if(c!=null){if(c.HandleKey(f)){f.preventDefault();
return false;
}}}}}var d=this._textBoxElement.selectionEnd;
var a=false;
if((f.keyCode==46||f.keyCode==127)&&d<this._textBoxElement.value.length){c.SetValue("",this._textBoxElement.selectionStart);
d++;
a=true;
f.preventDefault();
}else{if(f.keyCode==8&&d){this._partIndex[this._textBoxElement.selectionStart-1].SetValue("",this._textBoxElement.selectionStart-1);
d--;
a=true;
f.preventDefault();
}}if(a){return this._UpdateAfterKeyHandled(f,d);
}this._OnActivity(f);
return true;
},_onTextBoxKeyPressHandler:function(f){if(this.get_readOnly()){f.preventDefault();
f.stopPropagation();
return false;
}var g=new Telerik.Web.UI.InputKeyPressEventArgs(f,f.charCode,String.fromCharCode(f.charCode));
this.raise_keyPress(g);
if(g.get_cancel()){f.stopPropagation();
f.preventDefault();
return false;
}if(this.inSelection(f)){return true;
}var a=this._partIndex[this._textBoxElement.selectionStart];
if(a==null){if(f.charCode==13){if(this._ValueHasChanged()){this.raise_valueChanged();
this.updateDisplayValue();
this.updateCssClass();
}if(this.get_autoPostBack()){this.raisePostBackEvent();
}return true;
}else{if(f.charCode>47){f.stopPropagation();
f.preventDefault();
}return false;
}}if(Sys.Browser.agent==Sys.Browser.Firefox||Sys.Browser.agent==Sys.Browser.Opera){if(f.charCode==8){f.preventDefault();
f.stopPropagation();
return false;
}if(f.charCode==9){return true;
}if(!f.rawEvent.which){this._OnActivity(f);
f.stopPropagation();
return true;
}}var d=this._textBoxElement.selectionEnd;
if(f.charCode==13){if(this._ValueHasChanged()){this.raise_valueChanged();
this.updateDisplayValue();
this.updateCssClass();
}if(this.get_autoPostBack()){this.raisePostBackEvent();
}return true;
}var c=String.fromCharCode(f.charCode);
if(a.CanHandle(c)){while(d<this._textBoxElement.value.length){if(this._partIndex[d].SetValue(c,d)){d++;
break;
}d++;
}}var b=this._UpdateAfterKeyHandled(f,d);
if(!b){f.preventDefault();
}f.stopPropagation();
return b;
},_OnEnumChanged:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_enumerationChanged(d);
},_OnMoveUp:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_moveUp(d);
},_OnMoveDown:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_moveDown(d);
},_OnValueChange:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raiseEvent("valueChanged",d);
},_OnChunkError:function(c,a,b){var d=new Telerik.Web.UI.MaskedTextBoxEventArgs(b,a,c);
this.raise_error(d);
},_fixAbsolutePositioning:function(){var b=this._textBoxElement;
if(b.previousSibling&&b.previousSibling.tagName.toLowerCase()=="label"&&b.style.position=="absolute"){b.style.position="static";
var a=b.parentNode;
a.style.position="absolute";
a.style.top=b.style.top;
a.style.left=b.style.left;
}},_RecordInitialState:function(){this.initialFieldValue=this._textBoxElement.value;
},_PartAt:function(a){return this._partIndex[a];
},_CreatePartCollection:function(e,c){var f;
var a=[];
var g=0;
for(var d=0;
d<e.length;
d++){f=e[d];
f.PromptChar=c;
f.SetController(this);
f.index=this._parts.length;
a[a.length]=f;
if(a.length>1){a[a.length-2].NextChunk=f;
}f.NextChunk=null;
var b=f.GetLength();
f.offset=g;
g+=b;
}return a;
},_setMask:function(b){this._parts=this._CreatePartCollection(b,this.get_promptChar());
for(var c=0;
c<this._parts.length;
c++){var d=this._parts[c].GetLength();
for(var a=this._length;
a<this._length+d;
a++){this._partIndex[a]=this._parts[c];
}this._length+=d;
}},_setDisplayMask:function(c){this._displayParts=this._CreatePartCollection(c,this.get_displayPromptChar());
for(var d=0;
d<this._displayParts.length;
d++){var a=this._displayParts[d];
var e=a.GetLength();
if(a.ch){continue;
}for(var b=this._displayLength;
b<this._displayLength+e;
b++){this._displayPartIndex[b]=this._displayParts[d];
}this._displayLength+=e;
}},_SafariSelectionFix:function(b){var a=this._StrCompare(this._lastState.fieldValue,b.fieldValue);
b._selectionStart=a[0];
b._selectionEnd=a[0];
this._lastState._selectionStart=a[1];
this._lastState._selectionEnd=a[2];
},_HandleValueChange:function(h){if(this.get_readOnly()){this._Visualise();
return false;
}if(this._lastState==null){return;
}var g,d;
if(!$telerik.isSafari2&&$telerik.isSafari){this._SafariSelectionFix(h);
}if(this._lastState.fieldValue.length>h.fieldValue.length){if(h._selectionStart==this._textBoxElement.value.length){this._partIndex[this._partIndex.length-1].SetValue("",this._partIndex.length-1);
}if(this._lastState._selectionEnd>h._selectionStart){g=this._lastState._selectionEnd;
while(g-->h._selectionStart){this._partIndex[g].SetValue("",g);
}}else{g=this._lastState._selectionEnd+1;
while(g-->h._selectionStart){this._partIndex[g].SetValue("",g);
h._selectionEnd++;
}}}var f=this._lastState._selectionStart;
var c=Math.min(h._selectionStart,this._length);
var b=h.fieldValue.substr(f,c-f);
var a=this._UpdatePartsInRange(b,f,c);
h._selectionEnd+=a;
this._FixSelection(h);
},_SetPartValues:function(k,f,e,d,h){var c;
var a=0;
var b=d;
var g=0;
e=e.toString();
while(a<h-d&&b<f){c=e.charAt(a);
if(c==this.get_promptChar()){c="";
}if(k[b].SetValue(c,b)){a++;
}else{g++;
}b++;
}return g;
},_UpdateDisplayPartsInRange:function(b,a,c){this._SetPartValues(this._displayPartIndex,this._displayLength,b,a,c);
},_UpdatePartsInRange:function(b,a,c){var d=this._SetPartValues(this._partIndex,this._length,b,a,c);
this._Visualise();
return d;
},_FixSelection:function(a){this.set_cursorPosition(a._selectionEnd);
},_GetVisibleValues:function(b){var a=[];
for(var c=0;
c<b.length;
c++){a[c]=b[c].GetVisValue();
}return a.join("");
},_Visualise:function(){var b=this.get_valueWithPromptAndLiterals();
var a=this.get_value();
this._internalValueUpdate=true;
this._Render(b);
this.updateCssClass();
this._value=a;
this.updateHiddenValue();
this._internalValueUpdate=false;
this._projectedValue=this._textBoxElement.value;
},_Render:function(a){this._isEmptyMessage=false;
if(!this._focused){if(this.get_hideOnBlur()&&this.isEmpty()){this._isEmptyMessage=true;
this.set_textBoxValue(this.get_emptyMessage());
}else{if(this._displayParts&&this._displayParts.length){this.set_textBoxValue(this.get_displayValue());
}else{this.set_textBoxValue(a);
}}}else{this.set_textBoxValue(a);
}},_getResetValue:function(){var a="";
var b=this._parts[0];
while(b.NextChunk){if(b.GetVisValue()==b.GetValue()){a+=b.PromptChar;
}else{a+=b.GetVisValue();
}b=b.NextChunk;
}return a;
},_ValueHasChanged:function(){return this._textBoxElement.value!=this._textBoxElement._oldValue;
},_FakeOnPropertyChange:function(){if(document.createEventObject){if(event){var a=document.createEventObject(event);
}else{var a=document.createEventObject();
}a.propertyName="value";
this._textBoxElement.fireEvent("onpropertychange",a);
}},_UpdateAfterKeyHandled:function(b,a){this._Visualise();
var c=new Telerik.Web.UI.MaskedEventWrap(b,this._textBoxElement);
c._selectionEnd=a;
this._FixSelection(c);
return false;
},_ValueHandler:function(b){if(this._internalValueUpdate){return true;
}if(!b){b=window.event;
}this._calculateSelection();
var a=new Telerik.Web.UI.MaskedEventWrap(b,this._textBoxElement);
if(a.fieldValue!=this._projectedValue){this._HandleValueChange(a);
}return true;
},_ActivityHandler:function(a){if(this._internalValueUpdate){return true;
}if(!a){a=window.event;
}this._OnActivity(a);
return true;
},_calculateSelection:function(){if((document.selection&&Sys.Browser.agent!=Sys.Browser.Opera)&&(typeof window.getSelection=="undefined")){var a;
try{a=document.selection.createRange();
}catch(c){return;
}if(a.parentElement()!=this._textBoxElement){return;
}var b=a.duplicate();
if(this._isTextarea){b.moveToElementText(this._textBoxElement);
}else{b.move("character",-this._textBoxElement.value.length);
}b.setEndPoint("EndToStart",a);
this._textBoxElement.selectionStart=b.text.length;
this._textBoxElement.selectionEnd=this._textBoxElement.selectionStart+a.text.length;
if(this._isTextarea){}}},_StrCompare:function(b,f){var d;
var e,c,a;
d=0;
while(b.charAt(d)==f.charAt(d)&&d<b.length){d++;
}c=d;
b=b.substr(c).split("").reverse().join("");
f=f.substr(c).split("").reverse().join("");
d=0;
while(b.charAt(d)==f.charAt(d)&&d<b.length){d++;
}e=c+f.length-d;
a=b.length-d+c;
return[e,c,a];
},get__initialMasks:function(){return this._initialMasks;
},set__initialMasks:function(a){this._initialMasks=a;
},get__initialDisplayMasks:function(){return this._initialDisplayMasks;
},set__initialDisplayMasks:function(a){this._initialDisplayMasks=a;
},raise_valueChanged:function(){this._triggerDomEvent("change",this._getValidationField());
var a=this._textBoxElement._oldValue;
this._textBoxElement._oldValue=this._textBoxElement.value;
this._OnValueChange(null,a,this._textBoxElement.value);
}};
Telerik.Web.UI.RadMaskedTextBox.registerClass("Telerik.Web.UI.RadMaskedTextBox",Telerik.Web.UI.RadInputControl);

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();