// JavaScript Document
<!--

function validpw(form) {

  var cpw = form.cpw.value;
  var mpw = form.mpw.value;
  var rpw = form.mpsw1.value;  
  var invalid = " "; // Invalid character is a space
  var minLength = 6; // Minimum length	

  if (cpw == ''){
	  alert("Please enter your Current Password");
	  form.cpw.focus();
	  return false;
  }

// check for a value in both fields.
if (mpw == '' || rpw == '') {
alert('Please enter your password twice.');
mpw.focus();
return false;
}
// check for minimum length
if (document.form1.mpw.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}
// check for spaces
if (document.form1.mpw.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed in your password.");
return false;
}
else {
if (mpw != rpw) {
alert ("You did not enter the same new password twice. Please re-enter your password.");
return false;
}
}

}

















function validedit(form) {
  var fname = form.fname.value;
  var lname = form.lname.value;
  var address1 = form.address1.value;
  var address2 = form.address2.value;
  var city = form.city.value;
  var state = form.mstate.value;
  var zip = form.zip.value;
  var experience = form.experience.value;
  var mhow = form.how.value;
  var wheredry = form.wheredry.value;
  var wherelive = form.wherelive.value;
  var research = form.research.value;
  var oostock = form.oostock.value;




  var field = form.email; // email field
  var str = field.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid

  if (fname == ''){
	  alert("Please enter your First Name");
	  form.fname.focus();
	  return false;
  }
  if (lname == ''){
	  alert("Please enter your Last Name");
	  form.lname.focus();
	  return false;
  }
  if (address1 == ''){
	  alert("Please enter your Address");
	  form.address1.focus();
	  return false;
  }
  if (city == ''){
	  alert("Please enter your city");
	  form.city.focus();
	  return false;
  }
  if (state == ''){
	  alert("Please enter your state");
	  form.mstate.focus();
	  return false;
  }
  if (zip == ''){
	  alert("Please enter your zip");
	  form.zip.focus();
	  return false;
  }
  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
//    return true;
  }
  else
  {
  alert("Please enter a valid email"); // this is also optional
  field.focus();
  field.select();
  return false;
  }

  if (experience == ''){
	  alert("Please enter your Hobby Experience");
	  form.experience.focus();
	  return false;
  }
  if (mhow == ''){
	  alert("Please tell us how you heard about LFS Locator");
	  form.mhow.focus();
	  return false;
  }
  if (wheredry == ''){
	  alert("Please tell us where you buy your dry goods.");
	  form.wheredry.focus();
	  return false;
  }
  if (wherelive == ''){
	  alert("Please tell us where you buy your livestock.");
	  form.wherelive.focus();
	  return false;
  }
  if (research == ''){
	  alert("Please tell us where you first do your research");
	  form.research.focus();
	  return false;
  }
  if (oostock == ''){
	  alert("Please tell us what you do when your LFS is out of stock.");
	  form.oostock.focus();
	  return false;
  }

}










































function validsu(form) {
  var username = form.username.value;
  var fname = form.fname.value;
  var lname = form.lname.value;
  var address1 = form.address1.value;
  var address2 = form.address2.value;
  var city = form.city.value;
  var state = form.mstate.value;
  var zip = form.zip.value;
  var mpw = form.mpw.value;
  var rpw = form.rpw.value;

  var invalid = " "; // Invalid character is a space
  var minLength = 6; // Minimum length

var field = form.email; // email field
  var str = field.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid

  if (username == ''){
	  alert("Please enter your username");
	  form.username.focus();
	  return false;
  }
  if (fname == ''){
	  alert("Please enter your First Name");
	  form.fname.focus();
	  return false;
  }
  if (lname == ''){
	  alert("Please enter your Last Name");
	  form.lname.focus();
	  return false;
  }
  if (address1 == ''){
	  alert("Please enter your Address");
	  form.address1.focus();
	  return false;
  }
  if (city == ''){
	  alert("Please enter your city");
	  form.city.focus();
	  return false;
  }
  if (state == ''){
	  alert("Please enter your state");
	  form.mstate.focus();
	  return false;
  }
  if (zip == ''){
	  alert("Please enter your zip");
	  form.zip.focus();
	  return false;
  }
  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
//    return true;
  }
  else
  {
  alert("Please enter a valid email"); // this is also optional
  field.focus();
  field.select();
  return false;
  }


// check for a value in both fields.
if (mpw == '' || rpw == '') {
alert('Please enter your password twice.');
mpw.focus();
return false;
}
// check for minimum length
if (document.form1.mpw.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}
// check for spaces
if (document.form1.mpw.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed in your password.");
return false;
}
else {
if (mpw != rpw) {
alert ("You did not enter the same new password twice. Please re-enter your password.");
return false;
}
}

  if (experience == ''){
	  alert("Please enter your Hobby Experience");
	  form.experience.focus();
	  return false;
  }
  if (mhow == ''){
	  alert("Please tell us how you heard about LFS Locator");
	  form.mhow.focus();
	  return false;
  }
  if (wheredry == ''){
	  alert("Please tell us where you buy your dry goods.");
	  form.wheredry.focus();
	  return false;
  }
  if (wherelive == ''){
	  alert("Please tell us where you buy your livestock.");
	  form.wherelive.focus();
	  return false;
  }
  if (research == ''){
	  alert("Please tell us where you first do your research");
	  form.research.focus();
	  return false;
  }
  if (oostock == ''){
	  alert("Please tell us what you do when your LFS is out of stock.");
	  form.oostock.focus();
	  return false;
  }

}

// -->
