var hideTimeout = null;

function redflag(idecko)
{
	var vlajka = document.getElementById(idecko);
	vlajka.className = "flag";
}

function greenflag(idecko)
{
  var vlajka = document.getElementById(idecko);
	vlajka.className = "act";
}

function SafeDelete(whatToDelete)
{
		if (confirm('Opravdu smazat "'+whatToDelete+'"?'))
			return confirm('Opravdu smazat "'+whatToDelete+'" vcetne dat? Tato operace je nevratna!');

		return false;
}

function ShowPopUpWindow(sAdresa, iSirka, iVyska)
{
	iSirka+=7;
	iMyWidth = (window.screen.width - iSirka ) / 2 ;
	iMyHeight = (window.screen.height - iVyska ) / 2;
	return window.open(sAdresa, '', 'width='+iSirka+'px, height='+iVyska+'px, left=' + iMyWidth + ',top=' + iMyHeight + ', resizable=yes, titlebar=no, status=yes, address=no, scrollbars=yes, dependent=yes, modal=yes');
}

function ShowPopUpWindowCenter(sAdresa, iSirka, iVyska)
{
	iSirka+=7;
	iMyWidth = (window.screen.width - iSirka ) / 2 ;
	iMyHeight = (window.screen.height - iVyska ) / 2;

	return window.open(sAdresa, '', 'width='+iSirka+'px, height='+iVyska+'px, left=' + iMyWidth + ',top=' + iMyHeight + ', resizable=yes, titlebar=no, status=yes, address=no, scrollbars=yes, dependent=yes, modal=yes');
}


function Error(errorMessage)
{
	if (errorMessage.length != 0)
		alert(errorMessage);
}

function ShowNavi()
{
	var navigace = document.getElementById("navi");
	navigace.className = "show";
}
function autoHide()
{
	var navigace = document.getElementById("navi");
	navigace.className = "hide";
	clearTimeout(hideTimeout);
}
function HideNavi(time)
{
	clearTimeout(hideTimeout);
	hideTimeout = setTimeout("autoHide()", time * 1000);
}
function panorama( url, xwidth, xheight)
{
	iMyWidth = (window.screen.width - xwidth ) / 2 ;
	iMyHeight = (window.screen.height - xheight ) / 2;
	openerdue = window.open(url, "panorama","height="+xheight+",width="+xwidth+",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=auto, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,directories=no,resizable=no");
}

	function add_class(elText, classname)
	{
		if (elText.indexOf(classname)<0)
			return elText+" "+classname;
		else
			return elText;
	}
	function rem_class(elText, classname)
	{
		if (elText.indexOf(classname)<0)
			return elText;
		else
		{
			temp_text=new String();
			pozice=elText.indexOf(classname);
			if (pozice<0)
				return elText;
			var jmena = elText.split(" ");
			temp_text="";
			for(i = 0; i < jmena.length; i++)
			if (jmena[i]!=classname)
			{
				if (temp_text.length==0)
					temp_text=jmena[i];
				else
					temp_text=temp_text + " " + jmena[i];
			}
			return temp_text;
		}

	}
	function tr_changeimage(adresa,cim)
	{
		var slozky = adresa.split('/');
		temp_text="";
		for(i = 0; i < slozky.length-1; i++)
			temp_text=temp_text + slozky[i] + '/';
		return temp_text + cim;
	}
	function tr_zvyrazni(cislo)
	{
		oEl=document.getElementById('trpol'+cislo);
		if (oEl!=null)
			oEl.className = add_class(oEl.className, 'troznac');
		oEl=document.getElementById('bod'+cislo);
		if (oEl!=null)
			oEl.className = add_class(oEl.className, 'oznac');
		oEl=document.getElementById('img'+cislo);
		if (oEl!=null)
			oEl.src=tr_changeimage(oEl.src,'trasa_bigpoint.gif');
	}
	function tr_puvodni(cislo)
	{
		oEl=document.getElementById('trpol'+cislo);
		if (oEl!=null)
			oEl.className = rem_class(oEl.className, 'troznac');
		oEl=document.getElementById('bod'+cislo);
		if (oEl!=null)
			oEl.className = rem_class(oEl.className, 'oznac');
		oEl=document.getElementById('img'+cislo);
		if (oEl!=null)
			oEl.src=tr_changeimage(oEl.src,'trasa_smallpoint.gif');
	}
	function tr_a_zvyrazni(cislo)
	{
		oEl=document.getElementById("trpol"+cislo);
		if (oEl!=null)
			oEl.className = add_class(oEl.className, 'troznac');
	}
	function tr_a_puvodni(cislo)
	{
		oEl=document.getElementById("trpol"+cislo);
		if (oEl!=null)
			oEl.className = rem_class(oEl.className, 'troznac');
	}
