+
+ totalInput.val( total.toString() );
+ };
+
+ dashboardTotals = function(n) {
+ var dash = $('#dashboard_right_now'), total, appr, totalN, apprN;
+
+ n = n || 0;
+ if ( isNaN(n) || !dash.length )
+ return;
+
+ total = $('span.total-count', dash);
+ appr = $('span.approved-count', dash);
+ totalN = getCount(total);
+
+ totalN = totalN + n;
+ apprN = totalN - getCount( $('span.pending-count', dash) ) - getCount( $('span.spam-count', dash) );
+ updateCount(total, totalN);
+ updateCount(appr, apprN);
+
+ };
+
+ getCount = function(el) {
+ var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );
+ if ( isNaN(n) )
+ return 0;
+ return n;
+ };
+
+ updateCount = function(el, n) {
+ var n1 = '';
+ if ( isNaN(n) )
+ return;
+ n = n < 1 ? '0' : n.toString();
+ if ( n.length > 3 ) {
+ while ( n.length > 3 ) {
+ n1 = thousandsSeparator + n.substr(n.length - 3) + n1;
+ n = n.substr(0, n.length - 3);
+ }
+ n = n + n1;