/* IntegraXor Web SCADA - JavaScript Number Formatter http://www.integraxor.com/ author: KPL, KHL (c)2011 ecava Dual licensed under the MIT or GPL Version 2 licenses. */ /* window.format=function(b,a){if(!b||isNaN(+a))return a;var a=b.charAt(0)=="-"?-a:+a,j=a<0?a=-a:0,e=b.match(/[^\d\-\+#]/g),h=e&&e[e.length-1]||".",e=e&&e[1]&&e[0]||",",b=b.split(h),a=a.toFixed(b[1]&&b[1].length),a=+a+"",d=b[1]&&b[1].lastIndexOf("0"),c=a.split(".");if(!c[1]||c[1]&&c[1].length<=d)a=(+a).toFixed(d+1);d=b[0].split(e);b[0]=d.join("");var f=b[0]&&b[0].indexOf("0");if(f>-1)for(;c[0].length -1 ) { while (part[0].length < (m[0].length - pos_lead_zero)) { part[0] = '0' + part[0]; } } else if (+part[0] == 0){ part[0] = ''; } v = v.split('.'); v[0] = part[0]; //process the first group separator from decimal (.) only, the rest ignore. //get the length of the last slice of split result. var pos_separator = ( szSep[1] && szSep[ szSep.length-1].length); if (pos_separator) { var integer = v[0]; var str = ''; var offset = integer.length % pos_separator; for (var i=0, l=integer.length; i