
function insert(aTag, eTag) {
  var input = document.forms['form1'].elements['inhalt'];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}


function klappe(id)
{
	var klappText = document.getElementById('comment' + id);
	var klappBild = document.getElementById('pic' + id);

	if (klappText.style.display == 'none')
	{
	  klappText.style.display = 'block';
	  klappBild.src = 'images/minus.gif';
	}
	else
	{
	  klappText.style.display = 'none';
	  klappBild.src = 'images/plus.gif';
	}
}

/*
function getposition(id)
{
    if(!document.getElementById) return null;
    var o = document.getElementById(id);
    if(!o) return null;

	var top=0;
    while (o)
    {
         top += parseInt(o.offsetTop );
         o = o.offsetParent;
    }
    return (top-200);
}

function retposrichtig(ida,idb,idc,janein)
{	
	if(janein == 'set')
	{
		var a=getposition(ida);
		var b=getposition(idb);
		var c=getposition(idc);
		var differenz=(b-a);
		var richtig=(c-differenz+1);
	}
	else
	{
		var richtig=getposition(idc);
	}
	return richtig;
}

function scrollDivTo(ypos)
{
	document.getElementById("inhaltdiv").scrollTop = ypos;
}

//Die Funktion der Tooltip-Box
*/
wmtt = null;


function test(){
if (document.layers)  {
  //Netscape-----------------
   w=window.innerWidth;
   h=window.innerHeight;
   }
else if (document.all){
   // IE----------------------
  w=document.body.clientWidth;
  h=document.body.clientHeight;
  }
else {
  w=document.body.clientWidth;
  h=document.body.clientHeight;
}
}

zusx=0;
zusy=0;

document.onmousemove = updateWMTT;

function posx(win)
{
    if(!win) win = window;
    var posx=0
    posx = typeof win.pageXOffset != 'undefined' ?
               win.pageXOffset : // MZ
               (document.compatMode && document.compatMode == "CSS1Compat") ?
               document.documentElement.scrollLeft : // IE Strict Modus
               win.document.body.scrollLeft // IE Quirks Modus.
    ;
    return posx;
}
function posy(win)
{
    if(!win) win = window;
	var posy=0	
    posy = typeof win.pageYOffset != 'undefined' ?
              win.pageYOffset : // MZ
              (document.compatMode && document.compatMode == "CSS1Compat") ?
              document.documentElement.scrollTop : // IE Strict Modus
              win.document.body.scrollTop  // IE Quirks Modus
    ;
    return posy;
}
function updateWMTT(e) {
	test();
	x = (document.all) ? window.event.x + posx() : e.pageX;
	y = (document.all) ? window.event.y + posy()  : e.pageY;
	if (wmtt != null) {
		wmtt.style.left = (x + 12 + (zusx)) + "px";
		wmtt.style.top 	= (y + 25 + (zusy)) + "px";
	}
}
function showWMTT(id,zx,zy) {
	if(zx!=null)
    	zusx=zx;
	else
	    zusx=0;

	if(zy!=null)
		zusy=zy;
	else
		zusy=0;

	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}

