// JavaScript Document

		function submitform(frm) {			
			if(frm.app_family_name.value=="")  {
				alert("Please enter Family Name.");
				frm.app_family_name.focus();	
				return false;
			}
			else if(frm.app_home_phone.value=="")  {
				alert("Please enter your Home Phone Number.");
				frm.app_home_phone.focus();	
				return false;
			}
				else if(frm.app_main_email.value=="") {
				alert("Please enter your primary email address.");
				frm.app_main_email.focus();
				return false;  	
		  	}
			else if(!validEmail(frm.app_main_email.value)) {
				alert("Invalid email address; please re-enter your email.");
				frm.app_main_email.focus();
				frm.app_main_email.select();
				return false;  	
		  	}
			else if(!frm.app_toa_checkbox.checked)  {
				alert("Please indicate your agreement with the terms");
				frm.app_toa_checkbox.focus();	
				return false;
			}
			else if(frm.SubmitterCheck.value!= "")  {
				alert("There is a problem with your form submission. Please call us");
				return false;
			}

		}
		
		function validEmail(emailstr) {
			 invalidChars = "/:,;" 
			 
			 for (i=0; i<invalidChars.length;i++) {
			      badChar=invalidChars.charAt(i)
			         if (emailstr.indexOf(badChar,0) > -1)  {
			         return false;
			         }
			}
		    atPos = emailstr.indexOf("@",1)
		    if (atPos == -1)  {
		      return false;
		    }
		    if (emailstr.indexOf("@",atPos+1) > -1)  {
		    return false;
		    }
		    periodPos = emailstr.indexOf(".",atPos)
		    if (periodPos == -1)  {
		      return false;
		    }
		    if (periodPos+3 > emailstr.length)  {
		      return false;
		    }
		    return true;
	    }
		
		

