// common validation functions
// 06/15/05 BPB - created
// 11/22/05 BPB - phone numbers can have slashes in them

function JSValidatePhoneNumber(strCheck) {
	// Validates "strCheck" as a phone number.
	// Returns true if OK, false if not.
  var strOK = "0123456789--+x/() ";
  var allValid = true;
  for (i = 0;  i < strCheck.length;  i++) {
    ch = strCheck.charAt(i);
    for (j = 0;  j < strOK.length;  j++)
      if (ch == strOK.charAt(j))
        break;
    if (j == strOK.length) {
      allValid = false;
      break;
    }
  }
	return (allValid);
}


function JSValidateAlphaNumericDash(strCheck) {
	// Validates that "strCheck" contains only A-Za-z0-9 and -.
	// Returns true if OK, false if not.
  var strOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-";
  var allValid = true;
  for (i = 0;  i < strCheck.length;  i++) {
    ch = strCheck.charAt(i);
    for (j = 0;  j < strOK.length;  j++)
      if (ch == strOK.charAt(j))
        break;
    if (j == strOK.length) {
      allValid = false;
      break;
    }
  }
	return (allValid);
}


function JSValidateNumericDash(strCheck) {
	// Validates that "strCheck" contains only 0-9 and -.
	// Returns true if OK, false if not.
	var strOK = "0123456789-";
  var allValid = true;
  for (i = 0;  i < strCheck.length;  i++) {
    ch = strCheck.charAt(i);
    for (j = 0;  j < strOK.length;  j++)
      if (ch == strOK.charAt(j))
        break;
    if (j == strOK.length) {
      allValid = false;
      break;
    }
  }
	return (allValid);
}
