/* =========================================================================

NAME: lib_submitvalidation.js
AUTHOR: Domenico Coppola
DATE  : 4/7/2003

COMMENT: Common Function file for form submissions

============================================================================ */
function PromptErrorMessage(strElementName, strErrorMessage){
	
	alert(strErrorMessage);
	strElementName.focus();
	strElementName.select();

}


function ForceDataEntry(objField, strErrorMessage){

	if( objField.value == ''){
		PromptErrorMessage(objField, strErrorMessage)
		return false
	}
	else{
		return true;
	}

}

function ForceListBox(objField, strErrorMessage){
	if(objField.options[objField.selectedIndex].value == ''){
		PromptErrorMessage(objField, strErrorMessage)
		return false
	}
	else{
		return true;
	}
}

function checkemail(objField, strErrorMessage)
{
	// Regular expression to validate an e-mail address with or without wildcards (*)
	var regexp = /^((\w+([\.-]?\w+)*)|(\*))@((\*)|(\w+([\.-]?\w+)*(\.\w{2,})+))$/;
	// If the text field is empty, return false.
	if(objField.value == "") {
		PromptErrorMessage(objField, strErrorMessage);
		return false;
	}
	
	// If the text field fails the regular expression test, set the error message and return false.
	if(!regexp.test(objField.value))
	{
		PromptErrorMessage(objField, strErrorMessage);
		return false;
	}

	
	return true;
}