Date.prototype.format=function(m,r){var d=this,a,fix=function(n,c){return(n=n+"").length11?"pm":"am"},A:function(){return f.a().toUpperCase()},O:function(){return d.getTimezoneOffset()/60},z:function(){return(d-new Date(d.getFullYear()+"/1/1"))/864e5>>0},L:function(){var y=f.Y();return(!(y&3)&&(y%1e2||!(y%4e2)))?1:0},t:function(){var n;return(n=d.getMonth()+1)==2?28+f.L():n&1&&n<8||!(n&1)&&n>7?31:30},W:function(){var a=f.z(),b=364+f.L()-a,nd=(new Date(d.getFullYear()+"/1/1").getDay()||7)-1;return(b<=2&&((d.getDay()||7)-1)<=2-b)?1:(a<=2&&nd>=4&&a>=(6-nd))?new Date(d.getFullYear()-1+"/12/31").format("%W%"):(1+(nd<=3?((a+nd)/7):(a-(7-nd))/7)>>0);}} return m.replace(/%(.*?)%/g,function(t,s){return r[s]?r[s](d,function(s){return f[s]&&f[s]();}):f[s]?f[s]():"%"+(s&&s+"%");});} String.prototype.replaceAll=function(needle,replacement) {var str=this while(str.indexOf(needle)>-1) {str=str.replace(needle,replacement);} return str;} String.prototype.pad=function(l,s,t){return s||(s=" "),(l-=this.length)>0?(s=new Array(Math.ceil(l/s.length)+1).join(s)).substr(0,t=!t?l:t==1?0:Math.ceil(l/2))+this+s.substr(0,l-t):this;};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();} String.prototype.camelize=function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i