var d = document;

/* TrimStr: Alert user if input has too many chars */
function TrimStr(obj, fieldName) {
	if(obj.value.length > 255) {
		alert("You must limit the number of characters in the \"" + fieldName + "\" field to 255.\n\nPlease shorten your entry by " + (obj.value.length - 255) + " characters.");
		obj.focus();
		return false;
	}else{
		return true; // Explicitly return true since multiple functions are firing during onsubmit.
	}
}

/* Strip front/back white space */
function StripSpace(obj){
	while(obj.value.substring(0,1) == " ") {
		obj.value = obj.value.substring(1,obj.value.length);
	}
	while(obj.value.substring(obj.value.length-1,obj.value.length) == " ") {
		obj.value = obj.value.substring(0,obj.value.length-1);
	}
	return obj;
}

/* Verify form data */
function Verify(obj, strArray){
	arrForm = eval(strArray); // Transform string into array
	flgError = false;
	strError = "";
	// Strip spaces
	for(i = 0; i < arrForm.length; i++){
		StripSpace(arrForm[i][0]);
		if(arrForm[i][0].value == ""){
			strError = strError + "- " + arrForm[i][1] + "\n";
		}
	}
	if(strError != ""){
		alert("Please fill in the following required fields:\n\n" + strError);
		return false;
	}else{
		return true; // Explicitly return true since multiple functions are firing during onsubmit.
	}
}

