Number.implement({format:function(options){var value=this;options=options?Object.clone(options):{};var getOption=function(key){if(options[key]!=null){return options[key]}return Locale.get("Number."+key)};var negative=value<0,decimal=getOption("decimal"),precision=getOption("precision"),group=getOption("group"),decimals=getOption("decimals");if(negative){var negativeLocale=getOption("negative")||{};if(negativeLocale.prefix==null&&negativeLocale.suffix==null){negativeLocale.prefix="-"}["prefix","suffix"].each(function(key){if(negativeLocale[key]){options[key]=getOption(key)+negativeLocale[key]}});value=-value}var prefix=getOption("prefix"),suffix=getOption("suffix");if(decimals!==""&&decimals>=0&&decimals<=20){value=value.toFixed(decimals)}if(precision>=1&&precision<=21){value=(+value).toPrecision(precision)}value+="";var index;if(getOption("scientific")===false&&value.indexOf("e")>-1){var match=value.split("e"),zeros=+match[1];value=match[0].replace(".","");if(zeros<0){zeros=-zeros-1;index=match[0].indexOf(".");if(index>-1){zeros-=index-1}while(zeros--){value="0"+value}value="0."+value}else{index=match[0].lastIndexOf(".");if(index>-1){zeros-=match[0].length-index-1}while(zeros--){value+="0"}}}if(decimal!="."){value=value.replace(".",decimal)}if(group){index=value.lastIndexOf(decimal);index=(index>-1)?index:value.length;var newOutput=value.substring(index),i=index;while(i--){if((index-i-1)%3==0&&i!=(index-1)){newOutput=group+newOutput}newOutput=value.charAt(i)+newOutput}value=newOutput}if(prefix){value=prefix+value}if(suffix){value+=suffix}return value},formatCurrency:function(decimals){var locale=Locale.get("Number.currency")||{};if(locale.scientific==null){locale.scientific=false}locale.decimals=decimals!=null?decimals:(locale.decimals==null?2:locale.decimals);return this.format(locale)},formatPercentage:function(decimals){var locale=Locale.get("Number.percentage")||{};if(locale.suffix==null){locale.suffix="%"}locale.decimals=decimals!=null?decimals:(locale.decimals==null?2:locale.decimals);return this.format(locale)}});