function requirePasswordChange(pwdReqd,newPwd)
{
	if (pwdReqd)
	{
		// Password change required as it is their first login

		if (newPwd == '')
		{
			alert('You must choose a password when creating a new account');
			return false;
		}
		else
			return true;
	}
	else
	{
		// No password change required (already set)
		return true;
	}
}

//Validate phone number for 10 digit US numbers.
//phoneField - The HTML input field containing the phone number to validate.
//format - Integer value that defines how to format the text field.
function validatePhone(phoneField, format) {
   var num = phoneField.value.replace(/[^\d]/g,'');

   if(num.length != 10) {
        //Alert the user that the phone number entered was invalid.
        alert('Please enter a valid phone number in the format: xxxxxxxxxx');   
		return false;
   } else {
        //Email was valid.  If format type is set, format the Phone to the desired style.
      switch(format) {
            case '0': //Format (xxx)-xxx-xxxx
               phoneField.value = "(" + num.substring(0,3) + ")-" +
                                    num.substring(3, 6) + "-" + num.substring(6);
               break;
            case '1': //Format xxx-xxx-xxxx
               phoneField.value = num.substring(0,3) + "-" +
                                    num.substring(3, 6) + "-" + num.substring(6);
               break;
            default: //Format xxxxxxxxxx
               phoneField.value = num;
               break;
        }
		return true;
   }
}
