

Time=60

Clones=new Array()
for (c=0;c<13;c++) { Clones[c]=c }

spy=Math.floor(13*Math.random())

Fst=Clones.slice(0,spy)
Snd=Clones.slice(spy+1)
Clones=Fst.concat(Snd)

pos=Math.floor(Math.random()*56)

for(dept=0;dept<7;dept++) {
  for(mem=0;mem<8;mem++) {
    num=dept*8+mem
    divId="div"+num
    ran=Math.floor(Math.random()*12)
    if (num<22&&num%2==0) ran=num/2
    if (num>34&&num<55) { if (num%2==0) ran=(num-34)/2 }
    Pix=Clones[ran]
    if(num==pos){Pix=spy}
    GetDiv(divId,dept*46,20*(dept%2)+mem*35,10,10,'',1,num)
    document.write("<a href='javascript:CheckHim(",num,")'><img src=",Pix,".gif border=0 width=50 height=80></a>")
    EndDiv()
  }
}

clix=0
function CheckHim(x){
  clix++;
       document.getElementById("scorey").innerHTML=clix;
  if(clix>4)Lose(0)
  if(x==pos) { Win() }
}

warn=new Array(" seconds left... Hurry!!!"," seconds left...Oh no! Please!!!")

function CntDwn(){
  Time--
//  window.status=clix+" incorrect tries and only "+Time+warn[Time%2]
       document.getElementById("timey").innerHTML=Time;
  if(Time<1) Lose(1)
}

cnt=setInterval('CntDwn()',1000)

function Lose(x){
  Lost=new Array("More than 5 guesses!","Out of time!")
  clearInterval(cnt)
//  window.status=clix+" guess all wrong and "+Time+" second left!"
  alert("You lose!\n"+Lost[x])
//  window.status="The single one is shown above!"
  SingleOut()
  clix=0
}

function SingleOut(){
  for(x=0;x<56;x++){
    if(x!=pos){
      ShowHide("div"+x,0)
    }
  }
}

function Win(){
   alert("SUPER! You got the One (and only)!");
   clearInterval(cnt);
   SingleOut()
}




