//  Inizio  Variabili fuori dalle funzioni
punti=100;
a_num= new Array();
for (a=1; a<50; a++){
  a_num[a]=false;
}
p_fuori=true;
//  Fine  Variabili fuori dalle funzioni
function punteggio(parte){
  if (document.getElementById){
    tempo=0;
    if (parte==1){  
	  punti-=15;
      tempo=300;
	  p_fuori=false;
	  document.getElementById('copri').style.display='block';
      document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-10.gif';
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-9.gif'; document.getElementById('copri').style.display='none'; p_fuori=true;",tempo);
    }
	else if (parte==2){
	  punti-=3;
	  tempo=300;
	  p_fuori=false;
	  document.getElementById('copri').style.display='block';
      document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-12.gif';
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-11.gif'; document.getElementById('copri').style.display='none'; p_fuori=true;",tempo);
	}
	else if (parte==3){
	  punti-=5;
	  tempo=200;
	  p_fuori=false;
	  document.getElementById('copri').style.display='block';
      document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-2.gif';
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-4.gif'; document.getElementById('copri').style.display='none'; p_fuori=true;",tempo);
	}
	else if (parte==4){
	  punti-=5;
	  tempo=200;
	  p_fuori=false;
	  document.getElementById('copri').style.display='block';
	  document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-3.gif';
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-5.gif'; document.getElementById('copri').style.display='none'; p_fuori=true;",tempo);
	}
	else if (parte==5){
	  punti-=20;
	  tempo=800;
	  p_fuori=false;
	  document.getElementById('copri').style.display='block';
	  document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-8.gif';
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-7.gif'; document.getElementById('copri').style.display='none'; p_fuori=true;",tempo);
	}
	if (punti<=0){
	  setTimeout("document.getElementById('copri').style.display='block'; document.getElementById('frec').innerHTML='';",tempo);
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1-6.gif';",tempo);
	  setTimeout("document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1.gif'; document.getElementById('copri').style.display='none';",7000+tempo);
	  setTimeout("punti=100;",7000+tempo);
	  for (a=1; a<50; a++){
        a_num[a]=false;
	  }
	}
  }
}

function img_out(){
  if (document.getElementById){
	if ((punti>0)&&(p_fuori==true)){
	  document.getElementById('img').src='http://willyilcoyote.altervista.org/variexsito/img/img_id-1.gif';
	}
  }
}

function mirino(parte){
  if (document.getElementById){
    s_mir=document.getElementById('mirino').style;
    if (parte==1){
	  s_mir.display='block';
	  s_mir.top=3+'px';
      s_mir.left=5+'px';
	}
	else if (parte==2){
	  s_mir.display='block';
	  s_mir.top=3+'px';
      s_mir.left=107+'px';
	}
	else if (parte==3){
	  s_mir.display='block';
	  s_mir.top=98+'px';
      s_mir.left=7+'px';
	}
	else if (parte==4){
	  s_mir.display='block';
	  s_mir.top=98+'px';
      s_mir.left=100+'px';
	}
	else if (parte==5){
	  s_mir.display='block';
	  s_mir.top=33+'px';
      s_mir.left=2+'px';
	}
	else if (parte==6){
	  s_mir.display='block';
	  s_mir.top=70+'px';
      s_mir.left=2+'px';
	}
	else if (parte==7){
	  s_mir.display='block';
	  s_mir.top=105+'px';
      s_mir.left=53+'px';
	}
	else if (parte==8){
	  s_mir.display='block';
	  s_mir.top=50+'px';
      s_mir.left=108+'px';
	}
	else if (parte==9){
	  s_mir.display='block';
	  s_mir.top=0+'px';
      s_mir.left=80+'px';
	}
	else if (parte==10){
	  s_mir.display='block';
	  s_mir.top=0+'px';
      s_mir.left=55+'px';
	}
	else if (parte==11){
	  s_mir.display='block';
	  s_mir.top=0+'px';
      s_mir.left=30+'px';
	}
	else if (parte==12){
	  s_mir.display='block';
	  s_mir.top=25+'px';
      s_mir.left=18+'px';
	}
	else if (parte==13){
	  s_mir.display='block';
	  s_mir.top=55+'px';
      s_mir.left=20+'px';
	}
	else if (parte==14){
	  s_mir.display='block';
	  s_mir.top=52+'px';
      s_mir.left=90+'px';
	}
	else if (parte==15){
	  s_mir.display='block';
	  s_mir.top=21+'px';
      s_mir.left=97+'px';
	}
	else if (parte==16){
	  s_mir.display='block';
	  s_mir.top=25+'px';
      s_mir.left=60+'px';
	}
  }
}

