$(document).ready(function(){ startCount(); });

/* Javascript Applet ----- POPULATION COUNTER */

/*Written by Peter Russell, 1996. 
You may copy and use this script providing credit is given to the source.
*/

basedate = new Date("July 1, 2005 12:00:00") ;
today = new Date() ;
basemillisecs = basedate.getTime();
millisecs = today.getTime();
var PopNow = 6455658790 + (millisecs - basemillisecs)*2.37/1000;
PopNow=6000000000+Math.round(PopNow-6000000000);

var TimeoutID = null;
var countRunning = false;
var string = "5812665976";

function stopCount() {
if(countRunning)
clearTimeout(timeoutID);
countRunning = false;
}

function startCount() {
stopCount();
updatePop();
}

function updatePop() {
/*test browser base date is 1/1/70*/
testdate = new Date("Dec 31, 1969 00:00:00") ;
testmillisecs = testdate.getTime();
if(testmillisecs<20000000)
{
var populationNow = PopNow++;
$("#div-poblacion").html(addCommas(populationNow) +' Personas');
}
timeoutID = setTimeout("updatePop()", 426);
countRunning = true;
}

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;
}
