function focusemail(){	document.form1.email.focus()	document.form1.email.select()}function validEmail(objElement) {  var errorMsg=""  var invalidChars = " /:,;"//check empty email field  if (objElement.value == "") {	errorMsg="The email field is empty. "  }//Check for invalid characters    for (i=0; i<invalidChars.length; i++){    if (objElement.value.indexOf(invalidChars.charAt(i))>-1){		if (i==0){			errorMsg+="Spaces are not permitted in email addresses"		}		else {			errorMsg+=invalidChars.charAt(i)+" is an invalid email character. "		}          }  }//Check for an @ sign	if (objElement.value.indexOf("@")==-1){		errorMsg+="The @ character is required in an email address. "	}//Check for too many @ signs	var atInt=0	for (i=0; i<objElement.value.length;i++){		if(objElement.value.charAt(i)=="@"){			atInt++		}	}	if (atInt>1){		errorMsg+="Too many @ signs. "	}//Check for improperly placed @ sign	if (objElement.value.charAt(0)=="@"){		errorMsg+="@ can't start an email address"	}	if (objElement.value.indexOf("@",objElement.value.length-5)>-1){		errorMsg+="Improperly placed @ character. "	}//Check for period	if (objElement.value.indexOf(".")==-1){		errorMsg+="A period is required in an email address. "	}//Check for a properly place period	var periodInt=0	for (i=objElement.value.length-1; i>objElement.value.length-6;i--){		if (objElement.value.charAt(i)=="."){			periodInt++		}	}	if (objElement.value.charAt(objElement.value.length-2)=="."){		errorMsg+=errorMsg+"Email extension must be two characters at least. "	}	if (periodInt ==0){		errorMsg+="A period is required near the end of the email address. "	}//Check for two periods in a row	if (objElement.value.indexOf("..")>-1){		errorMsg+="Two periods in a row is not valid. "	}//Check for two periods in a row	if (objElement.value.indexOf("@.")>-1){		errorMsg+="@+ period not valid. "	}//Check for two periods in a row	if (objElement.value.indexOf(".@")>-1){		errorMsg+="Period + @ not valid. "	}//Give an error message if one of the tests above didn't pass		if (errorMsg != ""){		alert(errorMsg)		focusemail()	}}