// JavaScript Document
<!-- 
// Set up some global variables:
var curamount=0;      
// This function ccalculates time between current and start date to  
// increment a counter every 2 sec [1200ms]
function calc_amount () {
  var initialAmt = 300000000;
  var incrementer = 1200;
  var initdate   = new Date ("Feb 27, 2005");
  var curdate   = new Date ();
  var diff = curdate - initdate;
  curamount = initialAmt + (diff / incrementer);
}
// 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 ();
  // redisplay the div tag total 
  document.getElementById ("raw").firstChild.nodeValue = 
  "$" + number_str(curamount);
  //timer
  setTimeout('inc_totals_at_rate('+rate+');', rate);
}
function inc_totals ()
{
  inc_totals_at_rate (1000);
}

