﻿Type.registerNamespace("Telerik.Web.UI");
Type.registerNamespace("Telerik.Web.UI.NumberFormat");
NumberFormat=Telerik.Web.UI.NumberFormat=function(){};
NumberFormat=Telerik.Web.UI.NumberFormat.Round=function(e,k){if(!k.get_numberFormat().AllowRounding){var h=k.get_numberFormat().DecimalDigits;
if(h==0&&e.toString().indexOf(".")!=-1){return e.toString().substr(0,e.toString().indexOf(".")+1);
}else{if(h>0&&e.toString().indexOf(".")!=-1){var f=e.toString().split(".");
if(f[1].length>h){return parseFloat(f[0]+"."+f[1].substr(0,h));
}else{return e;
}}else{return e;
}}}if(e.toString().indexOf("e")>-1){var b=Math.pow(10,k.get_numberFormat().DecimalDigits);
return Math.round(e*b)/b;
}else{if(e.toString().indexOf(".")>-1){var f=e.toString().split(".");
var d=Math.abs(parseInt(f[0]));
var o=parseFloat("0."+f[1]);
var m=f[1].length;
var p=f[0].charAt(0)=="-"?-1:1;
if(f[1].length<=k.get_numberFormat().DecimalDigits){return e;
}var c=o*Math.pow(10,m);
if(c.toString().length>k.get_numberFormat().DecimalDigits+1){var l=0;
var g=f[1];
while(g.indexOf("0")==0){l++;
g=g.substr(1);
}c=parseInt(c.toString().substr(0,k.get_numberFormat().DecimalDigits+1));
m=c.toString().length+l;
}for(var j=1;
j<=m;
j++){if(j<=m-k.get_numberFormat().DecimalDigits){c=Math.round(c/10);
}else{c/=10;
}}if(c.toString().indexOf(".")>-1){var a=c.toString().split(".")[1].length;
if(a>k.get_numberFormat().DecimalDigits){var b=Math.pow(10,k.get_numberFormat().DecimalDigits);
c=Math.round(c*b)/b;
}}var n=p*(d+c);
if(k.get_numberFormat().DecimalDigits>0&&n.toString().indexOf(".")!=-1&&n.toString().split(".")[1].length>k.get_numberFormat().DecimalDigits){return p*(parseFloat(d+"."+c.toString().substr(2)));
}else{return n;
}}else{return e;
}}};
NumberFormat=Telerik.Web.UI.NumberFormat.SplitGroups=function(c,b,a){var d=c.toString().split("");
if(b>0){for(var e=d.length-b;
e>0;
e-=b){d.splice(e,0,a);
}}return d.join("");
};
NumberFormat=Telerik.Web.UI.NumberFormat.Parse=function(a,b,d,c){return parseFloat(a.toString().replace(b,"").replace(d,".").replace(c,"-"));
};
NumberFormat=Telerik.Web.UI.NumberFormat.ParseExact=function(e,p,b,j,o,g,c){if(!e){return"";
}var k=null;
var n=null;
var l=Telerik.Web.UI.NumberFormat.ReplaceN(b,"",c).replace(p,"");
var f=Telerik.Web.UI.NumberFormat.ReplaceN(j,"",c).replace(p,"");
n=e.toString().replace(p,"");
if(n==l){k=true;
}else{if(n==f){k=false;
}else{return"";
}}var m=Telerik.Web.UI.NumberFormat.ReplaceN(b,"1",c).split("1");
var d=Telerik.Web.UI.NumberFormat.ReplaceN(j,"1",c).split("1");
var h;
for(h in m){e=e.toString().replace(m[h],"");
}for(h in d){e=e.toString().replace(d[h],"");
}var a=Telerik.Web.UI.NumberFormat.Parse(e,o,g,c);
if(k&&!isNaN(a)){a=a*(-1);
}return a;
};
NumberFormat=Telerik.Web.UI.NumberFormat.Pad=function(b,a,c){while(b.toString().length<a){b=b.toString()+c.toString();
}return b;
};
NumberFormat=Telerik.Web.UI.NumberFormat.Format=function(a,c){var d=parseFloat(a.toString().replace(c.get_numberFormat().DecimalSeparator,"."));
if(isNaN(d)){return"";
}var e="";
d=this.Round(d,c);
var f=Math.abs(d).toString().split(".");
e+=this.SplitGroups(f[0],c.get_numberFormat().GroupSizes,c.get_numberFormat().GroupSeparator);
if((!c.get_numberFormat().AllowRounding)&&(f[1])){e+=c.get_numberFormat().DecimalSeparator+f[1];
}else{if(!c.get_numberFormat().AllowRounding){e=e;
}else{if(f[1]){e+=c.get_numberFormat().DecimalSeparator+this.Pad(f[1],c.get_numberFormat().DecimalDigits,"0");
}else{if(c.get_numberFormat().DecimalDigits>0){e+=c.get_numberFormat().DecimalSeparator+this.Pad("",c.get_numberFormat().DecimalDigits,"0");
}}}}var b=d<0?c.get_numberFormat().NegativePattern:c.get_numberFormat().PositivePattern;
return Telerik.Web.UI.NumberFormat.ReplaceN(b,e.toString(),c.get_numberFormat().NegativeSign);
};
NumberFormat=Telerik.Web.UI.NumberFormat.ReplaceN=function(a,c,e){var f=e+"n";
var d="n"+e;
var b=0;
var g=(-1);
if(a.indexOf(f)!=(-1)){g=a.indexOf(f);
b=1;
}else{if(a.indexOf(d)!=(-1)){g=a.indexOf(d);
b=0;
}else{g=a.indexOf("n ");
b=0;
if((g==(-1))||((g>0)&&a[g-1]!=(e))){g=a.indexOf(" n");
b=1;
if((g==(-1))||(g!=(a.Length-2))){g=a.indexOf(" n ");
b=1;
}}if((g==(-1))){g=a.indexOf("n");
b=0;
}}}a=a.substring(0,g+b)+c+a.substring(g+b+1,a.length);
return a;
};
NumberFormat=Telerik.Web.UI.NumberFormat.ReturnZeroIfEmpty=function(a){if((a==null)||(a=="")||isNaN(a)){return 0;
}return a;
};
Type.registerNamespace("Telerik.Web.UI");
$telerik.findNumericTextBox=$find;
$telerik.toNumericTextBox=function(a){return a;
};
Telerik.Web.UI.RadNumericTextBox=function(a){Telerik.Web.UI.RadNumericTextBox.initializeBase(this,[a]);
this._showSpinButtons=false;
this._maxValue=70368744177664;
this._minValue=-70368744177664;
this._numberFormat=null;
this._originalValue="";
this._incrementSettings=null;
this._holdsValidNumericValue=true;
this._allowOutOfRangeAutoCorrect=true;
this._isIncrementing=false;
this._hold=false;
this._selectionOnFocus=Telerik.Web.UI.SelectionOnFocus.SelectAll;
this._onButtonUpMouseDownDelegate=null;
this._onButtonDownMouseDownDelegate=null;
this._onButtonUpMouseUpDelegate=null;
this._onButtonDownMouseUpDelegate=null;
this._onSpinMouseOutDelegate=null;
this._onFormResetDelegate=null;
};
Telerik.Web.UI.RadNumericTextBox.prototype={initialize:function(){Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"initialize");
this._compileRegEx();
if(this._textBoxElement&&this._textBoxElement.form){this._onFormResetDelegate=Function.createDelegate(this,this._onFormResetHandler);
$addHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}if((this._initialValue!="")&&(!this.get_numberFormat().KeepNotRoundedValue)){this._hiddenElement.value=Telerik.Web.UI.NumberFormat.Round(this._initialValue,this);
}else{if((this._initialValue!="")&&(this.get_numberFormat().KeepNotRoundedValue)){this._hiddenElement.value=this._initialValue;
}}},dispose:function(){if(this.SpinUpButton){if(this._onButtonUpMouseDownDelegate){$removeHandler(this.SpinUpButton,"mousedown",this._onButtonUpMouseDownDelegate);
this._onButtonUpMouseDownDelegate=null;
}if(this._onButtonUpMouseUpDelegate){$removeHandler(this.SpinUpButton,"mouseup",this._onButtonUpMouseUpDelegate);
this._onButtonUpMouseUpDelegate=null;
}if(this._onSpinMouseOutDelegate){$removeHandler(this.SpinUpButton,"mouseout",this._onSpinMouseOutDelegate);
this._onSpinMouseOutDelegate=null;
}}if(this.SpinDownButton){if(this._onButtonDownMouseDownDelegate){$removeHandler(this.SpinDownButton,"mousedown",this._onButtonDownMouseDownDelegate);
this._onButtonDownMouseDownDelegate=null;
}if(this._onButtonDownMouseUpDelegate){$removeHandler(this.SpinDownButton,"mouseup",this._onButtonDownMouseUpDelegate);
this._onButtonDownMouseUpDelegate=null;
}if(this._onSpinMouseOutDelegate){$removeHandler(this.SpinDownButton,"mouseout",this._onSpinMouseOutDelegate);
this._onSpinMouseOutDelegate=null;
}}if(this._onFormResetDelegate){if(this._textBoxElement.form){$removeHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
}this._onFormResetDelegate=null;
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"dispose");
},isNegative:function(){return this.get_value()<0;
},get_value:function(){var a=parseFloat(this._hiddenElement.value);
if(isNaN(a)){a="";
}return a;
},set_value:function(a){this._holdsValidNumericValue=true;
if(typeof(a)=="string"&&a!=""){a=Telerik.Web.UI.NumberFormat.Parse(a,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}if(typeof(a)=="number"&&(a<this.get_minValue()||a>this.get_maxValue())){var b=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,a,null,null);
this.raise_error(b);
}if(!this.get_allowOutOfRangeAutoCorrect()&&!this._isIncrementing){this.set_textBoxValue(a);
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"set_value",[a]);
},get_displayValue:function(){return Telerik.Web.UI.NumberFormat.Format(this._getParsedTextBoxValue(),this);
},get_editValue:function(){var c=this.get_value();
if(this.get_numberFormat().KeepTrailingZerosOnFocus&&typeof(c)=="number"){var b=c.toString();
if(b.indexOf(".")==-1){c=c.toFixed(this.get_numberFormat().DecimalDigits);
}else{if(b.substr(b.indexOf(".")+1).length<this.get_numberFormat().DecimalDigits){c=c.toFixed(this.get_numberFormat().DecimalDigits);
}}}var a=c.toString().replace(".",this.get_numberFormat().DecimalSeparator);
return a.replace("-",this.get_numberFormat().NegativeSign);
},get_showSpinButtons:function(){return this._showSpinButtons;
},set_showSpinButtons:function(a){if(this._showSpinButtons!==a){this._showSpinButtons=a;
this.raisePropertyChanged("ShowSpinButtons");
}},get_maxValue:function(){return this._maxValue;
},set_maxValue:function(a){if(this._maxValue!==a){this._maxValue=a;
this.updateClientState();
this.raisePropertyChanged("maxValue");
}},get_minValue:function(){return this._minValue;
},set_minValue:function(a){if(this._minValue!==a){this._minValue=a;
this.updateClientState();
this.raisePropertyChanged("minValue");
}},get_numberFormat:function(){return this._numberFormat;
},set_numberFormat:function(a){this._numberFormat=a;
},get_incrementSettings:function(){return this._incrementSettings;
},set_incrementSettings:function(a){if(this._incrementSettings!==a){this._incrementSettings=a;
this.raisePropertyChanged("IncrementSettings");
}},get_allowOutOfRangeAutoCorrect:function(){return this._allowOutOfRangeAutoCorrect;
},set_allowOutOfRangeAutoCorrect:function(a){this._allowOutOfRangeAutoCorrect=a;
},saveClientState:function(){var a=["minValue","maxValue"];
return Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"saveClientState",[a]);
},_getParsedTextBoxValue:function(){var a=Telerik.Web.UI.NumberFormat.Parse(this.get_textBoxValue(),this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
a=Math.max(this.get_minValue(),a);
a=Math.min(this.get_maxValue(),a);
return a;
},_compileRegEx:function(){var a=this.get_numberFormat().DecimalSeparator=="."?"\\.":this.get_numberFormat().DecimalSeparator;
this._acceptRegExp=new RegExp("[0-9"+a+this.get_numberFormat().NegativeSign+"]{1}");
this._rejectRegExp=new RegExp("[^0-9"+a+this.get_numberFormat().NegativeSign+"]{1}","g");
this._decimalReplaceRegExp=new RegExp(a,"g");
},_onFormResetHandler:function(a){if(this._originalValue==null){this._originalValue="";
}this._setHiddenValue(Telerik.Web.UI.NumberFormat.Round(this._originalValue,this));
this.updateDisplayValue();
},_onTextBoxKeyDownHandler:function(a){if(!this.get_incrementSettings().InterceptArrowKeys){return;
}if(a.altKey||a.ctrlKey){return true;
}if(a.keyCode==38){this._move(this.get_incrementSettings().Step,false);
}else{if(a.keyCode==40){this._move(-this.get_incrementSettings().Step,false);
}else{if(a.keyCode==110&&this.get_numberFormat().DecimalSeparator!=this.get_numberFormat().CultureNativeDecimalSeparator){this._numPadDecimalSeparatorPressed=true;
a.preventDefault();
a.stopPropagation();
this._triggerDecimalSeparatorPressedEvent(this._textBoxElement);
}}}},_triggerDecimalSeparatorPressedEvent:function(c){this._fakeKeyPressEventTriggered=true;
var a=this.get_numberFormat().DecimalSeparator.charCodeAt(0);
if(c.fireEvent&&document.createEventObject){var b=document.createEventObject();
b.keyCode=a;
c.fireEvent("onkeypress",b);
}else{if(c.dispatchEvent){var b=document.createEvent("KeyboardEvent");
b.initKeyEvent("keypress",true,true,null,false,false,false,false,0,a);
c.dispatchEvent(b);
}}},_handleWheel:function(a){if(!this.get_incrementSettings().InterceptMouseWheel){return;
}this._calculateSelection();
if(a){this._move(-this.get_incrementSettings().Step,false);
}else{this._move(this.get_incrementSettings().Step,false);
}this._applySelection();
},_onTextBoxKeyPressHandler:function(i){var b=String.fromCharCode(i.charCode);
if(i.charCode==46&&this._numPadDecimalSeparatorPressed&&b!=this.get_numberFormat().DecimalSeparator){i.preventDefault();
i.stopPropagation();
return;
}if(i.altKey||i.ctrlKey){return true;
}var h=new Telerik.Web.UI.InputKeyPressEventArgs(i,i.charCode,String.fromCharCode(i.charCode));
this.raise_keyPress(h);
if(h.get_cancel()){i.stopPropagation();
i.preventDefault();
return false;
}if(i.charCode==13){var l=this.get_textBoxValue();
if(this._initialValue.toString()!==l.toString()){this.set_value(l);
}else{this.updateDisplayValue();
this.updateCssClass();
}if(this.get_autoPostBack()&&this._initialValue.toString()==l.toString()){this._isEnterPressed=true;
this.raisePostBackEvent();
}return true;
}if(!i.charCode||i.charCode==8||i.charCode==9||i.charCode==27){return true;
}var a=this.get_textBoxValue();
if(!this._isNormalChar(i)){return true;
}if(!b.match(this._acceptRegExp)){var c=$telerik.isOpera&&(i.charCode==35||i.charCode==36);
if(!c){var h=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,a,i.charCode,b);
this.raise_error(h);
i.stopPropagation();
i.preventDefault();
return false;
}}var k=false;
if(b==this.get_numberFormat().NegativeSign){this._calculateSelection();
var k=(this._selectionStart!=0);
k=k||(a.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0));
}else{if(!isNaN(parseInt(b,10))&&a.indexOf(this.get_numberFormat().NegativeSign)!=-1&&this.get_caretPosition()==0){k=true;
}}if(k){var h=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,a,i.charCode,b);
this.raise_error(h);
i.stopPropagation();
i.preventDefault();
return false;
}if(b==this.get_numberFormat().DecimalSeparator){this._calculateSelection();
var f=a.substr(0,this._selectionStart);
var d=a.substr(this._selectionStart,this._selectionEnd-this._selectionStart);
var j=a.substr(this._selectionEnd,a.length-1);
if(f.match(this._decimalReplaceRegExp)){this._selectionStart--;
this._selectionEnd--;
}else{if(d.match(this._decimalReplaceRegExp)){this._selectionEnd--;
}}a=a.replace(this._decimalReplaceRegExp,"");
if(d.length==a.length){this.set_textBoxValue("");
}else{if(f.indexOf(this.get_numberFormat().DecimalSeparator)!=-1||j.indexOf(this.get_numberFormat().DecimalSeparator)!=-1){this.set_textBoxValue(f.replace(this._decimalReplaceRegExp,"")+this.get_numberFormat().DecimalSeparator+j.replace(this._decimalReplaceRegExp,""));
i.preventDefault();
this.set_caretPosition(f.length+1);
}}if(this._fakeKeyPressEventTriggered){this._fakeKeyPressEventTriggered=false;
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){var g=document.selection.createRange();
if(g.parentElement()==this._textBoxElement){g.text=b;
}}}}},_moveUp:function(){return this._move(this.get_incrementSettings().Step,true);
},_moveDown:function(){return this._move(-this.get_incrementSettings().Step,true);
},_move:function(c,b){if(this.isReadOnly()){return false;
}var a=this.get_value();
if(!a){a=0;
}a=a+c;
if(this._originalMaxLength>0&&a.toString().length>this._originalMaxLength){return false;
}this._isIncrementing=true;
if(!b){this._SetValue(a);
}else{this.set_value(a);
}this._isIncrementing=false;
return true;
},_initializeButtons:function(){this._onButtonUpMouseDownDelegate=Function.createDelegate(this,this._onButtonUpMouseDownHandler);
this._onButtonDownMouseDownDelegate=Function.createDelegate(this,this._onButtonDownMouseDownHandler);
this._onButtonUpMouseUpDelegate=Function.createDelegate(this,this._onButtonUpMouseUpHandler);
this._onButtonDownMouseUpDelegate=Function.createDelegate(this,this._onButtonDownMouseUpHandler);
this._onSpinMouseOutDelegate=Function.createDelegate(this,this._onSpinMouseOutHandler);
this.SpinUpButton=null;
this.SpinDownButton=null;
this.Button=null;
var c=$get(this._wrapperElementID);
var b=c.getElementsByTagName("a");
var a;
for(a=0;
a<b.length;
a++){if(b[a].className.indexOf("riDown")!=(-1)){this.SpinDownButton=b[a];
}else{if(b[a].className.indexOf("riUp")!=(-1)){this.SpinUpButton=b[a];
}}}if(this.get_showSpinButtons()){$addHandler(this.SpinUpButton,"mousedown",this._onButtonUpMouseDownDelegate);
$addHandler(this.SpinDownButton,"mousedown",this._onButtonDownMouseDownDelegate);
$addHandler(this.SpinUpButton,"mouseup",this._onButtonUpMouseUpDelegate);
$addHandler(this.SpinDownButton,"mouseup",this._onButtonDownMouseUpDelegate);
$addHandler(this.SpinUpButton,"mouseout",this._onSpinMouseOutDelegate);
$addHandler(this.SpinDownButton,"mouseout",this._onSpinMouseOutDelegate);
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_initializeButtons");
},_onSpinMouseOutHandler:function(a){this._hold=false;
},_onButtonUpMouseDownHandler:function(a){var b=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveUpButton);
this.raise_buttonClick(b);
if(b.get_cancel()){return false;
}this._hold=true;
this._repeatedMoveUp(300);
},_onButtonDownMouseDownHandler:function(a){var b=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveDownButton);
this.raise_buttonClick(b);
if(b.get_cancel()){return false;
}this._hold=true;
this._repeatedMoveDown(300);
},_repeatedMoveUp:function(d){if(this._hold==false){return;
}var c=this;
var a=d;
if(a>50){a-=40;
}var b=function(){c._repeatedMoveUp(a);
};
c._moveUp();
if(!this.get_autoPostBack()){window.setTimeout(b,d);
}},_repeatedMoveDown:function(d){if(this._hold==false){return;
}var c=this;
var a=d;
if(a>50){a-=40;
}var b=function(){c._repeatedMoveDown(a);
};
c._moveDown();
if(!this.get_autoPostBack()){window.setTimeout(b,d);
}},_onButtonUpMouseUpHandler:function(a){this._hold=false;
this.SpinUpButton.blur();
},_onButtonDownMouseUpHandler:function(a){this._hold=false;
this.SpinDownButton.blur();
},_SetValue:function(a){if(a<this.get_minValue()||a>this.get_maxValue()){var b=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,a,null,null);
this.raise_error(b);
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[a]);
},_setHiddenValue:function(a){if(a==null){a="";
}if(typeof(a)!="number"){a=Telerik.Web.UI.NumberFormat.Parse(a,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}if(!this.get_allowOutOfRangeAutoCorrect()&&(a<this.get_minValue()||a>this.get_maxValue())){if(!this._isIncrementing){return this._invalidate();
}else{return false;
}}a=Math.max(this.get_minValue(),a);
a=Math.min(this.get_maxValue(),a);
if(!this.get_numberFormat().KeepNotRoundedValue){a=Telerik.Web.UI.NumberFormat.Round(a,this);
}if(isNaN(a)){a="";
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_setHiddenValue",[a]);
},_invalidate:function(){this._holdsValidNumericValue=false;
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_clearHiddenValue");
return false;
},updateDisplayValue:function(){if(!this._holdsValidNumericValue&&this._focused){this._holdsValidNumericValue=true;
}else{Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"updateDisplayValue");
}},updateCssClass:function(a){if(!this._holdsValidNumericValue&&!a){this._textBoxElement.style.cssText=this._originalTextBoxCssText+this.updateCssText(this.get_styles()["InvalidStyle"][0]);
this._textBoxElement.className=this.get_styles()["InvalidStyle"][1];
}else{Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"updateCssClass");
}},_initializeHiddenElement:function(a){this._hiddenElement=$get(a+"_Value");
},_initializeValidationField:function(a){this._validationField=$get(a);
},_setValidationField:function(a){this._validationField.value=a.toString().replace(".",this.get_numberFormat().DecimalSeparator);
},_getValidationField:function(a){return this._validationField;
}};
Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();