(function(tools){
	
	// public
	tools.trim = function(str)  {
		ltrim = /^[\s]+/
		rtrim = /[\s]+$/
		str = str.replace(ltrim,'');
		str = str.replace(rtrim,'');
		return str;
	}
	tools.hasword = function(str,word) {
		if (typeof(str)!="string") { return false; }
		pattern = new RegExp("(^|\\s)"+word+"(\\s|$)");
		return(str.match(pattern)!=null);
	}
		
})(window.tools = (window.tools) ? window.tools : {});
