function validate(theForm)
	{
	var returnFlag;
	var frmLength;
	var firstBlank;
	var strEmailAddress;
	var strMessage;
	
	var arrReqFields = getElementsByClassName(document.getElementById(theForm.name), "input", "required");
	
	strMessage = "Please complete all required fields."
	firstBlank = -1;
	
	// loop through fields to clear out default values
	frmLength = arrReqFields.length;
	
	for (i=0; i<frmLength;i++){ 
		if(arrReqFields[i].value == "")
		{
			
			arrReqFields[i].className = "required warning";
			returnFlag = false;
			if(firstBlank == -1) {
				firstBlank = i
			}
		}
		else if(arrReqFields[i].name == "email") {
			strEmailAddress = arrReqFields[i].value;
			intAtPosition = strEmailAddress.indexOf("@");
			intLastDotPosition = strEmailAddress.lastIndexOf(".");
			if((strEmailAddress=="") || (intAtPosition == 0) || (intAtPosition == 1) || (intLastDotPosition == -1) || (intAtPosition > intLastDotPosition) || (intLastDotPosition+1 == strEmailAddress.length)){
				arrReqFields[i].className = "required warning";
				returnFlag = false;
				if(firstBlank == -1) {
					firstBlank = i;
					strMessage = "Please enter a valid email address";
					
				}
			}
		}
		else {
			arrReqFields[i].className = "required";
		}
	}
				
	if(returnFlag == false)
		{
			alert(strMessage);
			arrReqFields[firstBlank].focus()
		}
		
	return returnFlag;
	}
