// POP_UP_WINDOW ( ) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*Revision History
  ----------------
  01/25/2011: Added a sample call in the notes.
  01/11/2011: Added <p> before <form name="closeit"> as Firefox wasn't skipping a line like IE.
  01/10/2011: Added the lines pop_up.document.open(); and pop_up.document.close(); as the pop-up window wouldn't finish loading to 100% in Firefox. Got answer from: http://www.codingforums.com/showthread.php?t=214704
  08/05/2000: Added the line window.name='main'; to open links in the original browser window.
  07/31/2000: Added Parameter Options at the bottom.
  05/24/2000: Added scroll bars and background options.
*/

function pop_up_window (image, title, width, height, text, close_button, scroll_bars, bg)
{
  var l = (screen.width-width) / 2 - 6; // -6 pixels for horizontal centering in Navigator.
  var t = (screen.height-height) / 2 - 28; // -28 pixels for the Windows taskbar.
  var pop_up = window.open('', '_blank', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll_bars+',resizable=no,copyhistory=no,top='+t+',left='+l+',width='+width+',height='+height);

  pop_up.document.open();
  pop_up.document.write ('<html>');
  pop_up.document.write ('<title>'+title+'</title>');
  window.name='main'; // To have links in pop up window open in the original browser window.
  if (bg == 'default')
     bg = '#ffffff'; // Assign the site's default background color to bg.
  if (bg.charAt(0) == '#') // The background will be a solid color if the first char is #.
     pop_up.document.write ('<body bgcolor='+bg+' text=black link=blue vlink=purple alink=red>');
  else // The background will be an image.
     pop_up.document.write ('<body background="'+bg+'" text=black link=blue vlink=purple alink=red>');
  pop_up.document.write ('<style> A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} </style>');
  if (image != 'no') // If pop up window contains an image. Changed on 01/11/2011 from: if (text != ' ')
  {
    pop_up.document.write ('<center><img src="'+image+'"></center>');
  }
  if (text != 'no') // If pop up window contains text. Changed on 01/11/2011 from: if (text != ' ')
  {
    pop_up.document.write ('<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="94%"><tr><td>');
    pop_up.document.write (''+text+'');
    pop_up.document.write ('</td></tr></table></center>');
  }
  if (close_button == 'yes') // If pop up window will contain a close button. Changed on 01/11/2011 from: if (close_button == 1)
  {
    pop_up.document.write ('<p><form name="closeit">'); // Couldn't use "close" because it was a reserved word.
    pop_up.document.write ('<center><input type="button" value="Close" onClick="window.close();"></center>');
    pop_up.document.write ('</form>');
  }
  pop_up.document.write ('</body>');
  pop_up.document.write ('</html>');
  pop_up.document.close();
}

/*
					Parameter Options
					-----------------

1. image: Determines if an image will be displayed.
   'file_name' = image to be displayed, 'no' = no image.

2. title: The title of the window.
   '' = no title, 'text' = title.

3. width: The width (in pixels) of the pop up window. If an image will be displayed, the width
   is obtained by adding 21 (no scroll bars) or 37 (with scroll bars) to the the image's width.
   Max window width: 788. Max image width: 767.

4. height: The height of the pop up window. If an image will be displayed, the height is found
   by adding 28 (no close button), 65 (with close button), 101 (one line of text) or 122 (two
   lines of text) to the images height. Max window height: 543. Max image height: 480 (without
   lines of text) or 513 (without lines of text and without a close button).

5. text: Determines if text will be displayed (HTML code can also be included).
   'text' = text, 'no' = no text.

6. close_button: Determines if there will be a close button at the bottom of the pop up window.
   'yes' = close button, 'no' = no close button.

7. scroll_bars: Determines if the pop up window will have scroll bars.
   'yes' = scroll bars, 'no' = no scroll bars.

8. bg: Determines what kind of background the pop up window will have.
   'default' = the website's default background color, '#123456' = custom color,
   'file_name' = the background will be an image.

					Sample Call
					-----------

  <a href="javascript:pop_up_window ('images/truckn_for_kids/truck_for_kids_028.jpg', 'Truck\'n for Kids', 821, 665, 'no', 'yes', 'no', 'default');" onMouseOver="window.status='Press to enlarge.'; return true;" onMouseOut="window.status=''; return true;">
  <img src="images/truckn_for_kids/truck_for_kids_028s.jpg" class="truck_shows_thumbnail"></a>
*/

// END OF SOURCE ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

