function sprintf(H){var R,j,S,W,C,o,G,Z,x,d=1,z=H.split("");for(R=0,x=z.length;R<=x;R++){if(z[R]=="%"){W=sprintf.arguments[d++];C=Z=S="",j=0,o=" ";do{G=z[R],z[R++]="";switch(G){case "$":W=sprintf.arguments[Z];Z="";break;case ".":if(Z==""){Z=0;}S=z[R],z[R++]="";break;case "%":G=z[R];break;case "+":if(C==""){C="+";}break;case "-":j=1;break;case "'":o=z[R],z[R++]="";break;case "0":if(Z==""){o=G;break;}if(S==""){Z+=G;}else{S+=G;}break;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":if(S==""){Z+=G;}else{S+=G;}break;default:R--;break;}}while("#"<G&&G<":");Z=(Z=="")?0:Number(Z);if(!isNaN(Number(W))){if(W<0){C="";}if(S!=""){W=W.toFixed(S);}}switch(G){case "%":d--;z[R]=G;continue;case "F":W=W.toFixed(6);break;case "f":W=W.toFixed(6);break;case "o":W=W.toString(8);break;case "u":W=W.toString(10);break;case "d":W=W.toString(10);break;case "c":W=String.fromCharCode(W);break;case "b":W=parseInt(W).toString(2);break;case "x":W=W.toString(16).toLowerCase();break;case "X":W=W.toString(16).toUpperCase();break;case "e":W=parseInt(W).toExponential(S||5);break;case "s":C="";if(S!=""){W=W.slice(0,S);}break;}if(W.length<Z){if(j){W=W+Array(Z-W.length-C.length+1).join(o);}else{W=Array(Z-W.length-C.length+1).join(o)+W;}}z[R]=C+W;}}return z.join("");}