function resize_fotky_box(i_box, nova_vyska)
  {
  //alert("Stara: " + fotky_box_vyska[i_box] + ", nova: " + nova_vyska);
  var rozdil_vysek = nova_vyska - fotky_box_vyska[i_box];
  //alert(rozdil_vysek);
  if (rozdil_vysek != 0)
    {
    document.getElementById("foto_box_" + i_box).style.height = ( fotky_box_vyska[i_box] + Math.round(rozdil_vysek/6) ) + "px";
    
    setTimeout("document.getElementById('foto_box_" + i_box + "').style.height='" + ( fotky_box_vyska[i_box] + Math.round(rozdil_vysek/4) ) + "px';", 80);
    setTimeout("document.getElementById('foto_box_" + i_box + "').style.height='" + ( fotky_box_vyska[i_box] + Math.round(rozdil_vysek/2) ) + "px';", 150);
    setTimeout("document.getElementById('foto_box_" + i_box + "').style.height='" + ( nova_vyska ) + "px';", 230);
    }
  //document.getElementById("foto_box_" + i_box).style.height = nova_vyska + "px";
  fotky_box_vyska[i_box] = nova_vyska;
  }
    
function show_foto(i_fotka, i_box)
  {
  fotky_box_fotka[i_box] = i_fotka;
  i_fotka = fotky_array[i_box][i_fotka];
  document.getElementById("foto_nazev_" + i_box).innerHTML = fotky[i_fotka][1];
  document.getElementById("foto_popis_" + i_box).innerHTML = fotky[i_fotka][2];
  //document.getElementById("foto_" + i_box).innerHTML       = "<img src=\"" + fotky[i_fotka][0] + "\" alt=\"" + fotky[i_fotka][1] + "\" />";
  document.getElementById("foto_" + i_box).src             = fotky[i_fotka][0];
  var obr_mins = document.getElementById("foto_miniatury_" + i_box).getElementsByTagName("a");
  for (var i = 0; i < obr_mins.length; i++)
    {
    obr_mins[i].className = "";
    }
  document.getElementById("miniatura_" + i_fotka).className = "aktualni";
  document.getElementById("miniatura_" + i_fotka).blur();
  resize_fotky_box(i_box, fotky[i_fotka][3]);
  return false;
  }
  
var pointA      = 0;
var pointB      = 0;
var cursor_last = 0;
var box_last    = 0;

function set_listener()
  {
  //var pointX = Math.round(document.body.clientWidth/2) - 411 + 234 + 54; //levý bod obrázku
  var pointX = Math.round(document.body.clientWidth/2) - 123; //střed obrázku  411 + 234 + 54
  pointA = pointX - 90;
  pointB = pointX + 90;
  }

function view_foto(fotka, i_box)
  {
  fotka = fotky_array[i_box][fotka];
  window.open("http://www.traja.cz" + fotky[fotka][4], "_blank", "width=1024,height=800");
  return false;
  }

function do_mouse(e)
  {
  var fotka = fotky_box_fotka[box_last];
	var posx = 0;
	if (!e) var e = window.event;
	posx = e.clientX;
	if (posx < pointA)
	  {
    //alert ("doleva: " + box_last);
    if (fotka == 0)
       fotka = (fotky_array[box_last].length -1);
    else
       fotka--;
    show_foto(fotka, box_last);
    }
  else if (posx > pointB)
    {
    if (fotka == (fotky_array[box_last].length -1) )
       fotka = 0;
    else
       fotka++;
    show_foto(fotka, box_last);
    //alert ("doprava: " + box_last);
    }
  else
    {
    view_foto(fotka, box_last);
    }
	
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
  }
  
function set_cursor(cursor_now)
  {
  if (cursor_now == cursor_last)
     return true;
  cursor_last = cursor_now;
  document.images.move_left.style.visibility = "hidden";
  document.images.move_right.style.visibility = "hidden";
  document.images.move_zoom.style.visibility = "hidden";
  if (cursor_now)
     document.images[cursor_now].style.visibility = "visible";
  }
  
function listen_mouse(e, objekt, img)
  {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	posx = e.clientX;
	posy = document.documentElement.scrollTop + e.clientY -10;
	objekt.style.cursor = "Pointer";
	if (posx < pointA)
	  {
    set_cursor("move_left");
    //document.images.move_left.style.left       = 0 + "px";
    document.images.move_left.style.top        = posy + "px";
    //objekt.title        = "Předchozí obrázek";
    }
  else if (posx > pointB)
    {
    set_cursor("move_right");
    //document.images.move_right.style.left       = posx + "px";
    document.images.move_right.style.top        = posy + "px";
    //objekt.title        = "Následující obrázek";
    }
  else
    {
    set_cursor("move_zoom");
    document.images.move_zoom.style.left       = (posx - pointA + 202) + "px";
    document.images.move_zoom.style.top        = (posy + 24) + "px";
    //objekt.title        = "Zvětšit obrázek";
    }
  if (img != "false")
     box_last = img;
  }
  
function set_default(prvek)
 {
 if (prvek.value == "")
    prvek.value = prvek.defaultValue;
 }
 
function set_empty(prvek)
 {
 if (prvek.value == prvek.defaultValue)
    prvek.value = "";
 }

