﻿Type.registerNamespace("Telerik.Web.UI");
Type.registerNamespace("Telerik.Web.UI.NumberFormat");
NumberFormat=Telerik.Web.UI.NumberFormat=function(){
};
NumberFormat=Telerik.Web.UI.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=Telerik.Web.UI.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=Telerik.Web.UI.NumberFormat.Parse=function(_9,_a,_b,_c){
return parseFloat(_9.toString().replace(_a,"").replace(_b,".").replace(_c,"-"));
};
NumberFormat=Telerik.Web.UI.NumberFormat.ParseExact=function(_d,_e,_f,_10,_11,_12,_13){
if(!_d){
return "";
}
var _14=null;
var _15=null;
var _16=Telerik.Web.UI.NumberFormat.ReplaceN(_f,"",_13).replace(_e,"");
var _17=Telerik.Web.UI.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=Telerik.Web.UI.NumberFormat.ReplaceN(_f,"1",_13).split("1");
var pos=Telerik.Web.UI.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=Telerik.Web.UI.NumberFormat.Parse(_d,_11,_12,_13);
if(_14&&!isNaN(_1b)){
_1b=_1b*(-1);
}
return _1b;
};
NumberFormat=Telerik.Web.UI.NumberFormat.Pad=function(str,_1d,_1e){
while(str.toString().length<_1d){
str=str.toString()+_1e.toString();
}
return str;
};
NumberFormat=Telerik.Web.UI.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 Telerik.Web.UI.NumberFormat.ReplaceN(_24,_22.toString(),_20.get_numberFormat().NegativeSign);
};
NumberFormat=Telerik.Web.UI.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]!=(_27))){
_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=Telerik.Web.UI.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=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 _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=Telerik.Web.UI.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 Telerik.Web.UI.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.updateClientState();
this.raisePropertyChanged("maxValue");
}
},get_minValue:function(){
return this._minValue;
},set_minValue:function(_34){
if(this._minValue!==_34){
this._minValue=_34;
this.updateClientState();
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");
}
},saveClientState:function(){
var _37=["minValue","maxValue"];
return Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"saveClientState",[_37]);
},_getParsedTextBoxValue:function(){
var _38=Telerik.Web.UI.NumberFormat.Parse(this.get_textBoxValue(),this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
_38=Math.max(this.get_minValue(),_38);
_38=Math.min(this.get_maxValue(),_38);
return _38;
},_compileRegEx:function(){
var _39=this.get_numberFormat().DecimalSeparator=="."?"\\.":this.get_numberFormat().DecimalSeparator;
this._acceptRegExp=new RegExp("[0-9"+_39+this.get_numberFormat().NegativeSign+"]{1}");
this._rejectRegExp=new RegExp("[^0-9"+_39+this.get_numberFormat().NegativeSign+"]{1}","g");
this._decimalReplaceRegExp=new RegExp(_39,"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.get_numberFormat().CultureNativeDecimalSeparator){
this._numPadDecimalSeparatorPressed=true;
e.preventDefault();
e.stopPropagation();
this._triggerDecimalSeparatorPressedEvent(this._textBoxElement);
}
}
}
},_triggerDecimalSeparatorPressedEvent:function(_3c){
this._fakeKeyPressEventTriggered=true;
var _3d=this.get_numberFormat().DecimalSeparator.charCodeAt(0);
if(_3c.fireEvent&&document.createEventObject){
var _3e=document.createEventObject();
_3e.keyCode=_3d;
_3c.fireEvent("onkeypress",_3e);
}else{
if(_3c.dispatchEvent){
var _3e=document.createEvent("KeyboardEvent");
_3e.initKeyEvent("keypress",true,true,null,false,false,false,false,0,_3d);
_3c.dispatchEvent(_3e);
}
}
},_handleWheel:function(_3f){
if(!this.get_incrementSettings().InterceptMouseWheel){
return;
}
this._calculateSelection();
if(_3f){
this._move(-this.get_incrementSettings().Step,false);
}else{
this._move(this.get_incrementSettings().Step,false);
}
this._applySelection();
},_onTextBoxKeyPressHandler:function(e){
var _41=String.fromCharCode(e.charCode);
if(e.charCode==46&&this._numPadDecimalSeparatorPressed&&_41!=this.get_numberFormat().DecimalSeparator){
e.preventDefault();
e.stopPropagation();
return;
}
if(e.altKey||e.ctrlKey){
return true;
}
var _42=new Telerik.Web.UI.InputKeyPressEventArgs(e,e.charCode,String.fromCharCode(e.charCode));
this.raise_keyPress(_42);
if(_42.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 _43=this.get_textBoxValue();
if(!this._isNormalChar(e)){
return true;
}
if(!_41.match(this._acceptRegExp)){
var _42=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_43,e.charCode,_41);
this.raise_error(_42);
e.stopPropagation();
e.preventDefault();
return false;
}
if(_41==this.get_numberFormat().NegativeSign){
this._calculateSelection();
var _44=(this._selectionStart!=0);
_44=_44||(_43.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0));
if(_44){
var _42=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,_43,e.charCode,_41);
this.raise_error(_42);
e.stopPropagation();
e.preventDefault();
return false;
}
}
if(_41==this.get_numberFormat().DecimalSeparator){
this._calculateSelection();
var _45=_43.substr(0,this._selectionStart);
var _46=_43.substr(this._selectionStart,this._selectionEnd-this._selectionStart);
var _47=_43.substr(this._selectionEnd,_43.length-1);
if(_45.match(this._decimalReplaceRegExp)){
this._selectionStart--;
this._selectionEnd--;
}else{
if(_46.match(this._decimalReplaceRegExp)){
this._selectionEnd--;
}
}
_43=_43.replace(this._decimalReplaceRegExp,"");
if(_46.length==_43.length){
this.set_textBoxValue("");
}else{
this.set_textBoxValue((_45+this.get_numberFormat().DecimalSeparator+_47).replace(this._decimalReplaceRegExp,""));
}
if(this._fakeKeyPressEventTriggered){
this._fakeKeyPressEventTriggered=false;
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){
var _48=document.selection.createRange();
if(_48.parentElement()==this._textBoxElement){
_48.text=_41;
}
}
}
}
},_moveUp:function(){
return this._move(this.get_incrementSettings().Step,true);
},_moveDown:function(){
return this._move(-this.get_incrementSettings().Step,true);
},_move:function(_49,_4a){
if(this.isReadOnly()){
return false;
}
var _4b=this.get_value();
_4b=_4b+_49;
if(!_4a){
this._SetValue(_4b);
}else{
this.set_value(_4b);
}
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 _4c=$get(this._wrapperElementID);
var _4d=_4c.getElementsByTagName("a");
var i;
for(i=0;i<_4d.length;i++){
if(_4d[i].className.indexOf("riDown")!=(-1)){
this.SpinDownButton=_4d[i];
}else{
if(_4d[i].className.indexOf("riUp")!=(-1)){
this.SpinUpButton=_4d[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 _51=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveUpButton);
this.raise_buttonClick(_51);
if(_51.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveUp(300);
},_onButtonDownMouseDownHandler:function(e){
var _53=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveDownButton);
this.raise_buttonClick(_53);
if(_53.get_cancel()){
return false;
}
this._hold=true;
this._repeatedMoveDown(300);
},_repeatedMoveUp:function(_54){
if(this._hold==false){
return;
}
var _55=this;
var _56=_54;
if(_56>50){
_56-=40;
}
var _57=function(){
_55._repeatedMoveUp(_56);
};
_55._moveUp();
if(!this.get_autoPostBack()){
window.setTimeout(_57,_54);
}
},_repeatedMoveDown:function(_58){
if(this._hold==false){
return;
}
var _59=this;
var _5a=_58;
if(_5a>50){
_5a-=40;
}
var _5b=function(){
_59._repeatedMoveDown(_5a);
};
_59._moveDown();
if(!this.get_autoPostBack()){
window.setTimeout(_5b,_58);
}
},_onButtonUpMouseUpHandler:function(e){
this._hold=false;
this.SpinUpButton.blur();
},_onButtonDownMouseUpHandler:function(e){
this._hold=false;
this.SpinDownButton.blur();
},_SetValue:function(_5e){
if(_5e<this.get_minValue()||_5e>this.get_maxValue()){
var _5f=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,_5e,null,null);
this.raise_error(_5f);
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[_5e]);
},_setHiddenValue:function(_60){
if(typeof (_60)!="number"){
_60=Telerik.Web.UI.NumberFormat.Parse(_60,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign);
}
_60=Math.max(this.get_minValue(),_60);
_60=Math.min(this.get_maxValue(),_60);
if(!this.get_numberFormat().KeepNotRoundedValue){
_60=Telerik.Web.UI.NumberFormat.Round(_60,this);
}
if(isNaN(_60)){
_60="";
}
Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_setHiddenValue",[_60]);
},_initializeHiddenElement:function(id){
this._hiddenElement=$get(id+"_Value");
},_initializeValidationField:function(id){
this._validationField=$get(id);
},_setValidationField:function(_63){
this._validationField.value=_63.toString().replace(".",this.get_numberFormat().DecimalSeparator);
},_getValidationField:function(_64){
return this._validationField;
}};
Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();