/*

	p*image version 2.0 (2001-03-01 18:28 PST)

	(c) 2001 by Chris Elliott / Warewolf Labs.  All rights reserved.
	http://www.warewolf.net/projects/pimage

*/

//	 p*image configuration
//
//	you may change the following to suit your preferences


// background color for dynamically generated popup window
// #FFFFFF = white (default), #000000 = black, #CCCCCC, #999999, #666666, #333333 = greys (lightest to darkest)
//
var background_color	= '#FFFFFF';
					
// this title can be used to display your name, website, etc. at the top of the popup window
// (not in the page itself, but for the browser window)
//
var popup_title		= 'OTW Figures';

// the amount of space in pixels to add to the image width and height in creating the popup window;
// fine tuning these will allow you to control how much of a border surrounds your image
// popup_padding_w refers to width dimension; 20-30 pixels is typically a good range
// popup_padding_h refers to the height dimension; 20-30 pixels is typically a good range
//
var popup_padding_w = 30;
				
var popup_padding_h = 20;
				



//	* * * DO NOT MODIFY BELOW THIS LINE * * *

var pimage_wh = null; // pimage window handler

function pimage(image_url, image_width, image_height ) { 

	// create the variable sets for the popup window dimensions and settings
	var popup_width = parseInt(image_width) + popup_padding_w;  
	var popup_height = parseInt(image_height) + popup_padding_h;
	var popup_variables = "width=" + popup_width + ",height=" + popup_height + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no";

	// create a blank popup window with the proper settings for the image to be loaded
	pimage_wh = open('','pimage', popup_variables);

	// generate the dynamic code
	generate_html( image_url, image_width, image_height );
}


// creates the window contents
function generate_html( image_url, image_width, image_height ) {

	var phd = pimage_wh.document;
	phd.open();
	phd.write('<!doctype html public "-//w3c//dtd html 4.0 transitional//en">\n');
	phd.write('<HTML>\n<HEAD>\n<TITLE>' + popup_title + '</TITLE>\n');
	phd.write('</HEAD>\n');
	phd.write('<BODY BGCOLOR="' + background_color + '" onBlur="window.close();"\n');
	phd.write('<DIV ALIGN="CENTER">\n');
	phd.write('<TABLE WIDTH="100%" HEIGHT="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">\n');
	phd.write('<TR ALIGN="CENTER" VALIGN="MIDDLE">\n');
	phd.write('<TD WIDTH="100%">\n');
	phd.write('<A HREF="javascript:window.close();"><IMG SRC="' + image_url + '" WIDTH="' + image_width + '" HEIGHT="' + image_height + '" BORDER="0" ALT="click image to close window"></A></TD>\n');
	phd.write('</TABLE>\n');
	phd.write('</DIV>\n');
	phd.write('</BODY>\n</HTML>');
	phd.close();
}