<!-- 


var currentamount=0;  	   // total amount saved in dollars
var currentscale=0;   	   // number of dollars per alternate scale
var currentunit="";   	   // name of the alternate scale
var scalingValue=1;     // scale the final number by this amount

// This section creates the .formatMoney function to allow for easy currency formating
Number.prototype.formatMoney = function(c, d, t){
    var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t)
    + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};

function calc_amount () {
  
// 'totalms' is the number of milliseconds is used to determine a rate at which to acrue the savings
var totalms = 63115200000;
  //var totalms = 2387520000;
  var initialdollars= 0;
  var totaldollars  = 2056000 - initialdollars;
  var rateperms     = totaldollars / totalms;
         
  var programrelease = new Date ("Aug 17, 2006");
  var currentdate = new Date ();
  var datediff = currentdate - programrelease;
  
  if (datediff < 0) {
    alert ("TheStandardPlus.com uses your computers date to calculate the savings to our customers. "+
           "Yours must be wrong because according to your computer The Standard "+
           "hasn't even been released yet!");
  }
  
  //calculates savings 
  currentamount = (initialdollars + datediff * rateperms) * scalingValue;
}


// 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;
}

// This section creates the .formatMoney function to allow for easy currency formating
Number.prototype.formatMoney = function(c, d, t){
    var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t)
    + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};

function inc_totals_at_rate(rate) {
  calc_amount ();
  //document.getElementById ("raw").firstChild.nodeValue = 
  //"$" + number_str(currentamount);
  //firefoxfix of two lines above
  document.getElementById ("raw").innerHTML =
  //"$" + number_str(currentamount);
  "$" + currentamount.formatMoney(2,'.',',');
  try {
    if (currentscale != 0) {
  	    var altamount = currentamount / currentscale;
  	    document.getElementById ("alt").firstChild.nodeValue =
  	    number_str(altamount) + currentunit;
  	    
    }
    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);
}

function setcurrentscale(scale)
{
	scalingValue = scale;
}


//-->
