<!--
// ESTIMATED NUMBER OF UNINSURED AMERICANS
// JavaScript by Aaron Myers for DEMOCRATS.SENATE.GOV


// These next few lines add commas to a string of numbers.
function number_format(n) {
  var arr=new Array('0'), i=0; 
  while (n>0) 
    {arr[i]=''+n%1000; n=Math.floor(n/1000); i++;}
  arr=arr.reverse();
  for (var i in arr) if (i>0) //padding zeros
    while (arr[i].length<3) arr[i]='0'+arr[i];
  return arr.join();
}
// This is the end of the comma function.


// This is the start of the uninsured population calculation

function withoutcoverage(){
// These next two lines get the current time with milliseconds included
// and also set the original start date.
// I'm starting at January 1, 2009 because of the 2008 data (released 9/10/2009)
// by the Census Bureau with an estimate of 46.3 million uninsured Americans.
var today=new Date()
var originaldate=new Date(2009,0,1)


// Next line gives total time passed since original date in milliseconds.
var amountoftime=today-originaldate


// BASIS FOR THE CALCULATION:
// We need to determine the per-second uninsured population increase.
// CAP and others note that 14,000 Americans lose coverage each day (February 2009).
// So 14,000 divided by 86,400 seconds in a day = 0.162037037037037
// That's the per-second increase in the uninsured population.
//
// NOTES FROM AARON:
// The line below this note takes the total milliseconds since 
// the original date and then divides by 1000 to get total seconds
// and then multiplies by 0.162037037037037 to determine the
// per-second increase in uninsured since the start date.
// Next, the result of the unsinured population count since the
// start date is added to an initial number to create the total current count.
// Right now, 46.3 million is used as the initial amount
// because that was the latest Census Bureau estimate.
totalcost=Math.round(((amountoftime/1000)*0.162037037037037)+46300000)

// Next line adds commas to the resulting population number.
populationwithcommas=number_format(totalcost)

// Next line handles placement of the final formatted number.
document.getElementById ("WithoutCoverageTicker").innerHTML =" "+populationwithcommas;

/// THIS NUMBER SETS UPDATE FREQUENCY in milliseconds with 1000 = 1 second
setTimeout("withoutcoverage()", 250);
}

//-->