function trim(str){
	str = '' + str;
	var re = /^ */;
	var res = str.replace(re, '');
	re = / *$/;
	return(res.replace(re, ''));
}

