pSec = 13;
pTime = 1164651462;
pPopulation = 300294485
s = ((new Date()).getTime()/1000-pTime);
pop = pPopulation+Math.round(s/pSec);

function popUpdate(comment)
{
//	sTime = 1163712873;
//	sPopulation = 300220324;
	obj = document.getElementById('usp');
	//s = ((new Date()).getTime()/1000-sTime);
	//pop = sPopulation+Math.round((s/8)-(s/12)+(s/30));
	pop++;
	obj.innerHTML = 'U.S. population: <b>'+addCommas(pop)+'</b><br><i>('+comment+')</i>';
	setTimeout('popUpdate("'+comment+'")', pSec*1000);
}

function loadPop(comment, sec)
{
	setTimeout('popUpdate("'+comment+'")', sec*1000);
	for ( i=1; i<sec*10; i++ )
	{
		prc = (100/(sec*10-1))*i;
/*		if ( i>10 && i+1 != sec*10 )
		{
			prc -= Math.random(10)*10;
		}*/
		prc = Math.round(prc);

		setTimeout('setPrc("'+comment+'", "'+prc+'")', i*100);
	}
}

function setPrc(comment, prc)
{
	obj = document.getElementById('usp');
	obj.innerHTML = '<font color=green>Loading population info...'+(prc<100 ? ' ' : '')+prc+'%<br>&nbsp;</font>';
}

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;
}