// --------------------------------------------------------------------------
// Copyright © 1999-2010 KB Group (UK) Ltd.  All Rights Reserved.
// www.kbgroupuk.com
// --------------------------------------------------------------------------
// Amendments:
//
//	Date		By	Description
//	----		--	---------------------------------------------------------
//	01/12/06	SK	Edited invalid password error message
// --------------------------------------------------------------------------

function ValidateLogin(theForm)
{
	if(!theForm.txtEmail.value.length)
	{
		if(!IsValidText(theForm.txtPatronId.value, 1, 10, "^\\d+$", "09", ""))
		{
			alert("Please enter a valid email address or customer number to login.");
			theForm.txtPatronId.focus();
			return false;
		}
	}
	else if(!isEmail(theForm.txtEmail.value))
	{
		alert("Please enter a valid email address to login.");
		theForm.txtEmail.focus();
		return false;
	}
	
	if (!theForm.txtPassword.value.length || !IsValidText(theForm.txtPassword.value, 6, 12, "^([a-z]*|\\d*)+", "azAZ09", ""))
	{
		alert("Please enter a valid password to login. Passwords consist of letters and numbers only and must be between 6 and 12 characters long.");
		theForm.txtPassword.focus();
		return false;
	}
	return true;
}

function DispMsg()
{
	// Check that the user has actually entered an email address of AgtRefNo
	if (document.form1.txtEmail.value == "" && document.form1.txtPatronId.value == "")
	{
		alert("You must enter either your email address or customer number before proceeding.");
		return false;
	}

	// Now display an alert to let the user know that this page is unsecure
	// and give them the option to exit from the password reminder
	// if (confirm("Your password will be emailed to your registered email address.\nPlease note this service is not secure.")) {
	if (confirm("You will be sent an email which contains instructions on how to change your password.\nPlease note this service is secure."))
	{
		document.form1.action='passremind2.asp';document.form1.submit();
	}
}