function check() {
if( document.gbadd.name.value == "" ){
alert( "Du hast keinen Namen angegeben!" );
document.gbadd.name.focus();
return false; }
if( document.gbadd.eintrag.value == "" ){
alert( "Du hast kein Kommentar geschrieben" );
document.gbadd.eintrag.focus();
return false; }
var zahl = 1; 
for(i=0;i<document.gbadd.icq.value.length;++i) 
if(document.gbadd.icq.value.charAt(i) < "0" 
|| document.gbadd.icq.value.charAt(i) > "9")
zahl = -1; 
if(zahl == -1) { 
alert("Deine Icq Nummer ist falsch!"); 
document.gbadd.icq.focus();
return false; }
}

function insert(aTag, eTag) {
  var input = document.forms['gbadd'].elements['eintrag'];
  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 = input.value.length;
	}
	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 switchMenu(obj, flash) {
	var el = document.getElementById(obj);
	
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
		if(flash==true){
			new Effect.Fade('overlay', { duration: 0.2});	
		}
	}
	else {
		el.style.display = '';
		if(flash==true){
			var arrayPageSize = getPageSize();
			Element.setHeight('overlay', arrayPageSize[1]);
			new Effect.Appear('overlay', { duration: 0.2, from: 0.0, to: 0.8 });			
		}
	}	
}

/*
 +--------------------------------------------------------------+
 |		J S - T O O L T I P   (v1.3)		|
 +--------------------------------------------------------------+
*/


  var OP = (navigator.userAgent.indexOf('Opera') != -1) ? true : false;
  var IE = (navigator.userAgent.indexOf('MSIE') != -1 && !OP) ? true : false;
  var GK = (navigator.userAgent.indexOf('Gecko') != -1) ? true : false;
  var NN4 = document.layers;
  var DOM = document.getElementById;

  function TOOLTIP() {
//----------------------------------------------------------------------------------------------------
// Configuration
//----------------------------------------------------------------------------------------------------
    this.width = 300;                     // width (pixels)
    this.bgColor = '#F7D91D';             // background color
    this.textColor = '#000000';           // text color
    this.borderColor = '#000000';         // border color
    this.opacity = 90;                    // opacity (percent) - doesn't work with all browsers
    this.cursorDistance = 5;              // distance from cursor (pixels)

    // don't change
    this.text = '';
    this.height = 0;
    this.obj = 0;
    this.sobj = 0;
    this.active = false;

// -------------------------------------------------------------------------------------------------------
// Functions
// -------------------------------------------------------------------------------------------------------
    this.create = function() {
      if(!this.sobj) this.init();

      var t = '<table style="border: 0px; width: ' + this.width + 'px; background-color: ' + this.bgColor + '; padding: 4px; margin: 0px;"><tr>' +
              '<td align="center"><span style="color:' + this.textColor + ';">' + this.text + '</span></td></tr></table>';

      if(NN4) {
        t = '<table style="border: 0px; padding: 1px; margin: 0px;"><tr><td style="background-color:' + this.borderColor + ';">' + t + '</td></tr></table>';
        this.sobj.document.write(t);
        this.sobj.document.close();
      }
      else {
        this.sobj.border = '2px solid ' + this.borderColor;
        this.setOpacity();
        if(document.getElementById) document.getElementById('ToolTip').innerHTML = t;
        else document.all.ToolTip.innerHTML = t;
      }
      if(DOM) this.height = this.obj.offsetHeight;
      else if(IE) this.height = this.sobj.pixelHeight;
      else if(NN4) this.height = this.obj.clip.bottom;

      this.show();
    }

    this.init = function() {
      if(DOM) {
        this.obj = document.getElementById('ToolTip');
        this.sobj = this.obj.style;
      }
      else if(IE) {
        this.obj = document.all.ToolTip;
        this.sobj = this.obj.style;
      }
      else if(NN4) {
        this.obj = document.ToolTip;
        this.sobj = this.obj;
      }
    }

    this.show = function() {
      var ext = (document.layers ? '' : 'px');
      var left = mouseX;
      var top = mouseY;

      if(left + this.width + this.cursorDistance > winX) left -= this.width + this.cursorDistance;
      else left += this.cursorDistance;

      if(top + this.height + this.cursorDistance > winY) top -= this.height;
      else top += this.cursorDistance;

      this.sobj.left = left + ext;
      this.sobj.top = top + ext;

      if(!this.active) {
        this.sobj.visibility = 'visible';
        this.active = true;
      }
    }

    this.hide = function() {
      if(this.sobj) this.sobj.visibility = 'hidden';
      this.active = false;
    }

    this.setOpacity = function() {
      this.sobj.filter = 'alpha(opacity=' + this.opacity + ')';
      this.sobj.mozOpacity = '.1';
      if(this.obj.filters) this.obj.filters.alpha.opacity = this.opacity;
      if(!document.all && this.sobj.setProperty) this.sobj.setProperty('-moz-opacity', this.opacity / 100, '');
    }
  }

//----------------------------------------------------------------------------------------------------
// Build layer, get mouse coordinates and window width, create tooltip-object
//----------------------------------------------------------------------------------------------------
  var tooltip = mouseX = mouseY = winX = winY = 0;

  if(document.layers) {
    document.write('<layer id="ToolTip"></layer>');
    document.captureEvents(Event.MOUSEMOVE);
  }
  else document.write('<div id="ToolTip" style="position:absolute; z-index:999"></div>');
  document.onmousemove = getMouseXY;

  function getMouseXY(e) {
    if(IE) {
      mouseX = event.clientX + document.body.scrollLeft;
      mouseY = event.clientY + document.body.scrollTop;
    }
    else {
      mouseX = e.pageX;
      mouseY = e.pageY;
    }
    if(mouseX < 0) mouseX = 0;
    if(mouseY < 0) mouseY = 0;

    else if(GK || NN4) {
      winX = window.innerWidth - 25;
      winY = window.innerHeight;
    }
    else if(DOM) {
      winX = document.body.offsetWidth - 25;
      winY = document.body.offsetHeight;
    }
    else {
      winX = screen.width - 25;
      winY = screen.height;
    }
    if(tooltip && tooltip.active) tooltip.show();
  }

  function toolTip(text, width, opacity) {
    if(text) {
      tooltip = new TOOLTIP();
      tooltip.text = text;
      if(width) tooltip.width = width;
      if(opacity) tooltip.opacity = opacity;
      tooltip.create();
    }
    else if(tooltip) tooltip.hide();
  }
  
function mktarget(obj) {
	obj.target = '_blank';
}

