//PUBSYS 5.04.24 tisk,-automat, Obsah, footer
VypsatText=false
Automat=false;
Ladeni=false;
Interval=30;
function Wr(s){document.writeln(s)}
//Wr('<div id="staticbanner" style="position:absolute; background-color:transparent"></div>');

function Jump(cil){//alert("skok="+cil);
 if (cil=="") document.history.back(1)
  if (cil!="") document.location=cil}
  iii=Interval;
function positionit(){
 if (Automat){ iii--
 //if(document.getElementById("count")!=null) document.getElementById("count").innerText=Stav(iii)
 if(document.getElementById("zbyva")!=null) document.getElementById("zbyva").innerText=iii
 myProgBar.setBar(1/Interval,true);  //add 10% to the progress bar's progress

}}
function Stav(c){var str="";
 for (var i=0;i<Interval-c;i++){str+="x"}//i
 for (var i=0;i<c;i++){str+="-"}//i
 return str;
}

Pozice=setInterval("positionit()",1000)


LO=location.href.toLowerCase()
MS=("www.statspol.cz,statspol.cz,inspider,kvadrous,ssysel,interstat,vypstat,www.stahroun.me.cz,stahroun.me.cz").split(",")

for (I in MS) { Nejm=MS[I];k=LO.indexOf(Nejm);if (k>0) break;}
SP=(LO.substring(0,k)+Nejm+"/")
ActualFile=LO.substr(k)
Common_path=SP+"common/";
SP=LO.substring(0,LO.indexOf(Nejm+"/"))
Konec=LO.substr(LO.lastIndexOf("/")+1)
Origin=SP+Nejm+"/";
//alert("Origin="+Origin)

s='<div id=OVL class=OVLADANI><center>'
+'<img src="'+Origin+'ces.png" title="Pouze ilustrace">'
//+'<font size=5>&nbsp;Česká statistická společnost</font>'
//+' <img src="'+Origin+'spolek.jpg" title="Oficiální znak">'
s+='</center><div id=GLOBAL></div>'
+'<span id=LOCAL></span>&nbsp;'
+'<span id="HIERARCHIE" title=" Postupná hierarchie adresářů"></span>'
+'</div>'
if(Ladeni)s+="<div id=LADENI></div>"
s+='<div id=footer>'
if (Automat){
s+='\n<span id="auto"><span id=progress></span><font color=red>Automat</font> zbývá <span id=zbyva></span> sec <span id=count></span>'
+'\n<INPUT TYPE="button" VALUE="STOP" onClick="Stopaut();"></span>'}
s+='<a href='+Origin+'obsah.htm>Obsah</a>'
//+'<a href='+Origin+'rejstrik.htm>Rejstřík</a>'
//+'<a href='+Origin+'priklady.htm>Příklady</a>'
//+'<a href='+Origin+'vypocty.htm>Výpočty</a>'
+'<a href='+Origin+'napoveda.htm>Nápověda</a></span>'
+'</div>'
Wr(s); //alert(s)
//if(~Automat)document.getElementById("auto").innerHTML="";
shie=''
Rest=LO.substring(LO.indexOf(Nejm+"/"),LO.lastIndexOf("/")+1)
//alert(Rest)
 while (Rest.indexOf("/")>0)
 {i=Rest.indexOf("/")
  Nam=Rest.substr(0,i+1);
  Rest=Rest.substr(i+1);
  shie+='<a href="'+SP+Nam+'index.htm">'+Nam.substr(0,Nam.length-1)+'</a>&nbsp;&gt;&nbsp;'
  SP=SP+Nam
 }
shie+=Konec;
document.getElementById("HIERARCHIE").innerHTML=shie;

