ori=new Array(a,b,c,d)
oriu=new Array(0,0,0,0)
lec=new Array(0,0,0,0)
sol=new Array(0,0,0,0)
solw=new Array(0,0,0,0)
p=new Array(0,0,0,0)
q=new Array(0,0,0,0)
yu=new Array(0,0,0,0)
for(i=0;i<4;i++){
 oriu[i]=ori[i].replace("¿","<u>¿")
 oriu[i]=oriu[i].replace("?","</u>?")
 lec[i]=oriu[i]
 for(j=0;j<4;j++){
  lec[i]=lec[i].replace(j,"")
  }
 n=Math.floor(4*Math.random())
 p[i]=oriu[i].replace(n,"w")
 for(j=0;j<4;j++){
  p[i]=p[i].replace(j,"")
  }
 wpos=p[i].indexOf("w")
 q[i]=p[i].replace(/[, ;.:"]/g,"~")
 fpos=q[i].indexOf("~",wpos)
 solw[i]=q[i].substring(wpos,fpos)
 sol[i]=solw[i].substring(1,solw[i].length)
 p[i]=p[i].replace(solw[i],"( . . . . )")
 tam=sol[i].length/2
 if (tam>5) tam=5
 yu[i]=sol[i].substring(0,tam)
}
comen=""
r=new Array(0,0,0,0)
ay=new Array(0,0,0,0)
letra=titu.substring(0,1)
nume=parseInt(titu.substring(1,titu.length))
nume++
pr="preg.htm?"
newtit=pr+letra+nume
titori=pr+titu
titant=pr+letra+(nume-2)
temas="temas"+letra+".htm"
if (nume-2==0) titant=temas
if (letra=='m' && nume>29) newtit=temas
if (letra!='m' && nume>23) newtit=temas
hcap='<HTML><BODY TEXT="#000000" BGCOLOR="#99cccc"><p><br><br><table cellpadding=15 width="100%"><colgroup><col><col><col><tr><td width="20%"><th width="60%" BGCOLOR="#F9FFF9">'
function limp(i){
 j2=document.formu.elements[i]
 if(j2.value!='sí, sí'){
  j2.value=''
  j2.style.backgroundColor='#feecda'}
}
function compr(k){
if(document.formu.elements[k].value!=''){
 j1=document.formu.elements[k+1]
 if(j1.value!='sí, sí'){
  if(document.formu.elements[k].value==sol[k/3]){
   j1.value='sí, sí'
   j1.style.backgroundColor='#ccffcc'
   r[k/3]=1}
  else{
   j1.value='   no'
   j1.style.backgroundColor='#ffffcc'}}
 else {j1.value='sí, sí'}}
}
function ayu(y){
 ay[y/3]=1
 document.formu.elements[y].value=yu[y/3]
 document.formu.elements[y].focus()
}
function tab(e,f){
tecla=(document.all)? e.keyCode : e.which
if(tecla==13){if(f<9)document.formu.elements[f+3].focus(); if(f==9)document.formu.elements[10].focus(); if(f>9) conti()}
}
function conti(){
 tf=new Date;msegf=tf.getTime()
 tt1=(msegf-mseg0)/1000
 tt=parseInt(tt1)
 min(tt)
 rto=r[0]+r[1]+r[2]+r[3]
 rtot=rto+" aciertos"
 if (rto==1) rtot="1 acierto"
 ayto=ay[0]+ay[1]+ay[2]+ay[3]
 aytot=ayto+" ayudas"
 if (ayto==1) aytot="1 ayuda"
 pun=rto*25-ayto*10-tt+18
 if (pun>49) {comen=" (bien)";eres="un experto"}
 if (pun>74) comen=" (¡muy bien!) "+'<img src="aplauso.gif">'
 if (pun<25) eres="novato-novato"
 else{if (pun<50) eres="un aprendiz"}
 if (rto==0) {pun=0}
 if (pun<4) {pun=rto*2;comen=" (¡ánimo!)"}
 if (pun>100) {pun=100;comen=" (¡100, 100!) "+'<img src="aplauso.gif">'}
resu=open("","","fullscreen")
resu.document.write(hcap+'RESULTADOS en '+titu+'<\/th><td width="20%"><tr><td width="20%"><td width="60%" BGCOLOR="#F9FFF9">'+"<ul><ul>"+
"Has conseguido <b>"+rtot+"<\/b><p>en "+ttm+"<p> utilizando "+aytot+"<p><br><p>Eres <b>"+eres+"</b><br>y has logrado en "+titu+": . . . "+"<b>"+pun+" puntos<\/b>"+comen+"<\/ul><\/ul>"+
'<td width="20%"><\/table><p><br><p><center><input type="button" value="misma pantalla, pero..." onClick="opener.sal(2)"><input type="button" value="siguiente pantalla" onClick="opener.sal(3)"><\/center><p><center><FORM NAME="formu2" onSubmit="return false"><\/form><\/center><\/BODY><\/HTML>')
resu.document.close()
}
function min(m){
 for(i=0;i<60;i++){
  if(m==1){ttm=m+" segundo";break}
  if(m<60){
   if(i==0){ttm=m+" segundos";break}
   else{ttm=i+" min. "+m+" seg.";break}}
  else{m=m-60}
}}
function sal(i){
 if (i==2){resu.close();location=titori}
 if (i==3){resu.close();location=newtit}
 if (i==4) location=titant
 if (i==5){leo.close();location=titori}
 if (i==6) location=temas
}
function lect(){
 leo=open("","","fullscreen")
leo.document.write(hcap+'LECTURA. '+titu+'<\/th><td width="20%"><tr><td width="20%"><td width="60%" BGCOLOR="#F9FFF9">'+lec[0]+"<p>"+lec[1]+"<p>"+lec[2]+"<p>"+lec[3]+'<td width="18%"><\/table><table cellpadding=12 width="100%"><colgroup><col><col><col><tr><td width="20%"><P ALIGN="RIGHT"><input type="button" value="imprimirlo" onclick="print()"><\/p><td width="60%"><td width="20%"><input type="button" value="continuar" onClick="opener.sal(5)"><\/table><\/BODY><\/HTML>')
leo.document.close()
}
