function trim(text){
	text += "";
	while (text.charAt(0) == " "){
		text = text.substring(1);
	}
	while (text.charAt(text.length - 1) == " "){
		text = text.substring(0, text.length - 1);
	}
	return text;
}

function replaceText(text, alt, neu){
	text += "";
	var neuLength = neu.length;
	var altLength = alt.length;
	var pos = -neuLength;
	while ((pos = text.indexOf(alt, pos + neuLength)) >= 0){
		text = text.substring(0, pos) + neu + text.substring(pos + altLength);
	}
	return text;
}