// The VerifyUserName JavaScript function can be used to perform client-side 
// validation of a User Name. The function accepts Two (2) input parameters
//  - strUserNameDesc, txtUserNameObj. 
// 
// The strUserNameDesc parameter is the English description of the form 
// text username object (i.e. Your User Name). The txtUserNameObj parameter 
// is the form text UserName object (i.e. txtUserName).

// The function will return "true" when there are no errors and it will 
// return "false" when errors exist.  Additionally, the function will 
// display an "alert" as well as set focus to the form text
// e-mail object when errors exist.

function VerifyUserName(txtUserNameObj, strUserNameDesc)
{
	var checkStr = txtUserNameObj.value;

	var INVALID_CHARS = ' :;/*?"><|{}[]!#$%&+=~`^\'';
	
	if (checkEmail(txtUserNameObj, strUserNameDesc))
		for (j = 0; j < INVALID_CHARS.length; j++)
		{
			if (INVALID_CHARS.indexOf(checkStr.charAt(j)) > 0)
			{
				txtUserNameObj.focus();
				txtUserNameObj.select();
				if (languageid == 1)
				  alert(strUserNameDesc + ' contains an invalid character at position ' + (j + 1) + '.');
                else
                  alert(strUserNameDesc + ' contient un caractère invalide à la position ' + (j + 1) + '.');				        
				return false;
			}
		}
	else
	{
		txtUserNameObj.focus();
		txtUserNameObj.select();
		return false;
	}
	return true;			

}

