function cookie_decode(cookies) {
	var array = {};
	cookies = cookies.split(";");
	var i;
	for (i = 0; i < cookies.length; i++) {
		var name = cookies[i].split("=")[0];
		var value = cookies[i].split("=")[1];
		array[name] = value;
	}
	return array;
}
var opt;
function opt_ask() {
	opt = document.createElement("div");
	opt.innerHTML = "Diese Seite nutzt Opolytics um Daten für Statistiken zu sammeln. <a href='clients' style='color:white'>Weitere Informationen</a> <input type='button' onclick='refuse_opolytics()' value='Ablehnen'> <input type='button' value='Akzeptieren' onclick='accept_opoltyics()'>";
	opt.style.backgroundColor = "rgba(0,0,0,0.5)";
	opt.style.margin = "0px";
	opt.style.position = "fixed";
	opt.style.left = "0px"
	opt.style.bottom = "0px";
	opt.style.right = "0px";
	opt.style.color = "white";
	opt.style.padding = "10px";
	document.body.appendChild(opt);
}
function close_opt() {
	opt.style.display = "none";
}
function accept_opoltyics() {
	document.cookie = "opt_accepted=true";
	opolytics_enable();
	close_opt();
}
function refuse_opolytics() {
	document.cookie = "opt_accepted=false";
	close_opt();
}
if(cookie_decode(document.cookie)["opt_accepted"]=="true") opolytics_enable();
else opt_ask();