function check(t){var rv=true;var nv=document.getElementById(t+'name').value+"";var ev=document.getElementById(t+'email').value+"";var av="";if(nv.match(/,/)){if(!(nv.match(/^[']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)?, [']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)?( [']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)?)*$/))){if(nv.match(/^[']?[a-z][^ ]*,/)){av+='Please capitalize your last name.\n';}if(nv.match(/, [']?[a-z][^ ]*/)){av+='Please capitalize your first name.\n';}if(nv.match(/[^,] [']?[a-z][^ ]*$/)){av+='Please capitalize your middle name.\n';}if(nv.match(/^[']?[a-z][^ ]*$/)){av+='Please capitalize your name.\n';}if(nv.match(/^\-[^ ]*,/ )){av+='You cannot start your last name with a dash.\n';}if(nv.match(/[^,] \-[^ ]*/)){av+='You cannot start your first name with a dash.\n';}if(nv.match(/ \-[^ ]*$/)){av+='You cannot start your middle name with a dash.\n';}if(nv.match(/^[^ ]*\-,/ )){av+='You cannot end your last name with a dash.\n';}if(nv.match(/, [^ ]*\-/)){av+='You cannot end your first name with a dash.\n';}if(nv.match(/[^,] [^ ]*\-$/)){av+='You cannot end your middle name with a dash.\n';}if(nv.match(/[0-9]/)){av+='You cannot include numbers in your name.\n';}if(nv.match(/[^a-zA-Z0-9\-', ]/)){av+='You cannot include symbols (other than dash, apostrophe and comma) in your name.\nP.S. If your name is written in a foreign language, please write your name in english, sorry for the inconvenience.\n';}if(nv.match(/,[^ ]/)){av+='Please put a space after the comma.\n';}if(nv.match(/  /)){av+='You have 1 or more extra spaces.\n';}if(nv.match(/^ /)){av+='You have an extra space before your name.\n';}if(nv.match(/ $/)){av+='You have an extra space after your name.\n';}if(av==""){av='Please enter a valid name.\n';}av=(t=='n')?av.replace(/your/g,"the student's"):av;al(av);rv=false;}}else{if(!(nv.match(/^[']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)? [']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)?( [']?[A-Z]([a-zA-Z']*[a-zA-Z\-']*[a-zA-Z']+)?)*$/))){if(nv.match(/^[^ ]*$/)){av+='Please include both your first name and your last name, the middle name is optional.\n';}if(nv.match(/^[']?[a-z][^ ]* /)){av+='Please capitalize your first name.\n';}if(nv.match(/ [']?[a-z][^ ]* /)){av+='Please capitalize your middle name(s).\n';}if(nv.match(/ [']?[a-z][^ ]*$/)){av+='Please capitalize your last name.\n';}if(nv.match(/^[']?[a-z][^ ]*$/)){av+='Please capitalize your name.\n';}if(nv.match(/^\-[^ ]*/ )){av+='You cannot start your first name with a dash.\n';}if(nv.match(/ \-[^ ]* /)){av+='You cannot start your middle name with a dash.\n';}if(nv.match(/ \-[^ ]*$/)){av+='You cannot start your last name with a dash.\n';}if(nv.match(/^[^ ]*\-/ )){av+='You cannot end your first name with a dash.\n';}if(nv.match(/ [^ ]*\- /)){av+='You cannot end your middle name with a dash.\n';}if(nv.match(/ [^ ]*\-$/)){av+='You cannot end your last name with a dash.\n';}if(nv.match(/[0-9]/)){av+='You cannot include numbers in your name.\n';}if(nv.match(/[^a-zA-Z0-9\-', ]/)){av+='You cannot include symbols (other than dash and apostrophe) in your name.\nP.S. If your name is written in a foreign language, please write your name in english, sorry for the inconvenience.\n';}if(nv.match(/  /)){av+='You have 1 or more extra spaces.\n';}if(nv.match(/^ /)){av+='You have an extra space before your name.\n';}if(nv.match(/ $/)){av+='You have an extra space after your name.\n';}if(av==""){av='Please enter a valid name.\n';}av=(t=='n')?av.replace(/your/g,"the student's"):av;al(av);rv=false;}}if(!(ev.match(/^[a-zA-Z0-9]([a-zA-Z0-9\-\_\+\.]*[a-zA-Z0-9]+)?@[a-zA-Z0-9]([a-zA-Z0-9\-\.]*[a-zA-Z0-9]+)?\.[a-zA-Z]{2,}$/))){al('Please enter a valid e-mail address.');rv=false;}return rv;}