// declare global variable name
var newWindow = null
function makeNewWindow(parm1, parm2) {
  // check if window already exists
  if (!newWindow || newWindow.closed) {
    // store new window object in global variable
    newWindow = window.open("","","width=275,height=285,resizable")
    newWindow.moveTo(screen.availWidth-310,0)
    // assemble content for new window
    var newContent = "<HTML><HEAD><TITLE>"+parm2+"</TITLE>"
    newContent += '</HEAD><BODY BGCOLOR=#FFFFCC><CENTER>'
    newContent += '<IMG SRC="images/levl2' 
    newContent += parm1 + '.gif"'
    newContent +=  ' WIDTH="256" HEIGHT="256" BORDER="0" ALT=""><BR>'
    newContent +=  '</CENTER>'
    newContent += "</BODY></HTML>"
    // write HTML to new window document
    newWindow.document.write(newContent)
    newWindow.document.close()
  } else {
    // window already exists, so replace content
    var newContent = "<HTML><HEAD><TITLE>"+parm2+"</TITLE>"
    newContent += '</HEAD><BODY BGCOLOR=#FFFFCC><CENTER>'
    newContent += '<IMG SRC="images/levl2' 
    newContent += parm1 + '.gif"'
    newContent +=  ' WIDTH="256" HEIGHT="256" BORDER="0" ALT=""><BR>'
    newContent +=  '</CENTER>'
    newContent += "</BODY></HTML>"
    // write HTML to new window document
    newWindow.document.write(newContent)
    newWindow.document.close()
  }
}

function bringBack() {
  // Called when main window gets focus
  if (newWindow!=null) {
    if (!newWindow.closed) {
      setTimeout("newWindow.focus()",500)
    }
  }
}
