// pro zpracovani cookie


// Public code by
// Bill Dortch, hIdaho Design (bdortch@netw.com)

function SetCookie(name, value)
	{
		var argv = SetCookie.arguments;
		var argc = SetCookie.arguments.length;
		var expires = (argc>2) ? argv[2] : null;
		var path = (argc>3) ? argv[3] : null;
		var domain = (argc>4) ? argv[4] : null;
		var secure = (argc>5) ? argv[5] : false;
		document.cookie = name + "=" + escape (value) + ((expires==null) ? "" : ("; expires="+expires.toGMTString())) + ((path==null) ? "" : ("; path="+path)) + ((domain == null) ? "" : ("; domain="+domain)) + ((secure==true) ? "; secure" : "");
	}

function getCookieVal(offset)
	{
		var endstr=document.cookie.indexOf(";", offset);
		if (endstr==-1)
			{
				endstr=document.cookie.length;
			}
		return unescape(document.cookie.substring(offset, endstr));
	}

function GetCookie(name)
	{
		var arg=name+"=";
		var alen=arg.length;
		var clen=document.cookie.length;
		var i=0;
		while (i<clen)
		{
			var j=i+alen;
			if (document.cookie.substring(i,j)==arg)
			{
				return getCookieVal(j);
			}
			i=document.cookie.indexOf(" ", i)+1;
			if (i==0) break;
		}
		return null;
	}

// End of public code
// by Bill Dortch, hIdaho Design


// XFanCZLastVisit - posledni navsteva - uchovat i po vypnuti browseru
// XFanCZLastVisitTemp - posledni navsteva docasna - po vypnuti browseru se musi smazat

function insertLastVisit()
	{
		if (GetCookie("XFanCZLastVisitTemp")==null) // jeste "dneska" na strance nebyl
		{
			// nastavit Temp na predchozi hodnotu XFanCZLastVisit; pokud neexistuje ani XFanCZLastVisit, tak na retezec "1"
			if (GetCookie("XFanCZLastVisit")==null)  // jeste vubec na strance nebyl
			{
				SetCookie("XFanCZLastVisitTemp", "1");
			}
			else
			{
				SetCookie("XFanCZLastVisitTemp", GetCookie("XFanCZLastVisit"));
			}
		}
		// aktualizovat XFanCZLastVisit s expires o rok dal
		var e=new Date();
		var dt=e.getYear();
    if (dt<1900) {dt=dt+1900;}
		var s=e.getDate()+". "+(e.getMonth()+1)+". "+dt;
		e.setYear(dt+1);
		SetCookie("XFanCZLastVisit", s, e);
		if ((GetCookie("XFanCZLastVisitTemp")!=1)&&(GetCookie("XFanCZLastVisitTemp")!=null))
		{
			document.writeln("<br>&nbsp;&nbsp;&nbsp;Vaše předchozí návštěva byla <b>"+GetCookie("XFanCZLastVisitTemp")+"</b>");
		}
	}


