//sets all form elemnts to be optional by defaultfunction requiredElements() {	var keepGoing = true;	for(var i = 0; i < document.userInfo.length; i++) {		//check each form element to see if it is in the list of required elements		for(var m = 0; (m < arguments.length) && keepGoing; m++) {			if(document.userInfo.elements[i].name == arguments[m]){				keepGoing = false;				var asterisk = document.createTextNode("*");				var tempElem = document.userInfo.elements[i];				tempElem.parentNode.insertBefore(asterisk, tempElem.previousSibling);			}		}		if(keepGoing) document.userInfo.elements[i].optional = true;		keepGoing = true;	}}// returns true if a string contains only whitespace charactersfunction isblank(s) {	for(var i = 0; i < s.length; i++ ) {		var c = s.charAt(i);		if ((c != ' ') && (c != '\n') && (c != '')) return false;	}	return true;}//this function performs the form verification and is invoked from the onsubmit event handler.//The handler should return whatever value this function returns.function verify(f) {	var empty_fields = false;	//Loop through the elements of the form, looking for all Text and Textarea elements that don't have an "optional" property defined.	//Then check for fields that are empty and make a list of them. Put together error messages for fields that are wrong.	for(var i = 0; i < f.length; i++) {				var e = f.elements[i];				if (((e.type =="text") || (e.type == "textarea")) && !e.optional) {			//first check if the field is empty			if ((e.value == null) || (e.value == "") || isblank(e.value)) {				empty_fields = true;				var tempStr = e.name.concat("Div");				var tempElem = document.getElementById(tempStr);					tempElem.className = "requiredFieldHighlight";				continue;			}		}	}		//Now, if there were any errors, display the messages, and return false to prevent the form from being submitted. Otherwise, return true.	if(!empty_fields) return true;	displayError();		return false;}//This function searches through the email submit field on the eventDescription.xsl page and checks it for an '@' symbol followed by a "." in the address.function verifyEmail(id) {	var fieldElem = document.getElementById(id);	var tempStr = fieldElem.value;	if((tempStr != "") && (tempStr.indexOf(" ") == -1 )) {				var firstAtSymIndex = tempStr.indexOf("@");		var periodIndex = tempStr.indexOf(".", firstAtSymIndex);		if((firstAtSymIndex != -1) && (periodIndex != -1)){			return true;		}	}	alert("Please enter a valid email address.");	fieldElem.value = "example@domain.com";	return false;}function displayError() {	document.getElementById('errorMsg').style.display = "block";}/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function requiredElementsQuestionnaire() {	var keepGoing = true;	for(var i = 0; i < document.questionnaireAnswers.length; i++) {		//check each form element to see if it is in the list of required elements		for(var m = 0; (m < arguments.length) && keepGoing; m++) {			if(document.questionnaireAnswers.elements[i].name == arguments[m]){				keepGoing = false;				var asterisk = document.createTextNode("*");				document.questionnaireAnswers.elements[i].parentNode.insertBefore(asterisk,document.questionnaireAnswers.elements[i].parentNode.firstChild);			}		}		if(keepGoing) 		{			document.questionnaireAnswers.elements[i].optional = true;		}		keepGoing = true;	}}function verifyQuestionnaire(f) {	var empty_fields = false;	//Loop through the elements of the form, looking for all Text and Textarea elements that don't have an "optional" property defined.	//Then check for fields that are empty and make a list of them. Put together error messages for fields that are wrong.	for(var i = 0; i < f.length; i++) {				var e = f.elements[i];				if (!e.optional) {			//first check if the field is empty			if ((e.value == null) || (e.value == "") || isblank(e.value)) {				empty_fields = true;				var tempStr = e.name.concat("Div");				var tempElem = document.getElementById(tempStr);				tempElem.className = "requiredFieldHighlight";				continue;			}		}	}		//Now, if there were any errors, display the messages, and return false to prevent the form from being submitted. Otherwise, return true.	if(!empty_fields) return true;	displayError();	return false;}