/* 
Script Created by: Larry Daughenbaugh [ www.systemsynapse.com ] for Travel Sentry [ www.travelsentry.org ]
*/													
/* ******************************************************************************************************************* Validate Login Form */
function validateLogin(CurrentForm) {
	 if (CurrentForm.strUserName.value == '') {
	  	alert("Please enter your Username.");
    CurrentForm.strUserName.focus();
		return false;
	 }
  if (CurrentForm.strUserName.value.length < 8) {
	  	alert("Your Username must be at least eight characters long.");
    CurrentForm.strUserName.focus();
  return false;
  }
  if (CurrentForm.strPassword.value == '') {
	  	alert("Please enter your Password.");
    CurrentForm.strPassword.focus();
  return false;
  }
  if (CurrentForm.strPassword.value.length < 8) {
	  	alert("Your password must be eight characters long.");
    CurrentForm.strPassword.focus();
  return false;
  }
return true;	
}
/* ******************************************************************************************************************* Validate General Help Form */
function validateHelp(CurrentForm) {
	 if (CurrentForm.tbEmail.value == '') {
    alert(String.fromCharCode(35831,36755,20837,24744,30340,30005,23376,37038,31665,22320,22336,12290));
    CurrentForm.tbEmail.focus();
		return false;
	 }
	 sEmail = CurrentForm.tbEmail.value;
  if(sEmail != "" && sEmail.search(/^[\w-_.]*[\w-_.]@[\w].+[\w]+[\w]$/) == -1){
    alert(String.fromCharCode(35831,36755,20837,19968,20010,26377,25928,30340,30005,23376,37038,31665,22320,22336,12290));
    CurrentForm.tbEmail.focus();
		return false;
	 }
		invalidChars = " /:,;";
  for (i=0; i<invalidChars.length; i++) {
    badChar = invalidChars.charAt(i);
    if (sEmail.indexOf(badChar,0) > -1) {
      alert(String.fromCharCode(35831,36755,20837,19968,20010,26377,25928,30340,30005,23376,37038,31665,22320,22336,12290));
      CurrentForm.tbEmail.focus();
      return false;
				}
  }
  if (CurrentForm.tbName.value == '') {
    alert(String.fromCharCode(35831,36755,20837,24744,30340,21517,23383,12290));
    CurrentForm.tbName.focus();
  return false;
  }
  if (CurrentForm.tbHelp.value == '') {
    alert(String.fromCharCode(35831,35814,32454,35828,26126,38656,35201,25105,20204,20160,20040,24110,21161,65311));
    CurrentForm.tbHelp.focus();
  return false;
  }
return true;	
}
/* ******************************************************************************************************************* Count Form Field Characters */
function txtCounter(field,countfield,maxlimit) {
  if (field.value.length > maxlimit) {
    field.value = field.value.substring(0, maxlimit);
  } else {
    countfield.value = field.value.length;
		}
}

