// CHECK CM/ECF online Registration -- CLIENT SIDE CHECK
function check_registration(theForm) {
	var why = "";
		why += check_string(theForm.a_first_name,"Attorney's First Name",2);
		why += check_string(theForm.a_last_name,"Attorney's Last Name",2);
		why += check_string(theForm.a_bar_number,"State Bar Number",2);
		why += check_pattern(theForm.a_phone,"Phone Number","phone","",true);
		why += check_pattern(theForm.a_fax,"FAX Number","phone","",false);
		why += check_email(theForm.a_email,"Primary Email",true);
		why += check_pattern(theForm.a_ssn,"Social Security Number",/\d{4}/,"xxxx",true);
		why += check_string(theForm.a_mother_name,"Mother's Maiden Name",2);
		why += check_string(theForm.firm_name,"Firm's Name",4);
		why += check_string(theForm.firm_address_1,"Firm's Address",4);
		why += check_string(theForm.firm_city,"Firm's City",4);
		why += check_string(theForm.firm_state,"Firm's State",2);
		why += check_pattern(theForm.firm_zip,"Firm's Zip Code + 4","zip","",true);
		why += check_atty_sig(theForm.a_signature,"Attorney's Signature");
		why += check_pattern(theForm.a_sig_date,"Form Signed Date","date","",true);
		/*
		//   JUST IN CASE THESE ARE NEEDED IN THE FUTURE:
				for (i=0, n=theForm.radios.length; i<n; i++) {
					if (theForm.radios[i].checked) {
						var checkvalue = theForm.radios[i].value;
						break;
					} 
				}
				why += checkRadio(checkvalue);
				why += checkDropdown(theForm.choose.selectedIndex);
		*/
		if (why != "") {
		   alert(why);
		   return false;
		}
	return true;
}


function check_training(theForm) {
	var why = "";
		why += check_string(theForm.a_first_name,"Attorney's First Name",2);
		why += check_string(theForm.a_last_name,"Attorney's Last Name",2);
		why += check_string(theForm.a_position,"Position",5);
		why += check_email(theForm.a_email,"Primary Email",true);
		if (why != "") {
		   alert(why);
		   return false;
		}
	return true;
}


// validate whether or not an attorney's signature was input correctly
function check_atty_sig(theString,fieldName) {
	var ckS = theString.value;
	var pattern = /(s\/){1}.{2,} .{2,}/;
	var ckStf = pattern.test(ckS);
		if (!ckStf) {
			theString.focus();
			return "The Attorney's Signature is not long enough or does not contain a space.\n-- (Should look like 's/John Smith')\n";
		}
		if (ckS.replace(pattern,"").length > 0) {
			theString.focus();
			return "It appears you put a character before the s/ in the Attorney's Signature.\n-- Please remove the extra characters.\n(Should look like 's/Bob Smith')\n";
		}
	return "";
}