//rozbor posloupnosti ============================================
I=0; II=-1;Ad=new Array();Na=new Array();Odkazy=new Array();Mapa="";
H=new Array();H[0]=0; //-1
N=new Array();N[0]=0; H9=9 //maximální hladina
lev=0;pocet=0;
function _(a,b){ //alert(a+"\n"+"\nfajl="+fajl)
 var n=a.length;pocet++;
 if (a.indexOf(".htm")>=0) alert("chybne .htm v "+a+"("+pocet+")")
 if (a.indexOf("index")>=0) alert("chybne index v "+a+"("+pocet+")")
 pole=a.split("");
 lev=0; for(i=0;i<n;i++) if(pole[i]=="/") lev++;
 pridat=".htm"
 if (n==a.lastIndexOf("/")+1) pridat="index"+pridat; // alert("level="+lev+"\n"+a+pridat)
 var s=a.lastIndexOf("/")+1
 var Last=(s==n); s=".htm"
 var ss=a; var aa=a
 if (Last) {s="index.htm";  ss=ss.substr(0,n-1);}
 Ho="";level=1; n=0;
 if (ss.indexOf("/")>=0){
  while (ss.indexOf("/")>=0)
  {i=ss.indexOf("/")
   ss=ss.substr(i+1);
	 aa=aa.substr(1);//   alert(ss)
   Ho+="&nbsp;";level++; n++ } };// alert("Počet="+n)
 H[n]++; N[n]=aa
 for (i=n+1;i<H9;i++) {H[i]=0;N[i]=""}; //maximálně 9 úrovní
 Cesta=""; Hs=""
 for (i=0;i<n;i++){ Cesta+=N[i]; }
 for (i=0;i<=n;i++){ Hs+=H[i]+"."}; // alert("Pocet="+n+" Cesta="+Cesta+"  Hs="+Hs+" SP="+SP+" Nam="+Nam)
 Na[I]=b; Ad[I]=Origin+Cesta+aa+s
 if (Ad[I]==LO) {II=I; };// if(I<5) alert(LO+"\n"+Ad[I])
 ss='\n<div class=lev'+level+'>'+Ho+'<a href="'+Ad[I]+'">'+Hs+b+'</a></div>';
 Odkazy[I]=ss
 st="\ndt_"+Hs.replace(".","_")
 st+='=("'+Ad[I]+'","'+Hs+b+'")'
 hie=Hs
 for (i=0;i<H9;i++) hie=hie.replace(".","_")
 hie=hie.substr(0,hie.lastIndexOf("_"))
 st="\nurl_"+hie
 st+='="'+Ad[I]+'";'
 st+=' td_'+hie+'="'+b+'"'
// document.getElementById("obsah").innerHTML+=(ss)
// document.getElementById("cesta").innerText+=(ss)
// document.getElementById("menu-polo").innerText+=(st)
  document.writeln(st)
 Mapa+=ss
 I++
}; // konec _(a,b)=======================================

//obsah
  document.open()
  document.writeln("<scr"+"ipt>")
_("","Úvod")
_("akce/","Akce")

_("dokumenty/","Dokumenty")
_("/cssinfo","O Společnosti")
//_("/adresy/","E-maily statistiků")
_("/stanovy","Stanovy")
_("/pravidla","Pravidla pro poskytování příspěvků na konference")
_("/vybor","Členové výborů")
_("/predsedove","Historie - předsedové")
_("/zalozeni","Zpráva o založení")
_("/archiv/","Archivní disketa 1990")


_("sdcsts/","SD CStS")
_("bulletiny/","Bulletin")
_("stakan/","STAKAN")
_("robust/","ROBUST")
_("request/","REQUEST")

_("clanky/","Články")

_("foto/","Foto")
_("/robust2006/","ROBUST 2006")
_("/robust2004/","ROBUST 2004")
_("/stakan2003/","STAKAN 2003")
_("/povoden2002/","Povodeň 2002 v Karlíně")
//_("povoden/prohlizec", "Povodeň v Karlíně")



_("odkazy/","Odkazy")
_("/katedry/","Katedry vyučující statistiku")
_("/firmy/","Firmy")
_("/vyzkum/","Vyzkum")
_("/urady/","Úřady")
//_("/vyuka/","Výukové stránky")
//_("/ucebnice/","Internetové učebnice v češtině")
_("/spolecnosti/","Statistické společnosti")
//_("/zajimave/","Zajímavé odkazy")

