// Javascript Functions

function trim(theField) {
    theField.value = theField.value.replace(/^\s+|\s+$/g, '');
}

function trim_left(theField) {
    theField.value = theField.value.replace(/^\s+/g, '');
}

function trim_right(theField) {
   theField.value = theField.value.replace(/\s+$/g, '');
}

function formatEmail(theField) {
	if (theField.value != '') {
		isValid = !(!theField.value.match(/^\w+([.\+\-]\w+)*@\w+([.\-]\w+)+$/));
		if (isValid == false) {
			alert('Please enter a valid email address.');		
			theField.select();
			theField.focus();
			return false;
		}
	}
}
