
// Leerstellen eines Strings (links und rechts) entfernen
function trim(str)
{
	var i, beg, end, result
	
	beg = -1
	for (i = 0; i < str.length; i++) {
		if (str.charCodeAt(i) != 0x20) {
			beg = i
			break
		}
	}
	end = -1
	for (i = str.length - 1; i >= 0; i--) {
		if (str.charCodeAt(i) != 0x20) {
			end = i
			break
		}
	}
	//alert('beg=' + beg + ', end=' + end);
	if (end >= beg)
		result = str.substring(beg,end+1)
	else
		result = ""
	//alert("<" + result + "> " + result.length)
	return result
}

