/*
	Form and Dom funcitons, do not put any other functions here
	<script>
*/

/*********************************************************************
'***    Function: displays a validation alert (div) on the form and sets focus
'***		to the field
'***
'***    Parameters: 
			objectId - id of object to highligh
			validationText - validation text to show
			errorDivId - id of error div to use when showing the messaage. default="errorMessage".
				this can be used to introduce a separate validation message per fieldset or section
'***        
'***    Returns: always returns false to simplify coding when validating forms
'***    Remarks: 
			Assumes and requires a div or other element with ID="errorMessage"
'***
'***    Created by: dimab
'***    Changed by: dimab
'***    Last change: 12/2/08
'*********************************************************************/
function validationAlert( objectId, validationText, errorDivId ) {
	// get objects
	if (errorDivId == null)
		errorDivId = "validationMessage";
	var input = document.getElementById(objectId);
	var errorElem = document.getElementById(errorDivId);

	// restyle
	if (errorElem != null) {
		errorElem.innerHTML = validationText;
		errorElem.className = "validationMessage";
		errorElem.style.visibility = "visible";
		errorElem.style.display = "block";
		errorElem.scrollIntoView(false);
	}

	if (input != null) {
		input.className = "invalidField";
		input.focus();
	}
	return false;
}

/*********************************************************************
'***    Program: validateEmail()
'***    Type: Sub
'***
'***    Function: validates an email address and returns result
'***
'***    Parameters: 
'***		strEmail - email to validate
'***
'***    Returns: String
'***    Remarks: none
'***
'***    Created by: dimab
'***    Changed by: rburdan
'***    Last change: 03/13/09
'*********************************************************************/
function validateEmail( strEmail ) {

	var strEmailString = new String(strEmail);
	strEmailString = strEmailString.replace(/( +)/g, "*");
        
	return (strEmailString.indexOf("@")!= -1 && strEmailString.indexOf(".") != -1 && strEmailString.indexOf("*") == -1);
}