function isEmpty(str)
{
	return (str == null) || (str.length == 0);
}
// returns true if the string is a valid email
function isEmail(str)
{
	if(isEmpty(str)) return false;
	var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
	return re.test(str);
}
// returns true if the string only contains characters A-Z or a-z
function isAlpha(str)
{
	var re = /[^a-zA-Z]/g
	if (re.test(str)) return false;
	return true;
}
// returns true if the string only contains characters 0-9
function isNumeric(str)
{
	var re = /[\D]/g
	if (re.test(str)) return false;
	return true;
}
// returns true if the string only contains characters A-Z, a-z or 0-9
function isAlphaNumeric(str)
{
	var re = /[^a-zA-Z0-9]/g
	if (re.test(str)) return false;
	return true;
}
// returns true if the string's length equals "len"
function isLength(str, len)
{
	return str.length == len;
}
// returns true if the string's length is between "min" and "max"
function isLengthBetween(str, min, max)
{
	return (str.length >= min)&&(str.length <= max);
}
// returns true if the string is a US phone number formatted as...
// (000)000-0000, (000) 000-0000, 000-000-0000, 000.000.0000, 000 000 0000, 0000000000
function isPhoneNumber(str)
{
	var re = /^\(?[2-9]\d{2}[\)\.-]?\s?\d{3}[\s\.-]?\d{4}$/
	return re.test(str);
}
// returns true if the string is a valid date formatted as...
// dd mm yyyy, dd/mm/yyyy, dd.mm.yyyy, dd-mm-yyyy
function isDate(str)
{
	var re = /^(\d{1,2})[\s\.\/-](\d{1,2})[\s\.\/-](\d{4})$/
	if (!re.test(str)) return false;
	var result = str.match(re);
	var y = Number(result[3]);
	var m = Number(result[2]);
	var d = Number(result[1]);
	if(m < 1 || m > 12 || y < 1900 || y > 2100) return false;
	if(m == 2)
	{
		  var days = ((y % 4) == 0) ? 29 : 28;
	}
	else if(m == 4 || m == 6 || m == 9 || m == 11)
	{
		  var days = 30;
	}
	else
	{
		  var days = 31;
	}
	return (d >= 1 && d <= days);
}
// returns true if "str1" is the same as the "str2"
function isMatch(str1, str2)
{
	return str1 == str2;
}
// returns true if the string contains only whitespace
function isWhitespace(str)
{
	var re = /[\S]/g
	if (re.test(str)) return false;
	return true;
}
function hideElement(id)
{
	document.getElementById(id).style.display = 'none';
}
function showElement(id)
{
	document.getElementById(id).style.display = 'block';
}
function changeElement(id)
{
	if (document.getElementById(id).style.display == 'block')
	{
		hideElement(id);
	}
	else
	{
		showElement(id);
	}
}
