// Password validation

<!-- Original:  Russ Swift (rswift220@yahoo.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function validatePwd(pw1,pw2) {
	var invalid = " "; // Invalid character is a space
	var minLength = 6; // Minimum length
	
	var ret = false;
	
	// check for a value in both fields.
	if (pw1 == '' || pw2 == '') {
		alert('Please enter your password twice.');
		ret = false;
	}
	// check for minimum length
	if (pw1.length < minLength) {
		alert('Your password must be at least ' + minLength + ' characters long. Try again.');
		ret = false;
	}
	// check for spaces
	if (pw1.indexOf(invalid) > -1) {
		alert("Sorry, spaces are not allowed.");
		ret = false;
	}
	else {
		if (pw1 != pw2) {
			alert ("You did not enter the same new password twice. Please re-enter your password.");
			ref = false;
		}
		else {
			//alert('Nice job.');
			ret = true;
		}
	}
	
	return ret;
}