function ValidateForm(theForm){

  if(theForm.Form_Status.value == 'Delete'){
  var del = window.confirm('Are you sure you want to delete this entry?')
  if (!del){return false}
 }

 
 if (theForm.Form_Status.value == 'Add' || theForm.Form_Status.value == 'Update'){
  if(theForm.User_First_Name.value == '' || theForm.User_First_Name.value.length > 50){
   RevertFormStatus(theForm);
   alert('First Name required.\n(Maximum length: 50 characters)');
   theForm.User_First_Name.focus();
   return false;
  }

  if(theForm.User_Last_Name.value == '' || theForm.User_Last_Name.value.length > 50){
   RevertFormStatus(theForm);
   alert('Last Name required.\n(Maximum length: 50 characters)');
   theForm.User_Last_Name.focus();
   return false;
  }

  if(theForm.User_Email.value == '' || theForm.User_Email.value.length > 150){
   RevertFormStatus(theForm);
   alert('Email required.\n(Actual length: ' + theForm.User_Email.value.length + ' characters)\n(Maximum length: 150 characters)');
   theForm.User_Email.focus();
   return false;
  }

  if(theForm.User_Email_Confirmation.value == '' || theForm.User_Email_Confirmation.value.length > 150){
   RevertFormStatus(theForm);
   alert('Email Confirmation required.\n(Actual length: ' + theForm.User_Email_Confirmation.value.length + ' characters)\n(Maximum length: 150 characters)');
   theForm.User_Email_Confirmation.focus();
   return false;
  }

  if(theForm.User_Email_Confirmation.value != theForm.User_Email.value){
   RevertFormStatus(theForm);
   alert('Email does not match Email Confirmation.');
   theForm.User_Email_Confirmation.focus();
   return false;
  }


  if(theForm.User_Phone.value == '' || theForm.User_Phone.value.length > 12){
   RevertFormStatus(theForm);
   alert('Phone required.\n(Maximum length: 12 characters)');
   theForm.User_Phone.focus();
   return false;
  }

  if(theForm.User_Company.value == '' || theForm.User_Company.value.length > 50){
   RevertFormStatus(theForm);
   alert('Company required.\n(Maximum length: 50 characters)');
   theForm.User_Company.focus();
   return false;
  }

  if(theForm.User_Company_Abbreviation.value == '' || theForm.User_Company_Abbreviation.value.length > 10){
   RevertFormStatus(theForm);
   alert('Company Abbreviation required.\n(Maximum length: 10 characters)');
   theForm.User_Company_Abbreviation.focus();
   return false;
  }

  if(theForm.User_User_Type_ID.value == ''){
   RevertFormStatus(theForm);
   alert('FTP User Type required.');
   theForm.User_User_Type_ID.focus();
   return false;
  }

  if(theForm.UserGroupSelect.value == ''){
   RevertFormStatus(theForm);
   alert('FTP User Group required.');
   theForm.UserGroupSelect.focus();
   return false;
  }
  
  if(theForm.User_Comments.value != ''){
   if(theForm.User_Comments.value.length > 150){
    RevertFormStatus(theForm);
    alert('Comments are too long.\nMaximun characters: 150.\nCurrent characters: ' + theForm.User_Comments.value.length + '.');
    theForm.User_Comments.focus();
    return false;
   }
  }

  
  
 }	
}


function RevertFormStatus(theForm){
 theForm.Form_Status.value = '';
}
