// JavaScript Document
var obr = -1;
var cas = 5000;
var cas1 = 50;
var path = "pictures/";
var x = 0;
var y = 40;
var obrazky = ["001.jpg","002.jpg","003.jpg","004.jpg","005.jpg","006.jpg","007.jpg","008.jpg","009.jpg","010.jpg","011.jpg","012.jpg","013.jpg","014.jpg","015.jpg","016.jpg","017.jpg","018.jpg","019.jpg","020.jpg","021.jpg","022.jpg","023.jpg","024.jpg","025.jpg","026.jpg","027.jpg","028.jpg","029.jpg","030.jpg"];
var timerID1 = 0;
var timerID2 = 0;



function collapse_all()
	{
		x=0;
		while (x<=39)
			{
				var zaznam = "zaznam_" + x;
				var element = document.getElementById(zaznam+'');
				element.style.display = 'none';
				x++;
			}
	}
	
function expand(ktere)
	{
		var zaznam = "zaznam_" + ktere;
		if (document.getElementById(zaznam).currentStyle.display == 'none')
			{
				document.getElementById(zaznam).style.display = 'block';
		}
			else
				{
					document.getElementById(zaznam).style.display = 'none';
				}
	}

function activateMenu(nav) {
    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

function shuffle()
	{
		timerID2=window.setTimeout("shuffle()",cas1);
		document.getElementById("obrazek").style.width = x+"%";
		document.getElementById("obrazek").style.marginTop = y+"%";
		if (x == 100) {x=0; y=40; clearTimeout(timerID2);} else {x+=5;y-= 2;}
	}
	
function animation()
	{
		if (obr+1==obrazky.length) {obr=0;clearTimeout(timerID1);}
			else obr++;
	if (obr != 0) {document.getElementById("double").style.background = "url("+path + obrazky[obr-1]+") no-repeat";}
		else {document.getElementById("double").style.background = "url("+path + obrazky[obr+obrazky.length-1]+") no-repeat";}
	shuffle();
	document.getElementById("obrazek").style.width =  "0%";
	document.getElementById("obrazek").src = path + obrazky[obr];
	timerID1=window.setTimeout("animation()",cas);
	}

window.onload= function(){
    /* pass the function the id of the top level UL */
    /* remove one, when only using one menu */
/*    activateMenu('nav'); */
//	animation();
    activateMenu('vertnav');
}
	
