var obraz=null;
function zvetsi(base,cesta,titul,alt,x,y,jazyk) {
	var sb="no";
	if (x>(screen.width-50)) {
		x=(screen.width-50);
		sb="yes";
	}
	if (y>(screen.height-50)) {
		y=(screen.height-50);
		sb="yes";
	}
	var winl = (screen.width-x)/2;
	var wint = (screen.height-y)/2;
	obraz=window.open(base+"zvetsi_nav.php?nazev="+titul+"&cesta="+cesta+"&alt="+alt+"&jazyk="+jazyk, "obraz", "width="+(x)+", height="+(y)+", top="+wint+", left="+winl+", menubar=no, directories=no, toolbar=no, location=no, status=no, scrollbars="+sb+", resizable=yes");
	obraz.window.focus();
}

function show(id) {
  var item = get_id_object(id);
  if(get_id_object(id + "_checkbox").checked) {
    item.style.display = 'inline';
  } else {
    item.style.display = 'none';
  }
}


//vrací objekt podle id podle dostupnosti kolekcí
function get_id_object(object_name)
{
 var html_object;
 if (document.all) {
  html_object = document.all[object_name];
 }
 else if (document.getElementById(object_name)) {
  html_object = document.getElementById(object_name);
 }
 return html_object;
}

function text_length(max, id_inp, id_div) {
  var actual = document.getElementById(id_inp).value.length;
  var remain = max - actual;
  
  if(remain > 0) document.getElementById(id_div).innerHTML = remain;
  else {
    document.getElementById(id_inp).value = document.getElementById(id_inp).value.substring(0,max-1);
    document.getElementById(id_div).innerHTML = "0";
  }
}

function text_length_init(id_val,id_result,max) {
  var size = document.getElementById(id_val).value.length;
  document.getElementById(id_result).innerHTML = max - size;
}