function start(stranka)
{
  vytvorAtributyBody ();
}

function reagujNaRolovani ()
{
  schovejVidea(true);
}

function vytvorAtributyBody ()
{
    nastavOvladacUdalosti (window.document, "scroll", reagujNaRolovani);
    nastavOvladacUdalosti (window.document.body, "scroll", reagujNaRolovani);
    // Pro IE 8
    window.onscroll = reagujNaRolovani;
}

function nastavOvladacUdalosti (element, typUdalosti, funkce)
{
  if (element.addEventListener)
	{ // Firefox
		element.addEventListener(typUdalosti, funkce, false);
	}
	else if (element.attachEvent)
	{ // Pro IE6, IE7
		element.attachEvent("on" + typUdalosti, funkce);
	}
	else
	{
		eval ("element.on" + typUdalosti + " = funkce;")
	}
}


/* ukaz obrazek */

function winH() {
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientHeight;
   else
      return null;
}


function getScrollOffset()
{
	if(document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
	if(window.pageYOffset)
		return window.pageYOffset;
	return document.body.scrollTop;
}

/*
function ukaz_obrazek(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; cursor: pointer;" onclick="window.close();">');
  okno.document.writeln('<img alt="" src="'+src+'" />');
  okno.document.writeln('</body>');
  okno.document.writeln('</html>');
  okno.document.close();
  return false;
}
*/

function ukaz_obrazek(nazevObrazku)
{
 	if(document.getElementById)
 	{
 		var obj = document.getElementById('detailImg');
 		if(obj)
 		{
 			obj.src = nazevObrazku;
		}
  	obj = document.getElementById('imgBlock');
  	if(obj)
  	{
   		obj.style.visibility = "visible";
   		obj.style.height = (winH())+'px';
   	}
   	obj = document.getElementById('imgBlock');
  	if(obj)
  	{
   		obj.style.top = getScrollOffset()+'px';
  	}
   		obj = document.getElementById('movieFlash');
  	if(obj)
  	{
   		obj.style.visibility = 'hidden';
   	}
   	upravFlashPrvky ("div",'movieFlash',true);
   	upravFlashPrvky ("span",'movieFlash',true);
   	schovejVidea(false);

   	/* přepni obrázek */
   	generujTlacitka(nazevObrazku);
 	}
 return false;
}

function upravFlashPrvky (tag,cssTrida,schovej)
{
  var prvky = document.getElementsByTagName(tag);
  var nazevTridy = new RegExp (cssTrida);
  if(prvky.length > 0)
  {
    for (i=0;i<prvky.length;i++)
    {
       if(prvky[i].className)
       {
          if(nazevTridy.test(prvky[i].className))
          {
            prvky[i].style.visibility = schovej ? 'hidden' : 'visible';
          }
       }
    }
  }
}


function schovejObrazek()
{
	var obj = document.getElementById('detailImg');
 		if(obj)
 			{
 				obj.src = 'style/free.gif';
			}
	
	var obj = document.getElementById('imgBlock');
  if(obj)
  {
   		obj.style.visibility = "hidden";
  }
  obj = document.getElementById('movieFlash');
  	if(obj)
  		{
   		obj.style.visibility = 'visible';
   		}
  
  upravFlashPrvky ("div",'movieFlash',false);
  upravFlashPrvky ("span",'movieFlash',false);
  ukazVidea();
	return false;
}

function schovejVidea(znovu_spustit)
{
	if(document.getElementsByTagName)
	{
		var pole_span = document.getElementsByTagName("span");
		if(pole_span.length <= 0)
		{
      return false;
    }
		for (indexSpanu in pole_span)
		{
		  if(pole_span[indexSpanu] && pole_span[indexSpanu].className=='mediaPlayer')
		  {
        pole_span[indexSpanu].style.visibility = "hidden";
		  }
		}
		
		if(znovu_spustit)
		{
		  window.setTimeout("ukazVidea()", 2000);
		}
	}
}

function ukazVidea()
{
	if(document.getElementsByTagName)
	{
		var pole_span = document.getElementsByTagName("span");
		if(pole_span.length <= 0)
		{
      return false;
    }
		for (indexSpanu in pole_span)
		{
		  if(pole_span[indexSpanu] && pole_span[indexSpanu].className=='mediaPlayer')
		  {
        pole_span[indexSpanu].style.visibility = "visible";
		  }
		}
	}
}
