function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function validateEmail(str)
{
	var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(str.match(emailRegEx))
	{
	return true;
	}else{
	return false;
	}
}

function validatePwd(str)
{
	var pwdRegEx = /^[a-zA-Z0-9]{4,16}$/;
	if(str.match(pwdRegEx))
	{
	return true;
	}else{
	return false;
	}
}


