﻿// UnCryptMailto() entschluesselt die Mail-Adresse, zu zuvor mit
// der PHP-Funktion encryptEmail() verschluesselt wurde
// Anwendung:
/*
<?php $link="javascript:linkTo_UnCryptMailto('".encryptEmail("john@doe.de")."');"; ?>
<a href="<?php echo $link ?>">E-Mail an John Doe schreiben</a>
*/
 
// JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) {	//
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}

  // JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s)	{	//
	location.href="mailto:"+UnCryptMailto(s);
}

// Flash
function insert_flash(modul_pfad, modulname, ersatz_pfad, ersatz, modulx, moduly)
{
	if (flashversion > 4)
	{
		document.write('<object style=" display: none; z-index:0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=6,0,0,0" id="movie" width="'+modulx+'" height="'+moduly+'">');
			document.write('<param name=movie value="'+modul_pfad+modulname+'.swf">');
			document.write('<param name="loop" value="true">');
			document.write('<param name="play" value="true">');
			document.write('<param name="menu" value="false">');
			document.write('<param name="quality" value="best">');
			document.write('<param name=wmode value=opaque>');
			document.write('<embed src="'+modul_pfad+modulname+'.swf" play="true" loop="true" wmode="opaque" menu="false" quality="best" bgcolor="#000000"  width="'+modulx+'" height="'+moduly+'" type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.write('</OBJECT>');
	
		var browser=new Object;
		browser=navigator.appName;
		if(browser == "Microsoft Internet Explorer")
		{
			document.all.movie.style.setAttribute('display','inline');
			document.all.movie.style.setAttribute('width','"'+modulx+'"');
			document.all.movie.style.setAttribute('height','"'+moduly+'"');
		}
		else
		{
			document.getElementById("movie").style.display = 'inline';
			document.getElementById("movie").style.width = '"'+modulx+'"';
			document.getElementById("movie").style.height = '"'+moduly+'"';
		}
	
	}
	else
	{
		document.write('<img src="'+ersatz_pfad+ersatz+'" alt="" width="'+modulx+'" height="'+moduly+'" border="0">');	
	}
}

// ersatz wird hier 1:1 ausgegeben!
function insert_flash_simple(modul_pfad, modulname, ersatz, modulx, moduly)
{
	if (flashversion > 4)
	{
		document.write('<object style=" display: none; z-index:0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=6,0,0,0" id="navi" width="'+modulx+'" height="'+moduly+'">');
			document.write('<param name="movie" value="'+modul_pfad+modulname+'.swf">');
			document.write('<param name="loop" value="true">');
			document.write('<param name="play" value="true">');
			document.write('<param name="menu" value="false">');
			document.write('<param name="quality" value="best">');
			document.write('<param name="wmode" value="opaque">');
			document.write('<embed src="'+modul_pfad+modulname+'.swf" play="true" loop="true" wmode="opaque" menu="false" quality="best" bgcolor="#000000"  width="'+modulx+'" height="'+moduly+'" type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.write('</object>');
	
		var browser=new Object;
		browser=navigator.appName;
		if(browser == "Microsoft Internet Explorer")
		{
			document.all.navi.style.setAttribute('display','inline');
			document.all.navi.style.setAttribute('width','"'+modulx+'"');
			document.all.navi.style.setAttribute('height','"'+moduly+'"');
		}
		else
		{
			document.getElementById("navi").style.display = 'inline';
			document.getElementById("navi").style.width = '"'+modulx+'"';
			document.getElementById("navi").style.height = '"'+moduly+'"';
		}
	
	}
	else
	{
		document.write(ersatz);	
	}
}

function image_change(src,target,obj)
{
	bild = new Image();	
	bild.src = src;
	document.images[target].src = bild.src;
}

function featurechangeall(txtshow,txthide)
{
	if(typeof(window.activefeatures) == 'object')
	{
		var inaktiv = "featuredesc-hidden";
		var aktiv = "featuredesc-show";
		var showLink = document.getElementById('changefeaturelink');
		var showtxt = document.getElementById('featurechangetxt');
		
		if(showtxt.innerHTML == txthide)
		{
			var newClass =  inaktiv;
			var newSrc = '../../images/symbole/faqplus.gif';
			
			showtxt.innerHTML = txtshow;
			showLink.innerHTML = "<img src='../../images/symbole/faqplus.gif' alt='' width='9' height='9' class='featureimg' border='0'>";
		}
		else
		{
			var newClass =  aktiv;
			var newSrc = '../../images/symbole/faqminus.gif';
			
			showtxt.innerHTML = txthide;
			showLink.innerHTML = "<img src='../../images/symbole/faqminus.gif' alt='' width='9' height='9' class='featureimg' border='0'>";
		}
		
	
		for(i=0;i<activefeatures.length;i++)
		{
			var actObj = document.getElementById(window.activefeatures[i]);
			var actImg = document.getElementById('img-' + window.activefeatures[i]);
		
			actObj.className = newClass;
			actImg.src = newSrc;
		}
	}
}

function featureclass(fid,txtshow,txthide)
{
	/*
		Info: wechselt CSS-Klassen , Sichtbarkeit Feature-Erkl?rungen
		Autor: Thomas B?chler
		Erstellt: 18.01.2006
	*/
	
	var inaktiv = "featuredesc-hidden";
	var aktiv = "featuredesc-show";
	
	var actObj = document.getElementById(fid);
	var actImg = document.getElementById('img-' + fid);
		
	if(actObj.className == inaktiv)
	{
		actObj.className = aktiv;
		actImg.src = '../../images/symbole/faqminus.gif';
	}
	else
	{
		actObj.className = inaktiv;
		actImg.src = '../../images/symbole/faqplus.gif';
	}
	
	//------ Test ob alle sichtbar/unsichtbar A
	
	var inaktcount =0;
	var aktcount =0;
	
	
	if(typeof(window.activefeatures) == 'object')
	{
		for(i=0;i<activefeatures.length;i++)
		{
			var actObj = document.getElementById(window.activefeatures[i]);
			
			if(actObj.className == inaktiv) { inaktcount++;} else {aktcount++;}
		}
		
		var showLink = document.getElementById('changefeaturelink');
		var showtxt = document.getElementById('featurechangetxt');
		
		if(aktcount == window.activefeatures.length)
		{
			showtxt.innerHTML = txthide;
			showLink.innerHTML = "<img src='../../images/symbole/faqminus.gif' alt='' width='9' height='9' class='featureimg' border='0'>";
		}
		else if (inaktcount == window.activefeatures.length)
		{
			showtxt.innerHTML = txtshow;
			showLink.innerHTML = "<img src='../../images/symbole/faqplus.gif' alt='' width='9' height='9' class='featureimg' border='0'>";
		}
	}

	//------ Test ob alle sichtbar/unsichtbar E
}

	function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function showglossary(val)
{
/*
	Info: Zeigt Layer mit Glossarinformationen
	Autor: Thomas B?chler
	Erstellt: 11.01.2006
*/
	if(window.divisactive != "yes")
	{
			setmouse();
		
			actGloss = document.getElementById("glossary-active");
			
			for(var i=0;i<glossary.length;i++)
			{
				if(glossary[i]['keyword'] == val)
				{
					actGloss.innerHTML = glossary[i]['explanation'];
				}
			}		
			
			actGloss.style.left = (mousX+10)+"px";
			actGloss.style.top = ((mousY-10)-actGloss.offsetHeight)+"px";
			
			if (getLeft(actGloss)+actGloss.offsetWidth >= document.body.offsetWidth)
			{
				actGloss.style.left = ((mousX-10)-actGloss.offsetWidth)+"px";
			}
			
			// Check der Fenstergr??e
			
			window.divisactive = "yes";
			actGloss.style.visibility = "visible";
			actGloss = document.getElementById("glossary-active");

	}
}



function hideglossary(val)
{
/*
	Info: Versteckt Layer mit Glossarinformationen
	Autor: Thomas B?chler
	Erstellt: 11.01.2006
*/
	if(window.divisactive == "yes")
	{
		actGloss = document.getElementById("glossary-active");
		actGloss.style.visibility = "hidden";
		window.divisactive = "none";
	}
}


function setmouse()
{
/*
	Info: Setzt Listener auf Mauszeiger
	Autor: Thomas B?chler
	Erstellt: 11.01.2006
*/
	
	var browsertyp=navigator.userAgent.toLowerCase();
		
	if(((browsertyp.indexOf("netscape") != -1 || browsertyp.appName == "Netscape" || browsertyp.indexOf("mozilla") != -1) && browsertyp.indexOf("opera") == -1 && browsertyp.indexOf("msie") == -1) && browsertyp.indexOf("safari") == -1)
	{				
		function handleMove(pos)
		{
			window.mousX=pos.clientX+pageOffset().left;
			window.mousY=pos.clientY+pageOffset().top;
		}
		document.addEventListener("mousemove", handleMove, true);
		document.addEventListener("mouseover", handleMove, true);
		document.addEventListener("mouseout", handleMove, true);
	}
	else  if(browsertyp.indexOf("msie") != -1 || browsertyp.indexOf("opera") != -1)
	{
			e = window.event;
			window.mousX = e.x+pageOffset().left;
			window.mousY = e.y+pageOffset().top;
	}
	else  if((browsertyp.indexOf("safari") != -1 ))
	{
			e = window.event;
			window.mousX = e.x;
			window.mousY = e.y;
	}
}

//------------------- PopUp Funktionen

function popup_loeschen(objekt)
{		
	//------ Autor: Andreas J?hrling
	//------ Erstellt: 05.06.04  
	//------ Kommentar: L?scht alle Inhalt aus einem Popup   
	var NeuerEintrag = new Option("", "");
	objekt.options[0] = NeuerEintrag;
	objekt.value = "";
	
	objekt.length=0;
	objekt.selectedIndex=0;
}





function popup_fuellen(objekt, texte, werte) 
{
	//------ Autor: Andreas J?hrling
	//------ Erstellt: 05.06.04  
	//------ Kommentar: Schreibt die Werte aus den Arrays "texte", "werte" in ein Popup und selektiert den ersten Eintrag 

	objekt.length=0;
					
	for(var i=0; i<werte.length; i++)
	{
		var NeuerEintrag = new Option(texte[i], werte[i]);
		objekt.options[objekt.length] = NeuerEintrag;
		objekt.value = "";
	}
	objekt.selectedIndex=0;	
} 


function colortxt(zelle)
{
	// Autor : Thomas B?chler
	// Erstellt : 29.06.2004
	// Kommentar : Im Body-Tag als onload eingesetzt, kann man hiermit bestimmte schl?sselworte einfaerben oder anderweitig filtern sowie Ausnahmen definieren
	// Ben?tigt: str_replace
	
	textzelle = document.getElementById(zelle);
	haystack = textzelle.innerHTML;
	
	//alert(haystack);
	
	var Filtern = new Array;
	
	Filtern[0] = "BLAU,<span class='blau'>BLAU</span>";
	
	
	//-- HL-DIVs filtern
	
	var Umgehen = new Array;
	var Ersatz = new Array;
	
	Umgehen[0] = "<DIV class=\"hl\">,</DIV>";				// ELEMENTE, DIE NICHT GEFILTERT WERDEN DUERFEN!
	
	var f=0;
	for(var i=0;i<Umgehen.length;i++)
	{
		var begriffe = Umgehen[i].split(",");
		umgehen1 = begriffe[0];
		umgehen2 = begriffe[1];
		
		var Pos = haystack.indexOf(umgehen1);
		
		
		
		while (Pos >= 0)
    	{
    		var Pos2 = haystack.indexOf(umgehen2, Pos);
    		
    		len_umgehung = haystack.substring(Pos,Pos2);
			
			haystack = str_replace(len_umgehung+umgehen2, "*"+f+"*", haystack);
			
			
			Ersatz[f] = len_umgehung+umgehen2;
			
			Pos = haystack.indexOf(umgehen1,Pos);
		
    		f++;
    	}
		
	}
	//-- HL-DIVs filtern
	
	for(var i=0;i<Filtern.length;i++)
	{
		var begriffe = Filtern[i].split(",");
		var strsearch = begriffe[0];
		var strreplace = begriffe[1];
		
		haystack = str_replace(strsearch, strreplace, haystack);
	
	}
	
	
	for(var i=0;i<Ersatz.length;i++)
	{
		if (haystack.indexOf("*"+i+"*") != -1)
		{		
			haystack = str_replace("*"+i+"*", Ersatz[i], haystack);
		}
	}
	textzelle.innerHTML = haystack;
}


function str_replace(strsearch, strreplace, haystack)
{
	// Autor : Thomas B?chler
	// Erstellt : 13.04.2004
	// Kommentar : Ersetzt alle strsearch innerhalb haystack durch strreplace

	if ((haystack == null) || (strsearch == null))
	{
		return null;
	}
   	
   	if ((haystack.length == 0) || (strsearch.length == 0))
   	{
   		return haystack;
   	}

    if ((strreplace == null) || (strreplace.length == 0))
    { 
    	strreplace = "";
    }

    var len_strsearch = strsearch.length;
    var len_strreplace = strreplace.length;
    var Pos = haystack.indexOf(strsearch, 0);

    while (Pos >= 0)
    {
    	haystack = haystack.substring(0, Pos) + strreplace + haystack.substring(Pos + len_strsearch);
    	Pos = haystack.indexOf(strsearch, Pos + len_strreplace);
    }
    
  	//  alert(haystack);
    
    return haystack;
}


function getLeft(targetObject)
{
/*
	Info: Gibt die absolute x_Position eines Objektes im Dokument zur?ck (DOM 2)
	Autor: Thomas B?chler
	Erstellt: 05.02.2004
	Letzte ?nderung: 05.02.2004
	
*/
	if (targetObject.offsetParent) return (targetObject.offsetLeft + getLeft(targetObject.offsetParent));
	else return (targetObject.offsetLeft);
}


function getTop(targetObject)
{
/*
	Info: Gibt die absolute y_Position eines Objektes im Dokument zur?ck (DOM 2)
	Autor: Thomas B?chler
	Erstellt: 05.02.2004
	Letzte ?nderung: 05.02.2004
	
*/

	if (targetObject.offsetParent) return (targetObject.offsetTop + getTop(targetObject.offsetParent));
	else return (targetObject.offsetTop);
}


function pageOffset(win)
{
	/*
	Info: Hilft bei IE scrolloffset-Problem (wenn fenster gescrollt, mausposition falsch)
	Autor: Thomas B?chler
	Erstellt: 03.12.2004
*/

    if(!win) win = window;
    var pos = {left:0,top:0};
    pos.left = typeof win.pageXOffset != 'undefined' ?
               win.pageXOffset : // MZ
               (document.compatMode && document.compatMode == "CSS1Compat") ?
               document.documentElement.scrollLeft : // IE Strict Modus
               win.document.body.scrollLeft;

    pos.top = typeof win.pageYOffset != 'undefined' ?
              win.pageYOffset : // MZ
              (document.compatMode && document.compatMode == "CSS1Compat") ?
              document.documentElement.scrollTop : // IE Strict Modus
              win.document.body.scrollTop;
    return pos;
}

function testMousepos(targetDiv)
{
/*
	Info: Pr?ft die Position des Mauszeigers relativ zum gew?nschten Objekt >> true/false (DOM 2)
	Autor: Thomas B?chler
	Erstellt: 05.02.2004
	Letzte ?nderung: 3.12.2004
	
*/
	if (document.getElementById(targetDiv))
	{
		var targetDiv = document.getElementById(targetDiv);
	}
	
	var targetDivX = getLeft(targetDiv);
	var targetDivY = getTop(targetDiv);

	var targetDivW = targetDivX + targetDiv.offsetWidth;
	var targetDivH = targetDivY + targetDiv.offsetHeight;
	
	var browsertyp=navigator.userAgent.toLowerCase();
	
	//alert(browsertyp);

	if(((browsertyp.indexOf("netscape") != -1 || browsertyp.appName == "Netscape" || browsertyp.indexOf("mozilla") != -1) && browsertyp.indexOf("opera") == -1 && browsertyp.indexOf("msie") == -1) && browsertyp.indexOf("safari") == -1)
	{				
		function handleMove(pos)
		{
			window.mousX=pos.clientX+pageOffset().left;
			window.mousY=pos.clientY+pageOffset().top;
		}
		document.addEventListener("mousemove", handleMove, true);
		document.addEventListener("mouseover", handleMove, true);
		document.addEventListener("mouseout", handleMove, true);
	}
	else  if(browsertyp.indexOf("msie") != -1 || browsertyp.indexOf("opera") != -1)
	{
			e = window.event;
			window.mousX = e.x+pageOffset().left;
			window.mousY = e.y+pageOffset().top;
	}
	else  if((browsertyp.indexOf("safari") != -1 ))
	{
			e = window.event;
			window.mousX = e.x;
			window.mousY = e.y;
	}
	
	//alert(window.mousX +"<=" +targetDivW+ " // " +window.mousY +"<=" +targetDivH+ " // " +window.mousX +"<=" +targetDivX+ " // " +window.mousY +"<=" +targetDivY);

	
	if(!((window.mousX <= targetDivW) && (window.mousY <= targetDivH) && (window.mousX >= targetDivX) && (window.mousY >= targetDivY)) &&  window.mousX != -1 && window.mousY != -1)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function bild_geladen(objekt,cssclass) 
{
/*
	ACHTUNG !!!!!!! OnClick-Events d?rfen nur auf dem Objekt liegen, das die funktion ausl?st!!!

	Info: Neue Version, CSS-Klasse f?r Lupenposition erforderlich, JEDES Bild muss von einem <div> umschlossen sein und CSS Klasse angegeben werden
	Beispiel fuer CSS: .lupe    { margin-top: 20px; margin-left: 265px; position: absolute }
	Autor: Thomas B?chler
	Erstellt: 05.02.2004
	Letzte ?nderung: 17.08.2005
	
*/
		var acthtml = objekt.parentNode.innerHTML;
		var bigpic = objekt.src.substr(objekt.src.lastIndexOf("/"),objekt.src.length);
		var lupe = "<div class='"+cssclass+"'><a href='#none' onclick='zoom(\"images/big"+bigpic+"\", \"\");'><img border='0' src='"+homepfad_+"images/symbole/lupe.gif'></a></div>";
		acthtml = "<a href='#none' onclick='zoom(\"images/big"+bigpic+"\", \"\");'>"+acthtml+"</a>";
		objekt.parentNode.innerHTML = lupe+str_replace("bild_geladen", "leer", acthtml);
}




//---****************** Zoomfunktionen **********************************


var akt_fensternummer=1; // wird um eins erh?ht wenn ein neues Fenster mit zoom_datei ge?fnet wird 


function zoom_seite(pfad, x, y) //--------------- ?ffnet eine bereits vorhandene HTML-Datei in definierter gr??e
{
	hl=akt_fensternummer; // -- somit wird immer ein neues Fenster ge?ffnet
	akt_fensternummer++;
	x=max_x(x);
	y=max_y(y);

	fenster = open(pfad,hl,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+x+",height="+y+",screenX=50,screenY=50,top=50,left=50");
}	


function zoom_page_noscroll(pfad, x, y) //--------------- ?ffnet eine bereits vorhandene HTML-Datei in definierter gr??e
{
	hl=akt_fensternummer; // -- somit wird immer ein neues Fenster ge?ffnet
	akt_fensternummer++;
	x=max_x(x);
	y=max_y(y);

	fenster = open(pfad,hl,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+x+",height="+y+",screenX=50,screenY=50,top=50,left=50");
}	


function zoom(pfad, text)
{
/*
	Info: ?ffnet ein Bild in einem neuen Fensterund passt dessen Gr??e der des Bildes an 
	Autor: Anderas J?hrling
	Erstellt: verdammt lang her
	Letzte ?nderung: 13.12.2004/ Kompatibilitaet mit mehr Browsern hergestellt
*/

	neues_fenster = window.open('', "Window", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=50,height=50,screenX=50,screenY=50,top=50,left=50");
	neues_fenster.document.open();
	
	with(neues_fenster.document)
	{	
		writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
		writeln('<html>');
		writeln('<head>');
			writeln('<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">');
	
			writeln('<style type="text/css" type="text/css" media="screen"><!--');
			writeln('.zoombild { border: solid 1px gray; background-color: white; padding: 7px }');
			writeln('--></style>');
			writeln('<title>Zoom</title>');
		
			writeln('<script language="javascript"><!--');
			writeln('function resize() {');
			writeln('var abstand_x = 50;');
			writeln('var abstand_y = 50;');
			
  			writeln('if (document.images[0]) window.resizeTo(document.images[0].width +abstand_x, document.images[0].height+abstand_y);');
 			writeln(' self.focus();');
			writeln('}');
			writeln('//--></script>');

		writeln('</head>');

		writeln('<body onload="resize();" bgcolor=#E6E6E6  leftmargin="0" marginheight="0" marginwidth="0" topmargin="5">');
		writeln('<div align="center"><a href="#" onclick="window.close();"><img class="zoombild" id="bild"  src="'+pfad+'" border="0" alt="" title=""></a></div>');		

		writeln('</body>');
		writeln('</html>');
	}
		
	neues_fenster.document.close();
	
}





function show_picture(objekt)
{	
/*
	Info: Holt sich den Dateinamen und den Pfad des gew?hlten Bildes. Ruft danach mit modifizierten Pfad (zoomverzeichnis) die Funktion "zoom()" auf.  
	Autor: Anderas J?hrling
	Erstellt: lang her
	Letzte ?nderung: 13.09.2005/ Datei muss nun nicht mehr im selben Verzeichnis wie das aufrufende Dokument liegen
*/
	

	var zoomverzeichnis="big/";
	var datei=dateiname(objekt);

	if (navigator.appName == "Netscape")
	{
		var pfad=objekt.target.src;
	}
	else
	{
		var pfad=objekt.srcElement.src;
	}
	
	var l=pfad.length;
	var pos=pfad.lastIndexOf("/");
	
	var pfad = pfad.substring(0, pos+1);
		
		
		
 	zoom(pfad+zoomverzeichnis+datei, "");
}



function dateiname(objekt) // Zur Zeit nur mit IE ab Version 5 und NS ab Version 6 funktionsf?hig
{
	
	if (navigator.appName == "Netscape")
	{
		var pfad=objekt.target.src;
	}
	else
	{
		var pfad=objekt.srcElement.src;
	}
	
	
	var l=pfad.length;
	var pos=pfad.lastIndexOf("/");	

	return pfad.substring(pos+1, l);
}


//---******************************************************************************
function max_x(x)
{

	if(ScriptOK)
	{		
		if(x>(screen.width-40))
		{
			x=screen.width-40;
		}
	}	
	return x;
}



function max_y(y)
{
	if(ScriptOK)
	{
		if(y>(screen.height-40))
		{
			y=screen.height-40;
		}
	}	
	return y;	
}

//---*************** Cookies **************************************************************


function setCookie(name, wert, domain, expires, path, secure){
	if(path==""){path="/";}
	
   //var cook = name + "=" + unescape(wert);
   var cook = name + "=" + escape(wert);
   cook += (domain) ? "; domain="+ domain : "";
   cook += (expires) ? "; expires="+expires : "";
   cook += (path) ? "; path="+path : "";
   cook += (secure) ? "; secure" : "";
   document.cookie = cook;

}



function eraseCookie(name, domain, path){
	if(path==""){path="/";}
   var cook="name=; expires=Thu, 01-Jan-70 00:00:01 GMT"
   cook += (domain) ? "domain="+domain : ""
   cook += (path) ? "path="+path : ""
   document.cookie = cook
}


function getCookie(name){
   var i=0  //Suchposition im Cookie
   var suche = name+"="
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length)
         ende = (ende>-1) ? ende : document.cookie.length
         var cook = document.cookie.substring(i+suche.length, ende)
         return unescape(cook)
      }
      i++
   }
   return ""
}


function checkCookie(){
   setCookie("CookieTest", "OK")
   if (!getCookie("CookieTest"))
      return false
   else{
      eraseCookie("CookieTest")
      return true
   }
}



