function 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 td(n)
{
	return (n < 10) ? '0' + n : n;
}

function getDate()
{
	n = new Date();
	return ' (' + td(n.getDate()) + '.' + td(n.getMonth()+1) + '.' + n.getFullYear() +
		' ' + td(n.getHours()) + ':' + td(n.getMinutes()) + ':' + td(n.getSeconds()) + ')';
}

if (document.cookie == "")
{
	if (window.location.search.substr(0, 3) == '?r=')
		st = window.location.search.substr(3) + encodeHex(' ' + document.referrer + getDate());
	else
		st = encodeHex(document.referrer + getDate());

	document.cookie = 'ref=' + st + '; domain=microton.cz; path=/; expires=Saturday, 31-Dec-11 23:59:59 GMT';
}
