/* *******************************************************************
inValidationAPI.js
Functions For Validating Client Input in Form Fields
-scott 6/1/06
******************************************************************** */


// -------------------------------------------------------------------
// gfunIsValidEmailAddress(sText, bAllowMultiple)
// Check for the Proper format of an Email Address
// -------------------------------------------------------------------
function gfunIsValidEmailAddress(sText, bAllowMultiple) {
	var isOK = true;
	if (bAllowMultiple == null) bAllowMultiple = false;
	if (bAllowMultiple) {
		var aryEmails = sText.split(";");
		for (var i=0; i<aryEmails.length; i++) {
			if (isOK) {
				//aryEmails[i] = funTrimString(aryEmails[i]);
				isOK = (aryEmails[i].search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
			}
			else {
				break;
			}
		}
	}
	else {
		isOK = (sText.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
	}

	return isOK;
}
