﻿function ParseIntDef(b,c){var a=parseInt(b,10);if(!a){a=(c||0)}return(a)}Number.prototype.RoundTo=function(b){var a;a=Math.pow(10,b);return(Math.round(this.valueOf()*a)/a)};Number.prototype.Format=function(f,a){var d;var c;var b;var e;if(undefined===f){f="."}if(undefined===a){a=","}b=(this.valueOf()+"").split(".");d=b[0];e=(b.length>1)?a+b[1]:"";if(f){c=/(\d+)(\d{3})/;while(c.test(d)){d=d.replace(c,"$1"+f+"$2")}}d+=e;return(d)};Number.prototype.FormatES=function(a){return(this.Format(a?".":"",","))};Number.prototype.FormatEN=function(a){return(this.Format(a?",":"","."))};Number.prototype.FormatEuro=function(a){if(undefined===a){a="€"}return(this.RoundTo(2).Format()+" "+a)};Number.prototype.FormatPts=function(a){if(undefined===a){a="Pts"}return(Math.round(this.valueOf()).Format()+" "+a)};Number.prototype.EuroAPts=function(){return(Math.round(this.valueOf()*166.386))};Number.prototype.PtsAEuro=function(){return((this.valueOf()/166.386).RoundTo(2))};Number.prototype.StrPadLeft=function(b,a){return(this.toString().StrPadLeft(b,a))};Number.prototype.Frac=function(){return(this-parseInt(this))};Number.prototype.Random=function(a){a=a||0;return(Math.floor(Math.random()*(this-a+1))+a)};