function Validator(theForm)
{
	
	
		if (theForm.txtUsername.value.length < 5)
	{
	alert("Username needs to be at least 5 letters and / or numbers long");
  theForm.txtUsername.focus();
  return (false);
  }


	var alphaExp = new RegExp("^[0-9a-zA-Z]+$");
	if(theForm.txtUsername.value.match(alphaExp)){
	
	}else{
		alert("Username can only contain letters and / or numbers.");
		return (false);
	}

 
if (theForm.txtPassword.value.length < 8)
  {
  alert("Password needs to be at least 8 letters and / or numbers long");
  theForm.txtPassword.focus();
  return (false);
  }

if(theForm.txtUsername.value.match(alphaExp)){
	
	}else{
		alert("Username can only contain letters and / or numbers.");
		return (false);
	}
	
	
		if(theForm.txtPassword.value.match(alphaExp)){
	}else{
		alert("Username can only contain letters and / or numbers.");
		return (false);
	}
	
	
	var numExp = new RegExp("^.*[0-9]+.*$");
	if(theForm.txtPassword.value.match(numExp)){
	}else{
		alert("Password must contain at least one number.");
		return (false);
	}


	var alph2Exp = new RegExp("^.*[a-zA-Z]+.*$");
	if(theForm.txtPassword.value.match(alph2Exp)){
	}else{
		alert("Password must contain at least one letter.");
		return (false);
	}

	
	
	
   if (theForm.txtFirstName.value == "")
  {
  alert("Please enter a value for the \"First Name\" field.");
  theForm.txtFirstName.focus();
  return (false);
  }

   if (theForm.txtLastName.value == "")
  {
  alert("Please enter a value for the \"Last Name\" field.");
  theForm.txtLastName.focus();
  return (false);
  }

   if (theForm.txtEmail.value == "")
  {
  alert("Please enter a value for the \"Email\" field.");
  theForm.txtEmail.focus();
  return (false);
  }

  if (theForm.txtEmail.value.indexOf ('@', 0) == -1 ||
      theForm.txtEmail.value.indexOf ('.', 0) == -1)
  {
  alert("Please enter a correct value for the \"Email\" field.");
  theForm.txtEmail.focus();
  return (false);
  }

   if (theForm.txtPhoneExt.value == "")
  {
  alert("Please enter a value for the \"Phone Extension\" field.");
  theForm.txtPhoneExt.focus();
  return (false);
  }

   if (theForm.txtLocation.value == "")
  {
  alert("Please enter a value for the \"Location Name\" field.");
  theForm.txtLocation.focus();
  return (false);
  }

   if (theForm.txtOfficeCode.value == "")
  {
  alert("Please enter a value for the \"Office Code\" field.");
  theForm.txtOfficeCode.focus();
  return (false);
  }

   if (theForm.txtUsername.value == "")
  {
  alert("Please enter a value for the \"User Name\" field.");
  theForm.txtUsername.focus();
  return (false);
  }

   if (theForm.txtPassword.value == "")
  {
  alert("Please enter a value for the \"Password\" field.");
  theForm.txtPassword.focus();
  return (false);
  }

   if (theForm.txtPassword2.value == "")
  {
  alert("Please enter a value for the \"Confirm Password\" field.");
  theForm.txtPassword2.focus();
  return (false);
  }

  return (true);
}
