function cz_britanik_encodeHex(inp)
{
	ret = "";
	for (i = 0; i < inp.length; i++)
	{
		n = inp.charCodeAt(i);
		n1 = n >>> 4;
		n2 = n & 15;
		ret += String.fromCharCode(n1<10 ? n1+48 : n1+87, n2<10 ? n2+48 : n2+87);
	}
	return ret;
}

function cz_britanik_td(n)
{
	return (n < 10) ? '0' + n : n;
}

function cz_britanik_getDate()
{
	n = new Date();
	return ' (' + cz_britanik_td(n.getDate()) + '.' + cz_britanik_td(n.getMonth()+1) + '.' + n.getFullYear() +
		' ' + cz_britanik_td(n.getHours()) + ':' + cz_britanik_td(n.getMinutes()) + ')';
}

if (document.cookie == null || document.cookie.search("ref=") < 0)
{
	if (window.location.search.substr(0, 3) == '?r=')
		st = window.location.search.substr(3) + cz_britanik_encodeHex(' ' + document.referrer + cz_britanik_getDate());
	else
		st = cz_britanik_encodeHex(document.referrer + cz_britanik_getDate());

	document.cookie = 'ref=' + st + '; domain=britanik.cz; path=/; expires=Monday, 31-Dec-12 23:59:59 GMT';
}
