/*This function borrowed from the O-Reilly book on java script, The Definitve Guide, to determine if form fields contain only whitespace characters*/  
	function isblanks(s)	{
		for(var i=0; i<s.length; i++) {
			var c = s.charAt(i);
			if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
		}
		return true;
	}
/*This function looks at each of the form element values, if they are text or textarea elements,  and determines if they contain data and in the case of an email address, verifies that the email address is in a correct format.  For this to work effectively you must name the text box which will be used to ascertain an email address as "Email."  This is case sensitive.  All other text and textareas can be named randomly*/
	function validate(z) {
		var msg;
		var empty = "";	
		var emailerr = "";
		var raderr ="";	
		var x=1;
		for(var i=0; i<z.length; i++) {
			var y=z.elements[i];
			if ((y.type == "text") || (y.type =="textarea")) {
				//Added 11/11/2003
				if (y.name == "Comment") {continue;}
				if (y.name == "Zip") {continue;}
				if (y.name == "Extension") {continue;}
				if (y.name == "ContactExtension") {continue;}
				//****************
				if ((y.value == null) || (y.value == "") || isblanks(y.value)) {					
					empty += "\n     " + y.name;					
					continue;
				}			
				if (y.name == "Email") {
					var pattern = y.value;			
					var result = /^[a-zA-Z0-9_\.-]*@[a-zA-Z0-9_\.-]*\.\w{2,3}$/i
					if(!result.test(pattern)) {
						emailerr += "- You have entered your email address in an incorrect format.";
						continue; 
					}
				}
			}				
		}			
	if (!empty && !emailerr) return true;
		
		msg = "_________________________________________\n\n";
		msg += "The form was not submitted either because fields were left blank or the email address specified was done so incorrectly.\n";
		msg += "Please correct these error(s) and resubmit the form.\n";
		msg +="_________________________________________\n\n";
		
	if(empty) {
			msg += "- The following required field(s) are empty:" + empty + "\n"
		}
		if (emailerr) {
			msg += "\n";
		}
			msg += emailerr;			
		alert(msg);
		return false;
	}
