
function displayImgPopup(imName,imWidth,imHeight,boxId)    { 
     
    
    //  imTop  = screen.availHeight - (imHeight + 20);
    //  imLeft = Math.round((screen.width - imWidth)/2); 
    
    
      // s_top = document.documentElement.scrollTop;
       s_top = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
               
      
    
      var imTop  = y + s_top - 20;
      
      if(screen.availHeight < (imTop + imHeight)) imTop = s_top + 80;
    /*  
      var imLeft = Math.round(x - (imWidth/2)); 
      
      var winPW = Math.round((imWidth/2) + x + 15);
      
      if(winPW > screen.availWidth) imLeft = (screen.availWidth - imWidth) - 40;
    */  
    
    
      
    
      // vycentrovano
      var imLeft = Math.round( (screen.availWidth/2) - (imWidth/2) ); 
    
     //  alert('imLeft: ' + imLeft +  '\n\navailWidth: ' + screen.availWidth + '\n\navailHeight: ' + screen.availHeight + '\n\nX: ' + x + '\n\nY: ' + y + '\n\nScrollTop: ' + s_top);
      
      
      document.getElementById(boxId).style.top = imTop + "px"; 
      document.getElementById(boxId).style.left = imLeft + "px"; 
       
      document.getElementById(boxId).style.display = 'block'; 
      document.getElementById(boxId).style.width = imWidth + 10; 
      
      document.ap.src = "images/" + imName; 
      document.ap.style.width = imWidth; 
      document.ap.style.height = imHeight; 
      
      
    
} // end function

