digit0 = new Image(13,23); digit0.src = "/g/i/s/thebombdigit0.gif";
digit1 = new Image(13,23); digit1.src = "/g/i/s/thebombdigit1.gif";
digit2 = new Image(13,23); digit2.src = "/g/i/s/thebombdigit2.gif";
digit3 = new Image(13,23); digit3.src = "/g/i/s/thebombdigit3.gif";
digit4 = new Image(13,23); digit4.src = "/g/i/s/thebombdigit4.gif";
digit5 = new Image(13,23); digit5.src = "/g/i/s/thebombdigit5.gif";
digit6 = new Image(13,23); digit6.src = "/g/i/s/thebombdigit6.gif";
digit7 = new Image(13,23); digit7.src = "/g/i/s/thebombdigit7.gif";
digit8 = new Image(13,23); digit8.src = "/g/i/s/thebombdigit8.gif";
digit9 = new Image(13,23); digit9.src = "/g/i/s/thebombdigit9.gif";

//current_date = new Date([% cur_year %], [% cur_month - 1 %], [% cur_day %], [% cur_hour %], [% cur_min %], [% cur_sec %]);
//finish_date = new Date(2006, 11, 16);

//alert(current_date.toString());
//alert(finish_date.toString());

diff_date = parseInt((finish_date - current_date) / 1000);
seconds = (diff_date % 60);
mins = parseInt(diff_date / 60) % 60;
hours = parseInt(diff_date / 3600); 

function countdown() {
  if (diff_date >= 0) 
    setTimeout("updateTime();", 1000);
  else {
    changeDiv('seconds',0);
    changeDiv('mins',0);
    changeDiv('hours',0);    
  }
}

function updateTime() {
  diff_date--;

  new_seconds = (diff_date % 60);
  new_mins = parseInt(diff_date / 60) % 60;
  new_hours = parseInt(diff_date / 3600); 

  if (new_seconds!=seconds)
    changeDiv('seconds',new_seconds);
  if (new_mins!=mins)    
    changeDiv('mins',new_mins);
  if (new_hours!=hours)    
    changeDiv('hours',new_hours);

  seconds = new_seconds;
  mins = new_mins;
  hours = new_hours;

  countdown();
}

function changeDiv(divID, time) {
  innerHTML = '<img src="/g/i/s/thebombdigit' + parseInt(time / 10) + '.gif" width="13" height="23" style="margin-left: 1px;" />';
  innerHTML += '<img src="/g/i/s/thebombdigit' + parseInt(time % 10) + '.gif" width="13" height="23" style="margin-left: 1px;" />';
  document.getElementById(divID).innerHTML = innerHTML;
}

window.onload = countdown;