function ValidateRegistration(theForm)
{

  // first name
  if(theForm.first.value=="")
  {
      alert("You must enter a first name. ");
      theForm.first.focus();
      theForm.first.select();
      return false;
  }


  // last name
  if(theForm.last.value=="")
  {
      alert("You must enter a last name.");
      theForm.last.focus();
      theForm.last.select();
      return false;
  }

  // email
  var theStr = new String(theForm.email.value);
  var index = theStr.indexOf("@");
  var pindex = theStr.indexOf(".",index);

  if (theStr == "")
  {
    alert("Please enter a valid email address.");
    theForm.email.focus();
    theForm.email.select();
    return false;
  }
  else if(theStr.indexOf("@") <= 0)
  {
    alert("Please enter a valid Email Address.\n\n"
        + "( yourname@yourdomain.com )" );
    theForm.email.focus();
    theForm.email.select();
    return false;
  }
  else if ( !((pindex > index+1) && (theStr.length > pindex+1)) )
  {
    alert("Please enter a valid Email Address.\n\n"
        + "( yourname@yourdomain.com )" );
    theForm.email.focus();
    theForm.email.select();
    return false;
  }

  // password
	if(theForm.password.value=="")
	{
			alert("You must enter a New Password.    ");
			theForm.password.focus();
			return false;
	}

	if(theForm.password.value.length < 4)
	{
			alert("You must enter at least 4 characters for the New Password.    ");
			theForm.password.focus();
			return false;
	}

	if(theForm.confirm.value=="")
	{
			alert("You must confirm the New Password.    ");
			theForm.confirm.focus();
			return false;
	}

	if(theForm.confirm.value != theForm.password.value)
	{
		alert("Your Confirm Password doesn't match.    ");
		theForm.confirm.focus();
		return false;
	}

	theForm.hidden_pass.value = md5(theForm.password.value);

  // secret_answer
  if(theForm.secret_answer.value=="")
  {
      alert("You must enter a secret answer.");
      theForm.secret_answer.focus();
      theForm.secret_answer.select();
      return false;
  }
	
  return true;
}


function ValidateModifyInfo(theForm)
{
	
  // first name
  if(theForm.first.value=="")
  {
      alert("You must enter a first name. ");
      theForm.first.focus();
      theForm.first.select();
      return false;
  }


  // last name
  if(theForm.last.value=="")
  {
      alert("You must enter a last name.");
      theForm.last.focus();
      theForm.last.select();
      return false;
  }

  // address
  if(theForm.address.value=="")
  {
      alert("You must enter an address.");
      theForm.address.focus();
      theForm.address.select();
      return false;
  }
  
  // city
  if(theForm.city.value=="")
  {
      alert("You must enter a city.");
      theForm.city.focus();
      theForm.city.select();
      return false;
  }

  // postal
  if(theForm.postal.value=="")
  {
      alert("You must enter a postal/zip code.");
      theForm.postal.focus();
      theForm.postal.select();
      return false;
  }
  
  // phone
  if(theForm.phone.value=="")
  {
      alert("You must enter a phone number.");
      theForm.phone.focus();
      theForm.phone.select();
      return false;
  }

  // email
  var theStr = new String(theForm.email.value);
  var index = theStr.indexOf("@");
  var pindex = theStr.indexOf(".",index);

  if (theStr == "")
  {
    alert("Please enter a valid email address.");
    theForm.email.focus();
    theForm.email.select();
    return false;
  }
  else if(theStr.indexOf("@") <= 0)
  {
    alert("Please enter a valid Email Address.\n\n"
        + "( yourname@yourdomain.com )" );
    theForm.email.focus();
    theForm.email.select();
    return false;
  }
  else if ( !((pindex > index+1) && (theStr.length > pindex+1)) )
  {
    alert("Please enter a valid Email Address.\n\n"
        + "( yourname@yourdomain.com )" );
    theForm.email.focus();
    theForm.email.select();
    return false;
  }

	if(theForm.change_pass.checked){
		
  // password
	if(theForm.password.value=="")
	{
			alert("You must enter a New Password.    ");
			theForm.password.focus();
			return false;
	}

	if(theForm.password.value.length < 4)
	{
			alert("You must enter at least 4 characters for the New Password.    ");
			theForm.password.focus();
			return false;
	}

	if(theForm.confirm.value=="")
	{
			alert("You must confirm the New Password.    ");
			theForm.confirm.focus();
			return false;
	}

	if(theForm.confirm.value != theForm.password.value)
	{
		alert("Your Confirm Password doesn't match.    ");
		theForm.confirm.focus();
		return false;
	}

	theForm.hidden_pass.value = md5(theForm.password.value);

	}// end if change pass

  // secret_answer
  if(theForm.secret_answer.value=="")
  {
      alert("You must enter a secret answer.");
      theForm.secret_answer.focus();
      theForm.secret_answer.select();
      return false;
  }
	
  return true;
}

