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.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.get_numberFormat().DecimalSeparator,"."));
if(isNaN(num)){
return "";
}
var _13="";
num=this.Round(num,_11);
var _14=Math.abs(num).toString().split(".");
_13+=this.SplitGroups(_14[0],_11.get_numberFormat().GroupSizes,_11.get_numberFormat().GroupSeparator);
if((!_11.get_numberFormat().AllowRounding)&&(_14[1])){
_13+=_11.get_numberFormat().DecimalSeparator+_14[1];
}else{
if(!_11.get_numberFormat().AllowRounding){
_13=_13;
}else{
if(_14[1]){
_13+=_11.get_numberFormat().DecimalSeparator+this.Pad(_14[1],_11.get_numberFormat().DecimalDigits,"0");
}else{
if(_11.get_numberFormat().DecimalDigits>0){
_13+=_11.get_numberFormat().DecimalSeparator+this.Pad("",_11.get_numberFormat().DecimalDigits,"0");
}
}
}
}
var _15=num<0?_11.get_numberFormat().NegativePattern:_11.get_numberFormat().PositivePattern;
return _15.replace("n",_13);
};
NumberFormat.ReturnZeroIfEmpty=function(_16){
if((_16==null)||(_16=="")||isNaN(_16)){
return 0;
}
return _16;
};;Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadNumericTextBox=function(_1){
Telerik.Web.UI.RadNumericTextBox.initializeBase(this,[_1]);
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();
this._onFormResetDelegate=Function.createDelegate(this,this._onFormResetHandler);
$addHandler(this._textBoxElement.form,"reset",this._onFormResetDelegate);
if(this._initialValue!=""){
this._hiddenElement.value=NumberFormat.Round(this._initialValue,this);
}
},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){
$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 _2=parseFloat(this._hiddenElement.value);
if(isNaN(_2)){
_2="";
}
return _2;
},set_value:function(_3){
if(typeof (_3)=="string"&&_3!=""){
_3=_3.replace(this._rejectRegExp,this.get_numberFormat().DecimalSeparator);
_3=NumberFormat.Parse(_3,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}
if(_3<this.get_minValue()||_3>this.get_maxValue()){
var _4=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,_3,null,null);
this.raise_error(_4);
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"set_value",[_3]);
},get_displayValue:function(){
return NumberFormat.Format(this._getParsedTextBoxValue(),this);
},get_editValue:function(){
var _5=this.get_value().toString().replace(".",this.get_numberFormat().DecimalSeparator);
return _5.replace("-",this.get_numberFormat().NegativeSign);
},get_showSpinButtons:function(){
return this._showSpinButtons;
},set_showSpinButtons:function(_6){
if(this._showSpinButtons!==_6){
this._showSpinButtons=_6;
this.raisePropertyChanged("ShowSpinButtons");
}
},get_maxValue:function(){
return this._maxValue;
},set_maxValue:function(_7){
if(this._maxValue!==_7){
this._maxValue=_7;
this.raisePropertyChanged("MaxValue");
}
},get_minValue:function(){
return this._minValue;
},set_minValue:function(_8){
if(this._minValue!==_8){
this._minValue=_8;
this.raisePropertyChanged("MinValue");
}
},get_numberFormat:function(){
return this._numberFormat;
},set_numberFormat:function(_9){
this._numberFormat=_9;
},get_incrementSettings:function(){
return this._incrementSettings;
},set_incrementSettings:function(_a){
if(this._incrementSettings!==_a){
this._incrementSettings=_a;
this.raisePropertyChanged("IncrementSettings");
}
},_getParsedTextBoxValue:function(){
var _b=NumberFormat.Parse(this.get_textBoxValue(),this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
_b=Math.max(this.get_minValue(),_b);
_b=Math.min(this.get_maxValue(),_b);
return _b;
},_compileRegEx:function(){
var _c=this.get_numberFormat().DecimalSeparator=="."?"\\.":this.get_numberFormat().DecimalSeparator;
this._acceptRegExp=new RegExp("[0-9"+_c+this.get_numberFormat().NegativeSign+"]{1}");
this._rejectRegExp=new RegExp("[^0-9"+_c+this.get_numberFormat().NegativeSign+"]{1}","g");
this._decimalReplaceRegExp=new RegExp(_c,"g");
},_onFormResetHandler:function(e){
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(_f){
this._fakeKeyPressEventTriggered=true;
var _10=this.get_numberFormat().DecimalSeparator.charCodeAt(0);
if(_f.fireEvent&&document.createEventObject){
var _11=document.createEventObject();
_11.keyCode=_10;
_f.fireEvent("onkeypress",_11);
}else{
if(_f.dispatchEvent){
var _11=document.createEvent("KeyboardEvent");
_11.initKeyEvent("keypress",true,true,null,false,false,false,false,0,_10);
_f.dispatchEvent(_11);
}
}
},_handleWheel:function(_12){
if(!this.get_incrementSettings().InterceptMouseWheel){
return;
}
this._calculateSelection();
if(_12){
this._move(-this.get_incrementSettings().Step,false);
}else{
this._move(this.get_incrementSettings().Step,false);
}
this._applySelection();
},_onTextBoxKeyPressHandler:function(e){
var _14=String.fromCharCode(e.charCode);
if(e.charCode==46&&this._numPadDecimalSeparatorPressed&&_14!=this.get_numberFormat().DecimalSeparator){
e.preventDefault();
e.stopPropagation();
return;
}
if(e.altKey||e.ctrlKey){
return true;
}
var _15=new Telerik.Web.UI.InputKeyPressEventArgs(e,e.charCode,String.fromCharCode(e.charCode));
this.raise_keyPress(_15);
if(_15.get_cancel()){
e.stopPropagation();
e.preventDefault();
return false;
}
if(e.charCode==13){
this._updateHiddenValueOnKeyPress(e);
if(this.get_autoPostBack()){
this.raisePostBackEvent();
}
return true;
}
if(!e.charCode||e.charCode==8||e.charCode==9){
return true;
}
var _16=this.get_textBoxValue();
if(!this._isNormalChar(e)){
return true;
}
if(!_14.match(this._acceptRegExp)){
var _15=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_16,e.charCode,_14);
this.raise_error(_15);
e.stopPropagation();
e.preventDefault();
return false;
}
if(_14==this.get_numberFormat().NegativeSign){
this._calculateSelection();
var _17=(this._selectionStart!=0);
_17=_17||(_16.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0));
if(_17){
var _15=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_16,e.charCode,_14);
this.raise_error(_15);
e.stopPropagation();
e.preventDefault();
return false;
}
}
if(_14==this.get_numberFormat().DecimalSeparator){
this._calculateSelection();
var _18=_16.substr(0,this._selectionStart);
var _19=_16.substr(this._selectionStart,this._selectionEnd-this._selectionStart);
var _1a=_16.substr(this._selectionEnd,_16.length-1);
if(_18.match(this._decimalReplaceRegExp)){
this._selectionStart--;
this._selectionEnd--;
}else{
if(_19.match(this._decimalReplaceRegExp)){
this._selectionEnd--;
}
}
_16=_16.replace(this._decimalReplaceRegExp,"");
if(_19.length==_16.length){
this.set_textBoxValue("");
}else{
this.set_textBoxValue((_18+this.get_numberFormat().DecimalSeparator+_1a).replace(this._decimalReplaceRegExp,""));
}
if(this._fakeKeyPressEventTriggered){
this._fakeKeyPressEventTriggered=false;
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){
var _1b=document.selection.createRange();
if(_1b.parentElement()==this._textBoxElement){
_1b.text=_14;
}
}
}
}
},_moveUp:function(){
return this._move(this.get_incrementSettings().Step,true);
},_moveDown:function(){
return this._move(-this.get_incrementSettings().Step,true);
},_move:function(_1c,_1d){
if(this.isReadOnly()){
return false;
}
var _1e=this.get_value();
_1e=_1e+_1c;
if(!_1d){
this._SetValue(_1e);
}else{
this.set_value(_1e);
}
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 _1f=$get(this._wrapperElementID);
var _20=_1f.getElementsByTagName("a");
var i;
for(i=0;i<_20.length;i++){
if(_20[i].className.indexOf("spinbutton down")!=(-1)){
this.SpinDownButton=_20[i];
}else{
if(_20[i].className.indexOf("spinbutton up")!=(-1)){
this.SpinUpButton=_20[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 _24=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveUpButton);
this.raise_buttonClick(_24);
if(_24.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveUp(300);
},_onButtonDownMouseDownHandler:function(e){
var _26=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveDownButton);
this.raise_buttonClick(_26);
if(_26.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveDown(300);
},_repeatedMoveUp:function(_27){
if(this._hold==false){
return;
}
var _28=this;
var _29=_27;
if(_29>50){
_29-=40;
}
var _2a=function(){
_28._repeatedMoveUp(_29);
};
_28._moveUp();
window.setTimeout(_2a,_27);
},_repeatedMoveDown:function(_2b){
if(this._hold==false){
return;
}
var _2c=this;
var _2d=_2b;
if(_2d>50){
_2d-=40;
}
var _2e=function(){
_2c._repeatedMoveDown(_2d);
};
_2c._moveDown();
window.setTimeout(_2e,_2b);
},_onButtonUpMouseUpHandler:function(e){
this._hold=false;
this.SpinUpButton.blur();
},_onButtonDownMouseUpHandler:function(e){
this._hold=false;
this.SpinDownButton.blur();
},_SetValue:function(_31){
if(_31<this.get_minValue()||_31>this.get_maxValue()){
var _32=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,_31,null,null);
this.raise_error(_32);
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[_31]);
},_setHiddenValue:function(_33){
if(typeof (_33)!="number"){
_33=NumberFormat.Parse(_33,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}
_33=Math.max(this.get_minValue(),_33);
_33=Math.min(this.get_maxValue(),_33);
_33=NumberFormat.Round(_33,this);
if(isNaN(_33)){
_33="";
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_setHiddenValue",[_33]);
},_initializeHiddenElement:function(id){
this._hiddenElement=$get(id+"_Value");
},_initializeValidationField:function(id){
this._validationField=$get(id);
},_setValidationField:function(_36){
this._validationField.value=_36.toString().replace(".",this.get_numberFormat().DecimalSeparator);
},_getValidationField:function(_37){
return this._validationField;
}};
$telerik.makeCompatible(Telerik.Web.UI.RadNumericTextBox);
Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);;