function trimStr(theString)
{
	var result = '';
			
	if (theString != "") {
		for (x=0; x < theString.length; x++) {
			var theChar = theString.charAt( x);
			if (theChar != " ") {
				result = result + theChar;
			}
		}
	}
	
	return result;
}


function isBlank(theString)
{
	var result = true;
			
	if (theString != "") {
		for (x=0; x < theString.length; x++) {
			var theChar = theString.charAt( x);
			if (theChar != " ") {
				result = false;
				break;
			}
		}
	}
	return result;
}

function isWithinMaxLength(formField,formLabel,maxLength)
{
	var result = true;
	var theString = formField.value;
	var theStringLength = theString.length;
	
	if (theStringLength > maxLength) {
		// field value exceeds the specified maxLength, so show err msg
		alert("[" + formLabel + "] cannot exceed " + maxLength.toString() + " characters. Present length is " + theStringLength.toString() + " characters.");
		formField.focus();
		result = false;
	}
	
	return result;
}

function isSpecifiedAndWithinMaxLength(formField,formLabel,maxLength)
{
	var result = true;
	var theString = formField.value;
	var theStringLength = theString.length;
			
	if (isBlank(theString)) {
		// it is blank, so show err msg
		alert("Please enter a value for [" + formLabel + "].");
		formField.focus();
		result = false;
	}
	else {
		if (theStringLength > maxLength) {
			// field value exceeds the specified maxLength, so show err msg
			alert("[" + formLabel + "] cannot exceed " + maxLength.toString() + " characters. Present length is " + theStringLength.toString() + " characters.");
			formField.focus();
			result = false;
		}
	}
	
	return result;
}

function isNumeric(str) {
	var result = true;
	
	if (str != '') {
		var iInt = parseInt(str, 10);
	
		if (isNaN(iInt)) {
			
			result = false;
		}
	}
	
	return result;
}


function doFormSubmit() {

//
// FUNCTION PURPOSE: To wait for the entire HTML page to be
//					 loaded and parsed (into JavaScript objs)
//					 before emulating the "param passing form"
//					 (called frmAutoSubmit) SUBMIT METHOD
//

	var tryAgain = true;

	// is there a document obj ?
	if (self.document != null) {

		// are there at least 2 form (javascript) objects on this page ?
		if (self.document.forms.length > 1) {
			tryAgain = false;
			frmAutoSubmit.submit();
		}
	}

	if (tryAgain)
		setTimeout( 'doFormSubmit()', 1000 );
}

