function trim(sText) { 
	return sText.replace(/^\s+|\s+$/, ''); 
};

String.prototype.charRefToUnicode = function()
{
	return this.replace(
		/&#(([0-9]{1,7})|(x[0-9a-f]{1,6}));?/gi,
		function(match, p1, p2, p3, offset, s)
			{
				return String.fromCharCode(p2 || ("0" + p3));
			}
	);
}