var MINIMUM_PASSWORD_LENGTH = 6;

//Returns true if parameter is a believable email address
function isEmail(potentialEmail)
{
	//var regex = new RegExp('^.*[@].*[.].*$');
	var regex = new RegExp('^.{1,}[@].{1,}[.].{1,}$');
	
	return potentialEmail.match(regex);
}

//Returns true if parameter is a believable Japanese postcode
//(parameter has no hyphens and is hankaku)
function isJapanesePostcode(potentialPostcode)
{
	var regex = new RegExp('^[0-9]{7}$');
	
	return potentialPostcode.match(regex);
}

//Returns true if password parameter is a weak password
function isWeakPassword(password, username)
{
	//Lowercase both parameters
	password = password.toLowerCase();
	username = username.toLowerCase();
	
	var weakPasswords = [username, 'password', 'secret', 'abracadabra', 'topsecret'];
	
	var weakPasswordsLength = weakPasswords.length;	//Loop optimization
	for(var loop = 0; loop < weakPasswordsLength; loop++)
	{
		if(password == weakPasswords[loop])
		{
			return true;
		}
	}
}

//Returns true if parameter is a too short password
function isTooShortPassword(password)
{
	if(password.length < MINIMUM_PASSWORD_LENGTH)
	{
		return true;
	}
}

//Returns true if parameter is ALL whitespace
function isAllWhitespace(string)
{
	var regex = new RegExp('[ |　|\t]{' + string.length + '}');
	
	return string.match(regex);
}

//Returns true if paramter contains no visible characters
function isEmpty(string)
{
	if(string.length == 0 || isAllWhitespace(string))
	{
		return true;
	}
	
	return false;
}
