
/*
checks the registration and profile form before submitting it. Calls functions defined in FormCheck.js
*/
function checkForm(theForm){
	//alert('checkform called, agreement checked=' + document.registerform.agreement.checked);
	//alert('this=' + theForm + '  name=' + theForm.name);
	//if (!checkFields(document.registerform.name)){ 
	if (!checkFields(theForm)){ 
		//alert("checkfields returned false");
		return false;
	} 
  if(theForm.agreement)
  {
	  if (theForm.agreement.checked == false)
	  { 
		alert('In order to use our service you must accept the Terms of Service');
			return false;
	  }
  }
	if((theForm.password) && (!checkAlphanumeric(theForm.password) || !checkMinLength(theForm.password,6,'Password field needs to be at least 6 characters long.  These characters must consist of letters and numbers only.')))
	//if((theForm.password) && (!checkAlphanumeric(theForm.password)))
	{ 
		theForm.password.select(); theForm.password.focus(); 
		return false;
	}
	if ((theForm.password2) && (!compareStrings(theForm.password2,theForm.password,'Passwords do not match!')))
	{
		//alert('returning false');
		theForm.password.select(); theForm.password.focus(); 
		return false;
	}
	return true;
	//return false;
}

function checkLogin(theForm){
	//alert('checkform called');
	if (!checkFields(theForm)){ 
		//alert("checkfields returns false");
		return false;
	} 
	if(!checkEmail(theForm.username))
	{ 
		theForm.password.select(); theForm.username.focus(); 
		return false;
	}
	//if(!checkMixedAlphanumeric(theForm.password) )
	//if(!checkAlphanumeric(theForm.password) )
	//{ 
	//	theForm.password.select(); theForm.password.focus(); 
	//	return false;
	//}
	/*
	if(!checkAlphanumeric(document.Login.password) || !checkMinLength(document.Login.password,6,'Password field needs to be at least 6 characters long.  These characters must be letters or numbers'))
	{ 
		document.Login.password.select(); document.Login.password.focus(); 
		return false;
	}
	*/
	//alert('checklogin returns true');
	return true;
}


function checkHintFields(theForm){
	//alert('checkform called');
	if (!checkFields(theForm)){ 
		return false;
	} 
	return true;
}
