var ccount={'2':{c:2852,u:1047},'1':{c:2864,u:1041},'3':{c:1062,u:1030},'4':{c:1052,u:1029},'5':{c:1039,u:1027},'6':{c:1071,u:1049},'7':{c:1040,u:1038},'8':{c:1231,u:1203},'9':{c:1135,u:1112},'10':{c:1037,u:1037},'11':{c:1102,u:1092},'12':{c:1011,u:1008},'13':{c:1062,u:1059},'14':{c:1018,u:1018},'15':{c:1028,u:1028},'16':{c:1043,u:1042},'17':{c:994,u:994},'18':{c:1002,u:1000},'19':{c:958,u:958},'20':{c:961,u:961},'21':{c:972,u:970},'22':{c:967,u:967},'23':{c:472,u:470},'24':{c:0,u:0},'':{}}; // Outputs a formatted number to the browser function ccount_write(sum) { document.write(sum.formatThousands('UK')); } // Displays total clicks for an ID function ccount_display(id) { ccount_write(ccount[id]['c']); } // Displays unique clicks for an ID function ccount_unique(id) { ccount_write(ccount[id]['u']); } // Sums total clicks for IDs passed as arguments function ccount_sum() { var sum = 0; for (var i=0; i if (typeof ccount[arguments[i]]!=='undefined') { sum += ccount[arguments[i]]['c']; } } ccount_write(sum); } // Sums unique clicks for IDs passed as arguments function ccount_sum_unique() { var sum = 0; for (var i=0; i if (typeof ccount[arguments[i]]!=='undefined') { sum += ccount[arguments[i]]['u']; } } ccount_write(sum); } // Displays total clicks count function ccount_total() { var sum = 0; for (var key in ccount) { if (ccount.hasOwnProperty(key) && key !== '') { sum += ccount[key]['c']; } } ccount_write(sum); } // Displays total unique clicks count function ccount_total_unique() { var sum = 0; for (var key in ccount) { if (ccount.hasOwnProperty(key) && key !== '') { sum += ccount[key]['u']; } } ccount_write(sum); } // Adds a thousands separator to a number 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); }