function validateFieldsPass() {
	var uname = document.getElementById('name');

	var whiteSpace = /^[\s]+$/;
	var okToSend = true;
	
	// Check to see if a required field is blank or null. If so, set an error message.
	if ( uname.value == '' || whiteSpace.test(uname.value) ) {
		alert("Please enter your username.");
		okToSend = false;
	}
	// If any of the checks for required information failed, 	
	if(okToSend == true){
		updateDetailsPass();
	}
}

/**
 * Sends the actual data in the form to the server via an AJAX request.
 * Change this method to extract whatever data you need to be taken from
 * the form and uploaded to the server.
**/
function updateDetailsPass () {
	showContactTimerPass(); // quickly begin the load bar

	// grab the fields in the form and the form itself
	var posfname = document.getElementById('name');

	// convert (&, +, =) to string equivs. Needed so URL encoded POST won't choke.
	var fname = cleanStringPass(posfname.value);

	// create the data that is to be sent
	var data = "uname="+fname;
	
	// the page on the server that sends the email
	var page = "includes/member/forms/forgotPass.php?contact=true&xml=true";
	// put the data into the request to be sent to the server
	loadXMLPosDoc(page,data);
}

/**
 * Cleans a string so that it can go in a string
**/
function cleanStringPass(str){
	str = str.replace(/&/g,"**am**");
	str = str.replace(/=/g,"**eq**");
	str = str.replace(/\+/g,"**pl**");
	return str;
}

function showContactTimerPass () {
	var loader = document.getElementById('loader');
	loader.innerHTML = "Please wait while we send your password to your email address.<img src=\"images/site/spinner.gif\">";
	sentTimer = setTimeout("hideContactTimerPass()",6000);
}

function hideContactTimerPass () {
	var loader = document.getElementById('loader');
	loader.innerHTML = "<ul id='buttons'><li><a title='login' href='javascript: document.loginForm.submit();'>log in</a></li><li><a title='sign up' href='signUp.php'>sign up</a></li><li><a title='lost password' href='javascript: validateFieldsPass();'>lost password</a></li></ul>";
	if(grabPosXML("status")=="OK"){
		loader.innerHTML += "Your password has been sent to the email address you used to sign up with.";
	}else{
		loader.innerHTML += "The username you supplied does not match any in our database. Should you experience further difficulties or require assistance please call Big Event Network free on 0800 001 6262";
	}
}