
 // PreLoader
 function showPreLoader(mode)
 {
	var pleft = (screen.availWidth  - 302) / 2;
	var ptop  = (screen.availHeight - 102) / 2;

	document.getElementById('preLoader').style.width  = 302;
	document.getElementById('preLoader').style.height = 102;

	document.getElementById('preLoader').style.left   = pleft;
	document.getElementById('preLoader').style.top    = ptop - 125;

	document.getElementById('preLoader').style.visibility = ( mode == 1 ) ? "visible" : "hidden";
 }


 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.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 xhttp;
 var isIEBr = 0;


 function submitPerAjax()
 {
	if( !xhttp )
	{
		return;
	}

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = submitPerAjax_callback;	
	} else
	  {
		xhttp.onload = submitPerAjax_callback;
	  }

	empf_id   = encodeURIComponent(document.editor.id.value);
	empf_mail = encodeURIComponent(document.editor.mailTo.value);
	empf_text = encodeURIComponent(document.editor.message.value);

	xhttp.open('GET', 'empf_ajax.php?empf_id='+empf_id+'&empf_mail='+empf_mail+'&empf_text='+empf_text, true);
	xhttp.send(null);
 }


 function submitPerAjax_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('recBlock').innerHTML = neuerInhalt;
 }


 // ======================================================================================================================================







 function submitPerAjax2()
 {
	if( !xhttp )
	{
		return;
	}

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = submitPerAjax2_callback;	
	} else
	  {
		xhttp.onload = submitPerAjax2_callback;
	  }

	empf_id   = encodeURIComponent(document.editor.id.value);
	empf_mail = encodeURIComponent(document.editor.mailTo.value);
	empf_text = encodeURIComponent(document.editor.message.value);

	xhttp.open('GET', 'empf_ajax2.php?empf_id='+empf_id+'&empf_mail='+empf_mail+'&empf_text='+empf_text, true);
	xhttp.send(null);
 }


 function submitPerAjax2_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('recBlock').innerHTML = neuerInhalt;
 }




 // ======================================================================================================================================




 var xhttp2;

 function gutscheinAjax()
 {
	loadAjax2();

	if( !xhttp2 )
	{
		return;
	}

	if( isIEBr == 1 )
	{
		xhttp2.onreadystatechange = gutscheinAjax_callback;
	} else
	  {
		xhttp2.onload = gutscheinAjax_callback;
	  }

	var a_gs_nummer   = encodeURIComponent(document.editor.gutschein.value);
	var a_gs_preis    = encodeURIComponent(document.editor.hiddenPreis.value);
	var a_gs_laufzeit = encodeURIComponent(document.editor.laufzeit2.options[document.editor.laufzeit2.selectedIndex].value);

	var time          = new Date().getTime();

	xhttp2.open('GET', 'gs_ajax.php?gs_nummer='+a_gs_nummer+'&gs_preis='+a_gs_preis+'&time='+time+'&gs_laufzeit='+a_gs_laufzeit, true);
	xhttp2.send(null);
 }


 function gutscheinAjax_callback()
 {
	if( xhttp2.readyState != 4 || xhttp2.status != 200 )
	{
		return;
	}

	if( xhttp2.responseText )
	{
		var gs_nPreis = xhttp2.responseText;
	} else
	  {
		var gs_nPreis = xhttp2.responseText;
	  }

	document.getElementById('gsCheck').innerHTML = gs_nPreis;

	var Ergebnis = gs_nPreis.search(/xxOKxx.+/);
	if( Ergebnis != -1 )
	{
		document.getElementById('gutschein').style.color = '#000000';
	} else
	  {
		document.getElementById('gutschein').style.color = '#FF0000';
	  }
 }



 // ======================================================================================================================================




 var xhttp4;

 function gutscheinAjax4()
 {
	loadAjax4();

	if( !xhttp4 )
	{
		return;
	}

	if( isIEBr == 1 )
	{
		xhttp4.onreadystatechange = gutscheinAjax_callback4;
	} else
	  {
		xhttp4.onload = gutscheinAjax_callback4;
	  }

	var a_gs_nummer   = encodeURIComponent(document.editor.gutschein.value);
	var a_gs_preis    = encodeURIComponent(document.editor.hiddenPreis.value);
	var a_gs_laufzeit = encodeURIComponent(document.editor.laufzeit.options[document.editor.laufzeit.selectedIndex].value);

	var time          = new Date().getTime();

	xhttp4.open('GET', 'gs_ajax4.php?gs_nummer='+a_gs_nummer+'&gs_preis='+a_gs_preis+'&time='+time+'&gs_laufzeit='+a_gs_laufzeit, true);
	xhttp4.send(null);
 }


 function gutscheinAjax_callback4()
 {
	if( xhttp4.readyState != 4 || xhttp4.status != 200 )
	{
		return;
	}

	if( xhttp4.responseText )
	{
		var gs_nPreis = xhttp4.responseText;
	} else
	  {
		var gs_nPreis = xhttp4.responseText;
	  }

	document.getElementById('gsCheck').innerHTML = gs_nPreis;

	var Ergebnis = gs_nPreis.search(/xxOKxx.+/);
	if( Ergebnis != -1 )
	{
		document.getElementById('gutschein').style.color = '#000000';
	} else
	  {
		document.getElementById('gutschein').style.color = '#FF0000';
	  }
 }








 // ======================================================================================================================================


 var xhttp3;

 function gutscheinAjax3()
 {
	loadAjax3();

	if( !xhttp3 )
	{
		return;
	}

	if( isIEBr == 1 )
	{
		xhttp3.onreadystatechange = gutscheinAjax3_callback;
	} else
	  {
		xhttp3.onload = gutscheinAjax3_callback;
	  }

	var a_gs_nummer   = encodeURIComponent(document.editor.gutschein.value);
	var a_gs_preis    = encodeURIComponent(document.editor.hiddenPreis.value);
	var a_gs_einzel   = encodeURIComponent(document.editor.einzel.value);

	if( document.editor.einzel.value == 0 )
	{
		var a_gs_laufzeit = encodeURIComponent(document.editor.laufzeit.options[document.editor.laufzeit.selectedIndex].value);
	} else
	  {
		var a_gs_laufzeit = 0;
	  }

	var time          = new Date().getTime();

	xhttp3.open('GET', 'gs_ajax3.php?gs_nummer='+a_gs_nummer+'&gs_preis='+a_gs_preis+'&time='+time+'&gs_laufzeit='+a_gs_laufzeit+'&gs_einzel='+a_gs_einzel, true);
	xhttp3.send(null);
 }


 function gutscheinAjax3_callback()
 {
	if( xhttp3.readyState != 4 || xhttp3.status != 200 )
	{
		return;
	}

	if( xhttp3.responseText )
	{
		var gs_nPreis = xhttp3.responseText;
	} else
	  {
		var gs_nPreis = xhttp3.responseText;
	  }

	document.getElementById('gsCheck').innerHTML = gs_nPreis;

	var Ergebnis = gs_nPreis.search(/xxOKxx.+/);
	if( Ergebnis != -1 )
	{
		document.getElementById('gutschein').style.color = '#000000';
	} else
	  {
		document.getElementById('gutschein').style.color = '#FF0000';
	  }
 }


 // ======================================================================================================================================


 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.onmousedown = pageMousedown;
	document.onkeyup     = seitenklick;
	document.onmousemove = pageMouseMove;
 }
 if(browser.isNS)
 {
	document.addEventListener("mousedown", pageMousedown, true);
	document.addEventListener("keyup", seitenklick, true);
	document.addEventListener("mousemove", pageMouseMove, true);
 }


 function seitenklick(event)
 {
	if( !event )
	{
		event = window.event;
	}

	if( browser.isIE )
	{
		hotKey = window.event.keyCode;
		isAlt  = window.event.altKey;
	}
	if( browser.isNS )
	{
		hotKey = event.which;
		isAlt  = event.altKey;
	}

	// Loginformular abschicken
	if( hotKey == 13 )
	{
		if( document.edit )
		{
			if( document.edit.log.value != '' && document.edit.pass.value != '' )
			{
				document.edit.submit();
			}
		}
		if( document.edit1 )
		{
			if( document.edit1.log.value != '' && document.edit1.pass.value != '' )
			{
				document.edit1.submit();
			}
		}
		if( document.edit2 )
		{
			if( document.edit2.log.value != '' && document.edit2.pass.value != '' )
			{
				document.edit2.submit();
			}
		}
	}
 }


 function pageMousedown(event)
 {
	var el;

	// angeklicktes Element finden
	if( browser.isIE )
	{
		el = window.event.srcElement;
	}
	if( browser.isNS )
	{
		el = (event.target.className ? event.target : event.target.parentNode);
	}
 }


 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";
