var NumberFormat={};
NumberFormat.Round=function(_1,_2){
if(!_2.get_numberFormat().AllowRounding){
return _1;
}
var _3=Math.pow(10,_2.get_numberFormat().DecimalDigits);
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.ParseExact=function(_d,_e,_f,_10,_11,_12,_13){
if(!_d){
return "";
}
var _14=null;
var _15=null;
var _16=NumberFormat.ReplaceN(_f,"",_13).replace(_e,"");
var _17=NumberFormat.ReplaceN(_10,"",_13).replace(_e,"");
_15=_d.toString().replace(_e,"");
if(_15==_16){
_14=true;
}else{
if(_15==_17){
_14=false;
}else{
return "";
}
}
var neg=NumberFormat.ReplaceN(_f,"1",_13).split("1");
var pos=NumberFormat.ReplaceN(_10,"1",_13).split("1");
var i;
for(i in neg){
_d=_d.toString().replace(neg[i],"");
}
for(i in pos){
_d=_d.toString().replace(pos[i],"");
}
var _1b=NumberFormat.Parse(_d,_11,_12,_13);
if(_14&&!isNaN(_1b)){
_1b=_1b*(-1);
}
return _1b;
};
NumberFormat.Pad=function(str,_1d,_1e){
while(str.toString().length<_1d){
str=str.toString()+_1e.toString();
}
return str;
};
NumberFormat.Format=function(_1f,_20){
var num=parseFloat(_1f.toString().replace(_20.get_numberFormat().DecimalSeparator,"."));
if(isNaN(num)){
return "";
}
var _22="";
num=this.Round(num,_20);
var _23=Math.abs(num).toString().split(".");
_22+=this.SplitGroups(_23[0],_20.get_numberFormat().GroupSizes,_20.get_numberFormat().GroupSeparator);
if((!_20.get_numberFormat().AllowRounding)&&(_23[1])){
_22+=_20.get_numberFormat().DecimalSeparator+_23[1];
}else{
if(!_20.get_numberFormat().AllowRounding){
_22=_22;
}else{
if(_23[1]){
_22+=_20.get_numberFormat().DecimalSeparator+this.Pad(_23[1],_20.get_numberFormat().DecimalDigits,"0");
}else{
if(_20.get_numberFormat().DecimalDigits>0){
_22+=_20.get_numberFormat().DecimalSeparator+this.Pad("",_20.get_numberFormat().DecimalDigits,"0");
}
}
}
}
var _24=num<0?_20.get_numberFormat().NegativePattern:_20.get_numberFormat().PositivePattern;
return NumberFormat.ReplaceN(_24,_22.toString(),_20.get_numberFormat().NegativeSign);
};
NumberFormat.ReplaceN=function(_25,_26,_27){
var _28=_27+"n";
var _29="n"+_27;
var i=0;
var _2b=(-1);
if(_25.indexOf(_28)!=(-1)){
_2b=_25.indexOf(_28);
i=1;
}else{
if(_25.indexOf(_29)!=(-1)){
_2b=_25.indexOf(_29);
i=0;
}else{
_2b=_25.indexOf("n ");
i=0;
if((_2b==(-1))||((_2b>0)&&_25[_2b-1]!=(ns))){
_2b=_25.indexOf(" n");
i=1;
if((_2b==(-1))||(_2b!=(_25.Length-2))){
_2b=_25.indexOf(" n ");
i=1;
}
}
if((_2b==(-1))){
_2b=_25.indexOf("n");
i=0;
}
}
}
_25=_25.substring(0,_2b+i)+_26+_25.substring(_2b+i+1,_25.length);
return _25;
};
NumberFormat.ReturnZeroIfEmpty=function(_2c){
if((_2c==null)||(_2c=="")||isNaN(_2c)){
return 0;
}
return _2c;
};
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadNumericTextBox=function(_2d){
Telerik.Web.UI.RadNumericTextBox.initializeBase(this,[_2d]);
this._showSpinButtons=false;
this._maxValue=70368744177664;
this._minValue=-70368744177664;
this._numberFormat=null;
this._originalValue="";
this._incrementSettings=null;
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=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 _2e=parseFloat(this._hiddenElement.value);
if(isNaN(_2e)){
_2e="";
}
return _2e;
},set_value:function(_2f){
if(typeof (_2f)=="string"&&_2f!=""){
_2f=_2f.replace(this._rejectRegExp,this.get_numberFormat().DecimalSeparator);
_2f=NumberFormat.Parse(_2f,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}
if(_2f<this.get_minValue()||_2f>this.get_maxValue()){
var _30=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,_2f,null,null);
this.raise_error(_30);
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"set_value",[_2f]);
},get_displayValue:function(){
return NumberFormat.Format(this._getParsedTextBoxValue(),this);
},get_editValue:function(){
var _31=this.get_value().toString().replace(".",this.get_numberFormat().DecimalSeparator);
return _31.replace("-",this.get_numberFormat().NegativeSign);
},get_showSpinButtons:function(){
return this._showSpinButtons;
},set_showSpinButtons:function(_32){
if(this._showSpinButtons!==_32){
this._showSpinButtons=_32;
this.raisePropertyChanged("ShowSpinButtons");
}
},get_maxValue:function(){
return this._maxValue;
},set_maxValue:function(_33){
if(this._maxValue!==_33){
this._maxValue=_33;
this.raisePropertyChanged("MaxValue");
}
},get_minValue:function(){
return this._minValue;
},set_minValue:function(_34){
if(this._minValue!==_34){
this._minValue=_34;
this.raisePropertyChanged("MinValue");
}
},get_numberFormat:function(){
return this._numberFormat;
},set_numberFormat:function(_35){
this._numberFormat=_35;
},get_incrementSettings:function(){
return this._incrementSettings;
},set_incrementSettings:function(_36){
if(this._incrementSettings!==_36){
this._incrementSettings=_36;
this.raisePropertyChanged("IncrementSettings");
}
},_getParsedTextBoxValue:function(){
var _37=NumberFormat.Parse(this.get_textBoxValue(),this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
_37=Math.max(this.get_minValue(),_37);
_37=Math.min(this.get_maxValue(),_37);
return _37;
},_compileRegEx:function(){
var _38=this.get_numberFormat().DecimalSeparator=="."?"\\.":this.get_numberFormat().DecimalSeparator;
this._acceptRegExp=new RegExp("[0-9"+_38+this.get_numberFormat().NegativeSign+"]{1}");
this._rejectRegExp=new RegExp("[^0-9"+_38+this.get_numberFormat().NegativeSign+"]{1}","g");
this._decimalReplaceRegExp=new RegExp(_38,"g");
},_onFormResetHandler:function(e){
if(this._originalValue==null){
this._originalValue="";
}
this.set_value(this._originalValue);
this._textBoxElement.defaultValue=this._originalValue;
},_onTextBoxKeyDownHandler:function(e){
if(!this.get_incrementSettings().InterceptArrowKeys){
return;
}
if(e.altKey||e.ctrlKey){
return true;
}
if(e.keyCode==38){
this._move(this.get_incrementSettings().Step,false);
}else{
if(e.keyCode==40){
this._move(-this.get_incrementSettings().Step,false);
}else{
if(e.keyCode==110&&this.get_numberFormat().DecimalSeparator!="."){
this._numPadDecimalSeparatorPressed=true;
e.preventDefault();
e.stopPropagation();
this._triggerDecimalSeparatorPressedEvent(this._textBoxElement);
}
}
}
},_triggerDecimalSeparatorPressedEvent:function(_3b){
this._fakeKeyPressEventTriggered=true;
var _3c=this.get_numberFormat().DecimalSeparator.charCodeAt(0);
if(_3b.fireEvent&&document.createEventObject){
var _3d=document.createEventObject();
_3d.keyCode=_3c;
_3b.fireEvent("onkeypress",_3d);
}else{
if(_3b.dispatchEvent){
var _3d=document.createEvent("KeyboardEvent");
_3d.initKeyEvent("keypress",true,true,null,false,false,false,false,0,_3c);
_3b.dispatchEvent(_3d);
}
}
},_handleWheel:function(_3e){
if(!this.get_incrementSettings().InterceptMouseWheel){
return;
}
this._calculateSelection();
if(_3e){
this._move(-this.get_incrementSettings().Step,false);
}else{
this._move(this.get_incrementSettings().Step,false);
}
this._applySelection();
},_onTextBoxKeyPressHandler:function(e){
var _40=String.fromCharCode(e.charCode);
if(e.charCode==46&&this._numPadDecimalSeparatorPressed&&_40!=this.get_numberFormat().DecimalSeparator){
e.preventDefault();
e.stopPropagation();
return;
}
if(e.altKey||e.ctrlKey){
return true;
}
var _41=new Telerik.Web.UI.InputKeyPressEventArgs(e,e.charCode,String.fromCharCode(e.charCode));
this.raise_keyPress(_41);
if(_41.get_cancel()){
e.stopPropagation();
e.preventDefault();
return false;
}
if(e.charCode==13){
this._updateHiddenValueOnKeyPress(e);
if(this.get_autoPostBack()){
this._isEnterPressed=true;
this.raisePostBackEvent();
}
return true;
}
if(!e.charCode||e.charCode==8||e.charCode==9||e.charCode==27){
return true;
}
var _42=this.get_textBoxValue();
if(!this._isNormalChar(e)){
return true;
}
if(!_40.match(this._acceptRegExp)){
var _41=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_42,e.charCode,_40);
this.raise_error(_41);
e.stopPropagation();
e.preventDefault();
return false;
}
if(_40==this.get_numberFormat().NegativeSign){
this._calculateSelection();
var _43=(this._selectionStart!=0);
_43=_43||(_42.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0));
if(_43){
var _41=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_42,e.charCode,_40);
this.raise_error(_41);
e.stopPropagation();
e.preventDefault();
return false;
}
}
if(_40==this.get_numberFormat().DecimalSeparator){
this._calculateSelection();
var _44=_42.substr(0,this._selectionStart);
var _45=_42.substr(this._selectionStart,this._selectionEnd-this._selectionStart);
var _46=_42.substr(this._selectionEnd,_42.length-1);
if(_44.match(this._decimalReplaceRegExp)){
this._selectionStart--;
this._selectionEnd--;
}else{
if(_45.match(this._decimalReplaceRegExp)){
this._selectionEnd--;
}
}
_42=_42.replace(this._decimalReplaceRegExp,"");
if(_45.length==_42.length){
this.set_textBoxValue("");
}else{
this.set_textBoxValue((_44+this.get_numberFormat().DecimalSeparator+_46).replace(this._decimalReplaceRegExp,""));
}
if(this._fakeKeyPressEventTriggered){
this._fakeKeyPressEventTriggered=false;
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){
var _47=document.selection.createRange();
if(_47.parentElement()==this._textBoxElement){
_47.text=_40;
}
}
}
}
},_moveUp:function(){
return this._move(this.get_incrementSettings().Step,true);
},_moveDown:function(){
return this._move(-this.get_incrementSettings().Step,true);
},_move:function(_48,_49){
if(this.isReadOnly()){
return false;
}
var _4a=this.get_value();
_4a=_4a+_48;
if(!_49){
this._SetValue(_4a);
}else{
this.set_value(_4a);
}
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 _4b=$get(this._wrapperElementID);
var _4c=_4b.getElementsByTagName("a");
var i;
for(i=0;i<_4c.length;i++){
if(_4c[i].className.indexOf("riDown")!=(-1)){
this.SpinDownButton=_4c[i];
}else{
if(_4c[i].className.indexOf("riUp")!=(-1)){
this.SpinUpButton=_4c[i];
}
}
}
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(e){
this._hold=false;
},_onButtonUpMouseDownHandler:function(e){
var _50=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveUpButton);
this.raise_buttonClick(_50);
if(_50.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveUp(300);
},_onButtonDownMouseDownHandler:function(e){
var _52=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveDownButton);
this.raise_buttonClick(_52);
if(_52.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveDown(300);
},_repeatedMoveUp:function(_53){
if(this._hold==false){
return;
}
var _54=this;
var _55=_53;
if(_55>50){
_55-=40;
}
var _56=function(){
_54._repeatedMoveUp(_55);
};
_54._moveUp();
if(!this.get_autoPostBack()){
window.setTimeout(_56,_53);
}
},_repeatedMoveDown:function(_57){
if(this._hold==false){
return;
}
var _58=this;
var _59=_57;
if(_59>50){
_59-=40;
}
var _5a=function(){
_58._repeatedMoveDown(_59);
};
_58._moveDown();
if(!this.get_autoPostBack()){
window.setTimeout(_5a,_57);
}
},_onButtonUpMouseUpHandler:function(e){
this._hold=false;
this.SpinUpButton.blur();
},_onButtonDownMouseUpHandler:function(e){
this._hold=false;
this.SpinDownButton.blur();
},_SetValue:function(_5d){
if(_5d<this.get_minValue()||_5d>this.get_maxValue()){
var _5e=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,_5d,null,null);
this.raise_error(_5e);
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[_5d]);
},_setHiddenValue:function(_5f){
if(typeof (_5f)!="number"){
_5f=NumberFormat.Parse(_5f,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}
_5f=Math.max(this.get_minValue(),_5f);
_5f=Math.min(this.get_maxValue(),_5f);
if(!this.get_numberFormat().KeepNotRoundedValue){
_5f=NumberFormat.Round(_5f,this);
}
if(isNaN(_5f)){
_5f="";
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_setHiddenValue",[_5f]);
},_initializeHiddenElement:function(id){
this._hiddenElement=$get(id+"_Value");
},_initializeValidationField:function(id){
this._validationField=$get(id);
},_setValidationField:function(_62){
this._validationField.value=_62.toString().replace(".",this.get_numberFormat().DecimalSeparator);
},_getValidationField:function(_63){
return this._validationField;
}};
Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);

