// generate random characters
function randomChars(xLength, xType)
{
	// start with a blank password
	var xPassword = '';
	var xChar = '';
	// define possible characters
	if (xType == 'alpha') xPossible = 'abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ';
	else if (xType == 'num') xPossible = '0123456789';
	else xPossible = '0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ';

	// add random characters to $password until $length is reached
	for (i = 1; i <= xLength; i++)
	{
		// pick a random character from the possible ones
		xChar = xPossible.substr(Math.floor(Math.random()*xPossible.length-1), 1);
		// we don't want this character if it's already in the password
		xPassword += xChar;
	}
	return xPassword;
}