
var subMenus=new Array();
self.onload=initPage;

function sbal(titulek,co)
	{
	var jak=co.className=="sbal"?false:true;
	co.className=jak?"sbal":"";
	if(titulek) titulek.title=jak?"Klikněte pro zobrazení.":"Klikněte pro skrytí.";
	}

function switch_search_form()
	{
	var fulltext=gid("hledani").elements["typ_hledani"][0].checked;
	gid("fulltextform").style.display=fulltext?"block":"none";
	gid("keywordsform").style.display=fulltext?"none":"block";
	document.cookie="search_form_fulltext="+(fulltext?"1":"0");
	}

function check_form()
	{
	var $resp=(document.getElementById('email').value!='')?true:false; 
	if(!$resp) alert('Vyplňte prosím e-mailovou adresu a text dotazu.'); 
	return $resp;
	}

function write_counter(stranka,verze)
	{
	if(stranka)
		{
		var c_hory=document.createElement("img");
		with(c_hory)
			{
			id="pocitadlo";
			src='http://nahory.net/pocitadlo/counter.php?server='+cserver+'&stranka='+stranka+'&verze='+verze+'&referer='+escape(top.document.referrer)+'&rozliseni_x='+screen.width+'&rozliseni_y='+screen.height+'&velikost_okna_x='+(top.innerWidth ? top.innerWidth : top.document.body.clientWidth)+'&velikost_okna_y='+(top.innerHeight ? top.innerHeight : top.document.body.clientHeight);
			alt="";
			width="0";
			height="0"			
			}
		gid("counter1").appendChild(c_hory);
		c_cnw=document.createElement("img");
		with(c_cnw)
			{
			src="http://counter.cnw.cz/trackit.cgi?pachollini&t5&" + escape(top.document.referrer);
			alt="CNW:Tracker";
			border="0";
			width="1";
			height="1";
			}
		gid("counter1").appendChild(c_cnw);
		}
	}

function o_okno(cesta, jmeno, sirka, vyska, misto)
		{
		if (misto<0) {poloha=screen.availWidth-(sirka+20)+misto;} else {poloha=misto;}
		params="toolbar=no, menubar=no, location=no, directories=no, scrollbars=no, resizable=no, status=no, top=10, left="+poloha+", width="+sirka+", height="+vyska;
		okno=window.open(cesta, jmeno, params);
		if (okno)
			{
			okno.focus();
			return false;
			}
		else return true;
		}

function hiLiteOn()
	{
	gid("logo").src='../img/logo_on.gif';
	gid("logo").style.filter='glow(color=#17E0E3, strength=10)';
	}

function hiLiteOff()
	{
	gid("logo").src='../img/logo.gif';
	gid("logo").style.filter=' ';
	}

function hiLiteIOn()
	{
	window.event.srcElement.style.filter="progid:DXImageTransform.Microsoft.Glow(Color=auqua,Strength=2)";
	window.event.srcElement.style.color="aqua";
	}

function hiLiteIOff()
	{
	window.event.srcElement.style.filter="";
	window.event.srcElement.style.color="";
	}

function hiLitePCHOn()
	{
	gid("pch").src="../img/pachollini_on.gif";
	}

function hiLitePCHOff()
	{
	gid("pch").src="../img/pachollini.gif";
	}

function gid(co) {return document.getElementById(co);}

function initPage()
	{
	if(navigator.appName=="Microsoft Internet Explorer")
		{
		gid("logo").onmouseover=hiLiteOn;
		gid("logo").onmouseout=hiLiteOff;
		}
	gid("pch").onmouseover=hiLitePCHOn;
	gid("pch").onmouseout=hiLitePCHOff;
	}

function browseDom(el,el0)
	{
	var nn;
	if(!el0) el0=el;
	if (el.nodeType==1)
		{
		if(el.nodeName.indexOf(":")>-1) nn=el.nodeName.substr(el.nodeName.indexOf(":")+1);
		else nn=el.nodeName;
		if (nn.toLowerCase()=="ul" && el.id)
			{
			subMenus[subMenus.length]=el.id;
			var prevSib=el.previousSibling.nodeType==1 ? el.previousSibling : el.previousSibling.previousSibling;
			prevSib.onclick=switchSub;
			}
		if (navigator.appName=="Microsoft Internet Explorer" && (el.parentNode.className=="o1" || el.className=="o1"))
			{
			el.onmouseover=hiLiteIOn;
			el.onmouseout=hiLiteIOff;
			}
		}
	if (el.hasChildNodes()) browseDom(el.firstChild,el0);
	if (el.nextSibling && el!=el0) browseDom(el.nextSibling,el0);
	}

function repairEvent(e)
	{
	if(!e.target) e.target=e.srcElement;
	e.mouse_button=e.button;
	if (e.button==1 && navigator.appName=="Microsoft Internet Explorer") e.mouse_button=0;
	return e;
	}

function switchSub(e)
	{
	e=e?e:window.event;
	e=repairEvent(e);
	switchUL(tUL=e.target.nextSibling.nodeType==1 ? e.target.nextSibling : e.target.nextSibling.nextSibling);
	}

function switchUL(tUL)
	{
	var i, expandThis, expanded;
	for(i=0;i<subMenus.length;i++)
		{
		expandThis = (gid(subMenus[i])!=tUL || gid(subMenus[i]).style.display=="block")?false:true;
		gid(subMenus[i]).style.display=expandThis ? "block" : "none";
		if(expandThis) 
			{
			document.cookie="expand="+subMenus[i]+";path=/";
			expanded=true;
			}
		}
	if(!expanded)document.cookie="expand=---;path=/";
	}

function pridej_sbalovac()
	{
	var linktext=" kompaktní výpis";
	var switchdiv=gid("switchdiv");
	var dchecked=document.cookie?((document.cookie.indexOf("kompaktni_vypis=1")>-1)?true:false):false;
	try
		{
		switchdiv.innerHTML="<input id='kompaktswitch' type='checkbox' onclick='sbalto();' onkeyup='sbalto();'"+(dchecked?" checked='checked'":"")+"/>"+linktext;
		}
	catch(e)
		{
		var switchbox=document.createElement("input");
		switchbox.type="checkbox";
		switchbox.addEventListener("click",sbalto,false);
		switchbox.addEventListener("keyup",sbalto,false);
		switchbox.checked=dchecked;
		switchbox.id="kompaktswitch";
		switchdiv.appendChild(switchbox);
		switchdiv.appendChild(document.createTextNode(linktext));
		}
	sbalto();
	}

function sbalto()
	{
	var st=gid("kompaktswitch").checked;
	gid("balic").className=st?"sbal":"";
	document.cookie="kompaktni_vypis="+(st?"1":"0")+";";
	}

function initMenu()
	{
	if(navigator.userAgent.substr(0,7)=="Mozilla" || navigator.userAgent.substr(0,5)=="Opera") switchUL(gid(expand?expand:subMenus[0]));
	}
