//

	function checkPassword(p) {
		// var p = document.forms[0][ 'password1' ];
		if ( p.value.length < 6 ) {
			alert( "Passwords is too short.  Please enter a new password 6 or more characters long." );
			return false;
		}
		// add more tests here, based on security policy...
		return true;
	}   // comparePasswords

	function comparePasswords() {
		var p1 = document.forms[0][ 'password1' ];
		var p2 = document.forms[0][ 'password2' ];
		if ( ( null != p1 ) && ( null != p2 ) && ( p1.value == p2.value ) ) return true;
		alert( "Passwords do not match.  Please re-enter both passwords." );
		return false;
	}   // comparePasswords
	
	function validateNewUser() {
		if ( checkEmptyField( "username", "Username cannot be blank." ) ) return false;
		if ( checkEmptyField( "firstName", "First name cannot be blank." ) ) return false;
		if ( checkEmptyField( "lastName", "Last name cannot be blank." ) ) return false;
		if ( checkEmptyField( "email", "Email cannot be blank." ) ) return false;
		if ( checkEmptyField( "password1", "Password cannot be blank." ) ) return false;
		if ( ! comparePasswords() ) return false;
		if ( ! checkPassword( document.forms[0][ 'password1' ] ) ) return false;
		if ( checkEmptyField( "clinicName", "Practice Name cannot be blank." ) ) return false;
		if ( checkEmptyField( "clinicPhone", "Practice Phone cannot be blank." ) ) return false;
		if ( checkEmptyField( "clinicAddr1", "Practice Address cannot be blank." ) ) return false;
		if ( checkEmptyField( "clinicCity", "Practice City cannot be blank." ) ) return false;
		if ( checkEmptyField( "clinicZip", "Practice ZIP cannot be blank." ) ) return false;		
		return true;
	}   // validateNewUser
	
	function validateChangeInfo() {
		if(document.pressed == 'cancel') return true;
		
		if ( checkEmptyField( "lastName", "Last name cannot be blank." ) ) return false;
		if ( checkEmptyField( "firstName", "First name cannot be blank." ) ) return false;
		if ( checkEmptyField( "email", "Email cannot be blank." ) ) return false;
		return true;
	}   // validateChangeInfo	

	function validateChangePassword() {
		if(document.pressed == 'cancel') return true;
		
		if ( checkEmptyField( "currentPassword", "Current password cannot be blank." ) ) return false;
		if ( checkEmptyField( "password1", "New password cannot be blank." ) ) return false;
		if ( ! comparePasswords() ) return false;
		if ( ! checkPassword( document.forms[0][ 'password1' ] ) ) return false;
		return true;
	}   // validateChangePassword
	
	function validateUserSecurityAdmin() {
		if(document.pressed == 'cancel') return true;
		
		if ( checkEmptyField( "lastName", "Last name cannot be blank." ) ) return false;
		if ( checkEmptyField( "firstName", "First name cannot be blank." ) ) return false;
		if ( checkEmptyField( "password", "Password cannot be blank." ) ) return false;
		if ( ! checkPassword( document.forms[0][ 'password' ] ) ) return false;	
		if ( checkEmptyField( "email", "Email cannot be blank." ) ) return false;
	}  // validateUserSecurityAdmin
	
// end
