// skript na plovouci logo
var krok, pocitadlo, poc_limit, smer_h, smer_v, x, y;
var maxx, maxy, minx, miny;
var timer_logo;

function get_element(eid)
{
  var obj = new Object;
//  if (document.all)
//    obj = eval("document.all."+eid);
//  else
    obj = document.getElementById(eid);
  return obj;
}

function winH() {
// vrací aktuální výsku okna
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlízeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. rezimu - Opera a Mozilla
      jiz uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starsí MSIE + MSIE6 v quirk rezimu */
      return document.body.clientHeight;
   else
      return null;
}

function winW() {
// vrací aktuální sířku okna
   if (window.innerWidth)
      /* NN4 a kompatibilní prohlízeče */
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth)
      /* MSIE6 v std. rezimu - Opera a Mozilla
      jiz uspěly s window.innerWidth */
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      /* starsí MSIE + MSIE6 v quirk rezimu */
      return document.body.clientWidth;
   else
      return null;
}

function startuj()
// nastavi promenne pro pohyb loga
{
  krok = 1;
  pocitadlo = 1;
  poc_limit = 3000;
  smer_h = 1;
  smer_v = 1;
  x = 10;
  y = 5;
  maxx = winW() - 130;
  maxy = winH() - 100;
  minx = 10;
  miny = 5;
  get_element("zastavit").style.visibility="visible";
  timer_logo = setInterval("posun()",20);
}

function posun()
// posunuje logo po obrazovce
{
  if (x>maxx)
    smer_h = -1;
  if (x<minx)
    smer_h = 1;
  if (y>maxy)  
    smer_v = -1;
  if (y<miny)
    smer_v = 1;
  x += smer_h*krok;
  y += smer_v*krok;
  if (pocitadlo++ > poc_limit)
  {
    pocitadlo = 1;
    krok++;
  }
  get_element("logo").style.left=x+"px";
  get_element("logo").style.top=y+"px";
}

function zastav()
{
  clearInterval(timer_logo);
  get_element("logo").style.left="10px";
  get_element("logo").style.top="5px";
  get_element("zastavit").style.visibility="hidden";
  // pro jistotu se nastavi souradnice na puvodni misto a vynuluje krok
  x = 10;
  y = 5;
  smer_h = 0;
  smer_v = 0;
}
