
function LTrim(strValue)
{
// Remove all leading space and tab characters.

	for (i = 0; i < strValue.length; i++) {
		if (strValue.charAt(i) != " " && strValue.charAt(i) != "\t") {
			break ;
		}
	}
	strValue = strValue.substring(i, strValue.length) ;
	return (strValue) ;
}

function RTrim(strValue)
{
// Remove all trailing space and tab characters.
	for (i = strValue.length - 1; i >= 0; i--) {
		if (strValue.charAt(i) != " " && strValue.charAt(i) != "\t") {
			break ;
		}
	}
	strValue = strValue.substring(0, i + 1) ;
	return (strValue) ;
}

function Trim(strValue)
{
// Remove all leading and trailing space and tab characters.
	strValue = LTrim(strValue) ;
	strValue = RTrim(strValue) ;
	
	return (strValue) ;
}

function CheckLength(fldItem, maxlen, fieldname)
{
	if (fldItem.value.length > maxlen) {
		alert("The " + fieldname + " field can contain no more than " + maxlen + " characters." +
			"\nThe contents will be truncated when saved!") ;
	}
}

function AllCarriageReturns(strValue)
{
// If string contains only Cr/Lf or Space characters return true
// otherwise return false.

//	for (i = 0; i < strValue.length; i++) {
//		if (strValue.charAt(i) != "\n" && strValue.charAt(i) != "\r" && strValue.charAt(i) != " ")
//			return (false) ;
//	}
//	return (true) ;
}