function no_mir(){
  if (document.getElementById){
    s_mir=document.getElementById('mirino').style;
	s_mir.display='none';
  }
}
function freccetta(parte){
  if (document.getElementById){
    img_top=0+'px';
	img_left=0+'px';
    if (parte==1){
	  do{
        var num= Math.round(1*Math.random());
        if ((num==0)&&(a_num[1]==false)){
	      img_top=10+'px';
	      img_left=5+'px';
	      punti-=1;
		  a_num[1]=true;
		  break;
        }
	    else if ((num==1)&&(a_num[2]==false)){
	      img_top=5+'px';
	      img_left=9+'px';
		  punti-=1;
		  a_num[2]=true;
		  break;
        }
	  }while((a_num[1]==false)||(a_num[2]==false));
	}
	else if (parte==2){
	  do{
	    var num= Math.round(1*Math.random());
	    if ((num==0)&&(a_num[3]==false)){
	      img_top=5+'px';
	      img_left=105+'px';
		  punti-=1;
		  a_num[3]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[4]==false)){
          img_top=10+'px';
	      img_left=108+'px';
		  punti-=1;
		  a_num[4]=true;
		  break;
	    }
	  }while((a_num[3]==false)||(a_num[4]==false));
	}
	else if (parte==3){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[5]==false)){
	      img_top=105+'px';
	      img_left=10+'px';
		  punti-=1;
		  a_num[5]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[6]==false)){
	      img_top=98+'px';
	      img_left=3+'px';
		  punti-=1;
		  a_num[6]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[7]==false)){
	      img_top=110+'px';
	      img_left=16+'px';
		  punti-=1;
		  a_num[7]=true;
		  break;
	    }
	  }while((a_num[5]==false)||(a_num[6]==false)||(a_num[7]==false));
	}
	else if (parte==4){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[8]==false)){
	      img_top=105+'px';
	      img_left=103+'px';
		  punti-=1;
		  a_num[8]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[9]==false)){
	      img_top=98+'px';
	      img_left=110+'px';
		  punti-=1;
		  a_num[9]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[10]==false)){
	      img_top=107+'px';
	      img_left=94+'px';
		  punti-=1;
		  a_num[10]=true;
		  break;
	    }
	  }while((a_num[8]==false)||(a_num[9]==false)||(a_num[10]==false));
	}
	else if (parte==5){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[11]==false)){
	      img_top=30+'px';
	      img_left=3+'px';
		  punti-=1;
		  a_num[11]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[12]==false)){
	      img_top=38+'px';
	      img_left=2+'px';
		  punti-=1;
		  a_num[12]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[13]==false)){
	      img_top=48+'px';
	      img_left=4+'px';
		  punti-=1;
		  a_num[13]=true;
		  break;
	    }
	  }while((a_num[11]==false)||(a_num[12]==false)||(a_num[13]==false));
	}
	else if (parte==6){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[14]==false)){
	      img_top=62+'px';
	      img_left=2+'px';
		  punti-=1;
		  a_num[14]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[15]==false)){
	      img_top=72+'px';
	      img_left=4+'px';
		  punti-=1;
		  a_num[15]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[16]==false)){
	      img_top=84+'px';
	      img_left=3+'px';
		  punti-=1;
		  a_num[16]=true;
		  break;
	    }
	  }while((a_num[14]==false)||(a_num[15]==false)||(a_num[16]==false));
	}
	else if (parte==7){
	  do{
	    var num= Math.round(4*Math.random());
	    if ((num==0)&&(a_num[17]==false)){
	      img_top=109+'px';
	      img_left=30+'px';
		  punti-=1;
		  a_num[17]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[18]==false)){
	      img_top=110+'px';
	      img_left=40+'px';
		  punti-=1;
		  a_num[18]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[19]==false)){
	      img_top=111+'px';
	      img_left=53+'px';
		  punti-=1;
		  a_num[19]=true;
		  break;
	    }
	    else if ((num==3)&&(a_num[20]==false)){
	      img_top=111+'px';
	      img_left=63+'px';
		  punti-=1;
		  a_num[20]=true;
		  break;
	    }
	    else if ((num==4)&&(a_num[21]==false)){
	      img_top=111+'px';
	      img_left=75+'px';
		  punti-=1;
		  a_num[21]=true;
		  break;
	    }
	  }while((a_num[17]==false)||(a_num[18]==false)||(a_num[19]==false)||(a_num[20]==false)||(a_num[21]==false));
	}
	else if (parte==8){
	  do{
	    var num= Math.round(4*Math.random());
	    if ((num==0)&&(a_num[22]==false)){
	      img_top=25+'px';
	      img_left=112+'px';
		  punti-=1;
		  a_num[22]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[23]==false)){
	      img_top=40+'px';
	      img_left=111+'px';
		  punti-=1;
		  a_num[23]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[24]==false)){
	      img_top=52+'px';
	      img_left=111+'px';
		  punti-=1;
		  a_num[24]=true;
		  break;
	    }
	    else if ((num==3)&&(a_num[25]==false)){
	      img_top=62+'px';
	      img_left=110+'px';
		  punti-=1;
		  a_num[25]=true;
		  break;
	    }
	    else if ((num==4)&&(a_num[26]==false)){
	      img_top=78+'px';
	      img_left=111+'px';
		  punti-=1;
		  a_num[26]=true;
		  break;
	    }
	  }while((a_num[22]==false)||(a_num[23]==false)||(a_num[24]==false)||(a_num[25]==false)||(a_num[26]==false));
	}
	else if (parte==9){
	  do{
	    var num= Math.round(1*Math.random());
	    if ((num==0)&&(a_num[27]==false)){
	      img_top=2+'px';
	      img_left=90+'px';
		  punti-=1;
		  a_num[27]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[28]==false)){
	      img_top=1+'px';
	      img_left=80+'px';
		  punti-=1;
		  a_num[28]=true;
		  break;
	    }
	  }while((a_num[22]==false)||(a_num[23]==false));
	}
	else if (parte==10){
	  do{
	    var num= Math.round(1*Math.random());
	    if ((num==0)&&(a_num[29]==false)){
	      img_top=2+'px';
	      img_left=50+'px';
		  punti-=1;
		  a_num[29]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[30]==false)){
	      img_top=2+'px';
	      img_left=60+'px';
		  punti-=1;
		  a_num[30]=true;
		  break;
	    }
	  }while((a_num[29]==false)||(a_num[30]==false));
	}
	else if (parte==11){
	  do{
	    var num= Math.round(1*Math.random());
	    if ((num==0)&&(a_num[31]==false)){
	      img_top=1+'px';
	      img_left=25+'px';
		  punti-=1;
		  a_num[31]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[32]==false)){
	      img_top=2+'px';
	      img_left=37+'px';
		  punti-=1;
		  a_num[32]=true;
		  break;
	    }
	  }while((a_num[31]==false)||(a_num[32]==false));
	}
	else if (parte==12){
	  do{
	    var num= Math.round(3*Math.random());
	    if ((num==0)&&(a_num[33]==false)){
	      img_top=15+'px';
	      img_left=27+'px';
		  punti-=2;
		  a_num[33]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[34]==false)){
	      img_top=25+'px';
	      img_left=15+'px';
	  	  punti-=2;
		  a_num[34]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[35]==false)){
	      img_top=40+'px';
	      img_left=16+'px';
	  	  punti-=2;
		  a_num[35]=true;
		  break;
	    }
	    else if ((num==3)&&(a_num[36]==false)){
	      img_top=43+'px';
	      img_left=24+'px';
		  punti-=2;
		  a_num[36]=true;
		  break;
	    }
	  }while((a_num[33]==false)||(a_num[34]==false)||(a_num[35]==false)||(a_num[36]==false));
	}
	else if (parte==13){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[37]==false)){
	      img_top=56+'px';
	      img_left=29+'px';
		  punti-=2;
		  a_num[37]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[38]==false)){
	      img_top=58+'px';
	      img_left=18+'px';
		  punti-=2;
		  a_num[38]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[39]==false)){
	      img_top=67+'px';
	      img_left=15+'px';
		  punti-=2;
		  a_num[39]=true;
		  break;
	    }
	  }while((a_num[37]==false)||(a_num[38]==false)||(a_num[39]==false));
	}
	else if (parte==14){
	  do{
	    var num= Math.round(3*Math.random());
	    if ((num==0)&&(a_num[40]==false)){
	      img_top=50+'px';
	      img_left=98+'px';
		  punti-=2;
		  a_num[40]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[41]==false)){
	      img_top=55+'px';
	      img_left=88+'px';
		  punti-=2;
		  a_num[41]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[42]==false)){
	      img_top=63+'px';
	      img_left=100+'px';
		  punti-=2;
		  a_num[42]=true;
		  break;
	    }
	    else if ((num==3)&&(a_num[43]==false)){
	      img_top=65+'px';
	      img_left=78+'px';
		  punti-=2;
		  a_num[43]=true;
		  break;
	    }
	  }while((a_num[40]==false)||(a_num[41]==false)||(a_num[42]==false)||(a_num[43]==false));
	}
	else if (parte==15){
	  do{
	    var num= Math.round(1*Math.random());
	    if ((num==0)&&(a_num[44]==false)){
	      img_top=32+'px';
	      img_left=98+'px';
		  punti-=2;
		  a_num[44]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[45]==false)){
	      img_top=20+'px';
	      img_left=96+'px';
		  punti-=2;
		  a_num[45]=true;
		  break;
	    }
	  }while((a_num[44]==false)||(a_num[45]==false));
	}
	else if (parte==16){
	  do{
	    var num= Math.round(2*Math.random());
	    if ((num==0)&&(a_num[46]==false)){
	      img_top=32+'px';
	      img_left=60+'px';
		  punti-=2;
		  a_num[46]=true;
		  break;
	    }
	    else if ((num==1)&&(a_num[47]==false)){
	      img_top=20+'px';
	      img_left=53+'px';
		  punti-=2;
		  a_num[47]=true;
		  break;
	    }
	    else if ((num==2)&&(a_num[48]==false)){
	      img_top=15+'px';
	      img_left=65+'px';
		  punti-=2;
		  a_num[48]=true;
		  break;
	    }
	  }while((a_num[46]==false)||(a_num[47]==false)||(a_num[48]==false));
	}
	freccia='<di'+'v style="position: absolute; top: '+img_top+'; left: '+img_left+'"><img alt="" src="http://willyilcoyote.altervista.org/variexsito/img/img_id-22.gif">'+'<'+'/div>';
	document.getElementById('frec').innerHTML+=freccia;
  }
}