function CheckAccountForm(theForm)
{

  if (theForm.firstname.value == "")
  {
    alert("Please enter a value for the \"first name\" field.");
    theForm.firstname.focus();
    return (false);
  }

  if (theForm.lastname.value == "")
  {
    alert("Please enter a value for the \"last name\" field.");
    theForm.lastname.focus();
    return (false);
  }
  
   if (theForm.phone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }
 
  if (theForm.phone.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }

  if (theForm.phone.value.length > 12)
  {
    alert("Please enter at most 12 characters in the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }

  var checkOK = "0123456789- ";
  var checkStr = theForm.phone.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != " ")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }

   if (theForm.email.value == "")
  {
    alert("You have not entered your email address.");
    theForm.email.focus();
    return (false);
  }

invalidChars = " /:,;"
  for (i=0; i<invalidChars.length; i++)
  	badChar = invalidChars.charAt(i)
  	if (theForm.email.value.indexOf(badChar,0) > -1) {
  		alert ('Your email address contains invalid chars.');
		theForm.email.focus();
  		return (false);
  		}
  		
  atPos = theForm.email.value.indexOf("@",1)
  if (atPos == -1) {
  	alert ('Your email address doesn\'t contain \"@\" ');
	theForm.email.focus();
  	return (false);
  	}
  	
  if (theForm.email.value.indexOf("@",atPos+1) >	 -1) {
 	alert ('Your email address contains 2 \"@s\" ');
	theForm.email.focus();
  	return (false);
  	}
  	
  	periodPos = theForm.email.value.indexOf(".",atPos)
  	if (periodPos == -1) {
  		alert ('Your email address doesn\'t contain \".\" ');
		theForm.email.focus();
		return (false);
  	}
  
  if (periodPos +2 > theForm.email.value.length) {
		alert ('Your email address incorrect. ');
		theForm.email.focus();
		return (false);
	}

 
  if (theForm.password.value == "")
  {
    alert("Please enter a value for the \"Password\" field.");
    theForm.password.focus();
    return (false);
  }
  
  if (theForm.password2.value == "")
  {
    alert("Please enter a value for the \"Password2\" field.");
    theForm.password2.focus();
    return (false);
  }
  
  if (theForm.password.value != theForm.password2.value)
  {
    alert("The passwords entered don\'t match.");
    theForm.password.focus();
    return (false);
  }
  
  return (true);
}


