var errors, edtEmail, edtConfirm;
function forgotten()
{
	errors = false; //initialise
	
	//NB!! always validate in reverse order
	validate_edtConfirm();
	validate_edtEmail();
	
	if (!errors)
	{
		var data = {};
		data.dummy = ""; //we seem to get errors from the first value, so always add a dummy value first.
		data.edtEmail = edtEmail;
		callModule('login/forgotten_val.php', data);
	}
} //function forgotten()

function resend()
{
	errors = false; //initialise
	
	//NB!! always validate in reverse order
	validate_edtConfirm();
	validate_edtEmail();
	
	if (!errors)
	{
		var data = {};
		data.dummy = ""; //we seem to get errors from the first value, so always add a dummy value first.
		data.edtEmail = edtEmail;
		data.action = 2;
		callModule('login/forgotten_val.php', data);
	}	
}

function validate_edtEmail()
{
	//edtEmail = validateRequiredEmail("edtEmail", "Please enter your email address.");
	edtEmail = validateRequiredText("edtEmail", "Please enter your email / cell no.");
	if (!isWholeNumber(edtEmail) && !isValidEmail(edtEmail))
	{
		errors = true;
		handleError('edtEmail', 'Please enter a valid email or cell no.');
	} else clearError('edtEmail');
}

function validate_edtConfirm()
{
	edtConfirm = document.getElementById("edtConfirm").value;
	var num = isWholeNumber(edtEmail);
	if (edtConfirm !== edtEmail)
	{
		errors = true;
		var msg = num ? 'The cell no. does not match.' : 'The email address does not match.';
		handleError('edtConfirm', msg);
	} else clearError('edtConfirm');
	//edtConfirm = validateConfirmationEmail("edtConfirm", "edtEmail", "Please confirm your email address.");
}