
function fnlistto($cil, isVisible){
    if(isVisible == true)
        $cil.show();
    else
        $cil.hide();
}


function closeBlock(blockId) {
	var block = $('block-content-'+blockId);
	var blockImg = $('block-img-'+blockId);
	if (block.rolled) {
		block.style.display = 'block';
		block.rolled = false;
		blockImg.src = 'images/minus.gif';
		blockImg.alt = 'schovej';
		setCookie('block-'+blockId,'visible',365);
		
	} else {
		block.style.display = 'none';
		block.rolled = true;
		blockImg.src = 'images/plus.gif';
		blockImg.alt = 'zobraz';
		setCookie('block-'+blockId,'hidden',365);
	}
}


function initBlock(blockId) {

	if (getCookie('block-'+blockId) == 'hidden') {
		closeBlock(blockId);
	}
}


function setCookie(c_name,value,expiredays) {
	var exdate = new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
	
function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1) { 
	    	c_start=c_start + c_name.length+1 
	    	c_end=document.cookie.indexOf(";",c_start)
	    	if (c_end==-1) c_end=document.cookie.length
	    	return unescape(document.cookie.substring(c_start,c_end))
	    } 
	}
	return ""
}

function showNews(id) {
	var news = $('news-content-'+id);
	var newsEdit = $('news-edit-'+id);
	var newsImg = $('news-img-'+id);
	if (news.invisible) {
		news.className = 'visible';
		news.invisible = false;
		newsImg.src = 'images/noncross.gif';
		newsImg.alt = 'schovej';
		if (newsEdit) {
			newsEdit.className = 'visibleTr';
		}
		
	} else {
		news.className = 'invisible';
		news.invisible = true;
		newsImg.src = 'images/cross.gif';
		newsImg.alt = 'zobraz';
		if (newsEdit) {
			newsEdit.className = 'invisible';
		}
		
	}
}

function initNews(id) {
	var news = $('news-content-'+id);
	news.className = 'invisible';
	news.invisible = true;
	var newsEdit = $('news-edit-'+id);
	if (newsEdit) {
		newsEdit.className = 'invisible';
	}
}

function newsOver(tr) {
	tr.className = 'hover';
}

function newsOut(tr) {
	tr.className = '';
}

function showNfo(atag) {
	var nfo = $('nfoFile');
	
	if (nfo.invisible || nfo.invisible == null) {
		nfo.style.display = 'block';
		nfo.invisible = false;
		atag.innerHTML = 'Schovej NFO soubor';
		
	} else {
		nfo.style.display = 'none';
		nfo.invisible = true;
		atag.innerHTML = 'Zobraz NFO soubor';
		
	}
}

function showYoutube(atag) {
	var nfo = $('youtubeDiv');
	
	if (nfo.invisible || nfo.invisible == null) {
		nfo.style.display = 'block';
		nfo.invisible = false;
		atag.innerHTML = 'Schovej';
		
	} else {
		nfo.style.display = 'none';
		nfo.invisible = true;
		atag.innerHTML = 'Zobraz';
		
	}
}

function checkForm(form) {
	var inputs = form.getElementsByTagName('input');
	for (i=0; i<inputs.length; i++) {
		var input = inputs.item(i);
		if (input.className == 'require' && input.value == '') {
			window.alert('Musíte vyplnit všechny povinné položky');
			if (input.focus) {
				input.focus();
			}
			return false;
		}
	}
	return true;
}

function showhideKoment() {
	if ($('komenttr').style.display == '' || $('komenttr').style.display == 'none') {
		$('komenttr').style.display = 'block';
	} else {
		$('komenttr').style.display = 'none';
	}
	
}


function openPlayer(url) {
	aPopUp = window.open(url,'','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=420,height=80');
}

	function getUrlParameter ( name,url ) {
		if (url == '' || url == null || url == 'undefined') {
			url = window.location.href;
		}
		
		name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var results = regex.exec( url );
		if( results == null )
			return "";
		else
			return results[1];
	}
	
	

