var NumberFormat={};
NumberFormat.Round=function(_1,_2){
var _3=Math.pow(10,_2);
return Math.round(_1*_3)/_3;
};
NumberFormat.SplitGroups=function(_4,_5,_6){
var sb=_4.toString().split("");
for(var i=sb.length-_5;i>0;i-=_5){
sb.splice(i,0,_6);
}
return sb.join("");
};
NumberFormat.Parse=function(_9,_a,_b,_c){
return parseFloat(_9.toString().replace(_a,"").replace(_b,".").replace(_c,"-"));
};
NumberFormat.Pad=function(_d,_e,_f){
while(_d.toString().length<_e){
_d=_d.toString()+_f.toString();
}
return _d;
};
NumberFormat.Format=function(_10,_11){
var num=parseFloat(_10.toString().replace(_11.NumberFormat.DecimalSeparator,"."));
if(isNaN(num)){
return "";
}
var _13="";
num=this.Round(num,_11.NumberFormat.DecimalDigits);
var _14=Math.abs(num).toString().split(".");
_13+=this.SplitGroups(_14[0],_11.NumberFormat.GroupSizes,_11.NumberFormat.GroupSeparator);
if(_14[1]){
_13+=_11.NumberFormat.DecimalSeparator+this.Pad(_14[1],_11.NumberFormat.DecimalDigits,"0");
}
var _15=num<0?_11.NumberFormat.NegativePattern:_11.NumberFormat.PositivePattern;
return _15.replace("n",_13);
};
NumberFormat.ReturnZeroIfEmpty=function(_16){
if((_16==null)||(_16=="")||isNaN(_16)){
return 0;
}
return _16;
};;function RadNumericTextBox(id,_2,_3){
RadTextBox.Extend(this);
this.CallBase("DisposeOldInstance",arguments);
this.Constructor(id);
this.Initialize(_2,_3);
}
RadNumericTextBox.prototype={Constructor:function(id){
this.CallBase("Constructor",arguments);
},Initialize:function(_5,_6){
this.CallBase("Initialize",arguments);
this.CompileRegEx();
this.Step=1;
this.Hold=false;
},CompileRegEx:function(){
var _7=this.NumberFormat.DecimalSeparator=="."?"\\.":this.NumberFormat.DecimalSeparator;
this.AcceptRegExp=new RegExp("[0-9"+_7+this.NumberFormat.NegativeSign+"]{1}");
this.RejectRegExp=new RegExp("[^0-9"+_7+this.NumberFormat.NegativeSign+"]{1}","g");
this.DecimalReplaceRegExp=new RegExp(_7,"g");
},GetParsedTextBoxValue:function(){
var _8=NumberFormat.Parse(this.GetTextBoxValue(),this.RejectRegExp,this.NumberFormat.DecimalSeparator,this.NumberFormat.NegativeSign);
_8=Math.max(this.MinValue,_8);
_8=Math.min(this.MaxValue,_8);
return _8;
},AttachEventHandlers:function(){
this.CallBase("AttachEventHandlers",arguments);
this.AttachToTextBoxEvent("keydown","TextBoxKeyDownHandler");
this.AttachToTextBoxEvent("keyup","TextBoxKeyUpHandler");
},TextBoxKeyDownHandler:function(e){
if(e.altKey||e.ctrlKey){
return true;
}
var _a=/MSIE/.test(navigator.userAgent);
var _b=_a?e.keyCode:e.which;
if(_b==38){
this.MoveUpDownInProgress=true;
this.MoveUp();
}
if(_b==40){
this.MoveUpDownInProgress=true;
this.MoveDown();
}
},DelayValueChangedEvent:function(){
var _c=this.CallBase("DelayValueChangedEvent",arguments);
return _c||(this.MoveUpDownInProgress==true);
},TextBoxKeyUpHandler:function(e){
this.MoveUpDownInProgress=false;
},HandleWheel:function(_e){
this.CalculateSelection();
if(_e){
this.MoveDown();
}else{
this.MoveUp();
}
this.ApplySelection();
},TextBoxKeyPressHandler:function(e){
if(e.altKey||e.ctrlKey){
return true;
}
this.UpdateHiddenValueOnKeyPress();
var _10=/MSIE/.test(navigator.userAgent);
var _11=_10?e.keyCode:e.which;
if(!_11||_11==8){
return true;
}
if(_11==13){
this.Blur();
return true;
}
var _12=this.GetTextBoxValue();
var _13=String.fromCharCode(_11);
if(!_13.match(this.AcceptRegExp)){
var _14={Reason:RadInputErrorReason.ParseError,InputText:_12,KeyCode:_11,KeyCharacter:_13};
this.RaiseErrorEvent(_14);
RadControlsNamespace.DomEvent.PreventDefault(e);
return false;
}
if(_13==this.NumberFormat.NegativeSign){
this.CalculateSelection();
var _15=(this.SelectionStart!=0);
_15=_15||(_12.indexOf(this.NumberFormat.NegativeSign)==0&&(this.SelectionStart==0&&this.SelectionEnd==0));
if(_15){
var _14={Reason:RadInputErrorReason.ParseError,InputText:_12,KeyCode:_11,KeyCharacter:_13};
this.RaiseErrorEvent(_14);
return RadControlsNamespace.DomEvent.PreventDefault(e);
}
}
if(_13==this.NumberFormat.DecimalSeparator){
var _16=_12.substr(0,this.SelectionStart);
var _17=_12.substr(this.SelectionStart,this.SelectionEnd-this.SelectionStart);
if(_16.match(this.DecimalReplaceRegExp)){
this.SelectionStart--;
this.SelectionEnd--;
}else{
if(_17.match(this.DecimalReplaceRegExp)){
this.SelectionEnd--;
}
}
this.SetTextBoxValue(_12.replace(this.DecimalReplaceRegExp,""));
}
},MoveUp:function(){
return this.Move(this.Step);
},MoveDown:function(){
return this.Move(-this.Step);
},Move:function(_18){
var _19=this.GetValue();
_19=_19+_18;
_19=_19.toString().replace(".",this.NumberFormat.DecimalSeparator);
this.SetValue(_19.replace("-",this.NumberFormat.NegativeSign));
return true;
},InitializeButtons:function(){
this.SpinUpButton=null;
this.SpinDownButton=null;
this.Button=null;
var _1a=document.getElementById(this.WrapperElementID);
var _1b=_1a.getElementsByTagName("span");
var i;
for(i=0;i<_1b.length;i++){
if(_1b[i].className.indexOf("radSpinDownCss")!=(-1)){
this.SpinDownButton=_1b[i];
}else{
if(_1b[i].className.indexOf("radSpinUpCss")!=(-1)){
this.SpinUpButton=_1b[i];
}
}
}
if(this.ShowSpinButtons){
this.AttachDomEvent(this.SpinUpButton,"mousedown","ButtonUpMouseDownHandler");
this.AttachDomEvent(this.SpinDownButton,"mousedown","ButtonDownMouseDownHandler");
this.AttachDomEvent(this.SpinUpButton,"mouseup","ButtonUpMouseUpHandler");
this.AttachDomEvent(this.SpinDownButton,"mouseup","ButtonDownMouseUpHandler");
this.AttachDomEvent(this.SpinUpButton,"mouseout","SpinMouseOutHandler");
this.AttachDomEvent(this.SpinDownButton,"mouseout","SpinMouseOutHandler");
}
this.CallBase("InitializeButtons",arguments);
},SpinMouseOutHandler:function(e){
this.Hold=false;
this.MoveUpDownInProgress=false;
},ButtonUpMouseDownHandler:function(e){
this.UpdateHiddenValue();
var _1f={"ButtonName":"MoveUpButton"};
if(!this.RaiseEvent("OnButtonClick",_1f)){
return;
}
this.Hold=true;
this._RepeatedMoveUp(300);
this.MoveUpDownInProgress=true;
},ButtonDownMouseDownHandler:function(e){
this.UpdateHiddenValue();
var _21={"ButtonName":"MoveDownButton"};
if(!this.RaiseEvent("OnButtonClick",_21)){
return;
}
this.Hold=true;
this._RepeatedMoveDown(300);
this.MoveUpDownInProgress=true;
},_RepeatedMoveUp:function(_22){
if(this.Hold==false){
return;
}
var _23=this;
var _24=_22;
if(_24>50){
_24-=40;
}
var _25=function(){
_23._RepeatedMoveUp(_24);
};
_23.MoveUp();
window.setTimeout(_25,_22);
},_RepeatedMoveDown:function(_26){
if(this.Hold==false){
return;
}
var _27=this;
var _28=_26;
if(_28>50){
_28-=40;
}
var _29=function(){
_27._RepeatedMoveDown(_28);
};
_27.MoveDown();
window.setTimeout(_29,_26);
},ButtonUpMouseUpHandler:function(e){
this.Hold=false;
this.SpinUpButton.blur();
this.MoveUpDownInProgress=false;
},ButtonDownMouseUpHandler:function(e){
this.Hold=false;
this.SpinDownButton.blur();
this.MoveUpDownInProgress=false;
},SetHiddenValue:function(_2c){
var _2d=_2c;
var _2c=NumberFormat.Parse(_2c,this.RejectRegExp,this.NumberFormat.DecimalSeparator,this.NumberFormat.NegativeSign);
if(_2c<this.MinValue||_2c>this.MaxValue){
var _2e={Reason:RadInputErrorReason.OutOfRange,InputText:_2d};
this.RaiseErrorEvent(_2e);
}
_2c=Math.max(this.MinValue,_2c);
_2c=Math.min(this.MaxValue,_2c);
_2c=NumberFormat.Round(_2c,this.NumberFormat.DecimalDigits);
if(isNaN(_2c)){
_2c="";
}
this.CallBase("SetHiddenValue",arguments);
},GetDisplayValue:function(){
return NumberFormat.Format(this.GetParsedTextBoxValue(),this);
},GetEditValue:function(){
var _2f=this.GetValue().toString().replace(".",this.NumberFormat.DecimalSeparator);
return _2f.replace("-",this.NumberFormat.NegativeSign);
},GetValue:function(){
var _30=parseFloat(this.HiddenElement.value);
if(isNaN(_30)){
_30="";
}
return _30;
},IsNegative:function(){
return this.GetValue()<0;
}};;