
 var activeToolTip = '';

 function tooltip_show(tooltip, event)
 {
	if( browser.isIE )
	{
		x = window.event.clientX + document.body.scrollLeft;
		y = window.event.clientY + document.body.scrollTop;
	}
	if( browser.isNS )
	{
		x = event.clientX + document.body.scrollLeft;
		y = event.clientY + document.body.scrollTop;
	}

	document.getElementById(tooltip).style.left       = ( x + 10 ) + "px";
	document.getElementById(tooltip).style.top        = ( y + 20 ) + "px";
	document.getElementById(tooltip).style.display    = 'block';
	document.getElementById(tooltip).style.visibility = 'visible';

	activeToolTip = tooltip;
 }


 function tooltip_hide(tooltip)
 {
	document.getElementById(tooltip).style.display    = 'none';
	document.getElementById(tooltip).style.visibility = 'hidden';

	activeToolTip = '';
 }


 var speed = 30;
 var index = 0; text_pos = 0;
 var contents, row;

 function type_text()
 {
	contents = '';
	row = Math.max(0,index-15);
	while( row < index )
	{
		contents += tl[row++] + '<br>\r\n';
	}

	document.getElementById('abc').innerHTML = "<font style='color: #FC7000; font-weight: bold;'>" + contents + tl[index].substring(0,text_pos) + "_</font>";

	if( text_pos++ == str_length )
	{
		text_pos = 0;
		index++;
		if( index != tl.length )
		{
			str_length = tl[index].length;
			setTimeout("type_text()",1500);
		} else
		  {
			var subContent = document.getElementById('abc').innerHTML;
			var endContent = subContent.substring(0,(subContent.length - 8)) + "</font>&nbsp;<sub><a href='index.php?site=vergessen' title='Passwort vergessen?'><img src='images/weiter.gif' border='0' alt='Passwort vergessen?'></a></sub>";
			document.getElementById('abc').innerHTML = endContent;
		  }
	} else
	  {
		setTimeout("type_text()",speed);
	  }
 }


 // ============================================================================================================


 var isIEBr = 0;


 function Browser()
 {
	var ua, s, i;

	this.isIE    = false;  // Internet Explorer
	this.isNS    = false;  // Netscape
	this.version = null;

	ua = navigator.userAgent;

	s = "MSIE";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}

	s = "Netscape6/";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isNS = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}

	s = "Gecko";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isNS = true;
		this.version = 6.1;
		return;
	}
 }


 var browser = new Browser();
 if(browser.isIE)
 {
	document.onkeyup = seitenklick;
	document.onmousemove = pageMouseMove;
 }
 if(browser.isNS)
 {
	document.addEventListener("keyup", seitenklick, true);
	document.addEventListener("mousemove", pageMouseMove, true);
 }

 function seitenklick(event)
 {
	var el;

	if( !event )
	{
		event = window.event;
	}

	if( browser.isIE )
	{
		hotKey = window.event.keyCode;
		isAlt  = window.event.altKey;
		el     = window.event.srcElement;
	}
	if( browser.isNS )
	{
		hotKey = event.which;
		isAlt  = event.altKey;
		el     = (event.target.className ? event.target : event.target.parentNode);
	}

	if( isAlt == true )
	{

	}

	// Formulare abschicken
	if( hotKey == 13 )
	{
		if( document.login1 )
		{
			if( el.name == 'log' || el.name == 'pass' )
			{
				document.login1.submit();
			}
		}
		if( document.login2 )
		{
			if( el.name == 'log' || el.name == 'pass' )
			{
				// document.login2.submit();
			}
		}
	}
 }


 // Mausbewegung auf der Seite
 function pageMouseMove(event)
 {
	if( browser.isIE )
	{
		x = window.event.clientX + document.body.scrollLeft;
		y = window.event.clientY + document.body.scrollTop;
	}
	if( browser.isNS )
	{
		x = event.clientX + document.body.scrollLeft;
		y = event.clientY + document.body.scrollTop;
	}

	if( activeToolTip )
	{
		if( activeToolTip != '' )
		{
			document.getElementById(activeToolTip).style.left = ( x + 10 ) + "px";
			document.getElementById(activeToolTip).style.top  = ( y + 20 ) + "px";
		}
	}
 }


 function sicher(ziel)
 {
	var Checkdelete = confirm("Sicher?");
	if( Checkdelete != false )
	{
		self.location.href = ziel;
	}
 }


 function copyUrl(FeldID)
 {
	if( document.all )
	{
		document.getElementById(FeldID).focus();
		document.getElementById(FeldID).select();
		Bereich = document.getElementById(FeldID).createTextRange();
		Bereich.execCommand("Copy");
	} else
	  {
		alert("Sorry, das funktioniert leider nur im Internet-Explorer.\r\nMarkieren Sie bitte den Text mit der Maus und wählen Sie dann nach einem Rechtsklick \"Kopieren\" aus.");
	  }
 }


 // =======================================================================================================================================================


 var menueTopSpeed      = 150;

 var menueTopArrId      = 0;
 var menueTopArrSize    = 0;
 var menueTopArrCounter = 0;
 var menueTopBackSwitch = 0;

 var menueTopArrCurrent;


 function menueTopOut(id)
 {
	if( menueTopArrId == 0 )
	{
		window.clearTimeout();

		menueTopArrId      = id;
		menueTopArrSize    = 0;
		menueTopArrCounter = 0;
		menueTopArrCurrent = new Array();
	} else
		if( menueTopArrId == id )
		{
			return;
		} else
		  {
			menueTopBackSwitch = id;
			menueTopIn(menueTopArrId);
			return;
		  }

	var mainButton = 'menueTop_'+id;

	var menueTopLeft   = document.getElementById(mainButton).offsetLeft;
	var menueTopTop    = document.getElementById(mainButton).offsetTop;
	var menueTopWidth  = document.getElementById(mainButton).offsetWidth;
	var menueTopHeight = document.getElementById(mainButton).offsetHeight;

	var subLeft   = menueTopLeft + 5;
	var subTop    = - ( menueTopHeight + 2 );
	var subWidth  = menueTopWidth - ( 2 * 5 );
	var subHeight = menueTopHeight;

	var subName   = 'menueTopSub_'+id+'_';
	var subDivs   = document.getElementById('menueTopDiv').getElementsByTagName('DIV');

	var subCount  = 0;

	for( i = 0; i < subDivs.length; i++ )
	{
		var subNavi = subDivs[i].id;
		if( subNavi.match(subName) )
		{
			subTop -= ( menueTopHeight + 5 );

			document.getElementById(subNavi).style.left    = subLeft   + 'px';
			document.getElementById(subNavi).style.top     = subTop    + 'px';
			document.getElementById(subNavi).style.width   = subWidth  + 'px';
			document.getElementById(subNavi).style.height  = subHeight + 'px';

			menueTopArrCurrent[subCount] = subNavi;

			subCount++;
		}
	}

	menueTopArrSize = menueTopArrCurrent.length;

	menueTopOutSwitch();
 }


 function menueTopOutSwitch()
 {
	if( menueTopArrCounter < menueTopArrSize )
	{
		window.clearTimeout();

		document.getElementById(menueTopArrCurrent[menueTopArrCounter]).style.display    = 'block';
		document.getElementById(menueTopArrCurrent[menueTopArrCounter]).style.visibility = 'visible';

		menueTopArrCounter++;
		window.setTimeout("menueTopOutSwitch()", menueTopSpeed);
	}
 }


 function menueTopInAll()
 {
	if( menueTopArrId != 0 )
	{
		window.clearTimeout();

		var subDivs    = document.getElementById('menueTopDiv').getElementsByTagName('DIV');

		for( i = 0; i < subDivs.length; i++ )
		{
			var subNavi = subDivs[i].id;

			document.getElementById(subNavi).style.display    = 'none';
			document.getElementById(subNavi).style.visibility = 'hidden';
		}

		menueTopArrId      = 0;
		menueTopArrSize    = 0;
		menueTopArrCounter = 0;
		menueTopArrCurrent = new Array();
	}
 }


 function menueTopIn(id)
 {
	window.clearTimeout();

	menueTopArrId      = 0;
	menueTopArrSize    = 0;
	menueTopArrCounter = 0;
	menueTopArrCurrent = new Array();

	var mainButton = 'menueTop_'+id;

	var subName    = 'menueTopSub_'+id+'_';
	var subDivs    = document.getElementById('menueTopDiv').getElementsByTagName('DIV');

	for( i = 0; i < subDivs.length; i++ )
	{
		var subNavi = subDivs[i].id;
		if( subNavi.match(subName) )
		{
			document.getElementById(subNavi).style.display    = 'none';
			document.getElementById(subNavi).style.visibility = 'hidden';
		}
	}

	menueTopArrId = 0;

	if( menueTopBackSwitch != 0 )
	{
		menueTopOut(menueTopBackSwitch);
		menueTopBackSwitch = 0;
	}
 }


 // =======================================================================================================================================================


 var tempKursID = 0;


 function getKursTrainer(id)
 {
	tempKursID = id;

	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxTrainerliste.php?id='+id, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = getKursTrainer_callback;	
	} else
	  {
		xhttp.onload = getKursTrainer_callback;
	  }

	xhttp.send(null);
 }


 function getKursTrainer_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('trainerListe').innerHTML = neuerInhalt;

	setKursCT(tempKursID);
 }


 function setKursCT(id)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxCountdown.php?id='+id, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = setKursCT_callback;	
	} else
	  {
		xhttp.onload = setKursCT_callback;
	  }

	xhttp.send(null);
 }


 function setKursCT_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	if( neuerInhalt != '' )
	{
		document.getElementById('ctTage').innerHTML = neuerInhalt;
	}
 }


 // =======================================================================================================================================================


 function loadAjax()
 {
	// Ajax
	if( window.ActiveXObject )
	{
		try
		{
			// IE 6.0
			xhttp = new ActiveXObject("Msxml2.XMLHTTP");
			isIEBr = 1;
		} catch(e)
		  {
			// IE 5.x
			try
			{
				xhttp = new ActiveXObject("Microsoft.XMLHTTP");
				isIEBr = 1;
			} catch(e)
			  {
				xhttp = false;
			  }
		  }
	} else
		if( window.XMLHttpRequest )
		{
			// Mozilla, Opera, Safari
			try
			{
				xhttp = new XMLHttpRequest();
			} catch(e)
			  {
				xhttp = false;
			  }
		}
 }


 function setMainContent()
 {
	// Inhalt-Div
	if( document.getElementById('contentCell') )
	{
		var mccWidth  = document.getElementById('contentCell').offsetWidth;
		var mccHeight = document.getElementById('contentCell').offsetHeight;

		var cdWidth   = mccWidth  - 15;
		var cdHeight  = mccHeight - 15;
	}

	if( document.getElementById('contentDiv') )
	{
		document.getElementById('contentDiv').style.position = 'absolute';
		document.getElementById('contentDiv').style.width    = cdWidth  + 'px';
		document.getElementById('contentDiv').style.height   = cdHeight + 'px';
		document.getElementById('contentDiv').style.display  = 'block';
	}
 }


 function initHP()
 {
	setMainContent();

	loadAjax();
 }