*/

			document.getElementById(activeToolTip).style.left = ( x + 10 ) + "px";
			document.getElementById(activeToolTip).style.top  = ( y - 20 ) + "px";

		}
	}
 }


 // GS-Ajax
 function loadAjax2()
 {
	// Ajax2
	if( window.ActiveXObject )
	{
		try
		{
			// IE 6.0
			xhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e)
		  {
			// IE 5.x
			try
			{
				xhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e)
			  {
				xhttp2 = false;
			  }
		  }
	} else
		if( window.XMLHttpRequest )
		{
			// Mozilla, Opera, Safari
			try
			{
				xhttp2 = new XMLHttpRequest();
			} catch(e)
			  {
				xhttp2 = false;
			  }
		}
 }


 // GS-Ajax 3
 function loadAjax3()
 {
	// Ajax3
	if( window.ActiveXObject )
	{
		try
		{
			// IE 6.0
			xhttp3 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e)
		  {
			// IE 5.x
			try
			{
				xhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e)
			  {
				xhttp3 = false;
			  }
		  }
	} else
		if( window.XMLHttpRequest )
		{
			// Mozilla, Opera, Safari
			try
			{
				xhttp3 = new XMLHttpRequest();
			} catch(e)
			  {
				xhttp3 = false;
			  }
		}
 }


 // GS-Ajax 4
 function loadAjax4()
 {
	// Ajax4
	if( window.ActiveXObject )
	{
		try
		{
			// IE 6.0
			xhttp4 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e)
		  {
			// IE 5.x
			try
			{
				xhttp4 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e)
			  {
				xhttp4 = false;
			  }
		  }
	} else
		if( window.XMLHttpRequest )
		{
			// Mozilla, Opera, Safari
			try
			{
				xhttp4 = new XMLHttpRequest();
			} catch(e)
			  {
				xhttp4 = false;
			  }
		}
 }


 function resizeMain()
 {
	// Einblendung Bannerrotation bei Bildschirmauflösung ab 1024 Px
	if( document.getElementById('bRot1') || document.getElementById('bRot2') )
	{
		// if( screen.width > 1150 )
		// Nur im Hauptfenster
		// if( window.name == "" )
		if( 1 == 1 )
		{
			if( document.body.clientWidth > 1150 )
			{
				document.getElementById('bRot1').style.display = 'block';
				document.getElementById('bRot2').style.display = 'block';
			} else
			  {
				document.getElementById('bRot1').style.display = 'none';
				document.getElementById('bRot2').style.display = 'none';
			  }
		}
	}

	// Umschalten auf großen Header
	if( document.body.clientHeight > 740 )
	{
		document.getElementById('headBig').style.display      = 'block';
		document.getElementById('headBig').style.visibility   = 'visible';

		document.getElementById('headSmall').style.display    = 'none';
		document.getElementById('headSmall').style.visibility = 'hidden';
	} else
	  {
		document.getElementById('headSmall').style.display    = 'block';
		document.getElementById('headSmall').style.visibility = 'visible';

		document.getElementById('headBig').style.display      = 'none';
		document.getElementById('headBig').style.visibility   = 'hidden';
	  }
 }


 function initHP()
 {
	// 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;
			  }
		}


	loadAjax2();
	loadAjax3();
	loadAjax4();

	// Einblendung Bannerrotation bei Bildschirmauflösung ab 1024 Px
	if( document.getElementById('bRot1') || document.getElementById('bRot2') )
	{
		// if( screen.width > 1150 )
		// Nur im Hauptfenster
		// if( window.name == "" )
		if( 1 == 1 )
		{
			if( document.body.clientWidth > 1150 )
			{
				document.getElementById('bRot1').style.display = 'block';
				document.getElementById('bRot2').style.display = 'block';
			}
		}
	}
 }


