<!-- 


var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();




var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)   
year = year + 1900;
document.write("<b>Chronic Disease Awareness</b><br> ");
document.write("As of " + lmonth + " ");
document.write(date + ", " + " approximately ");






var curamount=0;  	   // beginning number of people dead
var curscale=0;   	   // scale
var curunit="";   	   // name of the alternate scale
var geographicscale=1; // scale the final number by this amount

function calc_amount () {
  start = new Date ("Jan 1, 2009"); // must have constant beginning date
  curdate = new Date ();
  diff = curdate - start;

  if (diff < 0) {
    alert ("CDC uses your computers date to calculate the total. "+
           "Yours must be wrong because according to your computer the date "+
	   "is before our time!");
  }
  
  var millispermonth = 2678400000;                // 31*24*60*60*1000 2678400000
  var initialamount = 0;                // Starting number
  var sincethen = 143989.1 / millispermonth;    // 144,000 / month
  

  compareamount = (initialamount + diff * sincethen) * geographicscale;
  curamount = compareamount;
}

// Converts a number 'n' to a string with commas every three characters.
function number_str (n) {
  //var x = n.toFixed (0);  this doesn't seem to work on some browsers
  var x = n.toString ();
  var dot = x.lastIndexOf ('.');
  x = x.substr (0, dot);
  var l = x.length;
  var res = "";
  for (l -= 3; l > 0; l -= 3) {
    res = "," + x.substr (l, 3) + res;
  }
  res = x.substr (0, l+3) + res;
  return res;
}

function inc_totals_at_rate(rate) {
  calc_amount ();
  document.getElementById ("raw").firstChild.nodeValue = 
  number_str(curamount) + " people have died from chronic disease this year.";
  try {
    if (curscale != 0) {
  	    var altamount = compareamount / curscale;
  	    document.getElementById ("alt").firstChild.nodeValue =
  	    number_str(altamount) + curunit;
    }
    else {
  	    document.getElementById ("alt").firstChild.nodeValue = "";
    }
  } catch (e)
  {
     // ignore if there is no 'alt' element
  }
  setTimeout('inc_totals_at_rate('+rate+');', rate);
}

// For backwards compatibility, this function will cause the totals to
// increment at a rate of 100ms.
function inc_totals ()
{
  inc_totals_at_rate (100);
}


// -->
