
	// Variablen
	// - Cookie	
	var name = "location";
	var value = "";
	var domain = null;
	var expires = new Date();
	var expires = new Date(expires.getYear()+1910, expires.getMonth(), expires.getDate()).toGMTString();
	var path = "/";
	var secure = "";
	
	// functions
	function f_tag(tag) {
		return "<" + tag + ">" 
	}
	function f_setCookie() {
				
		var cook = name + "=" + escape(value);
   		cook += (domain) ? "; domain=" + escape(domain) : "";
   		cook += (expires) ? "; expires=" + expires : "";
   		cook += (path) ? "; path=" + path : "";
   		cook += (secure) ? "; secure" : "";
   		   		
   		if (f_checkCookie()) {
   			document.cookie = cook;
   			return true;
   		} else {
   			return false;
   		}
	}
	function f_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 f_checkCookie() {
		
		// Test Cookie setzen, Sessioncookie		
		var cook = "CookieTest" + "=" + escape("OK");
   		cook += "; domain=" +  "";
   		// cook += "; expires=" + new Date(2050, 12, 31).toGMTString();  
   		cook += "; path=" + escape("/");
   		cook += (secure) ? "; secure" : "";
   		
   		document.cookie = cook;

   		
   		// Test Cookie einlesen, wenn möglich und löschen (abgelaufen)
 	  	if (!f_getCookie("CookieTest")) {
 	  		window.alert("Cookies sollten aktiviert sein");
  	    	return false;
   		} else {
    		var cookd = "CookieTest=nok";
   			cookd += "; domain=" +  "";
   			cookd += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   			cookd += "; path=" + escape("/");
   			cookd += (secure) ? "; secure" : "";
   			
   			document.cookie = cookd;
   			
   			return true;
   		}
	}
	function f_saveLocation() {
		
		value = top.location.href;
		if (f_setCookie(name, value, domain, expires, path, secure)) {
			window.alert("Eigene Startseite definiert.");
		}
		return false;
	}
	function f_deleteLocation() {
		f_setCookie(name, value, domain, new Date(1970, 01, 01).toGMTString(), path, secure);
		return false;
	}
	// Abarbeitung Ablauf

	//document.write(' - ' + f_tag('a href="#" onclick="f_saveLocation();"') + "Diese Seite...." + f_tag('/a')+f_tag('br /'));
	//document.write(" - " + f_tag('a href="#" onclick="f_deleteLocation();"') + "L&ouml;schen...." + f_tag('/a')+f_tag('br /'));
	