function openPopup(URL, windowName, width, height) {
	// AUTHOR: Luke Goodwin, Automation Software Consulting Services 04/17/2006.
	// PARAMETERS:
	//   URL: String specifying the URL to open in the new window.
	//   windowName (OPTIONAL): String specifying the windowName to use in TARGET attribute of a FORM or TAG.
	//      windowName must NOT contain any spaces!
	//   width: Integer specifying window width (defaults to available space minus room for scrollbar).
	//   height: Integer specifying window width (defaults to available space minus room for scrollbar).
	// NOTES: 
	// 1) This function works for IE6 and FireFox 1.07.
	// 2) FireFox opens new window full-size by default, even when size is not specified, but IE6 opens
	//    a smaller-sized window and ignores the screenX and screenY values. The moveTo method call
	//    moves the new window to top-left position.
	if (!windowName) {
		var windowName = "";
	}
	if (!width) {
		width = (screen.availWidth - 12);
	}
	if (!height) {
		height = (screen.availHeight - 26);
	}

	var remote = window.open(URL, windowName, "width=" + width + ",height=" + height + 
		",toolbar=1,location=0,directories=0,resizable=1,screenX=10,screenY=0px,status=0px,menubar=1,scrollbars=yes");

	if (!remote) {
		return;
	}
	remote.moveTo(0,0);
}

function showImage(imageId,imageSrc) {
	// AUTHOR: Luke Goodwin, Automation Software Consulting Services 04/17/2006.
	// PARAMETERS:
	//   imageId: id attribute of an img tag to display image in.
	//   newSrc: String specifying the path/filename of image to display.
	objImage = document.getElementById(imageId);
	if (document.images) {
		objImage.src = imageSrc;
	}
}

function countFields(strIn, delimiter) {
	// AUTHOR: Luke Goodwin, Automation Software Consulting Services.
	// PURPOSE: Returns an integer specifying the number of fields in strIn,
	//          given the specified <delimiter>.
	// PARAMETERS:
	//   strIn: String to search.
	//   delimiter: Delimiter character used to divide string into two or more fields.
	// RETURNS:
	//   If strIn contains 0 instances of <delimiter>: 1
	//   If strIn contains 1 or more instance of <delimiter>: The number of instance found.
	var i;
	var nextChar;

	if (strIn == "") {
		return 1;
	}

	var fieldCount = 1;

	for(i=0; i < strIn.length; i++) {
		nextChar = strIn.substr(i,1);
		if (nextChar == delimiter) {
			fieldCount++;
		}
	}

	return fieldCount;
}

function getField(strIn, fieldNum, delimiter) {
	// AUTHOR: Luke Goodwin, Automation Software Consulting Services.
	// PURPOSE: Returns the field with specified <fieldNum> from <strIn>.
	// PARAMETERS:
	//   strIn: String to search.
	//   fieldNum: Integer specifying the field number (the first field is 1).
	//   delimiter: String specifying field delimiter (e.g., "|").
	var fieldCount;
	var fieldLen;
	var i;
	var curFieldNum;
	var strRemaining = strIn;
	var nextField = "";
	var strOut = "";

	if (strIn == "") {
		return "";
	}

	fieldCount = countFields(strIn, delimiter);

	if (fieldNum > fieldCount) {
		// fieldNum is GREATER THAN fieldCount!
		return "";
	}

	if (fieldCount == 1) {
		// Specified delimiter not found. Return entire strIn:
		return strIn;
	} else {
		for (i=0; i<fieldCount; i++) {
			curFieldNum = (i + 1);

			if (curFieldNum == fieldCount) {
				fieldLen = strRemaining.length;
			} else {
				fieldLen = strRemaining.indexOf(delimiter);
			}

			nextField = (strRemaining.substr(0, fieldLen));
			if (curFieldNum == fieldNum) {
				// This is the specified field:
				if (fieldLen == -1) {
					// Nothing to return.
					return "";
				} else {
					return nextField;
				}
			} else {
				strRemaining = (strRemaining.substr((fieldLen + 1), strRemaining.length));
			}
		}

		return strOut;
	} 
}
