<!-- 
// This was taken from costofwar.com and modified to calculate
// how many dollars starting on 1/1/08 to build to $60 billion by
// the end of the year.

var curamount=0;  	   // Start from amount

function calc_amount () {
  var totalms = 31536086400; // total milliseconds in 2010
  var initialdollars= 0;
  var totaldollars  = 100000000000 - initialdollars;  // 100 billion - $0 initial
  var rateperms     = totaldollars / totalms;
         
  var startoftime = new Date ("Jan 1, 2012");
  var curdate = new Date ();
  var diff = curdate - startoftime;
  
  if (diff < 0) {
    alert ("asbl.com uses your computer's date to calculate the cost. "+
           "Yours must be wrong because according to your computer "+
           "it isn't even 2012 yet!");
  }
  
  // Do the actual calculations and get the amount before and after interest.
  curamount = (initialdollars + diff * rateperms) ;
}

// Converts a number 'n' to a string with commas every three characters.
function number_str (n) {
  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").innerHTML =
  "$" + number_str(curamount);
  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);
}
// -->
