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){
return parseFloat(_9.toString().replace(_a,"").replace(_b,"."));
};
NumberFormat.Pad=function(_c,_d,_e){
while(_c.toString().length<_d){
_c=_c.toString()+_e.toString();
}
return _c;
};
NumberFormat.Format=function(_f,_10){
var num=parseFloat(_f.toString().replace(_10.NumberFormat.DecimalSeparator,"."));
if(isNaN(num)){
return "";
}
var _12="";
num=this.Round(num,_10.NumberFormat.DecimalDigits);
var _13=Math.abs(num).toString().split(".");
_12+=this.SplitGroups(_13[0],_10.NumberFormat.GroupSizes,_10.NumberFormat.GroupSeparator);
if(_13[1]){
_12+=_10.NumberFormat.DecimalSeparator+this.Pad(_13[1],_10.NumberFormat.DecimalDigits,"0");
}
var _14=num<0?_10.NumberFormat.NegativePattern:_10.NumberFormat.PositivePattern;
return _14.replace("n",_12);
};
NumberFormat.ReturnZeroIfEmpty=function(_15){
if((_15==null)||(_15=="")||isNaN(_15)){
return 0;
}
return _15;
};;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);
_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){
if(this.SelectionStart!=0){
return RadControlsNamespace.DomEvent.PreventDefault(e);
}
if(_12.indexOf(this.NumberFormat.NegativeSign)==0&&(this.SelectionStart==0&&this.SelectionEnd==0)){
return RadControlsNamespace.DomEvent.PreventDefault(e);
}
}
if(_13==this.NumberFormat.DecimalSeparator){
var _15=_12.substr(0,this.SelectionStart);
var _16=_12.substr(this.SelectionStart,this.SelectionEnd-this.SelectionStart);
if(_15.match(this.DecimalReplaceRegExp)){
this.SelectionStart--;
this.SelectionEnd--;
}else{
if(_16.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(_17){
var _18=this.GetValue();
_18=_18+_17;
this.SetValue(_18.toString().replace(".",this.NumberFormat.DecimalSeparator));
return true;
},InitializeButtons:function(){
this.SpinUpButton=null;
this.SpinDownButton=null;
this.Button=null;
var _19=document.getElementById(this.WrapperElementID);
var _1a=_19.getElementsByTagName("span");
var i;
for(i=0;i<_1a.length;i++){
if(_1a[i].className.indexOf("radSpinDownCss")!=(-1)){
this.SpinDownButton=_1a[i];
}else{
if(_1a[i].className.indexOf("radSpinUpCss")!=(-1)){
this.SpinUpButton=_1a[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 _1e={"ButtonName":"MoveUpButton"};
if(!this.RaiseEvent("OnButtonClick",_1e)){
return;
}
this.Hold=true;
this._RepeatedMoveUp(300);
this.MoveUpDownInProgress=true;
},ButtonDownMouseDownHandler:function(e){
this.UpdateHiddenValue();
var _20={"ButtonName":"MoveDownButton"};
if(!this.RaiseEvent("OnButtonClick",_20)){
return;
}
this.Hold=true;
this._RepeatedMoveDown(300);
this.MoveUpDownInProgress=true;
},_RepeatedMoveUp:function(_21){
if(this.Hold==false){
return;
}
var _22=this;
var _23=_21;
if(_23>50){
_23-=40;
}
var _24=function(){
_22._RepeatedMoveUp(_23);
};
_22.MoveUp();
window.setTimeout(_24,_21);
},_RepeatedMoveDown:function(_25){
if(this.Hold==false){
return;
}
var _26=this;
var _27=_25;
if(_27>50){
_27-=40;
}
var _28=function(){
_26._RepeatedMoveDown(_27);
};
_26.MoveDown();
window.setTimeout(_28,_25);
},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(_2b){
var _2c=_2b;
var _2b=NumberFormat.Parse(_2b,this.RejectRegExp,this.NumberFormat.DecimalSeparator);
if(_2b<this.MinValue||_2b>this.MaxValue){
var _2d={Reason:RadInputErrorReason.OutOfRange,InputText:_2c};
this.RaiseErrorEvent(_2d);
}
_2b=Math.max(this.MinValue,_2b);
_2b=Math.min(this.MaxValue,_2b);
_2b=NumberFormat.Round(_2b,this.NumberFormat.DecimalDigits);
if(isNaN(_2b)){
_2b="";
}
this.CallBase("SetHiddenValue",arguments);
},GetDisplayValue:function(){
return NumberFormat.Format(this.GetParsedTextBoxValue(),this);
},GetEditValue:function(){
return this.GetValue().toString().replace(".",this.NumberFormat.DecimalSeparator);
},GetValue:function(){
var _2e=parseFloat(this.HiddenElement.value);
if(isNaN(_2e)){
_2e="";
}
return _2e;
},IsNegative:function(){
return this.GetValue()<0;
}};;if (typeof(Sys) != "undefined"){if (Sys.Application != null && Sys.Application.notifyScriptLoaded != null){Sys.Application.notifyScriptLoaded();}}
