 function Validate(frmLogin) {
 un=frmLogin.txtUsername.value
 pw=frmLogin.txtPassword.value

 //checking driver number format is valid
 test = frmLogin.txtUsername.value; size = test.length
//Change to uppercase
 test = test.toUpperCase();
//writing back to form field and
// checking if username has been entered
 frmLogin.txtUsername.value = test; 
if(un == ""){
  alert("Your username was not entered")
  frmLogin.txtUsername.focus()
return false
}
//checking leftmost character is an alphabet
 if (!(isNaN(test.charAt(0)))){ 
   alert("please check the first character of your username");
   frmLogin.txtUsername.focus();
   return false;
   }

//checking for valid email format rember username is the same as email add
re= /^\w+([\.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/
if(!(re.test(un))){
alert("Invalid username")
	 frmLogin.txtUsername.focus();
return false
}


  // checking if password has been entered
if(pw == ""){
 alert("Your password was not entered")
 frmLogin.txtPassword.focus()
return false
}
 else
return true
 }
