	function trim (str) {
		str = str.replace(/^\s+/, '');
		for (var i = str.length - 1; i >= 0; i--) {
			if (/\S/.test(str.charAt(i))) {
				str = str.substring(0, i + 1);
				break;
			}
		}
		return str;
	}

	function isEmpty(id)
	{
		var obj = document.getElementById(id);

		if(typeof(obj.value)!="undefined")
			return trim(obj.value) == "";
		else
			if(typeof(obj.options)!="undefined")
			{
				for(var i=0; i < obj.options.length; i++)
					if(obj.options[i].selected == true)
						return trim(obj.options[i].value) == "";
					return true;
			}
			else
				return true;
	}
