I have a js script that performs a countup based on a start date and interval speed. I'm trying to add commas but can't seem to get the script to work. I'm sure it's something simple but I am terrible at js. I have included the entire code below. If anyone can provide help it would be greatly appreciated.

Thanks!

Code:
<html>
<head>
<title>Untitled Document</title>
<script>
var START_DATE = new Date("December 1, 2010 20:00:00"); // put in the starting date here
var INTERVAL = 1; // in seconds
var INCREMENT = 1; // increase per tick
var START_VALUE = 4166667; // initial value when it's the start date
var count = 0;

window.onload = function()
{
 var msInterval = INTERVAL * 1000;
 var now = new Date();
 count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
 document.getElementById('counter').innerHTML = count;
 setInterval("count += INCREMENT; document.getElementById('counter').innerHTML = count;", msInterval);
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
</script>
</head>

<body>
<div id="counter"></div>
</body>
</html>