var d1, d2;
var ctr=0;

var images=new Array();
for(i=0;i<=6;i++){
images[i]=new Image(); images[i].src='dice'+i+'.gif';
}

function rolldice(){
document.f.t.value='';
document.f.b.value='     Rolling.....    ';
if(ctr<6){
showdice();
ctr++;
setTimeout('rolldice()',150);
}else{
ctr=0;
showdice();
document.f.t.value=d1+d2;
document.f.b.value='Roll the dice...';
}}

function showdice(){
d1=Math.floor(Math.random()*6+1);
d2=Math.floor(Math.random()*6+1);
document.images['d1'].src='dice'+d1+'.gif';
document.images['d2'].src='dice'+d2+'.gif';
}
