/*

pop up window script based on:

The Book of JavaScript A Practical Guide to Interactive Web Pages (With CD-ROM) 
by Thau, et al (Paperback -- January 15, 2000)
ISBN: 1886411360

*/

// create a new generic object and assign it to the new variable 'newWindow'
newWindow = new Object;

// ad 'close' property to the object and set it to 'true'
newWindow.closed = true;

/* defines 'newWindowopener' function
   takes 4 parameters: pix - pat to image you want to show in the window
					   windwoTitle - title for the window
					   windowHeight - how high you want the window
					   windowWhidth - how wide you want the window
*/	
function newWindowopener(pix, windowTitle, windowHeight, windowWidth)
{
      /* 'if it's not true that the window is closed - close it'
         makes sure two dynamic windows are not open
         initially newWindow isn't a window, but a generic object,
         however, once a window is open 'newWindow' points to that window
      */
      if (!newWindow.closed) {  
        newWindow.close();
      }
      
      // constructor in action: generic 'newWindow' object becomes a bonified 'window' object 
      // it requires 3 string parameters, even if you don't have any values assigned to them
      newWindow = window.open("","","height=" + windowHeight + ",width=" + windowWidth + ",scrollbars,resizable");
      
      // create HTML code for dynamic window with the help of 'newWindow' object's 'write' method
      // 'write' method takes care of appropriately processing and displaying input on screen
      newWindow.document.write("<HTML><HEAD><TITLE>" + windowTitle);
      newWindow.document.write("</TITLE>"); 
      newWindow.document.writeln("</HEAD><BODY BGCOLOR=#ffffff><div align=center>");
      
      newWindow.document.writeln("<img src=" + pix + ">");
      
      newWindow.document.writeln("<FORM><INPUT TYPE=\"BUTTON\" VALUE=\"Close\" onClick=\"self.close()\">");
      newWindow.document.writeln("</FORM></div>");
      
      // we're done creating dynamic window code, we should close the 'document'     
      newWindow.document.close();
      
      // let's make sure the dynamic window stays on top
      newWindow.focus();
  }
