var ii=1;
var jj=1;
var eventoControlado = false;
window.onload = function(){document.onkeypress = cambioIm;}
function cambioIm(evObject){
               var chr = String.fromCharCode(evObject.which);
               if(chr=="q"){
                  if(1<ii){ii-=1; show();}}
               else if(chr=="a"){
                  if(ii<2){ii+=1; show();}}
               else if(chr=="o"){
                  if(1<jj){jj-=1; show();}}
               else if(chr=="p"){
                  if(jj<5){jj+=1; show();}}
               else if(chr=="w"){
                  var tag=document.getElementById('largeImg');
                  tag.width =  tag.width *1.1;
                  tag.height = tag.height*1.1;}
               else if(chr=="s"){
                  var tag=document.getElementById('largeImg');
                  tag.width =  tag.width /1.1;
                  tag.height = tag.height/1.1;}
               eventoControlado=true;}
function showImage(rr,cc) {
               ii=rr;
               jj=cc;
               show(ii,jj);}
function show() {
               console.log(ii,jj)
               document.getElementById('largeImg').src = getF(ii,jj);
               document.getElementById('largeImgText').innerHTML = getF(ii,jj);
               document.getElementById('largeImgPanel').style.visibility = 'visible';
               if(document.selection) document.selection.empty();
               if(window.getSelection) window.getSelection().removeAllRanges();}
function hideMe(obj) {
         obj.style.visibility = 'hidden';}
function getF(rr,cc){
         if(rr==1 && cc==1){return 'varper.png';}
         if(rr==1 && cc==2){return 'sign.png';}
         if(rr==1 && cc==3){return 'varcen.png';}
         if(rr==1 && cc==4){return 'varint.png';}
         if(rr==1 && cc==5){return 'varopt.png';}
         if(rr==2 && cc==1){return 'pc12.2.png';}
         if(rr==2 && cc==2){return 'pc12.3.png';}
         if(rr==2 && cc==3){return 'pc12.4.png';}
         if(rr==2 && cc==4){return 'pc12.5.png';}
         if(rr==2 && cc==5){return 'pc12.6.png';}}
function includeHTML(){
   /*loop through a collection of all HTML elements: https://www.w3schools.com/howto/howto_html_include.asp*/
   var z, i, elmnt, file, xhttp;
   z = document.getElementsByTagName("*");
   for(i=0;i<z.length;i++){
       elmnt = z[i];
       /*search for elements with a certain atrribute:*/
       file = elmnt.getAttribute("w3-include-html");
       if (file) {
          /*make an HTTP request using the attribute value as the file name:*/
          xhttp = new XMLHttpRequest();
          xhttp.onreadystatechange = function() {
                  if (this.readyState == 4) {
                     if (this.status == 200) {elmnt.innerHTML = this.responseText;}
                     if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
                     /*remove the attribute, and call this function once more:*/
                     elmnt.removeAttribute("w3-include-html");
                     includeHTML();}}
          xhttp.open("GET", file, true);
          xhttp.send();
          return;}}}

