<!--
// ESTIMATED COST OF WAL-MART TO TAXPAYERS
// JavaScript by Aaron Myers for Wake Up Wal-Mart
// TO LEARN MORE, visit http://www.wakeupwalmart.com


// 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 Wal-Mart cost calculation

function walmartcost(){
// These next two lines get the current time with milliseconds included
// and also set the original start date.
var today=new Date()
var originaldate=new Date(2006,0,1)


// Next line gives total time passed since original date in milliseconds.
var amountoftime=today-originaldate


// BASIS FOR THE CALCULATION:
// There are $2,103 in eligible federal subsidies for each employee.
// Wal-Mart has 1.3 million employees.
// So... 2103 X 1300000 = 2733900000
// divided by 31556926 seconds in a year
// equals a cost per second of $86.63
//
// 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 86.63 to figure the dollars and then
// adds the dollar amount prior to the original date for a total.
// Right now, 0 is used as the initial amount but can be changed if need be.
totalcost=Math.round(((amountoftime/1000)*86.63)+0)

// Next line adds commas to the resulting cost of Wal-Mart.
costwithcommas=number_format(totalcost)

// Next line handles placement of the final formatted number.
document.getElementById ("TickerCost").innerHTML ="$"+costwithcommas;

/// THIS NUMBER SETS UPDATE FREQUENCY in milliseconds with 1000 = 1 second
setTimeout("walmartcost()", 250);
}

//-->