//# TODO: remove comments and "fluff characters" before release
//#
//#----------------------------------------------------------------------------
//#	validate_password
//#
//#	  Parameters:
//#		  password_str: the password to validate;
//#
//#	  Purpose:
//#	  	Validates a password to ensure that it conforms to the current
//#     set of requirements for passwords (length, the kinds of characters)
//#     it can contain, etc.  Control over this is in the user-registration
//#     persons area.
//#
//#  	Return:
//#  		0   if valid
//#     10  if invalid: empty
//# 		20  if invalid: contains invalid chars
//#     30  if invalid: too short
//#     40  if invalid: too long
//#----------------------------------------------------------------------------
function validate_password( password_str )
{
	//# not present or ""?
	if( !password_str || (password_str.length == 0) )
	{
		return( 10 ); //# empty or not present
	}

	//# This doesn't work if the string passed in is a string *object*!
	//# 
	//# if( typeof password_str != "string" )
	//# {
	//# 	return( 20 );  //# invalid format
	//# }
	
	if( password_str.length < 3 )
	{
		return( 30 ); //# too short
	}
	
	if( password_str.length > 33 )
	{
		return( 40 ); //# too long
	}

	//# can't contain '"' or ''' 

	/* if( password_str.match(/\s|["']/) ) */

	if( password_str.match(/["']/) )
	{
		return( 20 ); //# wacky chars
	}
	
	return( 0 ); //# appears to be valid
}


