function udalostStart()
{
	animaceStart();
	setTimeout("formStart();", 1500);
}



/* formStart */



function formStart()
{
	if(document.getElementsByTagName)
	{
		var input = document.getElementsByTagName('input');
		for(var i = 0; i < input.length; ++i)
		{
			if(input[i] && input[i].type && input[i].type == "text")
			{
				input[i].focus();
				return;
			}
		}
	}
}



/* animace */



var animaceFaze = Array();

function animaceStart()
{
	var e;
	e = document.getElementById("hlavickaObsah");
	if(e) setTimeout("animace('hlavickaObsah', 50, 33, 33, 100)", 300);
	e = document.getElementById("logo");
	if(e) setTimeout("animace('logo', 50, 33, 33, 100)", 600);
	//e = document.getElementById("stranka");
	//if(e) setTimeout("animace('stranka', 50, 20, 20, 100)", 1300);
}

function animace(id, prodleva, krok, hStart, hStop)
{
	if(hStop == 0)
		hStop = 1;
	if(!animaceFaze[id])
		animaceFaze[id] = hStart;
	animaceNastavPruhlednost(id, animaceFaze[id]);
	if(animaceFaze[id] == hStop)
		return;
	if(Math.abs(animaceFaze[id] - hStop) >= Math.abs(krok))
		animaceFaze[id] += krok;
	else
		animaceFaze[id] = hStop;
	setTimeout("animace('" + id + "', " + prodleva + ", " + krok + ", " + hStart + ", " + hStop + ")", prodleva);
}

function animaceNastavPruhlednost(id, pruhlednost)
{
	if(pruhlednost > 99) pruhlednost = 99;
	var e = document.getElementById(id);
	if(e)
	{
		e.style.filter = "Alpha(Opacity="+pruhlednost+")";
		e.style.opacity = ""+(pruhlednost/100);
	}
}

function menuClick(odkaz)
{
	e = document.getElementById("menuAplikace");
	setTimeout("animace('menuAplikace', 50, -20, 100, 0);", 1);
	setTimeout("window.location='" + odkaz.href + "';", 300);	
	return false;
}



/* ukaz obrazek */



function ukazObrazek(src, width, height)
{
	width += 25; height += 25;
  var okno = open("", "_blank", "width="+width+",height="+height+",scrollbars");
  okno.document.open();
  okno.document.writeln('<html>');
  okno.document.writeln('<head>');
  okno.document.writeln('<title>Foto</title>');
  okno.document.writeln('<meta http-equiv="imagetoolbar" content="no" />');
  okno.document.writeln('</head>');
  okno.document.writeln('<body style="margin: 0px; padding: 0px;">');
  okno.document.writeln('<img alt="" src="'+src+'" />');
  okno.document.writeln('</body>');
  okno.document.writeln('</html>');
  okno.document.close();
  return false;
}



/* form najdi */



function udalostNajdiOdeslat(form)
{
	if(form.najdi && form.najdi.value == "")
	{
		alert("Nejdříve zadejte hledaný text.");
		form.najdi.focus();
		return false;
	}
	return true;
}



/* administrace */



function nastavHodnotu(id, v)
{
 if(document.getElementById)
 {
  var obj = document.getElementById(id);
  if(obj)
  {
   obj.value = v;
  }
 }
}

function ziskejHodnotu(id)
{
 if(document.getElementById)
 {
  var obj = document.getElementById(id);
  if(obj)
  {
  	var v = obj.value;
  	var f = parseFloat(v.replace(/,/,'.'));
		if(f != 0)
  	{
  		v = f;
		}
		return v;
  }
 }
 return false;
}