function trasapred()
{
	oImg=document.getElementById("mapa_hl");
	oStat=document.getElementById("mapa3dstat");
	pocetmap=mapy3d.length;
	mapa3dzobraz--;
	if (mapa3dzobraz<1)
	  mapa3dzobraz=pocetmap;
	oImg.src=mapy3d[mapa3dzobraz-1];
	oStat.value=mapa3dzobraz+"/"+pocetmap;
	return false;
}
function trasadal()
{
	oImg=document.getElementById("mapa_hl");
	oStat=document.getElementById("mapa3dstat");
	pocetmap=mapy3d.length;
	mapa3dzobraz++;
	if (mapa3dzobraz>pocetmap)
	  mapa3dzobraz=1;
	oImg.src=mapy3d[mapa3dzobraz-1];
	oStat.value=mapa3dzobraz+"/"+pocetmap;
	return false;
}
function tr_nastavtyp(ijaky)
{
  oEl=document.getElementById("ciscyklo");
	if (ijaky==2)
	  oEl.disabled=false;
	else
	  oEl.disabled=true;
	iCount=1;
	while(document.getElementById("turznac"+iCount)!=null)
	{
	  oEl=document.getElementById("turznac"+iCount);
	  if (ijaky==3)
		  oEl.disabled=false;
		else
	  	oEl.disabled=true;
	 	iCount++;
	}
}
function tr_nastav(naco)
{
	oEl=document.getElementById("chuze");
	oEl.disabled=naco;
	oEl=document.getElementById("kolo");
	oEl.disabled=naco;
}
function AddFavorite(linkObj,addUrl,addTitle)
{
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm(ltrasafav))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert(ltrasaoblinfo);
  return false;
}
function tr_nastavturist()
{
	oEl=document.getElementById("typcasukolo1");
	oEl.disabled=true;
	oEl=document.getElementById("typcasukolo2");
	oEl.disabled=true;
	oEl=document.getElementById("kolo");
	oEl.disabled=true;
	oEl=document.getElementById("typcasuturist1");
	oEl.disabled=false;
	chuze=oEl.checked
	oEl=document.getElementById("typcasuturist2");
	oEl.disabled=false;
	oEl=document.getElementById("chuze");
	oEl.disabled=chuze;
}
function tr_nastavkolo()
{
	oEl=document.getElementById("typcasuturist1");
	oEl.disabled=true;
	oEl=document.getElementById("typcasuturist2");
	oEl.disabled=true;
	oEl=document.getElementById("chuze");
	oEl.disabled=true;
	oEl=document.getElementById("typcasukolo1");
	oEl.disabled=false;
	kolo=oEl.checked;
	oEl=document.getElementById("typcasukolo2");
	oEl.disabled=false;
	oEl=document.getElementById("kolo");
	oEl.disabled=kolo;
}
function tr_inptextturist()
{
	oEl=document.getElementById("typcasuturist1");
	kolo=oEl.checked;
	oEl=document.getElementById("chuze");
	oEl.disabled=kolo;
}
function tr_inptextkolo()
{
	oEl=document.getElementById("typcasukolo1");
	kolo=oEl.checked;
	oEl=document.getElementById("kolo");
	oEl.disabled=kolo;
}
function zoom_new( image, xwidth, xheight)
{
iMyWidth = (window.screen.width - xwidth ) / 2 ;
iMyHeight = (window.screen.height - xheight ) / 2;
xwidth=xwidth+7;
xheight=xheight+14;
openerdue = window.open("", "opener","height="+xheight+",width="+xwidth+",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=auto, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,directories=no,resizable=yes");
openerdue.document.write("<HTML><head>");
openerdue.document.write("<title>Preview</title>");
openerdue.document.write("</head>");
openerdue.document.write("<BODY style=\"margin:0;padding:0;\" BGCOLOR=#000000 TEXT=FFFFFF>");
openerdue.document.write("<center><a href=\"javascript: parent.close()\"  title=\"Zavřít okno\" style=\"margin:0;padding:0;\"><IMG SRC='"+image+"' alt='Zavřít okno' style=\"margin:0;padding:0;border:0;\"></a></center>");
openerdue.document.write("</BODY>");
openerdue.document.write("</HTML>");
openerdue.document.close();
return openerdue;
}