// (c) Copyright 2002, Carol Mattsson
// dirView.js

// Validate the directory view parameters
// We check number of columns per row and thumbnail height.
// The album name is specified by menu, no further checking needed for that.

function validate(form) {

	var ncols = form.ncols.value;
	if (!ncols) {
		alert("Please specify the number of\nimages per row.  Try 4.");
		return false;
	} else if (isNaN(ncols)) {
		alert("The number of images per row must\nbe a number.  Try 4.");
		return false;
		// Make sure this agrees with the test in dirView.jsp
	} else if (parseInt(ncols) < 1 || parseInt(ncols) > 99) {
		alert("The number of images per row must be\nbetween 1 and 99 inclusive.  Try 4.");
		return false;
	}

	var height = form.height.value;
	if (!height) {
		alert("Please specify the thumbnail height\nin pixels.  Try \"Default,\" which means\n to use the actual thumnail height.");
		return false;
	} else if (!isNaN(height)) {
		// Make sure this agrees with the test in dirView.jsp
		if (parseInt(height) < 20 || parseInt(height) > 700) {
			alert("The thumbnail height must be\nbetween 20 and 700 inclusive.  Try \"Default.\"");
			return false;
		}
	}
	//alert("ncols: " + ncols + ", height: " + height + " are OK.");
	return true;
}
