function OpenWin (URL)
{
	window.open(URL, 'Window');
}

function ShowElement (strId, booBlock)
{
	if (typeof(booBlock) != 'boolean') {booBlock = true;}
	var strDisplay = 'block'; if (booBlock == false) {strDisplay = 'inline';}
	document.getElementById(strId).style.display = strDisplay;
}

function HideElement (strId)
{
	document.getElementById(strId).style.display = 'none';
}

function ShowHideElement (strId, booBlock)
{
	if (typeof(booBlock) != 'boolean') {booBlock = true;}
	
	if (document.getElementById(strId).style.display == 'none')
	{
		ShowElement(strId);
		ShowElement('hide_' + strId, booBlock);
		HideElement('show_' + strId);
	}
	else
	{
		HideElement(strId);
		HideElement('hide_' + strId);
		ShowElement('show_' + strId, booBlock);
	}
}

function InsertText (strId, strObject1, strObject2)
{
	var objField = document.getElementById(strId);
	objField.focus();
	if (typeof document.selection != 'undefined') // Internet Explorer
	{
		var range = document.selection.createRange();
		var insText = range.text;
		range.text = strObject1 + insText + strObject2;
		range = document.selection.createRange();
		if (insText.length == 0)
		{
			range.move('character', -strObject2.length);
		}
		else
		{
			range.moveStart('character', strObject1.length + insText.length + strObject2.length);
		}
		range.select();
	}
	else if (typeof objField.selectionStart != 'undefined') // neuere auf Gecko basierende Browser
	{
		var start = objField.selectionStart;
		var end = objField.selectionEnd;
		var insText = objField.value.substring(start, end);
		objField.value = objField.value.substr(0, start) + strObject1 + insText + strObject2 + objField.value.substr(end);
		var pos;
		if (insText.length == 0)
		{
			pos = start + strObject1.length;
		}
		else
		{
			pos = start + strObject1.length + insText.length + strObject2.length;
		}
		objField.selectionStart = pos;
		objField.selectionEnd = pos;
	}
	else // übrige Browser
	{
		var pos;
		var re = new RegExp('^[0-9]{0,3}$');
		while (!re.test(pos))
		{
			pos = prompt("Einfügen an Position (0.." + objField.value.length + "):", "0");
		}
		if (pos > objField.value.length)
		{
			pos = objField.value.length;
		}
		var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
		objField.value = objField.value.substr(0, pos) + strObject1 + insText + strObject2 + objField.value.substr(pos);
	}
}
