/*	============================================================
	Markierten Text auslesen und zurückgeben
	oder in Textfeld schreiben
	========================================================= */
var selection = new String();

function getSelectedText(target, message){
	// Netscape 6 & Mozilla
	if(window.getSelection){
		selection = window.getSelection().toString();

	// Netscape Navigator 4.7
	} else if(document.getSelection){
		selection = document.getSelection();

	//Internet Explorer 5.5
	} else if(document.selection){
		selection = document.selection.createRange().text;
	} // if

	if(selection != ""){
		// Begriff trimmen (vorne)
		while(selection.substr(0, 1) == " "){
			selection = selection.substr(1);
		} // while

		// Begriff trimmen (hinten)
		while(selection.substr(selection.length - 1, 1) == " "){
			selection = selection.substring(0, selection.length - 1);
		} // while

		if(target == ""){
			return selection;
		}else{
			target.value = selection;
		} // if
	} else {
		if(message){
			alert(message);
		} // if
	} // if
} // function