
// Clear a text field if the value is the provided default

function autoClearText(textId, textString) {
	textField = getElement(textId);
	
	if (textField.value == textString) {
		clearText(textId);
	} else {
		return false;
	}
	return true;
}

// Clear a text field given its name
function clearText(textId) {
	textField = getElement(textId);
	textField.value = '';
}

// Set the value of a text field given its name and contents given that the field is currently empty
function autoSetText(textId, textString) {

	textField = getElement(textId);
	if (textField.value == '' || textField.value.length == 0) {
		setText(textId, textString);
	} else {
		return false;
	}
	return true;
}

// Set the value of a text field given its name and contents
function setText(textId, textString) {
	textField = getElement(textId);
	textField.value = textString;
}