//_("http://www.stahroun.me.cz/statisticka_anketa/anketa-formular.php","Anketa")
_("aktuality/","Aktuality")
// konec obsahu

  document.writeln("</scr"+"ipt>")
//alert(Mapa)
 s="\n<a href=#top>top</a>"
 s+='\n<a href='+Ad[0]+' title="Začátek výkladu">Úvod</a>'
 if (II>0)
 { i=eval(II-1);  s+='\n<a href='+Ad[i]+' title="'+Na[i]+'">Předchozí</a>' }
 if ((II<Ad.length-1)&&(II>-1))
 {i=eval(II+1);  s+='\n<a href='+Ad[i]+' title="'+Na[i]+'">Další</a>';  }
 if (II<0)
 { s+='\n<a href=# onclick=javascript:"history.go(-1)"'+' title="Zpět">Zpět</a>';  }
 
 document.getElementById("footer").innerHTML+=s;


////////////////////Please leave this notice////////////////////
//
//	DropDown Menu 1.0
//	By Evgeny Novikov (java@aladin.ru)
//	http://java.skyteam.ru
//	It works only with IE5.0(++) and Netscape6.0(++)
//	Free to use!
//
////////////////////Last modified 2002-03-05////////////////////

//	Modify following four lines to customize your menu
var tdColor="#FFFFFF";		// menu item text color
var tdBgColor="chocolate";//"#6666FF"; menu item background color
var hlColor="#000000";		// highlight text color
var hlBgColor="#FFFFBB";	// highlight background color
//	After change, modify same values in your *.css file

var md=1250;
var ti=-1;
var oTd=new Object;
oTd=null;

function doMenu(td){
	clearTimeout(ti);
	td.style.backgroundColor=hlBgColor;
	td.style.color=hlColor;
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		for(i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(tdo[i]!=tda[i]){
				document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
				document.getElementById("td"+sT).style.color=tdColor;
				if(document.getElementById("tbl"+sT)!=null)
					document.getElementById("tbl"+sT).style.visibility="hidden";
			}
		}
	}
	oTd=td;
	sT="tbl";
	for(i=1;i<tda.length;i++)
		sT+="_"+tda[i];
	if(document.getElementById(sT)!=null)
		document.getElementById(sT).style.visibility="visible";

}

function clearMenu(){
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		var sT="";
		for(var i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
			document.getElementById("td"+sT).style.color=tdColor;
			if(document.getElementById("tbl"+sT)!=null)
				document.getElementById("tbl"+sT).style.visibility="hidden";
		}
		oTd=null;
	}
}

function runMenu(strURL){
	location.href=strURL;
}

var tt="";
var sT="";
var pT=new Array();
var tA=new Array();

function getCoord(st){
	tA=st.split("_");
	if(tA.length>2){
		tA=tA.slice(0,-1);
		tt=tA.join("_");
		return (document.getElementById("tbl"+tt).offsetTop+document.getElementById("td"+st).offsetTop+4)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth-2)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetHeight-2)+"px;left:"+
		  (document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetLeft+5)+"px\">";
}

