	
function open_image_window(url, win_name)
{
	my_width = 450;
	my_height = 451;
	my_top = 100;
	my_left = 75;
	my_window = window.open(url, win_name,'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,width=' + my_width + ',height=' + my_height + ',top=' + my_top + ',left=' + my_left + '');
	//my_window.document.write('menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=' + my_width + ',height=' + my_height + ',top=' + my_top + ',left=' + my_left + '');
	my_window.focus();
}

//open a new window automatically sized to accomodate the image
function open_image_window_auto_win_size(url, win_name, image_url)
{
	var ip = new ImagePreloader([image_url], onPreload, url, win_name, image_url);
}


//=============================================================================
// Image Preloader
//images is an array of image urls, callback is the callback fxn to call once preloading is complete
//url is the name of the page to open into a new window (in the callback fxn)
//win_name is the name of that new window and image_url is the url of the image to display in the new window
function ImagePreloader(images, callback, url, win_name, image_url)
{
	// store the callback
	this.callback = callback;

	// initialize internal state.
	this.nLoaded = 0;
	this.nProcessed = 0;
	this.aImages = new Array;
	this.url = url;
	this.win_name = win_name;
	this.image_url = image_url;

	// record the number of images.
	this.nImages = images.length;

	// for each image, call preload()
	for ( var i = 0; i < images.length; i++ ) 
		this.preload(images[i]);
}
ImagePreloader.prototype.preload = function(image)
{
	// create new Image object and add to array
	var oImage = new Image;
	this.aImages.push(oImage);
	
	// set up event handlers for the Image object
	oImage.onload = ImagePreloader.prototype.onload;
	oImage.onerror = ImagePreloader.prototype.onerror;
	oImage.onabort = ImagePreloader.prototype.onabort;
	
	// assign pointer back to this.
	oImage.oImagePreloader = this;
	oImage.bLoaded = false;
	oImage.source = image;
	
	// assign the .src property of the Image object
	oImage.src = image;
}
ImagePreloader.prototype.onComplete = function()
{
	this.nProcessed++;
	if ( this.nProcessed == this.nImages )
		this.callback(this.aImages, this.url, this.win_name, this.image_url);
}
ImagePreloader.prototype.onload = function()
{
	this.bLoaded = true;
	this.oImagePreloader.nLoaded++;
	this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onerror = function()
{
	this.bError = true;
	this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onabort = function()
{
	this.bAbort = true;
	this.oImagePreloader.onComplete();
}

function onPreload(myImages, url, win_name, image_url)
{
	my_width = myImages[0].width + 50;
	//document.write(my_width);
	my_height = myImages[0].height + 50;
	//because of my spacer gif on my vertical borders, i need an odd numbered height for it to look proper
	if (my_height%2==0) {
		//parent.document.write(my_height);
		my_height = my_height+6;
	}
	my_top = 100;
	my_left = 75;
	my_window = window.open(url, win_name,'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,width=' + my_width + ',height=' + my_height + ',top=' + my_top + ',left=' + my_left + '');
	//my_window.document.write('menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=' + my_width + ',height=' + my_height + ',top=' + my_top + ',left=' + my_left + '');
	//in case the window is already open we will need to do a window resize to accommoadate the new pic
	my_window.resizeTo(my_width+50, my_height+50);
	//my_window.document.write(my_width);
	my_window.focus();
}
