/**
/* validate_school_programs_frm.js
/*
/* @Descrip:
/*   File contains client-side form validators for school programs form.
/*
/* @Author : Justin R. Schwimmer                  
/**/

function ValidateSchoolProgramsFrm() {
   var ErrMsg = "";
   var ErrCnt = 0;
   
  // Company Name check: only contain letters, numbers, whitespace and symbols: ! - _ ? ' $ . : / \ ,
  if (ContainsNumAndSpecialChars(document.school_programs.company.value)) {
    ErrMsg += "  => Company name can only contain letters, numbers, whitespace and symbols: ! - _ ? ' $ . : / \ , \n";
    ErrCnt += 1;
  } 
  
  // Name check: only contain letters, numbers and whitespace
  if (IsAlphanumeric(document.school_programs.name.value)) {
    ErrMsg += "  => Name can only contain letters, numbers and whitespace.\n";
    ErrCnt += 1;
  }   
   
  // Position check: only contain letters, numbers, and symbols: - ' / \
  if (ContainsNumAndSpecialChars(document.school_programs.position.value)) {
    ErrMsg += "  => Position title can only contain letters, numbers, and symbols: - ' / \ \n";
    ErrCnt += 1;
  }   
   
  // Address check: only numbers, letters, hypens, or whitespace
  if (IsStreetAddress(document.school_programs.address.value)) {
    ErrMsg += "  => Address can only contain numbers, letters, hypens, or whitespace.\n";
    ErrCnt += 1;
  }   
   
  // City check: only letters, whitespace and symbols: - '
  if (ContainsChars(document.school_programs.city.value)) {
    ErrMsg += "  => City can only contain letters, whitespace and symbols: - '\n";
    ErrCnt += 1;
  }   
    
  // State check: only letters and whitespace
  if (LettersOnly(document.school_programs.state.value)) {
    ErrMsg += "  => State can only contain letters and whitespace.\n";
    ErrCnt += 1;
  }   
    
  // Zip check: only numbers, hyphens, and whitespace
  if (IsZip(document.school_programs.zip.value)) {
    ErrMsg += "  => Zip can only contain numbers, hyphens, and whitespace.\n";
    ErrCnt += 1;
  }   
   
  // Phone check: only numbers, parenthesis, hyphens, and whitespace
  if (IsPhone(document.school_programs.phone.value)) {
    ErrMsg += "  => Phone can only contain numbers, parenthesis, hyphens, and whitespace.\n";
    ErrCnt += 1;
  }   
  
  // Email check: No blanks. Must take the form of <account name>@<domain name>.<extension>
  if (IsEmpty(document.school_programs.email.value)) {
    ErrMsg += "  => Email address field is required.\n";
    ErrCnt += 1;
  } else if (IsEmail(document.school_programs.email.value)) {
    ErrMsg += "  => Email address must take the form of <account name>@<domain name>.<extension>.\n";
    ErrCnt += 1;
  }   
  
  // Questions/Comments check: No blanks. only contain letters, numbers, whitespace and symbols: ! - _ ? ' $ . : / \ ,
  if (IsEmpty(document.school_programs.questions.value)) {
    ErrMsg += "  => Questions/Comments field is required.\n";
    ErrCnt += 1;
  } else if (ContainsNumAndSpecialChars(document.school_programs.questions.value)) {
    ErrMsg += "  => Questions/Comments can only contain letters, numbers, whitespace and symbols: ! - _ ? ' $ . : / \ ,\n";
    ErrCnt += 1;
  }   
   
   if (ErrCnt != 0) {
    ErrMsg = ErrCnt + ((ErrCnt == 1)? " Error has" : " Errors have") + " occurred, please see below for details. \n\n" + ErrMsg;
    alert(ErrMsg);
    return false;  
  }
}