// Functions to validate input

// Display image in a new window

function view_image(img, width, height, cat_name)
{
	resize = ',resizable=no';

	// width & height are 0 for non-images
	if ((width == 0) || (height == 0)) {
		width = window.outerWidth;
		height = window.outerHeight;
		resize = ',resizable=yes';
	}
	else {
		width += 20;
		height += 20;
	}

	// if we didn't get a width or height, make one up
	if ((width == 0) || (width == undefined)) {
		width = 800
		resize = ',resizable=yes';
	}
	if ((height == 0) || (height == undefined)) {
		height = 600
		resize = ',resizable=yes';
	}
	
	url = "/photos/" + img;
	url = "/view_image.php?img=" + img + "&cat=" + cat_name;
	defaults = ',menubar=no,titlebar=no,location=no,status=no,toolbar=no';
	features = 'width=' + width + ',height=' + height + defaults + resize;
	title='image';
	new_win = window.open(url,title,features);
}
