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 is_numeric(str) {
	var valid_chars = "0123456789";
	var is_number = true;
	var the_char;
	
	for (i = 0; i < str.length && is_number == true; i++) {
		the_char = str.charAt(i);
		
		if (valid_chars.indexOf(the_char) == -1) {
			is_number = false;
		}
	}
	
	return is_number;
}

function check_email(email) {
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	if (filter.test(email)) {
		return true;
	}
	
	return false;
}


