  <!-- Original:  Anders Jennerberg (anders@katedral.se)  -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->

  function ViewImage(ifile,id,ix,iy,ititle,hasmap) { 
  var win;
  var sWidth;
  var sHeight;
  var iyy;
  var ixx;
  var NS = (document.layers) ? 1 : 0;
  if (hasmap) {
    ixx = ix + 18 ;
    iyy = iy + 4 ;
    iyyy = iyy + 15 ;
    ixx=Math.min(ixx,screen.availWidth-8) ;
    iyyy=Math.min(iyyy,screen.availHeight-8) ; 
    win = window.open("",id,"width="+ixx+",height="+iyyy+",left=0,top=0,menubar=no,toolbar=no,resizable=yes,scrollbars=yes");
  } else {
    ix=ix+13 ;
    iy=iy+13 ;
    win = window.open("",id,"width="+ix+",height="+iy+",left=0,top=10,menubar=no,toolbar=no,resizable=yes,scrollbars=yes");
  }
  if (NS) {
  sWidth = win.innerWidth;
  sHeight = win.innerHeight;
  } else {
  sWidth = win.document.body.clientWidth;
  sHeight = win.document.body.clientHeight;
  }
  /*if(sWidth!=ixx || sHeight!=iyyy) {
  win.close();
  setTimeout("ViewImage('"+ifile+"',"+ixx+","+iyyy+",'"+ititle+"',"+i+")", 500);
  return;
  } */
  win.document.open();
  win.document.write("<html><head><title>"+ititle+"</title>\n");
  win.document.write("</head>\n");
  if (hasmap) {
    /*win.document.write("<frameset border=0 frameSpacing=0 frameBorder=0 rows=*,"+iyy+">\n") ; */
    win.document.write("<frameset border=0 frameSpacing=0 frameBorder=0 rows=16,*>\n") ;
    win.document.write("<frame name=mapval src=http://beta.chmi.cz/aos/aladin/results/mapy/mapval.php >\n") ;
    win.document.write("<frame name=mapa src='mapdisplay.php?map="+ifile+"&w="+ix+"&h="+iy+"' >\n") ;
    win.document.write("</frameset></html>");
  } else {
    win.document.write('<body><div style="position:absolute;left:0px;top:0px">');
    win.document.write("<img src="+ifile+"></div></body></html>");
  }
  win.document.close();
  }

