TopNavi = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("topnavi");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" aktiv";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" aktiv", "");
				}
			}
		}
	}
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
  }
}

function link_popup(href, width, height) {
  params='width='+width+',height='+height+',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
  var theWindow =
    window.open(href, '_blank', params);
  theWindow.focus();
  return theWindow;
}

function openGlossar(word) {
	window.open("index.php?lia_page=glossar_popup&wort="+word,"glossar","width=316,height=350,toolbar=0,status=0,scrollbars=yes");
}


tt = null;

window.onload=function()
{
  TopNavi();
  externalLinks();

  tt = document.getElementById('tooltip');
  tt2 = document.getElementById('tooltip2');
  e = document.getElementById('innercontent');
  h = e.offsetHeight;
  
  if (h < 650) {
    e.style.height = "650px";
  }
}

  document.onmousemove = updateTooltip;

function getScrollY() {
	if (document.body.scrollTop) {
		return document.body.scrollTop;
	} else {
		return document.documentElement.scrollTop;
	}

}

function updateTooltip(e) {
	x = (document.all) ? window.event.x : e.pageX;
	y = (document.all) ? window.event.y + getScrollY() : e.pageY;

	if (tt != null) {
		tt.style.left = (x+1) + "px";
		tt.style.top = (y - tt2.offsetHeight) + "px";

	}
}

function showTooltip(text) {
	if (tt2) tt2.innerHTML = text;
	if (tt) tt.style.display = "block";
}

function hideTooltip() {
	if (tt) tt.style.display = "none";
}

function browserCheck()
	{
	var agt = navigator.userAgent.toLowerCase();
	this.ie4 = (document.all) ? true : false;
	this.ns4 = (document.layers) ? true : false;
	this.dom2 = (document.getElementById) ? true : false;
	this.ie5 = (this.ie4 && this.dom2) ? true : false;
	this.ns6 = (!this.ie4 && this.dom2) ? true : false;
	this.opa = (agt.indexOf('opera') != -1) ? true : false;
	this.win = (agt.indexOf('win') != -1) ? true : false;
	this.mac = (agt.indexOf('mac') != -1) ? true : false;

	if (this.ie4 && this.win && !this.opa)
		{
		with (document)
			{
			write('<script language="VBScript" type="text/vbscript">\n');
			write('Function flashActX(flashVer)\n');
			write('\tOn Error Resume Next\n');
			write('\t\n');
			write('\tDim FlashObj\n');
			write('\tFlashObj = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVer))\n');
			write('\tflashActX = FlashObj\n');
			write('End Function\n');
			write('</script>\n');
			}
		this.flashEnabled = (typeof(flashActX(4)) != 'undefined') ? true : false;
		this.flash5Enabled = (typeof(flashActX(5)) != 'undefined') ? true : false;
		this.flash6Enabled = (typeof(flashActX(6)) != 'undefined') ? true : false;
		}
	else
		{
		if (navigator.plugins && navigator.plugins['Shockwave Flash'])
			{
			var flashPlugIn = 0;
			var str = navigator.plugins['Shockwave Flash'].description.split(' ');
			for (var i = 0; i < str.length; i++)
				{
				if (!isNaN(parseInt(str[i])))
					{
					flashPlugIn = parseInt(str[i]);
					break;
					}
				}
			this.flashEnabled = (flashPlugIn >= 4) ? true : false;
			this.flash5Enabled = (flashPlugIn >= 5) ? true : false;
			this.flash6Enabled = (flashPlugIn >= 6) ? true : false;
			}
		else
			{
			this.flashEnabled = false;
			}
		}
	}

function changeBanner() {
	if (bannervisible == 1) {
		bannervisible = 0;

		lowerBanner();
		window.setTimeout("document.getElementById('divbanner').innerHTML = ''; document.getElementById('divbanner').style.display = 'none'",2000);

	} else {
		bannervisible = 1;
		currentheight = 0;

		document.getElementById('divbanner').innerHTML = BannerCode;
		document.getElementById('divbanner').style.display = 'block';
		raiseBanner();

	}

	logImg = '<img src="../images/empty.gif" width=20 height=1 alt="" border=0><img src="../log.php?res='+screen.width+'x'+screen.height+'&loc='+loc+'&banner='+bannervisible+'" border=0>';
	document.getElementById('bannerImg').innerHTML = logImg;

}

function resizeDiv(height) {
	document.getElementById('divbanner').style.height = height;
	currentheight = height;
}

function raiseBanner() {
	newheight = currentheight + 4;
	currentheight = newheight;

	if (newheight <= normalheight) {
		resizeDiv(newheight);
		window.setTimeout("raiseBanner()",20);
	}
}

function lowerBanner() {
	newheight = currentheight - 4;
	currentheight = newheight;

	if (newheight > 0) {
		resizeDiv(newheight);
		window.setTimeout("lowerBanner()",20);

	} else resizeDiv(1);
}
