Number.implement({format:function(q){var n=this;q=q?Object.clone(q):{};var a=function(i){if(q[i]!=null){return q[i]}return Locale.get("Number."+i)};var f=n<0,h=a("decimal"),k=a("precision"),o=a("group"),c=a("decimals");if(f){var e=a("negative")||{};if(e.prefix==null&&e.suffix==null){e.prefix="-"}["prefix","suffix"].each(function(i){if(e[i]){q[i]=a(i)+e[i]}});n=-n}var l=a("prefix"),p=a("suffix");if(c!==""&&c>=0&&c<=20){n=n.toFixed(c)}if(k>=1&&k<=21){n=(+n).toPrecision(k)}n+="";var m;if(a("scientific")===false&&n.indexOf("e")>-1){var j=n.split("e"),b=+j[1];n=j[0].replace(".","");if(b<0){b=-b-1;m=j[0].indexOf(".");if(m>-1){b-=m-1}while(b--){n="0"+n}n="0."+n}else{m=j[0].lastIndexOf(".");if(m>-1){b-=j[0].length-m-1}while(b--){n+="0"}}}if(h!="."){n=n.replace(".",h)}if(o){m=n.lastIndexOf(h);m=(m>-1)?m:n.length;var d=n.substring(m),g=m;while(g--){if((m-g-1)%3==0&&g!=(m-1)){d=o+d}d=n.charAt(g)+d}n=d}if(l){n=l+n}if(p){n+=p}return n},formatCurrency:function(b){var a=Locale.get("Number.currency")||{};if(a.scientific==null){a.scientific=false}a.decimals=b!=null?b:(a.decimals==null?2:a.decimals);return this.format(a)},formatPercentage:function(b){var a=Locale.get("Number.percentage")||{};if(a.suffix==null){a.suffix="%"}a.decimals=b!=null?b:(a.decimals==null?2:a.decimals);return this.format(a)}});