var ccount={'1':{c:2481,u:2336},'2':{c:48202,u:40597},'3':{c:34713,u:30386},'4':{c:517,u:503},'5':{c:1,u:1},'6':{c:0,u:0},'':{}}; function ccount_display(id) { document.write(ccount[id]['c'].formatThousands('US')); } function ccount_unique(id) { document.write(ccount[id]['u'].formatThousands('US')); } Number.prototype.formatThousands = function(notation) { var n = this, separator = ""; switch (notation) { case "US": separator = ","; break; case "UK": separator = "."; break; case "FR": separator = " "; break; default: return n; } n = parseInt(n) + ""; j = (j = n.length) > 3 ? j % 3 : 0; return (j ? n.substr(0, j) + separator : "") + n.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + separator); }