var tab_images=null;
var tab_notes=null;
var tab_noteRights=null;
var imI=-1;
var imJ=-1;

function addImage(im,i,j){
  if(tab_images==null){
     tab_images=new Array();
  }
  if(tab_images[i]==null){
     tab_images[i]=new Array();
  }
  tab_images[i][j]=im;
}

function addImageNote(note,i,j){
  if(tab_notes==null){
     tab_notes=new Array();
  }
  if(tab_notes[i]==null){
     tab_notes[i]=new Array();
  }
  tab_notes[i][j]=note;
}

function addImageNoteRight(note,i,j){
  if(tab_noteRights==null){
     tab_noteRights=new Array();
  }
  if(tab_noteRights[i]==null){
     tab_noteRights[i]=new Array();
  }
  tab_noteRights[i][j]=note;
}


function showImage(no){
  showImage2(no,1);
}

function showImage2(no,no2){
      imI=-1;
      imJ=-1;
      var el=document.getElementById("zoom");
      el.style.visibility="visible";       
      var elim=document.getElementById("imageZoomID");
      if(tab_images!=null&&tab_images[no]!=null&&tab_images[no][no2]!=null){
         elim.src=tab_images[no][no2];
         imI=no;
         imJ=no2;
      }

      var note=document.getElementById("imageNoteID");
      if(tab_notes!=null&&tab_notes[no]!=null&&tab_notes[no][no2]!=null){
         note.innerHTML=tab_notes[no][no2];   
      }
      else{
         note.innerHTML="";
      }

      var noteRight=document.getElementById("imageNoteRightID");
      if(noteRight){
        if(tab_noteRights!=null&&tab_noteRights[no]!=null&&tab_noteRights[no][no2]!=null){
           noteRight.innerHTML=tab_noteRights[no][no2];   
        }
        else{
           noteRight.innerHTML="";
        }
      }    
      var navig=document.getElementById("imageNavigID");
      var childs=navig.childNodes;
      if(childs!=null){
         for(i=childs.length-1;i>=0;i--){
            navig.removeChild(childs[i]);
         }
      }
      if(tab_images[no].length>2){
         for(i=1;i<tab_images[no].length;i++){
            if(i==no2){
               navig.appendChild(document.createTextNode(i+" "));
            }
            else{
               var objA=document.createElement("A");
               objA.setAttribute("href","javascript:showImage2("+no+","+i+");");     
               objA.appendChild(document.createTextNode(""+i));
               navig.appendChild(objA);
               navig.appendChild(document.createTextNode(" "));
            }
         }
      }
         
}

function closeZoom(){
    var el=document.getElementById("zoom");
    el.style.visibility="hidden";    
}



function selectChoiceAtQuery(idChoice){
   var index=-1;
   var txt=location.search;
   if(txt.length>0){
      if(txt.charAt(0)=="?"){
         txt=txt.substring(1);
         index=parseInt(txt);
      }
   }

   var choice=document.getElementById(idChoice);
   if(index!=-1&&index<choice.length){
      choice.selectedIndex=index;
   }
}

function changeLang(id){
   var path=location.pathname;
   if(id==0){
      var index=path.lastIndexOf("_e.html");
      if(index!=-1){
         path=path.substr(0,index)+".html";
      }
   }
   else if(id==1){
      var index=path.lastIndexOf(".html");
      if(index!=-1){
         path=path.substr(0,index)+"_e.html";
      }
      else{
         path=path+"/index_e.html";
      }
   }
   location.replace(path);
}

function openFullScreen(title,ref){

    window.open(ref,title,'top=0,left=0,width='+screen.width+',height='+screen.height);

}

function showTextInfo(){
      var el=document.getElementById("textInfo");
      el.style.visibility="visible";       
}

function closeTextInfo(){
    var el=document.getElementById("textInfo");
    el.style.visibility="hidden";    
}

