
function changeText (id, txt){
	var el = document.getElementById(id);
	
	if (document.all) //if IE 4+
		el.innerText = txt+" ";
	else 
		el.innerHTML=txt+" "		
}
/* reference */
function prew (){

	if((curent) > 0){
		curent--;					
		var im = document.getElementById('im');	
		im.src = gallery[curent];
	} else {
		curent = gallery.length -1 ;

		var im = document.getElementById('im');	
		im.src = gallery[curent];
	}
		changeText ('slideofs',curent+1);	
		document.getElementById('im_ref').href=""+gallery2[curent];
}

function next (){
	if((curent+1) < gallery.length){
		curent++;
				
		var im = document.getElementById('im');	
		im.src = gallery[curent];
	} else {
		curent = 0;
		var im = document.getElementById('im');	
		im.src = gallery[curent];
	}
		changeText ('slideofs',curent+1);
		document.getElementById('im_ref').href=""+gallery2[curent];
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
		x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapHeader() {
  var i,j=0,x,a=MM_swapHeader.arguments; document.MM_sr_header=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr_header[j++]=x; ; x.src=a[i+2];}
}

function makePopup(windowPosX,windowPosY,windowName,url,name,w,h,extra){
	var titlebarHeight = 28;
	str="height="+h+",width="+w+","+extra;
	if(parseInt(navigator.appVersion)>3) // supports screen.width
		if (windowPosX == -1) {
			str+=",left=" + (screen.width -w)/2 + ",top=" + parseInt(((screen.height -h)-titlebarHeight)/2);
		}
		else {
			str+=",left="+windowPosX+",top="+windowPosY;
		}
	var k = eval(windowName + "=window.open('" + url + "','" + name + "','" + str + "')");
	return k;
}

function openPop(url,width,height) {
	ak_pop = makePopup(-1,-1,'tab', url,'tab',width,height,'scrollbars=yes');		
	ak_pop.focus();	
}


/* time */

var countDownInterval=9;
var countDownTime=countDownInterval+1;
function countDown(){	
	countDownTime--;
	
	if (countDownTime <=0){
		countDownTime=countDownInterval;
		clearTimeout(counter)
		window.location.href=loc;
		return
	}
	
	if (document.all) //if IE 4+
		document.all.countDownText.innerText = countDownTime+" ";
	else 
		document.getElementById("countDownText").innerHTML=countDownTime+" "		
	
	counter=setTimeout("countDown()", 1000);
}

var countDownInterval2=5;
var countDownTime2=countDownInterval2+1;

function doExit(){	
	if(slide){
		clearTimeout(counter); 
		document.getElementById('countdown').style.display = 'none';
		var countDownInterval2=5;
		var countDownTime2=countDownInterval2+1;
		slide = 0;
	}
}

function doSlide(){	
	countDownTime2--;	
	
	if(slide == 0){
		var im = document.getElementById('ctdimg');	
		im.src = 'images/odpocet.gif';
	}
	slide = 1;
	
	document.getElementById('countdown').style.display = 'inline';
	
	if (countDownTime2 <=0){
		countDownTime2=countDownInterval2;
		
		if((curent+1) < gallery.length){
			next ();
		} else {
			curent = -1;			
			next ();
		}	
		
		document.getElementById('im_ref').href=""+gallery2[curent];
		
		var im = document.getElementById('ctdimg');	
		im.src = 'images/odpocet.gif';
	}
	
	

	
	counter=setTimeout("doSlide()", 1000);
}



/******** prace s inputy **************/

function remove_txt(txt,idcko) {
								
	var t = document.getElementById(idcko);
	if(t.value == txt){
		t.value = "";
	}
}

function set_txt(txt,idcko) {
	
	var t = document.getElementById(idcko);
	if(t.value == ""){
		t.value = txt;
	}
}

function CheckAll(f,el) {
	for (var i=0;i<f.elements.length;i++)
	{
		var e=f.elements[i];
		if (e.name==el) e.checked=f.check_all.checked;
	}
}




