/*ardoraPaquete.js, created by ARDORA www.webardora.net

Copyright (C) <2011>  <José Manuel Bouzán M.>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

var indice, indiceMul, taboaContidos, maxIndice, menuLateral, menuActividades, anchoContidoIni,horaInicio, taboaIntentos;
function inicia(){
   var data=new Date();
   if (data.getMinutes()<10){horaInicio=data.getHours() +":0"+data.getMinutes()+" h";}
   else{horaInicio=data.getHours() +":"+data.getMinutes()+" h";}
   taboaIntentos=new Array();
   menuLateral='';
   menuActividades='<h1></h1><table width="140" border="0"><tr><td><a href="javascript:irA(0)" title="Wordsearch puzzle">1 </a></td><td><a href="javascript:irA(1)" title="Match: pictures and definition">2 </a></td><td><a href="javascript:irA(2)" title="Listen and match">3 </a></td><td><a href="javascript:irA(3)" title="Match: adjectives">4 </a></td><td><a href="javascript:irA(4)" title="Character references">5 </a></td></tr><tr><td><a href="javascript:irA(5)" title="Drag and complete the text">6 </a></td><td><a href="javascript:irA(6)" title="Dictation">7 </a></td><td><a href="javascript:irA(7)" title="Classify the words">8 </a></td><td><a href="javascript:irA(8)" title="Order the sentences">9 </a></td><td><a href="javascript:irA(9)" title="Listen and order">10 </a></td></tr><tr><td><a href="javascript:irA(10)" title="Correct: make and let">11 </a></td><td><a href="javascript:irA(11)" title="Drag and drop: make and let">12 </a></td><td><a href="javascript:irA(12)" title="Fill the chart">13 </a></td><td><a href="javascript:irA(13)" title="Application for a job">14 </a></td><td><a href="javascript:irA(14)" title="Test">15 </a></td></tr><tr></tr></table>';
   if (window.opener == null){
      indice=0;
      }else{
      if (window.opener.indice == null){
         indice=0;
      }else{
         indice=window.opener.indice;
      }
   }
   maxIndice=14;
	taboaContidos=new Array();
taboaContidos[0]=new act("Wordsearch puzzle","Wordsearch puzzle","Read the definitions and find the corresponding jobs",'<APPLET code="ArdoraSopa.class" archive = "sopa_letras_jobs_def.jar"  width=700 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[1]=new act("Match: pictures and definition","Match: pictures and definition","Match the pictures to the descriptions",'<APPLET code="ArdoraRImaFra.class" archive = "relacionar_imaxe_frase1.jar"  width=720 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[2]=new act("Listen and match","Listen and match","Click on the question mark to listen and match the job to the corresponding picture.",'<APPLET code="ArdoraSons01.class" archive = "distinguir_sons.jar"  width=720 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[3]=new act("Match: adjectives","Match: adjectives","<b>Qualities you need to do your job<br>Ma</b>tch the adjectives to the corresponding definitions.",'<APPLET code="ArdoraRFrases.class" archive = "relaciona_frases_def.jar"  width=720 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[4]=new act("Character references","Character references","Here is some useful language for character references. Match the words in the three columns to make proper sentences.",'<APPLET code="ArdoraVariosV.class" archive = "varios_varios.jar"  width=1000 height=327 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[5]=new act("Drag and complete the text","Drag and complete the text","Complete the sentences  using the phrases in the box below.",'<APPLET code="ArdoraCompleta0.class" archive = "completar_arrastrando.jar"  width=570 height=363 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[6]=new act("Dictation","Dictation","Listen and write the text that you hear",'<APPLET code="ArdoraDictados.class" archive = "completar_palabras.jar"  width=680 height=113 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[7]=new act("Classify the words","Classify the words","Work<br>Classify the following words",'<APPLET code="ArdoraClasificaP.class" archive = "clasificar_palabras_def.jar"  width=730 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[8]=new act("Order the sentences","Order the sentences","<b>Working from home.<br></b>Write the following sentences in the correct order :",'<APPLET code="ArdoraParrafo.class" archive = "ordear_paragrafos__working_from_home.jar"  width=730 height=330 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[9]=new act("Listen and order","Listen and order","Listen and put the sentences in the correct order",'<APPLET code="ArdoraOrdena.class" archive = "ordenar_1.jar"  width=730 height=450 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[10]=new act("Correct: make and let","Correct: make and let","Correct the following sentences. Use the same verb.",'<APPLET code="ArdoraCorrPal.class" archive = "palabras_para_corrixir_make_and_let.jar"  width=630 height=300 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[11]=new act("Drag and drop: make and let","Drag and drop: make and let","Complete the sentences  using the phrases in the box below.",'<APPLET code="ArdoraCompleta0.class" archive = "completar_arrastrando.jar"  width=570 height=363 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[12]=new act("Fill the chart","Fill the chart","Write the past and past participle form of the following verbs:",'<APPLET code="ArdoraTablas.class" archive = "completar_taboas.jar"  width=1060 height=439 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[13]=new act("Application for a job","Application for a job","The following is a letter of application for a job.  Choose the right alternative for each space",'<APPLET code="ArdoraCompleta.class" archive = "completar_seleccionando.jar"  width=1000 height=500 MAYSCRIPT></APPLET>',true,"",true,true,true);
taboaContidos[14]=new act("Test","Test","",'<APPLET code="ATest.class" archive = "test.jar"  width=950 height=376 MAYSCRIPT></APPLET>',true,"",true,true,true);
document.getElementById("botonAdiante").href="javascript:avanza()";
document.getElementById("botonAtras").href="javascript:retrocede()";
document.getElementById("botonAxuda").target="_blank";
anchoContidoIni=document.getElementById("areaContido").style.width;
   actualiza();
}
function actualiza(){
   document.getElementById("tituloAct").innerHTML=taboaContidos[indice].descricion;
   document.getElementById("enunciadoAct").innerHTML=taboaContidos[indice].enunciado;
   document.getElementById("contidoAct").innerHTML=taboaContidos[indice].areaContido;
   document.getElementById("botonAdiante").style.visibility="hidden";
   document.getElementById("botonAtras").style.visibility="hidden";
   document.getElementById("botonAxuda").style.visibility="hidden";
   if (eval(document.getElementById("menu")) != null){document.getElementById("menu").style.visibility="hidden";}
   if (taboaContidos[indice].seg_ant){
      if (indice>0){
         document.getElementById("botonAtras").title=taboaContidos[indice-1].descricionUTF8;
         document.getElementById("botonAtras").style.visibility="visible";
      }
      if (indice<maxIndice){
         document.getElementById("botonAdiante").title=taboaContidos[indice+1].descricionUTF8;
         document.getElementById("botonAdiante").style.visibility="visible";
      }
   }
   if (taboaContidos[indice].mp){
      document.getElementById("menuPrincipal").style.visibility="visible";
   }
   else{
      document.getElementById("menuPrincipal").style.visibility="hidden";
   }
   if (taboaContidos[indice].bAxuda.length>0){
      document.getElementById("botonAxuda").href=taboaContidos[indice].bAxuda;
      document.getElementById("botonAxuda").style.visibility="visible";
   }
   if ((taboaContidos[indice].ml) || (taboaContidos[indice].ma)){
	   contido="";
	   document.getElementById("menu").style.height="auto";
      document.getElementById("areaContido").style.width=anchoContidoIni;
	   if (taboaContidos[indice].ml){ contido=menuLateral;}
	   if (taboaContidos[indice].ma){ contido=contido+menuActividades;}
	   document.getElementById("menu").innerHTML=contido;
	   document.getElementById("menu").style.visibility="visible";
   }
   else{
        if (eval(document.getElementById("menu")) != null){document.getElementById("menu").style.height="0px";}
        document.getElementById("areaContido").style.width="100%";
   }
}
function avanza(){
   if (indice<maxIndice){
      indice++; actualiza();
   };
}
function irA(num){
      indice=num; actualiza();
}
function recarga(){
      irA(indice);
}
function retrocede(){indice--; actualiza();}
function act( descricion, descricionUTF8, enunciado, areaContido,ma, bAxuda, seg_ant, mp, ml ) {
   this.descricion=descricion;
   this.descricionUTF8=descricionUTF8;
   this.enunciado=enunciado;
   this.areaContido=areaContido;
   this.mp=mp;
   this.ml=ml;
   this.ma=ma;
   this.seg_ant=seg_ant;
   this.bAxuda=bAxuda;
   }
function iniciaActividade(){
   var data=new Date();
   if (data.getMinutes()<10){var hI=data.getHours() +":0"+data.getMinutes();}
   else{var hI=data.getHours() +":"+data.getMinutes();}
   var x=taboaIntentos.length;
   taboaIntentos[x]=new infoAct(indice,hI,0,"exec","xx:xx",0);
}
function iniciaActividadeMul(){
   indiceMul=indice;
   var data=new Date();
   if (data.getMinutes()<10){var hI=data.getHours() +":0"+data.getMinutes();}
   else{var hI=data.getHours() +":"+data.getMinutes();}
   var x=taboaIntentos.length;
   taboaIntentos[x]=new infoAct(indice,hI,0,"exec","xx:xx",0);
}
function infoAct( ind, hinicio, intentos, estado, hfin, puntos){
	this.ind=ind;
	this.hinicio=hinicio;
	this.intentos=intentos;
	this.estado=estado;
	this.hfin=hfin;
	this.puntos=puntos;
}
function actualizaInfoAct(puntos,intentos,estado){
	var data=new Date();
   if (data.getMinutes()<10){var hF=data.getHours() +":0"+data.getMinutes();}
   else{var hF=data.getHours() +":"+data.getMinutes();}
	var x=taboaIntentos.length-1;
	var hI=taboaIntentos[x].hinicio;
	taboaIntentos[x]=new infoAct(indice,hI,intentos,estado,hF,puntos);
}
function actualizaInfoActMul(){
	var data=new Date();
   if (data.getMinutes()<10){var hF=data.getHours() +":0"+data.getMinutes();}
   else{var hF=data.getHours() +":"+data.getMinutes();}
	var x=taboaIntentos.length-1;
	var hI=taboaIntentos[x].hinicio;
	taboaIntentos[x]=new infoAct(indiceMul,hI,0,"--",hF,0);
}
function PechaVentana(){window.close()}
function AbreCentrada(theURL,winName,features, myWidth, myHeight, isCenter,aNume) {
	if(window.screen)if(isCenter)if(isCenter=="true"){
      var myLeft = (screen.width-myWidth)/2;
      var myTop = (screen.height-myHeight)/2;
      features+=(features!='')?',':'';
      features+=',left='+myLeft+',top='+myTop;
    }
    window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
    indice=aNume;
}
function mostrar(capa){
var obj = document.getElementById(capa)
if(obj.style.display == "block"){
   obj.style.display = "none"
   document.getElementById("contenido").style.width="95%";
}else{
   obj.style.display = "block";
   document.getElementById("contenido").style.width="75%";
}}
function MM_preloadImages() {
   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() {var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_findObj(n, d) { //v4.01
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
