function check_formReg() {
	var msg = "";
	var p=false;
	var d=false;
	with(document.form2) {
		// reset the form bg color
		for(f=0;f<document.form2.length;f++) {
			t = eval("elements["+f+"].type");
			if (t != "checkbox") {
				rbg = eval("elements["+f+"].style.backgroundColor='#FFFFFF'");
			}
		}
		// fields to chck
		fields_to_check = new Array("fname", "lname", "email");
		// check the fields in the array
		for(i=0;i<fields_to_check.length;i++) {
			//alert(fields_to_check[i]);
			fld = eval(fields_to_check[i]+".value");
			// missing data -- append to msg variable
			if (fld == "") {
				if (fields_to_check[i] == "email") {
					if (!isEmail(fld)) {
						msg += "Your email address is not formatted properly\n";
						bg = eval(fields_to_check[i]+".style.backgroundColor='#4A9BDD'");
					}
				} else {
					fld_disp = fields_to_check[i];
					switch(fld_disp) {
						case "fname":
							em_txt = "First Name\n";
							break;
						case "lname":
							em_txt = "Last Name\n";
							break;
						case "email":
							em_txt = "Email Address\n";
							break;			
						default:
							em_txt = "";
					}
					msg += em_txt;
					// set the background to a lovely peach color
					t = eval(fields_to_check[i]+".type");
					if (t != "checkbox") {
						bg = eval(fields_to_check[i]+".style.backgroundColor='#4A9BDD'");
					}
				}
			}
		}
	}
	if ( (msg == "") ){
		return true;
	} else { 
		msg = "The following information was missing or incorrect:\n\n" + msg;
		alert(msg);
		return false;
	}
}

function isEmail(email){
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
	return re.test(email)
}
