
function myLogin() {  
	var strUserID = document.getElementById('txtUserID').value;
 	if (!strUserID ) {
		document.getElementById('txtUserID').focus();
	    alert("User id cannot be Empty");
	    return;
	    } 	
		
	var strPassword=document.getElementById('txtPassword').value;
	
	if (!strPassword) {
		document.getElementById('txtPassword').focus();
		alert("Password cannot be empty");
		return;
		}		
	document.getElementById('txtPassword').value = hex_sha1(document.getElementById('txtPassword').value);
	document.frmLogon.submit();            
}     


function changePassword(){
	if (validPassword()==false){
		return;
	}else{	
		document.getElementById('txtPassword').value = hex_sha1(document.getElementById('txtPassword').value);
		document.getElementById('txtNewPassword').value = hex_sha1(document.getElementById('txtNewPassword').value);
		document.frmLogon.submit();  
	}
	
}
function validPassword(){
	
	if (document.getElementById('txtValid').value!='Yes'){return false;}
	if (comparePassword()==false){return false;}
	if (checkPassword()==false){return false;}
	return true;

}

function comparePassword(){
	var docpwd = document.getElementById('txtNewPassword').value
	var docpwd2 = document.getElementById('txtNewPassword1').value
	if (docpwd!=docpwd2) {
		alert('New Password and Confirm New Password information does not match.\nPlease re-enter the new password.');
		return false;
		}else{return true;}
}

function checkPassword () {
	 var strng = new String;
	 strng = document.getElementById('txtNewPassword').value;

	 if (strng == '') 
	 	{
		    alert("You didn't enter a password.");
		    return false;
	 	}	 
	 	
     
    if ((strng.length < 7) || (strng.length >15)) 
    	{
	       alert("The password needs to be at least 6 alphanumeric characters and contain at least 1 number.");
	       return false;
    	}
    	
    var illegalChars = new RegExp('/[\W_]/'); 
    if (illegalChars.test(strng)==true) 
	    {
	      alert("The password contains illegal characters.");
	      return false;
	    }

   
    /*
    var nbrCheck = new RegExp('/\d{1,}/'); 
	if (strng.search('/(0-9)+/')==-1)
    	{
	  		alert("The password must contain at least one 1 number.");
	  		return false;
 		}
 	*/
 	
	 
}
     
function myCancel() { 
	document.getElementById('txtUserID').value='';
	document.getElementById('txtPassword').value='';
	}     
	
function forgetPassword() { 
	var objChk=window.open('Forgetpassword.asp', 'password', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width=300, height=200'); 
	if (window.focus) {objChk.focus()}

	}     
	