var sH="<table class=\"menu\" id=\"mainmenu\" cellspacing=2px><tr>";
var p=0;
var j=0;
while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){
	sH+="<td id=\"td_"+j+"\" onmouseover=\"doMenu(this)\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"";
	sH+=(eval("typeof(url_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url_"+j)+"')\">":">";
	sH+=eval("td_"+j)+"</td>";
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
		pT[p++]="_"+j;
}
sH+="</tr></table>";
document.getElementById("GLOBAL").innerHTML+=sH;
//document.write(sH);
for(var q=0;typeof(pT[q])!="undefined";q++){
	sT=pT[q];
	sH="";
	j=0;
	sH+="<table class=\"menu\" id=\"tbl"+sT+"\" cellspacing=\"2\" style=\"top:"+getCoord(sT);
	while (eval("typeof(td"+sT+"_"+ ++j +")!=\"undefined\"")){
		sH+="<tr><td id=\"td"+sT+"_"+j+"\" onmouseover=\"doMenu(this)\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"";
		sH+=(eval("typeof(url"+sT+"_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url"+sT+"_"+j)+"')\">":">";
		sH+=eval("td"+sT+"_"+j)+"</td></tr>";
		if (eval("typeof(td"+sT+"_"+j+"_1)!=\"undefined\""))
			pT[p++]=sT+"_"+j;
	}
	sH+="</table>";
  document.getElementById("GLOBAL").innerHTML+=sH;
//	document.write(sH);
}
document.getElementById("mainmenu").style.visibility="visible";

// vnitrni obsah
onload=Obsah;
function Obsah(){
 for (lin = 0; lin<document.links.length; lin++)
  { document.links[lin].title = document.links[lin].toString()	//write URL
   //document.links[lin].title = document.links[lin].innerText	//write text
  }//titulky u string
 var stH="";  var H3i=0; var H2i=0; var H4i=0;
 ee=document.getElementsByTagName("*");
 for (i=0;i<ee.length;i++) {
  e=ee[i]; N=e.tagName; T=e.innerHTML;if(Ladeni)document.getElementById("LADENI").innerHTML+="("+i+"):"+N+", "
  if ((N=="H2")|| (N=="H3")|| (N=="H4"))
  { Hclass='<span class="p';
   if (N=="H2"){H2i++; H3i=0;  Hclass+='2">';H=eval(H2i); }
   if (N=="H3"){H3i++; H4i=0 ; Hclass+='3">&nbsp;';H=eval(H2i)+"."+eval(H3i); }
   if (N=="H4"){H4i++;       ; Hclass+='4">&nbsp;&nbsp;';H=eval(H2i)+"."+eval(H3i)+"."+eval(H4i);}
   T=".&nbsp;"+T
   e.innerHTML="<span class=back><A NAME="+H+"></A>&nbsp;"+H+T+'</span>';
   stH+="<a href=\"#" + H + "\">"+Hclass+H+T+"</span></a><br>"
  }//doplnění nadpisu
 }//i
  // uprava dt
  pom=document.getElementsByTagName("DT");
   for (i=0;i<pom.length;i++)  { e=pom[i]; T=e.innerHTML;
    e.innerHTML="<span class=back>"+T+"</span>";
  };//i
  str="";
 MenuPart("H2z",stH,"nadpisy","značky H");//alert(str)
// MenuPart("H3z",Odkazy_na_tag("H5"),"přehledy","značky H5");
// MenuPart("Bz",Odkazy_na_tag("B"),"zvýrazněno","značky B");
// MenuPart("AHREFz",pLinks(),"Externí odkazy","značky A HREF=http://")
 str+='<span class=menu><a href=# onclick=Tiskver()>Pro tisk</a></span>'

 document.getElementById("LOCAL").innerHTML+=str
//Copy atd
 De = ("neděle,pondělí,úterý,středa,čtvrtek,pátek,sobota").split(",");
 Mo =("ledna,února,března,dubna,května,června,července,srpna,září,října,listopadu,prosince").split(",");
 D = new Date(document.lastModified);
 strc="<br clear=all><div class=UPRAVA>Poslední úprava "+De[(D.getDay())]+", "
 strc+=D.getDate()+". "+Mo[(D.getMonth())]+" "+eval(D.getFullYear())+"."
 strc+=" &copy;JŽ</div>"

 document.getElementsByTagName("BODY")[0].insertAdjacentHTML("BeforeEnd",strc);
 // pokud tam je průběh
 if (Automat){document.getElementById("PRUBEH").innerHTML="";
    Dalsi=setTimeout("Akce()",Interval*1000);// skok na další stránku
  }
}//konec Obsah
function Akce(){ //alert(II)
 if (II+1>=Ad.length)
   {alert("Poslední stránka");Jump(Ad[0]);return}
 if (II>=0) {Jump(Ad[II+1]);return};
  if (k>=0) {if(Automat){Stopaut()}}
 //which = String.fromCharCode(k); //alert(which)
}
function Stopaut(){Automat=false;
 clearTimeout(Dalsi);
 clearTimeout(Pozice);
 document.getElementById("auto").innerHTML="";
}
//přerušení počítání při práci sklávesnicí
function getkey(e)
{if (window.event)   k=window.event.keyCode;
  else if (e) k=e.which;
  else  return null;
 // alert(k)
  if (k>=0) {if(Automat){clearTimeout(Dalsi);document.getElementById("auto").innerHTML="";}}
 //which = String.fromCharCode(k)
 //alert(which)
}
document.onkeypress = getkey;
var cm=null;
document.onclick = new Function("show(null)")
function getPos(el,sProp) {
	var iPos = 0
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos
}

function show(el,m) {
	if (m) {
		m.style.display='';
		m.style.pixelLeft = getPos(el,"Left")
		m.style.pixelTop = getPos(el,"Top") + el.offsetHeight
	}
	if ((m!=cm) && (cm)) cm.style.display='none'
	cm=m
}


function Odkazy_na_tag(tag){// alert("tag="+tag);
  pom=document.getElementsByTagName(tag); var str="";
  var n=pom.length; if (n==0) return str;
  for (i=0;i<pom.length;i++)  { e=pom[i]; T=e.innerHTML;
    e.innerHTML="<a name="+tag+i+"></A>"+T;
    str+="\n<a href=#"+tag+i+">"+T+"</a><br> ";
  };
 return(str);
};//Odkazy_na_tag
function pLinks(){
 var B=document.links; n=B.length; var stL=""
 for (i=0;i<n; i++) {
   if (B(i).innerText!="")
   { if (B(i).outerHTML.indexOf("http://")>0)  stL+=B(i).outerHTML+"<br>"}
 }return stL;}//pLiks
function MenuPart(ide,text,nazev,titulek){if (text=="") return;
  str+='\n<span ID="d'+ide+'" onmouseover="show(this,'+ide+'1);" class="menu">'+nazev+'</span>'
  str+='\n<DIV ID="'+ide+'1" CLASS="submenu"'
  if (titulek!=null) str+=' title="'+titulek+'"';
  str+=' STYLE="display:none">';
  str+=text+"\n</div>"; //alert(str)
  return str;
}//konec MenuPart
function Tiskver(){var D=new Date();
 ns=document.styleSheets.length;
 for (i=0;i<ns;i++) {document.styleSheets[i].disabled = true;};
 var s="Zdroj: " +HIERARCHIE.innerText+"<br>Soubor: "+document.location.href
 +"<br>Dne "+ D.getDate()+". "+Mo[(D.getMonth())]+" "+eval(D.getFullYear())+"<hr>"; //alert(s)
 document.getElementById("OVL").innerHTML=s
 document.getElementById("footer").innerHTML=""
if (VypsatText){strc='<TEXTAREA ID="OBSAH5" cols=50 rows=10></TEXTAREA>'
 document.getElementsByTagName("BODY")[0].insertAdjacentHTML("BeforeEnd",strc);}
for (i=0;i<document.getElementsByTagName("*").length;i++)
 {window.status="zpracovávám "+i
  e=document.getElementsByTagName("*")[i]; N=e.tagName
 if (N=="SCRIPT"){e.outerHTML="" }
 if ((N=="A")&& (e.href>"")) {M=e.href;
  e.outerHTML="<b>"+e.innerText+'</b> '
  +'(<span class="normi">'+M.replace("http://","")+"</span>)";i++;
  }//if
 }//i
if (VypsatText){
  document.getElementById("OBSAH5").innerText=document.getElementsByTagName("BODY")[0].innerHTML }
}//Tiskver
var MWJ_progBar = 0;

function getRefToDivNest( divID, oDoc ) {
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDivNest(divID,oDoc.layers[x].document); }
			return y; } }
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	return document[divID];
}

