function dollarformat(i) {
  if(!i)
    return("");
  else {
    var i2=Math.floor(i*100);
    var t=Math.floor(i)*100;
    i2=i2-t;
    t/=100;
    i1="";
    while(t>=1000) {
       i1=","+fixed0(t-Math.floor(t/1000)*1000, 3)+i1;
      t=Math.floor(t/1000);
    }
    i1=t+i1;
    return i1+"."+fixed0(i2, 2);
  }
}

function fixed0(i, len) {
  res=i;
  for(c=1; c<len; c++)
    if(i<Math.pow(10,c))
      res="0"+res;
  return res;
}

function jackpot(name, value, oldvalue, increment) {
  this.name=name;
  this.value=value;
  this.oldvalue=oldvalue;
  this.increment=increment;
  this.counter=0;
}

jackpot.prototype.tick=jackpot_tick;
function jackpot_tick() {
  var obj=document.forms["jackpot_form_"+this.name].jackpot;
  if(obj) obj.value="$"+dollarformat(this.value+this.increment*this.counter);
  this.counter++;
  if(this.increment)
    window.setTimeout("jackpot_"+this.name+".tick()", 1000);
}

