I wrote this countdown script a little while ago, not quite what you need but should get you one the right lines.
<script type="text/javascript">
function Countdown(release, imgid, image)
{
//transform realease into date format
//should probably change this to use the server time (use date())
release = new Date(release)
var images = new Array()
for(var i=0;i<10;i++) {
images[i] = new Image()
images[i].src=image+i+'.gif'
}
//force immediate update
update()
//update every second
setInterval(update,1000)
//Nested function update
function update()
{
var now = new Date()
var seconds = Math.floor((release-now)/1000) <0 ? 0 : Math.floor((release-now)/1000)
var minutes = Math.floor(seconds/60)
var hours = Math.floor(minutes/60)
var days = Math.floor(hours/24)
seconds = seconds-(minutes*60)
minutes = minutes-(hours*60)
hours = hours-(days*24)
var img = new Array()
img[8] = images[seconds%10]
img[7] = images[seconds<10?0:Math.floor(seconds/10)%10]
img[6] = images[minutes%10]
img[5] = images[minutes<10?0:Math.floor(minutes/10)%10]
img[4] = images[hours%10]
img[3] = images[hours<10?0:Math.floor(hours/10)%10]
img[2] = images[days%10]
img[1] = images[days<10?0:Math.floor(days/10)%10]
for(var i=1;i<9;i++) {
var command='document.images.'+imgid+(i+1)+'.src=img['+i+'].src'
// alert(command+'\n'+' and img['+i+'].src is '+img[i].src);
eval(command)
}
}
}
</script>
<img src="" width="7" height="10" alt="" id="img2" /><img src="" width="7" height="10" alt="" id="img3" />days
<img src="" width="7" height="10" alt="" id="img4" /><img src="" width="7" height="10" alt="" id="img5" />hr
<img src="" width="7" height="10" alt="" id="img6" /><img src="" width="7" height="10" alt="" id="img7" />min
<img src="" width="7" height="10" alt="" id="img8" /><img src="" width="7" height="10" alt="" id="img9" />s <a href="dogs" class="t11bb">»buy</a></span></td></tr>
<script type="text/javascript">
new Countdown('April 02 2004 00:00:01','img','');
</script>
The first parameter is the time you are counting down to, the second is the prefix of the the div ids (so that you can have more than one countdown on any particular page), the third is the prefix for the image file names (so you can have different number images for different countdowns)
HTH
Bubble