﻿Type.registerNamespace("Telerik.Web.UI");
Type.registerNamespace("Telerik.Web.UI.NumberFormat");
NumberFormat=Telerik.Web.UI.NumberFormat=function(){};
NumberFormat=Telerik.Web.UI.NumberFormat.Round=function(c,b){if(!b.get_numberFormat().AllowRounding){return c
}var a=Math.pow(10,b.get_numberFormat().DecimalDigits);
return Math.round(c*a)/a
};
NumberFormat=Telerik.Web.UI.NumberFormat.SplitGroups=function(c,b,e){var a=c.toString().split("");
for(var d=a.length-b;
d>0;
d-=b){a.splice(d,0,e)
}return a.join("")
};
NumberFormat=Telerik.Web.UI.NumberFormat.Parse=function(d,b,a,c){return parseFloat(d.toString().replace(b,"").replace(a,".").replace(c,"-"))
};
NumberFormat=Telerik.Web.UI.NumberFormat.ParseExact=function(l,p,h,m,d,a,c){if(!l){return""
}var o=null;
var f=null;
var g=Telerik.Web.UI.NumberFormat.ReplaceN(h,"",c).replace(p,"");
var b=Telerik.Web.UI.NumberFormat.ReplaceN(m,"",c).replace(p,"");
f=l.toString().replace(p,"");
if(f==g){o=true
}else{if(f==b){o=false
}else{return""
}}var k=Telerik.Web.UI.NumberFormat.ReplaceN(h,"1",c).split("1");
var j=Telerik.Web.UI.NumberFormat.ReplaceN(m,"1",c).split("1");
var n;
for(n in k){l=l.toString().replace(k[n],"")
}for(n in j){l=l.toString().replace(j[n],"")
}var e=Telerik.Web.UI.NumberFormat.Parse(l,d,a,c);
if(o&&!isNaN(e)){e=e*(-1)
}return e
};
NumberFormat=Telerik.Web.UI.NumberFormat.Pad=function(b,a,c){while(b.toString().length<a){b=b.toString()+c.toString()
}return b
};
NumberFormat=Telerik.Web.UI.NumberFormat.Format=function(a,c){var f=parseFloat(a.toString().replace(c.get_numberFormat().DecimalSeparator,"."));
if(isNaN(f)){return""
}var b="";
f=this.Round(f,c);
var d=Math.abs(f).toString().split(".");
b+=this.SplitGroups(d[0],c.get_numberFormat().GroupSizes,c.get_numberFormat().GroupSeparator);
if((!c.get_numberFormat().AllowRounding)&&(d[1])){b+=c.get_numberFormat().DecimalSeparator+d[1]
}else{if(!c.get_numberFormat().AllowRounding){b=b
}else{if(d[1]){b+=c.get_numberFormat().DecimalSeparator+this.Pad(d[1],c.get_numberFormat().DecimalDigits,"0")
}else{if(c.get_numberFormat().DecimalDigits>0){b+=c.get_numberFormat().DecimalSeparator+this.Pad("",c.get_numberFormat().DecimalDigits,"0")
}}}}var e=f<0?c.get_numberFormat().NegativePattern:c.get_numberFormat().PositivePattern;
return Telerik.Web.UI.NumberFormat.ReplaceN(e,b.toString(),c.get_numberFormat().NegativeSign)
};
NumberFormat=Telerik.Web.UI.NumberFormat.ReplaceN=function(c,b,d){var e=d+"n";
var a="n"+d;
var g=0;
var f=(-1);
if(c.indexOf(e)!=(-1)){f=c.indexOf(e);
g=1
}else{if(c.indexOf(a)!=(-1)){f=c.indexOf(a);
g=0
}else{f=c.indexOf("n ");
g=0;
if((f==(-1))||((f>0)&&c[f-1]!=(d))){f=c.indexOf(" n");
g=1;
if((f==(-1))||(f!=(c.Length-2))){f=c.indexOf(" n ");
g=1
}}if((f==(-1))){f=c.indexOf("n");
g=0
}}}c=c.substring(0,f+g)+b+c.substring(f+g+1,c.length);
return c
};
NumberFormat=Telerik.Web.UI.NumberFormat.ReturnZeroIfEmpty=function(a){if((a==null)||(a=="")||isNaN(a)){return 0
}return a
};
Type.registerNamespace("Telerik.Web.UI");
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._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 a=parseFloat(this._hiddenElement.value);
if(isNaN(a)){a=""
}return a
},set_value:function(a){if(typeof(a)=="string"&&a!=""){a=Telerik.Web.UI.NumberFormat.Parse(a,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign)
}if(a<this.get_minValue()||a>this.get_maxValue()){var b=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,a,null,null);
this.raise_error(b)
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"set_value",[a])
},get_displayValue:function(){return Telerik.Web.UI.NumberFormat.Format(this._getParsedTextBoxValue(),this)
},get_editValue:function(){var a=this.get_value().toString().replace(".",this.get_numberFormat().DecimalSeparator);
return a.replace("-",this.get_numberFormat().NegativeSign)
},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;
this.updateClientState();
this.raisePropertyChanged("maxValue")
}},get_minValue:function(){return this._minValue
},set_minValue:function(a){if(this._minValue!==a){this._minValue=a;
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")
}},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.get_textBoxValue(),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")
},_onFormResetHandler:function(a){if(this._originalValue==null){this._originalValue=""
}this._setHiddenValue(Telerik.Web.UI.NumberFormat.Round(this._originalValue,this));
this.updateDisplayValue()
},_onTextBoxKeyDownHandler:function(a){if(!this.get_incrementSettings().InterceptArrowKeys){return
}if(a.altKey||a.ctrlKey){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.get_numberFormat().DecimalSeparator!=this.get_numberFormat().CultureNativeDecimalSeparator){this._numPadDecimalSeparatorPressed=true;
a.preventDefault();
a.stopPropagation();
this._triggerDecimalSeparatorPressedEvent(this._textBoxElement)
}}}},_triggerDecimalSeparatorPressedEvent:function(c){this._fakeKeyPressEventTriggered=true;
var a=this.get_numberFormat().DecimalSeparator.charCodeAt(0);
if(c.fireEvent&&document.createEventObject){var b=document.createEventObject();
b.keyCode=a;
c.fireEvent("onkeypress",b)
}else{if(c.dispatchEvent){var b=document.createEvent("KeyboardEvent");
b.initKeyEvent("keypress",true,true,null,false,false,false,false,0,a);
c.dispatchEvent(b)
}}},_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(g){var k=String.fromCharCode(g.charCode);
if(g.charCode==46&&this._numPadDecimalSeparatorPressed&&k!=this.get_numberFormat().DecimalSeparator){g.preventDefault();
g.stopPropagation();
return
}if(g.altKey||g.ctrlKey){return true
}var h=new Telerik.Web.UI.InputKeyPressEventArgs(g,g.charCode,String.fromCharCode(g.charCode));
this.raise_keyPress(h);
if(h.get_cancel()){g.stopPropagation();
g.preventDefault();
return false
}if(g.charCode==13){var a=this.get_textBoxValue();
if(this._initialValue!==a){this.set_value(a)
}else{this.updateDisplayValue();
this.updateCssClass()
}return true
}if(!g.charCode||g.charCode==8||g.charCode==9||g.charCode==27){return true
}var j=this.get_textBoxValue();
if(!this._isNormalChar(g)){return true
}if(!k.match(this._acceptRegExp)){var h=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,j,g.charCode,k);
this.raise_error(h);
g.stopPropagation();
g.preventDefault();
return false
}if(k==this.get_numberFormat().NegativeSign){this._calculateSelection();
var c=(this._selectionStart!=0);
c=c||(j.indexOf(this.get_numberFormat().NegativeSign)==0&&(this._selectionStart==0&&this._selectionEnd==0));
if(c){var h=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.ParseError,j,g.charCode,k);
this.raise_error(h);
g.stopPropagation();
g.preventDefault();
return false
}}if(k==this.get_numberFormat().DecimalSeparator){this._calculateSelection();
var i=j.substr(0,this._selectionStart);
var b=j.substr(this._selectionStart,this._selectionEnd-this._selectionStart);
var d=j.substr(this._selectionEnd,j.length-1);
if(i.match(this._decimalReplaceRegExp)){this._selectionStart--;
this._selectionEnd--
}else{if(b.match(this._decimalReplaceRegExp)){this._selectionEnd--
}}j=j.replace(this._decimalReplaceRegExp,"");
if(b.length==j.length){this.set_textBoxValue("")
}else{this.set_textBoxValue((i+this.get_numberFormat().DecimalSeparator+d).replace(this._decimalReplaceRegExp,""))
}if(this._fakeKeyPressEventTriggered){this._fakeKeyPressEventTriggered=false;
if(Sys.Browser.agent==Sys.Browser.InternetExplorer){var f=document.selection.createRange();
if(f.parentElement()==this._textBoxElement){f.text=k
}}}}},_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
}if(!a){this._SetValue(c)
}else{this.set_value(c)
}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 a=$get(this._wrapperElementID);
var c=a.getElementsByTagName("a");
var b;
for(b=0;
b<c.length;
b++){if(c[b].className.indexOf("riDown")!=(-1)){this.SpinDownButton=c[b]
}else{if(c[b].className.indexOf("riUp")!=(-1)){this.SpinUpButton=c[b]
}}}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(a){this._hold=false
},_onButtonUpMouseDownHandler:function(a){var b=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveUpButton);
this.raise_buttonClick(b);
if(b.get_cancel()){return false
}this._hold=true;
this._repeatedMoveUp(300)
},_onButtonDownMouseDownHandler:function(a){var b=new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.MoveDownButton);
this.raise_buttonClick(b);
if(b.get_cancel()){return false
}this._hold=true;
this._repeatedMoveDown(300)
},_repeatedMoveUp:function(c){if(this._hold==false){return
}var d=this;
var b=c;
if(b>50){b-=40
}var a=function(){d._repeatedMoveUp(b)
};
d._moveUp();
if(!this.get_autoPostBack()){window.setTimeout(a,c)
}},_repeatedMoveDown:function(c){if(this._hold==false){return
}var d=this;
var b=c;
if(b>50){b-=40
}var a=function(){d._repeatedMoveDown(b)
};
d._moveDown();
if(!this.get_autoPostBack()){window.setTimeout(a,c)
}},_onButtonUpMouseUpHandler:function(a){this._hold=false;
this.SpinUpButton.blur()
},_onButtonDownMouseUpHandler:function(a){this._hold=false;
this.SpinDownButton.blur()
},_SetValue:function(a){if(a<this.get_minValue()||a>this.get_maxValue()){var b=new Telerik.Web.UI.InputErrorEventArgs(Telerik.Web.UI.InputErrorReason.OutOfRange,a,null,null);
this.raise_error(b)
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_SetValue",[a])
},_setHiddenValue:function(a){if(typeof(a)!="number"){a=Telerik.Web.UI.NumberFormat.Parse(a,this._rejectRegExp,this.get_numberFormat().DecimalSeparator,this.get_numberFormat().NegativeSign)
}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=""
}Telerik.Web.UI.RadNumericTextBox.callBaseMethod(this,"_setHiddenValue",[a])
},_initializeHiddenElement:function(a){this._hiddenElement=$get(a+"_Value")
},_initializeValidationField:function(a){this._validationField=$get(a)
},_setValidationField:function(a){this._validationField.value=a.toString().replace(".",this.get_numberFormat().DecimalSeparator)
},_getValidationField:function(a){return this._validationField
}};
Telerik.Web.UI.RadNumericTextBox.registerClass("Telerik.Web.UI.RadNumericTextBox",Telerik.Web.UI.RadInputControl);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();