var c=0;
var t;
var a1;
var a2;
var a3;
var i;
var j;
var k;

function images()
{
a1=(Math.ceil(Math.random()*6));
i=a1;
a2=(Math.ceil(Math.random()*6));
j=a2;
a3=(Math.ceil(Math.random()*6));
k=a3;

document.getElementById("aha1").src=("aha1_"+a1+".JPG");
document.getElementById("aha2").src=("aha2_"+a2+".JPG");
document.getElementById("aha3").src=("aha3_"+a3+".JPG");

timedCount();
}

function image1()
{
a1=(Math.ceil(Math.random()*6));
if (a1==i)
  { 
  a1++;
  if (a1>6) { a1=1; }
  }
i=a1;

document.getElementById("aha1").src=("aha1_"+a1+".JPG");
timedCount();
}

function image2()
{
a2=(Math.ceil(Math.random()*6));
if (a2==j)
  { 
  a2++;
  if (a2>6) { a2=1; }
  }
j=a2;

a2=(Math.ceil(Math.random()*6));

document.getElementById("aha2").src=("aha2_"+a2+".JPG");
}

function image3()
{
a3=(Math.ceil(Math.random()*6));
if (a3==k)
  { 
  a3++;
  if (a3>6) { a3=1; }
  }
k=a3;

a3=(Math.ceil(Math.random()*6));

document.getElementById("aha3").src=("aha3_"+a3+".JPG");
}

function timedCount()
{
c++;
t=setTimeout("timedCount()",1000);

if (c==3)
  {
  image3();
  }

if (c==5)
  {
  image2();
  }

if (c>6)
  {
  clearTimeout(t);
  c=0;
  image1(); 
  } 
}
