function trim(str)
{
	var retStr="" ;
	if (typeof(str) == "undefined") 
	{
		retStr = "";
	} else 
	{ 
		if (str == null) 
		{ 
			retStr = "";
		} else 
		{ 
			retStr= str.replace( /^\s*/, "" ).replace( /\s*$/, "" );  
		}
	}
	return retStr;
} 