function progressBar( oBt, oBc, oBg, oBa, oWi, oHi, oDr, target ) {
	MWJ_progBar++; this.id = 'MWJ_progBar' + MWJ_progBar; this.dir = oDr; this.width = oWi; this.height = oHi; this.amt = 0;
	//write the bar as a layer in an ilayer in two tables giving the border
	str=( '<table border="0" cellspacing="0" cellpadding="'+oBt+'" align=left><tr><td bgcolor="'+oBc+'">'+
		'<table border="0" cellspacing="0" cellpadding="0"><tr><td height="'+oHi+'" width="'+oWi+'" bgcolor="'+oBg+'">' );
	if( document.layers ) {
		str+=( '<ilayer height="'+oHi+'" width="'+oWi+'"><layer bgcolor="'+oBa+'" name="MWJ_progBar'+MWJ_progBar+'"></layer></ilayer>' );
	} else {
		str+=( '<div style="position:relative;top:0px;left:0px;height:'+oHi+'px;width:'+oWi+';">'+
			'<div style="position:absolute;top:0px;left:0px;height:0px;width:0;font-size:1px;background-color:'+oBa+';" id="MWJ_progBar'+MWJ_progBar+'"></div></div>' );
	}
	str+=( '</td></tr></table></td></tr></table>\n' );
	if (Automat) document.getElementById(target).innerHTML=str
	this.setBar = resetBar; //doing this inline causes unexpected bugs in early NS4
	this.setCol = setColour;
}
function resetBar( a, b ) {
	//work out the required size and use various methods to enforce it
	this.amt = ( typeof( b ) == 'undefined' ) ? a : b ? ( this.amt + a ) : ( this.amt - a );
	if( isNaN( this.amt ) ) { this.amt = 0; } if( this.amt > 1 ) { this.amt = 1; } if( this.amt < 0 ) { this.amt = 0; }
	var theWidth = Math.round( this.width * ( ( this.dir % 2 ) ? this.amt : 1 ) );
	var theHeight = Math.round( this.height * ( ( this.dir % 2 ) ? 1 : this.amt ) );
	var theDiv = getRefToDivNest( this.id ); if( !theDiv ) { window.status = 'Progress: ' + Math.round( 100 * this.amt ) + '%'; return; }
	if( theDiv.style ) { theDiv = theDiv.style; theDiv.clip = 'rect(0px '+theWidth+'px '+theHeight+'px 0px)'; }
	var oPix = document.childNodes ? 'px' : 0;
	theDiv.width = theWidth + oPix; theDiv.pixelWidth = theWidth; theDiv.height = theHeight + oPix; theDiv.pixelHeight = theHeight;
	if( theDiv.resizeTo ) { theDiv.resizeTo( theWidth, theHeight ); }
	theDiv.left = ( ( this.dir != 3 ) ? 0 : this.width - theWidth ) + oPix; theDiv.top = ( ( this.dir != 4 ) ? 0 : this.height - theHeight ) + oPix;
}
function setColour( a ) {
	//change all the different colour styles
	var theDiv = getRefToDivNest( this.id ); if( theDiv.style ) { theDiv = theDiv.style; }
	theDiv.bgColor = a; theDiv.backgroundColor = a; theDiv.background = a;
}
		var myProgBar = new progressBar(
			1,         //border thickness
			'#000000', //border colour
			'#a5f3b1', //background colour
			'#043db2', //bar colour
			400,       //width of bar (excluding border)
			20,        //height of bar (excluding border)
			1,          //direction of progress: 1 = right, 2 = down, 3 = left, 4 = up
			"progress"     //placement of progressbar
		);
myProgBar.setBar(0.0);       //set the progress bar to indicate a progress of 50%
