var msgWindow;
var timerID;

function showimage(imgname,imgcaption) {
  msgWindow = window.open("","imgwin","scrollbars,status,resizable,outerWidth=550,outerHeight=400,screenX=32,screenY=32");
  msgWindow.document.writeln ("<HEAD><TITLE>Split Infinity Music: Parse Screenshots</TITLE>");
  msgWindow.document.writeln ('</HEAD><BODY BGCOLOR="#7799aa">');
  msgWindow.document.writeln ("<FORM>");
  msgWindow.document.writeln ('<INPUT TYPE="button" VALUE="Close Screenshot" NAME="close" onClick="self.close();">');
  msgWindow.document.writeln ('<FONT COLOR="#880000"><font face="Arial,Helvetica"><i><b> This screenshot illustrates '+imgcaption+"</i><b></FONT></FONT><P>");
  msgWindow.document.writeln ('<IMG SRC="'+imgname+'" name="image1">');
  msgWindow.document.writeln ("</FORM></BODY>");
  msgWindow.document.close();
  checkloaded();
}

function checkloaded() {
  namestr = navigator.appName;
  if (namestr.substring(0,1)=="N") {
    ready=(msgWindow.document.images["image1"].width>0);
  } else {
    ready=(msgWindow.document.images["image1"].complete);
  }
  if (ready) {
    clearTimeout(timerID)
    imgwid=msgWindow.document.images["image1"].width+50;
    imghgt=msgWindow.document.images["image1"].height;
    if (imgwid<100) {
      imgwid=200;
    }
    if (imghgt<100) {
      imghgt=200;
    }
    if (namestr.substring(0,1)=="N") {
      imghgt = imghgt + 120;
    } else {
      imghgt = imghgt + 170;
    }
    if ((imghgt+40)>screen.availHeight) {
      imghgt = screen.availHeight - 40;
    }
    msgWindow.resizeTo(imgwid,imghgt);
  } else {
    timerID=setTimeout('checkloaded()',75)
  }
}
