Type.registerNamespace("Telerik.Web.UI"); Type.registerNamespace("Telerik.Web.UI.NumberFormat"); Telerik.Web.UI.NumberFormat=function(){}; Telerik.Web.UI.NumberFormat.Round=function(g,a){if(!a.get_numberFormat().AllowRounding){return parseFloat(Telerik.Web.UI.NumberFormat.ToFixed(g,0,a.get_numberFormat().DecimalDigits)); }var j; if(g.toString().indexOf("e")>-1){j=Math.pow(10,a.get_numberFormat().DecimalDigits); return Math.round(g*j)/j; }else{if(g.toString().indexOf(".")>-1){var h=g.toString().split("."); var f=Math.abs(parseInt(h[0],10)); var b=parseFloat("0."+h[1]); var c=Math.min(h[1].length,16); var l=h[0].charAt(0)=="-"?-1:1; if(h[1].length<=a.get_numberFormat().DecimalDigits){return g; }var n=b*Math.pow(10,c); if(n.toString().indexOf(".")>-1){n=+n.toString().split(".")[0]; }if(n.toString().length>a.get_numberFormat().DecimalDigits+1){var o=0; var m=h[1]; while(m.indexOf("0")==0){o++; m=m.substr(1); }n=parseInt(n.toString().substr(0,a.get_numberFormat().DecimalDigits+1),10); c=n.toString().length+o; }for(var e=1; e<=c; e++){if(e<=c-a.get_numberFormat().DecimalDigits){n=Math.round(n/10); }else{n/=10; }}if(n.toString().indexOf(".")>-1){var d=n.toString().split(".")[1].length; if(d>a.get_numberFormat().DecimalDigits){j=Math.pow(10,a.get_numberFormat().DecimalDigits); n=Math.round(n*j)/j; }}var k=l*(f+n); if(a.get_numberFormat().DecimalDigits>0&&k.toString().indexOf(".")!=-1&&k.toString().split(".")[1].length>a.get_numberFormat().DecimalDigits){return l*(parseFloat(f+"."+n.toString().substr(2))); }else{return k; }}else{return g; }}}; Telerik.Web.UI.NumberFormat.SplitGroups=function(e,b,a){var d=e.toString().split(""); if(b>0){for(var c=d.length-b; c>0; c-=b){d.splice(c,0,a); }}return d.join(""); }; Telerik.Web.UI.NumberFormat.Parse=function(d,c,a,b){return parseFloat(d.toString().replace(c,"").replace(a,".").replace(b,"-")); }; Telerik.Web.UI.NumberFormat.ParseExact=function(p,a,g,n,o,b,j,h){if(!p){return""; }var d=null; var k=null; var f=Telerik.Web.UI.NumberFormat.ReplaceN(g,"",j,h).replace(a,""); var m=Telerik.Web.UI.NumberFormat.ReplaceN(n,"",j,h).replace(a,""); k=p.toString().replace(a,""); if(k==f){d=true; }else{if(k==m){d=false; }else{return""; }}var e=Telerik.Web.UI.NumberFormat.ReplaceN(g,"1",j,h).split("1"); var l=Telerik.Web.UI.NumberFormat.ReplaceN(n,"1",j,h).split("1"); var c; for(c in e){p=p.toString().replace(e[c],""); }for(c in l){p=p.toString().replace(l[c],""); }var q=Telerik.Web.UI.NumberFormat.Parse(p,o,b,j); if(d&&!isNaN(q)){q=q*(-1); }return q; }; Telerik.Web.UI.NumberFormat.Pad=function(c,a,b){while(c.toString().length0){e+=a.get_numberFormat().DecimalSeparator+this.Pad("",a.get_numberFormat().DecimalDigits,"0"); }}}}var d=b<0?a.get_numberFormat().NegativePattern:b==0&&a.get_numberFormat().ZeroPattern?a.get_numberFormat().ZeroPattern:a.get_numberFormat().PositivePattern; return Telerik.Web.UI.NumberFormat.ReplaceN(d,e.toString(),a.get_numberFormat().NegativeSign,a.get_numberFormat().NumericPlaceHolder); }; Telerik.Web.UI.NumberFormat.ReplaceN=function(g,h,c,f){var d=c+f; var e=f+c; var a=0; var b=(-1); if(g.indexOf(d)!=(-1)){b=g.indexOf(d); a=1; }else{if(g.indexOf(e)!=(-1)){b=g.indexOf(e); a=0; }else{b=g.indexOf(f+" "); a=0; if((b==(-1))||((b>0)&&g[b-1]!=(c))){b=g.indexOf(" "+f); a=1; if((b==(-1))||(b!=(g.Length-2))){b=g.indexOf(" "+f+" "); a=1; }}if((b==(-1))){b=g.indexOf(f); a=0; }}}g=g.substring(0,b+a)+h+g.substring(b+a+1,g.length); return g; }; Telerik.Web.UI.NumberFormat.ToFixed=function(b,f,e){if(typeof b==="number"&&!(isNaN(b))){var c; var k=[]; var j=b.toString(); if(j.indexOf("e")!=-1){var h=j.split("e"); var a=+h[1]; k=[]; if(a<-1){a=Math.abs(a)-1; for(c=0; c0){if(d==-1){j=j+"."; d=j.length-1; }var g=f-(j.length-d-1); k=[]; for(c=0; c=0){if(e==0){j=j.substr(0,d); }else{if(e>0){j=j.substr(0,d+e+1); }}}return j; }else{return""; }}; Telerik.Web.UI.NumberFormat.ReturnZeroIfEmpty=function(a){if((a==null)||(a=="")||isNaN(a)){return 0; }return a; }; Type.registerNamespace("Telerik.Web.UI"); $telerik.findNumericTextBox=$find; $telerik.toNumericTextBox=function(a){return a; }; Telerik.Web.UI.RadNumericTextBox=function(a){Telerik.Web.UI.RadNumericTextBox.initializeBase(this,[a]); this._showSpinButtons=false; this._maxValue=70368744177664; this._minValue=-70368744177664; this._numberFormat=null; this._incrementSettings=null; this._allowOutOfRangeAutoCorrect=true; this._isIncrementing=false; 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._onSpinMouseClickDelegate=null; }; Telerik.Web.UI.RadNumericTextBox.prototype={initialize:function(){Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"initialize"); this._compileRegEx(); },dispose:function(){if(this.SpinUpButton){if(this._onButtonUpMouseDownDelegate){window.$removeHandler(this.SpinUpButton,"mousedown",this._onButtonUpMouseDownDelegate); this._onButtonUpMouseDownDelegate=null; }if(this._onButtonUpMouseUpDelegate){window.$removeHandler(this.SpinUpButton,"mouseup",this._onButtonUpMouseUpDelegate); this._onButtonUpMouseUpDelegate=null; }if(this._onSpinMouseOutDelegate){window.$removeHandler(this.SpinUpButton,"mouseout",this._onSpinMouseOutDelegate); }if(this._onSpinMouseClickDelegate){window.$removeHandler(this.SpinUpButton,"click",this._onSpinMouseClickDelegate); }}if(this.SpinDownButton){if(this._onButtonDownMouseDownDelegate){window.$removeHandler(this.SpinDownButton,"mousedown",this._onButtonDownMouseDownDelegate); this._onButtonDownMouseDownDelegate=null; }if(this._onButtonDownMouseUpDelegate){window.$removeHandler(this.SpinDownButton,"mouseup",this._onButtonDownMouseUpDelegate); this._onButtonDownMouseUpDelegate=null; }if(this._onSpinMouseOutDelegate){window.$removeHandler(this.SpinDownButton,"mouseout",this._onSpinMouseOutDelegate); }if(this._onSpinMouseClickDelegate){window.$removeHandler(this.SpinDownButton,"click",this._onSpinMouseClickDelegate); }}this._onSpinMouseOutDelegate=null; this._onSpinMouseClickDelegate=null; Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"dispose"); },isNegative:function(){return this.get_value()<0; },get_value:function(){return isNaN(this._value)?"":this._value; },set_value:function(b){this._holdsValidValue=true; var c=Telerik.Web.UI.NumberFormat.Parse(this._initialValueAsText,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign); if(typeof(b)=="string"&&b!=""){b=Telerik.Web.UI.NumberFormat.Parse(b,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign); }if(c===b&&!this._isEnterPressed){this.updateDisplayValue(); this.updateCssClass(); return; }if(typeof(b)=="number"&&(bthis.get_maxValue())){var a=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,b,null,null); this.raise_error(a); }if(!this.get_allowOutOfRangeAutoCorrect()&&!this._isIncrementing){this.set_textBoxValue(b.toString().replace((0.5).toString().charAt(1),this.get_numberFormat().DecimalSeparator)); }if(this.get_enableAriaSupport()){if(b){this._textBoxElement.setAttribute("aria-valuenow",b); }else{this._textBoxElement.removeAttribute("aria-valuenow"); }}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"set_value",[b]); },_constructEditText:function(a){if(typeof(a)=="number"){if(!a&&a!==0){return""; }if(this.get_numberFormat().KeepTrailingZerosOnFocus){a=Telerik.Web.UI.NumberFormat.ToFixed(a,this.get_numberFormat().DecimalDigits); }else{if(this.get_numberFormat().KeepNotRoundedValue){a=Telerik.Web.UI.NumberFormat.ToFixed(a); }else{a=Telerik.Web.UI.NumberFormat.Round(a,this); }}}var b=a.toString().replace(".",this.get_numberFormat().DecimalSeparator); return b.replace("-",this.get_numberFormat().NegativeSign); },_constructValueFromInitialText:function(b){var a=parseFloat(b); if(isNaN(a)){return""; }if(this.get_numberFormat().KeepNotRoundedValue){return a; }else{return parseFloat(Telerik.Web.UI.NumberFormat.Round(a,this)); }},get_valueAsString:function(){if(typeof this._value!="undefined"&&this._value!=null){return this._value.toString(); }else{return""; }},get_showSpinButtons:function(){return this._showSpinButtons; },set_showSpinButtons:function(a){if(this._showSpinButtons!==a){this._showSpinButtons=a; this.raisePropertyChanged("ShowSpinButtons"); }},get_maxValue:function(){return this._maxValue; },set_maxValue:function(a){if(this._maxValue!==a){this._maxValue=a; if(!this._clientID){return; }this.updateClientState(); this.raisePropertyChanged("maxValue"); }},get_minValue:function(){return this._minValue; },set_minValue:function(a){if(this._minValue!==a){this._minValue=a; if(!this._clientID){return; }this.updateClientState(); this.raisePropertyChanged("minValue"); }},get_numberFormat:function(){return this._numberFormat; },set_numberFormat:function(a){this._numberFormat=a; },get_incrementSettings:function(){return this._incrementSettings; },set_incrementSettings:function(a){if(this._incrementSettings!==a){this._incrementSettings=a; this.raisePropertyChanged("IncrementSettings"); }},get_allowOutOfRangeAutoCorrect:function(){return this._allowOutOfRangeAutoCorrect; },set_allowOutOfRangeAutoCorrect:function(a){this._allowOutOfRangeAutoCorrect=a; },saveClientState:function(){var a=["minValue","maxValue"]; return Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"saveClientState",[a]); },_getParsedTextBoxValue:function(){var a=Telerik.Web.UI.NumberFormat.Parse(this._textBoxElement.value,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign); a=Math.max(this.get_minValue(),a); a=Math.min(this.get_maxValue(),a); return a; },_compileRegEx:function(){var a=this.get_numberFormat().DecimalSeparator=="."?"\\.":this.get_numberFormat().DecimalSeparator; this._acceptRegExp=new RegExp("[0-9"+a+this.get_numberFormat().NegativeSign+"]{1}"); this._rejectRegExp=new RegExp("[^0-9"+a+this.get_numberFormat().NegativeSign+"]{1}","g"); this._decimalReplaceRegExp=new RegExp(a,"g"); },_onTextBoxKeyDownHandler:function(a){this._numPadDecimalSeparatorPressed=false; if(!this.get_incrementSettings().InterceptArrowKeys){return; }var b=(a.rawEvent&&a.rawEvent.metaKey); if(a.altKey||a.ctrlKey||b){return true; }if(a.keyCode==38){this._move(this.get_incrementSettings().Step,false); }else{if(a.keyCode==40){this._move(-this.get_incrementSettings().Step,false); }else{if(a.keyCode==110){this._numPadDecimalSeparatorPressed=true; }}}},_handleWheel:function(a){if(!this.get_incrementSettings().InterceptMouseWheel){return; }this._calculateSelection(); if(a){this._move(-this.get_incrementSettings().Step,false); }else{this._move(this.get_incrementSettings().Step,false); }this._applySelection(); },_onTextBoxKeyPressHandler:function(d){var k=String.fromCharCode(d.charCode); if(this._numPadDecimalSeparatorPressed){k=this.get_numberFormat().DecimalSeparator; }var l=(d.rawEvent&&d.rawEvent.metaKey); if(d.altKey||d.ctrlKey||l){return true; }var f=new Telerik.Web.UI.InputKeyPressEventArgs(d,d.charCode,String.fromCharCode(d.charCode)); this.raise_keyPress(f); var i=d.charCode||d.keyCode; var m=this._textBoxElement&&(this._textBoxElement.className.indexOf("rgPagerTextBox")>-1)&&i==9&&$telerik.isFirefox; if(f.get_cancel()){if(!m){d.stopPropagation(); d.preventDefault(); return false; }}if(d.charCode==13){this._isEnterPressed=true; this.set_value(this._textBoxElement.value); if(this.get_autoPostBack()){d.stopPropagation(); d.preventDefault(); return false; }return true; }if(!d.charCode||d.charCode==8||d.charCode==9||d.charCode==27){return true; }var c=this._textBoxElement.value; if(!this._isNormalChar(d)){return true; }if(!k.match(this._acceptRegExp)){var g=$telerik.isOpera&&(d.charCode==35||d.charCode==36)&&!d.shiftKey; if(!g){f=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,c,d.charCode,k); this.raise_error(f); d.stopPropagation(); d.preventDefault(); return false; }}var h=false; if(k==this.get_numberFormat().NegativeSign){this._calculateSelection(); h=(this._selectionStart!=0); h=h||(c.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0)); }else{if(!isNaN(parseInt(k,10))&&c.indexOf(this.get_numberFormat().NegativeSign)!=-1&&this.get_caretPosition()==0){h=true; }}if(h){f=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,c,d.charCode,k); this.raise_error(f); d.stopPropagation(); d.preventDefault(); return false; }if(k==this.get_numberFormat().DecimalSeparator&&!this.isReadOnly()){this._calculateSelection(); var b=c.substr(0,this._selectionStart); var j=c.substr(this._selectionStart,this._selectionEnd-this._selectionStart); var a=c.substr(this._selectionEnd,c.length); if(b.match(this._decimalReplaceRegExp)){this._selectionStart--; this._selectionEnd--; }else{if(j.match(this._decimalReplaceRegExp)){this._selectionEnd--; }}c=c.replace(this._decimalReplaceRegExp,""); if(j.length==c.length){if(this._numPadDecimalSeparatorPressed){this.set_textBoxValue(this.get_numberFormat().DecimalSeparator); this.set_caretPosition(b.length+1); d.preventDefault(); }else{this.set_textBoxValue(""); }}else{if(b.indexOf(this.get_numberFormat().DecimalSeparator)!=-1||a.indexOf(this.get_numberFormat().DecimalSeparator)!=-1){this.set_textBoxValue(b.replace(this._decimalReplaceRegExp,"")+this.get_numberFormat().DecimalSeparator+a.replace(this._decimalReplaceRegExp,"")); d.preventDefault(); this.set_caretPosition(b.length+1); }else{if(this._numPadDecimalSeparatorPressed){this.set_textBoxValue(b+this.get_numberFormat().DecimalSeparator+a); this.set_caretPosition(b.length+1); d.preventDefault(); }}}}},_moveUp:function(){return this._move(this.get_incrementSettings().Step,true); },_moveDown:function(){return this._move(-this.get_incrementSettings().Step,true); },_move:function(b,a){if(this.isReadOnly()){return false; }var c=this.get_value(); if(!c){c=0; }c=c+b; if(this._originalMaxLength>0&&c.toString().length>this._originalMaxLength){return false; }this._isIncrementing=true; if(!a){this._SetValue(c); }else{this.set_value(c); }this._isIncrementing=false; return true; },_initializeAriaSupport:function(){Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_initializeAriaSupport"); this._textBoxElement.setAttribute("role","spinbutton"); if(this.SpinUpButton){this.SpinUpButton.setAttribute("role","button"); this.SpinUpButton.setAttribute("aria-label","Spin up"); }if(this.SpinDownButton){this.SpinDownButton.setAttribute("role","button"); this.SpinDownButton.setAttribute("aria-label","Spin down"); }var a=this._textBoxElement; if(this.get_value()){a.setAttribute("aria-valuenow",this.get_value()); }if(this.get_maxValue()){a.setAttribute("aria-valuemax",this.get_maxValue()); }if(this.get_minValue()){a.setAttribute("aria-valuemin",this.get_minValue()); }},_initializeButtons:function(){this.SpinUpButton=null; this.SpinDownButton=null; this.Button=null; var b=$get(this._wrapperElementID); var a=b.getElementsByTagName("a"); var c; for(c=0; c50){c-=40; }var b=function(){a._repeatedMoveUp(c); }; a._moveUp(); if(!this.get_autoPostBack()){window.setTimeout(b,d); }},_repeatedMoveDown:function(d){if(this._hold==false){return; }var a=this; var c=d; if(c>50){c-=40; }var b=function(){a._repeatedMoveDown(c); }; a._moveDown(); if(!this.get_autoPostBack()){window.setTimeout(b,d); }},_onButtonUpMouseUpHandler:function(a){this._hold=false; this.SpinUpButton.blur(); },_onButtonDownMouseUpHandler:function(a){this._hold=false; this.SpinDownButton.blur(); },_SetValue:function(b){if(bthis.get_maxValue()){var a=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,b,null,null); this.raise_error(a); }Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[b]); },_setHiddenValue:function(a){if(a==null){a=""; }if(typeof(a)!="number"){a=Telerik.Web.UI.NumberFormat.Parse(a,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign); }if(!this.get_allowOutOfRangeAutoCorrect()&&(athis.get_maxValue())){if(!this._isIncrementing){return this._invalidate(); }else{return false; }}a=Math.max(this.get_minValue(),a); a=Math.min(this.get_maxValue(),a); if(!this.get_numberFormat().KeepNotRoundedValue){a=Telerik.Web.UI.NumberFormat.Round(a,this); }if(isNaN(a)||a==null){a=""; }this._value=a; this._text=this._constructEditText(a); this.set_validationText(this._constructValidationText(a)); return true; },_constructValidationText:function(a){return a.toString().replace(".",this.get_numberFormat().DecimalSeparator); },_constructDisplayText:function(a){return Telerik.Web.UI.NumberFormat.Format(a,this); }}; Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);