function checkRegistrationForm()
{
// defaults for the script
   var errors = '';
   var oMyForm = document.registrationform;
// regular expression patterns
   var validemail     = /^([a-zA-Z0-9])+([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   var validpassword  = /^[a-zA-Z 0-9]{6,}$/;

// test for basic mandatory form field values
   if(!validemail.test(oMyForm.c1_em.value))
   { errors+='Provide a valid email address.\n'; }
   if(!validpassword.test(oMyForm.c1_pw.value))
   { errors+='Password may only contain letters, numbers and spaces and must be at least 6 characters long.\n'; }
   else if(oMyForm.c1_pw.value != oMyForm.c1_pw2.value)
   { errors+='Password values do not match please carefully re-type your password.\n'; }
   
   if(oMyForm.agree.checked ==false)
   { errors+='Please tick the box to agree to the terms and conditions before registering.\n'; }
   
// show errors or submit form
   if (errors){alert('We cannot begin your registration until the following fields are completed\n-----------------------------------------------------------------------------\n'+errors);}
   else{oMyForm.submit();}
}
