/* Globale Funktionen für andere JavaScripts
 * Erstellt: 21.9.2006
 * Zuletzt Geändert: 21.9.2006
 * Author:	 Gerd Katzenbeisser
 */

// Original JavaScript code by Duncan Crombie: dcrombie at chirp.com.au
// Please acknowledge use of this code by including this header.

var bikky = document.cookie; // retrieve cookie string
var today = new Date();

function getCookie(name) { // use: getCookie("name");
	var index = bikky.indexOf(name + "=");
	if (index == -1) return null;
	index = bikky.indexOf("=", index) + 1;
	var endstr = bikky.indexOf(";", index);
	if (endstr == -1) endstr = bikky.length;
	return unescape(bikky.substring(index, endstr));
}

function setCookie(name, value, path, expiry) { // use: setCookie("name", value);
	var expiry = ( expiry == null) ? new Date(today.getTime() + 356 * 24 * 60 * 60 * 1000) : expiry;
	var path = ( path == null) ? "/" : path;
	if (value != null && value != "")
		document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString() + "; path=" + path;
	bikky = document.cookie; // update bikky
}

function isCookiesEnabled() {
	var enabled;
	var exp = new Date();
	exp.setTime(exp.getTime() + (60*1000));
	// valid: one minute (60seconds*1000 hundreds)
	SetCookie ('CookieEnabledCheck', 1, exp);
	enabled = GetCookie('CookieEnabledCheck');
	if (enabled == null)
		return false;
	return true;
}