function ukaz(id,e){
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}  
	document.getElementById('a_'+id).style.top= (posy-40) +'px';
 		document.getElementById('a_'+id).style.left=(posx + 15)+'px';
 		document.getElementById('a_'+id).style.display='block';
 }
 
 function schovej(id){  
 	document.getElementById('a_'+id).style.display='none';
 }
  	

function zobr_okno(current,e,cis,text)
{
  if (document.all&&document.readyState=="complete")
  	{
    document.all.mapa_graf.innerHTML= text;
    document.all.mapa_graf.style.pixelLeft=event.clientX+document.body.scrollLeft-150;
    document.all.mapa_graf.style.pixelTop=event.clientY+document.body.scrollTop-100;
    document.all.mapa_graf.style.visibility="visible";
	}
  else if (document.layers)
  	{
    document.mapa_graf.document.nstip.document.write('<b>'+text+'</b>');
    document.mapa_graf.document.nstip.document.close();
    document.mapa_graf.document.nstip.left=0;
    currentscroll=setInterval("scrolltip()",100);
    document.mapa_graf.left=e.pageX-150;
    document.mapa_graf.top=e.pageY-100;
    document.mapa_graf.visibility="show";
	}
  else
  	{
    document.getElementById("mapa_graf").innerHTML= text;
    document.getElementById("mapa_graf").style.left=e.clientX+document.body.scrollLeft-150;
   	document.getElementById("mapa_graf").style.top=e.clientY+document.body.scrollTop-100;
    document.getElementById("mapa_graf").style.visibility="visible";
    
	}
}

function schovej_okno()
{
  if (document.all)
    document.all.mapa_graf.style.visibility="hidden";
  else if (document.layers)
  	{
    clearInterval(currentscroll);
    document.mapa_graf.visibility="hidden";
	}
  else
    document.getElementById("mapa_graf").style.visibility="hidden";
}

function obrazek(cis)
{
  furl='../obr.php?co='+cis;
  mokno=window.open(furl,"Fotografie","width=770,height=530,top=1,left=1, status=no, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes ");
  mokno.focus();
}

function oblibene()
{
  cokno=window.open('../oblibene.php?typ=U','','width=300,height=400,top=0,left=0,toolbar=no, location=no, directories=no, status=no, scrollbars=no');
  cokno.focus();
}  


function pridat_oblibene(typ,cis,logged)
{
	if(logged)
		document.location="/include/oblibene_akce.php?typ="+typ+"&cz="+cis;
		else
			{
			alert("Pro použití oblíbených položek musíte být přihlášeni.");
			return;
		}
}

function text_zobr(cis)
{
var fm = document.getElementById('text_maly'+cis).style;
var fv = document.getElementById('text_velky'+cis).style;

if(fm.display=="none")
	{
	fm.display="";
	fv.display="none";
	}
else
	{
	fm.display="none";
	fv.display="";
	}
}
function zobraz(cis)
{
	var fm = document.getElementById('a_'+cis).style;
	var obr = document.getElementById('lokalityVokoliObr_'+cis);
	
	if(fm.display=="none")
		{
		fm.display="block";
		obr.src = '/images/minus2.gif';
		
		}
	else
		{
		fm.display="none";
		obr.src = '/images/plus2.gif';
		}
}

function addBookmark(url, title) 
{
	if (window.sidebar) 
	{ 
		window.sidebar.addPanel(title, url,""); 
	} 
	else if( document.all ) 
	{
		window.external.AddFavorite( url, title);
	} 
	else if( window.opera && window.print ) 
	{
		return true;
	}
}

function ochrana(divId, inputId)
{
	document.getElementById(divId).style.display = "none";
	document.getElementById(inputId).value = '3';
}

function extraWindow(Url,Title,Width,Height,Resiz,Scrol) {
	var opts = "width="+Width+",height="+Height+",titlebar=yes,status=no";
	//if (Resiz+0 > 0) opts += ",resizable=yes";
	//if (Scrol+0 > 0) opts += ",scrollbars=yes";
	
	var Okno = window.open(Url,Title,opts);
	Okno.opener=self;
	Okno.focus();
	return false;
}

function ukazPopisMapy(elm,vystup)
{
	var div = document.getElementById(vystup);
	var title = elm.title;
	if (div!=null)
	{
		div.innerHTML = title;
	}
}

function smazPopisMapy(vystup)
{
	var div = document.getElementById(vystup);
	if (div!=null)
	{
		div.innerHTML = "";
	}
}

function zmenOdkaz(id,select,oblast)
{
	var span = document.getElementById(id);
	span.innerHTML = "<a href=\"javascript:void(0);\" title=\"nájsť oblasť na mape\" onclick=\"return extraWindow('/oblasti/vyber/oblastmapa/" + id + "/select/" + select + "/oblastId/" + oblast + "','Oblasti',320,320,0,0);\">nájsť oblasť na mape</a>";
}

function nastaveniOblasti(select,oblast)
{
	var sel = document.getElementById(select);

	if  (sel != null)
	{
		for(var i=0; i<sel.options.length; i++)
		{
			if (sel.options[i].value==oblast)
			{
				sel.selectedIndex = i;
				break;
			}
		}
	}
}

function vybratVse(form,nazev,hodnota)
{
	var frm = document.getElementById(form);
	var nazev2 = nazev+"[]";
	for (var i=0;i<frm.length;i++)
	{
		if (frm.elements[i].name==nazev2)
		{
			frm.elements[i].checked = hodnota;
		}
	}
}

function prepniDivDleCheckboxu(cbId,divId) 
{
	var cb = document.getElementById(cbId);
	var div = document.getElementById(divId);
	
	if (cb.checked == true) 
	{
		div.style.display = 'block';
	} 
	else 
	{
		div.style.display = 'none';
	}
}
 
